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.

43 lines
1.0 KiB

  1. ps.1.1
  2. ;------------------------------------------------------------------------------
  3. ; Computes the diffuse component of lighting using lightmap + bumpmap
  4. ; t0 - Normalmap
  5. ; t1 - Lightmap1
  6. ; t2 - Lightmap2
  7. ; t3 - Lightmap3
  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. ; c3 = a
  13. ; c4 = b
  14. ; c5 = c in a quadratic approx to pow( 1/2.2 )
  15. ;------------------------------------------------------------------------------
  16. ; Get the 3-vector from the normal map
  17. tex t0
  18. ; Sample the lightmaps
  19. tex t1
  20. tex t2
  21. tex t3
  22. ; Compute the dot product of axis 1 and the normal
  23. dp3_sat r1, t0_bx2, c0
  24. ; Modulate the lightmap color by N dot Axis 1
  25. mul r0, t1, r1
  26. ; Do the same for the other two axes
  27. dp3_sat r1, t0_bx2, c1
  28. mad r0, r1, t2, r0
  29. dp3_sat r1, t0_bx2, c2
  30. mad r0, r1, t3, r0
  31. ; Do quadratic approximation to pow( x, 1 / 2.2 )
  32. ;mad r1, c3, r0, c4 ; r1 = a*x + b
  33. ;mad_x4_sat r0, r1, r0, c5 ; r0 = r1*x + c = a*x*x + b*x + c