git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@263 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
parent
b70e418bd7
commit
d99ed01f7c
|
@ -20,6 +20,8 @@
|
|||
// Libraries
|
||||
#include "CollisionEngine.h"
|
||||
#include <cfloat>
|
||||
#include <GL/freeglut.h> // TODO : Remove this in the final version
|
||||
#include <GL/gl.h> // TODO : Remove this in the final version
|
||||
|
||||
// We want to use the ReactPhysics3D namespace
|
||||
using namespace reactphysics3d;
|
||||
|
|
|
@ -18,39 +18,38 @@
|
|||
***************************************************************************/
|
||||
|
||||
// Libraries
|
||||
#include "CollisionWorld.h"
|
||||
#include "PhysicsWorld.h"
|
||||
#include "../constraint/Contact.h"
|
||||
|
||||
// We want to use the ReactPhysics3D namespace
|
||||
using namespace reactphysics3d;
|
||||
|
||||
// Constructor
|
||||
CollisionWorld::CollisionWorld(const Vector3D& gravity)
|
||||
:DynamicWorld(gravity) {
|
||||
PhysicsWorld::PhysicsWorld(const Vector3D& gravity) : gravity(gravity) {
|
||||
|
||||
}
|
||||
|
||||
// Destructor
|
||||
CollisionWorld::~CollisionWorld() {
|
||||
PhysicsWorld::~PhysicsWorld() {
|
||||
// Delete all the constraint
|
||||
for (std::vector<Constraint*>::iterator it = constraintList.begin(); it != constraintList.end(); ) {
|
||||
delete (*it);
|
||||
}
|
||||
}
|
||||
|
||||
// Add a constraint into the collision world
|
||||
void CollisionWorld::addConstraint(Constraint* constraint) throw(std::invalid_argument) {
|
||||
// Add a constraint into the physics world
|
||||
void PhysicsWorld::addConstraint(Constraint* constraint) throw(std::invalid_argument) {
|
||||
assert(constraint != 0);
|
||||
constraintList.push_back(constraint);
|
||||
}
|
||||
|
||||
// Remove a constraint
|
||||
void CollisionWorld::removeConstraint(Constraint* constraint) throw(std::invalid_argument) {
|
||||
void PhysicsWorld::removeConstraint(Constraint* constraint) throw(std::invalid_argument) {
|
||||
// TODO : Implement this method
|
||||
}
|
||||
|
||||
// Remove all collision contacts constraints
|
||||
void CollisionWorld::removeAllContactConstraints() {
|
||||
void PhysicsWorld::removeAllContactConstraints() {
|
||||
// For all constraints
|
||||
for (std::vector<Constraint*>::iterator it = constraintList.begin(); it != constraintList.end(); ) {
|
||||
|
||||
|
|
|
@ -17,13 +17,12 @@
|
|||
* along with ReactPhysics3D. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef COLLISIONWORLD_H
|
||||
#define COLLISIONWORLD_H
|
||||
#ifndef PHYSICSWORLD_H
|
||||
#define PHYSICSWORLD_H
|
||||
|
||||
// Libraries
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include "DynamicWorld.h"
|
||||
#include "../constraint/Constraint.h"
|
||||
#include "../mathematics/mathematics.h"
|
||||
|
||||
|
@ -31,19 +30,19 @@
|
|||
namespace reactphysics3d {
|
||||
|
||||
/* -------------------------------------------------------------------
|
||||
Class CollisionWorld :
|
||||
This class represent a physics world where bodies can collide
|
||||
against each other. This class inherits from the class
|
||||
DynamicWorld.
|
||||
Class PhysicsWorld :
|
||||
This class represent a physics world. The physics world contains
|
||||
some bodies.
|
||||
-------------------------------------------------------------------
|
||||
*/
|
||||
class CollisionWorld : public DynamicWorld {
|
||||
class PhysicsWorld {
|
||||
private :
|
||||
Vector3D gravity; // Gravity vector of the physics world
|
||||
std::vector<Constraint*> constraintList; // List that contains all the current constraints
|
||||
|
||||
public :
|
||||
CollisionWorld(const Vector3D& gravity); // Constructor
|
||||
~CollisionWorld(); // Destructor
|
||||
PhysicsWorld(const Vector3D& gravity); // Constructor
|
||||
virtual ~PhysicsWorld(); // Destructor
|
||||
|
||||
void addConstraint(Constraint* constraint) throw(std::invalid_argument); // Add a constraint
|
||||
void removeConstraint(Constraint* constraint) throw(std::invalid_argument); // Remove a constraint
|
||||
|
@ -53,12 +52,12 @@ class CollisionWorld : public DynamicWorld {
|
|||
};
|
||||
|
||||
// Return a start iterator on the constraint list
|
||||
inline std::vector<Constraint*>::const_iterator CollisionWorld::getConstraintListStartIterator() const {
|
||||
inline std::vector<Constraint*>::const_iterator PhysicsWorld::getConstraintListStartIterator() const {
|
||||
return constraintList.begin();
|
||||
}
|
||||
|
||||
// Return a end iterator on the constraint list
|
||||
inline std::vector<Constraint*>::const_iterator CollisionWorld::getConstraintListEndIterator() const {
|
||||
inline std::vector<Constraint*>::const_iterator PhysicsWorld::getConstraintListEndIterator() const {
|
||||
return constraintList.end();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user