Refactor, try to limit dependencies

This commit is contained in:
2022-07-28 00:59:56 +01:00
parent 8aa5c17ab9
commit 160560af5f
418 changed files with 15104 additions and 13342 deletions
+40 -43
View File
@@ -1,58 +1,55 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}
module Dodge.Data.LightSource where
import GHC.Generics
import Data.Aeson
import Geometry
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
import Geometry
data LightSourceDraw = DefaultLightSourceDraw
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON LightSourceDraw where
toEncoding = genericToEncoding defaultOptions
instance FromJSON LightSourceDraw
data TLSIntensity = ConstantIntensity
deriving (Eq, Ord, Show, Read)
data TLSIntensity
= ConstantIntensity
| TLSFade Point3 Int
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON TLSIntensity where
toEncoding = genericToEncoding defaultOptions
instance FromJSON TLSIntensity
data TLSUpdate = DestroyTLS
deriving (Eq, Ord, Show, Read)
data TLSUpdate
= DestroyTLS
| TimerTLS
| IntensityTLS TLSIntensity
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON TLSUpdate where
toEncoding = genericToEncoding defaultOptions
instance FromJSON TLSUpdate
deriving (Eq, Ord, Show, Read)
data LSParam = LSParam
{ _lsPos :: !Point3
, _lsRad :: !Float
, _lsCol :: !Point3
{ _lsPos :: !Point3
, _lsRad :: !Float
, _lsCol :: !Point3
}
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON LSParam where
toEncoding = genericToEncoding defaultOptions
instance FromJSON LSParam
data LightSource = LS
{ _lsID :: Int
, _lsParam :: LSParam
, _lsDir :: Float
, _lsPict :: LightSourceDraw --LightSource -> Picture
deriving (Eq, Ord, Show, Read)
data LightSource = LS
{ _lsID :: Int
, _lsParam :: LSParam
, _lsDir :: Float
, _lsPict :: LightSourceDraw --LightSource -> Picture
}
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON LightSource where
toEncoding = genericToEncoding defaultOptions
instance FromJSON LightSource
data TempLightSource = TLS
{ _tlsParam :: LSParam
, _tlsUpdate :: TLSUpdate --TempLightSource -> Maybe TempLightSource
, _tlsTime :: Int
deriving (Eq, Ord, Show, Read)
data TempLightSource = TLS
{ _tlsParam :: LSParam
, _tlsUpdate :: TLSUpdate --TempLightSource -> Maybe TempLightSource
, _tlsTime :: Int
}
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON TempLightSource where
toEncoding = genericToEncoding defaultOptions
instance FromJSON TempLightSource
deriving (Eq, Ord, Show, Read)
makeLenses ''LSParam
makeLenses ''LightSource
makeLenses ''TempLightSource
deriveJSON defaultOptions ''LightSourceDraw
deriveJSON defaultOptions ''TLSIntensity
deriveJSON defaultOptions ''TLSUpdate
deriveJSON defaultOptions ''LSParam
deriveJSON defaultOptions ''LightSource
deriveJSON defaultOptions ''TempLightSource