Fix normal map transformations for floor

This commit is contained in:
2023-03-18 12:17:42 +00:00
parent 2a9a38db8e
commit c6120f2fc9
11 changed files with 33 additions and 49 deletions
-1
View File
@@ -30,7 +30,6 @@ data CWorld = CWorld
, _pastWorlds :: [LWorld]
, _timeFlow :: TimeFlowStatus
, _seenWalls :: IS.IntSet
, _floorTiles :: [(Point3, Point3)]
, _cwTiles :: [Tile]
, _pathGraph :: Gr Point2 PathEdge
, _numberFloorVerxs :: Int
-2
View File
@@ -84,8 +84,6 @@ defaultCWorld =
, _pastWorlds = []
, _timeFlow = NormalTimeFlow
, _seenWalls = mempty
, _floorTiles = mempty
--, _pathGraph = mempty
, _pathGraph = Data.Graph.Inductive.Graph.empty
, _cwTiles = mempty
, _numberFloorVerxs = 0
+1 -14
View File
@@ -30,7 +30,6 @@ import Dodge.Zoning.Pathing
import Geometry
import qualified IntMapHelp as IM
import RandomHelp
import Tile
generateLevelFromRoomList :: IM.IntMap Room -> World -> GenWorld
generateLevelFromRoomList gr' w =
@@ -42,7 +41,7 @@ generateLevelFromRoomList gr' w =
. doInPlacements
. doOutPlacements
. doIndividualPlacements
. setFloors
. setTiles
. worldToGenWorld rs'
$ w & cWorld . lWorld . walls .~ wallsFromRooms rs
& cWorld . cwGen . cwgGameRooms .~ gameRoomsFromRooms (IM.elems rs')
@@ -60,12 +59,6 @@ generateLevelFromRoomList gr' w =
randomCompass :: World -> World
randomCompass w = w & cWorld . camPos . camRot .~ (takeOne [0, 0.5 * pi, pi, 1.5 * pi] & evalState $ _randGen w)
putFloorTiles :: GenWorld -> GenWorld
putFloorTiles gw = gw & gwWorld . cWorld . floorTiles .~ floorsFromGenWorld gw
setFloors :: GenWorld -> GenWorld
setFloors = putFloorTiles . setTiles
-- note the order of traversal of the rooms is important
-- hence the reverse
-- this is not ideal: should do this in some more sensible way
@@ -209,15 +202,9 @@ gameRoomFromRoom rm =
_ -> getDir xs
getDir _ = 0 -- fallback
floorsFromRooms :: [Room] -> [(Point3, Point3)]
floorsFromRooms = concatMap (concatMap tileToRenderList . getTiles . _rmFloor . doRoomShift)
tilesFromRooms :: [Room] -> [Tile]
tilesFromRooms = concatMap (getTiles . _rmFloor . doRoomShift)
floorsFromGenWorld :: GenWorld -> [(Point3, Point3)]
floorsFromGenWorld = floorsFromRooms . IM.elems . _genRooms
getTiles :: Floor -> [Tile]
getTiles fl = case fl of
Tiled xs -> xs
+1 -6
View File
@@ -33,12 +33,7 @@ generateWorldFromSeed rdata i = do
postGenerationProcessing :: RenderData -> GenWorld -> IO World
postGenerationProcessing _ gw = do
let w' = _gwWorld gw
-- nfloorvxs <- foldM (pokeTile (rdata ^. floorVBO . vboPtr))
-- 0
-- (tilesFromRooms . IM.elems $ _genRooms gw)
-- bufferPokedVBO (rdata ^. floorVBO) nfloorvxs
let w = w' -- & cWorld . numberFloorVerxs .~ nfloorvxs
& cWorld . cwTiles .~ (tilesFromRooms . IM.elems $ _genRooms gw)
let w = w' & cWorld . cwTiles .~ (tilesFromRooms . IM.elems $ _genRooms gw)
return $ foldl' assignPushDoors w (w ^. cWorld . lWorld . doors)
generateGraphs :: IO ()
-1
View File
@@ -89,7 +89,6 @@ doDrawing' win pdata u = do
unzip
[ (pdata ^. vboWalls, nWalls)
, (pdata ^. vboWindows, nWins)
, (pdata ^. floorVBO, nFls)
]
bufferPokedVBO (_vboShapes pdata) nShapeVs
glNamedBufferSubData
+2 -2
View File
@@ -46,7 +46,7 @@ shiftRoomBy shift r =
%~ map
( (tilePoly %~ map (shiftPointBy shift))
. (tileZero %~ shiftPointBy shift)
. (tileX %~ shiftPointBy shift)
. (tileTangentPos %~ shiftPointBy shift)
)
& rmViewpoints %~ map (shiftPointBy shift)
@@ -62,7 +62,7 @@ moveRoomBy shift r =
%~ map
( (tilePoly %~ map (shiftPointBy shift))
. (tileZero %~ shiftPointBy shift)
. (tileX %~ shiftPointBy shift)
. (tileTangentPos %~ shiftPointBy shift)
)
& rmViewpoints %~ map (shiftPointBy shift)
& rmPos %~ map ((rpPos %~ shiftPointBy shift) . (rpDir +~ snd shift))
+1 -1
View File
@@ -61,7 +61,7 @@ roomRect x y xn yn =
[ Tile
{ _tilePoly = rectNSWE y 0 0 x
, _tileZero = V2 0 0
, _tileX = V2 1 0
, _tileTangentPos = V2 32 0
, _tileZ = 16
}
]