Subversion Repository Public Repository

Divide-Framework

This repository has no backups
This repository's network speed is throttled to 100KB/sec

Diff Revisions 167 vs 168 for /trunk/assets/shaders/GLSL/vertexAtoms/vboInputData.vert

Diff revisions: vs.
  @@ -18,7 +18,17 @@
18 18 vec4 dvd_BoneWeight;
19 19 ivec4 dvd_BoneIndice;
20 20
21 + out vec4 _vertexM;
21 22 out vec2 _texCoord;
23 + out float outClip;
24 +
25 + #if defined(SKIP_HARDWARE_CLIPPING)
26 + out float dvd_ClipDistance[MAX_CLIP_PLANES];
27 + #else
28 + out float gl_ClipDistance[MAX_CLIP_PLANES];
29 + #endif
30 +
31 + uniform int dvd_clip_plane_count;
22 32
23 33 in vec3 inVertexData;
24 34 in vec3 inNormalData;
  @@ -33,6 +43,7 @@
33 43 uniform mat4 dvd_ModelViewMatrix;
34 44 uniform mat4 dvd_ModelViewMatrixInverse;
35 45 uniform mat4 dvd_ModelViewProjectionMatrix;
46 + uniform vec4 dvd_clip_plane[MAX_CLIP_PLANES];
36 47
37 48 layout(std140) uniform dvd_MatrixBlock
38 49 {
  @@ -45,6 +56,62 @@
45 56 // Light _LightSources[MAX_LIGHT_COUNT];
46 57 //};
47 58
59 + void setClipPlanes(){
60 + #if defined(SKIP_HARDWARE_CLIPPING)
61 +
62 + #if MAX_CLIP_PLANES > 0
63 + dvd_ClipDistance[0] = dot(_vertexM, dvd_clip_plane[0]);
64 + # if MAX_CLIP_PLANES > 1
65 + if(dvd_clip_plane_count == 1) return;
66 + dvd_ClipDistance[1] = dot(_vertexM, dvd_clip_plane[1]) ;
67 + # if MAX_CLIP_PLANES > 2
68 + if(dvd_clip_plane_count == 2) return;
69 + dvd_ClipDistance[2] = dot(_vertexM, dvd_clip_plane[2]);
70 + # if MAX_CLIP_PLANES > 3
71 + if(dvd_clip_plane_count == 3) return;
72 + dvd_ClipDistance[3] = dot(_vertexM, dvd_clip_plane[3]);
73 + # if MAX_CLIP_PLANES > 4
74 + if(dvd_clip_plane_count == 4) return;
75 + dvd_ClipDistance[4] = dot(_vertexM, dvd_clip_plane[4]);
76 + # if MAX_CLIP_PLANES > 5
77 + if(dvd_clip_plane_count == 5) return;
78 + dvd_ClipDistance[5] = dot(_vertexM, dvd_clip_plane[5]);
79 + # endif //5
80 + # endif //4
81 + # endif //3
82 + # endif //2
83 + # endif //1
84 + #endif //0
85 +
86 + #else //skip clip planes
87 +
88 + #if MAX_CLIP_PLANES > 0
89 + gl_ClipDistance[0] = dot(_vertexM, dvd_clip_plane[0]);
90 + # if MAX_CLIP_PLANES > 1
91 + if(dvd_clip_plane_count == 1) return;
92 + gl_ClipDistance[1] = dot(_vertexM, dvd_clip_plane[1]) ;
93 + # if MAX_CLIP_PLANES > 2
94 + if(dvd_clip_plane_count == 2) return;
95 + gl_ClipDistance[2] = dot(_vertexM, dvd_clip_plane[2]);
96 + # if MAX_CLIP_PLANES > 3
97 + if(dvd_clip_plane_count == 3) return;
98 + gl_ClipDistance[3] = dot(_vertexM, dvd_clip_plane[3]);
99 + # if MAX_CLIP_PLANES > 4
100 + if(dvd_clip_plane_count == 4) return;
101 + gl_ClipDistance[4] = dot(_vertexM, dvd_clip_plane[4]);
102 + # if MAX_CLIP_PLANES > 5
103 + if(dvd_clip_plane_count == 5) return;
104 + gl_ClipDistance[5] = dot(_vertexM, dvd_clip_plane[5]);
105 + # endif //5
106 + # endif //4
107 + # endif //3
108 + # endif //2
109 + # endif //1
110 + #endif //0
111 +
112 + #endif //skip clip planes
113 + }
114 +
48 115 void computeData(){
49 116
50 117 dvd_Vertex = vec4(inVertexData,1.0);
  @@ -52,6 +119,8 @@
52 119 _texCoord = inTexCoordData;
53 120 dvd_Tangent = inTangentData;
54 121 dvd_BiTangent = inBiTangentData;
122 + _vertexM = dvd_ModelMatrix * dvd_Vertex;
123 + setClipPlanes();
55 124 }
56 125
57 126 void computeBoneData(){