Cleanup
This commit is contained in:
+1
-22
@@ -16,17 +16,14 @@ import Data.Preload.Render
|
||||
import qualified Data.Vector.Unboxed.Mutable as UMV
|
||||
import Dodge.Data.Universe
|
||||
import Dodge.Render.Lights
|
||||
import Dodge.Render.Picture
|
||||
import Dodge.Render.ShapePicture
|
||||
import Dodge.Render.Walls
|
||||
import Foreign
|
||||
import Geometry
|
||||
import Graphics.GL.Core45
|
||||
import MatrixHelper
|
||||
import Picture.Base
|
||||
import Render
|
||||
import qualified SDL
|
||||
--import qualified SDL
|
||||
import Shader
|
||||
import Shader.Bind
|
||||
import Shader.Data
|
||||
@@ -87,7 +84,7 @@ doDrawing' win pdata u = do
|
||||
ws
|
||||
)
|
||||
-- bind wall points, silhouette data, surface geometry
|
||||
bindShaderLayers shadV layerCounts
|
||||
bufferShaderLayers shadV layerCounts
|
||||
uncurry (zipWithM_ bufferPokedVBO) $
|
||||
unzip
|
||||
[ (pdata ^. vboWalls, nWalls)
|
||||
@@ -374,26 +371,8 @@ doDrawing' win pdata u = do
|
||||
glBindBufferBase GL_UNIFORM_BUFFER 0 (pdata ^. orthonormalMatUBO)
|
||||
renderLayer FixedCoordLayer shadV layerCounts
|
||||
glDepthMask GL_TRUE
|
||||
-- when (debugOn Show_ms_frame $ _uvConfig u) $
|
||||
-- renderFoldable
|
||||
-- (_pictureShaders pdata)
|
||||
-- ( setDepth (-1)
|
||||
-- . translate (-0.5) (-0.8)
|
||||
-- . scale 0.0005 0.0005
|
||||
-- $ fpsText (u ^. uvFrameTicks - u ^. uvLastFrameTicks)
|
||||
-- )
|
||||
SDL.glSwapWindow win
|
||||
|
||||
fpsText :: (Show a, Ord a, Num a) => a -> Picture
|
||||
fpsText x = color col $ text $ "ms/frame " ++ show x
|
||||
where
|
||||
col
|
||||
| x < 22 = blue
|
||||
| x < 30 = green
|
||||
| x < 40 = yellow
|
||||
| x < 50 = orange
|
||||
| otherwise = red
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- note: currently assume there is only one UBO, we only bind it once at setup
|
||||
--bufferUBO :: GLuint -> [Float] -> IO ()
|
||||
|
||||
@@ -14,8 +14,6 @@ import qualified Data.Set as Set
|
||||
import Dodge.Base
|
||||
import Dodge.Creature.Picture
|
||||
import Dodge.Creature.Picture.Awareness
|
||||
import Dodge.Data.Config
|
||||
import Dodge.Data.World
|
||||
import Dodge.Debug.Picture
|
||||
import Dodge.Draw
|
||||
import Dodge.Flare
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
module Dodge.TestString where
|
||||
|
||||
import Dodge.Render.ShapePicture
|
||||
import Dodge.Render.Lights
|
||||
import Data.Aeson (ToJSON)
|
||||
import Data.ByteString.Lazy.Char8 (unpack)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
module Render (
|
||||
createLightMap,
|
||||
renderFoldable,
|
||||
renderLayer,
|
||||
pingPongBetween,
|
||||
bindTO,
|
||||
@@ -351,16 +350,6 @@ pingPongBetween (fb1, to1) (fb2, to2) fs = do
|
||||
glBindTexture GL_TEXTURE_2D (_unTO to2)
|
||||
drawShader fs 4
|
||||
|
||||
renderFoldable ::
|
||||
MV.MVector (PrimState IO) (Shader,VBO) ->
|
||||
Picture ->
|
||||
IO ()
|
||||
renderFoldable shadV struct = do
|
||||
counts <- UMV.replicate 6 0
|
||||
pokeBindFoldable shadV counts struct
|
||||
MV.imapM_ (drawShaderLay 0 counts) shadV
|
||||
|
||||
------------------------------end renderFoldable
|
||||
renderLayer ::
|
||||
Layer ->
|
||||
MV.MVector (PrimState IO) (Shader,VBO) ->
|
||||
|
||||
@@ -3,24 +3,16 @@ module Shader (
|
||||
drawShaderLay,
|
||||
shadVBOptr,
|
||||
drawShader,
|
||||
pokeBindFoldable,
|
||||
pokeBindFoldableLayer,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Control.Monad
|
||||
import Control.Monad.Primitive
|
||||
--import qualified Data.Vector as V
|
||||
import qualified Data.Vector.Mutable as MV
|
||||
--import qualified Data.Vector.Unboxed as UV
|
||||
import qualified Data.Vector.Unboxed.Mutable as UMV
|
||||
import Foreign
|
||||
import Graphics.GL.Core45
|
||||
import Picture.Data
|
||||
import Shader.Bind
|
||||
import Shader.Data
|
||||
import Shader.Parameters
|
||||
import Shader.Poke
|
||||
|
||||
drawShaderLay :: Int -> UMV.MVector (PrimState IO) Int -> Int -> (Shader, VBO) -> IO ()
|
||||
{-# INLINE drawShaderLay #-}
|
||||
@@ -48,24 +40,6 @@ drawShader fs i = do
|
||||
freeShaderPointers' :: (Shader, VBO) -> IO ()
|
||||
freeShaderPointers' = free . _vboPtr . snd
|
||||
|
||||
pokeBindFoldable ::
|
||||
MV.MVector (PrimState IO) (Shader, VBO) ->
|
||||
UMV.MVector (PrimState IO) Int ->
|
||||
Picture ->
|
||||
IO ()
|
||||
pokeBindFoldable shadV counts m = do
|
||||
pokeVerxs shadV counts m
|
||||
bufferShaderVector shadV counts
|
||||
|
||||
pokeBindFoldableLayer ::
|
||||
MV.MVector (PrimState IO) (Shader, VBO) ->
|
||||
UMV.MVector (PrimState IO) Int ->
|
||||
Picture ->
|
||||
IO ()
|
||||
pokeBindFoldableLayer shadV counts m = do
|
||||
pokeLayVerxs shadV counts m
|
||||
bindShaderLayers shadV counts
|
||||
|
||||
shadVBOptr :: (Shader, VBO) -> Ptr Float
|
||||
{-# INLINE shadVBOptr #-}
|
||||
shadVBOptr = _vboPtr . snd
|
||||
|
||||
+3
-10
@@ -1,8 +1,6 @@
|
||||
module Shader.Bind (
|
||||
bindShaderLayers,
|
||||
--, bindShaderBuffers
|
||||
bufferShaderLayers,
|
||||
bufferPokedVBO,
|
||||
bufferShaderVector,
|
||||
) where
|
||||
|
||||
import Control.Monad.Primitive
|
||||
@@ -24,8 +22,8 @@ bufferPokedVBO theVBO numVs =
|
||||
(fromIntegral $ floatSize * numVs * _vboVertexSize theVBO)
|
||||
(_vboPtr theVBO)
|
||||
|
||||
bindShaderLayers :: MV.MVector (PrimState IO) (Shader, VBO) -> UMV.MVector (PrimState IO) Int -> IO ()
|
||||
bindShaderLayers shads counts = MV.imapM_ f shads
|
||||
bufferShaderLayers :: MV.MVector (PrimState IO) (Shader, VBO) -> UMV.MVector (PrimState IO) Int -> IO ()
|
||||
bufferShaderLayers shads counts = MV.imapM_ f shads
|
||||
where
|
||||
f i shad = do
|
||||
let theVBO = snd shad
|
||||
@@ -42,8 +40,3 @@ bindShaderLayers shads counts = MV.imapM_ f shads
|
||||
|
||||
glNamedBufferSubDataH :: GLuint -> GLintptr -> GLsizeiptr -> Ptr a -> IO ()
|
||||
glNamedBufferSubDataH = glNamedBufferSubData
|
||||
|
||||
bufferShaderVector :: MV.MVector (PrimState IO) (Shader, VBO) -> UMV.MVector (PrimState IO) Int -> IO ()
|
||||
bufferShaderVector shads counts = MV.imapM_ f shads
|
||||
where
|
||||
f i shad = UMV.read counts i >>= bufferPokedVBO (snd shad)
|
||||
|
||||
Reference in New Issue
Block a user