Forráskód Böngészése

Renames some methods/member variables to better reflect use.
General code cleanup.
Adds static void slerp(float q1x, float q1y, float q1z, float q1w, float q2x, float q2y, float q2z, float q2w, float t, float* dstx, float* dsty, float* dstz, float* dstw) method in Quaternion

Kieran Cunney 14 éve
szülő
commit
1dd0a7b5d3

+ 2 - 2
gameplay/src/AnimationClip.cpp

@@ -295,10 +295,10 @@ bool AnimationClip::update(unsigned long elapsedTime, std::list<AnimationTarget*
         target = channel->_target;
         value = _values[i];
 
-        // If the target's _bitFlag is clear, we can assume that this is the first
+        // If the target's _animationPropertyBitFlag is clear, we can assume that this is the first
         // animation channel to act on the target and we can add the target to the list of
         // active targets stored by the AnimationController.
-        if (target->_bitFlag == 0x00)
+        if (target->_animationPropertyBitFlag == 0x00)
             activeTargets->push_front(target);
 
         // Evaluate the point on Curve

+ 2 - 2
gameplay/src/AnimationController.cpp

@@ -349,12 +349,12 @@ void AnimationController::update(long elapsedTime)
         }
     }
 
-    // Loop through active AnimationTarget's and reset their _bitFlag for the next frame.
+    // Loop through active AnimationTarget's and reset their _animationPropertyBitFlag for the next frame.
     std::list<AnimationTarget*>::iterator targetItr = _activeTargets.begin();
     while (targetItr != _activeTargets.end())
     {
         AnimationTarget* target = (*targetItr);
-        target->_bitFlag = 0x00;
+        target->_animationPropertyBitFlag = 0x00;
         targetItr++;
     }
     _activeTargets.clear();

+ 1 - 1
gameplay/src/AnimationTarget.cpp

@@ -8,7 +8,7 @@ namespace gameplay
 {
 
 AnimationTarget::AnimationTarget()
-    : _targetType(SCALAR), _bitFlag(0x00), _animationChannels(NULL)
+    : _targetType(SCALAR), _animationPropertyBitFlag(0x00), _animationChannels(NULL)
 {
 }
 

+ 1 - 1
gameplay/src/AnimationTarget.h

@@ -69,7 +69,7 @@ protected:
 
     TargetType _targetType;             // The type of target this is.
 
-    char _bitFlag;
+    char _animationPropertyBitFlag;     // Bit flag used to indicate which properties on the AnimationTarget are currently animating.
 
 private:
 

+ 3 - 10
gameplay/src/Curve.cpp

@@ -1109,19 +1109,12 @@ void Curve::interpolateLinear(float s, Point* from, Point* to, float* dst) const
 }
 
 void Curve::interpolateQuaternion(float s, float* from, float* to, float* dst) const
