Refactor the way headers are included and use more forward declarations for faster compilation time

This commit is contained in:
Daniel Chappuis 2018-04-20 07:13:39 +02:00
parent 491702c05c
commit d14e42be70
108 changed files with 721 additions and 572 deletions

View File

@ -26,6 +26,7 @@
// Libraries
#include "Body.h"
#include "collision/shapes/CollisionShape.h"
#include "utils/Logger.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;
@ -43,3 +44,52 @@ Body::Body(bodyindex id)
#endif
}
// Set whether or not the body is active
/**
* @param isActive True if you want to activate the body
*/
void Body::setIsActive(bool isActive) {
mIsActive = isActive;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set isActive=" +
(mIsActive ? "true" : "false"));
}
// Set the variable to know whether or not the body is sleeping
void Body::setIsSleeping(bool isSleeping) {
if (isSleeping) {
mSleepTime = decimal(0.0);
}
else {
if (mIsSleeping) {
mSleepTime = decimal(0.0);
}
}
if (mIsSleeping != isSleeping) {
mIsSleeping = isSleeping;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set isSleeping=" +
(mIsSleeping ? "true" : "false"));
}
}
// Set whether or not the body is allowed to go to sleep
/**
* @param isAllowedToSleep True if the body is allowed to sleep
*/
void Body::setIsAllowedToSleep(bool isAllowedToSleep) {
mIsAllowedToSleep = isAllowedToSleep;
if (!mIsAllowedToSleep) setIsSleeping(false);
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set isAllowedToSleep=" +
(mIsAllowedToSleep ? "true" : "false"));
}

View File

@ -27,14 +27,15 @@
#define REACTPHYSICS3D_BODY_H
// Libraries
#include <stdexcept>
#include <cassert>
#include "configuration.h"
#include "utils/Logger.h"
/// Namespace reactphysics3d
namespace reactphysics3d {
// Declarations
class Logger;
// TODO : Make this class abstract
// Class Body
/**
@ -164,20 +165,6 @@ inline bool Body::isAllowedToSleep() const {
return mIsAllowedToSleep;
}
// Set whether or not the body is allowed to go to sleep
/**
* @param isAllowedToSleep True if the body is allowed to sleep
*/
inline void Body::setIsAllowedToSleep(bool isAllowedToSleep) {
mIsAllowedToSleep = isAllowedToSleep;
if (!mIsAllowedToSleep) setIsSleeping(false);
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set isAllowedToSleep=" +
(mIsAllowedToSleep ? "true" : "false"));
}
// Return whether or not the body is sleeping
/**
* @return True if the body is currently sleeping and false otherwise
@ -194,40 +181,6 @@ inline bool Body::isActive() const {
return mIsActive;
}
// Set whether or not the body is active
/**
* @param isActive True if you want to activate the body
*/
inline void Body::setIsActive(bool isActive) {
mIsActive = isActive;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set isActive=" +
(mIsActive ? "true" : "false"));
}
// Set the variable to know whether or not the body is sleeping
inline void Body::setIsSleeping(bool isSleeping) {
if (isSleeping) {
mSleepTime = decimal(0.0);
}
else {
if (mIsSleeping) {
mSleepTime = decimal(0.0);
}
}
if (mIsSleeping != isSleeping) {
mIsSleeping = isSleeping;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set isSleeping=" +
(mIsSleeping ? "true" : "false"));
}
}
// Return a pointer to the user data attached to this body
/**
* @return A pointer to the user data you have attached to the body

View File

@ -27,6 +27,8 @@
#include "CollisionBody.h"
#include "engine/CollisionWorld.h"
#include "collision/ContactManifold.h"
#include "collision/RaycastInfo.h"
#include "utils/Logger.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;
@ -390,3 +392,49 @@ AABB CollisionBody::getAABB() const {
return bodyAABB;
}
// Set the current position and orientation
/**
* @param transform The transformation of the body that transforms the local-space
* of the body into world-space
*/
void CollisionBody::setTransform(const Transform& transform) {
// Update the transform of the body
mTransform = transform;
// Update the broad-phase state of the body
updateBroadPhaseState();
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set transform=" + mTransform.to_string());
}
// Set the type of the body
/// The type of the body can either STATIC, KINEMATIC or DYNAMIC as described bellow:
/// STATIC : A static body has infinite mass, zero velocity but the position can be
/// changed manually. A static body does not collide with other static or kinematic bodies.
/// KINEMATIC : A kinematic body has infinite mass, the velocity can be changed manually and its
/// position is computed by the physics engine. A kinematic body does not collide with
/// other static or kinematic bodies.
/// DYNAMIC : A dynamic body has non-zero mass, non-zero velocity determined by forces and its
/// position is determined by the physics engine. A dynamic body can collide with other
/// dynamic, static or kinematic bodies.
/**
* @param type The type of the body (STATIC, KINEMATIC, DYNAMIC)
*/
void CollisionBody::setType(BodyType type) {
mType = type;
if (mType == BodyType::STATIC) {
// Update the broad-phase state of the body
updateBroadPhaseState();
}
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set type=" +
(mType == BodyType::STATIC ? "Static" : (mType == BodyType::DYNAMIC ? "Dynamic" : "Kinematic")));
}

View File

