2014-04-08 15:44:43 -04:00
|
|
|
layout (std140) uniform MatrixesData
|
|
|
|
{
|
2014-04-08 16:33:44 -04:00
|
|
|
mat4 ViewMatrix;
|
|
|
|
mat4 ProjectionMatrix;
|
|
|
|
mat4 InverseViewMatrix;
|
|
|
|
mat4 InverseProjectionMatrix;
|
|
|
|
mat4 ShadowViewProjMatrixes[4];
|
2014-04-08 15:44:43 -04:00
|
|
|
};
|
2014-02-10 13:28:02 -05:00
|
|
|
|
2014-03-26 17:27:11 -04:00
|
|
|
#if __VERSION__ >= 400
|
|
|
|
layout(triangles, invocations=4) in;
|
|
|
|
#else
|
2014-02-10 13:28:02 -05:00
|
|
|
layout(triangles) in;
|
2014-03-26 17:27:11 -04:00
|
|
|
#endif
|
2014-02-11 15:49:46 -05:00
|
|
|
layout(triangle_strip, max_vertices=12) out;
|
2014-02-10 13:28:02 -05:00
|
|
|
|
|
|
|
in vec2 tc[3];
|
|
|
|
|
|
|
|
out vec2 uv;
|
|
|
|
|
2014-03-26 17:27:11 -04:00
|
|
|
void emitToLayer(int layerId)
|
|
|
|
{
|
|
|
|
gl_Layer = layerId;
|
|
|
|
for(int i=0; i<3; i++)
|
|
|
|
{
|
|
|
|
uv = tc[i];
|
2014-04-08 16:33:44 -04:00
|
|
|
gl_Position = ShadowViewProjMatrixes[layerId] * gl_in[i].gl_Position;
|
2014-03-26 17:27:11 -04:00
|
|
|
EmitVertex();
|
|
|
|
}
|
|
|
|
EndPrimitive();
|
|
|
|
}
|
|
|
|
|
2014-02-10 13:28:02 -05:00
|
|
|
void main(void)
|
|
|
|
{
|
2014-03-26 17:27:11 -04:00
|
|
|
#if __VERSION__ >= 400
|
|
|
|
emitToLayer(gl_InvocationID);
|
|
|
|
#else
|
2014-02-11 15:49:46 -05:00
|
|
|
for (int j = 0; j<4; j++)
|
2014-02-10 13:28:02 -05:00
|
|
|
{
|
2014-03-26 17:27:11 -04:00
|
|
|
emitToLayer(j);
|
2014-02-10 13:28:02 -05:00
|
|
|
}
|
2014-03-26 17:27:11 -04:00
|
|
|
#endif
|
2014-02-10 13:28:02 -05:00
|
|
|
}
|