| Line | |
|---|
| 1 | #version 150 |
|---|
| 2 | |
|---|
| 3 | mat2x4 blendTwoWeightsAntipod(vec4 blendWgt, vec4 blendIdx, vec4 dualQuaternions[24]); |
|---|
| 4 | vec3 calculateBlendPosition(vec3 position, mat2x4 blendDQ); |
|---|
| 5 | |
|---|
| 6 | uniform vec4 worldDualQuaternion2x4Array[24]; |
|---|
| 7 | uniform vec4 scaleM[72]; |
|---|
| 8 | uniform mat4 viewProjectionMatrix; |
|---|
| 9 | uniform vec4 ambient; |
|---|
| 10 | |
|---|
| 11 | in vec4 vertex; |
|---|
| 12 | in vec4 blendIndices; |
|---|
| 13 | in vec4 blendWeights; |
|---|
| 14 | |
|---|
| 15 | out vec4 ambientColour; |
|---|
| 16 | |
|---|
| 17 | void main() |
|---|
| 18 | { |
|---|
| 19 | //First phase - applies scaling and shearing: |
|---|
| 20 | int blendIndicesX = int(blendIndices.x) * 3; |
|---|
| 21 | int blendIndicesY = int(blendIndices.y) * 3; |
|---|
| 22 | |
|---|
| 23 | mat3x4 blendS = blendWeights.x*mat3x4(scaleM[blendIndicesX], |
|---|
| 24 | scaleM[blendIndicesX + 1], scaleM[blendIndicesX + 2]); |
|---|
| 25 | |
|---|
| 26 | blendS += blendWeights.y*mat3x4(scaleM[blendIndicesY], |
|---|
| 27 | scaleM[blendIndicesY + 1], scaleM[blendIndicesY + 2]); |
|---|
| 28 | |
|---|
| 29 | mat4x3 blendF = transpose(blendS); |
|---|
| 30 | |
|---|
| 31 | vec3 pass1_position = blendF * vertex; |
|---|
| 32 | |
|---|
| 33 | //Second phase |
|---|
| 34 | mat2x4 blendDQ = blendTwoWeightsAntipod(blendWeights, blendIndices, worldDualQuaternion2x4Array); |
|---|
| 35 | |
|---|
| 36 | blendDQ /= length(blendDQ[0]); |
|---|
| 37 | |
|---|
| 38 | vec3 blendPosition = calculateBlendPosition(pass1_position, blendDQ); |
|---|
| 39 | |
|---|
| 40 | gl_Position = viewProjectionMatrix * vec4(blendPosition, 1.0); |
|---|
| 41 | |
|---|
| 42 | ambientColour = ambient; |
|---|
| 43 | } |
|---|
| 44 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.