diff options
Diffstat (limited to 'src/LambdaCube/GL/Input.hs')
-rw-r--r-- | src/LambdaCube/GL/Input.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/LambdaCube/GL/Input.hs b/src/LambdaCube/GL/Input.hs index 0471a57..7a3b809 100644 --- a/src/LambdaCube/GL/Input.hs +++ b/src/LambdaCube/GL/Input.hs | |||
@@ -5,6 +5,7 @@ import Control.Applicative | |||
5 | import Control.Exception | 5 | import Control.Exception |
6 | import Control.Monad | 6 | import Control.Monad |
7 | import Control.Monad.Writer | 7 | import Control.Monad.Writer |
8 | import Data.Maybe | ||
8 | import Data.IORef | 9 | import Data.IORef |
9 | import Data.Map (Map) | 10 | import Data.Map (Map) |
10 | import Data.IntMap (IntMap) | 11 | import Data.IntMap (IntMap) |
@@ -101,7 +102,7 @@ addObject input slotName prim indices attribs uniformNames = do | |||
101 | enabled <- newIORef True | 102 | enabled <- newIORef True |
102 | index <- readIORef seed | 103 | index <- readIORef seed |
103 | modifyIORef seed (1+) | 104 | modifyIORef seed (1+) |
104 | (setters,unis) <- mkUniform [(n,t) | n <- uniformNames, let Just t = Map.lookup n (uniforms sch)] | 105 | (setters,unis) <- mkUniform [(n,t) | n <- uniformNames, let t = fromMaybe (error $ "missing uniform: " ++ n) $ Map.lookup n (uniforms sch)] |
105 | cmdsRef <- newIORef (V.singleton V.empty) | 106 | cmdsRef <- newIORef (V.singleton V.empty) |
106 | let obj = Object | 107 | let obj = Object |
107 | { objSlot = slotIdx | 108 | { objSlot = slotIdx |
@@ -216,7 +217,7 @@ createObjectCommands texUnitMap topUnis obj prg = objUniCmds ++ objStreamCmds ++ | |||
216 | uniInputType (GLUniform ty _) = ty | 217 | uniInputType (GLUniform ty _) = ty |
217 | 218 | ||
218 | -- object attribute stream commands | 219 | -- object attribute stream commands |
219 | objStreamCmds = [attrCmd i s | (i,name) <- Map.elems attrMap, let Just s = Map.lookup name objAttrs] | 220 | objStreamCmds = [attrCmd i s | (i,name) <- Map.elems attrMap, let s = fromMaybe (error $ "missing attribute: " ++ name) $ Map.lookup name objAttrs] |
220 | where | 221 | where |
221 | attrMap = inputStreams prg | 222 | attrMap = inputStreams prg |
222 | objAttrs = objAttributes obj | 223 | objAttrs = objAttributes obj |