Move closer to removing all geom shaders

This commit is contained in:
2025-11-20 17:45:15 +00:00
parent d28e3bef6c
commit 5c5d9ef0e3
7 changed files with 38 additions and 15 deletions
+21
View File
@@ -0,0 +1,21 @@
#version 450 core
layout(early_fragment_tests) in;
layout (std140, binding = 1) uniform TheLight { vec4 lightPos; vec4 lumRad; };
layout (binding = 0) uniform sampler2D screenTexture;
layout (binding = 1) uniform sampler2D normals;
in vec2 vTexPos;
out vec4 fColor;
float rad = lumRad.a;
void main() {
vec3 pos = texture(screenTexture, vTexPos).xyz;
vec3 distVec = pos - lightPos.xyz;
float dist = dot(distVec, distVec);
vec3 norm = texture(normals, vTexPos).xyz;
float y1 = dot(norm, distVec);
float y2 = float(y1 > 0 ? 1 : 0.1);
//bool t = pos.z > lightPos.z && norm.z > 0;
//float y2 = float(y1 > 0 || t ? 1 : 0.1);
float x = 1 - (pow(dist / rad,4));
vec3 c = y2* x * lumRad.rgb;
fColor = vec4(c, 0);
}
+8
View File
@@ -0,0 +1,8 @@
#version 450 core
layout (std140, binding = 2) uniform PosTex { vec4 posTex[6]; };
out vec2 vTexPos;
void main()
{
gl_Position = vec4(posTex[gl_VertexID].xy,0,1);
vTexPos = posTex[gl_VertexID].zw;
}
-1
View File
@@ -10,6 +10,5 @@ void main()
{
gl_Position = theMat * pos;
vColor = inColor;
//vTexCoord = inTexCoord.xyz;
vTexCoord = inTexCoord;
}