From 3bf679ded27bf9afd902cf07533824105055a9d6 Mon Sep 17 00:00:00 2001 From: Marc Sunet Date: Wed, 29 Aug 2012 18:23:26 +0200 Subject: Loader now handles animation speeds --- Spear/Scene/Loader.hs | 10 +++++++--- 1 file 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 import Spear.Render.Program import Spear.Render.StaticModel as SM import Spear.Render.Texture -import Spear.Scene.GameObject +import Spear.Scene.GameObject as GO import Spear.Scene.Graph import Spear.Scene.Light import Spear.Scene.SceneResources @@ -314,7 +314,8 @@ newLight _ = return () loadGO :: GameStyle -> SceneResources -> [Property] -> Matrix3 -> Setup GameObject loadGO style sceneRes props transf = do modelName <- asString . mandatory "model" $ props - case getAnimatedModel sceneRes modelName of + let animSpeed = asFloat . value "animation-speed" $ props + go <- case getAnimatedModel sceneRes modelName of Just model -> return $ goNew style (Right model) (AABBCol $ AM.box 0 model) transf Nothing -> @@ -322,7 +323,10 @@ loadGO style sceneRes props transf = do Just model -> return $ goNew style (Left model) (AABBCol $ SM.box 0 model) transf Nothing -> - setupError $ "model " ++ modelName ++ " not found" + setupError $ "model " ++ modelName ++ " not found" + return $ case animSpeed of + Nothing -> go + Just s -> GO.setAnimationSpeed s go type CreateGameObject m a -- cgit v1.2.3