Move towards uploading certain vbos less than once per frame (floor)
This commit is contained in:
@@ -56,6 +56,8 @@ data RenderData = RenderData
|
|||||||
, _vboWalls :: VBO
|
, _vboWalls :: VBO
|
||||||
, _vboWindows :: VBO
|
, _vboWindows :: VBO
|
||||||
, _vboShapes :: VBO
|
, _vboShapes :: VBO
|
||||||
|
, _floorVBO :: VBO
|
||||||
|
, _floorShader :: FullShader
|
||||||
, _toNormalMaps :: TO
|
, _toNormalMaps :: TO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ data World = World
|
|||||||
, _pnZoning :: IntMap (IntMap [(Int, Point2)]) --Zoning IM.IntMap Creature
|
, _pnZoning :: IntMap (IntMap [(Int, Point2)]) --Zoning IM.IntMap Creature
|
||||||
, _peZoning :: IntMap (IntMap (Set PathEdgeNodes))
|
, _peZoning :: IntMap (IntMap (Set PathEdgeNodes))
|
||||||
, _gsZoning :: IntMap (IntMap IntSet)
|
, _gsZoning :: IntMap (IntMap IntSet)
|
||||||
|
, _numberFloorVerxs :: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
-- deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
-- deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ defaultWorld =
|
|||||||
, _pnZoning = mempty
|
, _pnZoning = mempty
|
||||||
, _peZoning = mempty
|
, _peZoning = mempty
|
||||||
, _gsZoning = mempty --Zoning IM.empty clZoneSize (zonePos _guPos)
|
, _gsZoning = mempty --Zoning IM.empty clZoneSize (zonePos _guPos)
|
||||||
|
, _numberFloorVerxs = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultCWGen :: CWGen
|
defaultCWGen :: CWGen
|
||||||
|
|||||||
@@ -24,14 +24,14 @@ generateWorldFromSeed i = do
|
|||||||
writeFile "log/aGeneratedRoomLayout" ""
|
writeFile "log/aGeneratedRoomLayout" ""
|
||||||
generateGraphs
|
generateGraphs
|
||||||
(roomList, bounds) <- layoutLevelFromSeed 0 i
|
(roomList, bounds) <- layoutLevelFromSeed 0 i
|
||||||
return $!
|
|
||||||
postGenerationProcessing $!
|
postGenerationProcessing $!
|
||||||
_gwWorld (generateLevelFromRoomList roomList initialWorld{_randGen = mkStdGen i})
|
_gwWorld (generateLevelFromRoomList roomList initialWorld{_randGen = mkStdGen i})
|
||||||
& cWorld . cwGen . cwgRoomClipping .~ bounds
|
& cWorld . cwGen . cwgRoomClipping .~ bounds
|
||||||
& cWorld . cwGen . cwgSeed .~ i
|
& cWorld . cwGen . cwgSeed .~ i
|
||||||
|
|
||||||
postGenerationProcessing :: World -> World
|
postGenerationProcessing :: World -> IO World
|
||||||
postGenerationProcessing w = foldl' assignPushDoors w (w ^. cWorld . lWorld . doors)
|
postGenerationProcessing w =
|
||||||
|
return $ foldl' assignPushDoors w (w ^. cWorld . lWorld . doors)
|
||||||
|
|
||||||
generateGraphs :: IO ()
|
generateGraphs :: IO ()
|
||||||
generateGraphs = TIO.writeFile "graph/itemCombinations.gv" combinationsDotGraph
|
generateGraphs = TIO.writeFile "graph/itemCombinations.gv" combinationsDotGraph
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ module Dodge.StartNewGame (
|
|||||||
startSeedGame,
|
startSeedGame,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Data.Preload.Render
|
||||||
|
import Shader.Data
|
||||||
|
import Shader.Poke -- it would be very nice to remove/rework the poking dependencies
|
||||||
import Dodge.Menu.Loading
|
import Dodge.Menu.Loading
|
||||||
import Dodge.Concurrent
|
import Dodge.Concurrent
|
||||||
--import Dodge.Menu.Option
|
--import Dodge.Menu.Option
|
||||||
@@ -23,11 +26,14 @@ blockingLoad str f u = u & uvScreenLayers .:~ loadingScreen str
|
|||||||
& addSideEffect f str
|
& addSideEffect f str
|
||||||
|
|
||||||
startSeedGame :: Int -> Int -> Universe -> Universe
|
startSeedGame :: Int -> Int -> Universe -> Universe
|
||||||
startSeedGame _ i = blockingLoad "LOADING" (startSeedGameConc i)
|
startSeedGame _ i u = blockingLoad "LOADING" (startSeedGameConc i $ u ^. preloadData) u
|
||||||
|
|
||||||
startSeedGameConc :: Int -> IO (Universe -> Maybe Universe)
|
startSeedGameConc :: Int -> PreloadData -> IO (Universe -> Maybe Universe)
|
||||||
startSeedGameConc seed = do
|
startSeedGameConc seed pdata = do
|
||||||
w <- generateWorldFromSeed seed
|
w' <- generateWorldFromSeed seed
|
||||||
|
nfloorvxs <- pokeFloors (pdata ^?! renderData . textureArrayShader . _2 . vboPtr)
|
||||||
|
(w' ^. cWorld . floorTiles)
|
||||||
|
let w = w' & numberFloorVerxs .~ nfloorvxs
|
||||||
writeFile "saveSlot/seed" $ show seed
|
writeFile "saveSlot/seed" $ show seed
|
||||||
return $ Just
|
return $ Just
|
||||||
. saveWorldInSlot (LevelStartSlot 0)
|
. saveWorldInSlot (LevelStartSlot 0)
|
||||||
|
|||||||
@@ -170,6 +170,9 @@ preloadRender = do
|
|||||||
textArrayShad <-
|
textArrayShad <-
|
||||||
makeShader "texture/arrayPos" [vert, frag] [3, 3] ETriangles
|
makeShader "texture/arrayPos" [vert, frag] [3, 3] ETriangles
|
||||||
>>= addTextureArray "data/texture/ayene_wooden_floor_transformed.png"
|
>>= addTextureArray "data/texture/ayene_wooden_floor_transformed.png"
|
||||||
|
let floorverxstrd = 8
|
||||||
|
vbofloor <- setupVBO floorverxstrd
|
||||||
|
floorshader <- makeShader4 "floor/arrayPos" [vert, frag] [4,4] floorverxstrd ETriangles vbofloor
|
||||||
-- bind fixed vertex data
|
-- bind fixed vertex data
|
||||||
bufferPokedVBO (snd fsShad) 4
|
bufferPokedVBO (snd fsShad) 4
|
||||||
framebuf2 <- setupTextureFramebuffer 800 600
|
framebuf2 <- setupTextureFramebuffer 800 600
|
||||||
@@ -254,6 +257,8 @@ preloadRender = do
|
|||||||
, _vboWalls = wpVBO
|
, _vboWalls = wpVBO
|
||||||
, _vboWindows = winVBO
|
, _vboWindows = winVBO
|
||||||
, _vboShapes = shVBO
|
, _vboShapes = shVBO
|
||||||
|
, _floorVBO = vbofloor
|
||||||
|
, _floorShader = floorshader
|
||||||
, _toNormalMaps = tonormalmap
|
, _toNormalMaps = tonormalmap
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ module Shader.Poke (
|
|||||||
pokeShape,
|
pokeShape,
|
||||||
pokeWallsWindowsFloor,
|
pokeWallsWindowsFloor,
|
||||||
memoTopPrismEdgeIndices,
|
memoTopPrismEdgeIndices,
|
||||||
|
pokeFloors
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Control.Monad.Primitive
|
import Control.Monad.Primitive
|
||||||
@@ -54,6 +55,11 @@ pokeWallsWindowsFloor wlptr wiptr flptr wls wis fls = do
|
|||||||
flcounts <- VFSM.foldlM' (pokeF flptr) 0 (VFSM.fromList fls)
|
flcounts <- VFSM.foldlM' (pokeF flptr) 0 (VFSM.fromList fls)
|
||||||
return (wlcounts1, wlcounts2, flcounts)
|
return (wlcounts1, wlcounts2, flcounts)
|
||||||
|
|
||||||
|
pokeFloors :: Ptr Float ->
|
||||||
|
[(Point3, Point3)] ->
|
||||||
|
IO Int
|
||||||
|
pokeFloors flptr fls = VFSM.foldlM' (pokeF flptr) 0 (VFSM.fromList fls)
|
||||||
|
|
||||||
pokeF :: Ptr Float -> Int -> (Point3, Point3) -> IO Int
|
pokeF :: Ptr Float -> Int -> (Point3, Point3) -> IO Int
|
||||||
pokeF ptr i' (V3 a b c, V3 d e f) = do
|
pokeF ptr i' (V3 a b c, V3 d e f) = do
|
||||||
let i = i' * 6
|
let i = i' * 6
|
||||||
|
|||||||
Reference in New Issue
Block a user