Last change
on this file since 12202 was
12115,
checked in by wiesep, 6 years ago
|
Changed folder structure, deletet some unused files and cleaned up code
|
File size:
1.2 KB
|
Rev | Line | |
---|
[12115] | 1 | #version 120 |
---|
| 2 | |
---|
| 3 | mat2x4 blendTwoWeightsAntipod(vec4 blendWgt, vec4 blendIdx, vec4 dualQuaternions[48]); |
---|
| 4 | vec3 calculateBlendPosition(vec3 position, mat2x4 blendDQ); |
---|
| 5 | |
---|
| 6 | uniform vec4 worldDualQuaternion2x4Array[48]; |
---|
| 7 | uniform vec4 scaleM[72]; |
---|
| 8 | uniform mat4 viewProjectionMatrix; |
---|
| 9 | uniform vec4 ambient; |
---|
| 10 | |
---|
| 11 | attribute vec4 vertex; |
---|
| 12 | attribute vec4 blendIndices; |
---|
| 13 | attribute vec4 blendWeights; |
---|
| 14 | |
---|
| 15 | varying vec4 colour; |
---|
| 16 | |
---|
| 17 | //Shadow caster pass |
---|
| 18 | void main() |
---|
| 19 | { |
---|
| 20 | //First phase - applies scaling and shearing: |
---|
| 21 | int blendIndicesX = int(blendIndices.x) * 3; |
---|
| 22 | int blendIndicesY = int(blendIndices.y) * 3; |
---|
| 23 | |
---|
| 24 | mat3x4 blendS = blendWeights.x*mat3x4(scaleM[blendIndicesX], |
---|
| 25 | scaleM[blendIndicesX + 1], scaleM[blendIndicesX + 2]); |
---|
| 26 | |
---|
| 27 | blendS += blendWeights.y*mat3x4(scaleM[blendIndicesY], 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 | gl_FrontColor = ambient; |
---|
| 43 | } |
---|
| 44 | |
---|
Note: See
TracBrowser
for help on using the repository browser.