-{
-    Quaternion quatFrom(from);
-    Quaternion quatTo(to);
-
-    // Normalize the quaternions.
-    quatFrom.normalize();
-    quatTo.normalize();
-        
+{        
     // Evaluate.
     if (s >= 0)
-        Quaternion::slerp(quatFrom, quatTo, s, (Quaternion*)dst);
+        Quaternion::slerp(from[0], from[1], from[2], from[3], to[0], to[1], to[2], to[3], s, dst, dst + 1, dst + 2, dst + 3);
     else
-        Quaternion::slerp(quatTo, quatFrom, -s, (Quaternion*)dst);
+        Quaternion::slerp(to[0], to[1], to[2], to[3], from[0], from[1], from[2], from[3], s, dst, dst + 1, dst + 2, dst + 3);
 }
 
 int Curve::determineIndex(float time) const

+ 81 - 125
gameplay/src/MaterialParameter.cpp

@@ -393,173 +393,96 @@ void MaterialParameter::setAnimationPropertyValue(int propertyId, AnimationValue
             {
                 case FLOAT:
                 {
-                    float value1 = value->getFloat(0);
-                    if (blendWeight != 1.0f)
-                        value1 *= blendWeight;
-
-                    if ((_bitFlag & UNIFORM_BIT) != UNIFORM_BIT)
+                    if (_count == 1)
                     {
-                        if (_count == 1)
+                        if ((_animationPropertyBitFlag & ANIMATION_UNIFORM_BIT) != ANIMATION_UNIFORM_BIT)
                         {
-                            _value.floatValue = value1;
+                            _animationPropertyBitFlag |= ANIMATION_UNIFORM_BIT;
+
+                            if (blendWeight != 1.0f)
+                                _value.floatValue = value->getFloat(0) * blendWeight;
+                            else
+                                _value.floatValue = value->getFloat(0);
                         }
                         else
                         {
-                            for (unsigned int i = 0; i < _count; i++)
-                                _value.floatPtrValue[i] = value1;
+                            if (blendWeight != 1.0f)
+                                _value.floatValue += value->getFloat(0) * blendWeight;
+                            else
+                                _value.floatValue += value->getFloat(0);
                         }
-                        _bitFlag |= UNIFORM_BIT;
                     }
                     else
                     {
-                        if (_count == 1)
-                        {
-                            _value.floatValue += value1;
-                        }
-                        else
-                        {
-                            for (unsigned int i = 0; i < _count; i++)
-                                _value.floatPtrValue[i] += value1;
-                        }
-                    }
+                        applyAnimationValue(value, blendWeight, 1);
+                    }                    
                     break;
                 }
                 case INT:
                 {
-                    float value1 = value->getFloat(0);
-                    if (blendWeight != 1.0f)
-                        value1 *= blendWeight;
-
-                    if ((_bitFlag & UNIFORM_BIT) != UNIFORM_BIT)
+                    if ((_animationPropertyBitFlag & ANIMATION_UNIFORM_BIT) != ANIMATION_UNIFORM_BIT)
                     {
+                        _animationPropertyBitFlag |= ANIMATION_UNIFORM_BIT;
+
                         if (_count == 1)
                         {
-                            _value.intValue = value1;
+                            if (blendWeight != 1.0f)
+                                _value.intValue = value->getFloat(0) * blendWeight;
+                            else
+                                _value.intValue = value->getFloat(0);
                         }
                         else
                         {
-                            for (unsigned int i = 0; i < _count; i++)
-                                _value.intPtrValue[i] = value1;
+                            if (blendWeight != 1.0f)
+                            {
+                                for (unsigned int i = 0; i < _count; i++)
+                                    _value.intPtrValue[i] = value->getFloat(i) * blendWeight;
+                            }
+                            else
+                            {
+                                for (unsigned int i = 0; i < _count; i++)
+                                    _value.intPtrValue[i] = value->getFloat(i);
+                            }
                         }
-                        _bitFlag |= UNIFORM_BIT;
                     }
                     else
                     {
                         if (_count == 1)
                         {
-                            _value.intValue += value1;
+                            if (blendWeight != 1.0f)
+                                _value.intValue += value->getFloat(0) * blendWeight;
+                            else
+                                _value.intValue += value->getFloat(0);
                         }
                         else
                         {
-                            for (unsigned int i = 0; i < _count; i++)
-                                _value.intPtrValue[i] += value1;
+                            if (blendWeight != 1.0f)
+                            {
+                                for (unsigned int i = 0; i < _count; i++)
+                                    _value.intPtrValue[i] += value->getFloat(i) * blendWeight;
+                            }
+                            else
+                            {
+                                for (unsigned int i = 0; i < _count; i++)
+                                    _value.intPtrValue[i] += value->getFloat(i);
+                            }
                         }
                     }
                     break;
                 }
                 case VECTOR2:
                 {
-                    float value1 = value->getFloat(0);
-                    float value2 = value->getFloat(1);
-                    if (blendWeight != 1.0f)
-                    {
-                        value1 *= blendWeight;
-                        value2 *= blendWeight;
-                    }
-
-                    if ((_bitFlag & UNIFORM_BIT) != UNIFORM_BIT)
-                    {
-                        unsigned int count = _count * 2;
-                        for (unsigned int i = 0; i < count; i++)
-                        {
-                            _value.floatPtrValue[i] = value1;
-                            _value.floatPtrValue[++i] = value2;
-                        }
-                        _bitFlag |= UNIFORM_BIT;
-                    }
-                    else
-                    {
-                        unsigned int count = _count * 2;
-                        for (unsigned int i = 0; i < count; i++)
-                        {
-                            _value.floatPtrValue[i] += value1;
-                            _value.floatPtrValue[++i] += value2;
-                        }
-                    }
+                    applyAnimationValue(value, blendWeight, 2);
                     break;
                 }
                 case VECTOR3:
                 {
-                    float value1 = value->getFloat(0);
-                    float value2 = value->getFloat(1);
-                    float value3 = value->getFloat(2);
-                    if (blendWeight != 1.0f)
-                    {
-                        value1 *= blendWeight;
-                        value2 *= blendWeight;
-                        value3 *= blendWeight;
-                    }
-
-                    if ((_bitFlag & UNIFORM_BIT) != UNIFORM_BIT)
-                    {
-                        unsigned int count = _count * 3;
-                        for (unsigned int i = 0; i < count; i++)
-                        {
-                            _value.floatPtrValue[i] = value1;
-                            _value.floatPtrValue[++i] = value2;
-                            _value.floatPtrValue[++i] = value3;
-                        }
-                        _bitFlag |= UNIFORM_BIT;
-                    }
-                    else
-                    {
-                        unsigned int count = _count * 3;
-                        for (unsigned int i = 0; i < count; i++)
-                        {
-                            _value.floatPtrValue[i] += value1;
-                            _value.floatPtrValue[++i] += value2;
-                            _value.floatPtrValue[++i] += value3;
-                        }
-                    }
+                    applyAnimationValue(value, blendWeight, 3);
                     break;
                 }
                 case VECTOR4:
                 {
-                    float value1 = value->getFloat(0);
-                    float value2 = value->getFloat(1);
-                    float value3 = value->getFloat(2);
-                    float value4 = value->getFloat(3);
-                    if (blendWeight != 1.0f)
-                    {
-                        value1 *= blendWeight;
-                        value2 *= blendWeight;
-                        value3 *= blendWeight;
-                        value4 *= blendWeight;
-                    }
-
-                    if ((_bitFlag & UNIFORM_BIT) != UNIFORM_BIT)
-                    {
-                        unsigned int count = _count * 4;
-                        for (unsigned int i = 0; i < count; i++)
-                        {
-                            _value.floatPtrValue[i] = value1;
-                            _value.floatPtrValue[++i] = value2;
-                            _value.floatPtrValue[++i] = value3;
-                            _value.floatPtrValue[++i] = value4;
-                        }
-                        _bitFlag |= UNIFORM_BIT;
-                    }
-                    else
-                    {
-                        unsigned int count = _count * 4;
-                        for (unsigned int i = 0; i < count; i++)
-                        {
-                            _value.floatPtrValue[i] += value1;
-                            _value.floatPtrValue[++i] += value2;
-                            _value.floatPtrValue[++i] += value3;
-                            _value.floatPtrValue[++i] += value4;;
-                        }
-                    }
+                    applyAnimationValue(value, blendWeight, 4);
                     break;
                 }
 
@@ -569,4 +492,37 @@ void MaterialParameter::setAnimationPropertyValue(int propertyId, AnimationValue
     }
 }
 
+void MaterialParameter::applyAnimationValue(AnimationValue* value, float blendWeight, int components)
+{
+    unsigned int count = _count * components;
+    if ((_animationPropertyBitFlag & ANIMATION_UNIFORM_BIT) != ANIMATION_UNIFORM_BIT)
+    {
+        _animationPropertyBitFlag |= ANIMATION_UNIFORM_BIT;
+
+        if (blendWeight != 1.0f)
+        {
+            for (unsigned int i = 0; i < count; i++)
+                _value.floatPtrValue[i] = value->getFloat(i) * blendWeight;
+        }
+        else
+        {
+            for (unsigned int i = 0; i < count; i++)
+                _value.floatPtrValue[i] = value->getFloat(i);
+        }
+    }
+    else
+    {
+        if (blendWeight != 1.0f)
+        {
+            for (unsigned int i = 0; i < count; i++)
+                _value.floatPtrValue[i] += (value->getFloat(i) * blendWeight);
+        }
+        else
+        {
+            for (unsigned int i = 0; i < count; i++)
+                _value.floatPtrValue[i] += value->getFloat(i);
+        }
+    }
+}
+
 }

