Store number of vertices in an intmap

This commit is contained in:
2021-08-09 00:54:19 +02:00
parent 35f2499e85
commit 3fdae85953
4 changed files with 48 additions and 125 deletions
+10 -14
View File
@@ -12,16 +12,17 @@ import Picture.Data
import Geometry.Data
--import Polyhedra.Data
--import Polyhedra
import Layers
--import Layers
import Data.Foldable
--import Control.Lens
import Control.Monad
--import Control.Monad
--import qualified Control.Foldl as F
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
@@ -156,20 +157,14 @@ pokeBindFoldable pdata m = do
zeroCounts :: PicShads Int
zeroCounts = PicShads 0 0 0 0 0 0
pokeVerxLayers
:: PicShads VBO
-> [Verx]
-> Layers (PicShads Int)
-> IO (Layers (PicShads Int))
pokeVerxLayers = undefined
pokeBindFoldableLayer
:: RenderData
-> Picture
-> IO (Layers (PicShads Int))
-> IO (IM.IntMap (PicShads Int))
pokeBindFoldableLayer pdata m = do
let shads = _pictureShaders pdata
--slist'' <- fmap toIMLayers $ pokeLayVerxsFold (fmap (_vaoVBO . _vshaderVAO) shads) m
slist'' <- pokeLayVerxsFold (fmap (_vaoVBO . _vshaderVAO) shads) m
bindShaderLay shads slist''
@@ -185,14 +180,15 @@ renderFoldable pdata struct = do
count <- pokeBindFoldable pdata struct
let shads = _pictureShaders pdata
mapM_ (uncurry (drawShaderLay 0)) ((,) <$> shads <*> count)
sequence_ (drawShaderLay 0 <$> shads <*> count)
pokeEndTicks <- SDL.ticks
return $ pokeEndTicks - pokeStartTicks
------------------------------end renderFoldable
renderLayer :: Int -> PicShads VShader -> Layers (PicShads Int) -> IO ()
renderLayer i shads counts = sequence_ $ drawShaderLay i <$> shads <*> getLay i counts
renderLayer :: Int -> PicShads VShader -> IM.IntMap (PicShads Int) -> IO ()
renderLayer i shads counts = sequence_ $ drawShaderLay i <$> shads <*> counts IM.! i
where
pokeTwoOff
:: Ptr Float