Implement poking using Verx lists

This commit is contained in:
2021-07-30 20:04:55 +02:00
parent 834464db51
commit d7649b951b
12 changed files with 109 additions and 155 deletions
+5 -7
View File
@@ -12,6 +12,7 @@ import Picture.Data
import Geometry.Data
--import Polyhedra.Data
--import Polyhedra
import Layers
--import Control.Lens
import Control.Monad
@@ -20,7 +21,7 @@ import Foreign hiding (rotate)
import Graphics.Rendering.OpenGL hiding (Line,translate,scale,imageHeight,Polygon,Color,T)
--import Data.Foldable
--import Data.Tuple.Extra
import qualified Data.IntMap.Strict as IM
--import qualified Data.IntMap.Strict as IM
import qualified SDL
divideSize :: Int -> Size -> Size
@@ -160,12 +161,10 @@ pokeBindFoldableLayer
-- :: Foldable f
:: RenderData
-> [Verx]
-> IO (IM.IntMap (PicShads Int))
-> IO (Layers (PicShads Int))
pokeBindFoldableLayer pdata m = do
let shads = _pictureShaders pdata
--slist' = (IM.fromList ((,) <$> [0..6] <*> [zeroCounts])) :: IM.IntMap (PicShads Int)
--slist'' <- foldM (pokeVX shads) slist' m
slist'' <- pokeLayVerxs (fmap (_vaoVBO . _vshaderVAO) shads) m
bindShaderLay shads slist''
@@ -187,9 +186,8 @@ renderFoldable pdata struct = do
return $ pokeEndTicks - pokeStartTicks
------------------------------end renderFoldable
renderLayer :: Int -> PicShads VShader -> IM.IntMap (PicShads Int) -> IO ()
renderLayer i shads counts =
mapM_ (uncurry $ drawShaderLay i) ((,) <$> shads <*> counts IM.! i)
renderLayer :: Int -> PicShads VShader -> Layers (PicShads Int) -> IO ()
renderLayer i shads counts = sequence_ $ drawShaderLay i <$> shads <*> getLay i counts
pokeTwoOff
:: Ptr Float