Fix some menu bugs

This commit is contained in:
2021-05-01 19:31:10 +02:00
parent 6eb6221a84
commit 9cdd3a9629
4 changed files with 61 additions and 48 deletions
+7 -14
View File
@@ -53,6 +53,10 @@ setWallDepth pdata wallPoints (viewFromx,viewFromy) pmat = do
divideSize :: Int -> Size -> Size
divideSize i (Size x y) = Size (div x $ fromIntegral i) (div y $ fromIntegral i)
{- |
Determine where light is shining in the world.
Note that this currently (1/5/2021) sets the bound framebuffer to fbo2.
The lightmap itself is rendered into this buffer. -}
createLightMap
:: RenderData
-> Int -- Resolution division
@@ -138,13 +142,10 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) pmat =
-- set the viewport size to that of the window
viewport $= (vppos, vpsize)
-- always want to draw lightmap
-- disable depth testing for blurring
depthFunc $= Just Always
-- draw the lightmap on a full size fbo
-- bindFramebuffer Framebuffer $= fst (_fbo3 pdata)
-- clear [ColorBuffer,DepthBuffer]
bindFramebuffer Framebuffer $= fst (_fbo2 pdata)
-- clear [ColorBuffer,DepthBuffer]
colorMask $= Color4 Disabled Disabled Disabled Enabled
bindShaderBuffers [_boxBlurShader pdata] [4]
textureBinding Texture2D $= Just (_fboTexture pdata)
@@ -154,18 +155,10 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) pmat =
generateMipmap' Texture2D
drawShader (_boxBlurShader pdata) 4
-- ping pong blur between the two buffers as many times as desired
-- ping pong blur between '_fbo2' and '_fbo3' as many times as desired
replicateM_ 3 $ pingPongBlur pdata
---- draw the lightmap to the screen
-- bindFramebuffer Framebuffer $= defaultFramebufferObject
-- clear [DepthBuffer]
-- textureBinding Texture2D $= Just (snd $ _fbo2 pdata)
-- textureFilter Texture2D $= ((Linear',Just Linear') , Linear')
-- generateMipmap' Texture2D
-- bindShaderBuffers [_fullscreenShader pdata] [4]
-- drawShader (_fullscreenShader pdata) 4
-- reset drawing parameters ready for drawing on top of the light map
colorMask $= Color4 Enabled Enabled Enabled Enabled
depthMask $= Enabled
blend $= Enabled