home *** CD-ROM | disk | FTP | other *** search
/ NVIDIA Tech Demo: DAWN / NVIDIA_demo.iso / Dawn.exe / Disk1 / data1.cab / Program_Executable_Files / shaders_ultra / _bkg.vp20 next >
Encoding:
Text File  |  2003-02-11  |  799 b   |  33 lines

  1. // vecMul(matrix, float3) multiplies like a vector instead of point 
  2. // (no translate)
  3. float3 vecMul(const float4x4 matrix, const float3 vec){
  4.   return(float3(dot(vec, matrix._11_12_13),
  5.                 dot(vec, matrix._21_22_23),
  6.                 dot(vec, matrix._31_32_33)));
  7. }
  8.  
  9. struct a2vConnector : application2vertex {
  10.   float4 coord;
  11.   float3 texture;
  12. };
  13.  
  14. struct v2fConnector : vertex2fragment {
  15.   float4 HPOS:HPOS;
  16.   float3 texture:TEX0;
  17. };
  18.  
  19. v2fConnector main(a2vConnector a2v,
  20.                   uniform float4x4 view,
  21.                   uniform float4x4 proj){
  22.   v2fConnector v2f;
  23.  
  24.   float4 eyeCoord;  
  25.   eyeCoord.xyz    = vecMul(view, a2v.coord.xyz);
  26.   eyeCoord.w      = 1.0;
  27.  
  28.   v2f.HPOS    = mul(proj, eyeCoord);
  29.   v2f.texture = a2v.texture;
  30.  
  31.   return v2f;
  32. }
  33.