Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.7 KiB

  1. vs.1.1
  2. # DYNAMIC: "DOWATERFOG" "0..1"
  3. # DYNAMIC: "SKINNING" "0..1"
  4. ;------------------------------------------------------------------------------
  5. ; Shader specific constant:
  6. ; $SHADER_SPECIFIC_CONST_5 = [sOffset, tOffset, 0, 0]
  7. ;------------------------------------------------------------------------------
  8. #include "macros.vsh"
  9. ;------------------------------------------------------------------------------
  10. ; Vertex blending
  11. ;------------------------------------------------------------------------------
  12. &AllocateRegister( \$worldPos );
  13. &AllocateRegister( \$worldNormal );
  14. &AllocateRegister( \$worldTangentS );
  15. &AllocateRegister( \$worldTangentT );
  16. &SkinPositionNormalAndTangentSpace( $worldPos, $worldNormal,
  17. $worldTangentS, $worldTangentT );
  18. ;------------------------------------------------------------------------------
  19. ; Transform the position from world to proj space
  20. ;------------------------------------------------------------------------------
  21. &AllocateRegister( \$projPos );
  22. dp4 $projPos.x, $worldPos, $cViewProj0
  23. dp4 $projPos.y, $worldPos, $cViewProj1
  24. dp4 $projPos.z, $worldPos, $cViewProj2
  25. dp4 $projPos.w, $worldPos, $cViewProj3
  26. mov oPos, $projPos
  27. ;------------------------------------------------------------------------------
  28. ; Fog
  29. ;------------------------------------------------------------------------------
  30. &CalcFog( $worldPos, $projPos );
  31. &FreeRegister( \$projPos );
  32. ;------------------------------------------------------------------------------
  33. ; Lighting
  34. ;------------------------------------------------------------------------------
  35. ; Transform tangent space basis vectors to env map space (world space)
  36. ; This will produce a set of vectors mapping from tangent space to env space
  37. ; We'll use this to transform normals from the normal map from tangent space
  38. ; to environment map space.
  39. ; NOTE: use dp3 here since the basis vectors are vectors, not points
  40. ; svect
  41. mov oT1.x, $worldTangentS.x
  42. mov oT2.x, $worldTangentS.y
  43. mov oT3.x, $worldTangentS.z
  44. &FreeRegister( \$worldTangentS );
  45. ; tvect
  46. mov oT1.y, $worldTangentT.x
  47. mov oT2.y, $worldTangentT.y
  48. mov oT3.y, $worldTangentT.z
  49. &FreeRegister( \$worldTangentT );
  50. ; normal
  51. mov oT1.z, $worldNormal.x
  52. mov oT2.z, $worldNormal.y
  53. mov oT3.z, $worldNormal.z
  54. &FreeRegister( \$worldNormal );
  55. ; Compute the vector from vertex to camera
  56. &AllocateRegister( \$eyeVector );
  57. sub $eyeVector.xyz, $cEyePos, $worldPos
  58. &FreeRegister( \$worldPos );
  59. ; eye vector
  60. mov oT4.xyz, $eyeVector
  61. &FreeRegister( \$eyeVector );
  62. ;------------------------------------------------------------------------------
  63. ; Texture coordinates
  64. ;------------------------------------------------------------------------------
  65. dp4 oT0.x, $vTexCoord0, $SHADER_SPECIFIC_CONST_4
  66. dp4 oT0.y, $vTexCoord0, $SHADER_SPECIFIC_CONST_5