Przeglądaj źródła

Merge branch 'next' of https://github.com/blackberry-gaming/GamePlay into next-dgough

Darryl Gough 14 lat temu
rodzic
commit
d8a409f77e

+ 3 - 3
gameplay/src/AnimationClip.cpp

@@ -509,17 +509,17 @@ void AnimationClip::onEnd()
     }
     }
 }
 }
 
 
-bool AnimationClip::isClipStateBitSet(char bit) const
+bool AnimationClip::isClipStateBitSet(unsigned char bit) const
 {
 {
     return (_stateBits & bit) == bit;
     return (_stateBits & bit) == bit;
 }
 }
 
 
-void AnimationClip::setClipStateBit(char bit)
+void AnimationClip::setClipStateBit(unsigned char bit)
 {
 {
     _stateBits |= bit;
     _stateBits |= bit;
 }
 }
 
 
-void AnimationClip::resetClipStateBit(char bit)
+void AnimationClip::resetClipStateBit(unsigned char bit)
 {
 {
     _stateBits &= ~bit;
     _stateBits &= ~bit;
 }
 }

+ 13 - 13
gameplay/src/AnimationClip.h

@@ -228,15 +228,15 @@ private:
     /**
     /**
      * State bits.
      * State bits.
      */
      */
-    static const char CLIP_IS_PLAYING_BIT = 0x01;             // Bit representing whether AnimationClip is a running clip in AnimationController
-    static const char CLIP_IS_STARTED_BIT = 0x02;             // Bit representing whether the AnimationClip has actually been started (ie: received first call to update())
-    static const char CLIP_IS_FADING_OUT_STARTED_BIT = 0x04;  // Bit representing that a cross fade has started.
-    static const char CLIP_IS_FADING_OUT_BIT = 0x08;          // Bit representing whether the clip is fading out.
-    static const char CLIP_IS_FADING_IN_BIT = 0x10;           // Bit representing whether the clip is fading out.
-    static const char CLIP_IS_MARKED_FOR_REMOVAL_BIT = 0x20;  // Bit representing whether the clip has ended and should be removed from the AnimationController.
-    static const char CLIP_IS_RESTARTED_BIT = 0x40;           // Bit representing if the clip should be restarted by the AnimationController.
-    static const char CLIP_IS_PAUSED_BIT = 0x80;              // Bit representing if the clip is currently paused.
-    static const char CLIP_ALL_BITS = 0xFF;                   // Bit mask for all the state bits.
+    static const unsigned char CLIP_IS_PLAYING_BIT = 0x01;             // Bit representing whether AnimationClip is a running clip in AnimationController
+    static const unsigned char CLIP_IS_STARTED_BIT = 0x02;             // Bit representing whether the AnimationClip has actually been started (ie: received first call to update())
+    static const unsigned char CLIP_IS_FADING_OUT_STARTED_BIT = 0x04;  // Bit representing that a cross fade has started.
+    static const unsigned char CLIP_IS_FADING_OUT_BIT = 0x08;          // Bit representing whether the clip is fading out.
+    static const unsigned char CLIP_IS_FADING_IN_BIT = 0x10;           // Bit representing whether the clip is fading out.
+    static const unsigned char CLIP_IS_MARKED_FOR_REMOVAL_BIT = 0x20;  // Bit representing whether the clip has ended and should be removed from the AnimationController.
+    static const unsigned char CLIP_IS_RESTARTED_BIT = 0x40;           // Bit representing if the clip should be restarted by the AnimationController.
+    static const unsigned char CLIP_IS_PAUSED_BIT = 0x80;              // Bit representing if the clip is currently paused.
+    static const unsigned char CLIP_ALL_BITS = 0xFF;                   // Bit mask for all the state bits.
 
 
     /**
     /**
      * ListenerEvent.
      * ListenerEvent.
@@ -297,24 +297,24 @@ private:
     /**
     /**
      * Determines whether the given bit is set in the AnimationClip's state.
      * Determines whether the given bit is set in the AnimationClip's state.
      */
      */
-    bool isClipStateBitSet(char bit) const;
+    bool isClipStateBitSet(unsigned char bit) const;
 
 
     /**
     /**
      * Sets the given bit in the AnimationClip's state.
      * Sets the given bit in the AnimationClip's state.
      */
      */
-    void setClipStateBit(char bit);
+    void setClipStateBit(unsigned char bit);
 
 
     /**
     /**
      * Resets the given bit in the AnimationClip's state.
      * Resets the given bit in the AnimationClip's state.
      */
      */
-    void resetClipStateBit(char bit);
+    void resetClipStateBit(unsigned char bit);
 
 
     std::string _id;                                    // AnimationClip ID.
     std::string _id;                                    // AnimationClip ID.
     Animation* _animation;                              // The Animation this clip is created from.
     Animation* _animation;                              // The Animation this clip is created from.
     unsigned long _startTime;                           // Start time of the clip.
     unsigned long _startTime;                           // Start time of the clip.
     unsigned long _endTime;                             // End time of the clip.
     unsigned long _endTime;                             // End time of the clip.
     unsigned long _duration;                            // The total duration.
     unsigned long _duration;                            // The total duration.
