aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Sunet <jeannekamikaze@gmail.com>2012-08-29 18:23:26 +0200
committerMarc Sunet <jeannekamikaze@gmail.com>2012-08-29 18:23:26 +0200
commit3bf679ded27bf9afd902cf07533824105055a9d6 (patch)
treeef6d019e07c56713948b070d45c89c455f3fe0b1
parent3b6e46ae6bb91a8f6bb9b1917f627f6e7f181d9b (diff)
Loader now handles animation speeds
-rw-r--r--Spear/Scene/Loader.hs10
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
32import Spear.Render.Program 32import Spear.Render.Program
33import Spear.Render.StaticModel as SM 33import Spear.Render.StaticModel as SM
34import Spear.Render.Texture 34import Spear.Render.Texture
35import Spear.Scene.GameObject 35import Spear.Scene.GameObject as GO
36import Spear.Scene.Graph 36import Spear.Scene.Graph
37import Spear.Scene.Light 37import Spear.Scene.Light
38import Spear.Scene.SceneResources 38import Spear.Scene.SceneResources
@@ -314,7 +314,8 @@ newLight _ = return ()
314loadGO :: GameStyle -> SceneResources -> [Property] -> Matrix3 -> Setup GameObject 314loadGO :: GameStyle -> SceneResources -> [Property] -> Matrix3 -> Setup GameObject
315loadGO style sceneRes props transf = do 315loadGO 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
328type CreateGameObject m a 332type CreateGameObject m a