Cleanup
This commit is contained in:
@@ -28,6 +28,7 @@ data CWorld = CWorld
|
||||
, _pathGraph :: Gr Point2 PathEdge
|
||||
, _numberFloorVerxs :: Int
|
||||
, _chasms :: [[Point2]]
|
||||
, _numberChasmVerxs :: Int
|
||||
}
|
||||
|
||||
data CWGen = CWGen
|
||||
|
||||
@@ -92,6 +92,7 @@ defaultCWorld =
|
||||
, _cwTiles = mempty
|
||||
, _numberFloorVerxs = 0
|
||||
, _chasms = mempty
|
||||
, _numberChasmVerxs = 0
|
||||
}
|
||||
|
||||
defaultLWorld :: LWorld
|
||||
|
||||
@@ -58,6 +58,7 @@ doDrawing' win pdata u = do
|
||||
viewFroms@(V2 vfx vfy) = w ^. wCam . camViewFrom
|
||||
shadV = _pictureShaders pdata
|
||||
nFls = w ^. cWorld . numberFloorVerxs
|
||||
nchs = w ^. cWorld . numberChasmVerxs
|
||||
-- bind as much data into vbos as feasible at this point
|
||||
-- count mutable vectors setup
|
||||
pokeCounts <- UMV.replicate (numLayers * numShads) 0
|
||||
@@ -181,6 +182,13 @@ doDrawing' win pdata u = do
|
||||
(fromIntegral nIndices)
|
||||
GL_UNSIGNED_SHORT
|
||||
nullPtr
|
||||
-- draw chasm shader blocking floor
|
||||
glUseProgram (pdata ^. chasmShader . shaderUINT)
|
||||
glBindVertexArray $ pdata ^. chasmShader . shaderVAO . vaoName
|
||||
glDrawArrays
|
||||
(_unPrimitiveMode $ pdata ^. chasmShader . shaderPrimitive)
|
||||
0
|
||||
(fromIntegral nchs)
|
||||
--draw floor onto base buffer
|
||||
glUseProgram (pdata ^. floorShader . shaderUINT)
|
||||
glBindVertexArray $ pdata ^. floorShader . shaderVAO . vaoName
|
||||
|
||||
@@ -31,15 +31,15 @@ worldSPic cfig u =
|
||||
<> foldup floorItemSPic (filtOn _flItPos (_unNIntMap . _floorItems))
|
||||
<> foldup btSPic (filtOn _btPos _buttons)
|
||||
<> foldup (mcSPic (u ^. uvWorld . cWorld . lWorld)) (filtOn _mcPos _machines)
|
||||
<> foldMap' drawChasm (u ^. uvWorld . cWorld . chasms)
|
||||
-- <> foldMap' drawChasm (u ^. uvWorld . cWorld . chasms)
|
||||
where
|
||||
w = _uvWorld u
|
||||
foldup = foldMap'
|
||||
filtOn f g = IM.filter (pointIsClose . f) (g (_lWorld (_cWorld w)))
|
||||
pointIsClose = cullPoint cfig w
|
||||
|
||||
drawChasm :: [Point2] -> SPic
|
||||
drawChasm = noShape . color green . setDepth 2 . polygon
|
||||
--drawChasm :: [Point2] -> SPic
|
||||
--drawChasm = noShape . color green . setDepth 2 . polygon
|
||||
|
||||
drawPulseBall :: PulseBall -> SPic
|
||||
drawPulseBall pb =
|
||||
|
||||
@@ -19,4 +19,10 @@ postWorldLoad rdata cw = do
|
||||
0
|
||||
(cw ^. cwTiles)
|
||||
bufferPokedVBO (rdata ^. floorVBO) nfloorvxs
|
||||
nchasmvxs <- foldM (pokeChasm (rdata ^. chasmVBO . vboPtr))
|
||||
0
|
||||
(cw ^. chasms)
|
||||
bufferPokedVBO (rdata ^. chasmVBO) nchasmvxs
|
||||
return $ cw & numberFloorVerxs .~ nfloorvxs
|
||||
& numberChasmVerxs .~ nchasmvxs
|
||||
|
||||
|
||||
Reference in New Issue
Block a user