module Diagrams.ThreeD.Light where
import Data.Colour
import Data.Monoid
import Data.Typeable
import Diagrams.Core
import Diagrams.Direction
import Diagrams.ThreeD.Types
data PointLight n = PointLight (Point V3 n) (Colour Double)
deriving Typeable
type instance V (PointLight n) = V3
type instance N (PointLight n) = n
data ParallelLight n = ParallelLight (V3 n) (Colour Double)
deriving Typeable
type instance V (ParallelLight n) = V3
type instance N (ParallelLight n) = n
instance Fractional n => Transformable (PointLight n) where
transform t (PointLight p c) = PointLight (transform t p) c
instance Transformable (ParallelLight n) where
transform t (ParallelLight v c) = ParallelLight (transform t v) c
pointLight :: (Typeable n, Num n, Ord n, Renderable (PointLight n) b)
=> Colour Double
-> QDiagram b V3 n Any
pointLight c = mkQD (Prim $ PointLight origin c) mempty mempty mempty
(Query . const . Any $ False)
parallelLight :: (Typeable n, OrderedField n, Renderable (ParallelLight n) b)
=> Direction V3 n
-> Colour Double
-> QDiagram b V3 n Any
parallelLight d c = mkQD (Prim $ ParallelLight (fromDirection d) c)
mempty mempty mempty (Query . const . Any $ False)