Further cleanup

This commit is contained in:
2021-09-01 19:35:25 +01:00
parent ce4c3bd231
commit d0aeeed5c3
4 changed files with 24 additions and 42 deletions
+16 -29
View File
@@ -93,15 +93,28 @@ doDrawing pdata w = do
nTextArrayVs <- pokePoint33s (shadVBOptr $ _textureArrayShader pdata) (_floorTiles w)
bindShaderBuffers [_textureArrayShader pdata] [nTextArrayVs]
drawShader (_textureArrayShader pdata) nTextArrayVs
--draw lightmap for base buffer
bindFramebuffer Framebuffer $= fst (_fboLighting pdata)
createLightMap pdata lightPoints nWalls nSils nCaps (snd $ snd $ _fboBase pdata)
colorMask $= Color4 Enabled Enabled Enabled Enabled
clearColor $= Color4 0 0 0 0
--apply lightmap to base buffer
bindFramebuffer Framebuffer $= fst (_fboBase pdata)
textureBinding Texture2D $= Just (snd $ _fboLighting pdata)
blend $= Enabled
blendFunc $= (Zero, OneMinusSrcColor)
drawShader (_fullscreenShader pdata) 4
blendFunc $= (SrcAlpha, OneMinusSrcAlpha)
--draw bloom onto bloom buffer
bindFramebuffer Framebuffer $= fst (_fboBloom pdata)
clear [ColorBuffer]
depthFunc $= Just Less
blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
depthMask $= Disabled
renderLayer 3 shadV layerCounts
depthMask $= Enabled
renderLayer 1 shadV layerCounts
--depthMask $= Enabled
--setup downscale viewport for blurring bloom
viewport $= (Position 0 0
, divideSize (2 * (w ^. config . shadow_resolution)) $ Size (round $ fstV2 wins) (round $ sndV2 wins))
@@ -114,21 +127,6 @@ doDrawing pdata w = do
blend $= Enabled
viewport $= (Position 0 0
, divideSize (w ^. config . shadow_resolution) $ Size (round $ fstV2 wins) (round $ sndV2 wins))
--draw lightmap for base buffer
bindFramebuffer Framebuffer $= fst (_fboLighting pdata)
createLightMap pdata lightPoints nWalls nSils nCaps (snd $ snd $ _fboBase pdata)
colorMask $= Color4 Enabled Enabled Enabled Enabled
clearColor $= Color4 0 0 0 0
--apply lightmap to base buffer
bindFramebuffer Framebuffer $= fst (_fboBase pdata)
textureBinding Texture2D $= Just (snd $ _fboLighting pdata)
blend $= Enabled
blendFunc $= (Zero, OneMinusSrcColor)
drawShader (_fullscreenShader pdata) 4
blendFunc $= (SrcAlpha, OneMinusSrcAlpha)
--draw clouds
bindFramebuffer Framebuffer $= fst (_fboCloud pdata)
depthFunc $= Just Lequal
@@ -140,24 +138,19 @@ doDrawing pdata w = do
clear [ColorBuffer]
renderLayer 2 shadV layerCounts
renderWindows pdata windowPoints
----render transparency depths
depthMask $= Enabled
blend $= Disabled
drawBuffers $= [NoBuffers,FBOColorAttachment 1]
clearColor $= Color4 0 0 0 0
clear [ColorBuffer]
renderLayer 2 shadV layerCounts
renderWindows pdata windowPoints
depthMask $= Disabled
blend $= Enabled
----draw lightmap for cloud buffer
bindFramebuffer Framebuffer $= fst (_fboLighting pdata)
createLightMap pdata lightPoints nWalls nSils nCaps (snd $ snd $ _fboCloud pdata)
colorMask $= Color4 Enabled Enabled Enabled Enabled
clearColor $= Color4 0 0 0 0
--apply lightmap to cloud buffer
clearColor $= Color4 0 0 0 0
bindFramebuffer Framebuffer $= fst (_fboCloud pdata)
@@ -170,10 +163,6 @@ doDrawing pdata w = do
blendFuncSeparate $= ((Zero, OneMinusSrcColor),(Zero, One))
drawShader (_fullscreenShader pdata) 4
blendFunc $= (SrcAlpha, OneMinusSrcAlpha)
depthMask $= Disabled
depthFunc $= Just Always
--Draw blurred bloom onto base buffer
bindFramebuffer Framebuffer $= fst (_fboBase pdata)
blend $= Enabled
@@ -181,15 +170,13 @@ doDrawing pdata w = do
textureBinding Texture2D $= Just (snd $ _fboFourth1 pdata)
drawShader (_fullscreenShader pdata) 4
blendFunc $= (SrcAlpha, OneMinusSrcAlpha)
--draw shadowed clouds onto base buffer
textureBinding Texture2D $= Just (fst $ snd $ _fboCloud pdata)
drawShader (_fullscreenShader pdata) 4
depthFunc $= Just Lequal
--set viewport for radial distortion
viewport $= (Position 0 0, Size (round $ fstV2 wins) (round $ sndV2 wins))
depthFunc $= Just Always
blendFunc $= (One,Zero)
-- perform any radial distortion
case _radDistortion w of
[] -> do