diff options
author | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-29 18:23:26 +0200 |
---|---|---|
committer | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-29 18:23:26 +0200 |
commit | 3bf679ded27bf9afd902cf07533824105055a9d6 (patch) | |
tree | ef6d019e07c56713948b070d45c89c455f3fe0b1 | |
parent | 3b6e46ae6bb91a8f6bb9b1917f627f6e7f181d9b (diff) |
Loader now handles animation speeds
-rw-r--r-- | Spear/Scene/Loader.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Spear/Scene/Loader.hs b/Spear/Scene/Loader.hs index d53faab..64ad622 100644 --- a/Spear/Scene/Loader.hs +++ b/Spear/Scene/Loader.hs | |||
@@ -32,7 +32,7 @@ import Spear.Render.Material | |||
32 | import Spear.Render.Program | 32 | import Spear.Render.Program |
33 | import Spear.Render.StaticModel as SM | 33 | import Spear.Render.StaticModel as SM |
34 | import Spear.Render.Texture | 34 | import Spear.Render.Texture |
35 | import Spear.Scene.GameObject | 35 | import Spear.Scene.GameObject as GO |
36 | import Spear.Scene.Graph | 36 | import Spear.Scene.Graph |
37 | import Spear.Scene.Light | 37 | import Spear.Scene.Light |
38 | import Spear.Scene.SceneResources | 38 | import Spear.Scene.SceneResources |
@@ -314,7 +314,8 @@ newLight _ = return () | |||
314 | loadGO :: GameStyle -> SceneResources -> [Property] -> Matrix3 -> Setup GameObject | 314 | loadGO :: GameStyle -> SceneResources -> [Property] -> Matrix3 -> Setup GameObject |
315 | loadGO style sceneRes props transf = do | 315 | loadGO style sceneRes props transf = do |
316 | modelName <- asString . mandatory "model" $ props | 316 | modelName <- asString . mandatory "model" $ props |
317 | case getAnimatedModel sceneRes modelName of | 317 | let animSpeed = asFloat . value "animation-speed" $ props |
318 | go <- case getAnimatedModel sceneRes modelName of | ||
318 | Just model -> | 319 | Just model -> |
319 | return $ goNew style (Right model) (AABBCol $ AM.box 0 model) transf | 320 | return $ goNew style (Right model) (AABBCol $ AM.box 0 model) transf |
320 | Nothing -> | 321 | Nothing -> |
@@ -322,7 +323,10 @@ loadGO style sceneRes props transf = do | |||
322 | Just model -> | 323 | Just model -> |
323 | return $ goNew style (Left model) (AABBCol $ SM.box 0 model) transf | 324 | return $ goNew style (Left model) (AABBCol $ SM.box 0 model) transf |
324 | Nothing -> | 325 | Nothing -> |
325 | setupError $ "model " ++ modelName ++ " not found" | 326 | setupError $ "model " ++ modelName ++ " not found" |
327 | return $ case animSpeed of | ||
328 | Nothing -> go | ||
329 | Just s -> GO.setAnimationSpeed s go | ||
326 | 330 | ||
327 | 331 | ||
328 | type CreateGameObject m a | 332 | type CreateGameObject m a |