]> git.tdb.fi Git - libs/demoscene.git/blobdiff - source/animate.cpp
Do not scale looping animation duration
[libs/demoscene.git] / source / animate.cpp
index d74c23920da32b08c720f5cded62459e1f588ce5..28129156796426e244593ad8787c1e2c6dcba894 100644 (file)
@@ -2,7 +2,9 @@
 #include "demo.h"
 
 using namespace std;
-using namespace Msp;
+
+namespace Msp {
+namespace DemoScene {
 
 Animate::Animate():
        target(0),
@@ -28,7 +30,9 @@ void Animate::validate() const
 
 void Animate::start(float, float d)
 {
-       float speed = (d ? (anim->get_duration()/Time::sec)/d : 1.0f);
+       float speed = 1.0f;
+       if(!anim->is_looping() && d)
+               speed = (anim->get_duration()/Time::sec)/d;
        player->play(*target, *anim, speed);
 }
 
@@ -50,3 +54,6 @@ void Animate::Loader::target(const string &n)
 {
        obj.target = &demo.get_thing<GL::Placeable>(n);
 }
+
+} // namespace DemoScene
+} // namespace Msp