Grayscale post processing

This commit is contained in:
jgk
2021-05-01 15:48:56 +02:00
parent 30c09d3403
commit 6eb6221a84
2 changed files with 29 additions and 14 deletions
+18 -8
View File
@@ -52,9 +52,10 @@ doDrawing pdata w = do
pmat <- (newMatrix RowMajor $ perspectiveMatrix rot zoom trans wins viewFroms)
:: IO (GLmatrix GLfloat)
createLightMap pdata (w ^. config . shadow_resolution) wallPoints lightPoints viewFroms pmat
blendFuncSeparate $= ((SrcAlphaSaturate, OneMinusSrcAlpha), (Zero,One))
-- clear [DepthBuffer]
depthFunc $= Just Always
-- depthFunc $= Just Always
renderBackground pdata rot zoom trans wins
depthFunc $= Just Less
if w ^. config . wall_textured
@@ -77,14 +78,23 @@ doDrawing pdata w = do
renderBlankWalls pdata windowPoints pmat
depthMask $= Enabled
---- draw the lightmap to the screen
-- draw the lightmap to the screen
bindFramebuffer Framebuffer $= defaultFramebufferObject
blend $= Disabled
clear [ColorBuffer,DepthBuffer]
depthFunc $= Just Always
textureBinding Texture2D $= Just (snd $ _fbo2 pdata)
textureFilter Texture2D $= ((Linear',Just Linear') , Linear')
generateMipmap' Texture2D
bindShaderBuffers [_grayscaleShader pdata] [4]
drawShader (_grayscaleShader pdata) 4
-- bindFramebuffer Framebuffer $= fst (_fbo3 pdata)
-- clear [ColorBuffer,DepthBuffer]
-- bindFramebuffer Framebuffer $= fst (_fbo2 pdata)
-- clear [ColorBuffer,DepthBuffer]
-- 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
blend $= Enabled
resetShaderUniforms (map extractProgAndUnis $ _pictureShaders pdata)
----------------------
+11 -6
View File
@@ -141,7 +141,10 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) pmat =
-- always want to draw lightmap
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,12 +157,14 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) pmat =
-- ping pong blur between the two buffers as many times as desired
replicateM_ 3 $ pingPongBlur pdata
-- draw the lightmap to the screen
bindFramebuffer Framebuffer $= defaultFramebufferObject
textureBinding Texture2D $= Just (snd $ _fbo2 pdata)
textureFilter Texture2D $= ((Linear',Just Linear') , Linear')
generateMipmap' Texture2D
drawShader (_boxBlurShader pdata) 4
---- 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
colorMask $= Color4 Enabled Enabled Enabled Enabled
depthMask $= Enabled