Add Store instances

This commit is contained in:
2022-08-21 12:21:05 +01:00
parent 1ce7d4a72d
commit dd62e30026
92 changed files with 465 additions and 255 deletions
+9 -6
View File
@@ -5,6 +5,8 @@
module Dodge.Data.LightSource where
import TH.Derive
import Data.Store
import Data.Binary
import Flat
import LinearHelp ()
@@ -14,21 +16,22 @@ import Data.Aeson.TH
import Geometry
data LightSourceDraw = DefaultLightSourceDraw
| HackLightSourceDraw
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LightSourceDraw
$($(derive [d| instance Deriving (Store LightSourceDraw ) |]))
data TLSIntensity
= ConstantIntensity
| TLSFade Point3 Int
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TLSIntensity
$($(derive [d| instance Deriving (Store TLSIntensity) |]))
data TLSUpdate
= DestroyTLS
| TimerTLS
| IntensityTLS TLSIntensity
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TLSUpdate
$($(derive [d| instance Deriving (Store TLSUpdate) |]))
data LSParam = LSParam
{ _lsPos :: !Point3
@@ -36,7 +39,7 @@ data LSParam = LSParam
, _lsCol :: !Point3
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LSParam
$($(derive [d| instance Deriving (Store LSParam ) |]))
data LightSource = LS
{ _lsID :: Int
@@ -45,7 +48,7 @@ data LightSource = LS
, _lsPict :: LightSourceDraw --LightSource -> Picture
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LightSource
$($(derive [d| instance Deriving (Store LightSource ) |]))
data TempLightSource = TLS
{ _tlsParam :: LSParam
@@ -53,7 +56,7 @@ data TempLightSource = TLS
, _tlsTime :: Int
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TempLightSource
$($(derive [d| instance Deriving (Store TempLightSource ) |]))
makeLenses ''LSParam
makeLenses ''LightSource