+ 3 - 1
gameplay/src/MaterialParameter.h

@@ -253,7 +253,9 @@ private:
         METHOD
     } _type;
 
-    static const char UNIFORM_BIT = 0x01;
+    static const char ANIMATION_UNIFORM_BIT = 0x01;
+
+    void MaterialParameter::applyAnimationValue(AnimationValue* value, float blendWeight, int components);
 
     unsigned int _count;
     bool _dynamic;

+ 42 - 28
gameplay/src/Quaternion.cpp

@@ -262,28 +262,55 @@ void Quaternion::lerp(const Quaternion& q1, const Quaternion& q2, float t, Quate
 }
 
 void Quaternion::slerp(const Quaternion& q1, const Quaternion& q2, float t, Quaternion* dst)
+{
+    slerp(q1.x, q1.y, q1.z, q1.w, q2.x, q2.y, q2.z, q2.w, t, &dst->x, &dst->y, &dst->z, &dst->w);
+}
+
+void Quaternion::squad(const Quaternion& q1, const Quaternion& q2, const Quaternion& s1, const Quaternion& s2, float t, Quaternion* dst)
+{
+    assert(dst);
+    assert(!(t < 0.0f || t > 1.0f));
+
+    Quaternion dstQ(0.0f, 0.0f, 0.0f, 1.0f);
+    Quaternion dstS(0.0f, 0.0f, 0.0f, 1.0f);
+
+    slerpForSquad(q1, q2, t, &dstQ);
+    slerpForSquad(s1, s2, t, &dstS);
+    slerpForSquad(dstQ, dstS, 2.0f * t * (1.0f - t), dst);
+}
+
+void Quaternion::slerp(float q1x, float q1y, float q1z, float q1w, float q2x, float q2y, float q2z, float q2w, float t, float* dstx, float* dsty, float* dstz, float* dstw)
 {
     // Fast slerp implementation by kwhatmough:
     // It contains no division operations, no trig, no inverse trig
     // and no sqrt. Not only does this code tolerate small constraint
     // errors in the input quaternions, it actually corrects for them.
-    assert(dst);
+    assert(dstx && dsty && dstz && dstw);
     assert(!(t < 0.0f || t > 1.0f));
 
     if (t == 0.0f)
     {
-        memcpy(dst, &q1, sizeof(float) * 4);
+        *dstx = q1x;
+        *dsty = q1y;
+        *dstz = q1z;
+        *dstw = q1w;
         return;
     }
     else if (t == 1.0f)
     {
-        memcpy(dst, &q2, sizeof(float) * 4);
+        *dstx = q2x;
+        *dsty = q2y;
+        *dstz = q2z;
+        *dstw = q2w;
         return;
     }
 
-    if (q1.x == q2.x && q1.y == q2.y && q1.z == q2.z && q1.w == q2.w)
+    if (q1x == q2x && q1y == q2y && q1z == q2z && q1w == q2w)
     {
-        memcpy(dst, &q1, sizeof(float) * 4);
+        *dstx = q1x;
+        *dsty = q1y;
+        *dstz = q1z;
+        *dstw = q1w;
         return;
     }
 
@@ -293,7 +320,7 @@ void Quaternion::slerp(const Quaternion& q1, const Quaternion& q2, float t, Quat
     float halfSecHalfTheta, versHalfTheta;
     float sqNotU, sqU;
 
-    float cosTheta = q1.w * q2.w + q1.x * q2.x + q1.y * q2.y + q1.z * q2.z;
+    float cosTheta = q1w * q2w + q1x * q2x + q1y * q2y + q1z * q2z;
 
     // As usual in all slerp implementations, we fold theta.
     alpha = cosTheta >= 0 ? 1.0f : -1.0f;
@@ -334,34 +361,21 @@ void Quaternion::slerp(const Quaternion& q1, const Quaternion& q2, float t, Quat
     beta = f1 + f2b;
 
     // Apply final coefficients to a and b as usual.
-    float w = alpha * q1.w + beta * q2.w;
-    float x = alpha * q1.x + beta * q2.x;
-    float y = alpha * q1.y + beta * q2.y;
-    float z = alpha * q1.z + beta * q2.z;
+    float w = alpha * q1w + beta * q2w;
+    float x = alpha * q1x + beta * q2x;
+    float y = alpha * q1y + beta * q2y;
+    float z = alpha * q1z + beta * q2z;
 
     // This final adjustment to the quaternion's length corrects for
-    // any small constraint error in the inputs q1 and q2. But as you
+    // any small constraint error in the inputs q1 and q2 But as you
     // can see, it comes at the cost of 9 additional multiplication
     // operations. If this error-correcting feature is not required,
     // the following code may be removed.
     f1 = 1.5f - 0.5f * (w * w + x * x + y * y + z * z);
-    dst->w = w * f1;
-    dst->x = x * f1;
-    dst->y = y * f1;
-    dst->z = z * f1;
-}
-
-void Quaternion::squad(const Quaternion& q1, const Quaternion& q2, const Quaternion& s1, const Quaternion& s2, float t, Quaternion* dst)
-{
-    assert(dst);
-    assert(!(t < 0.0f || t > 1.0f));
-
-    Quaternion dstQ(0.0f, 0.0f, 0.0f, 1.0f);
-    Quaternion dstS(0.0f, 0.0f, 0.0f, 1.0f);
-
-    slerpForSquad(q1, q2, t, &dstQ);
-    slerpForSquad(s1, s2, t, &dstS);
-    slerpForSquad(dstQ, dstS, 2.0f * t * (1.0f - t), dst);
+    *dstw = w * f1;
+    *dstx = x * f1;
+    *dsty = y * f1;
+    *dstz = z * f1;
 }
 
 void Quaternion::slerpForSquad(const Quaternion& q1, const Quaternion& q2, float t, Quaternion* dst)

+ 30 - 2
gameplay/src/Quaternion.h

@@ -40,6 +40,8 @@ class Matrix;
  */
 class Quaternion
 {
+    friend class Curve;
+
 public:
 
     /**
@@ -293,7 +295,7 @@ public:
      * @param dst A quaternion to store the result in.
      */
     static void lerp(const Quaternion& q1, const Quaternion& q2, float t, Quaternion* dst);
-
+    
     /**
      * Interpolates between two quaternions using spherical linear interpolation.
      *
@@ -310,7 +312,7 @@ public:
      * @param dst A quaternion to store the result in.
      */
     static void slerp(const Quaternion& q1, const Quaternion& q2, float t, Quaternion* dst);
-
+    
     /**
      * Interpolates over a series of quaternions using spherical spline interpolation.
      *
@@ -350,6 +352,32 @@ public:
 
 private:
 
+    /**
+     * Interpolates between two quaternions using spherical linear interpolation.
+     *
+     * Spherical linear interpolation provides smooth transitions between different
+     * orientations and is often useful for animating models or cameras in 3D.
+     *
+     * Note: For accurate interpolation, the input quaternions must be at (or close to) unit length.
+     * This method does not automatically normalize the input quaternions, so it is up to the
+     * caller to ensure they call normalize beforehand, if necessary.
+     *
+     * @param q1x The x component of the first quaternion.
+     * @param q1y The y component of the first quaternion.
+     * @param q1z The z component of the first quaternion.
+     * @param q1w The w component of the first quaternion.
+     * @param q2x The x component of the second quaternion.
+     * @param q2y The y component of the second quaternion.
+     * @param q2z The z component of the second quaternion.
+     * @param q2w The w component of the second quaternion.
+     * @param t The interpolation coefficient.
+     * @param dstx A pointer to store the x component of the slerp in.
+     * @param dsty A pointer to store the y component of the slerp in.
+     * @param dstz A pointer to store the z component of the slerp in.
+     * @param dstw A pointer to store the w component of the slerp in.
+     */
+    static void slerp(float q1x, float q1y, float q1z, float q1w, float q2x, float q2y, float q2z, float q2w, float t, float* dstx, float* dsty, float* dstz, float* dstw);
+
     static void slerpForSquad(const Quaternion& q1, const Quaternion& q2, float t, Quaternion* dst);
 };
 

+ 48 - 52
gameplay/src/Transform.cpp

@@ -662,9 +662,9 @@ void Transform::setAnimationPropertyValue(int propertyId, AnimationValue* value,
             if (blendWeight != 1.0f)
                 scale *= blendWeight;
 
-            animateScaleX(scale);
-            animateScaleY(scale);
-            animateScaleZ(scale);
+            applyAnimationValueScaleX(scale);
+            applyAnimationValueScaleY(scale);
+            applyAnimationValueScaleZ(scale);
             
             break;
         }   
@@ -680,9 +680,9 @@ void Transform::setAnimationPropertyValue(int propertyId, AnimationValue* value,
                 sz *= blendWeight;
             }
 
-            animateScaleX(sx);
-            animateScaleY(sy);
-            animateScaleZ(sz);
+            applyAnimationValueScaleX(sx);
+            applyAnimationValueScaleY(sy);
+            applyAnimationValueScaleZ(sz);
 
             break;
         }
@@ -693,7 +693,7 @@ void Transform::setAnimationPropertyValue(int propertyId, AnimationValue* value,
             if (blendWeight != 1.0f)
                 sx *= blendWeight;
 
-            animateScaleX(sx);
+            applyAnimationValueScaleX(sx);
 
             break;
         }
@@ -704,7 +704,7 @@ void Transform::setAnimationPropertyValue(int propertyId, AnimationValue* value,
             if (blendWeight != 1.0f)
                 sy *= blendWeight;
 
-            animateScaleY(sy);
+            applyAnimationValueScaleY(sy);
 
             break;
         }
@@ -715,7 +715,7 @@ void Transform::setAnimationPropertyValue(int propertyId, AnimationValue* value,
             if (blendWeight != 1.0f)
                 sz *= blendWeight;
 
-            animateScaleZ(sz);
+            applyAnimationValueScaleZ(sz);
 
             break;
         }
@@ -726,7 +726,7 @@ void Transform::setAnimationPropertyValue(int propertyId, AnimationValue* value,
             if (blendWeight != 1.0f)
                 Quaternion::slerp(Quaternion::identity(), q, blendWeight, &q);
 
-            animateRotate(&q);
+            applyAnimationValueRotation(&q);
             
             break;
         }
@@ -743,9 +743,9 @@ void Transform::setAnimationPropertyValue(int propertyId, AnimationValue* value,
                 tz *= blendWeight;
             }
 
-            animateTranslateX(tx);
-            animateTranslateY(ty);
-            animateTranslateZ(tz);
+            applyAnimationValueTranslationX(tx);
+            applyAnimationValueTranslationY(ty);
+            applyAnimationValueTranslationZ(tz);
             
             break;
         }
