Use stencil test to not draw floors where there are chasms

This commit is contained in:
2025-08-05 19:57:49 +01:00
parent 83124703c5
commit df443744db
4 changed files with 44 additions and 38 deletions
-6
View File
@@ -1,6 +0,0 @@
#version 450 core
out vec4 fColor;
void main()
{
fColor = vec4 (0,0,0,1);
}
+7 -7
View File
@@ -36,8 +36,8 @@ void main() {
vec2 p2cs = p2 + closeshift;
vec2 p2o = vec2( distance(p2,lightPos.xy) > rad2 ? p2cs : shift(p2) );
gl_Position = theMat * vec4(p1o,0,1); EmitVertex();
gl_Position = theMat * vec4(p1,0,1); EmitVertex();
gl_Position = theMat * vec4(p1o,-500,1); EmitVertex();
gl_Position = theMat * vec4(p1,-500,1); EmitVertex();
gl_Position = theMat * vec4(p1o,100,1); EmitVertex();
gl_Position = theMat * vec4(p1,100,1); EmitVertex();
gl_Position = theMat * vec4(p1cs,100,1); EmitVertex();
@@ -52,15 +52,15 @@ void main() {
// gl_Position = theMat * vec4(p2,0,1); EmitVertex();
gl_Position = theMat * vec4(p2,100,1); EmitVertex();
gl_Position = theMat * vec4(p2,0,1); EmitVertex();
gl_Position = theMat * vec4(p2,-500,1); EmitVertex();
gl_Position = theMat * vec4(p2o,100,1); EmitVertex();
gl_Position = theMat * vec4(p2o,0,1); EmitVertex();
gl_Position = theMat * vec4(p2o,-500,1); EmitVertex();
gl_Position = theMat * vec4(p2cs,100,1); EmitVertex();
gl_Position = theMat * vec4(p2cs,0,1); EmitVertex();
gl_Position = theMat * vec4(p2cs,-500,1); EmitVertex();
gl_Position = theMat * vec4(p1cs,100,1); EmitVertex();
gl_Position = theMat * vec4(p1cs,0,1); EmitVertex();
gl_Position = theMat * vec4(p1cs,-500,1); EmitVertex();
gl_Position = theMat * vec4(p1o,100,1); EmitVertex();
gl_Position = theMat * vec4(p1o,0,1); EmitVertex();
gl_Position = theMat * vec4(p1o,-500,1); EmitVertex();
EndPrimitive();
} else {