vs_2_0 dcl_position v0 dcl_normal v1 dcl_texcoord0 v3 #include "..\..\VertexShader.h" ;------------------------------------------------------------------------------ ; Geometry transform ;------------------------------------------------------------------------------ ; Copy model-space geometry to pipeline registers mov pPos, vPos mov pNormal, vNormal ; Transform position to projection space m4x4 OPOS, vPos, 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 alpha mov oD0.rgb, C_MATERIAL_COLOR mul oD0.a, rLightCoeff.x, C_MATERIAL_COLOR #include "..\..\VertexShader.h" ;------------------------------------------------------------------------------ ; Fog calculation ;------------------------------------------------------------------------------ #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