Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/GLSL120/DualQuaternion_TwoPhaseShadowCaster.glsl @ 12412

Last change on this file since 12412 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
RevLine 
[12115]1#version 120
2
3mat2x4 blendTwoWeightsAntipod(vec4 blendWgt, vec4 blendIdx, vec4 dualQuaternions[48]);
4vec3 calculateBlendPosition(vec3 position, mat2x4 blendDQ);
5
6uniform vec4 worldDualQuaternion2x4Array[48];
7uniform vec4 scaleM[72];
8uniform mat4 viewProjectionMatrix;
9uniform vec4   ambient;
10
11attribute vec4 vertex;
12attribute vec4 blendIndices;
13attribute vec4 blendWeights;
14
15varying vec4 colour;
16
17//Shadow caster pass
18void 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.