Files
clientdata_OLD/vertex_program/modules/dot3.inc
T
2018-04-24 13:27:52 -04:00

29 lines
805 B
PHP
Executable File

// ======================================================================
// inputs:
//
// none
//
// outputs:
//
// oT0 = texture coordinate for NRML map
// oT1 = directon to light (packed into 0..1 range)
//
// ======================================================================
// ----------------------------------------------------------------------
// transform the light direction into texture space, pack into 0..1 range
mov r0.xyz, vTextureCoordinateSetDOT3
mov r2.xyz, vNormal
dp3 r2.w, r2, r2
rsq r2.w, r2.w
mul r2.xyz, r2,r2.w
mul r1.xyz, r2.zxy, r0.yzx
mad r1.xyz, r2.yzx, r0.zxy, -r1.xyz
mul r1.xyz, r1, vTextureCoordinateSetDOT3.w
m3x3 r0.xyz, cLightData_dot3_0_direction, r0
mad oT0.xyz, r0, c0_5, c0_5
mov oT1, vTextureCoordinateSetNRML