Commit before fully removing uniforms other than the matrix

This commit is contained in:
jgk
2021-06-10 15:45:52 +02:00
parent aa30f6b969
commit 0a8370c7c6
9 changed files with 25 additions and 151 deletions
-92
View File
@@ -11,94 +11,14 @@ import Dodge.Item.Data
import Dodge.Creature.Stance.Data
import Dodge.Creature.State.Data
import Dodge.Creature.AlertLevel.Data
import Dodge.Debug.Flag.Data
import Dodge.Data.Menu
import Dodge.SoundLogic
import Dodge.Base
import Dodge.Picture.Layer
import Dodge.Config.Data
import Dodge.Config.KeyConfig
import Geometry
import Picture
import Control.Lens
import System.Random
import qualified Data.IntMap.Strict as IM
import qualified Data.Map as M
import qualified Data.Set as S
import Data.Graph.Inductive.Graph hiding ((&))
import Data.List
defaultWorld :: World
defaultWorld = World
{ _keys = S.empty
, _mouseButtons = S.empty
, _cameraCenter = (0,0)
, _cameraRot = 0
, _cameraZoom = 1
, _cameraViewFrom = (0,0)
, _creatures = IM.empty
, _creaturesZone = IM.empty
, _creatureGroups = IM.empty
, _clouds = IM.empty
, _cloudsZone = IM.empty
, _itemPositions = IM.empty
, _projectiles = IM.empty
, _particles = []
, _staticWalls = []
, _walls = IM.empty
, _wallsZone = IM.empty
, _forceFields = IM.empty
, _floorItems = IM.empty
, _randGen = mkStdGen 2
, _mousePos = (0,0)
, _testString = []
, _yourID = 0
, _worldEvents = id
, _pressPlates = IM.empty
, _buttons = IM.empty
, _soundQueue = []
, _sounds = M.empty
, _corpses = IM.empty
, _decorations = IM.empty
, _storedLevel = Nothing
, _menuLayers = [LevelMenu 1]
, _worldState = M.empty
, _worldTriggers = S.empty
, _clickMousePos = (0,0)
, _pathGraph = Data.Graph.Inductive.Graph.empty
, _pathGraph' = []
, _pathPoints = IM.empty
, _pathInc = M.empty
, _carteDisplay = False
, _carteCenter = (0,0)
, _carteZoom = 0.5
, _carteRot = 0
, _lightSources = IM.empty
, _tempLightSources = [youLight]
, _closeActiveObjects = []
, _seenLocations = IM.fromList
[(0, (_crPos . you, "CURRENT POSITION"))
,(1, (const (0,0) , "START POSITION"))
]
, _selLocation = 0
, _keyConfig = defaultKeyConfigSDL
, _config = defaultConfig
, _sideEffects = []
, _doneSideEffects = []
, _debugFlags = defaultDebugFlags
, _inventoryMode = TopInventory
, _lClickHammer = HammerUp
, _foregroundDecorations =
[ setDepth (-0.1) $ color orange $ pictures
[ polygon $ rectNSEW 50 40 140 (-20)
, translate 60 45 $ scale 0.5 1 $ thickArc 0 pi 75 10
]
, setDepth (-0.2) $ rotate 0.75 $ pictures
$ map f [5,25,45,65]
]
}
where
f x = polygon $ rectNSEW (x - 20) (x-22) 500 0
defaultCreature :: Creature
defaultCreature = Creature
@@ -255,18 +175,6 @@ defaultPP = PressPlate
, _ppID = -1
, _ppText = "Pressure plate"
}
defaultDebugFlags :: DebugFlags
defaultDebugFlags = DebugFlags
{ _noClip = False
, _displaySecondsPerFrame = True
}
youLight :: TempLightSource
youLight =
TLS { _tlsPos = (0,0)
,_tlsRad = 300
,_tlsIntensity = 0.1
,_tlsUpdate = \w _ -> (w, Just (youLight {_tlsPos = _crPos (you w)}))
}
+1 -1
View File
@@ -1,5 +1,5 @@
module Dodge.Initialisation where
import Dodge.Default
import Dodge.Default.World
import Dodge.Data
import Dodge.Data.Menu
import Dodge.Creature
+5
View File
@@ -61,6 +61,11 @@ doDrawing pdata w = do
:: IO (GLmatrix GLfloat)
-- draw the lightmap. Probably changes the bound framebufferObject
createLightMap pdata (w ^. config . shadow_resolution) wallPoints lightPoints viewFroms pmat
(foregroundPics w)
-- -- set the coordinate uniforms ready for drawing elements using world coordinates
-- setCommonUniforms pdata rot camzoom trans wins
-- draw the background. Assumes that depth testing is not enabled or that
-- the depth buffer is ready to be drawn on
blendFuncSeparate $= ((SrcAlphaSaturate, OneMinusSrcAlpha), (Zero,One))
+11 -2
View File
@@ -64,9 +64,10 @@ createLightMap
-> [(Point2,Point2)] -- Wall pairs
-> [Point4] -- Lights
-> (Float,Float) -- View from position
-> GLmatrix GLfloat
-> GLmatrix GLfloat -- perspective matrix
-> Picture -- foreground pictures
-> IO ()
createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) pmat = do
createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) pmat _ = do
-- get viewport size so we can reset it later
(vppos,vpsize) <- get viewport
@@ -99,6 +100,14 @@ createLightMap pdata resDiv wallPoints lightPoints (viewFromx,viewFromy) pmat =
$= (0 :: Float)
cullFace $= Just Back
drawShader (_lightingOccludeShader pdata) nWalls
cullFace $= Nothing
---- draw foreground elements to set z buffer
-- forM_ (_pictureShaders pdata) $ \shad -> do
-- currentProgram $= Just (_shaderProgram shad)
-- uniform (_shaderUniforms shad !! 4) $= pmat
-- _ <- renderFoldable pdata $ picToLTree (Just 0) fpics
-- for each of the lights:
-- stencil out the walls from this light's point of view
-- draw fading lightmap circles on the floor