summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lambdacube-gl.cabal2
-rw-r--r--src/LambdaCube/GL.hs1
-rw-r--r--src/LambdaCube/GL/Backend.hs12
-rw-r--r--src/LambdaCube/GL/Input.hs6
4 files changed, 11 insertions, 10 deletions
diff --git a/lambdacube-gl.cabal b/lambdacube-gl.cabal
index e9a8e71..ee76dab 100644
--- a/lambdacube-gl.cabal
+++ b/lambdacube-gl.cabal
@@ -1,5 +1,5 @@
1name: lambdacube-gl 1name: lambdacube-gl
2version: 0.5.1.2 2version: 0.5.2.0
3synopsis: OpenGL 3.3 Core Profile backend for LambdaCube 3D 3synopsis: OpenGL 3.3 Core Profile backend for LambdaCube 3D
4description: OpenGL 3.3 Core Profile backend for LambdaCube 3D 4description: OpenGL 3.3 Core Profile backend for LambdaCube 3D
5homepage: http://lambdacube3d.com 5homepage: http://lambdacube3d.com
diff --git a/src/LambdaCube/GL.hs b/src/LambdaCube/GL.hs
index f852eab..5436125 100644
--- a/src/LambdaCube/GL.hs
+++ b/src/LambdaCube/GL.hs
@@ -50,6 +50,7 @@ module LambdaCube.GL (
50 setObjectOrder, 50 setObjectOrder,
51 objectUniformSetter, 51 objectUniformSetter,
52 setScreenSize, 52 setScreenSize,
53 sortSlotObjects,
53 54
54 uniformBool, 55 uniformBool,
55 uniformV2B, 56 uniformV2B,
diff --git a/src/LambdaCube/GL/Backend.hs b/src/LambdaCube/GL/Backend.hs
index 37b38c0..c682723 100644
--- a/src/LambdaCube/GL/Backend.hs
+++ b/src/LambdaCube/GL/Backend.hs
@@ -750,14 +750,16 @@ renderFrame glp = do
750 case input of 750 case input of
751 Nothing -> putStrLn "Warning: No pipeline input!" >> return () 751 Nothing -> putStrLn "Warning: No pipeline input!" >> return ()
752 Just ic -> do 752 Just ic -> do
753 GLSlot _ objs _ <- readIORef (slotVector (icInput ic) ! (icSlotMapPipelineToInput ic ! slotIdx)) 753 let draw obj = do
754 --putStrLn $ "Rendering " ++ show (V.length objs) ++ " objects" 754 enabled <- readIORef $ objEnabled obj
755 V.forM_ objs $ \(_,obj) -> do 755 when enabled $ do
756 enabled <- readIORef $ objEnabled obj
757 when enabled $ do
758 cmd <- readIORef $ objCommands obj 756 cmd <- readIORef $ objCommands obj
759 --putStrLn "Render object" 757 --putStrLn "Render object"
760 renderSlot ((cmd ! icId ic) ! progIdx) 758 renderSlot ((cmd ! icId ic) ! progIdx)
759 --putStrLn $ "Rendering " ++ show (V.length objs) ++ " objects"
760 readIORef (slotVector (icInput ic) ! (icSlotMapPipelineToInput ic ! slotIdx)) >>= \case
761 GLSlot _ objs Ordered -> forM_ objs $ draw . snd
762 GLSlot objMap _ _ -> forM_ objMap draw
761 {- 763 {-
762 GLSetSampler 764 GLSetSampler
763 GLSaveImage 765 GLSaveImage
diff --git a/src/LambdaCube/GL/Input.hs b/src/LambdaCube/GL/Input.hs
index 00b2773..c979e28 100644
--- a/src/LambdaCube/GL/Input.hs
+++ b/src/LambdaCube/GL/Input.hs
@@ -133,15 +133,14 @@ addObject input slotName prim indices attribs uniformNames = do
133 Just ic <- readIORef $ glInput p 133 Just ic <- readIORef $ glInput p
134 case icSlotMapInputToPipeline ic ! slotIdx of 134 case icSlotMapInputToPipeline ic ! slotIdx of
135 Nothing -> do 135 Nothing -> do
136 putStrLn $ " ** slot is not used!" 136 --putStrLn $ " ** slot is not used!"
137 return V.empty -- this slot is not used in that pipeline 137 return V.empty -- this slot is not used in that pipeline
138 Just pSlotIdx -> do 138 Just pSlotIdx -> do
139 putStrLn "slot is used!" 139 --putStrLn "slot is used!"
140 --where 140 --where
141 let emptyV = V.replicate (V.length $ glPrograms p) [] 141 let emptyV = V.replicate (V.length $ glPrograms p) []
142 return $ emptyV // [(prgIdx,createObjectCommands (glTexUnitMapping p) topUnis obj (glPrograms p ! prgIdx))| prgIdx <- glSlotPrograms p ! pSlotIdx] 142 return $ emptyV // [(prgIdx,createObjectCommands (glTexUnitMapping p) topUnis obj (glPrograms p ! prgIdx))| prgIdx <- glSlotPrograms p ! pSlotIdx]
143 writeIORef cmdsRef cmds 143 writeIORef cmdsRef cmds
144 sortSlotObjects input
145 return obj 144 return obj
146 145
147removeObject :: GLStorage -> Object -> IO () 146removeObject :: GLStorage -> Object -> IO ()
@@ -154,7 +153,6 @@ setObjectOrder :: GLStorage -> Object -> Int -> IO ()
154setObjectOrder p obj i = do 153setObjectOrder p obj i = do
155 writeIORef (objOrder obj) i 154 writeIORef (objOrder obj) i
156 modifyIORef (slotVector p ! objSlot obj) $ \(GLSlot objs sorted _) -> GLSlot objs sorted Reorder 155 modifyIORef (slotVector p ! objSlot obj) $ \(GLSlot objs sorted _) -> GLSlot objs sorted Reorder
157 sortSlotObjects p
158 156
159objectUniformSetter :: Object -> Map GLUniformName InputSetter 157objectUniformSetter :: Object -> Map GLUniformName InputSetter
160objectUniformSetter = objUniSetter 158objectUniformSetter = objUniSetter