Commit before attempt to unify picture rendering
This commit is contained in:
@@ -73,6 +73,8 @@ data World = World
|
||||
, _soundQueue :: [(Int,Int16)]
|
||||
, _sounds :: M.Map SoundOrigin Sound
|
||||
, _decorations :: IM.IntMap Picture
|
||||
, _foregroundDecorations :: [Picture]
|
||||
, _midgroundDecorations :: [Picture]
|
||||
, _corpses :: IM.IntMap (IM.IntMap [Corpse])
|
||||
, _clickMousePos :: (Float,Float)
|
||||
, _pathGraph :: ~(Gr Point2 Float)
|
||||
|
||||
@@ -88,7 +88,20 @@ defaultWorld = World
|
||||
, _debugFlags = defaultDebugFlags
|
||||
, _inventoryMode = TopInventory
|
||||
, _lClickHammer = HammerUp
|
||||
, _foregroundDecorations =
|
||||
[setDepth (-0.2) $ rotate 0.75 $ pictures
|
||||
$ map f [5,25,45,65]
|
||||
]
|
||||
, _midgroundDecorations =
|
||||
[setDepth (-0.1) $ color orange $ pictures
|
||||
[ polygon $ rectNSEW 50 40 140 (-20)
|
||||
, translate 60 45 $ thickArc 0 pi 75 10
|
||||
]
|
||||
]
|
||||
}
|
||||
where
|
||||
f x = polygon $ rectNSEW (x - 20) (x-22) 500 0
|
||||
|
||||
defaultCreature :: Creature
|
||||
defaultCreature = Creature
|
||||
{ _crPos = (0,0)
|
||||
|
||||
+17
-1
@@ -52,7 +52,7 @@ doDrawing pdata w = do
|
||||
viewFroms@(viewFromx,viewFromy) = _cameraViewFrom w
|
||||
pic = worldPictures w
|
||||
wallPoints = map fst wallPointsCol
|
||||
-- set the coordinate uniforms ready for drawing elements with using world coordinates
|
||||
-- set the coordinate uniforms ready for drawing elements using world coordinates
|
||||
setCommonUniforms pdata rot camzoom trans wins
|
||||
depthFunc $= Just Less
|
||||
pmat <- (newMatrix RowMajor $ perspectiveMatrix rot camzoom trans wins viewFroms)
|
||||
@@ -88,7 +88,22 @@ doDrawing pdata w = do
|
||||
-- render transparent walls
|
||||
-- the ordering between these and transparent clouds perhaps presents a challenge
|
||||
renderBlankWalls pdata windowPoints pmat
|
||||
|
||||
setShaderUniforms rot (camzoom * (1/ 0.9)) trans wins
|
||||
$ map extractProgAndUnis $ _pictureShaders pdata
|
||||
depthFunc $= Just Lequal
|
||||
_ <- renderFoldable pdata $ picToLTree (Just 0) (midgroundPics w)
|
||||
|
||||
--depthMask $= Enabled
|
||||
-- set the coordinate uniforms for the foreground
|
||||
setShaderUniforms rot (camzoom * (1/ 0.8)) trans wins
|
||||
$ map extractProgAndUnis $ _pictureShaders pdata
|
||||
blendFunc $= (One,Zero)
|
||||
depthFunc $= Just Always
|
||||
_ <- renderFoldable pdata $ picToLTree (Just 0) (foregroundPics w)
|
||||
|
||||
depthMask $= Enabled
|
||||
|
||||
-- draw the fbo to the screen
|
||||
-- allows for post-processing
|
||||
-- first, bind the screen fbo
|
||||
@@ -107,6 +122,7 @@ doDrawing pdata w = do
|
||||
bindShaderBuffers [_grayscaleShader pdata] [4]
|
||||
drawShader (_grayscaleShader pdata) 4
|
||||
blend $= Enabled
|
||||
|
||||
-- reset the coordinate uniforms for pictures that are drawn wrt to window
|
||||
-- coordinates
|
||||
resetShaderUniforms (map extractProgAndUnis $ _pictureShaders pdata)
|
||||
|
||||
@@ -28,6 +28,11 @@ worldPictures w = pictures $ concat
|
||||
, map drawWallFloor (wallFloorsToDraw w)
|
||||
, testPic w
|
||||
]
|
||||
midgroundPics :: World -> Picture
|
||||
midgroundPics = pictures . _midgroundDecorations
|
||||
|
||||
foregroundPics :: World -> Picture
|
||||
foregroundPics = pictures . _foregroundDecorations
|
||||
|
||||
fixedCoordPictures :: World -> Picture
|
||||
fixedCoordPictures w = case _menuLayers w of
|
||||
|
||||
Reference in New Issue
Block a user