Move toward implementing chasms
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -27,6 +27,7 @@ data CWorld = CWorld
|
|||||||
, _cwTiles :: [Tile]
|
, _cwTiles :: [Tile]
|
||||||
, _pathGraph :: Gr Point2 PathEdge
|
, _pathGraph :: Gr Point2 PathEdge
|
||||||
, _numberFloorVerxs :: Int
|
, _numberFloorVerxs :: Int
|
||||||
|
, _chasms :: [[Point2]]
|
||||||
}
|
}
|
||||||
|
|
||||||
data CWGen = CWGen
|
data CWGen = CWGen
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ data PSType
|
|||||||
| PutNothing
|
| PutNothing
|
||||||
| PutUsingGenParams (World -> (World, PSType))
|
| PutUsingGenParams (World -> (World, PSType))
|
||||||
| PutID {_putID :: Int}
|
| PutID {_putID :: Int}
|
||||||
|
| PutChasm {_putChasmPoly :: [Point2]}
|
||||||
|
|
||||||
-- maybe there is a monadic implementation of this?
|
-- maybe there is a monadic implementation of this?
|
||||||
-- add room effect for any placement spot?
|
-- add room effect for any placement spot?
|
||||||
|
|||||||
@@ -91,6 +91,7 @@ defaultCWorld =
|
|||||||
, _pathGraph = Data.Graph.Inductive.Graph.empty
|
, _pathGraph = Data.Graph.Inductive.Graph.empty
|
||||||
, _cwTiles = mempty
|
, _cwTiles = mempty
|
||||||
, _numberFloorVerxs = 0
|
, _numberFloorVerxs = 0
|
||||||
|
, _chasms = mempty
|
||||||
}
|
}
|
||||||
|
|
||||||
defaultLWorld :: LWorld
|
defaultLWorld :: LWorld
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ module Dodge.Placement.PlaceSpot (
|
|||||||
) where
|
) where
|
||||||
|
|
||||||
import Color
|
import Color
|
||||||
import Control.Lens
|
import LensHelp
|
||||||
import Control.Monad.State
|
import Control.Monad.State
|
||||||
import Data.Bifunctor
|
import Data.Bifunctor
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
@@ -140,6 +140,7 @@ placeSpotID' ps pt w = case pt of
|
|||||||
PutUsingGenParams f ->
|
PutUsingGenParams f ->
|
||||||
let (w', pt') = f w
|
let (w', pt') = f w
|
||||||
in placeSpotID' ps pt' w'
|
in placeSpotID' ps pt' w'
|
||||||
|
PutChasm ps' -> (0, w & cWorld . chasms .:~ map doShift ps')
|
||||||
where
|
where
|
||||||
p@(V2 px py) = _psPos ps
|
p@(V2 px py) = _psPos ps
|
||||||
p' = V3 px py 0
|
p' = V3 px py 0
|
||||||
|
|||||||
@@ -31,12 +31,16 @@ worldSPic cfig u =
|
|||||||
<> foldup floorItemSPic (filtOn _flItPos (_unNIntMap . _floorItems))
|
<> foldup floorItemSPic (filtOn _flItPos (_unNIntMap . _floorItems))
|
||||||
<> foldup btSPic (filtOn _btPos _buttons)
|
<> foldup btSPic (filtOn _btPos _buttons)
|
||||||
<> foldup (mcSPic (u ^. uvWorld . cWorld . lWorld)) (filtOn _mcPos _machines)
|
<> foldup (mcSPic (u ^. uvWorld . cWorld . lWorld)) (filtOn _mcPos _machines)
|
||||||
|
<> foldMap' drawChasm (u ^. uvWorld . cWorld . chasms)
|
||||||
where
|
where
|
||||||
w = _uvWorld u
|
w = _uvWorld u
|
||||||
foldup = foldMap'
|
foldup = foldMap'
|
||||||
filtOn f g = IM.filter (pointIsClose . f) (g (_lWorld (_cWorld w)))
|
filtOn f g = IM.filter (pointIsClose . f) (g (_lWorld (_cWorld w)))
|
||||||
pointIsClose = cullPoint cfig w
|
pointIsClose = cullPoint cfig w
|
||||||
|
|
||||||
|
drawChasm :: [Point2] -> SPic
|
||||||
|
drawChasm = noShape . color green . setDepth 2 . polygon
|
||||||
|
|
||||||
drawPulseBall :: PulseBall -> SPic
|
drawPulseBall :: PulseBall -> SPic
|
||||||
drawPulseBall pb =
|
drawPulseBall pb =
|
||||||
translateSPz 20
|
translateSPz 20
|
||||||
|
|||||||
@@ -120,8 +120,10 @@ roomPillars pillarsize w h wn hn = do
|
|||||||
addGirderLights $
|
addGirderLights $
|
||||||
rm
|
rm
|
||||||
& cleatSide
|
& cleatSide
|
||||||
& rmPmnts .~ plmnts
|
& rmPmnts .~ (testchasm : plmnts)
|
||||||
& rmName .~ "rectPillars"
|
& rmName .~ "rectPillars"
|
||||||
where
|
where
|
||||||
pilw = ((w - 40 * (fromIntegral wn + 1)) / fromIntegral wn) - pillarsize
|
pilw = ((w - 40 * (fromIntegral wn + 1)) / fromIntegral wn) - pillarsize
|
||||||
pilh = ((h - 40 * (fromIntegral hn + 1)) / fromIntegral hn) - pillarsize
|
pilh = ((h - 40 * (fromIntegral hn + 1)) / fromIntegral hn) - pillarsize
|
||||||
|
testchasm = Placement 0 (PS 0 0) (PutChasm (map (+V2 100 100) (square 50))) Nothing
|
||||||
|
(\_ _ -> Nothing)
|
||||||
|
|||||||
@@ -38,10 +38,6 @@ preloadRender = do
|
|||||||
glNamedBufferData theUBO 64 nullPtr GL_STREAM_DRAW
|
glNamedBufferData theUBO 64 nullPtr GL_STREAM_DRAW
|
||||||
glBindBufferBase GL_UNIFORM_BUFFER 0 theUBO
|
glBindBufferBase GL_UNIFORM_BUFFER 0 theUBO
|
||||||
|
|
||||||
-- orthonormalUBO <- mglCreate glCreateBuffers
|
|
||||||
-- withArray idMat $ \ptr ->
|
|
||||||
-- glNamedBufferStorage orthonormalUBO 64 ptr 0
|
|
||||||
|
|
||||||
lightsubo <- mglCreate glCreateBuffers
|
lightsubo <- mglCreate glCreateBuffers
|
||||||
glNamedBufferData lightsubo 640 nullPtr GL_STREAM_DRAW
|
glNamedBufferData lightsubo 640 nullPtr GL_STREAM_DRAW
|
||||||
glBindBufferBase GL_UNIFORM_BUFFER 1 lightsubo
|
glBindBufferBase GL_UNIFORM_BUFFER 1 lightsubo
|
||||||
@@ -113,7 +109,7 @@ preloadRender = do
|
|||||||
-- blank wallShader
|
-- blank wallShader
|
||||||
putStrLn "Setup floor VBO, shader"
|
putStrLn "Setup floor VBO, shader"
|
||||||
let floorverxstrd = 8
|
let floorverxstrd = 8
|
||||||
floorvbo <- setupVBOStatic floorverxstrd
|
floorvbo <- setupVBOStatic (floatSize * floorverxstrd)
|
||||||
floorshader <- makeShaderUsingVBO "floor/arrayPos" [vert, frag] (toFloatVAs [4, 4]) pmTriangles floorvbo
|
floorshader <- makeShaderUsingVBO "floor/arrayPos" [vert, frag] (toFloatVAs [4, 4]) pmTriangles floorvbo
|
||||||
initTexture2DArraySquare 40 3 GL_LINEAR_MIPMAP_LINEAR GL_LINEAR "data/normalMaps/diffuseArray.png"
|
initTexture2DArraySquare 40 3 GL_LINEAR_MIPMAP_LINEAR GL_LINEAR "data/normalMaps/diffuseArray.png"
|
||||||
initTexture2DArraySquare 41 3 GL_LINEAR_MIPMAP_LINEAR GL_LINEAR "data/normalMaps/normalArray.png"
|
initTexture2DArraySquare 41 3 GL_LINEAR_MIPMAP_LINEAR GL_LINEAR "data/normalMaps/normalArray.png"
|
||||||
|
|||||||
@@ -120,10 +120,10 @@ setupVBOStatic vertexsize = do
|
|||||||
-- Allocate space
|
-- Allocate space
|
||||||
glNamedBufferData
|
glNamedBufferData
|
||||||
vboname
|
vboname
|
||||||
(fromIntegral $ floatSize * numDrawableVertices * vertexsize)
|
(fromIntegral $ numDrawableVertices * vertexsize)
|
||||||
nullPtr
|
nullPtr
|
||||||
GL_STATIC_DRAW
|
GL_STATIC_DRAW
|
||||||
return VBO{_vboName = vboname, _vboPtr = thePtr, _vboVertexBytes = floatSize * vertexsize}
|
return VBO{_vboName = vboname, _vboPtr = thePtr, _vboVertexBytes = vertexsize}
|
||||||
|
|
||||||
makeByteStringShaderUsingVAO ::
|
makeByteStringShaderUsingVAO ::
|
||||||
-- | (Arbitrary) name of the shader
|
-- | (Arbitrary) name of the shader
|
||||||
|
|||||||
Reference in New Issue
Block a user