-    char _stateBits;                                    // Bit flag used to keep track of the clip's current state.
+    unsigned char _stateBits;                           // Bit flag used to keep track of the clip's current state.
     float _repeatCount;                                 // The clip's repeat count.
     float _repeatCount;                                 // The clip's repeat count.
     unsigned long _activeDuration;                      // The active duration of the clip.
     unsigned long _activeDuration;                      // The active duration of the clip.
     float _speed;                                       // The speed that the clip is playing. Default is 1.0. Negative goes in reverse.
     float _speed;                                       // The speed that the clip is playing. Default is 1.0. Negative goes in reverse.

+ 4 - 4
gameplay/src/Node.cpp

@@ -693,12 +693,12 @@ void Node::setParticleEmitter(ParticleEmitter* emitter)
     }
     }
 }
 }
 
 
-PhysicsRigidBody* Node::getPhysicsRigidBody() const
+PhysicsRigidBody* Node::getRigidBody() const
 {
 {
     return _physicsRigidBody;
     return _physicsRigidBody;
 }
 }
 
 
-void Node::setPhysicsRigidBody(PhysicsRigidBody::Type type, float mass, float friction,
+void Node::setRigidBody(PhysicsRigidBody::Type type, float mass, float friction,
         float restitution, float linearDamping, float angularDamping)
         float restitution, float linearDamping, float angularDamping)
 {
 {
     SAFE_DELETE(_physicsRigidBody);
     SAFE_DELETE(_physicsRigidBody);
@@ -707,14 +707,14 @@ void Node::setPhysicsRigidBody(PhysicsRigidBody::Type type, float mass, float fr
         _physicsRigidBody = new PhysicsRigidBody(this, type, mass, friction, restitution, linearDamping, angularDamping);
         _physicsRigidBody = new PhysicsRigidBody(this, type, mass, friction, restitution, linearDamping, angularDamping);
 }
 }
 
 
-void Node::setPhysicsRigidBody(const char* filePath)
+void Node::setRigidBody(const char* filePath)
 {
 {
     SAFE_DELETE(_physicsRigidBody);
     SAFE_DELETE(_physicsRigidBody);
 
 
     _physicsRigidBody = PhysicsRigidBody::create(this, filePath);
     _physicsRigidBody = PhysicsRigidBody::create(this, filePath);
 }
 }
 
 
-void Node::setPhysicsRigidBody(Properties* properties)
+void Node::setRigidBody(Properties* properties)
 {
 {
     SAFE_DELETE(_physicsRigidBody);
     SAFE_DELETE(_physicsRigidBody);
 
 

+ 4 - 4
gameplay/src/Node.h

@@ -349,7 +349,7 @@ public:
      *
      *
      * @return The pointer to this node's physics rigid body or NULL.
      * @return The pointer to this node's physics rigid body or NULL.
      */
      */
-    PhysicsRigidBody* getPhysicsRigidBody() const;
+    PhysicsRigidBody* getRigidBody() const;
 
 
     /**
     /**
      * Sets (or disables) the physics rigid body for this node.
      * Sets (or disables) the physics rigid body for this node.
@@ -366,7 +366,7 @@ public:
      * @param linearDamping The percentage of linear velocity lost per second (between 0.0 and 1.0).
      * @param linearDamping The percentage of linear velocity lost per second (between 0.0 and 1.0).
      * @param angularDamping The percentage of angular velocity lost per second (between 0.0 and 1.0).
      * @param angularDamping The percentage of angular velocity lost per second (between 0.0 and 1.0).
      */
      */
-    void setPhysicsRigidBody(PhysicsRigidBody::Type type, float mass = 0.0f, float friction = 0.5f,
+    void setRigidBody(PhysicsRigidBody::Type type, float mass = 0.0f, float friction = 0.5f,
         float restitution = 0.0f, float linearDamping = 0.0f, float angularDamping = 0.0f);
         float restitution = 0.0f, float linearDamping = 0.0f, float angularDamping = 0.0f);
 
 
     /**
     /**
@@ -374,14 +374,14 @@ public:
      * 
      * 
      * @param filePath The path to the file that contains the rigid body definition.
      * @param filePath The path to the file that contains the rigid body definition.
      */
      */
-    void setPhysicsRigidBody(const char* filePath);
+    void setRigidBody(const char* filePath);
 
 
     /**
     /**
      * Sets the physics rigid body for this node from the given properties object.
      * Sets the physics rigid body for this node from the given properties object.
      * 
      * 
      * @param properties The properties object defining the rigid body (must have namespace equal to 'rigidbody').
      * @param properties The properties object defining the rigid body (must have namespace equal to 'rigidbody').
      */
      */
-    void setPhysicsRigidBody(Properties* properties);
+    void setRigidBody(Properties* properties);
 
 
     /**
     /**
      * Returns the bounding sphere for the Node, in world space.
      * Returns the bounding sphere for the Node, in world space.

+ 1 - 1
gameplay/src/PhysicsConstraint.cpp

@@ -155,7 +155,7 @@ Vector3 PhysicsConstraint::getWorldCenterOfMass(const Model* model)
 
 
 Vector3 PhysicsConstraint::offsetByCenterOfMass(const Node* node, const Vector3& v)
 Vector3 PhysicsConstraint::offsetByCenterOfMass(const Node* node, const Vector3& v)
 {
 {
-    btVector3 centerOfMassOffset = ((PhysicsMotionState*)node->getPhysicsRigidBody()->_body->getMotionState())->_centerOfMassOffset.getOrigin();
+    btVector3 centerOfMassOffset = ((PhysicsMotionState*)node->getRigidBody()->_body->getMotionState())->_centerOfMassOffset.getOrigin();
     return Vector3(v.x + centerOfMassOffset.x(), v.y + centerOfMassOffset.y(), v.z + centerOfMassOffset.z());
     return Vector3(v.x + centerOfMassOffset.x(), v.y + centerOfMassOffset.y(), v.z + centerOfMassOffset.z());
 }
 }
 
 

+ 1 - 1
gameplay/src/PhysicsMotionState.cpp

@@ -21,7 +21,7 @@ PhysicsMotionState::~PhysicsMotionState()
 
 
 void PhysicsMotionState::getWorldTransform(btTransform &transform) const
 void PhysicsMotionState::getWorldTransform(btTransform &transform) const
 {
 {
-    if (_node->getPhysicsRigidBody() && _node->getPhysicsRigidBody()->isKinematic())
+    if (_node->getRigidBody() && _node->getRigidBody()->isKinematic())
         updateTransformFromNode();
         updateTransformFromNode();
 
 
     transform = _centerOfMassOffset.inverse() * _worldTransform;
     transform = _centerOfMassOffset.inverse() * _worldTransform;

+ 4 - 4
gameplay/src/SceneLoader.cpp

@@ -385,7 +385,7 @@ void SceneLoader::applyNodeProperties(const Scene* scene, const Properties* scen
                         // Set the specified model during physics rigid body creation.
                         // Set the specified model during physics rigid body creation.
                         Model* model = node->getModel();
                         Model* model = node->getModel();
                         node->setModel(modelNode->getModel());
                         node->setModel(modelNode->getModel());
-                        node->setPhysicsRigidBody(p);
+                        node->setRigidBody(p);
                         node->setModel(model);
                         node->setModel(model);
                     }
                     }
                 }
                 }
@@ -393,7 +393,7 @@ void SceneLoader::applyNodeProperties(const Scene* scene, const Properties* scen
             else if (!node->getModel())
             else if (!node->getModel())
                 WARN_VARG("Attempting to set a rigid body on node '%s', which has no model.", _nodeProperties[i]._nodeID);
                 WARN_VARG("Attempting to set a rigid body on node '%s', which has no model.", _nodeProperties[i]._nodeID);
             else
             else
-                node->setPhysicsRigidBody(p);
+                node->setRigidBody(p);
         }
         }
     }
     }
 }
 }
@@ -807,7 +807,7 @@ void SceneLoader::loadPhysics(Properties* physics, Scene* scene)
                 WARN_VARG("Node '%s' to be used as 'rigidBodyA' for constraint %s cannot be found.", name, constraint->getId());
                 WARN_VARG("Node '%s' to be used as 'rigidBodyA' for constraint %s cannot be found.", name, constraint->getId());
                 continue;
                 continue;
             }
             }
-            PhysicsRigidBody* rbA = rbANode->getPhysicsRigidBody();
+            PhysicsRigidBody* rbA = rbANode->getRigidBody();
             if (!rbA)
             if (!rbA)
             {
             {
                 WARN_VARG("Node '%s' to be used as 'rigidBodyA' does not have a rigid body.", name);
                 WARN_VARG("Node '%s' to be used as 'rigidBodyA' does not have a rigid body.", name);
@@ -828,7 +828,7 @@ void SceneLoader::loadPhysics(Properties* physics, Scene* scene)
                     WARN_VARG("Node '%s' to be used as 'rigidBodyB' for constraint %s cannot be found.", name, constraint->getId());
                     WARN_VARG("Node '%s' to be used as 'rigidBodyB' for constraint %s cannot be found.", name, constraint->getId());
                     continue;
                     continue;
                 }
                 }
-                rbB = rbBNode->getPhysicsRigidBody();
+                rbB = rbBNode->getRigidBody();
                 if (!rbB)
                 if (!rbB)
                 {
                 {
                     WARN_VARG("Node '%s' to be used as 'rigidBodyB' does not have a rigid body.", name);
                     WARN_VARG("Node '%s' to be used as 'rigidBodyB' does not have a rigid body.", name);