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.

31 lines
737 B

  1. ps.1.4
  2. ; Get the 3-vector from the normal map
  3. texld r0, t0
  4. ; Get environment matrix
  5. texcrd r1.rgb, t1
  6. texcrd r2.rgb, t2
  7. texcrd r3.rgb, t3
  8. ; Normalize eye-ray vector through normalizer cube map
  9. texld r4, t4 ; <---- CUBE MAP here!!!
  10. ; Transform normal
  11. dp3 r5.r, r1, r0_bx2
  12. dp3 r5.g, r2, r0_bx2
  13. dp3 r5.b, r3, r0_bx2
  14. ; Reflection calculatiom
  15. dp3_x2 r3.rgb, r5, r4_bx2 ; 2(N.Eye)
  16. mul r3.rgb, r5, r3 ; 2N(N.Eye)
  17. dp3 r2.rgb, r5, r5 ; N.N
  18. mad r2.rgb, -r4_bx2, r2, r3 ; 2N(N.Eye) - Eye(N.N)
  19. phase
  20. ; Sample environment map
  21. texld r3, r2
  22. ; multiply color by reflecttint
  23. mul r0, r3, c1
  24. ; blend between reflected color and fog color based on constant factor
  25. lrp r0.rgb, c1.a, r0, c0