diff options
author | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-29 18:47:14 +0200 |
---|---|---|
committer | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-29 18:47:14 +0200 |
commit | ec66c8cfbc5cf3dd7b521694d0b8c617088161aa (patch) | |
tree | e5aeb06dea8baacc34247bbe6a00ec002f5f7185 | |
parent | bd7c8d76bd54c874bbfad9da900d6d2a98fd5e61 (diff) |
Fix: animation speed now taken into account in update
-rw-r--r-- | Spear.lkshw | 2 | ||||
-rw-r--r-- | Spear/Render/AnimatedModel.hs | 7 |
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 @@ | |||
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 | "Wed Aug 29 17:58:31 CEST 2012" | 4 | "Wed Aug 29 18:42:19 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/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'. |
151 | update dt (AnimatedModelRenderer model curAnim startFrame endFrame curFrame fp s) = | 151 | update 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 | ||