Tweak clouds

This commit is contained in:
2023-03-20 18:24:07 +00:00
parent 695f849f77
commit 7d0bb7f229
11 changed files with 88 additions and 63 deletions
+53 -32
View File
@@ -132,7 +132,6 @@ doDrawing' win pdata u = do
GL_DEPTH
0
ptr
glDepthFunc GL_LESS
-- draw wall occlusions from the camera's point of view
glUseProgram (pdata ^. lightingWallShadShader . shadName)
@@ -203,7 +202,7 @@ doDrawing' win pdata u = do
nIndices
(u ^. uvConfig . graphics_object_shadows)
(pdata ^. fboBase . _2 . _2)
(drawCPUShadows pdata ws)
(pdata ^. fboBase . _2 . _3)
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
--apply lightmap to base buffer
glBindFramebuffer GL_FRAMEBUFFER (pdata ^. fboBase . _1 . unFBO)
@@ -250,36 +249,58 @@ doDrawing' win pdata u = do
GL_COLOR
0
ptr
renderLayer MidLayer shadV layerCounts
-- glUseProgram (pdata ^. cloudShader . shaderUINT)
-- glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
-- glDrawElements
-- (pdata ^. cloudShader . shaderPrimitive)
-- (fromIntegral nCloudIs)
-- GL_UNSIGNED_SHORT
-- nullPtr
-- renderLayer MidLayer shadV layerCounts
glUseProgram (pdata ^. cloudShader . shaderUINT)
glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
glDrawElements
(pdata ^. cloudShader . shaderPrimitive)
(fromIntegral nCloudIs)
GL_UNSIGNED_SHORT
nullPtr
drawShader (_windowShader pdata) nWins
-- when (_graphics_cloud_shadows cfig) $ do
-- ----render transparency depths
-- glDepthMask GL_TRUE
-- glDisable GL_BLEND
-- withArray [GL_NONE, GL_COLOR_ATTACHMENT1] $ \ptr -> glDrawBuffers 2 ptr
-- renderLayer MidLayer shadV layerCounts
-- drawShader (_windowShader pdata) nWins
-- ----draw lightmap for cloud buffer
-- glDepthMask GL_FALSE
-- glEnable GL_BLEND
-- glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
-- createLightMap
-- cfig
-- pdata
-- lightPoints
-- nWalls
-- nSilIndices
-- nIndices
-- (_graphics_object_shadows $ _uvConfig u)
-- (snd $ snd $ _fboCloud pdata)
-- (drawCPUShadows pdata ws)
when (_graphics_cloud_shadows cfig) $ do
----render transparency depths
glDepthMask GL_TRUE
glDepthFunc GL_ALWAYS
glDisable GL_BLEND
withArray [GL_NONE, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2] $ \ptr -> glDrawBuffers 3 ptr
withArray [0,0,0,0] $ \ptr -> glClearNamedFramebufferfv
(pdata ^. fboCloud . _1 . unFBO)
GL_COLOR
1
ptr
withArray [0,0,0,0] $ \ptr -> glClearNamedFramebufferfv
(pdata ^. fboCloud . _1 . unFBO)
GL_COLOR
2
ptr
glEnable GL_BLEND
glBlendColor 0.5 0.5 0.5 0.5
glBlendFunci 1 GL_ONE_MINUS_DST_ALPHA GL_DST_ALPHA
glBlendFunci 2 GL_ONE GL_ONE
glUseProgram (pdata ^. cloudShader . shaderUINT)
glBindVertexArray $ pdata ^. cloudShader . shaderVAO . vaoName
glDrawElements
(pdata ^. cloudShader . shaderPrimitive)
(fromIntegral nCloudIs)
GL_UNSIGNED_SHORT
nullPtr
drawShader (_windowShader pdata) nWins
----draw lightmap for cloud buffer
glDepthMask GL_FALSE
glDepthFunc GL_LEQUAL
glEnable GL_BLEND
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboLighting pdata)))
createLightMap
cfig
pdata
lightPoints
nWalls
nSilIndices
nIndices
(_graphics_object_shadows $ _uvConfig u)
(pdata ^. fboCloud . _2 . _2)
(pdata ^. fboCloud . _2 . _3)
glInvalidateBufferData (pdata ^. vboShapes . vboName)
--apply lightmap to cloud buffer
glBindFramebuffer GL_FRAMEBUFFER (_unFBO (fst (_fboCloud pdata)))
@@ -300,7 +321,7 @@ doDrawing' win pdata u = do
drawShader (fst $ _fullscreenShader pdata) 4
glBlendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
--draw shadowed clouds onto base buffer
glBindTexture GL_TEXTURE_2D (_unTO . fst . snd $ _fboCloud pdata)
glBindTexture GL_TEXTURE_2D (pdata ^. fboCloud . _2 . _1 . unTO)
drawShader (fst $ _fullscreenShader pdata) 4
--set viewport for radial distortion
setViewportSize (round winx) (round winy)