#include "..\..\VertexShader.h" ;------------------------------------------------------------------------------ ; Defines ;------------------------------------------------------------------------------ #define C_LIGHT_POSITION c10 #define C_LIGHT_ATTEN c11 ;------------------------------------------------------------------------------ ; 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 oD0.a, rTemp.w