@ -27,24 +27,23 @@
#define REACTPHYSICS3D_COLLISION_BODY_H
// Libraries
#include <stdexcept>
#include <cassert>
#include "Body.h"
#include "mathematics/Transform.h"
#include "collision/shapes/AABB.h"
#include "collision/shapes/CollisionShape.h"
#include "collision/RaycastInfo.h"
#include "memory/PoolAllocator.h"
#include "mathematics/Transform.h"
#include "configuration.h"
#include "utils/Profiler.h"
/// Namespace reactphysics3d
namespace reactphysics3d {
// Class declarations
// Declarations
struct ContactManifoldListElement;
class ProxyShape;
class CollisionWorld;
class CollisionShape;
struct RaycastInfo;
class PoolAllocator;
class Profiler;
/// Enumeration for the type of a body
/// STATIC : A static body has infinite mass, zero velocity but the position can be
@ -210,33 +209,6 @@ inline BodyType CollisionBody::getType() const {
return mType;
}
// Set the type of the body
/// The type of the body can either STATIC, KINEMATIC or DYNAMIC as described bellow:
/// STATIC : A static body has infinite mass, zero velocity but the position can be
/// changed manually. A static body does not collide with other static or kinematic bodies.
/// KINEMATIC : A kinematic body has infinite mass, the velocity can be changed manually and its
/// position is computed by the physics engine. A kinematic body does not collide with
/// other static or kinematic bodies.
/// DYNAMIC : A dynamic body has non-zero mass, non-zero velocity determined by forces and its
/// position is determined by the physics engine. A dynamic body can collide with other
/// dynamic, static or kinematic bodies.
/**
* @param type The type of the body (STATIC, KINEMATIC, DYNAMIC)
*/
inline void CollisionBody::setType(BodyType type) {
mType = type;
if (mType == BodyType::STATIC) {
// Update the broad-phase state of the body
updateBroadPhaseState();
}
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set type=" +
(mType == BodyType::STATIC ? "Static" : (mType == BodyType::DYNAMIC ? "Dynamic" : "Kinematic")));
}
// Return the current position and orientation
/**
* @return The current transformation of the body that transforms the local-space
@ -246,23 +218,6 @@ inline const Transform& CollisionBody::getTransform() const {
return mTransform;
}
// Set the current position and orientation
/**
* @param transform The transformation of the body that transforms the local-space
* of the body into world-space
*/
inline void CollisionBody::setTransform(const Transform& transform) {
// Update the transform of the body
mTransform = transform;
// Update the broad-phase state of the body
updateBroadPhaseState();
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set transform=" + mTransform.to_string());
}
// Return the first element of the linked list of contact manifolds involving this body
/**
* @return A pointer to the first element of the linked-list with the contact

View File

@ -28,6 +28,7 @@
#include "constraint/Joint.h"
#include "collision/shapes/CollisionShape.h"
#include "engine/DynamicsWorld.h"
#include "utils/Profiler.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;
@ -334,6 +335,55 @@ void RigidBody::removeCollisionShape(const ProxyShape* proxyShape) {
recomputeMassInformation();
}
// Set the variable to know if the gravity is applied to this rigid body
/**
* @param isEnabled True if you want the gravity to be applied to this body
*/
void RigidBody::enableGravity(bool isEnabled) {
mIsGravityEnabled = isEnabled;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set isGravityEnabled=" +
(mIsGravityEnabled ? "true" : "false"));
}
// Set the linear damping factor. This is the ratio of the linear velocity
// that the body will lose every at seconds of simulation.
/**
* @param linearDamping The linear damping factor of this body
*/
void RigidBody::setLinearDamping(decimal linearDamping) {
assert(linearDamping >= decimal(0.0));
mLinearDamping = linearDamping;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set linearDamping=" + std::to_string(mLinearDamping));
}
// Set the angular damping factor. This is the ratio of the angular velocity
// that the body will lose at every seconds of simulation.
/**
* @param angularDamping The angular damping factor of this body
*/
void RigidBody::setAngularDamping(decimal angularDamping) {
assert(angularDamping >= decimal(0.0));
mAngularDamping = angularDamping;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set angularDamping=" + std::to_string(mAngularDamping));
}
// Set a new material for this rigid body
/**
* @param material The material you want to set to the body
*/
void RigidBody::setMaterial(const Material& material) {
mMaterial = material;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set Material" + mMaterial.to_string());
}
// Set the linear velocity of the rigid body.
/**
* @param linearVelocity Linear velocity vector of the body

View File

@ -31,7 +31,6 @@
#include "CollisionBody.h"
#include "engine/Material.h"
#include "mathematics/mathematics.h"
#include "memory/MemoryManager.h"
/// Namespace reactphysics3d
namespace reactphysics3d {
@ -40,6 +39,7 @@ namespace reactphysics3d {
struct JointListElement;
class Joint;
class DynamicsWorld;
class MemoryManager;
// Class RigidBody
/**
@ -319,18 +319,6 @@ inline bool RigidBody::isGravityEnabled() const {
return mIsGravityEnabled;
}
// Set the variable to know if the gravity is applied to this rigid body
/**
* @param isEnabled True if you want the gravity to be applied to this body
*/
inline void RigidBody::enableGravity(bool isEnabled) {
mIsGravityEnabled = isEnabled;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set isGravityEnabled=" +
(mIsGravityEnabled ? "true" : "false"));
}
// Return a reference to the material properties of the rigid body
/**
* @return A reference to the material of the body
@ -339,17 +327,6 @@ inline Material& RigidBody::getMaterial() {
return mMaterial;
}
// Set a new material for this rigid body
/**
* @param material The material you want to set to the body
*/
inline void RigidBody::setMaterial(const Material& material) {
mMaterial = material;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set Material" + mMaterial.to_string());
}
// Return the linear velocity damping factor
/**
* @return The linear damping factor of this body
@ -358,19 +335,6 @@ inline decimal RigidBody::getLinearDamping() const {
return mLinearDamping;
}
// Set the linear damping factor. This is the ratio of the linear velocity
// that the body will lose every at seconds of simulation.
/**
* @param linearDamping The linear damping factor of this body
*/
inline void RigidBody::setLinearDamping(decimal linearDamping) {
assert(linearDamping >= decimal(0.0));
mLinearDamping = linearDamping;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set linearDamping=" + std::to_string(mLinearDamping));
}
// Return the angular velocity damping factor
/**
* @return The angular damping factor of this body
@ -379,19 +343,6 @@ inline decimal RigidBody::getAngularDamping() const {
return mAngularDamping;
}
// Set the angular damping factor. This is the ratio of the angular velocity
// that the body will lose at every seconds of simulation.
/**
* @param angularDamping The angular damping factor of this body
*/
inline void RigidBody::setAngularDamping(decimal angularDamping) {
assert(angularDamping >= decimal(0.0));
mAngularDamping = angularDamping;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::Body,
"Body " + std::to_string(mID) + ": Set angularDamping=" + std::to_string(mAngularDamping));
}
// Return the first element of the linked list of joints involving this body
/**
* @return The first element of the linked-list of all the joints involving this body

View File

@ -28,6 +28,7 @@
#include "engine/OverlappingPair.h"
#include "memory/MemoryAllocator.h"
#include "collision/ContactManifold.h"
#include "memory/MemoryManager.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;

View File

@ -26,13 +26,16 @@
#ifndef REACTPHYSICS3D_COLLISION_CALLBACK_H
#define REACTPHYSICS3D_COLLISION_CALLBACK_H
// Libraries
#include "collision/ContactManifold.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
class OverlappingPair;
class ContactManifold;
struct ContactManifoldListElement;
class CollisionBody;
class ProxyShape;
class MemoryManager;
// Class CollisionCallback
/**

View File

@ -35,10 +35,13 @@
#include "collision/CollisionCallback.h"
#include "collision/MiddlePhaseTriangleCallback.h"
#include "collision/OverlapCallback.h"
#include "collision/NarrowPhaseInfo.h"
#include "collision/ContactManifold.h"
#include "collision/ContactManifoldInfo.h"
#include "utils/Profiler.h"
#include "engine/EventListener.h"
#include "collision/RaycastInfo.h"
#include <cassert>
#include <complex>
#include <utility>
#include <utility>
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;
@ -376,6 +379,20 @@ void CollisionDetection::addAllContactManifoldsToBodies() {
}
}
// Ray casting method
void CollisionDetection::raycast(RaycastCallback* raycastCallback,
const Ray& ray,
unsigned short raycastWithCategoryMaskBits) const {
RP3D_PROFILE("CollisionDetection::raycast()", mProfiler);
RaycastTest rayCastTest(raycastCallback);
// Ask the broad-phase algorithm to call the testRaycastAgainstShape()
// callback method for each proxy shape hit by the ray in the broad-phase
mBroadPhaseAlgorithm.raycast(ray, rayCastTest, raycastWithCategoryMaskBits);
}
// Add a contact manifold to the linked list of contact manifolds of the two bodies involved
// in the corresponding contact
void CollisionDetection::addContactManifoldToBody(OverlappingPair* pair) {

View File

@ -29,23 +29,24 @@
// Libraries
#include "body/CollisionBody.h"
#include "broadphase/BroadPhaseAlgorithm.h"
#include "collision/shapes/CollisionShape.h"
#include "engine/OverlappingPair.h"
#include "engine/EventListener.h"
#include "narrowphase/DefaultCollisionDispatch.h"
#include "memory/MemoryManager.h"
#include "constraint/ContactPoint.h"
#include "collision/narrowphase/DefaultCollisionDispatch.h"
#include "containers/Map.h"
#include "containers/Set.h"
#include <utility>
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
class BroadPhaseAlgorithm;
class CollisionWorld;
class CollisionCallback;
class OverlapCallback;
class RaycastCallback;
class ContactPoint;
class MemoryManager;
class EventListener;
class CollisionDispatch;
// Class CollisionDetection
/**
@ -84,10 +85,6 @@ class CollisionDetection {
/// Broad-phase algorithm
BroadPhaseAlgorithm mBroadPhaseAlgorithm;
/// Narrow-phase GJK algorithm
// TODO : Delete this
GJKAlgorithm mNarrowPhaseGJKAlgorithm;
/// Set of pair of bodies that cannot collide between each other
Set<bodyindexpair> mNoCollisionPairs;
@ -309,20 +306,6 @@ inline NarrowPhaseAlgorithm* CollisionDetection::selectNarrowPhaseAlgorithm(cons
return mCollisionMatrix[shape1Index][shape2Index];
}
// Ray casting method
inline void CollisionDetection::raycast(RaycastCallback* raycastCallback,
const Ray& ray,
unsigned short raycastWithCategoryMaskBits) const {
RP3D_PROFILE("CollisionDetection::raycast()", mProfiler);
RaycastTest rayCastTest(raycastCallback);
// Ask the broad-phase algorithm to call the testRaycastAgainstShape()
// callback method for each proxy shape hit by the ray in the broad-phase
mBroadPhaseAlgorithm.raycast(ray, rayCastTest, raycastWithCategoryMaskBits);
}
// Return a pointer to the world
inline CollisionWorld* CollisionDetection::getWorld() {
return mWorld;

View File

@ -24,8 +24,9 @@
********************************************************************************/
// Libraries
#include <iostream>
#include "ContactManifold.h"
#include "constraint/ContactPoint.h"
#include "collision/ContactManifoldInfo.h"
using namespace reactphysics3d;
@ -98,6 +99,25 @@ void ContactManifold::removeContactPoint(ContactPoint* contactPoint) {
assert(mNbContactPoints >= 0);
}
// Return the largest depth of all the contact points
decimal ContactManifold::getLargestContactDepth() const {
decimal largestDepth = 0.0f;
assert(mNbContactPoints > 0);
ContactPoint* contactPoint = mContactPoints;
while(contactPoint != nullptr){
decimal depth = contactPoint->getPenetrationDepth();
if (depth > largestDepth) {
largestDepth = depth;
}
contactPoint = contactPoint->getNext();
}
return largestDepth;
}
// Add a contact point
void ContactManifold::addContactPoint(const ContactPointInfo* contactPointInfo) {
@ -117,6 +137,20 @@ void ContactManifold::addContactPoint(const ContactPointInfo* contactPointInfo)
mNbContactPoints++;
}
// Set to true to make the manifold obsolete
void ContactManifold::setIsObsolete(bool isObsolete, bool setContactPoints) {
mIsObsolete = isObsolete;
if (setContactPoints) {
ContactPoint* contactPoint = mContactPoints;
while (contactPoint != nullptr) {
contactPoint->setIsObsolete(isObsolete);
contactPoint = contactPoint->getNext();
}
}
}
// Clear the obsolete contact points
void ContactManifold::clearObsoleteContactPoints() {

View File

@ -27,17 +27,18 @@
#define REACTPHYSICS3D_CONTACT_MANIFOLD_H
// Libraries
#include "body/CollisionBody.h"
#include "collision/ProxyShape.h"
#include "constraint/ContactPoint.h"
#include "collision/ContactManifoldInfo.h"
#include "memory/PoolAllocator.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Class declarations
class ContactManifold;
class ContactManifoldInfo;
struct ContactPointInfo;
class CollisionBody;
class ContactPoint;
class PoolAllocator;
// Structure ContactManifoldListElement
/**
@ -353,25 +354,6 @@ inline bool ContactManifold::isAlreadyInIsland() const {
return mIsAlreadyInIsland;
}
// Return the largest depth of all the contact points
inline decimal ContactManifold::getLargestContactDepth() const {
decimal largestDepth = 0.0f;
assert(mNbContactPoints > 0);
ContactPoint* contactPoint = mContactPoints;
while(contactPoint != nullptr){
decimal depth = contactPoint->getPenetrationDepth();
if (depth > largestDepth) {
largestDepth = depth;
}
contactPoint = contactPoint->getNext();
}
return largestDepth;
}
// Return a pointer to the previous element in the linked-list
inline ContactManifold* ContactManifold::getPrevious() const {
return mPrevious;
@ -397,20 +379,6 @@ inline bool ContactManifold::getIsObsolete() const {
return mIsObsolete;
}
// Set to true to make the manifold obsolete
inline void ContactManifold::setIsObsolete(bool isObsolete, bool setContactPoints) {
mIsObsolete = isObsolete;
if (setContactPoints) {
ContactPoint* contactPoint = mContactPoints;
while (contactPoint != nullptr) {
contactPoint->setIsObsolete(isObsolete);
contactPoint = contactPoint->getNext();
}
}
}
}
#endif

View File

@ -25,6 +25,7 @@
// Libraries
#include "ContactManifoldInfo.h"
#include "collision/ContactPointInfo.h"
using namespace reactphysics3d;

View File

@ -27,12 +27,16 @@
#define REACTPHYSICS3D_CONTACT_MANIFOLD_INFO_H
// Libraries
#include "collision/ContactPointInfo.h"
#include "memory/MemoryAllocator.h"
#include "configuration.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
class MemoryAllocator;
struct ContactPointInfo;
class Transform;
// Constants
const int8 MAX_CONTACT_POINTS_IN_MANIFOLD = 4; // Maximum number of contacts in the manifold

View File

@ -25,6 +25,10 @@
// Libraries
#include "ContactManifoldSet.h"
#include "constraint/ContactPoint.h"
#include "collision/ContactManifoldInfo.h"
#include "ProxyShape.h"
#include "collision/ContactManifold.h"
using namespace reactphysics3d;
@ -65,6 +69,34 @@ void ContactManifoldSet::addContactManifold(const ContactManifoldInfo* contactMa
}
}
// Return the total number of contact points in the set of manifolds
int ContactManifoldSet::getTotalNbContactPoints() const {
int nbPoints = 0;
ContactManifold* manifold = mManifolds;
while (manifold != nullptr) {
nbPoints += manifold->getNbContactPoints();
manifold = manifold->getNext();
}
return nbPoints;
}
// Return the maximum number of contact manifolds allowed between to collision shapes
int ContactManifoldSet::computeNbMaxContactManifolds(const CollisionShape* shape1, const CollisionShape* shape2) {
// If both shapes are convex
if (shape1->isConvex() && shape2->isConvex()) {
return mWorldSettings.nbMaxContactManifoldsConvexShape;
} // If there is at least one concave shape
else {
return mWorldSettings.nbMaxContactManifoldsConcaveShape;
}
}
// Update a previous similar manifold with a new one
void ContactManifoldSet::updateManifoldWithNewOne(ContactManifold* oldManifold, const ContactManifoldInfo* newManifold) {

View File

@ -26,11 +26,16 @@
#ifndef REACTPHYSICS3D_CONTACT_MANIFOLD_SET_H
#define REACTPHYSICS3D_CONTACT_MANIFOLD_SET_H
// Libraries
#include "ContactManifold.h"
namespace reactphysics3d {
// Declarations
class ContactManifold;
class ContactManifoldInfo;
class ProxyShape;
class MemoryAllocator;
struct WorldSettings;
class CollisionShape;
// Constants
const int MAX_MANIFOLDS_IN_CONTACT_MANIFOLD_SET = 3; // Maximum number of contact manifolds in the set
const int CONTACT_CUBEMAP_FACE_NB_SUBDIVISIONS = 3; // N Number for the N x N subdivisions of the cubemap
@ -151,33 +156,6 @@ inline ContactManifold* ContactManifoldSet::getContactManifolds() const {
return mManifolds;
}
// Return the total number of contact points in the set of manifolds
inline int ContactManifoldSet::getTotalNbContactPoints() const {
int nbPoints = 0;
ContactManifold* manifold = mManifolds;
while (manifold != nullptr) {
nbPoints += manifold->getNbContactPoints();
manifold = manifold->getNext();
}
return nbPoints;
}
// Return the maximum number of contact manifolds allowed between to collision shapes
inline int ContactManifoldSet::computeNbMaxContactManifolds(const CollisionShape* shape1, const CollisionShape* shape2) {
// If both shapes are convex
if (shape1->isConvex() && shape2->isConvex()) {
return mWorldSettings.nbMaxContactManifoldsConvexShape;
} // If there is at least one concave shape
else {
return mWorldSettings.nbMaxContactManifoldsConcaveShape;
}
}
}
#endif

View File

@ -27,13 +27,15 @@
#define REACTPHYSICS3D_CONTACT_POINT_INFO_H
// Libraries
#include "body/CollisionBody.h"
#include "mathematics/mathematics.h"
#include "configuration.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
class CollisionBody;
// Structure ContactPointInfo
/**
* This structure contains informations about a collision contact

View File

@ -25,6 +25,9 @@
// Libraries
#include "collision/MiddlePhaseTriangleCallback.h"
#include "engine/OverlappingPair.h"
#include "collision/NarrowPhaseInfo.h"
#include "collision/shapes/TriangleShape.h"
using namespace reactphysics3d;

View File

@ -26,13 +26,24 @@
#ifndef REACTPHYSICS3D_MIDDLE_PHASE_TRIANGLE_CALLBACK_H
#define REACTPHYSICS3D_MIDDLE_PHASE_TRIANGLE_CALLBACK_H
// Libraries
#include "configuration.h"
#include "collision/shapes/ConcaveShape.h"
#include "collision/narrowphase/NarrowPhaseAlgorithm.h"
/// Namespace ReactPhysics3D
namespace reactphysics3d {
// Libraries
// Declarations
class ConcaveShape;
class OverlappingPair;
class NarrowPhaseAlgorithm;
class ProxyShape;
class MemoryAllocator;
class Profiler;
struct NarrowPhaseInfo;
struct Vector3;
// Class ConvexVsTriangleCallback
/**
* This class is used to report a collision between the triangle

View File

@ -24,7 +24,6 @@
********************************************************************************/
// Libraries
#include <iostream>
#include "NarrowPhaseInfo.h"
#include "ContactPointInfo.h"
#include "collision/shapes/TriangleShape.h"

View File

@ -27,14 +27,16 @@
#define REACTPHYSICS3D_NARROW_PHASE_INFO_H
// Libraries
#include "shapes/CollisionShape.h"
#include "collision/ContactManifoldInfo.h"
#include "engine/OverlappingPair.h"
/// Namespace ReactPhysics3D
namespace reactphysics3d {
// Declarations
class CollisionShape;
struct LastFrameCollisionInfo;
class ContactManifoldInfo;
struct ContactPointInfo;
// Class NarrowPhaseInfo
/**

View File

@ -26,12 +26,12 @@
#ifndef REACTPHYSICS3D_OVERLAP_CALLBACK_H
#define REACTPHYSICS3D_OVERLAP_CALLBACK_H
// Libraries
#include "body/CollisionBody.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
class CollisionBody;
// Class OverlapCallback
/**
* This class can be used to register a callback for collision overlap queries.

View File

@ -26,6 +26,7 @@
// Libraries
#include "PolyhedronMesh.h"
#include "memory/MemoryManager.h"
#include "collision/PolygonVertexArray.h"
using namespace reactphysics3d;

View File

@ -29,11 +29,13 @@
// Libraries
#include "mathematics/mathematics.h"
#include "HalfEdgeStructure.h"
#include "collision/PolygonVertexArray.h"
#include "memory/DefaultAllocator.h"
namespace reactphysics3d {
// Declarations
class DefaultAllocator;
class PolygonVertexArray;
// Class PolyhedronMesh
/**
* This class describes a polyhedron mesh made of faces and vertices.

View File

@ -25,6 +25,9 @@
// Libraries
#include "ProxyShape.h"
#include "utils/Logger.h"
#include "collision/RaycastInfo.h"
#include "memory/MemoryManager.h"
using namespace reactphysics3d;
@ -57,6 +60,45 @@ bool ProxyShape::testPointInside(const Vector3& worldPoint) {
return mCollisionShape->testPointInside(localPoint, this);
}
// Set the collision category bits
/**
* @param collisionCategoryBits The collision category bits mask of the proxy shape
*/
void ProxyShape::setCollisionCategoryBits(unsigned short collisionCategoryBits) {
mCollisionCategoryBits = collisionCategoryBits;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::ProxyShape,
"ProxyShape " + std::to_string(mBroadPhaseID) + ": Set collisionCategoryBits=" +
std::to_string(mCollisionCategoryBits));
}
// Set the collision bits mask
/**
* @param collideWithMaskBits The bits mask that specifies with which collision category this shape will collide
*/
void ProxyShape::setCollideWithMaskBits(unsigned short collideWithMaskBits) {
mCollideWithMaskBits = collideWithMaskBits;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::ProxyShape,
"ProxyShape " + std::to_string(mBroadPhaseID) + ": Set collideWithMaskBits=" +
std::to_string(mCollideWithMaskBits));
}
// Set the local to parent body transform
void ProxyShape::setLocalToBodyTransform(const Transform& transform) {
mLocalToBodyTransform = transform;
mBody->setIsSleeping(false);
// Notify the body that the proxy shape has to be updated in the broad-phase
mBody->updateProxyShapeInBroadPhase(this, true);
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::ProxyShape,
"ProxyShape " + std::to_string(mBroadPhaseID) + ": Set localToBodyTransform=" +
mLocalToBodyTransform.to_string());
}
// Raycast method with feedback information
/**
* @param ray Ray to use for the raycasting

View File

@ -28,11 +28,13 @@
// Libraries
#include "body/CollisionBody.h"
#include "shapes/CollisionShape.h"
#include "memory/MemoryManager.h"
#include "collision/shapes/CollisionShape.h"
namespace reactphysics3d {
// Declarations
class MemoryManager;
// Class ProxyShape
/**
* The CollisionShape instances are supposed to be unique for memory optimization. For instance,
@ -265,21 +267,6 @@ inline const Transform& ProxyShape::getLocalToBodyTransform() const {
return mLocalToBodyTransform;
}
// Set the local to parent body transform
inline void ProxyShape::setLocalToBodyTransform(const Transform& transform) {
mLocalToBodyTransform = transform;
mBody->setIsSleeping(false);
// Notify the body that the proxy shape has to be updated in the broad-phase
mBody->updateProxyShapeInBroadPhase(this, true);
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::ProxyShape,
"ProxyShape " + std::to_string(mBroadPhaseID) + ": Set localToBodyTransform=" +
mLocalToBodyTransform.to_string());
}
// Return the local to world transform
/**
* @return The transformation that transforms the local-space of the collision
@ -323,18 +310,6 @@ inline unsigned short ProxyShape::getCollisionCategoryBits() const {
return mCollisionCategoryBits;
}
// Set the collision category bits
/**
* @param collisionCategoryBits The collision category bits mask of the proxy shape
*/
inline void ProxyShape::setCollisionCategoryBits(unsigned short collisionCategoryBits) {
mCollisionCategoryBits = collisionCategoryBits;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::ProxyShape,
"ProxyShape " + std::to_string(mBroadPhaseID) + ": Set collisionCategoryBits=" +
std::to_string(mCollisionCategoryBits));
}
// Return the collision bits mask
/**
* @return The bits mask that specifies with which collision category this shape will collide
@ -343,18 +318,6 @@ inline unsigned short ProxyShape::getCollideWithMaskBits() const {
return mCollideWithMaskBits;
}
// Set the collision bits mask
/**
* @param collideWithMaskBits The bits mask that specifies with which collision category this shape will collide
*/
inline void ProxyShape::setCollideWithMaskBits(unsigned short collideWithMaskBits) {
mCollideWithMaskBits = collideWithMaskBits;
RP3D_LOG(mLogger, Logger::Level::Information, Logger::Category::ProxyShape,
"ProxyShape " + std::to_string(mBroadPhaseID) + ": Set collideWithMaskBits=" +
std::to_string(mCollideWithMaskBits));
}
// Return the broad-phase id
inline int ProxyShape::getBroadPhaseId() const {
return mBroadPhaseID;

View File

@ -28,7 +28,6 @@
// Libraries
#include "mathematics/Vector3.h"
#include "mathematics/Ray.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
@ -37,6 +36,7 @@ namespace reactphysics3d {
class CollisionBody;
class ProxyShape;
class CollisionShape;
struct Ray;
// Structure RaycastInfo
/**

View File

@ -25,5 +25,12 @@
// Libraries
#include "TriangleMesh.h"
#include "memory/MemoryManager.h"
using namespace reactphysics3d;
// Constructor
TriangleMesh::TriangleMesh()
: mTriangleArrays(MemoryManager::getBaseAllocator()) {
}

View File

@ -28,12 +28,14 @@
// Libraries
#include <cassert>
#include "TriangleVertexArray.h"
#include "memory/MemoryManager.h"
#include "containers/List.h"
namespace reactphysics3d {
// Declarations
class TriangleVertexArray;
class MemoryManager;
// Class TriangleMesh
/**
* This class represents a mesh made of triangles. A TriangleMesh contains
@ -52,9 +54,7 @@ class TriangleMesh {
public:
/// Constructor
TriangleMesh() : mTriangleArrays(MemoryManager::getBaseAllocator()) {
}
TriangleMesh();
/// Destructor
~TriangleMesh() = default;

View File

@ -31,6 +31,7 @@
namespace reactphysics3d {
// Declarations
struct Vector3;
// Class TriangleVertexArray

View File

@ -27,6 +27,8 @@
#include "BroadPhaseAlgorithm.h"
#include "collision/CollisionDetection.h"
#include "utils/Profiler.h"
#include "collision/RaycastInfo.h"
#include "memory/MemoryManager.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;
@ -96,6 +98,31 @@ void BroadPhaseAlgorithm::addMovedCollisionShape(int broadPhaseID) {
mNbMovedShapes++;
}
// Return true if the two broad-phase collision shapes are overlapping
bool BroadPhaseAlgorithm::testOverlappingShapes(const ProxyShape* shape1,
const ProxyShape* shape2) const {
if (shape1->getBroadPhaseId() == -1 || shape2->getBroadPhaseId() == -1) return false;
// Get the two AABBs of the collision shapes
const AABB& aabb1 = mDynamicAABBTree.getFatAABB(shape1->getBroadPhaseId());
const AABB& aabb2 = mDynamicAABBTree.getFatAABB(shape2->getBroadPhaseId());
// Check if the two AABBs are overlapping
return aabb1.testCollision(aabb2);
}
// Ray casting method
void BroadPhaseAlgorithm::raycast(const Ray& ray, RaycastTest& raycastTest,
unsigned short raycastWithCategoryMaskBits) const {
RP3D_PROFILE("BroadPhaseAlgorithm::raycast()", mProfiler);
BroadPhaseRaycastCallback broadPhaseRaycastCallback(mDynamicAABBTree, raycastWithCategoryMaskBits, raycastTest);
mDynamicAABBTree.raycast(ray, broadPhaseRaycastCallback);
}
// Remove a collision shape from the array of shapes that have moved in the last simulation step
// and that need to be tested again for broad-phase overlapping.
void BroadPhaseAlgorithm::removeMovedCollisionShape(int broadPhaseID) {

View File

@ -27,10 +27,7 @@
#define REACTPHYSICS3D_BROAD_PHASE_ALGORITHM_H
// Libraries
#include "body/CollisionBody.h"
#include "collision/ProxyShape.h"
#include "DynamicAABBTree.h"
#include "utils/Profiler.h"
#include "containers/LinkedList.h"
/// Namespace ReactPhysics3D
@ -39,6 +36,10 @@ namespace reactphysics3d {
// Declarations
class CollisionDetection;
class BroadPhaseAlgorithm;
class CollisionBody;
class ProxyShape;
class MemoryManager;
class Profiler;
// Structure BroadPhasePair
/**
@ -242,36 +243,11 @@ inline bool BroadPhasePair::smallerThan(const BroadPhasePair& pair1, const Broad
return false;
}
// Return true if the two broad-phase collision shapes are overlapping
inline bool BroadPhaseAlgorithm::testOverlappingShapes(const ProxyShape* shape1,
const ProxyShape* shape2) const {
if (shape1->getBroadPhaseId() == -1 || shape2->getBroadPhaseId() == -1) return false;
// Get the two AABBs of the collision shapes
const AABB& aabb1 = mDynamicAABBTree.getFatAABB(shape1->getBroadPhaseId());
const AABB& aabb2 = mDynamicAABBTree.getFatAABB(shape2->getBroadPhaseId());
// Check if the two AABBs are overlapping
return aabb1.testCollision(aabb2);
}
// Return the fat AABB of a given broad-phase shape
inline const AABB& BroadPhaseAlgorithm::getFatAABB(int broadPhaseId) const {
return mDynamicAABBTree.getFatAABB(broadPhaseId);
}
// Ray casting method
inline void BroadPhaseAlgorithm::raycast(const Ray& ray, RaycastTest& raycastTest,
unsigned short raycastWithCategoryMaskBits) const {
RP3D_PROFILE("BroadPhaseAlgorithm::raycast()", mProfiler);
BroadPhaseRaycastCallback broadPhaseRaycastCallback(mDynamicAABBTree, raycastWithCategoryMaskBits, raycastTest);
mDynamicAABBTree.raycast(ray, broadPhaseRaycastCallback);
}
// Return the proxy shape corresponding to the broad-phase node id in parameter
inline ProxyShape* BroadPhaseAlgorithm::getProxyShapeForBroadPhaseId(int broadPhaseId) const {
return static_cast<ProxyShape*>(mDynamicAABBTree.getNodeDataPointer(broadPhaseId));

View File

@ -29,8 +29,6 @@
// Libraries
#include "configuration.h"
#include "collision/shapes/AABB.h"
#include "body/CollisionBody.h"
#include "memory/MemoryAllocator.h"
/// Namespace ReactPhysics3D
namespace reactphysics3d {
@ -39,7 +37,12 @@ namespace reactphysics3d {
class BroadPhaseAlgorithm;
class BroadPhaseRaycastTestCallback;
class DynamicAABBTreeOverlapCallback;
class CollisionBody;
struct RaycastTest;
class AABB;
class Profiler;
class MemoryAllocator;
// Structure TreeNode
/**

View File

@ -26,6 +26,7 @@
// Libraries
#include "CapsuleVsCapsuleAlgorithm.h"
#include "collision/shapes/CapsuleShape.h"
#include "collision/NarrowPhaseInfo.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;

View File

@ -27,14 +27,15 @@
#define REACTPHYSICS3D_CAPSULE_VS_CAPSULE_ALGORITHM_H
// Libraries
#include "body/Body.h"
#include "constraint/ContactPoint.h"
#include "NarrowPhaseAlgorithm.h"
/// Namespace ReactPhysics3D
namespace reactphysics3d {
// Declarations
class Body;
class ContactPoint;
// Class CapsuleVsCapsuleAlgorithm
/**
* This class is used to compute the narrow-phase collision detection

View File

@ -29,6 +29,8 @@
#include "GJK/GJKAlgorithm.h"
#include "collision/shapes/CapsuleShape.h"
#include "collision/shapes/ConvexPolyhedronShape.h"
#include "collision/NarrowPhaseInfo.h"
#include "collision/ContactPointInfo.h"
#include <cassert>
// We want to use the ReactPhysics3D namespace

View File

@ -27,14 +27,15 @@
#define REACTPHYSICS3D_CAPSULE_VS_CONVEX_POLYHEDRON_ALGORITHM_H
// Libraries
#include "body/Body.h"
#include "constraint/ContactPoint.h"
#include "NarrowPhaseAlgorithm.h"
/// Namespace ReactPhysics3D
namespace reactphysics3d {
// Declarations
class ContactPoint;
class Body;
// Class CapsuleVsConvexPolyhedronAlgorithm
/**
* This class is used to compute the narrow-phase collision detection

View File

@ -27,10 +27,13 @@
#define REACTPHYSICS3D_COLLISION_DISPATCH_H
// Libraries
#include "NarrowPhaseAlgorithm.h"
namespace reactphysics3d {
// Declarations
class NarrowPhaseAlgorithm;
class Profiler;
// Class CollisionDispatch
/**
* This is the abstract base class for dispatching the narrow-phase

View File

@ -27,6 +27,7 @@
#include "ConvexPolyhedronVsConvexPolyhedronAlgorithm.h"
#include "GJK/GJKAlgorithm.h"
#include "SAT/SATAlgorithm.h"
#include "collision/NarrowPhaseInfo.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;

View File

@ -27,14 +27,15 @@
#define REACTPHYSICS3D_CONVEX_POLYHEDRON_VS_CONVEX_POLYHEDRON_ALGORITHM_H
// Libraries
#include "body/Body.h"
#include "constraint/ContactPoint.h"
#include "NarrowPhaseAlgorithm.h"
/// Namespace ReactPhysics3D
namespace reactphysics3d {
// Declarations
class Body;
class ContactPoint;
// Class ConvexPolyhedronVsConvexPolyhedronAlgorithm
/**
* This class is used to compute the narrow-phase collision detection

View File

@ -34,7 +34,6 @@
#include "CapsuleVsCapsuleAlgorithm.h"
#include "CapsuleVsConvexPolyhedronAlgorithm.h"
#include "ConvexPolyhedronVsConvexPolyhedronAlgorithm.h"
#include "GJK/GJKAlgorithm.h"
namespace reactphysics3d {

View File

@ -30,9 +30,8 @@
#include "collision/shapes/TriangleShape.h"
#include "configuration.h"
#include "utils/Profiler.h"
#include <algorithm>
#include <cmath>
#include <cfloat>
#include "collision/NarrowPhaseInfo.h"
#include "collision/narrowphase/GJK/VoronoiSimplex.h"
#include <cassert>
// We want to use the ReactPhysics3D namespace

View File

@ -27,14 +27,18 @@
#define REACTPHYSICS3D_GJK_ALGORITHM_H
// Libraries
#include "collision/ContactManifoldInfo.h"
#include "collision/NarrowPhaseInfo.h"
#include "collision/shapes/ConvexShape.h"
#include "VoronoiSimplex.h"
#include "decimal.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
class ContactManifoldInfo;
struct NarrowPhaseInfo;
class ConvexShape;
class Profiler;
class VoronoiSimplex;
// Constants
constexpr decimal REL_ERROR = decimal(1.0e-3);
constexpr decimal REL_ERROR_SQUARE = REL_ERROR * REL_ERROR;

View File

@ -25,7 +25,7 @@
// Libraries
#include "VoronoiSimplex.h"
#include <cfloat>
#include "mathematics/Vector2.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;

View File

@ -27,7 +27,7 @@
#define REACTPHYSICS3D_VORONOI_SIMPLEX_H
// Libraries
#include "mathematics/mathematics.h"
#include "mathematics/Vector3.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {

View File

@ -27,16 +27,19 @@
#define REACTPHYSICS3D_NARROW_PHASE_ALGORITHM_H
// Libraries
#include "body/Body.h"
#include "collision/ContactManifoldInfo.h"
#include "memory/PoolAllocator.h"
#include "engine/OverlappingPair.h"
#include "collision/NarrowPhaseInfo.h"
/// Namespace ReactPhysics3D
namespace reactphysics3d {
class CollisionDetection;
class Body;
class ContactManifoldInfo;
class PoolAllocator;
class OverlappingPair;
struct NarrowPhaseInfo;
struct ContactPointInfo;
class Profiler;
class MemoryAllocator;
// Class NarrowPhaseCallback
/**

View File

@ -31,11 +31,9 @@
#include "collision/shapes/SphereShape.h"
#include "engine/OverlappingPair.h"
#include "collision/shapes/TriangleShape.h"
#include "collision/NarrowPhaseInfo.h"
#include "configuration.h"
#include "utils/Profiler.h"
#include <algorithm>
#include <cmath>
#include <cfloat>
#include <cassert>
// We want to use the ReactPhysics3D namespace

View File

@ -27,16 +27,20 @@
#define REACTPHYSICS3D_SAT_ALGORITHM_H
// Libraries
#include "collision/ContactManifoldInfo.h"
#include "collision/NarrowPhaseInfo.h"
#include "collision/shapes/ConvexPolyhedronShape.h"
#include "decimal.h"
#include "collision/HalfEdgeStructure.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
class CapsuleShape;
class SphereShape;
class ContactManifoldInfo;
struct NarrowPhaseInfo;
class ConvexPolyhedronShape;
class MemoryAllocator;
class Profiler;
// Class SATAlgorithm
class SATAlgorithm {

View File

@ -27,6 +27,7 @@
#include "SphereVsCapsuleAlgorithm.h"
#include "collision/shapes/SphereShape.h"
#include "collision/shapes/CapsuleShape.h"
#include "collision/NarrowPhaseInfo.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;

View File

@ -27,14 +27,16 @@
#define REACTPHYSICS3D_SPHERE_VS_CAPSULE_ALGORITHM_H
// Libraries
#include "body/Body.h"
#include "constraint/ContactPoint.h"
#include "NarrowPhaseAlgorithm.h"
/// Namespace ReactPhysics3D
namespace reactphysics3d {
// Declarations
class Body;
class ContactPoint;
// Class SphereVsCapsuleAlgorithm
/**
* This class is used to compute the narrow-phase collision detection

View File

@ -27,6 +27,7 @@
#include "SphereVsConvexPolyhedronAlgorithm.h"
#include "GJK/GJKAlgorithm.h"
#include "SAT/SATAlgorithm.h"
#include "collision/NarrowPhaseInfo.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;

View File

@ -27,14 +27,15 @@
#define REACTPHYSICS3D_SPHERE_VS_CONVEX_POLYHEDRON_ALGORITHM_H
// Libraries
#include "body/Body.h"
#include "constraint/ContactPoint.h"
#include "NarrowPhaseAlgorithm.h"
/// Namespace ReactPhysics3D
namespace reactphysics3d {
// Declarations
class ContactPoint;
class Body;
// Class SphereVsConvexPolyhedronAlgorithm
/**
* This class is used to compute the narrow-phase collision detection

View File

@ -26,6 +26,7 @@
// Libraries
#include "SphereVsSphereAlgorithm.h"
#include "collision/shapes/SphereShape.h"
#include "collision/NarrowPhaseInfo.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;

View File

@ -27,14 +27,15 @@
#define REACTPHYSICS3D_SPHERE_VS_SPHERE_ALGORITHM_H
// Libraries
#include "body/Body.h"
#include "constraint/ContactPoint.h"
#include "NarrowPhaseAlgorithm.h"
/// Namespace ReactPhysics3D
namespace reactphysics3d {
// Declarations
class ContactPoint;
class Body;
// Class SphereVsSphereAlgorithm
/**
* This class is used to compute the narrow-phase collision detection

View File

@ -28,6 +28,7 @@
#include "collision/ProxyShape.h"
#include "configuration.h"
#include "memory/MemoryManager.h"
#include "collision/RaycastInfo.h"
#include <cassert>
using namespace reactphysics3d;

View File

@ -27,15 +27,16 @@
#define REACTPHYSICS3D_BOX_SHAPE_H
// Libraries
#include <cfloat>
#include "ConvexPolyhedronShape.h"
#include "body/CollisionBody.h"
#include "mathematics/mathematics.h"
#include "memory/DefaultAllocator.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
class CollisionBody;
class DefaultAllocator;
// Class BoxShape
/**
* This class represents a 3D box shape. Those axis are unit length.

View File

@ -27,6 +27,7 @@
#include "CapsuleShape.h"
#include "collision/ProxyShape.h"
#include "configuration.h"
#include "collision/RaycastInfo.h"
#include <cassert>
using namespace reactphysics3d;

View File

@ -28,12 +28,14 @@
// Libraries
#include "ConvexShape.h"
#include "body/CollisionBody.h"
#include "mathematics/mathematics.h"
// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
class CollisionBody;
// Class CapsuleShape
/**
* This class represents a capsule collision shape that is defined around the Y axis.

View File

@ -28,18 +28,21 @@
// Libraries
#include <cassert>
#include <typeinfo>
#include "mathematics/Vector3.h"
#include "mathematics/Matrix3x3.h"
#include "mathematics/Ray.h"
#include "AABB.h"
#include "collision/RaycastInfo.h"
#include "memory/PoolAllocator.h"
#include "utils/Profiler.h"
#include "configuration.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
class Profiler;
class PoolAllocator;
class AABB;
class Transform;
struct Ray;
struct RaycastInfo;
struct Vector3;
class Matrix3x3;
/// Type of collision shapes
enum class CollisionShapeType {SPHERE, CAPSULE, CONVEX_POLYHEDRON, CONCAVE_SHAPE};
const int NB_COLLISION_SHAPE_TYPES = 4;

View File

@ -26,6 +26,10 @@
// Libraries
#include "ConcaveMeshShape.h"
#include "memory/MemoryManager.h"
#include "collision/RaycastInfo.h"
#include "collision/TriangleMesh.h"
#include "utils/Profiler.h"
#include "collision/TriangleVertexArray.h"
using namespace reactphysics3d;

View File

@ -29,14 +29,15 @@
// Libraries
#include "ConcaveShape.h"
#include "collision/broadphase/DynamicAABBTree.h"
#include "collision/TriangleMesh.h"
#include "collision/shapes/TriangleShape.h"
#include "containers/List.h"
#include "utils/Profiler.h"
namespace reactphysics3d {
// Declarations
class ConcaveMeshShape;
class Profiler;
class TriangleShape;
class TriangleMesh;
// class ConvexTriangleAABBOverlapCallback
class ConvexTriangleAABBOverlapCallback : public DynamicAABBTreeOverlapCallback {

View File

@ -24,9 +24,10 @@
********************************************************************************/
// Libraries
#include <complex>
#include "configuration.h"
#include "ConvexMeshShape.h"
#include "engine/CollisionWorld.h"
#include "collision/RaycastInfo.h"
using namespace reactphysics3d;

View File

@ -28,17 +28,16 @@
// Libraries
#include "ConvexPolyhedronShape.h"
#include "engine/CollisionWorld.h"
#include "mathematics/mathematics.h"
#include "collision/PolyhedronMesh.h"
#include "collision/narrowphase/GJK/GJKAlgorithm.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Declaration
class CollisionWorld;
class GJKAlgorithm;
class CollisionWorld;
// Class ConvexMeshShape
/**

View File

@ -25,7 +25,7 @@
// Libraries
#include "ConvexShape.h"
#include "mathematics/Vector3.h"
// We want to use the ReactPhysics3D namespace
using namespace reactphysics3d;

View File

@ -25,6 +25,8 @@
// Libraries
#include "HeightFieldShape.h"
#include "collision/RaycastInfo.h"
#include "utils/Profiler.h"
using namespace reactphysics3d;

View File

@ -28,12 +28,13 @@
// Libraries
#include "ConcaveShape.h"
#include "collision/shapes/TriangleShape.h"
#include "utils/Profiler.h"
#include "collision/shapes/AABB.h"
namespace reactphysics3d {
class HeightFieldShape;
class Profiler;
class TriangleShape;
// Class TriangleOverlapCallback
/**

View File

@ -27,6 +27,7 @@
#include "SphereShape.h"
#include "collision/ProxyShape.h"
#include "configuration.h"
#include "collision/RaycastInfo.h"
#include <cassert>
using namespace reactphysics3d;
@ -40,6 +41,22 @@ SphereShape::SphereShape(decimal radius)
assert(radius > decimal(0.0));
}
// Update the AABB of a body using its collision shape
/**
* @param[out] aabb The axis-aligned bounding box (AABB) of the collision shape
* computed in world-space coordinates
* @param transform Transform used to compute the AABB of the collision shape
*/
void SphereShape::computeAABB(AABB& aabb, const Transform& transform) const {
// Get the local extents in x,y and z direction
Vector3 extents(mMargin, mMargin, mMargin);
// Update the AABB with the new minimum and maximum coordinates
aabb.setMin(transform.getPosition() - extents);
aabb.setMax(transform.getPosition() + extents);
}
// Raycast method with feedback information
bool SphereShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, ProxyShape* proxyShape, MemoryAllocator& allocator) const {

View File

@ -28,12 +28,14 @@
// Libraries
#include "ConvexShape.h"
#include "body/CollisionBody.h"
#include "mathematics/mathematics.h"
// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
class CollisionBody;
// Class SphereShape
/**
* This class represents a sphere collision shape that is centered
@ -152,22 +154,6 @@ inline void SphereShape::computeLocalInertiaTensor(Matrix3x3& tensor, decimal ma
0.0, 0.0, diag);
}
// Update the AABB of a body using its collision shape
/**
* @param[out] aabb The axis-aligned bounding box (AABB) of the collision shape
* computed in world-space coordinates
* @param transform Transform used to compute the AABB of the collision shape
*/
inline void SphereShape::computeAABB(AABB& aabb, const Transform& transform) const {
// Get the local extents in x,y and z direction
Vector3 extents(mMargin, mMargin, mMargin);
// Update the AABB with the new minimum and maximum coordinates
aabb.setMin(transform.getPosition() - extents);
aabb.setMax(transform.getPosition() + extents);
}
// Return true if a point is inside the collision shape
inline bool SphereShape::testPointInside(const Vector3& localPoint, ProxyShape* proxyShape) const {
return (localPoint.lengthSquare() < mMargin * mMargin);

View File

@ -27,6 +27,7 @@
#include "TriangleShape.h"
#include "collision/ProxyShape.h"
#include "mathematics/mathematics_functions.h"
#include "collision/RaycastInfo.h"
#include "utils/Profiler.h"
#include "configuration.h"
#include <cassert>
@ -208,6 +209,25 @@ Vector3 TriangleShape::computeSmoothLocalContactNormalForTriangle(const Vector3&
return (u * mVerticesNormals[0] + v * mVerticesNormals[1] + w * mVerticesNormals[2]).getUnit();
}
// Update the AABB of a body using its collision shape
/**
* @param[out] aabb The axis-aligned bounding box (AABB) of the collision shape
* computed in world-space coordinates
* @param transform Transform used to compute the AABB of the collision shape
*/
void TriangleShape::computeAABB(AABB& aabb, const Transform& transform) const {
const Vector3 worldPoint1 = transform * mPoints[0];
const Vector3 worldPoint2 = transform * mPoints[1];
const Vector3 worldPoint3 = transform * mPoints[2];
const Vector3 xAxis(worldPoint1.x, worldPoint2.x, worldPoint3.x);
const Vector3 yAxis(worldPoint1.y, worldPoint2.y, worldPoint3.y);
const Vector3 zAxis(worldPoint1.z, worldPoint2.z, worldPoint3.z);
aabb.setMin(Vector3(xAxis.getMinValue(), yAxis.getMinValue(), zAxis.getMinValue()));
aabb.setMax(Vector3(xAxis.getMaxValue(), yAxis.getMaxValue(), zAxis.getMaxValue()));
}
// Raycast method with feedback information
/// This method use the line vs triangle raycasting technique described in
/// Real-time Collision Detection by Christer Ericson.

View File

@ -221,25 +221,6 @@ inline void TriangleShape::computeLocalInertiaTensor(Matrix3x3& tensor, decimal
tensor.setToZero();
}
// Update the AABB of a body using its collision shape
/**
* @param[out] aabb The axis-aligned bounding box (AABB) of the collision shape
* computed in world-space coordinates
* @param transform Transform used to compute the AABB of the collision shape
*/
inline void TriangleShape::computeAABB(AABB& aabb, const Transform& transform) const {
const Vector3 worldPoint1 = transform * mPoints[0];
const Vector3 worldPoint2 = transform * mPoints[1];
const Vector3 worldPoint3 = transform * mPoints[2];
const Vector3 xAxis(worldPoint1.x, worldPoint2.x, worldPoint3.x);
const Vector3 yAxis(worldPoint1.y, worldPoint2.y, worldPoint3.y);
const Vector3 zAxis(worldPoint1.z, worldPoint2.z, worldPoint3.z);
aabb.setMin(Vector3(xAxis.getMinValue(), yAxis.getMinValue(), zAxis.getMinValue()));
aabb.setMax(Vector3(xAxis.getMaxValue(), yAxis.getMaxValue(), zAxis.getMaxValue()));
}
// Return true if a point is inside the collision shape
inline bool TriangleShape::testPointInside(const Vector3& localPoint, ProxyShape* proxyShape) const {
return false;

View File

@ -30,7 +30,6 @@
#include <limits>
#include <cfloat>
#include <utility>
#include <cstdint>
#include <sstream>
#include <string>
#include "decimal.h"

View File

@ -27,14 +27,16 @@
#define REACTPHYSICS3D_CONTACT_POINT_H
// Libraries
#include "body/CollisionBody.h"
#include "collision/ContactPointInfo.h"
#include "configuration.h"
#include "mathematics/mathematics.h"
#include "collision/ContactPointInfo.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
class CollisionBody;
struct NarrowPhaseInfo;
// Class ContactPoint

View File

@ -26,7 +26,6 @@
// Libraries
#include "HingeJoint.h"
#include "engine/ConstraintSolver.h"
#include <cmath>
using namespace reactphysics3d;

View File

@ -25,6 +25,7 @@
// Libraries
#include "SliderJoint.h"
#include "engine/ConstraintSolver.h"
using namespace reactphysics3d;

View File

@ -28,10 +28,14 @@
// Libraries
#include "mathematics/mathematics.h"
#include "engine/ConstraintSolver.h"
#include "body/RigidBody.h"
#include "Joint.h"
namespace reactphysics3d {
// Declarations
class ConstraintSolver;
// Structure SliderJointInfo
/**
* This structure is used to gather the information needed to create a slider

View File

@ -25,8 +25,8 @@
// Libraries
#include "CollisionWorld.h"
#include <algorithm>
#include <sstream>
#include "utils/Profiler.h"
#include "utils/Logger.h"
// Namespaces
using namespace reactphysics3d;

View File

@ -27,24 +27,24 @@
#define REACTPHYSICS3D_COLLISION_WORLD_H
// Libraries
#include <algorithm>
#include "mathematics/mathematics.h"
#include "containers/List.h"
#include "utils/Profiler.h"
#include "utils/Logger.h"
#include "body/CollisionBody.h"
#include "collision/RaycastInfo.h"
#include "OverlappingPair.h"
#include "collision/CollisionDetection.h"
#include "constraint/Joint.h"
#include "constraint/ContactPoint.h"
#include "memory/MemoryManager.h"
#include "EventListener.h"
/// Namespace reactphysics3d
namespace reactphysics3d {
// Declarations
class Profiler;
class Logger;
class EventListener;
class Joint;
class ContactPoint;
class OverlappingPair;
class CollisionBody;
struct RaycastInfo;
class CollisionCallback;
class OverlapCallback;

View File

@ -26,6 +26,7 @@
// Libraries
#include "ConstraintSolver.h"
#include "utils/Profiler.h"
#include "engine/Island.h"
using namespace reactphysics3d;

View File

@ -29,11 +29,14 @@
// Libraries
#include "configuration.h"
#include "mathematics/mathematics.h"
#include "constraint/Joint.h"
#include "Island.h"
namespace reactphysics3d {
// Declarations
class Joint;
class Island;
class Profiler;
// Structure ConstraintSolverData
/**
* This structure contains data from the constraint solver that are used to solve

View File

@ -27,8 +27,10 @@
#include "ContactSolver.h"
#include "DynamicsWorld.h"
#include "body/RigidBody.h"
#include "constraint/ContactPoint.h"
#include "utils/Profiler.h"
#include <limits>
#include "engine/Island.h"
#include "collision/ContactManifold.h"
using namespace reactphysics3d;
using namespace std;
@ -758,6 +760,30 @@ void ContactSolver::solve() {
}
}
// Compute the collision restitution factor from the restitution factor of each body
decimal ContactSolver::computeMixedRestitutionFactor(RigidBody* body1,
RigidBody* body2) const {
decimal restitution1 = body1->getMaterial().getBounciness();
decimal restitution2 = body2->getMaterial().getBounciness();
// Return the largest restitution factor
return (restitution1 > restitution2) ? restitution1 : restitution2;
}
// Compute the mixed friction coefficient from the friction coefficient of each body
decimal ContactSolver::computeMixedFrictionCoefficient(RigidBody *body1,
RigidBody *body2) const {
// Use the geometric mean to compute the mixed friction coefficient
return std::sqrt(body1->getMaterial().getFrictionCoefficient() *
body2->getMaterial().getFrictionCoefficient());
}
// Compute th mixed rolling resistance factor between two bodies
inline decimal ContactSolver::computeMixedRollingResistance(RigidBody* body1,
RigidBody* body2) const {
return decimal(0.5f) * (body1->getMaterial().getRollingResistance() + body2->getMaterial().getRollingResistance());
}
// Store the computed impulses to use them to
// warm start the solver at the next iteration
void ContactSolver::storeImpulses() {

View File

@ -27,15 +27,21 @@
#define REACTPHYSICS3D_CONTACT_SOLVER_H
// Libraries
#include "constraint/ContactPoint.h"
#include "configuration.h"
#include "constraint/Joint.h"
#include "collision/ContactManifold.h"
#include "Island.h"
#include "mathematics/Vector3.h"
#include "mathematics/Matrix3x3.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
class ContactPoint;
class Joint;
class ContactManifold;
class MemoryManager;
class Profiler;
class Island;
class RigidBody;
// Class Contact Solver
/**
@ -316,8 +322,8 @@ class ContactSolver {
// -------------------- Methods -------------------- //
/// Compute the collision restitution factor from the restitution factor of each body
decimal computeMixedRestitutionFactor(RigidBody *body1,
RigidBody *body2) const;
decimal computeMixedRestitutionFactor(RigidBody* body1,
RigidBody* body2) const;
/// Compute the mixed friction coefficient from the friction coefficient of each body
decimal computeMixedFrictionCoefficient(RigidBody* body1,
@ -412,30 +418,6 @@ inline void ContactSolver::setIsSplitImpulseActive(bool isActive) {
mIsSplitImpulseActive = isActive;
}
// Compute the collision restitution factor from the restitution factor of each body
inline decimal ContactSolver::computeMixedRestitutionFactor(RigidBody* body1,
RigidBody* body2) const {
decimal restitution1 = body1->getMaterial().getBounciness();
decimal restitution2 = body2->getMaterial().getBounciness();
// Return the largest restitution factor
return (restitution1 > restitution2) ? restitution1 : restitution2;
}
// Compute the mixed friction coefficient from the friction coefficient of each body
inline decimal ContactSolver::computeMixedFrictionCoefficient(RigidBody *body1,
RigidBody *body2) const {
// Use the geometric mean to compute the mixed friction coefficient
return std::sqrt(body1->getMaterial().getFrictionCoefficient() *
body2->getMaterial().getFrictionCoefficient());
}
// Compute th mixed rolling resistance factor between two bodies
inline decimal ContactSolver::computeMixedRollingResistance(RigidBody* body1,
RigidBody* body2) const {
return decimal(0.5f) * (body1->getMaterial().getRollingResistance() + body2->getMaterial().getRollingResistance());
}
#ifdef IS_PROFILING_ACTIVE
// Set the profiler

View File

@ -29,7 +29,10 @@
#include "constraint/SliderJoint.h"
#include "constraint/HingeJoint.h"
#include "constraint/FixedJoint.h"
#include <fstream>
#include "utils/Profiler.h"
#include "engine/EventListener.h"
#include "engine/Island.h"
#include "collision/ContactManifold.h"
// Namespaces
using namespace reactphysics3d;

View File

@ -28,16 +28,19 @@
// Libraries
#include "CollisionWorld.h"
#include "collision/CollisionDetection.h"
#include "ContactSolver.h"
#include "ConstraintSolver.h"
#include "body/RigidBody.h"
#include "Island.h"
#include "configuration.h"
#include "utils/Logger.h"
#include "engine/ContactSolver.h"
/// Namespace ReactPhysics3D
namespace reactphysics3d {
// Declarations
class CollisionDetection;
class Island;
class RigidBody;
// Class DynamicsWorld
/**
* This class represents a dynamics world. This class inherits from

View File

@ -25,6 +25,7 @@
// Libraries
#include "Island.h"
#include "memory/MemoryManager.h"
using namespace reactphysics3d;

View File

@ -27,13 +27,15 @@
#define REACTPHYSICS3D_ISLAND_H
// Libraries
#include "memory/SingleFrameAllocator.h"
#include "body/RigidBody.h"
#include "constraint/Joint.h"
#include "collision/ContactManifold.h"
namespace reactphysics3d {
// Declarations
class RigidBody;
class SingleFrameAllocator;
class ContactManifold;
// Class Island
/**
* An island represent an isolated group of awake bodies that are connected with each other by

View File

@ -29,10 +29,10 @@
#include "collision/ContactManifoldInfo.h"
#include "collision/NarrowPhaseInfo.h"
#include "containers/containers_common.h"
#include "collision/ContactPointInfo.h"
using namespace reactphysics3d;
// Constructor
OverlappingPair::OverlappingPair(ProxyShape* shape1, ProxyShape* shape2,
MemoryAllocator& persistentMemoryAllocator, MemoryAllocator& temporaryMemoryAllocator,

View File

@ -29,7 +29,6 @@
// Libraries
#include "collision/ContactManifoldSet.h"
#include "collision/ProxyShape.h"
#include "collision/shapes/CollisionShape.h"
#include "containers/Map.h"
#include "containers/Pair.h"
#include "containers/containers_common.h"
@ -37,6 +36,10 @@
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
struct NarrowPhaseInfo;
class CollisionShape;
// Structure LastFrameCollisionInfo
/**
* This structure contains collision info about the last frame.

View File

@ -27,8 +27,6 @@
#define REACTPHYSICS3D_TIMER_H
// Libraries
#include <stdexcept>
#include <iostream>
#include <ctime>
#include <cassert>
#include "configuration.h"

View File

@ -28,7 +28,6 @@
// Libraries
#include <cassert>
#include <string>
#include "Vector2.h"
/// ReactPhysics3D namespace

View File

@ -24,7 +24,6 @@
********************************************************************************/
// Libraries
#include <iostream>
#include "Matrix3x3.h"
// Namespaces

View File

@ -29,13 +29,11 @@
// Libraries
#include <cassert>
#include <string>
#include "Vector3.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Class Matrix3x3
/**
* This class represents a 3x3 matrix.

View File

@ -26,6 +26,7 @@
// Libraries
#include "Quaternion.h"
#include "Vector3.h"
#include "Matrix3x3.h"
#include <cassert>
// Namespace

View File

@ -27,14 +27,15 @@
#define REACTPHYSICS3D_QUATERNION_H
// Libraries
#include <cmath>
#include "Vector3.h"
#include "Matrix3x3.h"
#include "decimal.h"
#include "Vector3.h"
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Declarations
class Matrix3x3;
// Class Quaternion
/**
* This class represents a quaternion. We use the notation :

View File

@ -25,7 +25,30 @@
// Libraries
#include "Transform.h"
#include "Matrix3x3.h"
// Namespaces
using namespace reactphysics3d;
// Set the transform from an OpenGL transform matrix
void Transform::setFromOpenGL(decimal* openglMatrix) {
Matrix3x3 matrix(openglMatrix[0], openglMatrix[4], openglMatrix[8],
openglMatrix[1], openglMatrix[5], openglMatrix[9],
openglMatrix[2], openglMatrix[6], openglMatrix[10]);
mOrientation = Quaternion(matrix);
mPosition.setAllValues(openglMatrix[12], openglMatrix[13], openglMatrix[14]);
}
// Get the OpenGL matrix of the transform
void Transform::getOpenGLMatrix(decimal* openglMatrix) const {
const Matrix3x3& matrix = mOrientation.getMatrix();
openglMatrix[0] = matrix[0][0]; openglMatrix[1] = matrix[1][0];
openglMatrix[2] = matrix[2][0]; openglMatrix[3] = 0.0;
openglMatrix[4] = matrix[0][1]; openglMatrix[5] = matrix[1][1];
openglMatrix[6] = matrix[2][1]; openglMatrix[7] = 0.0;
openglMatrix[8] = matrix[0][2]; openglMatrix[9] = matrix[1][2];
openglMatrix[10] = matrix[2][2]; openglMatrix[11] = 0.0;
openglMatrix[12] = mPosition.x; openglMatrix[13] = mPosition.y;
openglMatrix[14] = mPosition.z; openglMatrix[15] = 1.0;
}

View File

@ -27,7 +27,6 @@
#define REACTPHYSICS3D_TRANSFORM_H
// Libraries
#include "Matrix3x3.h"
#include "Vector3.h"
#include "Quaternion.h"
@ -170,28 +169,6 @@ inline void Transform::setToIdentity() {
mOrientation = Quaternion::identity();
}
// Set the transform from an OpenGL transform matrix
inline void Transform::setFromOpenGL(decimal* openglMatrix) {
Matrix3x3 matrix(openglMatrix[0], openglMatrix[4], openglMatrix[8],
openglMatrix[1], openglMatrix[5], openglMatrix[9],
openglMatrix[2], openglMatrix[6], openglMatrix[10]);
mOrientation = Quaternion(matrix);
mPosition.setAllValues(openglMatrix[12], openglMatrix[13], openglMatrix[14]);
}
// Get the OpenGL matrix of the transform
inline void Transform::getOpenGLMatrix(decimal* openglMatrix) const {
const Matrix3x3& matrix = mOrientation.getMatrix();
openglMatrix[0] = matrix[0][0]; openglMatrix[1] = matrix[1][0];
openglMatrix[2] = matrix[2][0]; openglMatrix[3] = 0.0;
openglMatrix[4] = matrix[0][1]; openglMatrix[5] = matrix[1][1];
openglMatrix[6] = matrix[2][1]; openglMatrix[7] = 0.0;
openglMatrix[8] = matrix[0][2]; openglMatrix[9] = matrix[1][2];
openglMatrix[10] = matrix[2][2]; openglMatrix[11] = 0.0;
openglMatrix[12] = mPosition.x; openglMatrix[13] = mPosition.y;
openglMatrix[14] = mPosition.z; openglMatrix[15] = 1.0;
}
// Return the inverse of the transform
inline Transform Transform::getInverse() const {
const Quaternion& invQuaternion = mOrientation.getInverse();

View File

@ -27,9 +27,7 @@
#define REACTPHYSICS3D_VECTOR2_H
// Libraries
#include <cmath>
#include <cassert>
#include <string>
#include "mathematics_functions.h"
#include "decimal.h"
@ -55,7 +53,7 @@ struct Vector2 {
// -------------------- Methods -------------------- //
/// Constructor of the class Vector3D
/// Constructor of the struct Vector2
Vector2();
/// Constructor with arguments

View File

@ -25,7 +25,6 @@
// Libraries
#include "Vector3.h"
#include <iostream>
// Namespaces
using namespace reactphysics3d;

View File

@ -27,9 +27,7 @@
#define REACTPHYSICS3D_VECTOR3_H
// Libraries
#include <cmath>
#include <cassert>
#include <string>
#include "mathematics_functions.h"
#include "decimal.h"
@ -37,7 +35,7 @@
/// ReactPhysics3D namespace
namespace reactphysics3d {
// Class Vector3
// Struct Vector3
/**
* This class represents a 3D vector.
*/
@ -58,7 +56,7 @@ struct Vector3 {
// -------------------- Methods -------------------- //
/// Constructor of the class Vector3D
/// Constructor of the struct Vector3
Vector3();
/// Constructor with arguments
@ -172,7 +170,7 @@ struct Vector3 {
friend Vector3 operator/(const Vector3& vector1, const Vector3& vector2);
};
// Constructor of the class Vector3D
// Constructor of the struct Vector3
inline Vector3::Vector3() : x(0.0), y(0.0), z(0.0) {
}

View File

@ -42,7 +42,7 @@ class DefaultAllocator : public MemoryAllocator {
public:
/// Destructor
virtual ~DefaultAllocator() = default;
virtual ~DefaultAllocator() override = default;
/// Assignment operator
DefaultAllocator& operator=(DefaultAllocator& allocator) = default;

View File

@ -27,7 +27,6 @@
#define REACTPHYSICS3D_MEMORY_MANAGER_H
// Libraries
#include "memory/MemoryAllocator.h"
#include "memory/DefaultAllocator.h"
#include "memory/PoolAllocator.h"
#include "memory/SingleFrameAllocator.h"
@ -35,6 +34,9 @@
/// Namespace ReactPhysics3D
namespace reactphysics3d {
// Declarations
class MemoryAllocator;
// Class MemoryManager
/**
* The memory manager is used to store the different memory allocators that are used

Some files were not shown because too many files have changed in this diff Show More