Trees.nvv 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ;
  2. ; Command & Conquer Generals Zero Hour(tm)
  3. ; Copyright 2025 Electronic Arts Inc.
  4. ;
  5. ; This program is free software: you can redistribute it and/or modify
  6. ; it under the terms of the GNU General Public License as published by
  7. ; the Free Software Foundation, either version 3 of the License, or
  8. ; (at your option) any later version.
  9. ;
  10. ; This program is distributed in the hope that it will be useful,
  11. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ; GNU General Public License for more details.
  14. ;
  15. ; You should have received a copy of the GNU General Public License
  16. ; along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. ;
  18. //vertex shader for grass..
  19. // v0 - Vertex Position
  20. // v1 - Normal vector - used for other fun stuff.
  21. // - v1.x = index for the motion wave data
  22. // - v1.y = color scale factor for darkening.
  23. // - v1.z = z coordinate value of the base of the tree/grass/bush.
  24. // v2 - Diffuse color
  25. // v7 - Vertex Texture Data u,v
  26. // c4-7 - Composite World-View-Projection Matrix
  27. // c8 - Tilt vector.
  28. // c32 - offset for shroud texture mapping
  29. // c33 - scale for shroud texture mapping
  30. vs.1.1
  31. mov r2, v1.wwzw ; move the z value for the tree into r2
  32. sub r2, v0, r2 ; subtract the z from the base coordinate.
  33. mov a0.x, v1 ; get the index for the wave value.
  34. mov r0, c[a0.x+8] ; load the correct wave entry for this tree/grass
  35. mad r1, r2.zzzw,r0,v0 ; multiply the z value by wave value to get the xy skew value for the wave motion
  36. ; and add it to the coordinate value.
  37. m4x4 oPos, r1, c4 ; Transform vertex to screen coords.
  38. mov r2, v1.yyyw ; Get the color scale from v1.y
  39. mul oD0, v2,r2 ; Scale and move diffuse color into color register.
  40. mov oT0, v7 ; Move texture coords into texture register.
  41. add r1, v0, c32 ; offset coordinate
  42. mul oT1, r1, c33 ;