diff options
Diffstat (limited to 'Spear/Scene/Light.hs')
-rw-r--r-- | Spear/Scene/Light.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Spear/Scene/Light.hs b/Spear/Scene/Light.hs index 76ff074..f482560 100644 --- a/Spear/Scene/Light.hs +++ b/Spear/Scene/Light.hs | |||
@@ -6,7 +6,7 @@ where | |||
6 | 6 | ||
7 | 7 | ||
8 | import qualified Spear.Math.Matrix4 as M | 8 | import qualified Spear.Math.Matrix4 as M |
9 | import qualified Spear.Math.Spatial as S | 9 | import qualified Spear.Math.Spatial3 as S |
10 | import Spear.Math.Vector3 | 10 | import Spear.Math.Vector3 |
11 | import qualified Spear.Math.Vector4 as V4 | 11 | import qualified Spear.Math.Vector4 as V4 |
12 | 12 | ||
@@ -32,7 +32,7 @@ data Light | |||
32 | } | 32 | } |
33 | 33 | ||
34 | 34 | ||
35 | instance S.Spatial Light where | 35 | instance S.Spatial3 Light where |
36 | move _ l@DirectionalLight {} = l | 36 | move _ l@DirectionalLight {} = l |
37 | move v l = l { transform = M.translv v * transform l} | 37 | move v l = l { transform = M.translv v * transform l} |
38 | 38 | ||
@@ -80,3 +80,8 @@ instance S.Spatial Light where | |||
80 | 80 | ||
81 | setTransform _ l@DirectionalLight {} = l | 81 | setTransform _ l@DirectionalLight {} = l |
82 | setTransform t l = l { Spear.Scene.Light.transform = t } | 82 | setTransform t l = l { Spear.Scene.Light.transform = t } |
83 | |||
84 | setPos _ l@DirectionalLight {} = l | ||
85 | setPos pos l = | ||
86 | let t = Spear.Scene.Light.transform l | ||
87 | in l { transform = M.transform (M.right t) (M.up t) (M.forward t) pos } | ||