]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Interpolator.hh
fixed layer bugs; generalized octree
[chaz/yoink] / src / Moof / Interpolator.hh
index b32482c73a9e502667530293786db06f04b4d60a..4de3f6974bd3a7ceeaf93945b9d7ca5323126c07 100644 (file)
@@ -29,6 +29,7 @@
 #ifndef _MOOF_INTERPOLATOR_HH_
 #define _MOOF_INTERPOLATOR_HH_
 
+#include <Moof/Log.hh>
 #include <Moof/Math.hh>
 
 
@@ -47,7 +48,7 @@ class Interpolator
                        {
                                case STOP:
                                        value = 1.0;
-                                       stopped_ = true;
+                                       done_ = true;
                                        break;
                                case REPEAT:
                                        value -= 1.0;
@@ -64,7 +65,7 @@ class Interpolator
                        {
                                case STOP:
                                        value = 0.0;
-                                       stopped_ = true;
+                                       done_ = true;
                                        break;
                                case REPEAT:
                                        value += 1.0;
@@ -96,13 +97,13 @@ public:
        void setMode(Mode mode)
        {
                mode_ = mode;
-               stopped_ = false;
+               done_ = false;
        }
 
 
-       void update(Scalar dt)
+       void update(Scalar t, Scalar dt)
        {
-               if (!stopped_)
+               if (!done_)
                {
                        alpha_ += dt * scale_;
                        clamp(alpha_);
@@ -110,13 +111,19 @@ public:
                }
        }
 
+       bool isDone() const
+       {
+               return done_;
+       }
+
        virtual void calculate(Scalar alpha) = 0;
 
 private:
+
        Scalar  alpha_;
        Mode    mode_;
        Scalar  scale_;
-       bool    stopped_;
+       bool    done_;
 };
 
 template <class T = Scalar>
@@ -139,12 +146,12 @@ public:
 
        virtual void calculate(T& value, Scalar alpha) = 0;
 
-       const T& getValue()
+       const T& getValue() const
        {
                return value_;
        }
 
-       const T getState(Scalar alpha)
+       const T getState(Scalar alpha) const
        {
                return cml::lerp(previous_, value_, alpha);
        }
This page took 0.019091 seconds and 4 git commands to generate.