Files
clientdata-1.2/vertex_program/modules/fog_setup.inc
T
2018-04-24 13:27:52 -04:00

26 lines
736 B
PHP
Executable File

// ======================================================================
// inputs:
//
// none
//
// outputs:
//
// r9.xyz = vertex in world space
// r11.xyz = unit vector from vertex to camera
// r11.w = distance squared from vertex to camera
//
// ======================================================================
// ----------------------------------------------------------------------
// transform vertex position into world space
m4x3 r9.xyz, vPosition, cObjectWorldMatrix
// ----------------------------------------------------------------------
// calculate the direction to the viewer
sub r11.xyz, cCameraPosition, r9
dp3 r11.w, r11, r11
rsq r0.w, r11.w
mul r11.xyz, r11, r0.w