Replace explicit matrix uniforms with single ubo

This commit is contained in:
2021-06-24 17:58:15 +02:00
parent 7ab932db93
commit 97598bc171
26 changed files with 39 additions and 174 deletions
+10 -12
View File
@@ -1,11 +1,9 @@
#version 430 core
layout (points) in;
layout (triangle_strip, max_vertices = 11) out;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
uniform vec2 lightPos;
uniform mat4 worldMat;
vec2 lightPosa = ( worldMat * vec4(lightPos,0,1) ).xy;
vec2 lightPosa = ( theMat * vec4(lightPos,0,1) ).xy;
vec4 shift (vec4 p)
{ return vec4 (p.xy + (200 * (p.xy-lightPos)), 0 , 1);
@@ -28,14 +26,14 @@ vec4 p6 = shift(p2);
vec4 p7 = vec4 (p6.xy,-0.5,1);
vec4 p8 = vec4 (p5.xy,-0.5,1);
vec4 a1 = worldMat * p1;
vec4 a2 = worldMat * p2;
vec4 a3 = worldMat * p3;
vec4 a4 = worldMat * p4;
vec4 a5 = worldMat * p5;
vec4 a6 = worldMat * p6;
vec4 a7 = worldMat * p7;
vec4 a8 = worldMat * p8;
vec4 a1 = theMat * p1;
vec4 a2 = theMat * p2;
vec4 a3 = theMat * p3;
vec4 a4 = theMat * p4;
vec4 a5 = theMat * p5;
vec4 a6 = theMat * p6;
vec4 a7 = theMat * p7;
vec4 a8 = theMat * p8;
gl_Position = a4; EmitVertex();
gl_Position = a3; EmitVertex();