@@ -756,7 +756,7 @@ void Transform::setAnimationPropertyValue(int propertyId, AnimationValue* value,
             if (blendWeight != 1.0f)
                 tx *= blendWeight;
 
-            animateTranslateX(tx);
+            applyAnimationValueTranslationX(tx);
 
             break;
         }
@@ -767,7 +767,7 @@ void Transform::setAnimationPropertyValue(int propertyId, AnimationValue* value,
             if (blendWeight != 1.0f)
                 ty *= blendWeight;
             
-            animateTranslateY(ty);
+            applyAnimationValueTranslationY(ty);
 
             break;
         }
@@ -778,7 +778,7 @@ void Transform::setAnimationPropertyValue(int propertyId, AnimationValue* value,
             if (blendWeight != 1.0f)
                 tz *= blendWeight;
 
-            animateTranslateZ(tz);
+            applyAnimationValueTranslationZ(tz);
 
             break;
         }
@@ -797,10 +797,10 @@ void Transform::setAnimationPropertyValue(int propertyId, AnimationValue* value,
                 tz *= blendWeight;
             }
 
-            animateRotate(&q);
-            animateTranslateX(tx);
-            animateTranslateY(ty);
-            animateTranslateZ(tz);
+            applyAnimationValueRotation(&q);
+            applyAnimationValueTranslationX(tx);
+            applyAnimationValueTranslationY(ty);
+            applyAnimationValueTranslationZ(tz);
             
             break;
         }
