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.

39 lines
1022 B

  1. ;------------------------------------------------------------------------------
  2. ; Computes the diffuse component of lighting using lightmap + bumpmap
  3. ; t0 - Normalmap
  4. ; t1 - Lightmap1
  5. ; t2 - Lightmap2
  6. ; t3 - Lightmap3
  7. ; t4 - Base
  8. ;
  9. ; The texture coordinates need to be defined as follows:
  10. ; tc0 - Normalmap and lightmap texture coordinates
  11. ; c0, c1, c2 - Axes of the lightmap coordinate system in tangent space
  12. ;------------------------------------------------------------------------------
  13. ps.1.4
  14. ; Get the 3-vector from the normal map
  15. texld r0, t0
  16. ; Sample the lightmaps
  17. texld r1, t1
  18. texld r2, t2
  19. texld r3, t3
  20. ; Sample the base texture
  21. texld r4, t4
  22. ; output = (lightmapColor[0] * ( ( N dot basis[0] )^2 ) +
  23. ; lightmapColor[1] * ( ( N dot basis[1] )^2 ) +
  24. ; lightmapColor[2] * ( ( N dot basis[2] )^2 ) ) * base
  25. dp3 r5.r, r0_bx2, c0
  26. dp3 r5.g, r0_bx2, c1
  27. dp3 r5.b, r0_bx2, c2
  28. mul r5.rgb, r5, r5
  29. mul r1, r1, r5.r
  30. mad r1, r2, r5.g, r1
  31. mad r1, r3, r5.g, r1
  32. ; assume overbright_2 !!!
  33. mul_x2 r0, r1, r4