Reduce rendertype down to vertex information

This commit is contained in:
2021-07-27 13:35:43 +02:00
parent d27c5e7ff4
commit ae84f44824
14 changed files with 225 additions and 189 deletions
+26 -22
View File
@@ -1,4 +1,4 @@
--{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TemplateHaskell #-}
--{-# LANGUAGE Strict #-}
{-# LANGUAGE DeriveGeneric #-}
module Picture.Data
@@ -15,17 +15,31 @@ import Data.Foldable
--import qualified Data.Sequence as Se
--import qualified Data.DList as DL
--import qualified Data.Vector as V
--import Control.Lens
import Control.Lens
--import Control.Monad
data Verx = Verx
{ _vxPos :: Point3
, _vxCol :: Point4
, _vxType :: VertexType
, _vxLayer :: Int
}
data VertexType
= PolyV
| PolyzV Float
| BezV Point4
| TextV Point2
| ArcV Point3
| EllV
data RenderType
= RenderPoly [(Point3,Point4)]
| RenderPolyZ [(Point3,Point4,Float)]
| RenderBezQ [(Point3,Point4,Point4)]
| RenderText [(Point3,Point4,Point2)]
| RenderArc [(Point3,Point4,Point3)]
| RenderEllipse [(Point3,Point4)]
| Render3 [Point3]
-- -= RenderPoly [(Point3,Point4)]
-- -| RenderPolyZ [(Point3,Point4,Float)]
-- -| RenderBezQ [(Point3,Point4,Point4)]
-- -| RenderText [(Point3,Point4,Point2)]
-- -| RenderArc [(Point3,Point4,Point3)]
-- -| RenderEllipse [(Point3,Point4)]
= Render3 [Point3]
| Render1111 {_unRender1111 :: (Float,Float,Float,Float)}
| Render22 {_unRender22 :: (Point2,Point2)}
| Render2221 {_unRender2221 :: (Point2,Point2,Point2,Float)}
@@ -99,20 +113,10 @@ flat4 (x,y,z,w) = [x,y,z,w]
{-# INLINE flat3 #-}
{-# INLINE flat4 #-}
type Picture = [(Int,RenderType)]
-- = Blank
-- | Text String
-- | Polygon [Point2]
-- | PolygonZ [Point2] Float
-- | BezierQuad [(Point2,RGBA,Point2,Point2)]
-- | PolygonCol [(Point2,RGBA)]
-- | Poly3D [(Point3,RGBA)]
-- | Circle RGBA RGBA Float
-- | ThickArc Float Float Float Float
-- | Pictures [Picture]
-- | OverPic (Point3 -> Point3) (Point4 -> Point4) Picture
-- | OnLayer Int Picture
type Picture = [Verx]
blank :: Picture
{-# INLINE blank #-}
blank = []
makeLenses ''Verx