@@ -825,13 +825,13 @@ void Transform::setAnimationPropertyValue(int propertyId, AnimationValue* value,
                 tz *= blendWeight;
             }
 
-            animateScaleX(sx);
-            animateScaleY(sy);
-            animateScaleZ(sz);
-            animateRotate(&q);
-            animateTranslateX(tx);
-            animateTranslateY(ty);
-            animateTranslateZ(tz);
+            applyAnimationValueScaleX(sx);
+            applyAnimationValueScaleY(sy);
+            applyAnimationValueScaleZ(sz);
+            applyAnimationValueRotation(&q);
+            applyAnimationValueTranslationX(tx);
+            applyAnimationValueTranslationY(ty);
+            applyAnimationValueTranslationZ(tz);
             
             break;
         }
@@ -884,12 +884,11 @@ void Transform::transformChanged()
     }
 }
 
-
-void Transform::animateScaleX(float sx)
+void Transform::applyAnimationValueScaleX(float sx)
 {
-    if ((_bitFlag & SCALE_X_BIT) != SCALE_X_BIT)
+    if ((_animationPropertyBitFlag & ANIMATION_SCALE_X_BIT) != ANIMATION_SCALE_X_BIT)
     {
-        _bitFlag |= SCALE_X_BIT;
+        _animationPropertyBitFlag |= ANIMATION_SCALE_X_BIT;
         setScaleX(sx);
     }
     else
@@ -899,11 +898,11 @@ void Transform::animateScaleX(float sx)
     }
 }
 
