Readd dust cloud rendering

This commit is contained in:
2025-11-12 20:53:37 +00:00
parent 409180959c
commit 383beeae82
4 changed files with 22 additions and 37 deletions
+10 -28
View File
@@ -4,7 +4,6 @@ module Dodge.Render (
getWindowSize,
) where
import Shape.Parameters
import Control.Lens
import Control.Monad
import qualified Control.Monad.Parallel as MP
@@ -61,11 +60,6 @@ doDrawing' win pdata u = do
let wswp = wallSPics <> worldSPic cfig u
ws = wswp ^. _1
wp = wswp ^. _2
nCloudVs <-
V.foldM'
(pokeCloud (pdata ^. cloudVBO . vboPtr))
0
(V.fromList $ w ^. cWorld . lWorld . clouds)
((nWins, trueNWalls), (nShapeVs, nIndices, nSilIndices)) <-
MP.liftM3
(\_ a b -> (a, b))
@@ -88,28 +82,16 @@ doDrawing' win pdata u = do
(0, 0, 0)
ws
)
-- (nCloudVs', nCloudIs') <-
-- -- Might want to sort the clouds based on z depth, not sure
-- V.foldM'
-- (pokeCloud (pdata ^. cloudVBO . vboPtr) (pdata ^. cloudEBO . uiboPtr))
-- (0, 0)
-- (V.fromList $ w ^. cWorld . lWorld . clouds)
-- (nCloudVs, nCloudIs) <-
-- V.foldM'
-- (pokeDust (pdata ^. cloudVBO . vboPtr) (pdata ^. cloudEBO . uiboPtr))
-- (nCloudVs', nCloudIs')
-- (V.fromList $ w ^. cWorld . lWorld . dusts)
--nCloudVs' <-
-- nCloudVs <-
-- V.foldM'
-- (pokeCloud (pdata ^. cloudVBO . vboPtr))
-- 0
-- (V.fromList $ w ^. cWorld . lWorld . clouds)
-- nCloudVs <-
-- V.foldM'
-- (pokeDust (pdata ^. cloudVBO . vboPtr))
-- nCloudVs'
-- (V.fromList $ w ^. cWorld . lWorld . dusts)
nCloudVs' <-
V.foldM'
(pokeCloud (pdata ^. cloudVBO . vboPtr))
0
(V.fromList $ w ^. cWorld . lWorld . clouds)
nCloudVs <-
V.foldM'
(pokeDust (pdata ^. cloudVBO . vboPtr))
nCloudVs'
(V.fromList $ w ^. cWorld . lWorld . dusts)
-- bind wall points, silhouette data, surface geometry
bufferShaderLayers shadV pokeCounts
mapM_
+4
View File
@@ -156,8 +156,11 @@ renderShadows shadrendertype nWalls nSils nCaps positiontexture normaltexture li
-- for each of the lights:
-- 1. stencil out the shadows from this light's point of view
-- 2. calculate lighting based on each fragment's position and normal
-- TODO stencil out square around light!
-- glEnable GL_SCISSOR_TEST
flip VFSM.mapM_ (VFSM.fromList lightPoints) $ \(V3 x y z, rad, V3 r g b) -> do
-- note that the stencil shadows rely on the depth buffer
-- glScissor 0 0 200 200
glDepthFunc GL_LESS
glColorMask GL_FALSE GL_FALSE GL_FALSE GL_FALSE
-- setup stencil
@@ -234,6 +237,7 @@ renderShadows shadrendertype nWalls nSils nCaps positiontexture normaltexture li
(fromIntegral (4 :: Int))
--cleanup: may not be necessary, depending on what comes after...
-- glDisable GL_STENCIL_TEST
-- glDisable GL_SCISSOR_TEST
glStencilFunc GL_NOTEQUAL 128 255
glStencilOp GL_KEEP GL_KEEP GL_KEEP
glColorMask GL_TRUE GL_TRUE GL_TRUE GL_TRUE