aboutsummaryrefslogtreecommitdiff
path: root/Graphics/Glyph/BufferBuilder.hs
diff options
context:
space:
mode:
authorJoshua Rahm <joshua.rahm@colorado.edu>2014-03-20 01:16:40 -0600
committerJoshua Rahm <joshua.rahm@colorado.edu>2014-03-20 01:16:40 -0600
commita006a8dfc1d30a12160346da3c0ece4460b49966 (patch)
tree39628d52510f5c587735494a26e155c97dc6ce0b /Graphics/Glyph/BufferBuilder.hs
parentacd306c98a062be220fd52a44500f318a3c7b885 (diff)
downloadearths-ring-a006a8dfc1d30a12160346da3c0ece4460b49966.tar.gz
earths-ring-a006a8dfc1d30a12160346da3c0ece4460b49966.tar.bz2
earths-ring-a006a8dfc1d30a12160346da3c0ece4460b49966.zip
updated to add particles
Diffstat (limited to 'Graphics/Glyph/BufferBuilder.hs')
-rw-r--r--Graphics/Glyph/BufferBuilder.hs32
1 files changed, 16 insertions, 16 deletions
diff --git a/Graphics/Glyph/BufferBuilder.hs b/Graphics/Glyph/BufferBuilder.hs
index 4c56c6f..e9606de 100644
--- a/Graphics/Glyph/BufferBuilder.hs
+++ b/Graphics/Glyph/BufferBuilder.hs
@@ -88,7 +88,7 @@ compilingBuilder (Builder lst _) = do
tmp _ = 0
{- Simply figure out what types of elementse
- exist in this buffer -}
- let en@(bn,bc,bt) = Fold.foldl (\(bn,bc,bt) ele ->
+ let en@(bn,bc,bt) = Fold.foldl' (\(bn,bc,bt) ele ->
case ele of
NormalLink _ -> (True,bc,bt)
ColorLink _ -> (bn,True,bt)
@@ -100,8 +100,8 @@ compilingBuilder (Builder lst _) = do
(?) False = 0
-- Cur color normal texture buffer
let (nverts,_,_,_,buffer) =
- Fold.foldl (\(num,cn,cc,ct,ll) ele ->
- -- trace ("foldl " ++! ele) $
+ Fold.foldl' (\(num,cn,cc,ct,ll) ele ->
+ -- trace ("foldl " ++! ele) $
case ele of
NormalLink nn -> (num,nn,cc,ct,ll)
ColorLink nc -> (num,cn,nc,ct,ll)
@@ -111,19 +111,19 @@ compilingBuilder (Builder lst _) = do
ll >< (tp3 True vert >< tp3 bn cn >< tp4 bc cc >< tp2 bt ct)
)) ( 0, (0,0,0), (0,0,0,0), (0,0), Seq.empty ) (Seq.reverse lst)
- arr <- newListArray (0,Seq.length buffer) (Fold.toList buffer)
- ((putStrLn.("Compiled: "++!))>&>return) $ CompiledBuild stride en nverts arr
-
-
- where
- tp2 True (a,b) = Seq.fromList [a,b]
- tp2 False _ = empty
-
- tp3 True (a,b,c) = Seq.fromList [a,b,c]
- tp3 False _ = empty
-
- tp4 True (a,b,c,d) = Seq.fromList [a,b,c,d]
- tp4 False _ = empty
+ let blst = (Fold.toList buffer)
+ arr <- blst `seq` newListArray (0,Seq.length buffer) blst
+ let compiledRet = CompiledBuild stride en nverts arr
+ compiledRet `seq` putStrLn ("Compiled: " ++! compiledRet ) `seq` return compiledRet
+ where
+ tp2 True (a,b) = Seq.fromList [a,b]
+ tp2 False _ = empty
+
+ tp3 True (a,b,c) = Seq.fromList [a,b,c]
+ tp3 False _ = empty
+
+ tp4 True (a,b,c,d) = Seq.fromList [a,b,c,d]
+ tp4 False _ = empty
storableArrayToBuffer :: (Storable el) => BufferTarget -> StorableArray Int el -> IO BufferObject
storableArrayToBuffer target arr = do