wave.nvv 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ;
  2. ; Command & Conquer Generals(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. ;////////////////////////////////////////////////////////////////////////////////
  19. ;// //
  20. ;// (c) 2001-2003 Electronic Arts Inc. //
  21. ;// //
  22. ;////////////////////////////////////////////////////////////////////////////////
  23. ; Waves vertex shader
  24. ; Kenny Mitchell April 2001
  25. ; Modified July 2001 Mark Wilczynski
  26. #define CV_ZERO 0
  27. #define CV_ONE 1
  28. #define CV_WORLDVIEWPROJ_0 2
  29. #define CV_WORLDVIEWPROJ_1 3
  30. #define CV_WORLDVIEWPROJ_2 4
  31. #define CV_WORLDVIEWPROJ_3 5
  32. #define CV_TEXPROJ_0 6
  33. #define CV_TEXPROJ_1 7
  34. #define CV_TEXPROJ_2 8
  35. #define CV_TEXPROJ_3 9
  36. #define CV_PATCH_SCALE_OFFSET 10
  37. #define V_POSITION v0
  38. #define V_DIFFUSE v1
  39. #define V_TEXTURE v2
  40. #define V_TEXTURE2 v3
  41. vs.1.1
  42. ; Below is Kenny's new optimized version
  43. ; Transform position to clip space and output it
  44. dp4 r0.x, V_POSITION, c[CV_WORLDVIEWPROJ_0]
  45. dp4 r0.y, V_POSITION, c[CV_WORLDVIEWPROJ_1]
  46. dp4 r0.z, V_POSITION, c[CV_WORLDVIEWPROJ_2]
  47. dp4 r0.w, V_POSITION, c[CV_WORLDVIEWPROJ_3]
  48. mov oPos, r0
  49. ; get 1/w and multiply it onto x and y
  50. rcp r1.w, r0.w
  51. mul r1.xy, r0.xy, r1.w
  52. ; scale/flip/offset tex coords to screen
  53. mad oT1.xy, r1.xy, c[CV_TEXPROJ_0].xy,c[CV_TEXPROJ_0].zw
  54. mov oT0, V_TEXTURE
  55. mov oD0, V_DIFFUSE
  56. #ifdef DO_WATER_ALPHA_TEXTURE
  57. ;generate uv coordinates for a third texture (alpha channel)
  58. mad oT2.xy,v0.xz,c[CV_PATCH_SCALE_OFFSET].zw,c[CV_PATCH_SCALE_OFFSET].xy
  59. #endif