git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@113 92aac97c-a6ce-11dd-a772-7fcde58d38e6

This commit is contained in:
chappuis.daniel 2009-03-07 14:40:55 +00:00
parent f72fdc428d
commit 19909cad76
2 changed files with 15 additions and 1 deletions

View File

@ -24,7 +24,7 @@
using namespace reactphysics3d; using namespace reactphysics3d;
// Constructor // Constructor
PhysicsWorld::PhysicsWorld(const Vector3D& gravity) : gravity(gravity) { PhysicsWorld::PhysicsWorld(const Vector3D& gravity) : gravity(gravity), isGravityOn(true) {
} }
@ -32,6 +32,7 @@ PhysicsWorld::PhysicsWorld(const Vector3D& gravity) : gravity(gravity) {
PhysicsWorld::PhysicsWorld(const PhysicsWorld& world) { PhysicsWorld::PhysicsWorld(const PhysicsWorld& world) {
bodyList = world.bodyList; bodyList = world.bodyList;
gravity = world.gravity; gravity = world.gravity;
isGravityOn = world.isGravityOn;
} }
// Destructor // Destructor

View File

@ -40,6 +40,7 @@ class PhysicsWorld {
protected : protected :
std::vector<Body*> bodyList; // list that contains all bodies of the physics world std::vector<Body*> bodyList; // list that contains all bodies of the physics world
Vector3D gravity; // Gravity vector of the world Vector3D gravity; // Gravity vector of the world
bool isGravityOn; // True if the gravity force is on
public : public :
PhysicsWorld(const Vector3D& gravity); // Constructor PhysicsWorld(const Vector3D& gravity); // Constructor
@ -49,6 +50,8 @@ class PhysicsWorld {
void addBody(Body* body) throw(std::invalid_argument); // Add a body to the physics world void addBody(Body* body) throw(std::invalid_argument); // Add a body to the physics world
void removeBody(Body const* const body) throw(std::invalid_argument); // Remove a body from the physics world void removeBody(Body const* const body) throw(std::invalid_argument); // Remove a body from the physics world
Vector3D getGravity() const; // Return the gravity vector of the world Vector3D getGravity() const; // Return the gravity vector of the world
bool getIsGravityOn() const; // Return if the gravity is on
void setIsGratityOn(bool isGravityOn); // Set the isGravityOn attribute
std::vector<Body*>::const_iterator getBodyListStartIterator() const; // Return a start iterator on the body list std::vector<Body*>::const_iterator getBodyListStartIterator() const; // Return a start iterator on the body list
std::vector<Body*>::const_iterator getBodyListEndIterator() const; // Return a end iterator on the body list std::vector<Body*>::const_iterator getBodyListEndIterator() const; // Return a end iterator on the body list
}; };
@ -72,6 +75,16 @@ inline std::vector<Body*>::const_iterator PhysicsWorld::getBodyListEndIterator()
return bodyList.end(); return bodyList.end();
} }
// Return if the gravity is on
inline bool PhysicsWorld::getIsGravityOn() const {
return isGravityOn;
}
// Set the isGravityOn attribute
inline void PhysicsWorld::setIsGratityOn(bool isGravityOn) {
this->isGravityOn = isGravityOn;
}
} // End of the ReactPhysics3D namespace } // End of the ReactPhysics3D namespace
#endif #endif