-void Transform::animateScaleY(float sy)
+void Transform::applyAnimationValueScaleY(float sy)
 {
-    if ((_bitFlag & SCALE_Y_BIT) != SCALE_Y_BIT)
+    if ((_animationPropertyBitFlag & ANIMATION_SCALE_Y_BIT) != ANIMATION_SCALE_Y_BIT)
     {
-        _bitFlag |= SCALE_Y_BIT;
+        _animationPropertyBitFlag |= ANIMATION_SCALE_Y_BIT;
         setScaleY(sy);
     }
     else
@@ -913,11 +912,11 @@ void Transform::animateScaleY(float sy)
     }
 }
 
-void Transform::animateScaleZ(float sz)
+void Transform::applyAnimationValueScaleZ(float sz)
 {
-    if ((_bitFlag & SCALE_Z_BIT) != SCALE_Z_BIT)
+    if ((_animationPropertyBitFlag & ANIMATION_SCALE_Z_BIT) != ANIMATION_SCALE_Z_BIT)
     {
-        _bitFlag |= SCALE_Z_BIT;
+        _animationPropertyBitFlag |= ANIMATION_SCALE_Z_BIT;
         setScaleZ(sz);
     }
     else
@@ -927,11 +926,11 @@ void Transform::animateScaleZ(float sz)
     }
 }
 
