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