Ver Fonte

Adds new animation property ANIMATE_SCALE_UNIT to the Transform class.
Adds the ability to scale all dimensions of the transform by a single scalar.

Kieran Cunney há 14 anos atrás
pai
commit
d4ff231dfd
2 ficheiros alterados com 12 adições e 0 exclusões
  1. 7 0
      gameplay/src/Transform.cpp
  2. 5 0
      gameplay/src/Transform.h

+ 7 - 0
gameplay/src/Transform.cpp

@@ -551,6 +551,7 @@ unsigned int Transform::getAnimationPropertyComponentCount(int propertyId) const
 {
 {
     switch (propertyId)
     switch (propertyId)
     {
     {
+        case ANIMATE_SCALE_UNIT:
         case ANIMATE_SCALE_X:
         case ANIMATE_SCALE_X:
         case ANIMATE_SCALE_Y:
         case ANIMATE_SCALE_Y:
         case ANIMATE_SCALE_Z:
         case ANIMATE_SCALE_Z:
@@ -576,6 +577,9 @@ void Transform::getAnimationPropertyValue(int propertyId, AnimationValue* value)
 {
 {
     switch (propertyId)
     switch (propertyId)
     {
     {
+        case ANIMATE_SCALE_UNIT:
+            value->setFloat(0, _scale.x);
+            break;
         case ANIMATE_SCALE:
         case ANIMATE_SCALE:
             value->setFloat(0, _scale.x);
             value->setFloat(0, _scale.x);
             value->setFloat(1, _scale.y);
             value->setFloat(1, _scale.y);
@@ -640,6 +644,9 @@ void Transform::setAnimationPropertyValue(int propertyId, AnimationValue* value)
 {
 {
     switch (propertyId)
     switch (propertyId)
     {
     {
+        case ANIMATE_SCALE_UNIT:
+            setScale(value->getFloat(0));
+            break;
         case ANIMATE_SCALE:
         case ANIMATE_SCALE:
             setScale(value->getFloat(0), value->getFloat(1), value->getFloat(2));
             setScale(value->getFloat(0), value->getFloat(1), value->getFloat(2));
             break;
             break;

+ 5 - 0
gameplay/src/Transform.h

@@ -33,6 +33,11 @@ public:
     /**
     /**
      * Scale animation property. Data=sx,sy,sz
      * Scale animation property. Data=sx,sy,sz
      */
      */
+    static const int ANIMATE_SCALE_UNIT = 0;
+
+    /**
+     * Scale animation property. Data=scale
+     */
     static const int ANIMATE_SCALE = 1;
     static const int ANIMATE_SCALE = 1;
 
 
     /**
     /**