Work on lightmaps, add file

This commit is contained in:
2023-03-23 23:42:09 +00:00
parent 1abfaa3cd0
commit 9a66a09f96
9 changed files with 157 additions and 183 deletions
+6 -9
View File
@@ -51,7 +51,7 @@ doDrawing' win pdata u = do
trans = w ^. cWorld . camPos . camCenter
wins@(V2 winx winy) = V2 (_windowX cfig) (_windowY cfig)
resFact = resFactorNum $ cfig ^. graphics_resolution_factor
(wallPointsCol, windowPoints, wallSPics, wallsToPoke) = wallsToDraw w
( windowPoints, wallSPics, wallsToPoke) = wallsToDraw w
lightPoints = lightsToRender cfig (w ^. cWorld . camPos) (w ^. cWorld . lWorld)
viewFroms@(V2 vfx vfy) = w ^. cWorld . camPos . camViewFrom
shadV = _pictureShaders pdata
@@ -61,7 +61,7 @@ doDrawing' win pdata u = do
layerCounts <- UMV.replicate (numLayers * 6) 0
-- attempt to poke in parallel
let (ws, wp) = wallSPics <> worldSPic cfig u
((nWalls, nWins,trueNWalls), (nShapeVs, nIndices, nSilIndices)) <-
(( nWins,trueNWalls), (nShapeVs, nIndices, nSilIndices)) <-
MP.bindM3
(\_ a b -> return (a, b))
( pokeLayVerxs
@@ -70,10 +70,8 @@ doDrawing' win pdata u = do
wp
)
( pokeWallsWindows
( pdata ^. vboWalls . vboPtr)
( pdata ^. vboWindows . vboPtr)
( pdata ^. wallVBO . vboPtr)
wallPointsCol
windowPoints
wallsToPoke
)
@@ -88,8 +86,7 @@ doDrawing' win pdata u = do
bufferShaderLayers shadV layerCounts
uncurry (zipWithM_ bufferPokedVBO) $
unzip
[ (pdata ^. vboWalls, nWalls)
, (pdata ^. vboWindows, nWins)
[ (pdata ^. vboWindows, nWins)
, (pdata ^. wallVBO, trueNWalls)
]
bufferPokedVBO (_vboShapes pdata) nShapeVs
@@ -141,7 +138,7 @@ doDrawing' win pdata u = do
glDrawArrays
(_unPrimitiveMode $ pdata ^. lightingWallShadShader . shaderPrimitive)
0
(fromIntegral nWalls)
(fromIntegral trueNWalls)
-- clear normals
withArray [0,0,0,0] $ \ptr -> glClearNamedFramebufferfv
(pdata ^. fboBase . _1 . unFBO)
@@ -189,7 +186,7 @@ doDrawing' win pdata u = do
createLightMap
cfig
(u ^. uvConfig . graphics_object_shadows)
nWalls
(fromIntegral trueNWalls)
nSilIndices
nIndices
(pdata ^. fboBase . _2 . _2)
@@ -305,7 +302,7 @@ doDrawing' win pdata u = do
createLightMap
cfig
(_graphics_object_shadows $ _uvConfig u)
nWalls
(fromIntegral trueNWalls)
nSilIndices
nIndices
(pdata ^. fboPos . _2)
+3 -4
View File
@@ -14,11 +14,10 @@ import Geometry
import ShapePicture
-- not necessary: should just poke all walls to their wanted places
wallsToDraw :: World -> ([((Point2, Point2), Point4)], [((Point2, Point2), Point4)], SPic, [Wall])
wallsToDraw :: World -> ( [((Point2, Point2), Point4)], SPic, [Wall])
wallsToDraw w = L.fold
( (,,,)
<$> L.prefilter wlOpaqueDraw (L.premap f L.list)
<*> L.prefilter wlSeeThroughDraw (L.premap f L.list)
( (,,)
<$>L.prefilter wlSeeThroughDraw (L.premap f L.list)
<*> L.premap getWallSPic L.mconcat
<*> L.prefilter wlOpaqueDraw L.list
)