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.

47 lines
1.2 KiB

  1. ps.1.1
  2. ;------------------------------------------------------------------------------
  3. ; Computes the diffuse component of lighting using lightmap + bumpmap
  4. ; t0 - decal texture
  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 - ( ( N dot basis[0] )^2 ), ( ( N dot basis[1] )^2 ), ( ( N dot basis[2] )^2 )
  12. ;------------------------------------------------------------------------------
  13. ; Get the decal color
  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 = lightmapColor[0] * ( ( N dot basis[0] )^2 )
  23. mul r0, t1, c0
  24. ; r0 = lightmapColor[0] * ( ( N dot basis[0] )^2 ) + lightmapColor[1] * ( ( N dot basis[1] )^2 )
  25. mad r0, t2, c1, r0
  26. ; r0 = lightmapColor[0] * ( ( N dot basis[0] )^2 ) +
  27. ; lightmapColor[1] * ( ( N dot basis[1] )^2 ) +
  28. ; lightmapColor[2] * ( ( N dot basis[2] )^2 )
  29. mad r0, t3, c2, r0
  30. ; Modulate by decal texture
  31. mul r0.rgb, r0, t0
  32. + mov r0.a, t0.a
  33. ; Modulate by constant color
  34. mul r0, r0, c3
  35. ; Modulate by per-vertex factor
  36. mul r0, r0, v0