Cleanup doDrawing a bit

This commit is contained in:
2021-08-31 13:24:42 +01:00
parent b096b8ef20
commit 90111594c0
+17 -22
View File
@@ -76,7 +76,6 @@ doDrawing pdata w = do
clearColor $= Color4 0 0 0 0
clear [ColorBuffer,DepthBuffer]
depthFunc $= Just Less
-- draw wall occlusions from the camera's point of view
currentProgram $= Just (_shaderProgram $ _lightingSurfaceShader pdata)
uniform (head $ _shaderCustomUnis $ _lightingSurfaceShader pdata)
@@ -88,44 +87,29 @@ doDrawing pdata w = do
uniform (head $ _shaderCustomUnis $ _lightingWallShader pdata)
$= viewFrom3d
drawShader (_lightingOccludeShader pdata) nWalls
-- this might only work because the uniform has been correctly set
-- elsewhere, beware
-- indeed this is the case: this needs fixing
--draw walls onto base buffer
if w ^. config . wall_textured
then renderTextureWalls pdata nWalls
else renderBlankWalls pdata nWalls
---draw foreground geometry onto base buffer
renderFoldable shadV $ polysToPic $ foregroundPics w
--draw objects onto base buffer
layerCounts <- UMV.replicate (6*6) 0
pokeBindFoldableLayer shadV layerCounts $ worldPictures w
renderLayer 0 shadV layerCounts
--draw floor onto base buffer
nTextArrayVs <- pokePoint33s (shadVBOptr $ _textureArrayShader pdata) (_floorTiles w)
bindShaderBuffers [_textureArrayShader pdata] [nTextArrayVs]
drawShader (_textureArrayShader pdata) nTextArrayVs
--draw bloom onto bloom buffer
bindFramebuffer Framebuffer $= fst (_fboBloom pdata)
clear [ColorBuffer]
--blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
--blendEquation $= Max
depthMask $= Disabled
renderLayer 3 shadV layerCounts
depthMask $= Enabled
renderLayer 1 shadV layerCounts
-- bindFramebuffer Framebuffer $= fst (_fboColor pdata)
-- clear [ColorBuffer]
-- depthMask $= Disabled
-- blendEquation $= FuncAdd
-- renderLayer 3 shadV layerCounts
-- renderLayer 4 shadV layerCounts
-- renderLayer 5 shadV layerCounts
--
-- depthMask $= Enabled
-- this is not ideal if the original is not divisible by 2
--setup downscale viewport for blurring bloom
viewport $= (Position 0 0
, divideSize (2 * (w ^. config . shadow_resolution)) $ Size (round $ fstV2 wins) (round $ sndV2 wins))
bindFramebuffer Framebuffer $= fst (_fboFourth1 pdata)
@@ -138,6 +122,17 @@ doDrawing pdata w = do
viewport $= (Position 0 0
, divideSize (w ^. config . shadow_resolution) $ Size (round $ fstV2 wins) (round $ sndV2 wins))
-- bindFramebuffer Framebuffer $= fst (_fboColor pdata)
-- clear [ColorBuffer]
-- depthMask $= Disabled
-- blendEquation $= FuncAdd
-- renderLayer 3 shadV layerCounts
-- renderLayer 4 shadV layerCounts
-- renderLayer 5 shadV layerCounts
--
-- depthMask $= Enabled
-- this is not ideal if the original is not divisible by 2
bindFramebuffer Framebuffer $= fst (_fboLighting pdata)
createLightMap pdata lightPoints nWalls nSils nsurfVs
colorMask $= Color4 Enabled Enabled Enabled Enabled