vs_2_0 dcl_position v0 dcl_normal v1 dcl_texcoord0 v3 dcl_tangent v7 dcl_binormal v8 dcl_texcoord4 v9 #include "..\..\VertexShader.h" ;------------------------------------------------------------------------------ ; Geometry transform ;------------------------------------------------------------------------------ ; Copy model-space geometry to pipeline registers mov pPos, vPos mov pNormal, vNormal ; Copy model-space basis vectors to pipeline registers mov pBasisU, vBasisU mov pBasisV, vBasisV ; Transform position to projection space m4x4 OPOS, vPos, C_PROJECTION_MATRIX FIXUP_OPOS #include "..\..\VertexShader.h" ;------------------------------------------------------------------------------ ; Diffuse color ;------------------------------------------------------------------------------ ; Initialize diffuse color mov oD0, C_MATERIAL_COLOR #include "..\..\VertexShader.h" ;------------------------------------------------------------------------------ ; Fog calculation ;------------------------------------------------------------------------------ #include "..\..\VertexShader.h" ;------------------------------------------------------------------------------ ; Defines ;------------------------------------------------------------------------------ #define C_LIGHT_POSITION c10 #define C_LIGHT_ATTEN c11 #define C_LIGHT_DIRECTION c12 #define C_LIGHT_CONE c13 ;------------------------------------------------------------------------------ ; Texture coordinates ;------------------------------------------------------------------------------ ; Base texture is the normal map mul oT0.xy, vTexCoords, C_TEXCOORD_DECOMPRESS ; Transform L vector into texture space and store as a texture stage add rVertexToLight, C_LIGHT_POSITION, -pPos dp3 oT1.x, rVertexToLight, pBasisU dp3 oT1.y, rVertexToLight, pBasisV dp3 oT1.z, rVertexToLight, pNormal ; Store per-vertex light attenuation in diffuse alpha dp3 rTemp.w, rVertexToLight, rVertexToLight /* Calc light vector */ rsq rVertexToLight.w, rTemp.w dst rTemp, rTemp.wwww, rVertexToLight.wwww /* Calc attenuation */ dp3 rTemp.w, rTemp, C_LIGHT_ATTEN rcp rLightCoeff.x, rTemp.w mul rVertexToLight.xyz, rVertexToLight, rVertexToLight.w /* Normalize light vector */ dp3 rTemp.w, rVertexToLight, -C_LIGHT_DIRECTION /* Scale by spotlight cone */ mad rTemp.w, rTemp.w, C_LIGHT_CONE.x, C_LIGHT_CONE.y mul oD0.a, rLightCoeff.x, rTemp.w