diff --git a/src/Dodge/Render.hs b/src/Dodge/Render.hs index 1bc3cb89d..b1cb70ece 100644 --- a/src/Dodge/Render.hs +++ b/src/Dodge/Render.hs @@ -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