Add shading for shapes and the floor

This commit is contained in:
2023-03-15 18:24:09 +00:00
parent 21f87b96d8
commit 989140d46e
16 changed files with 158 additions and 69 deletions
+32 -27
View File
@@ -125,7 +125,12 @@ doDrawing' win pdata u = do
(marshalEPrimitiveMode $ pdata ^. lightingWallShadShader . shadPrim')
0
(fromIntegral nWalls)
-- glDisable GL_CULL_FACE
-- clear normals
withArray [0,0,0,0] $ \ptr -> glClearNamedFramebufferfv
(pdata ^. fboBase . _1 . unFBO)
GL_COLOR
2
ptr
--draw walls onto base buffer
if cfig ^. graphics_wall_textured
then renderTextureWalls pdata nWalls
@@ -152,7 +157,7 @@ doDrawing' win pdata u = do
nSilIndices
nIndices
(u ^. uvConfig . graphics_object_shadows)
(snd $ snd $ pdata ^. fboBase)
(pdata ^. fboBase . _2 . _2)
(drawCPUShadows pdata ws)
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
glClearColor 0 0 0 0
@@ -196,29 +201,29 @@ doDrawing' win pdata u = do
glClear GL_COLOR_BUFFER_BIT
renderLayer MidLayer shadV layerCounts
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)
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
glClearColor 0 0 0 0
-- 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)
-- glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE
-- glClearColor 0 0 0 0
glInvalidateBufferData (pdata ^. vboShapes . vboName)
--apply lightmap to cloud buffer
glClearColor 0 0 0 0
@@ -249,7 +254,7 @@ doDrawing' win pdata u = do
-- perform any radial distortion
case w ^. cWorld . lWorld . distortions of
[] -> do
bindTO $ fst $ snd $ _fboBase pdata
bindTO $ pdata ^. fboBase . _2 . _1
glBindFramebuffer GL_FRAMEBUFFER 0
drawShader (fst $ _fullscreenShader pdata) 4
rds -> do
@@ -261,7 +266,7 @@ doDrawing' win pdata u = do
fboList =
take (length rds - 1) (concat (repeat [fst $ _fbo2 pdata, fst $ _fbo3 pdata]))
++ [FBO 0]
toList = fst (snd (_fboBase pdata)) : concat (repeat [snd $ _fbo2 pdata, snd $ _fbo3 pdata])
toList = (pdata ^. fboBase . _2 . _1) : concat (repeat [snd $ _fbo2 pdata, snd $ _fbo3 pdata])
bindings = zipWith (>>) (map bindFBO fboList) (map bindTO toList)
glActiveTexture GL_TEXTURE1
zipWithM_ (>>) bindings $ map bindDrawDist rds