Stop overwriting depth buffer when combining cloud positions

This commit is contained in:
2023-03-21 16:42:58 +00:00
parent 4519a6fbc7
commit c0579fae00
8 changed files with 22 additions and 27 deletions
+5 -6
View File
@@ -47,10 +47,10 @@ createLightMap ::
TO ->
IO ()
createLightMap cfig pdata lightPoints nWalls nSils nCaps shadsdrawtype
toPos
positiontexture
normaltexture
= case shadsdrawtype of
InstancingShads -> instanceLightMap cfig pdata lightPoints nWalls nSils nCaps toPos
InstancingShads -> instanceLightMap cfig pdata lightPoints nWalls nSils nCaps positiontexture
NoShadows -> do
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
let ltextShad = _lightingTextureShader pdata
@@ -86,7 +86,7 @@ createLightMap cfig pdata lightPoints nWalls nSils nCaps shadsdrawtype
--draw lightmap itself
glDepthFunc GL_ALWAYS
-- bind world position texture
bindTO toPos
glBindTextureUnit 0 (positiontexture ^. unTO)
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
glStencilFunc GL_EQUAL 0 255
glUseProgram (ltextShad ^. shadName)
@@ -114,7 +114,7 @@ createLightMap cfig pdata lightPoints nWalls nSils nCaps shadsdrawtype
0
ptr
glDisable GL_CULL_FACE
glBindTextureUnit 0 (toPos ^. unTO)
glBindTextureUnit 0 (positiontexture ^. unTO)
glDepthFunc GL_ALWAYS
glDepthMask GL_FALSE
_ -> do
@@ -192,14 +192,13 @@ createLightMap cfig pdata lightPoints nWalls nSils nCaps shadsdrawtype
glDepthFunc GL_ALWAYS
-- bind world position texture
glDisable GL_CULL_FACE
bindTO toPos
glBindTextureUnit 0 (positiontexture ^. unTO)
glBindTextureUnit 1 (normaltexture ^. unTO)
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
glStencilFunc GL_EQUAL 0 255
glUseProgram (ltextShad ^. shadName) --Just (_shadProg ltextShad)
glUniform3f 0 x y z
glUniform4f 1 r g b rad
--bindVertexArrayObject $= ltextShad ^? shadVAO' . vaoName -- Just (_vao $ _shadVAO ltextShad)
glBindVertexArray $ ltextShad ^. shadVAO . vaoName -- Just (_vao $ _shadVAO ltextShad)
glDrawArrays
(marshalEPrimitiveMode (_shadPrim' ltextShad))