-void Transform::animateRotate(Quaternion* q)
+void Transform::applyAnimationValueRotation(Quaternion* q)
 {
-    if ((_bitFlag & ROTATE_BIT) != ROTATE_BIT)
+    if ((_animationPropertyBitFlag & ANIMATION_ROTATION_BIT) != ANIMATION_ROTATION_BIT)
     {
-        _bitFlag |= ROTATE_BIT;
+        _animationPropertyBitFlag |= ANIMATION_ROTATION_BIT;
         setRotation(*q);
     }
     else
@@ -940,11 +939,11 @@ void Transform::animateRotate(Quaternion* q)
     }
 }
 
-void Transform::animateTranslateX(float tx)
+void Transform::applyAnimationValueTranslationX(float tx)
 {
-    if ((_bitFlag & TRANSLATE_X_BIT) != TRANSLATE_X_BIT)
+    if ((_animationPropertyBitFlag & ANIMATION_TRANSLATION_X_BIT) != ANIMATION_TRANSLATION_X_BIT)
     {
-        _bitFlag |= TRANSLATE_X_BIT;
+        _animationPropertyBitFlag |= ANIMATION_TRANSLATION_X_BIT;
         setTranslationX(tx);
     }
     else
@@ -953,11 +952,11 @@ void Transform::animateTranslateX(float tx)
     }
 }
 
