Move shape parameters into separate file
This commit is contained in:
@@ -5,6 +5,7 @@ module Preload.Render (
|
|||||||
cleanUpRenderPreload,
|
cleanUpRenderPreload,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Shape.Parameters
|
||||||
import Shader.Parameters
|
import Shader.Parameters
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
@@ -18,7 +19,6 @@ import Graphics.GL.Core45
|
|||||||
import Shader.AuxAddition
|
import Shader.AuxAddition
|
||||||
import Shader.Compile
|
import Shader.Compile
|
||||||
import Shader.Data
|
import Shader.Data
|
||||||
import Shape.Data
|
|
||||||
|
|
||||||
{- BINDING LIST:
|
{- BINDING LIST:
|
||||||
0 base
|
0 base
|
||||||
@@ -73,10 +73,7 @@ preloadRender = do
|
|||||||
-- note the shape shader vao is distinct from the position vao, but they
|
-- note the shape shader vao is distinct from the position vao, but they
|
||||||
-- share an EBO
|
-- share an EBO
|
||||||
shapeshader <- makeShaderUsingVBO "shape/basic" [vert, frag]
|
shapeshader <- makeShaderUsingVBO "shape/basic" [vert, frag]
|
||||||
[VertexAttribute 4 GL_FLOAT GL_FALSE 0
|
shapeVerxAttributes
|
||||||
,VertexAttribute 4 GL_UNSIGNED_BYTE GL_TRUE (fromIntegral 4 * fromIntegral floatSize)
|
|
||||||
,VertexAttribute 4 GL_FLOAT GL_FALSE (fromIntegral 4 * fromIntegral (floatSize + ubyteSize))
|
|
||||||
]
|
|
||||||
pmTriangles shVBO
|
pmTriangles shVBO
|
||||||
glVertexArrayElementBuffer (shapeshader ^. shaderVAO . vaoName) (shEBO ^. eboName)
|
glVertexArrayElementBuffer (shapeshader ^. shaderVAO . vaoName) (shEBO ^. eboName)
|
||||||
|
|
||||||
|
|||||||
+1
-3
@@ -9,6 +9,7 @@ module Shader.Poke (
|
|||||||
pokeFloors,
|
pokeFloors,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Shape.Parameters
|
||||||
import Color
|
import Color
|
||||||
import Control.Monad.Primitive
|
import Control.Monad.Primitive
|
||||||
import qualified Data.Vector as V
|
import qualified Data.Vector as V
|
||||||
@@ -433,7 +434,6 @@ pokeJustV xdata cp col ptr nv sh = do
|
|||||||
return (nv + 1)
|
return (nv + 1)
|
||||||
where
|
where
|
||||||
V3 x y z = sh
|
V3 x y z = sh
|
||||||
V4 r g b a = col
|
|
||||||
V3 nx ny nz = cp
|
V3 nx ny nz = cp
|
||||||
|
|
||||||
pokeJustVInvNormal ::
|
pokeJustVInvNormal ::
|
||||||
@@ -452,7 +452,6 @@ pokeJustVInvNormal xdata cp col ptr nv sh = do
|
|||||||
return (nv + 1)
|
return (nv + 1)
|
||||||
where
|
where
|
||||||
V3 x y z = sh
|
V3 x y z = sh
|
||||||
V4 r g b a = col
|
|
||||||
V3 nx ny nz = (2 * sh) - cp
|
V3 nx ny nz = (2 * sh) - cp
|
||||||
|
|
||||||
pokeFlatV ::
|
pokeFlatV ::
|
||||||
@@ -471,7 +470,6 @@ pokeFlatV xdata norm col ptr nv sh = do
|
|||||||
return (nv + 1)
|
return (nv + 1)
|
||||||
where
|
where
|
||||||
V3 x y z = sh
|
V3 x y z = sh
|
||||||
V4 r g b a = col
|
|
||||||
V3 nx ny nz = sh - norm
|
V3 nx ny nz = sh - norm
|
||||||
|
|
||||||
pokeLayVerxs ::
|
pokeLayVerxs ::
|
||||||
|
|||||||
@@ -8,12 +8,10 @@
|
|||||||
|
|
||||||
module Shape.Data where
|
module Shape.Data where
|
||||||
|
|
||||||
import Foreign.Storable
|
|
||||||
import Control.Lens
|
import Control.Lens
|
||||||
import Data.Aeson
|
import Data.Aeson
|
||||||
import Data.Aeson.TH
|
import Data.Aeson.TH
|
||||||
import Geometry.Data
|
import Geometry.Data
|
||||||
import Data.Word
|
|
||||||
|
|
||||||
data ShapeType
|
data ShapeType
|
||||||
= FlatFaces { _topBoxSize :: Int }
|
= FlatFaces { _topBoxSize :: Int }
|
||||||
@@ -54,7 +52,6 @@ makeLenses ''ShapeType
|
|||||||
|
|
||||||
type Shape = [Surface]
|
type Shape = [Surface]
|
||||||
|
|
||||||
shapeVerxSize = sizeOf (0 :: Float) * 8 + 4 * sizeOf (0 :: Word8)
|
|
||||||
|
|
||||||
--nShapeVerxComp :: Int
|
--nShapeVerxComp :: Int
|
||||||
--nShapeVerxComp = sum shapeVerxSizes
|
--nShapeVerxComp = sum shapeVerxSizes
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
module Shape.Parameters
|
||||||
|
where
|
||||||
|
|
||||||
|
import Shader.Parameters
|
||||||
|
import Shader.Data
|
||||||
|
import Data.Word
|
||||||
|
import Foreign.Storable
|
||||||
|
import Graphics.GL.Core45
|
||||||
|
|
||||||
|
shapeVerxSize :: Int
|
||||||
|
shapeVerxSize = sizeOf (0 :: Float) * 8 + 4 * sizeOf (0 :: Word8)
|
||||||
|
|
||||||
|
shapeVerxAttributes :: [VertexAttribute]
|
||||||
|
shapeVerxAttributes =
|
||||||
|
[VertexAttribute 4 GL_FLOAT GL_FALSE 0
|
||||||
|
,VertexAttribute 4 GL_UNSIGNED_BYTE GL_TRUE (fromIntegral (4 :: Int) * fromIntegral floatSize)
|
||||||
|
,VertexAttribute 4 GL_FLOAT GL_FALSE (fromIntegral (4 :: Int) * fromIntegral (floatSize + ubyteSize))
|
||||||
|
]
|
||||||
|
|
||||||
Reference in New Issue
Block a user