vs_2_0 dcl_position v0 dcl_normal v1 dcl_texcoord0 v3 dcl_texcoord6 v14 dcl_texcoord7 v15 #include "../../VertexShader.h" ;------------------------------------------------------------------------------ ; Geometry transform ;------------------------------------------------------------------------------ ; Calculate bone indices mad r7, vIndices, c23.x, c23.y ; Initialize w-coordinate mov r0.w, C_ONE ; Calculate the second bone weight from the first sub r8.x, C_ONE, vWeights.x ; Skin position by bone 0 MOVA a0.x, r7.x m4x3 r0.xyz, vPos, c[a0.x] mul pPos, r0, vWeights.x ; Skin position by bone 1 MOVA a0.x, r7.y m4x3 r0.xyz, vPos, c[a0.x] mad pPos, r0, r8.x, pPos ; Skin normal by bone 0 MOVA a0.x, r7.x m3x3 pNormal.xyz, vNormal, c[a0.x] NormalizeVector(pNormal) ; Transform skinned position to projection space m4x4 OPOS, pPos, C_PROJECTION_MATRIX FIXUP_OPOS #include "..\..\VertexShader.h" ;------------------------------------------------------------------------------ ; Defines ;------------------------------------------------------------------------------ #define C_EYE_POSITION c10 ;------------------------------------------------------------------------------ ; Diffuse color ;------------------------------------------------------------------------------ ; Compute the normalized vertex to eye vector add rVertexToEye, C_EYE_POSITION, -pPos NormalizeVector(rVertexToEye) ; Dot with vertex normal and take absolute value dp3 rLightCoeff.x, pNormal, rVertexToEye max rLightCoeff.x, rLightCoeff.x, -rLightCoeff.x sub rLightCoeff.x, C_ONE, rLightCoeff.x ; Square the coefficient to emphasize the effect (needed?) mul rLightCoeff.x, rLightCoeff.x, rLightCoeff.x ; Modulate with constant diffuse color mul oD0.rgb, rLightCoeff.x, C_MATERIAL_COLOR mov oD0.a, C_MATERIAL_COLOR #include "..\..\VertexShader.h" ;------------------------------------------------------------------------------ ; Fog calculation ;------------------------------------------------------------------------------ ; Calculate fog factor and copy to fog register CalculateLayeredFog(pPos, oFog) #include "..\..\VertexShader.h" ;------------------------------------------------------------------------------ ; Texture coordinates ;------------------------------------------------------------------------------ ; Scale and offset the base texture coordinates mov r0, c12 mul r0, r0, C_TEXCOORD_DECOMPRESS mad oT0, vTexCoords, r0, c13