diff options
author | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-06 13:24:41 +0200 |
---|---|---|
committer | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-06 13:24:41 +0200 |
commit | 6bb5583d7087419861b250c83f8783996bf5f9f8 (patch) | |
tree | 70f62042aa9355b53083b406d7a32769c46f4ed6 | |
parent | 9c9cbffd57a47abc3459d67e79fe9939c34668b3 (diff) |
Added setPos
-rw-r--r-- | Spear/Math/Spatial.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Spear/Math/Spatial.hs b/Spear/Math/Spatial.hs index d925f6f..fe2700f 100644 --- a/Spear/Math/Spatial.hs +++ b/Spear/Math/Spatial.hs | |||
@@ -49,6 +49,14 @@ class Spatial s where | |||
49 | -- | Set the 'Spatial''s transform. | 49 | -- | Set the 'Spatial''s transform. |
50 | setTransform :: Matrix4 -> s -> s | 50 | setTransform :: Matrix4 -> s -> s |
51 | 51 | ||
52 | -- | Set the 'Spatial''s position. | ||
53 | setPos :: Vector3 -> s -> s | ||
54 | setPos p s = setTransform t' s | ||
55 | where t' = M.transform r u f p | ||
56 | r = Spear.Math.Spatial.right s | ||
57 | u = Spear.Math.Spatial.up s | ||
58 | f = Spear.Math.Spatial.fwd s | ||
59 | |||
52 | -- | Make the 'Spatial' look at the given point. | 60 | -- | Make the 'Spatial' look at the given point. |
53 | lookAt :: Vector3 -> s -> s | 61 | lookAt :: Vector3 -> s -> s |
54 | lookAt pt s = | 62 | lookAt pt s = |