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
+5 -8
View File
@@ -1,14 +1,11 @@
#version 430 core
layout (points) in;
layout (triangle_strip, max_vertices = 4) out;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
out vec3 dField;
out float lum;
uniform vec2 lightPos;
uniform mat4 worldMat;
uniform vec2 radLum;
float isLHS (vec2 startV, vec2 testV)
{
return sign( -startV.x * testV.y + startV.y * testV.x);
@@ -31,10 +28,10 @@ if (isLHS (p1.xy - lightPos, p2.xy - lightPos) < 0)
vec2 d1 = p1.xy - lightPos;
vec2 d2 = p2.xy - lightPos;
vec4 a1 = shiftCloser( worldMat * p1 );
vec4 a2 = shiftCloser( worldMat * p2 );
vec4 a3 = shiftCloser( worldMat * p3 );
vec4 a4 = shiftCloser( worldMat * p4 );
vec4 a1 = shiftCloser( theMat * p1 );
vec4 a2 = shiftCloser( theMat * p2 );
vec4 a3 = shiftCloser( theMat * p3 );
vec4 a4 = shiftCloser( theMat * p4 );
dField = vec3( d1.x/rad, d1.y/rad, 0);
gl_Position = a1;