Use ssbo/vertex pulling for lighting cap shader

Not yet sure whether the colour vector is correctly input into the ssbo
This commit is contained in:
2025-11-11 14:15:42 +00:00
parent a65a1cab93
commit 219c574931
11 changed files with 90 additions and 85 deletions
+8 -17
View File
@@ -14,27 +14,18 @@ vec4 projNear (vec4 pos)
vec2 xy = (pos.xyz + a * dir).xy ;
return vec4 ( xy, 100 , 1) ;
}
vec4 tris[3] =
{vec4(0,0,0,1)
,vec4(1,1,0,1)
,vec4(0,1,0,1)
};
bool ztest (vec4 p) {return p.z - lightPos.z > 0;}
void main() {
int j = gl_VertexID/3;
int i1 = j * 3;
uint t = indices[gl_VertexID];
//uint t = gl_VertexID;
gl_Position = tris[t];
//uint t = gl_VertexID % 3;
vec4 p = data[indices[gl_VertexID]].pos;
// gl_Position = (p.w == 1
// && ztest(data[indices[i1]].pos)
// && ztest(data[indices[i1+1]].pos)
// && ztest(data[indices[i1+2]].pos)
// ? theMat * projNear(p)
// : vec4(1,1,1,0)
// );
vec4 po = data[indices[gl_VertexID]].pos;
gl_Position = (po.w == 1
&& ztest(data[indices[i1]].pos)
&& ztest(data[indices[i1+1]].pos)
&& ztest(data[indices[i1+2]].pos)
? theMat * projNear(po)
: vec4(1,1,1,0)
);
}
//layout (location = 0) in vec4 position;
//layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;