Bloom lamps, commit before unifying wall points vbo

This commit is contained in:
2021-07-11 14:34:10 +02:00
parent 50295daeba
commit 5e21a6527d
4 changed files with 17 additions and 18 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ lamp h = defaultInanimate
lampPic :: Float -> Picture lampPic :: Float -> Picture
lampPic h = pictures lampPic h = pictures
[ pictures . map (Poly3D 0 . map ((, blue) . (-.-.- (2.5,2.5,0)))) $ boxXYZ 5 5 (h-1) [ pictures . map (Poly3D 0 . map ((, blue) . (-.-.- (2.5,2.5,0)))) $ boxXYZ 5 5 (h-1)
, setDepth h $ color white $ circleSolid 3 , setLayer 1 $ setDepth h $ color white $ circleSolid 3
] ]
initialiseLamp :: Float -> CRUpdate initialiseLamp :: Float -> CRUpdate
+4 -7
View File
@@ -98,8 +98,8 @@ doDrawing pdata w = do
blendFunc $= (One,Zero) blendFunc $= (One,Zero)
--textureBinding Texture2D $= Just (snd $ _fboFourth1 pdata) --textureBinding Texture2D $= Just (snd $ _fboFourth1 pdata)
drawShader (_bloomBlurShader pdata) 4 drawShader (_bloomBlurShader pdata) 4
blendFunc $= (One,Zero) --blendFunc $= (One,Zero)
replicateM_ 5 $ pingPongBetween (_fboFourth1 pdata) (_fboFourth2 pdata) (_bloomBlurShader pdata) replicateM_ 3 $ pingPongBetween (_fboFourth1 pdata) (_fboFourth2 pdata) (_bloomBlurShader pdata)
--replicateM_ 5 $ pingPongBlur pdata --replicateM_ 5 $ pingPongBlur pdata
--blend $= Enabled --blend $= Enabled
viewport $= (Position 0 0, Size (round $ fst wins) (round $ snd wins)) viewport $= (Position 0 0, Size (round $ fst wins) (round $ snd wins))
@@ -113,14 +113,9 @@ doDrawing pdata w = do
colorMask $= Color4 Enabled Enabled Enabled Enabled colorMask $= Color4 Enabled Enabled Enabled Enabled
clearColor $= Color4 0 0 0 0 clearColor $= Color4 0 0 0 0
bindShaderBuffers [_fullscreenShader pdata] [4]
--bindFramebuffer Framebuffer $= defaultFramebufferObject
blend $= Disabled blend $= Disabled
depthMask $= Disabled depthMask $= Disabled
depthFunc $= Just Always depthFunc $= Just Always
--textureBinding Texture2D $= Just (snd $ head $ fst $ _fbos pdata)
--drawShader (_fullscreenShader pdata) 4
bindFramebuffer Framebuffer $= (fst $ _fboBase pdata) bindFramebuffer Framebuffer $= (fst $ _fboBase pdata)
--drawShader (_fullscreenShader pdata) 4 --drawShader (_fullscreenShader pdata) 4
@@ -136,6 +131,8 @@ doDrawing pdata w = do
--textureBinding Texture2D $= Just (snd3 $ _fbo2 pdata) --textureBinding Texture2D $= Just (snd3 $ _fbo2 pdata)
textureBinding Texture2D $= Just (snd $ _fboFourth1 pdata) textureBinding Texture2D $= Just (snd $ _fboFourth1 pdata)
drawShader (_fullscreenShader pdata) 4 drawShader (_fullscreenShader pdata) 4
textureBinding Texture2D $= Just (snd $ _fboBloom pdata)
drawShader (_fullscreenShader pdata) 4
depthFunc $= Just Lequal depthFunc $= Just Lequal
_ <- renderFoldable pdata $ picToLTree (Just 2) pic _ <- renderFoldable pdata $ picToLTree (Just 2) pic
+11 -9
View File
@@ -21,12 +21,14 @@ perspectiveMatrixb rot zoom (tranx,trany) (winx,winy) (viewFromx,viewFromy) =
. vToL . vToL
. lmt . lmt
$ scaleMat (2*zoom/winx,2*zoom/winy) $ scaleMat (2*zoom/winx,2*zoom/winy)
-- $ scaleMat (2/winx,2/winy)
!*! rotMatr (-rot) !*! rotMatr (-rot)
!*! transMat (viewFromx-tranx,viewFromy-trany) !*! transMat (viewFromx-tranx,viewFromy-trany)
!*! perMat !*! perMat (zoom * 0.4)
!*! transMat (-viewFromx,-viewFromy) !*! transMat (-viewFromx,-viewFromy)
!*! vertScale !*! vertScale
!*! vertTrans !*! vertTrans 20
-- !*! vertTrans 80
isoMatrix isoMatrix
:: Float -- ^ Rotation :: Float -- ^ Rotation
@@ -47,12 +49,12 @@ lmt = Linear.Matrix.transpose
vToL :: V4 a -> [a] vToL :: V4 a -> [a]
vToL (V4 a b c d) = [a,b,c,d] vToL (V4 a b c d) = [a,b,c,d]
perMat :: V4 (V4 Float) perMat :: Float -> V4 (V4 Float)
perMat = V4 perMat x = V4
(V4 1 0 0 0) (V4 1 0 0 0)
(V4 0 1 0 0) (V4 0 1 0 0)
(V4 0 0 1 0) (V4 0 0 1 0)
(V4 0 0 1 1) (V4 0 0 x 1)
scaleMat :: Point2 -> V4 (V4 Float) scaleMat :: Point2 -> V4 (V4 Float)
scaleMat (x,y) = V4 scaleMat (x,y) = V4
@@ -82,9 +84,9 @@ vertScale = V4
(V4 0 0 (negate 0.005) 0) (V4 0 0 (negate 0.005) 0)
(V4 0 0 0 1) (V4 0 0 0 1)
vertTrans :: V4 (V4 Float) vertTrans :: Float -> V4 (V4 Float)
vertTrans = V4 vertTrans z = V4
(V4 1 0 0 0) (V4 1 0 0 0)
(V4 0 1 0 0) (V4 0 1 0 0)
(V4 0 0 1 (negate 20)) (V4 0 0 1 (negate z))
(V4 0 0 0 1) (V4 0 0 0 1)
+1 -1
View File
@@ -74,7 +74,7 @@ preloadRender = do
textArrayShad <- makeShader "texture/array" [vert,frag] [3,3] ETriangles poke33 textArrayShad <- makeShader "texture/array" [vert,frag] [3,3] ETriangles poke33
>>= addTextureArray "data/texture/ayene_wooden_floor.png" >>= addTextureArray "data/texture/ayene_wooden_floor.png"
-- bind fixed vertex data -- bind fixed vertex data
bindShaderBuffers [bloomBlurShad,colorBlurShad,fullscreenAlphaHalveShad] [4,4,4] bindShaderBuffers [fsShad,bloomBlurShad,colorBlurShad,fullscreenAlphaHalveShad] [4,4,4,4]
-- framebuffer for lighting -- framebuffer for lighting
(fbo,fboTO,fboRBO) <- setupFramebufferWithStencil (fbo,fboTO,fboRBO) <- setupFramebufferWithStencil
framebuf2 <- setupFramebufferWithStencil framebuf2 <- setupFramebufferWithStencil