Clouds are affected by (underlying) lightmap

This commit is contained in:
2021-08-31 16:04:42 +01:00
parent 90111594c0
commit f58530cbb1
3 changed files with 108 additions and 11 deletions
+26
View File
@@ -0,0 +1,26 @@
module Dodge.Creature.ShadowBox
where
import Dodge.Data
import Polyhedra
import Geometry
import qualified Data.IntMap as IM
crToBox :: Creature -> [[Point3]]
crToBox cr = map (map f . polyToTris) $ boxXYZ 10 10 15
where
f = (+ V3 (x-5) (y-5) 1)
V2 x y = _crPos cr
youBox' :: World -> [[Point3]]
youBox' w = crToBox' $ _creatures w IM.! 0
youBox :: World -> [Point3]
youBox = concat . youBox'
crToBox' :: Creature -> [[Point3]]
crToBox' cr = map (map f . polyToTris) $ boxXYZ 20 20 15
where
f = (+ V3 (x-10) (y-10) 1)
V2 x y = _crPos cr
youSil :: World -> [Point3]
youSil = constructEdgesList . youBox'
+25 -11
View File
@@ -122,13 +122,6 @@ 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
@@ -138,6 +131,27 @@ doDrawing pdata w = do
colorMask $= Color4 Enabled Enabled Enabled Enabled
clearColor $= Color4 0 0 0 0
bindFramebuffer Framebuffer $= fst (_fboColor pdata)
clearColor $= Color4 0 0 0 0
clear [ColorBuffer]
depthFunc $= Just Lequal
depthMask $= Disabled
blendFuncSeparate $= ((SrcAlpha,OneMinusSrcAlpha),(SrcAlpha,One))
--blendFunc $= (SrcAlpha,One)
renderLayer 2 shadV layerCounts
clearColor $= Color4 0 0 0 0
depthMask $= Enabled
depthMask $= Disabled
depthFunc $= Just Always
textureBinding Texture2D $= Just (snd $ _fboLighting pdata)
blend $= Enabled
--blendFunc $= (Zero, OneMinusSrcAlpha)
blendFuncSeparate $= ((Zero, OneMinusSrcColor),(Zero, One))
drawShader (_fullscreenShader pdata) 4
blendFunc $= (SrcAlpha, OneMinusSrcAlpha)
-- renderLayer 4 shadV layerCounts
-- renderLayer 5 shadV layerCounts
--blend $= Disabled
depthMask $= Disabled
depthFunc $= Just Always
@@ -152,7 +166,6 @@ doDrawing pdata w = do
drawShader (_fullscreenShader pdata) 4
blendFunc $= (SrcAlpha, OneMinusSrcAlpha)
--textureBinding Texture2D $= Just (snd $ _fboColor pdata)
--drawShader (_colorBlurShader pdata) 4
blendFunc $= (SrcAlpha, One)
textureBinding Texture2D $= Just (snd $ _fboFourth1 pdata)
@@ -161,10 +174,11 @@ doDrawing pdata w = do
-- textureBinding Texture2D $= Just (snd $ _fboBloom pdata)
-- drawShader (_fullscreenShader pdata) 4
depthFunc $= Just Lequal
--mapM_ (uncurry $ drawShaderLay 2) (vnums IM.! 2)
renderLayer 2 shadV layerCounts
textureBinding Texture2D $= Just (snd $ _fboColor pdata)
drawShader (_fullscreenShader pdata) 4
--renderLayer 2 shadV layerCounts
renderWindows pdata windowPoints
depthFunc $= Just Lequal
viewport $= (Position 0 0, Size (round $ fstV2 wins) (round $ sndV2 wins))
depthFunc $= Just Always