Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 35 | chris | 1 | !!ARBvp1.0 |
| 2 | |||
| 3 | |||
| 4 | # Purpose: |
||
| 5 | |||
| 6 | |||
| 7 | # Input Parameters: |
||
| 8 | # TexCoord0: Particle texture. |
||
| 9 | # TexCoord1: Corner point of particle. |
||
| 10 | # xy: Particle corner. x and y have to be -1 or 1. |
||
| 11 | # TexCoord2: Particle options. |
||
| 12 | # xy: Up vector |
||
| 13 | # z: Particle size. |
||
| 14 | |||
| 15 | |||
| 16 | # Constants |
||
| 17 | PARAM ModelViewProj[4] = { state.matrix.mvp }; |
||
| 18 | |||
| 19 | |||
| 20 | TEMP vertexpos; |
||
| 21 | TEMP offsetvector, offsetlength, rightvector; |
||
| 22 | |||
| 23 | # Move vertex to corner position. |
||
| 24 | MUL offsetlength, vertex.texcoord[2].xyxx, vertex.texcoord[2].z; |
||
| 25 | MUL offsetvector, vertex.texcoord[1].y, offsetlength; |
||
| 26 | ADD vertexpos, offsetvector, vertex.position; |
||
| 27 | |||
| 28 | # Generate normal vector of the up vector. |
||
| 29 | MUL rightvector, vertex.texcoord[2].yxxx, {1.0, -1.0, 0.0, 0.0}; |
||
| 30 | |||
| 31 | MUL offsetlength, rightvector, vertex.texcoord[2].z; |
||
| 32 | MUL offsetvector, vertex.texcoord[1].x, offsetlength; |
||
| 33 | ADD vertexpos, offsetvector, vertexpos; |
||
| 34 | |||
| 35 | MOV vertexpos.zw, {0.0, 0.0, 0.0, 1.0}; |
||
| 36 | |||
| 37 | # Transform into world space. |
||
| 38 | DP4 result.position.x, ModelViewProj[0], vertexpos; |
||
| 39 | DP4 result.position.y, ModelViewProj[1], vertexpos; |
||
| 40 | DP4 result.position.z, ModelViewProj[2], vertexpos; |
||
| 41 | DP4 result.position.w, ModelViewProj[3], vertexpos; |
||
| 42 | |||
| 43 | MOV result.texcoord[0], vertex.texcoord[0]; |
||
| 44 | MOV result.color, vertex.color; |
||
| 45 | |||
| 46 | END |