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.

79 lines
1.8 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. ;------------------------------------------------------------------------------
  13. ; Get the 3-vector from the normal map
  14. tex t0
  15. ; Sample the lightmaps
  16. tex t1
  17. tex t2
  18. tex t3
  19. ; output = lightmapColor[0] * ( ( N dot basis[0] )^2 ) +
  20. ; lightmapColor[1] * ( ( N dot basis[1] )^2 ) +
  21. ; lightmapColor[2] * ( ( N dot basis[2] )^2 ) +
  22. ; r0 = ( N dot basis[0] )
  23. ; don't "_sat" here so that everything adds up to one even if the normal is outside of the basis!!!!!
  24. dp3 r0, t0_bx2, c0
  25. ; r1 = ( N dot basis[1] )
  26. dp3 r1, t0_bx2, c1
  27. ;----
  28. ; r0 = ( N dot basis[0] )
  29. ; r1 = ( N dot basis[1] )
  30. ;----
  31. ; r0.rgb = ( N dot basis[0] )^2
  32. mul r0.rgb, r0, r0
  33. ; r1.a = ( N dot basis[1] )^2
  34. +mul r1.a, r1, r1
  35. ;----
  36. ; r0.rgb = ( N dot basis[0] )^2
  37. ; r1.a = ( N dot basis[1] )^2
  38. ;----
  39. mul t1, r0, t1
  40. ;----
  41. ; r1.a = ( N dot basis[1] )^2
  42. ; t1 = lightmapColor[0] * ( N dot basis[0] )^2
  43. ;----
  44. dp3 r0, t0_bx2, c2
  45. ;----
  46. ; r1.a = ( N dot basis[1] )^2
  47. ; t1 = lightmapColor[0] * ( N dot basis[0] )^2
  48. ; r0 = ( N dot basis[2] )
  49. ;----
  50. mad t1.rgb, r1.a, t2, t1
  51. +mul r0.a, r0, r0
  52. ;----
  53. ; t1.rgb = lightmapColor[0] * ( N dot basis[0] )^2 + lightmapColor[1] * ( N dot basis[1] )^2
  54. ; r0.a = ( N dot basis[2] )^2
  55. ;----
  56. mad r0.rgba, r0.a, t3, t1
  57. ;----
  58. ; r0.rgb = lightmapColor[0] * ( N dot basis[0] )^2 +
  59. ; lightmapColor[1] * ( N dot basis[1] )^2 +
  60. ; lightmapColor[2] * ( N dot basis[2] )^2
  61. ;----