Trees.nvv 1.2 KB

1234567891011121314151617181920212223242526272829
  1. //vertex shader for grass..
  2. // v0 - Vertex Position
  3. // v1 - Normal vector - used for other fun stuff.
  4. // - v1.x = index for the motion wave data
  5. // - v1.y = color scale factor for darkening.
  6. // - v1.z = z coordinate value of the base of the tree/grass/bush.
  7. // v2 - Diffuse color
  8. // v7 - Vertex Texture Data u,v
  9. // c4-7 - Composite World-View-Projection Matrix
  10. // c8 - Tilt vector.
  11. // c32 - offset for shroud texture mapping
  12. // c33 - scale for shroud texture mapping
  13. vs.1.1
  14. mov r2, v1.wwzw ; move the z value for the tree into r2
  15. sub r2, v0, r2 ; subtract the z from the base coordinate.
  16. mov a0.x, v1 ; get the index for the wave value.
  17. mov r0, c[a0.x+8] ; load the correct wave entry for this tree/grass
  18. mad r1, r2.zzzw,r0,v0 ; multiply the z value by wave value to get the xy skew value for the wave motion
  19. ; and add it to the coordinate value.
  20. m4x4 oPos, r1, c4 ; Transform vertex to screen coords.
  21. mov r2, v1.yyyw ; Get the color scale from v1.y
  22. mul oD0, v2,r2 ; Scale and move diffuse color into color register.
  23. mov oT0, v7 ; Move texture coords into texture register.
  24. add r1, v0, c32 ; offset coordinate
  25. mul oT1, r1, c33 ;