Create post world load function

This commit is contained in:
2023-03-18 09:37:09 +00:00
parent d8fb7a1f99
commit 77c88f68a7
14 changed files with 80 additions and 48 deletions
+17 -13
View File
@@ -56,12 +56,13 @@ doDrawing' win pdata u = do
lightPoints = lightsToRender cfig (w ^. cWorld . camPos) (w ^. cWorld . lWorld)
viewFroms@(V2 vfx vfy) = w ^. cWorld . camPos . camViewFrom
shadV = _pictureShaders pdata
nFls = w ^. cWorld . numberFloorVerxs
-- bind as much data into vbos as feasible at this point
-- count mutable vectors setup
layerCounts <- UMV.replicate (numLayers * 6) 0
-- attempt to poke in parallel
let (ws, wp) = wallSPics <> worldSPic cfig w
((nWalls, nWins, nFls), (nShapeVs, nIndices, nSilIndices)) <-
((nWalls, nWins), (nShapeVs, nIndices, nSilIndices)) <-
MP.bindM3
(\_ a b -> return (a, b))
( pokeLayVerxs
@@ -69,15 +70,11 @@ doDrawing' win pdata u = do
layerCounts
wp
)
( pokeWallsWindowsFloor
--(shadVBOptr $ _wallTextureShader pdata)
--(shadVBOptr $ _windowShader pdata)
( pokeWallsWindows
( pdata ^. vboWalls . vboPtr)
( pdata ^. vboWindows . vboPtr)
(shadVBOptr $ _textureArrayShader pdata)
wallPointsCol
windowPoints
(w ^. cWorld . floorTiles)
)
( pokeShape
(_vboPtr $ _vboShapes pdata)
@@ -92,7 +89,7 @@ doDrawing' win pdata u = do
unzip
[ (pdata ^. vboWalls, nWalls)
, (pdata ^. vboWindows, nWins)
, (snd $ _textureArrayShader pdata, nFls)
, (pdata ^. floorVBO, nFls)
]
bufferPokedVBO (_vboShapes pdata) nShapeVs
glNamedBufferSubData
@@ -158,17 +155,24 @@ doDrawing' win pdata u = do
(fromIntegral nIndices)
GL_UNSIGNED_SHORT
nullPtr
-- glDisable GL_CULL_FACE
glDisable GL_CULL_FACE
--draw floor onto base buffer
glDisable GL_BLEND
glUseProgram (pdata ^. textureArrayShader . _1 . shadName)
glBindVertexArray $ pdata ^. textureArrayShader . _1 . shadVAO . vaoName
-- glUseProgram (pdata ^. textureArrayShader . _1 . shadName)
-- glBindVertexArray $ pdata ^. textureArrayShader . _1 . shadVAO . vaoName
-- glBindTextureUnit 1 (pdata ^. toNormalMaps . unTO)
---- glBindTextureUnit 0 $ pdata ^?! textureArrayShader . _1 . shadTex' . _Just . textureObject
-- glDrawArrays
-- (marshalEPrimitiveMode $ pdata ^. textureArrayShader . _1 . shadPrim' )
-- 0
-- (fromIntegral nFls)
glUseProgram (pdata ^. floorShader . shadName)
glBindVertexArray $ pdata ^. floorShader . shadVAO . vaoName
glBindTextureUnit 1 (pdata ^. toNormalMaps . unTO)
glBindTextureUnit 0 $ pdata ^?! textureArrayShader . _1 . shadTex' . _Just . textureObject
glDrawArrays
(marshalEPrimitiveMode $ pdata ^. textureArrayShader . _1 . shadPrim' )
(marshalEPrimitiveMode $ pdata ^. floorShader . shadPrim' )
0
(fromIntegral nFls)
(fromIntegral $ nFls)
glEnable GL_BLEND
--draw lightmap into its own buffer
createLightMap