diff options
-rw-r--r-- | Spear.lkshw | 2 | ||||
-rw-r--r-- | Spear/Math/MatrixUtils.hs | 10 | ||||
-rw-r--r-- | Spear/Scene/GameObject.hs | 4 |
3 files changed, 8 insertions, 8 deletions
diff --git a/Spear.lkshw b/Spear.lkshw index c0d466b..a54198c 100644 --- a/Spear.lkshw +++ b/Spear.lkshw | |||
@@ -1,7 +1,7 @@ | |||
1 | Version of workspace file format: | 1 | Version of workspace file format: |
2 | 1 | 2 | 1 |
3 | Time of storage: | 3 | Time of storage: |
4 | "Sun Sep 2 11:28:18 CEST 2012" | 4 | "Sun Sep 2 15:36:42 CEST 2012" |
5 | Name of the workspace: | 5 | Name of the workspace: |
6 | "Spear" | 6 | "Spear" |
7 | File paths of contained packages: | 7 | File paths of contained packages: |
diff --git a/Spear/Math/MatrixUtils.hs b/Spear/Math/MatrixUtils.hs index 7502234..44af2c0 100644 --- a/Spear/Math/MatrixUtils.hs +++ b/Spear/Math/MatrixUtils.hs | |||
@@ -32,9 +32,9 @@ rpgTransform | |||
32 | :: Float -- ^ The height above the ground | 32 | :: Float -- ^ The height above the ground |
33 | -> Float -- ^ Angle of rotation | 33 | -> Float -- ^ Angle of rotation |
34 | -> Vector3 -- ^ Axis of rotation | 34 | -> Vector3 -- ^ Axis of rotation |
35 | -> Matrix3 | 35 | -> Vector2 -- ^ Object's position. |
36 | -> Matrix4 | 36 | -> Matrix4 |
37 | rpgTransform h a axis mat = | 37 | rpgTransform h a axis pos = |
38 | {-let r = let r' = M3.right mat in vec3 (V2.x r') (V2.y r') 0 | 38 | {-let r = let r' = M3.right mat in vec3 (V2.x r') (V2.y r') 0 |
39 | u = V3.unity | 39 | u = V3.unity |
40 | f = let f' = M3.forward mat in vec3 (V2.x f') 0 (V2.y f') | 40 | f = let f' = M3.forward mat in vec3 (V2.x f') 0 (V2.y f') |
@@ -43,7 +43,7 @@ rpgTransform h a axis mat = | |||
43 | r = M4.right mat' | 43 | r = M4.right mat' |
44 | u = M4.up mat' | 44 | u = M4.up mat' |
45 | f = M4.forward mat' | 45 | f = M4.forward mat' |
46 | t = vec3 0 h 0 + let t' = M3.position mat in vec3 (V2.x t') 0 (V2.y t') | 46 | t = vec3 0 h 0 + vec3 (V2.x pos) 0 (-V2.y pos) |
47 | in mat4 | 47 | in mat4 |
48 | (V3.x r) (V3.x u) (V3.x f) (V3.x t) | 48 | (V3.x r) (V3.x u) (V3.x f) (V3.x t) |
49 | (V3.y r) (V3.y u) (V3.y f) (V3.y t) | 49 | (V3.y r) (V3.y u) (V3.y f) (V3.y t) |
@@ -76,9 +76,9 @@ rpgInverse | |||
76 | :: Float -- ^ The height above the ground | 76 | :: Float -- ^ The height above the ground |
77 | -> Float -- ^ Angle of rotation | 77 | -> Float -- ^ Angle of rotation |
78 | -> Vector3 -- ^ Axis of rotation | 78 | -> Vector3 -- ^ Axis of rotation |
79 | -> Matrix3 | 79 | -> Vector2 |
80 | -> Matrix4 | 80 | -> Matrix4 |
81 | rpgInverse h a rot = M4.inverseTransform . rpgTransform h a rot | 81 | rpgInverse h a rot pos = M4.inverseTransform $ rpgTransform h a rot pos |
82 | 82 | ||
83 | 83 | ||
84 | -- | Compute the inverse transform of the given transformation matrix. | 84 | -- | Compute the inverse transform of the given transformation matrix. |
diff --git a/Spear/Scene/GameObject.hs b/Spear/Scene/GameObject.hs index b892b7d..fc35c2b 100644 --- a/Spear/Scene/GameObject.hs +++ b/Spear/Scene/GameObject.hs | |||
@@ -177,7 +177,7 @@ goAABBs = fmap getAABB . collisioners | |||
177 | 177 | ||
178 | -- | Get the game object's 3D transform. | 178 | -- | Get the game object's 3D transform. |
179 | go3Dtransform :: GameObject -> M4.Matrix4 | 179 | go3Dtransform :: GameObject -> M4.Matrix4 |
180 | go3Dtransform go = rpgTransform 0 (angle go) (axis go) . S2.transform $ go | 180 | go3Dtransform go = rpgTransform 0 (angle go) (axis go) (S2.pos go) |
181 | 181 | ||
182 | 182 | ||
183 | -- | Get the game object's current animation. | 183 | -- | Get the game object's current animation. |
@@ -251,7 +251,7 @@ goRender' :: (ProgramUniforms u, Program p) | |||
251 | goRender' style a axis prog uniforms model cam bindRenderer render = | 251 | goRender' style a axis prog uniforms model cam bindRenderer render = |
252 | let view = M4.inverseTransform $ Cam.transform cam | 252 | let view = M4.inverseTransform $ Cam.transform cam |
253 | modelview = case style of | 253 | modelview = case style of |
254 | RPG -> view * rpgTransform 0 a axis model | 254 | RPG -> view * rpgTransform 0 a axis (M3.position model) |
255 | PLT -> view * pltTransform model | 255 | PLT -> view * pltTransform model |
256 | normalmat = fastNormalMatrix modelview | 256 | normalmat = fastNormalMatrix modelview |
257 | in do | 257 | in do |