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
@@ -190,7 +190,7 @@ doDrawing' win pdata u = do
glDrawArrays
(marshalEPrimitiveMode $ pdata ^. floorShader . shadPrim' )
0
(fromIntegral $ nFls)
(fromIntegral nFls)
glEnable GL_BLEND
--draw lightmap into its own buffer
createLightMap
@@ -288,6 +288,7 @@ doDrawing' win pdata u = do
glBlendFunci 2 GL_SRC_ALPHA GL_ONE
glUseProgram (pdata ^. cloudShader . shaderUINT)
glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
glDepthMask GL_TRUE
glDrawElements
(pdata ^. cloudShader . shaderPrimitive)
(fromIntegral nCloudIs)
@@ -301,11 +302,10 @@ doDrawing' win pdata u = do
0
ptr
glBindTextureUnit 0 (pdata ^. fboCloud . _2 . _2 . unTO)
drawShader (pdata ^. alphaDivideShader) 4
glEnable GL_BLEND
----draw lightmap for cloud buffer
glDepthMask GL_FALSE
glDepthFunc GL_LEQUAL
drawShader (pdata ^. alphaDivideShader) 4
----draw lightmap for cloud buffer
glDepthFunc GL_LESS
glEnable GL_BLEND
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
createLightMap
@@ -316,7 +316,6 @@ doDrawing' win pdata u = do
nSilIndices
nIndices
(_graphics_object_shadows $ _uvConfig u)
--(pdata ^. fboCloud . _2 . _2)
(pdata ^. fboPos . _2)
(pdata ^. fboCloud . _2 . _3)
glInvalidateBufferData (pdata ^. vboShapes . vboName)