Refactor vao preload
This commit is contained in:
+6
-75
@@ -14,24 +14,6 @@ import Control.Lens
|
||||
type RGBA = (Float,Float,Float,Float)
|
||||
type Color = (Float,Float,Float,Float)
|
||||
|
||||
|
||||
--type VerticesContainer a = Se.Seq a
|
||||
--toVC = Se.fromList
|
||||
--fromVC :: VerticesContainer a -> [a]
|
||||
--fromVC = F.toList
|
||||
--type VerticesContainer a = DL.DList a
|
||||
--toVC = DL.fromList
|
||||
--fromVC = DL.toList
|
||||
type VerticesContainer a = [a]
|
||||
toVC = id
|
||||
fromVC = id
|
||||
{-# INLINE toVC #-}
|
||||
{-# INLINE fromVC #-}
|
||||
{-# INLINE mapVC #-}
|
||||
|
||||
mapVC :: (a -> b) -> VerticesContainer a -> VerticesContainer b
|
||||
mapVC = fmap
|
||||
|
||||
data FTree a
|
||||
= FBranch (a -> a) (FTree a)
|
||||
| FBranches [FTree a]
|
||||
@@ -43,33 +25,6 @@ instance Foldable FTree where
|
||||
foldMap g (FLeaf x) = g x
|
||||
{-# INLINE foldMap #-}
|
||||
|
||||
--reduceShapeTree :: (Shape -> Shape) -> ShapeTree -> [Shape]
|
||||
--reduceShapeTree
|
||||
-- (TransformShape f xs) = map (f . reduceShapeTree) xs
|
||||
--reduceShapeTree
|
||||
-- (Leaf s) = [s]
|
||||
|
||||
-- data ShapeTree
|
||||
-- = TransformShape (Shape -> Shape) [ShapeTree]
|
||||
-- | Leaf Shape
|
||||
--
|
||||
-- data Shape
|
||||
-- = Shape
|
||||
-- { _shPos :: VerticesContainer Point3
|
||||
-- , _shCol :: VerticesContainer RGBA
|
||||
-- }
|
||||
-- | TextShape
|
||||
-- { _shPos :: VerticesContainer Point3
|
||||
-- , _shCol :: VerticesContainer RGBA
|
||||
-- , _shTex :: VerticesContainer Point2
|
||||
-- }
|
||||
--
|
||||
--combineShapes :: Shape -> Shape -> Shape
|
||||
--combineShapes sa sb = Shape
|
||||
-- { _shPos = _shPos sa <> _shPos sb
|
||||
-- , _shCol = _shCol sa <> _shCol sb
|
||||
-- }
|
||||
|
||||
flat2 (x,y) = [x,y]
|
||||
flat3 (x,y,z) = [x,y,z]
|
||||
flat4 (x,y,z,w) = [x,y,z,w]
|
||||
@@ -80,49 +35,25 @@ flat4 (x,y,z,w) = [x,y,z,w]
|
||||
data RenderType
|
||||
= RenderPoly [(Point3,Point4)]
|
||||
| RenderText [(Point3,Point4,Point2)]
|
||||
| RenderCirc (Point3,Point4,Float)
|
||||
| RenderArc (Point3,Point4,Point4)
|
||||
| RenderLine [(Point3,Point4)]
|
||||
| RenderBlank
|
||||
|
||||
data Picture
|
||||
= Blank
|
||||
| Text String
|
||||
| Polygon [Point2]
|
||||
| PolygonCol [(Point2,RGBA)]
|
||||
| Circle Float
|
||||
| Scale Float Float Picture
|
||||
| Translate Float Float Picture
|
||||
| Rotate Float Picture
|
||||
| SetDepth Float Picture
|
||||
| Color RGBA Picture
|
||||
| Pictures [Picture]
|
||||
|
||||
data Scene = Scene
|
||||
{ _scPosTri :: VerticesContainer Point3
|
||||
, _scColTri :: VerticesContainer RGBA
|
||||
, _scPosChar :: VerticesContainer Point3
|
||||
, _scColChar :: VerticesContainer RGBA
|
||||
, _scTexChar :: VerticesContainer Point2
|
||||
}
|
||||
|
||||
emptyScene :: Scene
|
||||
{-# INLINE emptyScene #-}
|
||||
emptyScene = Scene mempty mempty mempty mempty mempty
|
||||
| Line [Point2]
|
||||
|
||||
blank :: Picture
|
||||
{-# INLINE blank #-}
|
||||
blank = Blank
|
||||
|
||||
combineScenes :: Scene -> Scene -> Scene
|
||||
{-# INLINE combineScenes #-}
|
||||
combineScenes sa sb = Scene
|
||||
{ _scPosTri = _scPosTri sa <> _scPosTri sb
|
||||
, _scColTri = _scColTri sa <> _scColTri sb
|
||||
, _scPosChar = _scPosChar sa <> _scPosChar sb
|
||||
, _scColChar = _scColChar sa <> _scColChar sb
|
||||
, _scTexChar = _scTexChar sa <> _scTexChar sb
|
||||
}
|
||||
|
||||
instance Semigroup Scene where
|
||||
(<>) = combineScenes
|
||||
instance Monoid Scene where
|
||||
mempty = emptyScene
|
||||
--mappend = combineScenes
|
||||
|
||||
makeLenses ''Scene
|
||||
|
||||
Reference in New Issue
Block a user