Add trail to bloom

This commit is contained in:
jgk
2021-07-05 21:31:35 +02:00
parent 77d93fabeb
commit be7bf986e2
6 changed files with 28 additions and 2 deletions
+1
View File
@@ -16,6 +16,7 @@ data RenderData = RenderData
, _textureShader :: FullShader
, _textureArrayShader :: FullShader
, _fullscreenShader :: FullShader
, _fullscreenAlphaHalveShader :: FullShader
, _boxBlurShader :: FullShader
, _grayscaleShader :: FullShader
, _pictureShaders :: [FullShader]
+7 -1
View File
@@ -84,12 +84,18 @@ doDrawing pdata w = do
depthFunc $= Just Always
--blend $= Disabled
textureBinding Texture2D $= Just (snd $ _fboBloom pdata)
clear [ColorBuffer]
--clear [ColorBuffer]
--blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
blendFuncSeparate $= ((Zero,One), (Zero,SrcAlpha))
bindShaderBuffers [_fullscreenAlphaHalveShader pdata] [4]
drawShader (_fullscreenAlphaHalveShader pdata) 4
blendFunc $= (One,Zero)
bindShaderBuffers [_boxBlurShader pdata] [4]
blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
drawShader (_boxBlurShader pdata) 4
blendFunc $= (One,Zero)
pingPongBlur pdata
replicateM_ 5 $ pingPongBlur pdata
--blend $= Enabled
blendFunc $= (SrcAlpha,OneMinusSrcAlpha)
+12
View File
@@ -47,6 +47,10 @@ preloadRender = do
cslist <- makeShader "twoD/character" [vert,frag] [3,4,2] ETriangles pokeCharStrat
>>= addTexture "data/texture/charMap.png"
basicTweakZShad <- makeShader "twoD/basicTweakZ" [vert,frag] [4,4] ETriangles pokeTriTweakZ
-- fullscreen shaders
fullscreenAlphaHalveShad <- makeShader "fullscreen/alphaHalve" [vert,frag] [2] ETriangleStrip $
const cornerListNoCoord
pokeArray (_vboPointer $ _vaoVBO $ _shaderVAO fullscreenAlphaHalveShad) $ concat cornerListNoCoord
-- texture shaders, no textures attached
fsShad <- makeShader "texture/simple" [vert,frag] [2,2] ETriangleStrip $ const cornerList
-- note we directly poke the shader vertex data here
@@ -103,6 +107,7 @@ preloadRender = do
, _textureShader = textShad
, _textureArrayShader = textArrayShad
, _fullscreenShader = fsShad
, _fullscreenAlphaHalveShader = fullscreenAlphaHalveShad
, _boxBlurShader = boxBlurShad
, _grayscaleShader = grayscaleShad
, _spareFBO = fbo
@@ -125,6 +130,13 @@ cornerList =
,[-1,-1,0,0]
,[ 1,-1,1,0]
]
cornerListNoCoord :: [[Float]]
cornerListNoCoord =
[[-1, 1]
,[ 1, 1]
,[-1,-1]
,[ 1,-1]
]
--------------------end preloadRender
setupFramebufferWithStencil :: IO (FramebufferObject, TextureObject,RenderbufferObject)