Start implementing ceiling stencil shader

This commit is contained in:
2025-11-01 11:24:08 +00:00
parent 71006e24fd
commit d35a41944c
4 changed files with 60 additions and 35 deletions
+14 -10
View File
@@ -122,28 +122,33 @@ doDrawing' win pdata u = do
glDepthMask GL_TRUE
glDisable GL_BLEND
glDepthFunc GL_LESS
with 1 $
glClearNamedFramebufferfv
-- clear depth and stencil buffers
glStencilMask 255 -- to alter the entire stencil
glClearNamedFramebufferfi
(pdata ^. fboBase . _1 . unFBO)
GL_DEPTH
GL_DEPTH_STENCIL
0
1
0
-- draw wall occlusions from the camera's point of view
glDisable GL_CULL_FACE
-- glEnable GL_STENCIL_TEST
-- glStencilFunc
unless (debugOn Remove_LOS cfig) $ do
glUseProgram (pdata ^. lightingWallShadShader . shaderUINT)
glUseProgram (pdata ^. ceilingStencilShader . shaderUINT)
glProgramUniform3f
(pdata ^. lightingWallShadShader . shaderUINT)
(pdata ^. ceilingStencilShader . shaderUINT)
0
vfx
vfy
20
glProgramUniform1f
(pdata ^. lightingWallShadShader . shaderUINT)
(pdata ^. ceilingStencilShader . shaderUINT)
1
1000 -- this should be the furthest on screen distance from the viewpoint
glBindVertexArray $ pdata ^. lightingWallShadShader . shaderVAO . vaoName
glBindVertexArray $ pdata ^. ceilingStencilShader . shaderVAO . vaoName
glDrawArrays
(_unPrimitiveMode $ pdata ^. lightingWallShadShader . shaderPrimitive)
(_unPrimitiveMode $ pdata ^. ceilingStencilShader . shaderPrimitive)
0
(fromIntegral trueNWalls)
-- clear color and normals
@@ -182,12 +187,11 @@ doDrawing' win pdata u = do
glEnable GL_STENCIL_TEST
glStencilFunc GL_ALWAYS 0 255
glStencilOp GL_INCR GL_INCR GL_INCR
with 0 $ \ptr ->
with 0 $
glClearNamedFramebufferiv
(pdata ^. fboBase . _1 . unFBO)
GL_STENCIL
0
ptr
glDrawArrays
(_unPrimitiveMode $ pdata ^. chasmShader . shaderPrimitive)
0