-void Transform::animateTranslateY(float ty)
+void Transform::applyAnimationValueTranslationY(float ty)
 {
-    if ((_bitFlag & TRANSLATE_Y_BIT) != TRANSLATE_Y_BIT)
+    if ((_animationPropertyBitFlag & ANIMATION_TRANSLATION_Y_BIT) != ANIMATION_TRANSLATION_Y_BIT)
     {
-        _bitFlag |= TRANSLATE_Y_BIT;
+        _animationPropertyBitFlag |= ANIMATION_TRANSLATION_Y_BIT;
         setTranslationY(ty);
     }
     else
@@ -966,11 +965,11 @@ void Transform::animateTranslateY(float ty)
     }
 }
 
-void Transform::animateTranslateZ(float tz)
+void Transform::applyAnimationValueTranslationZ(float tz)
 {
-    if ((_bitFlag & TRANSLATE_Z_BIT) != TRANSLATE_Z_BIT)
+    if ((_animationPropertyBitFlag & ANIMATION_TRANSLATION_Z_BIT) != ANIMATION_TRANSLATION_Z_BIT)
     {
-        _bitFlag |= TRANSLATE_Z_BIT;
+        _animationPropertyBitFlag |= ANIMATION_TRANSLATION_Z_BIT;
         setTranslationZ(tz);
     }
     else
@@ -978,7 +977,4 @@ void Transform::animateTranslateZ(float tz)
         translateZ(tz);
     }
 }
-
-
-
 }

+ 15 - 17
gameplay/src/Transform.h

@@ -746,23 +746,21 @@ protected:
     std::list<TransformListener>* _listeners;
 
 private:
-    static const char SCALE_X_BIT = 0x01; 
-    static const char SCALE_Y_BIT = 0x02; 
-    static const char SCALE_Z_BIT = 0x04; 
-    static const char ROTATE_BIT = 0x08;  
-    static const char TRANSLATE_X_BIT = 0x10; 
-    static const char TRANSLATE_Y_BIT = 0x20; 
-    static const char TRANSLATE_Z_BIT = 0x40; 
-
-    void animateScaleX(float sx);
-    void animateScaleY(float sy);
-    void animateScaleZ(float sz);
-    void animateRotate(Quaternion* q);
-    void animateTranslateX(float tx);
-    void animateTranslateY(float ty);
-    void animateTranslateZ(float tz);
-
-
+    static const char ANIMATION_SCALE_X_BIT = 0x01; 
+    static const char ANIMATION_SCALE_Y_BIT = 0x02; 
+    static const char ANIMATION_SCALE_Z_BIT = 0x04; 
+    static const char ANIMATION_ROTATION_BIT = 0x08;  
+    static const char ANIMATION_TRANSLATION_X_BIT = 0x10; 
+    static const char ANIMATION_TRANSLATION_Y_BIT = 0x20; 
+    static const char ANIMATION_TRANSLATION_Z_BIT = 0x40; 
+
+    void applyAnimationValueScaleX(float sx);
+    void applyAnimationValueScaleY(float sy);
+    void applyAnimationValueScaleZ(float sz);
+    void applyAnimationValueRotation(Quaternion* q);
+    void applyAnimationValueTranslationX(float tx);
+    void applyAnimationValueTranslationY(float ty);
+    void applyAnimationValueTranslationZ(float tz);
 };
 
 }