Refactor shapes, prepare for different normals at single vertex pos
This commit is contained in:
+10
-21
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user