{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE GeneralisedNewtypeDeriving #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE TemplateHaskell #-} {-# OPTIONS_GHC -Wno-missing-signatures #-} module Shape.Data where import Foreign.Storable import Control.Lens import Data.Aeson import Data.Aeson.TH import Geometry.Data import Data.Word 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] shapeVerxSize = sizeOf (0 :: Float) * 8 + 4 * sizeOf (0 :: Word8) --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