Remove the use of std::vector
This commit is contained in:
parent
3a0cc1feac
commit
301823729d
|
@ -34,7 +34,6 @@
|
||||||
#include "narrowphase/DefaultCollisionDispatch.h"
|
#include "narrowphase/DefaultCollisionDispatch.h"
|
||||||
#include "memory/MemoryManager.h"
|
#include "memory/MemoryManager.h"
|
||||||
#include "constraint/ContactPoint.h"
|
#include "constraint/ContactPoint.h"
|
||||||
#include <vector>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#define REACTPHYSICS3D_CONTACT_MANIFOLD_H
|
#define REACTPHYSICS3D_CONTACT_MANIFOLD_H
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include <vector>
|
|
||||||
#include "body/CollisionBody.h"
|
#include "body/CollisionBody.h"
|
||||||
#include "collision/ProxyShape.h"
|
#include "collision/ProxyShape.h"
|
||||||
#include "constraint/ContactPoint.h"
|
#include "constraint/ContactPoint.h"
|
||||||
|
|
|
@ -41,13 +41,13 @@ void HalfEdgeStructure::init() {
|
||||||
std::map<uint, edgeKey> mapEdgeIndexToKey;
|
std::map<uint, edgeKey> mapEdgeIndexToKey;
|
||||||
std::map<uint, edgeKey> mapFaceIndexToEdgeKey;
|
std::map<uint, edgeKey> mapFaceIndexToEdgeKey;
|
||||||
|
|
||||||
|
List<edgeKey> currentFaceEdges(mAllocator, mFaces[0].faceVertices.size());
|
||||||
|
|
||||||
// For each face
|
// For each face
|
||||||
for (uint f=0; f<mFaces.size(); f++) {
|
for (uint f=0; f<mFaces.size(); f++) {
|
||||||
|
|
||||||
Face face = mFaces[f];
|
Face face = mFaces[f];
|
||||||
|
|
||||||
std::vector<edgeKey> currentFaceEdges;
|
|
||||||
|
|
||||||
edgeKey firstEdgeKey;
|
edgeKey firstEdgeKey;
|
||||||
|
|
||||||
// For each vertex of the face
|
// For each vertex of the face
|
||||||
|
@ -100,8 +100,10 @@ void HalfEdgeStructure::init() {
|
||||||
mEdges.add(edge);
|
mEdges.add(edge);
|
||||||
}
|
}
|
||||||
|
|
||||||
currentFaceEdges.push_back(pairV1V2);
|
currentFaceEdges.add(pairV1V2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
currentFaceEdges.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set next edges
|
// Set next edges
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "mathematics/mathematics.h"
|
#include "mathematics/mathematics.h"
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#include "HalfEdgeStructure.h"
|
#include "HalfEdgeStructure.h"
|
||||||
#include "collision/PolygonVertexArray.h"
|
#include "collision/PolygonVertexArray.h"
|
||||||
#include "memory/DefaultAllocator.h"
|
#include "memory/DefaultAllocator.h"
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
|
||||||
|
|
|
@ -27,9 +27,10 @@
|
||||||
#define REACTPHYSICS3D_TRIANGLE_MESH_H
|
#define REACTPHYSICS3D_TRIANGLE_MESH_H
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include <vector>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include "TriangleVertexArray.h"
|
#include "TriangleVertexArray.h"
|
||||||
|
#include "memory/MemoryManager.h"
|
||||||
|
#include "containers/List.h"
|
||||||
|
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
|
||||||
|
@ -46,12 +47,14 @@ class TriangleMesh {
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/// All the triangle arrays of the mesh (one triangle array per part)
|
/// All the triangle arrays of the mesh (one triangle array per part)
|
||||||
std::vector<TriangleVertexArray*> mTriangleArrays;
|
List<TriangleVertexArray*> mTriangleArrays;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/// Constructor
|
/// Constructor
|
||||||
TriangleMesh() = default;
|
TriangleMesh() : mTriangleArrays(MemoryManager::getBaseAllocator()) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// Destructor
|
/// Destructor
|
||||||
~TriangleMesh() = default;
|
~TriangleMesh() = default;
|
||||||
|
@ -68,7 +71,7 @@ class TriangleMesh {
|
||||||
|
|
||||||
// Add a subpart of the mesh
|
// Add a subpart of the mesh
|
||||||
inline void TriangleMesh::addSubpart(TriangleVertexArray* triangleVertexArray) {
|
inline void TriangleMesh::addSubpart(TriangleVertexArray* triangleVertexArray) {
|
||||||
mTriangleArrays.push_back(triangleVertexArray );
|
mTriangleArrays.add(triangleVertexArray );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return a pointer to a given subpart (triangle vertex array) of the mesh
|
// Return a pointer to a given subpart (triangle vertex array) of the mesh
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
#define REACTPHYSICS3D_BROAD_PHASE_ALGORITHM_H
|
#define REACTPHYSICS3D_BROAD_PHASE_ALGORITHM_H
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include <vector>
|
|
||||||
#include "body/CollisionBody.h"
|
#include "body/CollisionBody.h"
|
||||||
#include "collision/ProxyShape.h"
|
#include "collision/ProxyShape.h"
|
||||||
#include "DynamicAABBTree.h"
|
#include "DynamicAABBTree.h"
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "mathematics/mathematics.h"
|
#include "mathematics/mathematics.h"
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
/// ReactPhysics3D namespace
|
/// ReactPhysics3D namespace
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include "collision/ProxyShape.h"
|
#include "collision/ProxyShape.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "memory/MemoryManager.h"
|
#include "memory/MemoryManager.h"
|
||||||
#include <vector>
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
using namespace reactphysics3d;
|
using namespace reactphysics3d;
|
||||||
|
|
|
@ -155,7 +155,7 @@ uint ConcaveMeshShape::computeTriangleShapeId(uint subPart, uint triangleIndex)
|
||||||
decimal ConcaveMeshRaycastCallback::raycastBroadPhaseShape(int32 nodeId, const Ray& ray) {
|
decimal ConcaveMeshRaycastCallback::raycastBroadPhaseShape(int32 nodeId, const Ray& ray) {
|
||||||
|
|
||||||
// Add the id of the hit AABB node into
|
// Add the id of the hit AABB node into
|
||||||
mHitAABBNodes.push_back(nodeId);
|
mHitAABBNodes.add(nodeId);
|
||||||
|
|
||||||
return ray.maxFraction;
|
return ray.maxFraction;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ decimal ConcaveMeshRaycastCallback::raycastBroadPhaseShape(int32 nodeId, const R
|
||||||
// Raycast all collision shapes that have been collected
|
// Raycast all collision shapes that have been collected
|
||||||
void ConcaveMeshRaycastCallback::raycastTriangles() {
|
void ConcaveMeshRaycastCallback::raycastTriangles() {
|
||||||
|
|
||||||
std::vector<int>::const_iterator it;
|
List<int>::Iterator it;
|
||||||
decimal smallestHitFraction = mRay.maxFraction;
|
decimal smallestHitFraction = mRay.maxFraction;
|
||||||
|
|
||||||
for (it = mHitAABBNodes.begin(); it != mHitAABBNodes.end(); ++it) {
|
for (it = mHitAABBNodes.begin(); it != mHitAABBNodes.end(); ++it) {
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "collision/broadphase/DynamicAABBTree.h"
|
#include "collision/broadphase/DynamicAABBTree.h"
|
||||||
#include "collision/TriangleMesh.h"
|
#include "collision/TriangleMesh.h"
|
||||||
#include "collision/shapes/TriangleShape.h"
|
#include "collision/shapes/TriangleShape.h"
|
||||||
|
#include "containers/List.h"
|
||||||
#include "engine/Profiler.h"
|
#include "engine/Profiler.h"
|
||||||
|
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
@ -70,7 +71,7 @@ class ConcaveMeshRaycastCallback : public DynamicAABBTreeRaycastCallback {
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
std::vector<int32> mHitAABBNodes;
|
List<int32> mHitAABBNodes;
|
||||||
const DynamicAABBTree& mDynamicAABBTree;
|
const DynamicAABBTree& mDynamicAABBTree;
|
||||||
const ConcaveMeshShape& mConcaveMeshShape;
|
const ConcaveMeshShape& mConcaveMeshShape;
|
||||||
ProxyShape* mProxyShape;
|
ProxyShape* mProxyShape;
|
||||||
|
@ -91,7 +92,7 @@ class ConcaveMeshRaycastCallback : public DynamicAABBTreeRaycastCallback {
|
||||||
// Constructor
|
// Constructor
|
||||||
ConcaveMeshRaycastCallback(const DynamicAABBTree& dynamicAABBTree, const ConcaveMeshShape& concaveMeshShape,
|
ConcaveMeshRaycastCallback(const DynamicAABBTree& dynamicAABBTree, const ConcaveMeshShape& concaveMeshShape,
|
||||||
ProxyShape* proxyShape, RaycastInfo& raycastInfo, const Ray& ray, MemoryAllocator& allocator)
|
ProxyShape* proxyShape, RaycastInfo& raycastInfo, const Ray& ray, MemoryAllocator& allocator)
|
||||||
: mDynamicAABBTree(dynamicAABBTree), mConcaveMeshShape(concaveMeshShape), mProxyShape(proxyShape),
|
: mHitAABBNodes(allocator), mDynamicAABBTree(dynamicAABBTree), mConcaveMeshShape(concaveMeshShape), mProxyShape(proxyShape),
|
||||||
mRaycastInfo(raycastInfo), mRay(ray), mIsHit(false), mAllocator(allocator) {
|
mRaycastInfo(raycastInfo), mRay(ray), mIsHit(false), mAllocator(allocator) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,6 @@
|
||||||
#include "collision/TriangleMesh.h"
|
#include "collision/TriangleMesh.h"
|
||||||
#include "collision/PolyhedronMesh.h"
|
#include "collision/PolyhedronMesh.h"
|
||||||
#include "collision/narrowphase/GJK/GJKAlgorithm.h"
|
#include "collision/narrowphase/GJK/GJKAlgorithm.h"
|
||||||
#include <vector>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ using namespace std;
|
||||||
// Constructor
|
// Constructor
|
||||||
CollisionWorld::CollisionWorld()
|
CollisionWorld::CollisionWorld()
|
||||||
: mCollisionDetection(this, mMemoryManager), mCurrentBodyID(0),
|
: mCollisionDetection(this, mMemoryManager), mCurrentBodyID(0),
|
||||||
mEventListener(nullptr) {
|
mFreeBodiesIDs(mMemoryManager.getPoolAllocator()), mEventListener(nullptr) {
|
||||||
|
|
||||||
#ifdef IS_PROFILING_ACTIVE
|
#ifdef IS_PROFILING_ACTIVE
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ void CollisionWorld::destroyCollisionBody(CollisionBody* collisionBody) {
|
||||||
collisionBody->removeAllCollisionShapes();
|
collisionBody->removeAllCollisionShapes();
|
||||||
|
|
||||||
// Add the body ID to the list of free IDs
|
// Add the body ID to the list of free IDs
|
||||||
mFreeBodiesIDs.push_back(collisionBody->getID());
|
mFreeBodiesIDs.add(collisionBody->getID());
|
||||||
|
|
||||||
// Call the destructor of the collision body
|
// Call the destructor of the collision body
|
||||||
collisionBody->~CollisionBody();
|
collisionBody->~CollisionBody();
|
||||||
|
@ -119,9 +119,9 @@ bodyindex CollisionWorld::computeNextAvailableBodyID() {
|
||||||
|
|
||||||
// Compute the body ID
|
// Compute the body ID
|
||||||
bodyindex bodyID;
|
bodyindex bodyID;
|
||||||
if (!mFreeBodiesIDs.empty()) {
|
if (mFreeBodiesIDs.size() != 0) {
|
||||||
bodyID = mFreeBodiesIDs.back();
|
bodyID = mFreeBodiesIDs[mFreeBodiesIDs.size() - 1];
|
||||||
mFreeBodiesIDs.pop_back();
|
mFreeBodiesIDs.remove(mFreeBodiesIDs.size() - 1);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bodyID = mCurrentBodyID;
|
bodyID = mCurrentBodyID;
|
||||||
|
|
|
@ -27,11 +27,11 @@
|
||||||
#define REACTPHYSICS3D_COLLISION_WORLD_H
|
#define REACTPHYSICS3D_COLLISION_WORLD_H
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include <vector>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "mathematics/mathematics.h"
|
#include "mathematics/mathematics.h"
|
||||||
|
#include "containers/List.h"
|
||||||
#include "Profiler.h"
|
#include "Profiler.h"
|
||||||
#include "body/CollisionBody.h"
|
#include "body/CollisionBody.h"
|
||||||
#include "collision/RaycastInfo.h"
|
#include "collision/RaycastInfo.h"
|
||||||
|
@ -74,7 +74,7 @@ class CollisionWorld {
|
||||||
bodyindex mCurrentBodyID;
|
bodyindex mCurrentBodyID;
|
||||||
|
|
||||||
/// List of free ID for rigid bodies
|
/// List of free ID for rigid bodies
|
||||||
std::vector<luint> mFreeBodiesIDs;
|
List<luint> mFreeBodiesIDs;
|
||||||
|
|
||||||
/// Pointer to an event listener object
|
/// Pointer to an event listener object
|
||||||
EventListener* mEventListener;
|
EventListener* mEventListener;
|
||||||
|
|
|
@ -446,7 +446,7 @@ void DynamicsWorld::destroyRigidBody(RigidBody* rigidBody) {
|
||||||
rigidBody->removeAllCollisionShapes();
|
rigidBody->removeAllCollisionShapes();
|
||||||
|
|
||||||
// Add the body ID to the list of free IDs
|
// Add the body ID to the list of free IDs
|
||||||
mFreeBodiesIDs.push_back(rigidBody->getID());
|
mFreeBodiesIDs.add(rigidBody->getID());
|
||||||
|
|
||||||
// Destroy all the joints in which the rigid body to be destroyed is involved
|
// Destroy all the joints in which the rigid body to be destroyed is involved
|
||||||
JointListElement* element;
|
JointListElement* element;
|
||||||
|
@ -828,9 +828,9 @@ void DynamicsWorld::enableSleeping(bool isSleepingEnabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the list of all contacts of the world
|
/// Return the list of all contacts of the world
|
||||||
std::vector<const ContactManifold*> DynamicsWorld::getContactsList() const {
|
List<const ContactManifold*> DynamicsWorld::getContactsList() {
|
||||||
|
|
||||||
std::vector<const ContactManifold*> contactManifolds;
|
List<const ContactManifold*> contactManifolds(mMemoryManager.getPoolAllocator());
|
||||||
|
|
||||||
// For each currently overlapping pair of bodies
|
// For each currently overlapping pair of bodies
|
||||||
std::map<overlappingpairid, OverlappingPair*>::const_iterator it;
|
std::map<overlappingpairid, OverlappingPair*>::const_iterator it;
|
||||||
|
@ -845,7 +845,7 @@ std::vector<const ContactManifold*> DynamicsWorld::getContactsList() const {
|
||||||
while (manifold != nullptr) {
|
while (manifold != nullptr) {
|
||||||
|
|
||||||
// Get the contact manifold
|
// Get the contact manifold
|
||||||
contactManifolds.push_back(manifold);
|
contactManifolds.add(manifold);
|
||||||
|
|
||||||
manifold = manifold->getNext();
|
manifold = manifold->getNext();
|
||||||
}
|
}
|
||||||
|
|
|
@ -249,7 +249,7 @@ class DynamicsWorld : public CollisionWorld {
|
||||||
void setEventListener(EventListener* eventListener);
|
void setEventListener(EventListener* eventListener);
|
||||||
|
|
||||||
/// Return the list of all contacts of the world
|
/// Return the list of all contacts of the world
|
||||||
std::vector<const ContactManifold*> getContactsList() const;
|
List<const ContactManifold*> getContactsList();
|
||||||
|
|
||||||
// -------------------- Friendship -------------------- //
|
// -------------------- Friendship -------------------- //
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "Vector2.h"
|
#include "Vector2.h"
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
// Namespaces
|
// Namespaces
|
||||||
using namespace reactphysics3d;
|
using namespace reactphysics3d;
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "Vector3.h"
|
#include "Vector3.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
// Namespaces
|
// Namespaces
|
||||||
using namespace reactphysics3d;
|
using namespace reactphysics3d;
|
||||||
|
|
|
@ -36,7 +36,6 @@
|
||||||
#include "Ray.h"
|
#include "Ray.h"
|
||||||
#include "configuration.h"
|
#include "configuration.h"
|
||||||
#include "mathematics_functions.h"
|
#include "mathematics_functions.h"
|
||||||
#include <vector>
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
#include "Vector3.h"
|
#include "Vector3.h"
|
||||||
#include "Vector2.h"
|
#include "Vector2.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
using namespace reactphysics3d;
|
using namespace reactphysics3d;
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <vector>
|
|
||||||
#include "containers/List.h"
|
#include "containers/List.h"
|
||||||
|
|
||||||
/// ReactPhysics3D namespace
|
/// ReactPhysics3D namespace
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
#include "constraint/SliderJoint.h"
|
#include "constraint/SliderJoint.h"
|
||||||
#include "constraint/HingeJoint.h"
|
#include "constraint/HingeJoint.h"
|
||||||
#include "constraint/FixedJoint.h"
|
#include "constraint/FixedJoint.h"
|
||||||
|
#include "containers/List.h"
|
||||||
|
|
||||||
/// Alias to the ReactPhysics3D namespace
|
/// Alias to the ReactPhysics3D namespace
|
||||||
namespace rp3d = reactphysics3d;
|
namespace rp3d = reactphysics3d;
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
// Libraries
|
// Libraries
|
||||||
#include "Test.h"
|
#include "Test.h"
|
||||||
#include "collision/broadphase/DynamicAABBTree.h"
|
#include "collision/broadphase/DynamicAABBTree.h"
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
/// Reactphysics3D namespace
|
/// Reactphysics3D namespace
|
||||||
namespace reactphysics3d {
|
namespace reactphysics3d {
|
||||||
|
|
|
@ -186,7 +186,7 @@ class CollisionDetectionScene : public SceneDemo {
|
||||||
virtual void setIsContactPointsDisplayed(bool display) override;
|
virtual void setIsContactPointsDisplayed(bool display) override;
|
||||||
|
|
||||||
/// Return all the contact points of the scene
|
/// Return all the contact points of the scene
|
||||||
virtual std::vector<ContactPoint> getContactPoints() const override;
|
virtual std::vector<ContactPoint> getContactPoints() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Display or not the surface normals at hit points
|
// Display or not the surface normals at hit points
|
||||||
|
@ -205,7 +205,7 @@ inline void CollisionDetectionScene::setIsContactPointsDisplayed(bool display) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return all the contact points of the scene
|
// Return all the contact points of the scene
|
||||||
inline std::vector<ContactPoint> CollisionDetectionScene::getContactPoints() const {
|
inline std::vector<ContactPoint> CollisionDetectionScene::getContactPoints() {
|
||||||
return mContactManager.getContactPoints();
|
return mContactManager.getContactPoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,11 +101,11 @@ class CollisionShapesScene : public SceneDemo {
|
||||||
virtual void reset() override;
|
virtual void reset() override;
|
||||||
|
|
||||||
/// Return all the contact points of the scene
|
/// Return all the contact points of the scene
|
||||||
virtual std::vector<ContactPoint> getContactPoints() const override;
|
virtual std::vector<ContactPoint> getContactPoints() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return all the contact points of the scene
|
// Return all the contact points of the scene
|
||||||
inline std::vector<ContactPoint> CollisionShapesScene::getContactPoints() const {
|
inline std::vector<ContactPoint> CollisionShapesScene::getContactPoints() {
|
||||||
return computeContactPointsOfWorld(getDynamicsWorld());
|
return computeContactPointsOfWorld(getDynamicsWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,11 +98,11 @@ class ConcaveMeshScene : public SceneDemo {
|
||||||
virtual void reset() override;
|
virtual void reset() override;
|
||||||
|
|
||||||
/// Return all the contact points of the scene
|
/// Return all the contact points of the scene
|
||||||
virtual std::vector<ContactPoint> getContactPoints() const override;
|
virtual std::vector<ContactPoint> getContactPoints() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return all the contact points of the scene
|
// Return all the contact points of the scene
|
||||||
inline std::vector<ContactPoint> ConcaveMeshScene::getContactPoints() const {
|
inline std::vector<ContactPoint> ConcaveMeshScene::getContactPoints() {
|
||||||
return computeContactPointsOfWorld(getDynamicsWorld());
|
return computeContactPointsOfWorld(getDynamicsWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,11 +69,11 @@ class CubesScene : public SceneDemo {
|
||||||
virtual void reset() override;
|
virtual void reset() override;
|
||||||
|
|
||||||
/// Return all the contact points of the scene
|
/// Return all the contact points of the scene
|
||||||
virtual std::vector<ContactPoint> getContactPoints() const override;
|
virtual std::vector<ContactPoint> getContactPoints() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return all the contact points of the scene
|
// Return all the contact points of the scene
|
||||||
inline std::vector<ContactPoint> CubesScene::getContactPoints() const {
|
inline std::vector<ContactPoint> CubesScene::getContactPoints() {
|
||||||
return computeContactPointsOfWorld(getDynamicsWorld());
|
return computeContactPointsOfWorld(getDynamicsWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,11 +69,11 @@ class CubeStackScene : public SceneDemo {
|
||||||
virtual void reset() override;
|
virtual void reset() override;
|
||||||
|
|
||||||
/// Return all the contact points of the scene
|
/// Return all the contact points of the scene
|
||||||
virtual std::vector<ContactPoint> getContactPoints() const override;
|
virtual std::vector<ContactPoint> getContactPoints() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return all the contact points of the scene
|
// Return all the contact points of the scene
|
||||||
inline std::vector<ContactPoint> CubeStackScene::getContactPoints() const {
|
inline std::vector<ContactPoint> CubeStackScene::getContactPoints() {
|
||||||
return computeContactPointsOfWorld(getDynamicsWorld());
|
return computeContactPointsOfWorld(getDynamicsWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,11 +100,11 @@ class HeightFieldScene : public SceneDemo {
|
||||||
virtual void reset() override ;
|
virtual void reset() override ;
|
||||||
|
|
||||||
/// Return all the contact points of the scene
|
/// Return all the contact points of the scene
|
||||||
virtual std::vector<ContactPoint> getContactPoints() const override ;
|
virtual std::vector<ContactPoint> getContactPoints() override ;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return all the contact points of the scene
|
// Return all the contact points of the scene
|
||||||
inline std::vector<ContactPoint> HeightFieldScene::getContactPoints() const {
|
inline std::vector<ContactPoint> HeightFieldScene::getContactPoints() {
|
||||||
return computeContactPointsOfWorld(getDynamicsWorld());
|
return computeContactPointsOfWorld(getDynamicsWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,11 +127,11 @@ class JointsScene : public SceneDemo {
|
||||||
virtual void reset() override;
|
virtual void reset() override;
|
||||||
|
|
||||||
/// Return all the contact points of the scene
|
/// Return all the contact points of the scene
|
||||||
virtual std::vector<ContactPoint> getContactPoints() const override;
|
virtual std::vector<ContactPoint> getContactPoints() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return all the contact points of the scene
|
// Return all the contact points of the scene
|
||||||
inline std::vector<ContactPoint> JointsScene::getContactPoints() const {
|
inline std::vector<ContactPoint> JointsScene::getContactPoints() {
|
||||||
return computeContactPointsOfWorld(getDynamicsWorld());
|
return computeContactPointsOfWorld(getDynamicsWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ class RaycastScene : public SceneDemo {
|
||||||
virtual void setIsContactPointsDisplayed(bool display) override;
|
virtual void setIsContactPointsDisplayed(bool display) override;
|
||||||
|
|
||||||
/// Return all the contact points of the scene
|
/// Return all the contact points of the scene
|
||||||
virtual std::vector<ContactPoint> getContactPoints() const override;
|
virtual std::vector<ContactPoint> getContactPoints() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Display or not the surface normals at hit points
|
// Display or not the surface normals at hit points
|
||||||
|
@ -217,7 +217,7 @@ inline void RaycastScene::setIsContactPointsDisplayed(bool display) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return all the contact points of the scene
|
// Return all the contact points of the scene
|
||||||
inline std::vector<ContactPoint> RaycastScene::getContactPoints() const {
|
inline std::vector<ContactPoint> RaycastScene::getContactPoints() {
|
||||||
return mRaycastManager.getHitPoints();
|
return mRaycastManager.getHitPoints();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ class Scene {
|
||||||
void setIsWireframeEnabled(bool isEnabled);
|
void setIsWireframeEnabled(bool isEnabled);
|
||||||
|
|
||||||
/// Return all the contact points of the scene
|
/// Return all the contact points of the scene
|
||||||
std::vector<ContactPoint> virtual getContactPoints() const;
|
std::vector<ContactPoint> virtual getContactPoints();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Called when a keyboard event occurs
|
// Called when a keyboard event occurs
|
||||||
|
@ -303,7 +303,7 @@ inline void Scene::setIsWireframeEnabled(bool isEnabled) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return all the contact points of the scene
|
// Return all the contact points of the scene
|
||||||
inline std::vector<ContactPoint> Scene::getContactPoints() const {
|
inline std::vector<ContactPoint> Scene::getContactPoints() {
|
||||||
|
|
||||||
// Return an empty list of contact points
|
// Return an empty list of contact points
|
||||||
return std::vector<ContactPoint>();
|
return std::vector<ContactPoint>();
|
||||||
|
|
|
@ -418,15 +418,15 @@ void SceneDemo::removeAllContactPoints() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return all the contact points of the scene
|
// Return all the contact points of the scene
|
||||||
std::vector<ContactPoint> SceneDemo::computeContactPointsOfWorld(const rp3d::DynamicsWorld* world) const {
|
std::vector<ContactPoint> SceneDemo::computeContactPointsOfWorld(rp3d::DynamicsWorld* world) {
|
||||||
|
|
||||||
std::vector<ContactPoint> contactPoints;
|
std::vector<ContactPoint> contactPoints;
|
||||||
|
|
||||||
// Get the list of contact manifolds from the world
|
// Get the list of contact manifolds from the world
|
||||||
std::vector<const rp3d::ContactManifold*> manifolds = world->getContactsList();
|
rp3d::List<const rp3d::ContactManifold*> manifolds = world->getContactsList();
|
||||||
|
|
||||||
// For each contact manifold
|
// For each contact manifold
|
||||||
std::vector<const rp3d::ContactManifold*>::const_iterator it;
|
rp3d::List<const rp3d::ContactManifold*>::Iterator it;
|
||||||
for (it = manifolds.begin(); it != manifolds.end(); ++it) {
|
for (it = manifolds.begin(); it != manifolds.end(); ++it) {
|
||||||
|
|
||||||
const rp3d::ContactManifold* manifold = *it;
|
const rp3d::ContactManifold* manifold = *it;
|
||||||
|
|
|
@ -158,7 +158,7 @@ class SceneDemo : public Scene {
|
||||||
virtual void setIsShadowMappingEnabled(bool isShadowMappingEnabled) override;
|
virtual void setIsShadowMappingEnabled(bool isShadowMappingEnabled) override;
|
||||||
|
|
||||||
/// Return all the contact points of the scene
|
/// Return all the contact points of the scene
|
||||||
std::vector<ContactPoint> computeContactPointsOfWorld(const rp3d::DynamicsWorld* world) const;
|
std::vector<ContactPoint> computeContactPointsOfWorld(reactphysics3d::DynamicsWorld *world);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Enabled/Disable the shadow mapping
|
// Enabled/Disable the shadow mapping
|
||||||
|
|
Loading…
Reference in New Issue
Block a user