git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@171 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
parent
009a11e334
commit
7b60c4dac8
45
sources/reactphysics3d/engine/CollisionWorld.cpp
Normal file
45
sources/reactphysics3d/engine/CollisionWorld.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2009 Daniel Chappuis *
|
||||
****************************************************************************
|
||||
* This file is part of ReactPhysics3D. *
|
||||
* *
|
||||
* ReactPhysics3D is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as published *
|
||||
* by the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* ReactPhysics3D is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public License *
|
||||
* along with ReactPhysics3D. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
// Libraries
|
||||
#include "CollisionWorld.h"
|
||||
|
||||
// We want to use the ReactPhysics3D namespace
|
||||
using namespace reactphysics3d;
|
||||
|
||||
// Constructor
|
||||
CollisionWorld::CollisionWorld(const Vector3D& gravity)
|
||||
:DynamicWorld(gravity) {
|
||||
|
||||
}
|
||||
|
||||
// Destructor
|
||||
CollisionWorld::~CollisionWorld() {
|
||||
|
||||
}
|
||||
|
||||
// Add a constraint
|
||||
void CollisionWorld::addConstraint(Constraint* constraint) throw(std::invalid_argument) {
|
||||
// TODO : Implement this method
|
||||
}
|
||||
|
||||
// Remove a constraint
|
||||
void CollisionWorld::removeConstraint(Constraint* constraint) throw(std::invalid_argument) {
|
||||
// TODO : Implement this method
|
||||
}
|
67
sources/reactphysics3d/engine/CollisionWorld.h
Normal file
67
sources/reactphysics3d/engine/CollisionWorld.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
/***************************************************************************
|
||||
* Copyright (C) 2009 Daniel Chappuis *
|
||||
****************************************************************************
|
||||
* This file is part of ReactPhysics3D. *
|
||||
* *
|
||||
* ReactPhysics3D is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as published *
|
||||
* by the Free Software Foundation, either version 3 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* ReactPhysics3D is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public License *
|
||||
* along with ReactPhysics3D. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef COLLISIONWORLD_H
|
||||
#define COLLISIONWORLD_H
|
||||
|
||||
// Libraries
|
||||
#include <vector>
|
||||
#include <stdexcept>
|
||||
#include "DynamicWorld.h"
|
||||
#include "../constraint/Constraint.h"
|
||||
#include "../mathematics/mathematics.h"
|
||||
|
||||
// ReactPhysics3D namespace
|
||||
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 CollisionWorld : public DynamicWorld {
|
||||
private :
|
||||
std::vector<Constraint*> constraintList; // List that contains all the current constraints
|
||||
|
||||
public :
|
||||
CollisionWorld(const Vector3D& gravity); // Constructor
|
||||
~CollisionWorld(); // Destructor
|
||||
|
||||
void addConstraint(Constraint* constraint) throw(std::invalid_argument); // Add a constraint
|
||||
void removeConstraint(Constraint* constraint) throw(std::invalid_argument); // Remove a constraint
|
||||
std::vector<Constraint*>::const_iterator getConstraintListStartIterator() const; // Return a start iterator on the constraint list
|
||||
std::vector<Constraint*>::const_iterator getConstraintListEndIterator() const; // Return a end iterator on the constraint list
|
||||
};
|
||||
|
||||
// Return a start iterator on the constraint list
|
||||
inline std::vector<Constraint*>::const_iterator CollisionWorld::getConstraintListStartIterator() const {
|
||||
return constraintList.begin();
|
||||
}
|
||||
|
||||
// Return a end iterator on the constraint list
|
||||
inline std::vector<Constraint*>::const_iterator CollisionWorld::getConstraintListEndIterator() const {
|
||||
return constraintList.end();
|
||||
}
|
||||
|
||||
|
||||
} // End of the ReactPhysics3D namespace
|
||||
|
||||
#endif
|
|
@ -24,7 +24,8 @@
|
|||
using namespace reactphysics3d;
|
||||
|
||||
// Constructor
|
||||
PhysicsWorld::PhysicsWorld(const Vector3D& gravity) : gravity(gravity), isGravityOn(true) {
|
||||
PhysicsWorld::PhysicsWorld(const Vector3D& gravity)
|
||||
: gravity(gravity), isGravityOn(true) {
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user