Cleanup: remove uniforms from shader datatype

This commit is contained in:
2023-03-20 01:19:10 +00:00
parent 33f31aa385
commit 32ecf46343
17 changed files with 24 additions and 99 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
layout (triangles) in;
layout (triangle_strip, max_vertices = 3) out;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
uniform vec3 lightPos;
layout(location=0)uniform vec3 lightPos;
// this code is duplicated in lineShadow.geom, should not be changed on its own
vec4 projNear (vec4 pos)
{
+2 -2
View File
@@ -2,8 +2,8 @@
layout(lines_adjacency) in;
layout(triangle_strip, max_vertices = 4) out;
layout(std140, binding = 0) uniform TheMat { mat4 theMat; };
uniform vec3 lightPos;
uniform float radiusUniform;
layout(location=0) uniform vec3 lightPos;
layout(location=1) uniform float radiusUniform;
// vec4 shift (vec4 p) { return (vec4 (p.xyz +
// (lumRad.a*normalize(p.xyz-lightPos)), 1));}
float closestPointOnLineParam3 (vec3 a, vec3 b, vec3 p) {
+4 -4
View File
@@ -1,6 +1,6 @@
#version 450 core
uniform vec3 lightPos;
uniform vec4 lumRad;
layout(location=0)uniform vec3 lightPos;
layout(location=1)uniform vec4 lumRad;
layout (binding = 0) uniform sampler2D screenTexture;
layout (binding = 1) uniform sampler2D normals;
in vec2 vTexPos;
@@ -20,8 +20,8 @@ void main() {
//float y3 = clamp(0.5 * (y1 + 1),0,1) ;
float y3 = clamp(2*y1 + 1,0,1) ;
//float y3 = clamp(0.5 * (y1 + 2),0,1) ;
float y = float(normbit.w == 0 ? y2 : y2);
//float y = y2;
//float y = float(normbit.w == 0 ? y3 : y2);
float y = y2;
float x = 1 - dist / rad;
vec3 c = y* (x * x * x) * lumRad.rgb;
fColor = vec4(c, 0);
-9
View File
@@ -1,9 +0,0 @@
#version 450 core
in vec3 lum;
in vec3 dField;
out vec4 fColor;
void main()
{
vec3 c = pow (1 - min(1, dot(dField,dField)) , 2) * lum ;
fColor = vec4(c,0);
}
-32
View File
@@ -1,32 +0,0 @@
#version 450 core
layout (points) in;
layout (triangle_strip, max_vertices = 4) out;
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
uniform vec3 lightPos;
uniform vec4 lumRad;
out vec3 dField;
out vec3 lum;
float isLHS (vec2 startV, vec2 testV)
{ return sign( -startV.x * testV.y + startV.y * testV.x); }
void main()
{
vec4 p1 = vec4 (gl_in[0].gl_Position.xy,0,1);
vec4 p2 = vec4 (gl_in[0].gl_Position.zw,0,1);
if (isLHS (p1.xy - lightPos.xy, p2.xy - lightPos.xy) < 0)
{ lum = lumRad.rgb;
float rad = lumRad.a;
vec4 p3 = vec4 (p1.xy,100,1);
vec4 p4 = vec4 (p2.xy,100,1);
vec2 d1 = p1.xy - lightPos.xy;
vec2 d2 = p2.xy - lightPos.xy;
vec4 a1 = theMat * p1;
vec4 a2 = theMat * p2;
vec4 a3 = theMat * p3;
vec4 a4 = theMat * p4;
dField = (p1.xyz - lightPos) / rad; gl_Position = a1; EmitVertex();
dField = (p3.xyz - lightPos) / rad; gl_Position = a3; EmitVertex();
dField = (p2.xyz - lightPos) / rad; gl_Position = a2; EmitVertex();
dField = (p4.xyz - lightPos) / rad; gl_Position = a4; EmitVertex();
EndPrimitive();
} else {}
}
-6
View File
@@ -1,6 +0,0 @@
#version 450 core
layout (location = 0) in vec4 poss;
void main()
{
gl_Position = poss;
}
+2 -2
View File
@@ -2,8 +2,8 @@
layout(points) in;
layout(triangle_strip, max_vertices = 18) out;
layout(std140, binding = 0) uniform TheMat { mat4 theMat; };
uniform vec3 lightPos;
uniform float rad;
layout(location=0) uniform vec3 lightPos;
layout(location=1) uniform float rad;
float rad2 = rad;
// Preprocessed to include ../functions.glsl
float closestPointOnLineParam (vec2 a, vec2 b, vec2 p) {