aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Sunet <jeannekamikaze@gmail.com>2012-08-29 18:47:14 +0200
committerMarc Sunet <jeannekamikaze@gmail.com>2012-08-29 18:47:14 +0200
commitec66c8cfbc5cf3dd7b521694d0b8c617088161aa (patch)
treee5aeb06dea8baacc34247bbe6a00ec002f5f7185
parentbd7c8d76bd54c874bbfad9da900d6d2a98fd5e61 (diff)
Fix: animation speed now taken into account in update
-rw-r--r--Spear.lkshw2
-rw-r--r--Spear/Render/AnimatedModel.hs7
2 files changed, 4 insertions, 5 deletions
diff --git a/Spear.lkshw b/Spear.lkshw
index b7737af..27e8748 100644
--- a/Spear.lkshw
+++ b/Spear.lkshw
@@ -1,7 +1,7 @@
1Version of workspace file format: 1Version of workspace file format:
2 1 2 1
3Time of storage: 3Time of storage:
4 "Wed Aug 29 17:58:31 CEST 2012" 4 "Wed Aug 29 18:42:19 CEST 2012"
5Name of the workspace: 5Name of the workspace:
6 "Spear" 6 "Spear"
7File paths of contained packages: 7File paths of contained packages:
diff --git a/Spear/Render/AnimatedModel.hs b/Spear/Render/AnimatedModel.hs
index 6e3c535..552fada 100644
--- a/Spear/Render/AnimatedModel.hs
+++ b/Spear/Render/AnimatedModel.hs
@@ -150,13 +150,12 @@ animatedModelRenderer animSpeed modelResource =
150-- | Update the 'AnimatedModelRenderer'. 150-- | Update the 'AnimatedModelRenderer'.
151update dt (AnimatedModelRenderer model curAnim startFrame endFrame curFrame fp s) = 151update dt (AnimatedModelRenderer model curAnim startFrame endFrame curFrame fp s) =
152 AnimatedModelRenderer model curAnim startFrame endFrame curFrame' fp' s 152 AnimatedModelRenderer model curAnim startFrame endFrame curFrame' fp' s
153 where f = fp + dt 153 where f = fp + dt * s
154 nextFrame = f >= 1.0 154 nextFrame = f >= 1.0
155 fp' = if nextFrame then f - 1.0 else f 155 fp' = if nextFrame then f - 1.0 else f
156 curFrame' = if nextFrame 156 curFrame' = if nextFrame
157 then 157 then let x = curFrame + 1
158 let x = curFrame + 1 158 in if x > endFrame then startFrame else x
159 in if x > endFrame then startFrame else x
160 else curFrame 159 else curFrame
161 160
162 161