62 lines
1.4 KiB
Haskell
62 lines
1.4 KiB
Haskell
{-# LANGUAGE StrictData #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
|
|
module Shape.Data where
|
|
|
|
import Control.Lens
|
|
import Data.Aeson
|
|
import Data.Aeson.TH
|
|
import Geometry.Data
|
|
|
|
data ShapeType
|
|
= FlatFaces { _topBoxSize :: Int }
|
|
| RoundedFaces { _shapeHalfSize :: Int }
|
|
| Cylinder { _cylinderSize :: Int }
|
|
deriving (Eq, Ord, Show, Read)
|
|
-- for RoundedFaces, the first vertex in _sfVs should be the center of the top
|
|
-- plane, the second should be the center of the bottom plane.
|
|
|
|
data ShadowFidelity = FullShadowFidelity
|
|
| NoShadowFidelity
|
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
data Size = Huge
|
|
| Large
|
|
| Medium
|
|
| Small
|
|
| Tiny
|
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
data Importance = Essential
|
|
| Important
|
|
| Typical
|
|
| Unimportant
|
|
| Superfluous
|
|
deriving (Eq, Ord, Show, Read, Enum, Bounded) --Generic, Flat)
|
|
|
|
data Surface = Surface
|
|
{ _sfType :: ShapeType
|
|
, _sfVs :: [Point3]
|
|
, _sfColor :: Point4
|
|
, _sfShadowImportance :: Importance
|
|
, _sfSize :: Size
|
|
}
|
|
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
|
|
|
makeLenses ''Surface
|
|
makeLenses ''ShapeType
|
|
|
|
type Shape = [Surface]
|
|
|
|
|
|
--nShapeVerxComp :: Int
|
|
--nShapeVerxComp = sum shapeVerxSizes
|
|
--
|
|
--shapeVerxSizes :: [Int]
|
|
--shapeVerxSizes = [4,4,4]
|
|
|
|
deriveJSON defaultOptions ''ShadowFidelity
|
|
deriveJSON defaultOptions ''ShapeType
|
|
deriveJSON defaultOptions ''Size
|
|
deriveJSON defaultOptions ''Importance
|
|
deriveJSON defaultOptions ''Surface
|