فهرست منبع

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

Sean Paul Taylor 13 سال پیش
والد
کامیت
12107837ed

+ 1 - 1
gameplay/src/AudioSource.h

@@ -13,7 +13,7 @@ class Node;
 class NodeCloneContext;
 
 /**
- *  Declares an audio source in 3D space.
+ * Declares an audio source in 3D space.
  */
 class AudioSource : public Ref, public Transform::Listener
 {

+ 1 - 7
gameplay/src/Node.h

@@ -347,9 +347,7 @@ public:
     Vector3 getForwardVectorWorld() const;
 
     /**
-     *  Returns the forward vector of the Node in view space.
-     *
-     * @param normalize True to return the vector normalized, false (default) otherwise.
+     * Returns the forward vector of the Node in view space.
      *
      * @return The forwward vector in view space.
      */
@@ -358,8 +356,6 @@ public:
     /**
      * Returns the right vector of the Node in world space.
      *
-     * @param normalize True to return the vector normalized, false (default) otherwise.
-     *
      * @return The right vector in world space.
      */
     Vector3 getRightVectorWorld() const;
@@ -367,8 +363,6 @@ public:
     /**
      * Returns the up vector of the Node in world space.
      *
-     * @param normalize True to return the vector normalized, false (default) otherwise.
-     *
      * @return The up vector in world space.
      */
     Vector3 getUpVectorWorld() const;

+ 1 - 1
gameplay/src/PhysicsCollisionObject.h

@@ -178,7 +178,7 @@ public:
     /**
      * Sets the collision object be enabled or disabled.
      *
-     * @param enable true enables the collision object, false diables it.
+     * @param enable true enables the collision object, false disables it.
      */
     void setEnabled(bool enable);
 

+ 13 - 27
gameplay/src/PhysicsConstraint.cpp

@@ -35,8 +35,8 @@ Vector3 PhysicsConstraint::centerOfMassMidpoint(const Node* a, const Node* b)
     a->getWorldMatrix().getTranslation(&tA);
     b->getWorldMatrix().getTranslation(&tB);
 
-    tA = getWorldCenterOfMass(a->getModel());
-    tB = getWorldCenterOfMass(b->getModel());
+    tA = getWorldCenterOfMass(a);
+    tB = getWorldCenterOfMass(b);
     
     Vector3 d(tA, tB);
     d.scale(0.5f);
@@ -130,36 +130,22 @@ btTransform PhysicsConstraint::getTransformOffset(const Node* node, const Vector
     return btTransform(BQ(r), BV(t));
 }
 
-Vector3 PhysicsConstraint::getWorldCenterOfMass(const Model* model)
+Vector3 PhysicsConstraint::getWorldCenterOfMass(const Node* node)
 {
-    GP_ASSERT(model && model->getMesh() && model->getNode());
+    GP_ASSERT(node);
 
-    Vector3 center;
-    const BoundingBox& box = model->getMesh()->getBoundingBox();
-    if (!(box.min.isZero() && box.max.isZero()))
-    {
-        Vector3 bMin, bMax;
-        model->getNode()->getWorldMatrix().transformPoint(box.min, &bMin);
-        model->getNode()->getWorldMatrix().transformPoint(box.max, &bMax);
-        center.set(bMin, bMax);
-        center.scale(0.5f);
-        center.add(bMin);
-    }
-    else
+    const BoundingSphere& sphere = node->getBoundingSphere();
+    if (!(sphere.center.isZero() && sphere.radius == 0))
     {
-        const BoundingSphere& sphere = model->getMesh()->getBoundingSphere();
-        if (!(sphere.center.isZero() && sphere.radius == 0))
-        {
-            model->getNode()->getWorldMatrix().transformPoint(sphere.center, &center);
-        }
-        else
-        {
-            // Warn the user that the model has no bounding volume.
-            GP_WARN("Model '%s' has no bounding volume - center of mass is defaulting to local coordinate origin.", model->getNode()->getId());
-            model->getNode()->getWorldMatrix().transformPoint(&center);
-        }
+        // The world-space center of mass is the sphere's center.
+        return sphere.center;
     }
 
+    // Warn the user that the node has no bounding volume.
+    GP_WARN("Node %s' has no bounding volume - center of mass is defaulting to local coordinate origin.", node->getId());
+
+    Vector3 center;
+    node->getWorldMatrix().transformPoint(&center);
     return center;
 }
 

+ 2 - 3
gameplay/src/PhysicsConstraint.h

@@ -2,7 +2,6 @@
 #define PHYSICSCONSTRAINT_H_
 
 #include "Base.h"
-#include "Model.h"
 #include "Vector3.h"
 
 namespace gameplay
@@ -93,9 +92,9 @@ protected:
     static btTransform getTransformOffset(const Node* node, const Vector3& origin);
     
     /**
-     * Calculates the center of mass in world space of the given model.
+     * Calculates the center of mass in world space of the given node.
      */
-    static Vector3 getWorldCenterOfMass(const Model* model);
+    static Vector3 getWorldCenterOfMass(const Node* node);
 
     /**
      * Offsets the given vector by the given node's center of mass.

+ 6 - 1
gameplay/src/PlatformMacOSX.mm

@@ -156,9 +156,14 @@ static CVReturn MyDisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTime
     _game->run();
     
     if (__fullscreen)
+    {
         [[self window] setLevel: NSMainMenuWindowLevel+1];
+        [[self window] setHidesOnDeactivate:YES]; 
+    }
     else
-        [[self window] setLevel: NSFloatingWindowLevel];
+    {
+        [[self window] setLevel: NSNormalWindowLevel];
+    }
     [[self window] makeKeyAndOrderFront: self];
     [[self window] setTitle: [NSString stringWithUTF8String: __title ? __title : ""]];
     

+ 5 - 0
gameplay/src/SpriteBatch.h

@@ -273,6 +273,11 @@ public:
      */
     void setProjectionMatrix(const Matrix& matrix);
 
+    /**
+     * Gets the projection matrix for the SpriteBatch.
+     * 
+     * @return The projection matrix.
+     */
     const Matrix& getProjectionMatrix() const;
 
 private: