Refactor shapes, prepare for different normals at single vertex pos

This commit is contained in:
2023-03-15 21:43:00 +00:00
parent 989140d46e
commit 249262b2b6
7 changed files with 114 additions and 136 deletions
+10 -21
View File
@@ -18,38 +18,27 @@ shVfromList = id
{-# INLINE shEfromList #-}
shEfromList = id
newtype ShapeType = TopPrism { _prismSize :: Int }
deriving newtype (Eq, Ord, Show, Read)
data ShapeType = TopPrism { _prismSize :: Int }
-- | Surface { _surfaceSize :: Int}
deriving (Eq, Ord, Show, Read)
--deriving stock Generic
--deriving anyclass Flat
data ShapeObj = ShapeObj
{ _shType :: ShapeType
, _shVs :: [ShapeV]
data Surface = Surface
{ _sfType :: ShapeType
, _sfVs :: [Point3]
, _sfColor :: Point4
}
deriving (Eq, Ord, Show, Read) --Generic, Flat)
-- edges are given by four consecutive points
data ShapeV = ShapeV
{ _svPos :: Point3
, _svCol :: Point4
}
deriving (Eq, Ord, Show, Read) --Generic, Flat)
pairToSV :: (Point3, Point4) -> ShapeV
{-# INLINE pairToSV #-}
pairToSV = uncurry ShapeV
makeLenses ''ShapeV
makeLenses ''ShapeObj
makeLenses ''Surface
makeLenses ''ShapeType
type Shape = [ShapeObj]
type Shape = [Surface]
nShapeVerxComp :: Int
nShapeVerxComp = 12
deriveJSON defaultOptions ''ShapeType
deriveJSON defaultOptions ''ShapeV
deriveJSON defaultOptions ''ShapeObj
deriveJSON defaultOptions ''Surface