Simplify ceiling oclusions

This commit is contained in:
2025-11-02 19:20:57 +00:00
parent 0d0c1a72e0
commit 2f0487a424
8 changed files with 178 additions and 171 deletions
+7 -6
View File
@@ -98,7 +98,7 @@ renderLightingNoShadows positiontexture normaltexture lightPoints pdata = do
(fromIntegral (4 :: Int))
--cleanup: may not be necessary, depending on what comes after...
glDisable GL_CULL_FACE
glDisable GL_STENCIL_TEST
-- glDisable GL_STENCIL_TEST
renderFlatLighting :: RenderData -> IO ()
@@ -155,9 +155,8 @@ renderShadows shadrendertype nWalls nSils nCaps positiontexture normaltexture li
flip VFSM.mapM_ (VFSM.fromList lightPoints) $ \(V3 x y z, rad, V3 r g b) -> do
-- note that the stencil shadows rely on the depth buffer
glDepthFunc GL_LESS
-- setup stencil
glColorMask GL_FALSE GL_FALSE GL_FALSE GL_FALSE
glStencilMask 127 -- so we only affect the last 7 bits
-- setup stencil
with 0 $
glClearNamedFramebufferiv
(pdata ^. fboLighting . _1 . unFBO)
@@ -206,16 +205,18 @@ renderShadows shadrendertype nWalls nSils nCaps positiontexture normaltexture li
glDisable GL_CULL_FACE
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_FALSE
glStencilFunc GL_EQUAL 0 255
glUseProgram (ltextShad ^. shaderUINT) --Just (_shadProg ltextShad)
glUseProgram (ltextShad ^. shaderUINT)
glUniform3f 0 x y z
glUniform4f 1 r g b rad
glBindVertexArray $ ltextShad ^. shaderVAO . vaoName -- Just (_vao $ _shadVAO ltextShad)
glBindVertexArray $ ltextShad ^. shaderVAO . vaoName
glDrawArrays
(_unPrimitiveMode (_shaderPrimitive ltextShad))
0
(fromIntegral (4 :: Int))
--cleanup: may not be necessary, depending on what comes after...
glDisable GL_STENCIL_TEST
-- glDisable GL_STENCIL_TEST
glStencilFunc GL_NOTEQUAL 128 255
glStencilOp GL_KEEP GL_KEEP GL_KEEP
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
-- assumes that vertices have already been sent to the shader