#include "VertexShader.h" #define C_BILLBOARD_X c10 #define C_BILLBOARD_Y c14 #define C_THRESHOLD c17 ;------------------------------------------------------------------------------ ; Vertex transformation ;------------------------------------------------------------------------------ ; Transform to projection space m4x4 r0, vPos, C_PROJECTION_MATRIX ; Add in the appropriate billboard vectors ; (These are already transformed into projection space) mad r7, vScale.x, C_BILLBOARD_X, r0 mad r7, vScale.y, C_BILLBOARD_Y, r7 mov OPOS, r7 FIXUP_OPOS ;------------------------------------------------------------------------------ ; Lighting calculation ;------------------------------------------------------------------------------ #ifdef _XBOX ; Combine vertex color and material color ; C_THRESHOLD - x = threshold in screen space z ; y = 1/znorm ; z = 1/threshold ; create a vertex position in the center of the screen (?) max r7.xyz, vScale.xyz, -vScale.xyz mul r7.xyz, r7.xyz, C_BILLBOARD_X ; convert to screenspace extent mul r7.xyz, r7, c49 rcc r7.w, r7.w mul r7.xyz, r7, r7.w mov r5, r7 slt r4, r5, C_THRESHOLD.x sge r5, r5, C_THRESHOLD.x mul r5.w, r5.x, C_THRESHOLD.z sub r6.w, C_THRESHOLD.w, r7.x mad r4.w, r5.w, r6.w, r4.x mov r4.xyz, C_ONE mul r5, r4, vDiffuse mul oD0, r5, C_MATERIAL_COLOR #else ; Combine vertex color and material color mul oD0, vDiffuse, C_MATERIAL_COLOR #endif ;------------------------------------------------------------------------------ ; Fog calculation ;------------------------------------------------------------------------------ CalculateLayeredFog(vPos, oFog) ;------------------------------------------------------------------------------ ; Texture coordinates ;------------------------------------------------------------------------------ ; Copy base tex coords mov oT0.xy, vTexCoords