Implement texture atlas, details on why it works unclear
This commit is contained in:
@@ -63,6 +63,7 @@ data World = World
|
||||
, _wallsZone :: IM.IntMap (IM.IntMap (IM.IntMap Wall))
|
||||
, _forceFields :: IM.IntMap ForceField
|
||||
, _floorItems :: IM.IntMap FloorItem
|
||||
, _floorTiles :: [RenderType]
|
||||
, _randGen :: StdGen
|
||||
, _mousePos :: !(Float,Float)
|
||||
, _testString :: String
|
||||
|
||||
@@ -9,6 +9,7 @@ import Dodge.Config.KeyConfig
|
||||
import Dodge.Item.Data
|
||||
import Picture
|
||||
import Geometry
|
||||
import Picture.Texture
|
||||
|
||||
import System.Random
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
@@ -36,6 +37,17 @@ defaultWorld = World
|
||||
, _wallsZone = IM.empty
|
||||
, _forceFields = IM.empty
|
||||
, _floorItems = IM.empty
|
||||
, _floorTiles =
|
||||
let x = 200
|
||||
y = 0.9
|
||||
z = 16
|
||||
r = 4
|
||||
in tileToRender [(0,0,z),(r,0,z),(r,r,z),(0,r,z)]
|
||||
[(20,100 + 20,y)
|
||||
,( x,100 + 20,y)
|
||||
,( x,100 + x,y)
|
||||
,(20,100 + x,y)
|
||||
]
|
||||
, _randGen = mkStdGen 2
|
||||
, _mousePos = (0,0)
|
||||
, _testString = []
|
||||
|
||||
+6
-6
@@ -1,8 +1,7 @@
|
||||
{- |
|
||||
Contains the central drawing functions for the dodge loop. -}
|
||||
module Dodge.Render
|
||||
( module Dodge.Render.Picture
|
||||
, doDrawing
|
||||
( doDrawing
|
||||
)
|
||||
where
|
||||
import Dodge.Data
|
||||
@@ -39,10 +38,8 @@ import Data.Tuple.Extra
|
||||
import Graphics.Rendering.OpenGL hiding (color,scale,translate,rotate)
|
||||
import qualified SDL
|
||||
|
||||
{- |
|
||||
Central drawing function.
|
||||
Returns a 'Word32' that should give the number of ticks it took to evaluate.
|
||||
-}
|
||||
{- | Central drawing function.
|
||||
Returns a 'Word32' that should give the number of ticks it took to evaluate. -}
|
||||
doDrawing :: RenderData -> World -> IO Word32
|
||||
doDrawing pdata w = do
|
||||
sTicks <- SDL.ticks
|
||||
@@ -73,6 +70,9 @@ doDrawing pdata w = do
|
||||
-- the depth buffer is ready to be drawn on
|
||||
blendFuncSeparate $= ((SrcAlphaSaturate, OneMinusSrcAlpha), (Zero,One))
|
||||
renderBackground pdata rot camzoom trans wins
|
||||
|
||||
_ <- renderShader (_textureArrayShader pdata) (_floorTiles w)
|
||||
|
||||
-- draw the walls
|
||||
depthFunc $= Just Less
|
||||
if w ^. config . wall_textured
|
||||
|
||||
Reference in New Issue
Block a user