Reduce rendertype down to vertex information
This commit is contained in:
+25
-12
@@ -19,13 +19,6 @@ pokeShader fs = F.FoldM (pokeVertices fls ptr stride) (return 0) return
|
||||
stride = sum $ _vboAttribSizes theVBO
|
||||
fls = _shaderPokeStrategy fs
|
||||
|
||||
pokeShaderLayer :: (Int,FullShader) -> F.FoldM IO (Int,RenderType) Int
|
||||
pokeShaderLayer (l,fs) = F.FoldM (pokeVerticesOff fls ptr stride l) (return 0) return
|
||||
where
|
||||
theVBO = _vaoVBO $ _shaderVAO fs
|
||||
ptr = _vboPointer theVBO
|
||||
stride = sum $ _vboAttribSizes theVBO
|
||||
fls = _shaderPokeStrategy fs
|
||||
|
||||
|
||||
pokeVertices
|
||||
@@ -37,17 +30,37 @@ pokeVertices
|
||||
-> IO Int
|
||||
pokeVertices toFs ptr stride n rt = foldM (pokeVertex ptr stride) n (toFs rt)
|
||||
|
||||
pokeShaderLayer :: (Int,VShader) -> F.FoldM IO Verx Int
|
||||
pokeShaderLayer (l,fs) = F.FoldM (pokeVerticesOff ptr (_vshaderPokeTest fs) stride l) (return 0) return
|
||||
where
|
||||
theVBO = _vaoVBO $ _vshaderVAO fs
|
||||
ptr = _vboPointer theVBO
|
||||
stride = sum $ _vboAttribSizes theVBO
|
||||
|
||||
pokeVerticesOff
|
||||
:: (RenderType -> [[Float]])
|
||||
-> Ptr Float
|
||||
:: Ptr Float
|
||||
-> (VertexType -> Bool)
|
||||
-> Int -- ^ stride
|
||||
-> Int -- ^ offset
|
||||
-> Int -- ^ number of vertices already poked
|
||||
-> (Int,RenderType)
|
||||
-> Verx
|
||||
-> IO Int
|
||||
pokeVerticesOff toFs ptr stride offset n (i,rt)
|
||||
| offset == i = foldM (pokeVertexOff ptr stride offset) n (toFs rt)
|
||||
pokeVerticesOff ptr vtest stride offset n vx
|
||||
| offset == i && typetest = do
|
||||
foldM (pokeVertexOff ptr stride offset) n (toFls vx)
|
||||
| otherwise = return n
|
||||
where
|
||||
i = _vxLayer vx
|
||||
typetest = vtest (_vxType vx)
|
||||
|
||||
toFls :: Verx -> [[Float]]
|
||||
toFls vx = [flat3 (_vxPos vx) ++ flat4 (_vxCol vx) ++ f (_vxType vx)]
|
||||
where
|
||||
f (PolyzV x) = [x]
|
||||
f (BezV x) = flat4 x
|
||||
f (TextV x) = flat2 x
|
||||
f (ArcV x) = flat3 x
|
||||
f _ = []
|
||||
|
||||
pokeVertexOff :: Ptr Float -> Int -> Int -> Int -> [Float] -> IO Int
|
||||
pokeVertexOff ptr stride offset n fs = do
|
||||
|
||||
Reference in New Issue
Block a user