Complete poke fold change
This commit is contained in:
@@ -4,6 +4,7 @@ module Shader.Poke
|
||||
, pokeArrayOff
|
||||
, pokePoint33s
|
||||
, pokeShape
|
||||
, pokeShape'
|
||||
, pokeWallsWindowsFloor
|
||||
) where
|
||||
import Shader.Data
|
||||
@@ -89,6 +90,14 @@ pokeShape
|
||||
-> IO ()
|
||||
pokeShape ptr iptr ieptr counts = VS.mapM_ (pokeShapeObj ptr iptr ieptr counts) . VS.fromList
|
||||
|
||||
pokeShape'
|
||||
:: Ptr Float
|
||||
-> Ptr GLushort
|
||||
-> Ptr GLushort
|
||||
-> [ShapeObj]
|
||||
-> IO (Int,Int,Int)
|
||||
pokeShape' ptr iptr ieptr = VS.foldM (pokeShapeObj' ptr iptr ieptr) (0,0,0) . VS.fromList
|
||||
|
||||
pokeShapeObj
|
||||
:: Ptr Float
|
||||
-> Ptr GLushort
|
||||
@@ -99,6 +108,29 @@ pokeShapeObj
|
||||
pokeShapeObj ptr iptr ieptr counts (ShapeObj shType shVerts) = case shType of
|
||||
TopPrism size -> pokeTopPrism (size - 2) ptr iptr ieptr counts shVerts
|
||||
|
||||
pokeShapeObj'
|
||||
:: Ptr Float
|
||||
-> Ptr GLushort
|
||||
-> Ptr GLushort
|
||||
-> (Int,Int,Int)
|
||||
-> ShapeObj
|
||||
-> IO (Int,Int,Int)
|
||||
pokeShapeObj' ptr iptr ieptr counts (ShapeObj shType shVerts) = case shType of
|
||||
TopPrism size -> pokeTopPrism' (size - 2) ptr iptr ieptr counts shVerts
|
||||
|
||||
pokeTopPrism' :: Int -> Ptr Float -> Ptr GLushort
|
||||
-> Ptr GLushort
|
||||
-> (Int,Int,Int)
|
||||
-> [ShapeV]
|
||||
-> IO (Int,Int,Int)
|
||||
pokeTopPrism' size ptr iptr ieptr (nv,nshapeindices,nedgeindices) svs = do
|
||||
nv' <- VS.foldM (pokeJustV' ptr) nv (VS.fromList svs)
|
||||
nshapeindices' <- UV.foldM (pokeTopPrismIndex' nv iptr) nshapeindices
|
||||
(memoTopPrismIndices V.! size)
|
||||
nedgeindices' <- UV.foldM (pokeTopPrismEdgeIndex' nv ieptr) nedgeindices
|
||||
(memoTopPrismEdgeIndices V.! size)
|
||||
return ( nv', nshapeindices', nedgeindices')
|
||||
|
||||
pokeTopPrism :: Int -> Ptr Float -> Ptr GLushort
|
||||
-> Ptr GLushort
|
||||
-> UMV.MVector (PrimState IO) Int
|
||||
|
||||
Reference in New Issue
Block a user