Add Binary instances

This commit is contained in:
2022-08-21 10:58:19 +01:00
parent 386a2b4732
commit 1ce7d4a72d
95 changed files with 345 additions and 3 deletions
+7
View File
@@ -5,6 +5,7 @@
module Dodge.Data.LightSource where
import Data.Binary
import Flat
import LinearHelp ()
import Control.Lens
@@ -14,17 +15,20 @@ import Geometry
data LightSourceDraw = DefaultLightSourceDraw
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LightSourceDraw
data TLSIntensity
= ConstantIntensity
| TLSFade Point3 Int
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TLSIntensity
data TLSUpdate
= DestroyTLS
| TimerTLS
| IntensityTLS TLSIntensity
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TLSUpdate
data LSParam = LSParam
{ _lsPos :: !Point3
@@ -32,6 +36,7 @@ data LSParam = LSParam
, _lsCol :: !Point3
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LSParam
data LightSource = LS
{ _lsID :: Int
@@ -40,6 +45,7 @@ data LightSource = LS
, _lsPict :: LightSourceDraw --LightSource -> Picture
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary LightSource
data TempLightSource = TLS
{ _tlsParam :: LSParam
@@ -47,6 +53,7 @@ data TempLightSource = TLS
, _tlsTime :: Int
}
deriving (Eq, Ord, Show, Read, Generic, Flat)
instance Binary TempLightSource
makeLenses ''LSParam
makeLenses ''LightSource