diff --git a/include/reactphysics3d/collision/CollisionCallback.h b/include/reactphysics3d/collision/CollisionCallback.h index a398a3c9..2afe2359 100644 --- a/include/reactphysics3d/collision/CollisionCallback.h +++ b/include/reactphysics3d/collision/CollisionCallback.h @@ -172,14 +172,14 @@ class CollisionCallback { /** * @return The number of contact points in the contact pair */ - uint getNbContactPoints() const; + uint32 getNbContactPoints() const; /// Return a given contact point /** * @param index Index of the contact point to retrieve * @return A contact point object */ - ContactPoint getContactPoint(uint index) const; + ContactPoint getContactPoint(uint32 index) const; /// Return a pointer to the first body in contact /** @@ -271,7 +271,7 @@ class CollisionCallback { /** * @return The number of contact pairs */ - uint getNbContactPairs() const; + uint32 getNbContactPairs() const; /// Return a given contact pair /** @@ -304,7 +304,7 @@ RP3D_FORCE_INLINE uint32 CollisionCallback::CallbackData::getNbContactPairs() co /** * @return The number of contact points */ -RP3D_FORCE_INLINE uint CollisionCallback::ContactPair::getNbContactPoints() const { +RP3D_FORCE_INLINE uint32 CollisionCallback::ContactPair::getNbContactPoints() const { return mContactPair.nbToTalContactPoints; } diff --git a/include/reactphysics3d/collision/ContactManifold.h b/include/reactphysics3d/collision/ContactManifold.h index 738e1565..bacfd68e 100644 --- a/include/reactphysics3d/collision/ContactManifold.h +++ b/include/reactphysics3d/collision/ContactManifold.h @@ -104,7 +104,7 @@ class ContactManifold { /// Constructor ContactManifold(Entity bodyEntity1, Entity bodyEntity2, Entity colliderEntity1, Entity colliderEntity2, - uint contactPointsIndex, uint8 nbContactPoints); + uint32 contactPointsIndex, uint8 nbContactPoints); // -------------------- Friendship -------------------- // diff --git a/include/reactphysics3d/collision/HalfEdgeStructure.h b/include/reactphysics3d/collision/HalfEdgeStructure.h index 8b9f8e4a..3bef6542 100644 --- a/include/reactphysics3d/collision/HalfEdgeStructure.h +++ b/include/reactphysics3d/collision/HalfEdgeStructure.h @@ -41,26 +41,26 @@ class HalfEdgeStructure { public: - using VerticesPair = Pair; + using VerticesPair = Pair; /// Edge struct Edge { - uint vertexIndex; // Index of the vertex at the beginning of the edge - uint twinEdgeIndex; // Index of the twin edge - uint faceIndex; // Adjacent face index of the edge - uint nextEdgeIndex; // Index of the next edge + uint32 vertexIndex; // Index of the vertex at the beginning of the edge + uint32 twinEdgeIndex; // Index of the twin edge + uint32 faceIndex; // Adjacent face index of the edge + uint32 nextEdgeIndex; // Index of the next edge }; /// Face struct Face { - uint edgeIndex; // Index of an half-edge of the face - Array faceVertices; // Index of the vertices of the face + uint32 edgeIndex; // Index of an half-edge of the face + Array faceVertices; // Index of the vertices of the face /// Constructor Face(MemoryAllocator& allocator) : faceVertices(allocator) {} /// Constructor - Face(Array vertices) : faceVertices(vertices) {} + Face(Array vertices) : faceVertices(vertices) {} }; /// Vertex @@ -89,8 +89,8 @@ class HalfEdgeStructure { public: /// Constructor - HalfEdgeStructure(MemoryAllocator& allocator, uint facesCapacity, uint verticesCapacity, - uint edgesCapacity) :mAllocator(allocator), mFaces(allocator, facesCapacity), + HalfEdgeStructure(MemoryAllocator& allocator, uint32 facesCapacity, uint32 verticesCapacity, + uint32 edgesCapacity) :mAllocator(allocator), mFaces(allocator, facesCapacity), mVertices(allocator, verticesCapacity), mEdges(allocator, edgesCapacity) {} /// Destructor @@ -100,28 +100,28 @@ class HalfEdgeStructure { void init(); /// Add a vertex - uint addVertex(uint vertexPointIndex); + uint32 addVertex(uint vertexPointIndex); /// Add a face - void addFace(Array faceVertices); + void addFace(Array faceVertices); /// Return the number of faces - uint getNbFaces() const; + uint32 getNbFaces() const; /// Return the number of half-edges - uint getNbHalfEdges() const; + uint32 getNbHalfEdges() const; /// Return the number of vertices - uint getNbVertices() const; + uint32 getNbVertices() const; /// Return a given face - const Face& getFace(uint index) const; + const Face& getFace(uint32 index) const; /// Return a given edge - const Edge& getHalfEdge(uint index) const; + const Edge& getHalfEdge(uint32 index) const; /// Return a given vertex - const Vertex& getVertex(uint index) const; + const Vertex& getVertex(uint32 index) const; }; @@ -140,7 +140,7 @@ RP3D_FORCE_INLINE uint32 HalfEdgeStructure::addVertex(uint32 vertexPointIndex) { * @param faceVertices Array of the vertices in a face (ordered in CCW order as seen from outside * the polyhedron */ -RP3D_FORCE_INLINE void HalfEdgeStructure::addFace(Array faceVertices) { +RP3D_FORCE_INLINE void HalfEdgeStructure::addFace(Array faceVertices) { // Create a new face Face face(faceVertices); diff --git a/include/reactphysics3d/collision/PolygonVertexArray.h b/include/reactphysics3d/collision/PolygonVertexArray.h index 4512bc15..3a2975eb 100644 --- a/include/reactphysics3d/collision/PolygonVertexArray.h +++ b/include/reactphysics3d/collision/PolygonVertexArray.h @@ -56,34 +56,34 @@ class PolygonVertexArray { struct PolygonFace { /// Number of vertices in the polygon face - uint nbVertices; + uint32 nbVertices; /// Index of the first vertex of the polygon face /// inside the array with all vertex indices - uint indexBase; + uint32 indexBase; }; protected: /// Number of vertices in the array - uint mNbVertices; + uint32 mNbVertices; /// Pointer to the first vertex value in the array const unsigned char* mVerticesStart; /// Stride (number of bytes) between the beginning of two vertices /// values in the array - int mVerticesStride; + uint32 mVerticesStride; /// Pointer to the first vertex index of the array const unsigned char* mIndicesStart; /// Stride (number of bytes) between the beginning of two indices in /// the array - int mIndicesStride; + uint32 mIndicesStride; /// Number of polygon faces in the array - uint mNbFaces; + uint32 mNbFaces; /// Pointer to the first polygon face in the polyhedron PolygonFace* mPolygonFacesStart; @@ -97,9 +97,9 @@ class PolygonVertexArray { public: /// Constructor - PolygonVertexArray(uint nbVertices, const void* verticesStart, int verticesStride, - const void* indexesStart, int indexesStride, - uint nbFaces, PolygonFace* facesStart, + PolygonVertexArray(uint32 nbVertices, const void* verticesStart, uint32 verticesStride, + const void* indexesStart, uint32 indexesStride, + uint32 nbFaces, PolygonFace* facesStart, VertexDataType vertexDataType, IndexDataType indexDataType); /// Destructor @@ -112,22 +112,22 @@ class PolygonVertexArray { IndexDataType getIndexDataType() const; /// Return the number of vertices - uint getNbVertices() const; + uint32 getNbVertices() const; /// Return the number of faces - uint getNbFaces() const; + uint32 getNbFaces() const; /// Return the vertices stride (number of bytes) - int getVerticesStride() const; + uint32 getVerticesStride() const; /// Return the indices stride (number of bytes) - int getIndicesStride() const; + uint32 getIndicesStride() const; /// Return the vertex index of a given vertex in a face - uint getVertexIndexInFace(uint faceIndex, uint noVertexInFace) const; + uint32 getVertexIndexInFace(uint32 faceIndex32, uint32 noVertexInFace) const; /// Return a polygon face of the polyhedron - PolygonFace* getPolygonFace(uint faceIndex) const; + PolygonFace* getPolygonFace(uint32 faceIndex) const; /// Return the pointer to the start of the vertices array const unsigned char* getVerticesStart() const; @@ -156,7 +156,7 @@ RP3D_FORCE_INLINE PolygonVertexArray::IndexDataType PolygonVertexArray::getIndex /** * @return The number of vertices in the array */ -RP3D_FORCE_INLINE uint PolygonVertexArray::getNbVertices() const { +RP3D_FORCE_INLINE uint32 PolygonVertexArray::getNbVertices() const { return mNbVertices; } @@ -164,7 +164,7 @@ RP3D_FORCE_INLINE uint PolygonVertexArray::getNbVertices() const { /** * @return The number of faces in the array */ -RP3D_FORCE_INLINE uint PolygonVertexArray::getNbFaces() const { +RP3D_FORCE_INLINE uint32 PolygonVertexArray::getNbFaces() const { return mNbFaces; } @@ -172,7 +172,7 @@ RP3D_FORCE_INLINE uint PolygonVertexArray::getNbFaces() const { /** * @return The number of bytes between two vertices */ -RP3D_FORCE_INLINE int PolygonVertexArray::getVerticesStride() const { +RP3D_FORCE_INLINE uint32 PolygonVertexArray::getVerticesStride() const { return mVerticesStride; } @@ -180,7 +180,7 @@ RP3D_FORCE_INLINE int PolygonVertexArray::getVerticesStride() const { /** * @return The number of bytes between two consecutive face indices */ -RP3D_FORCE_INLINE int PolygonVertexArray::getIndicesStride() const { +RP3D_FORCE_INLINE uint32 PolygonVertexArray::getIndicesStride() const { return mIndicesStride; } @@ -189,7 +189,7 @@ RP3D_FORCE_INLINE int PolygonVertexArray::getIndicesStride() const { * @param faceIndex Index of a given face * @return A polygon face */ -RP3D_FORCE_INLINE PolygonVertexArray::PolygonFace* PolygonVertexArray::getPolygonFace(uint faceIndex) const { +RP3D_FORCE_INLINE PolygonVertexArray::PolygonFace* PolygonVertexArray::getPolygonFace(uint32 faceIndex) const { assert(faceIndex < mNbFaces); return &mPolygonFacesStart[faceIndex]; } diff --git a/include/reactphysics3d/collision/PolyhedronMesh.h b/include/reactphysics3d/collision/PolyhedronMesh.h index 210173d7..d0318dab 100644 --- a/include/reactphysics3d/collision/PolyhedronMesh.h +++ b/include/reactphysics3d/collision/PolyhedronMesh.h @@ -79,7 +79,7 @@ class PolyhedronMesh { void computeCentroid() ; /// Compute and return the area of a face - decimal getFaceArea(uint faceIndex) const; + decimal getFaceArea(uint32 faceIndex) const; /// Static factory method to create a polyhedron mesh static PolyhedronMesh* create(PolygonVertexArray* polygonVertexArray, MemoryAllocator& polyhedronMeshAllocator, MemoryAllocator& dataAllocator); @@ -92,16 +92,16 @@ class PolyhedronMesh { ~PolyhedronMesh(); /// Return the number of vertices - uint getNbVertices() const; + uint32 getNbVertices() const; /// Return a vertex - Vector3 getVertex(uint index) const; + Vector3 getVertex(uint32 index) const; /// Return the number of faces - uint getNbFaces() const; + uint32 getNbFaces() const; /// Return a face normal - Vector3 getFaceNormal(uint faceIndex) const; + Vector3 getFaceNormal(uint32 faceIndex) const; /// Return the half-edge structure of the mesh const HalfEdgeStructure& getHalfEdgeStructure() const; @@ -121,7 +121,7 @@ class PolyhedronMesh { /** * @return The number of vertices in the mesh */ -RP3D_FORCE_INLINE uint PolyhedronMesh::getNbVertices() const { +RP3D_FORCE_INLINE uint32 PolyhedronMesh::getNbVertices() const { return mHalfEdgeStructure.getNbVertices(); } @@ -129,7 +129,7 @@ RP3D_FORCE_INLINE uint PolyhedronMesh::getNbVertices() const { /** * @return The number of faces in the mesh */ -RP3D_FORCE_INLINE uint PolyhedronMesh::getNbFaces() const { +RP3D_FORCE_INLINE uint32 PolyhedronMesh::getNbFaces() const { return mHalfEdgeStructure.getNbFaces(); } @@ -138,7 +138,7 @@ RP3D_FORCE_INLINE uint PolyhedronMesh::getNbFaces() const { * @param faceIndex The index of a given face of the mesh * @return The normal vector of a given face of the mesh */ -RP3D_FORCE_INLINE Vector3 PolyhedronMesh::getFaceNormal(uint faceIndex) const { +RP3D_FORCE_INLINE Vector3 PolyhedronMesh::getFaceNormal(uint32 faceIndex) const { assert(faceIndex < mHalfEdgeStructure.getNbFaces()); return mFacesNormals[faceIndex]; } diff --git a/include/reactphysics3d/collision/TriangleMesh.h b/include/reactphysics3d/collision/TriangleMesh.h index 2088a312..2891e8d4 100644 --- a/include/reactphysics3d/collision/TriangleMesh.h +++ b/include/reactphysics3d/collision/TriangleMesh.h @@ -63,10 +63,10 @@ class TriangleMesh { void addSubpart(TriangleVertexArray* triangleVertexArray); /// Return a pointer to a given subpart (triangle vertex array) of the mesh - TriangleVertexArray* getSubpart(uint indexSubpart) const; + TriangleVertexArray* getSubpart(uint32 indexSubpart) const; /// Return the number of subparts of the mesh - uint getNbSubparts() const; + uint32 getNbSubparts() const; // ---------- Friendship ---------- // diff --git a/include/reactphysics3d/collision/TriangleVertexArray.h b/include/reactphysics3d/collision/TriangleVertexArray.h index f68c8e22..27e969f1 100644 --- a/include/reactphysics3d/collision/TriangleVertexArray.h +++ b/include/reactphysics3d/collision/TriangleVertexArray.h @@ -62,30 +62,30 @@ class TriangleVertexArray { // -------------------- Attributes -------------------- // /// Number of vertices in the array - uint mNbVertices; + uint32 mNbVertices; /// Pointer to the first vertex value in the array const uchar* mVerticesStart; /// Stride (number of bytes) between the beginning of two vertices /// values in the array - uint mVerticesStride; + uint32 mVerticesStride; /// Pointer to the first vertex normal value in the array const uchar* mVerticesNormalsStart; /// Stride (number of bytes) between the beginning of two vertex normals /// values in the array - uint mVerticesNormalsStride; + uint32 mVerticesNormalsStride; /// Number of triangles in the array - uint mNbTriangles; + uint32 mNbTriangles; /// Pointer to the first vertex index of the array const uchar* mIndicesStart; /// Stride (number of bytes) between the beginning of the three indices of two triangles - uint mIndicesStride; + uint32 mIndicesStride; /// Data type of the vertices in the array VertexDataType mVertexDataType; @@ -109,14 +109,14 @@ class TriangleVertexArray { // -------------------- Methods -------------------- // /// Constructor without vertices normals - TriangleVertexArray(uint nbVertices, const void* verticesStart, uint verticesStride, - uint nbTriangles, const void* indexesStart, uint indexesStride, + TriangleVertexArray(uint32 nbVertices, const void* verticesStart, uint32 verticesStride, + uint32 nbTriangles, const void* indexesStart, uint32 indexesStride, VertexDataType vertexDataType, IndexDataType indexDataType); /// Constructor with vertices normals - TriangleVertexArray(uint nbVertices, const void* verticesStart, uint verticesStride, - const void* verticesNormalsStart, uint uverticesNormalsStride, - uint nbTriangles, const void* indexesStart, uint indexesStride, + TriangleVertexArray(uint32 nbVertices, const void* verticesStart, uint32 verticesStride, + const void* verticesNormalsStart, uint32 uverticesNormalsStride, + uint32 nbTriangles, const void* indexesStart, uint32 indexesStride, VertexDataType vertexDataType, NormalDataType normalDataType, IndexDataType indexDataType); @@ -139,19 +139,19 @@ class TriangleVertexArray { IndexDataType getIndexDataType() const; /// Return the number of vertices - uint getNbVertices() const; + uint32 getNbVertices() const; /// Return the number of triangles - uint getNbTriangles() const; + uint32 getNbTriangles() const; /// Return the vertices stride (number of bytes) - uint getVerticesStride() const; + uint32 getVerticesStride() const; /// Return the vertex normals stride (number of bytes) - uint getVerticesNormalsStride() const; + uint32 getVerticesNormalsStride() const; /// Return the indices stride (number of bytes) - uint getIndicesStride() const; + uint32 getIndicesStride() const; /// Return the pointer to the start of the vertices array const void* getVerticesStart() const; @@ -163,19 +163,19 @@ class TriangleVertexArray { const void* getIndicesStart() const; /// Return the vertices coordinates of a triangle - void getTriangleVertices(uint triangleIndex, Vector3* outTriangleVertices) const; + void getTriangleVertices(uint32 triangleIndex, Vector3* outTriangleVertices) const; /// Return the three vertices normals of a triangle - void getTriangleVerticesNormals(uint triangleIndex, Vector3* outTriangleVerticesNormals) const; + void getTriangleVerticesNormals(uint32 triangleIndex, Vector3* outTriangleVerticesNormals) const; /// Return the indices of the three vertices of a given triangle in the array - void getTriangleVerticesIndices(uint triangleIndex, uint* outVerticesIndices) const; + void getTriangleVerticesIndices(uint32 triangleIndex, uint32* outVerticesIndices) const; /// Return a vertex of the array - void getVertex(uint vertexIndex, Vector3* outVertex); + void getVertex(uint32 vertexIndex, Vector3* outVertex); /// Return a vertex normal of the array - void getNormal(uint vertexIndex, Vector3* outNormal); + void getNormal(uint32 vertexIndex, Vector3* outNormal); }; // Return the vertex data type @@ -206,7 +206,7 @@ RP3D_FORCE_INLINE TriangleVertexArray::IndexDataType TriangleVertexArray::getInd /** * @return The number of vertices in the array */ -RP3D_FORCE_INLINE uint TriangleVertexArray::getNbVertices() const { +RP3D_FORCE_INLINE uint32 TriangleVertexArray::getNbVertices() const { return mNbVertices; } @@ -214,7 +214,7 @@ RP3D_FORCE_INLINE uint TriangleVertexArray::getNbVertices() const { /** * @return The number of triangles in the array */ -RP3D_FORCE_INLINE uint TriangleVertexArray::getNbTriangles() const { +RP3D_FORCE_INLINE uint32 TriangleVertexArray::getNbTriangles() const { return mNbTriangles; } @@ -222,7 +222,7 @@ RP3D_FORCE_INLINE uint TriangleVertexArray::getNbTriangles() const { /** * @return The number of bytes separating two consecutive vertices in the array */ -RP3D_FORCE_INLINE uint TriangleVertexArray::getVerticesStride() const { +RP3D_FORCE_INLINE uint32 TriangleVertexArray::getVerticesStride() const { return mVerticesStride; } @@ -230,7 +230,7 @@ RP3D_FORCE_INLINE uint TriangleVertexArray::getVerticesStride() const { /** * @return The number of bytes separating two consecutive normals in the array */ -RP3D_FORCE_INLINE uint TriangleVertexArray::getVerticesNormalsStride() const { +RP3D_FORCE_INLINE uint32 TriangleVertexArray::getVerticesNormalsStride() const { return mVerticesNormalsStride; } @@ -238,7 +238,7 @@ RP3D_FORCE_INLINE uint TriangleVertexArray::getVerticesNormalsStride() const { /** * @return The number of bytes separating two consecutive face indices in the array */ -RP3D_FORCE_INLINE uint TriangleVertexArray::getIndicesStride() const { +RP3D_FORCE_INLINE uint32 TriangleVertexArray::getIndicesStride() const { return mIndicesStride; } diff --git a/include/reactphysics3d/collision/narrowphase/CapsuleVsCapsuleAlgorithm.h b/include/reactphysics3d/collision/narrowphase/CapsuleVsCapsuleAlgorithm.h index f065235c..0746e7d1 100644 --- a/include/reactphysics3d/collision/narrowphase/CapsuleVsCapsuleAlgorithm.h +++ b/include/reactphysics3d/collision/narrowphase/CapsuleVsCapsuleAlgorithm.h @@ -66,8 +66,8 @@ class CapsuleVsCapsuleAlgorithm : public NarrowPhaseAlgorithm { CapsuleVsCapsuleAlgorithm& operator=(const CapsuleVsCapsuleAlgorithm& algorithm) = delete; /// Compute the narrow-phase collision detection between two capsules - bool testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint batchStartIndex, - uint batchNbItems, MemoryAllocator& memoryAllocator); + bool testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint32 batchStartIndex, + uint32 batchNbItems, MemoryAllocator& memoryAllocator); }; } diff --git a/include/reactphysics3d/collision/narrowphase/CapsuleVsConvexPolyhedronAlgorithm.h b/include/reactphysics3d/collision/narrowphase/CapsuleVsConvexPolyhedronAlgorithm.h index f72e7db2..f97cb660 100644 --- a/include/reactphysics3d/collision/narrowphase/CapsuleVsConvexPolyhedronAlgorithm.h +++ b/include/reactphysics3d/collision/narrowphase/CapsuleVsConvexPolyhedronAlgorithm.h @@ -70,8 +70,8 @@ class CapsuleVsConvexPolyhedronAlgorithm : public NarrowPhaseAlgorithm { CapsuleVsConvexPolyhedronAlgorithm& operator=(const CapsuleVsConvexPolyhedronAlgorithm& algorithm) = delete; /// Compute the narrow-phase collision detection between a capsule and a polyhedron - bool testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint batchStartIndex, - uint batchNbItems, bool clipWithPreviousAxisIfStillColliding, + bool testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint32 batchStartIndex, + uint32 batchNbItems, bool clipWithPreviousAxisIfStillColliding, MemoryAllocator& memoryAllocator); }; diff --git a/include/reactphysics3d/collision/narrowphase/ConvexPolyhedronVsConvexPolyhedronAlgorithm.h b/include/reactphysics3d/collision/narrowphase/ConvexPolyhedronVsConvexPolyhedronAlgorithm.h index 2b6525e7..64406b04 100644 --- a/include/reactphysics3d/collision/narrowphase/ConvexPolyhedronVsConvexPolyhedronAlgorithm.h +++ b/include/reactphysics3d/collision/narrowphase/ConvexPolyhedronVsConvexPolyhedronAlgorithm.h @@ -65,7 +65,7 @@ class ConvexPolyhedronVsConvexPolyhedronAlgorithm : public NarrowPhaseAlgorithm ConvexPolyhedronVsConvexPolyhedronAlgorithm& operator=(const ConvexPolyhedronVsConvexPolyhedronAlgorithm& algorithm) = delete; /// Compute the narrow-phase collision detection between two convex polyhedra - bool testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint batchStartIndex, uint batchNbItems, + bool testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint32 batchStartIndex, uint32 batchNbItems, bool clipWithPreviousAxisIfStillColliding, MemoryAllocator& memoryAllocator); }; diff --git a/include/reactphysics3d/collision/narrowphase/GJK/GJKAlgorithm.h b/include/reactphysics3d/collision/narrowphase/GJK/GJKAlgorithm.h index 2383be1f..3916d54e 100644 --- a/include/reactphysics3d/collision/narrowphase/GJK/GJKAlgorithm.h +++ b/include/reactphysics3d/collision/narrowphase/GJK/GJKAlgorithm.h @@ -97,8 +97,8 @@ class GJKAlgorithm { GJKAlgorithm& operator=(const GJKAlgorithm& algorithm) = delete; /// Compute a contact info if the two bounding volumes collide. - void testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint batchStartIndex, - uint batchNbItems, Array& gjkResults); + void testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint32 batchStartIndex, + uint32 batchNbItems, Array& gjkResults); #ifdef IS_RP3D_PROFILING_ENABLED diff --git a/include/reactphysics3d/collision/narrowphase/SphereVsCapsuleAlgorithm.h b/include/reactphysics3d/collision/narrowphase/SphereVsCapsuleAlgorithm.h index 49d27a4f..fd6acf35 100644 --- a/include/reactphysics3d/collision/narrowphase/SphereVsCapsuleAlgorithm.h +++ b/include/reactphysics3d/collision/narrowphase/SphereVsCapsuleAlgorithm.h @@ -65,8 +65,8 @@ class SphereVsCapsuleAlgorithm : public NarrowPhaseAlgorithm { SphereVsCapsuleAlgorithm& operator=(const SphereVsCapsuleAlgorithm& algorithm) = delete; /// Compute the narrow-phase collision detection between a sphere and a capsule - bool testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint batchStartIndex, - uint batchNbItems, MemoryAllocator& memoryAllocator); + bool testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint32 batchStartIndex, + uint32 batchNbItems, MemoryAllocator& memoryAllocator); }; } diff --git a/include/reactphysics3d/collision/narrowphase/SphereVsConvexPolyhedronAlgorithm.h b/include/reactphysics3d/collision/narrowphase/SphereVsConvexPolyhedronAlgorithm.h index 41a9a87e..e2eeb089 100644 --- a/include/reactphysics3d/collision/narrowphase/SphereVsConvexPolyhedronAlgorithm.h +++ b/include/reactphysics3d/collision/narrowphase/SphereVsConvexPolyhedronAlgorithm.h @@ -71,7 +71,7 @@ class SphereVsConvexPolyhedronAlgorithm : public NarrowPhaseAlgorithm { SphereVsConvexPolyhedronAlgorithm& operator=(const SphereVsConvexPolyhedronAlgorithm& algorithm) = delete; /// Compute the narrow-phase collision detection between a sphere and a convex polyhedron - bool testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint batchStartIndex, uint batchNbItems, + bool testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint32 batchStartIndex, uint32 batchNbItems, bool clipWithPreviousAxisIfStillColliding, MemoryAllocator& memoryAllocator); }; diff --git a/include/reactphysics3d/collision/shapes/BoxShape.h b/include/reactphysics3d/collision/shapes/BoxShape.h index 4670ac54..c92967b4 100644 --- a/include/reactphysics3d/collision/shapes/BoxShape.h +++ b/include/reactphysics3d/collision/shapes/BoxShape.h @@ -103,28 +103,28 @@ class BoxShape : public ConvexPolyhedronShape { virtual decimal getVolume() const override; /// Return the number of faces of the polyhedron - virtual uint getNbFaces() const override; + virtual uint32 getNbFaces() const override; /// Return a given face of the polyhedron - virtual const HalfEdgeStructure::Face& getFace(uint faceIndex) const override; + virtual const HalfEdgeStructure::Face& getFace(uint32 faceIndex) const override; /// Return the number of vertices of the polyhedron - virtual uint getNbVertices() const override; + virtual uint32 getNbVertices() const override; /// Return a given vertex of the polyhedron - virtual HalfEdgeStructure::Vertex getVertex(uint vertexIndex) const override; + virtual HalfEdgeStructure::Vertex getVertex(uint32 vertexIndex) const override; /// Return the number of half-edges of the polyhedron - virtual uint getNbHalfEdges() const override; + virtual uint32 getNbHalfEdges() const override; /// Return a given half-edge of the polyhedron - virtual const HalfEdgeStructure::Edge& getHalfEdge(uint edgeIndex) const override; + virtual const HalfEdgeStructure::Edge& getHalfEdge(uint32 edgeIndex) const override; /// Return the position of a given vertex - virtual Vector3 getVertexPosition(uint vertexIndex) const override; + virtual Vector3 getVertexPosition(uint32 vertexIndex) const override; /// Return the normal vector of a given face of the polyhedron - virtual Vector3 getFaceNormal(uint faceIndex) const override; + virtual Vector3 getFaceNormal(uint32 faceIndex) const override; /// Return the centroid of the polyhedron virtual Vector3 getCentroid() const override; @@ -193,17 +193,17 @@ RP3D_FORCE_INLINE bool BoxShape::testPointInside(const Vector3& localPoint, Coll } // Return the number of faces of the polyhedron -RP3D_FORCE_INLINE uint BoxShape::getNbFaces() const { +RP3D_FORCE_INLINE uint32 BoxShape::getNbFaces() const { return 6; } // Return the number of vertices of the polyhedron -RP3D_FORCE_INLINE uint BoxShape::getNbVertices() const { +RP3D_FORCE_INLINE uint32 BoxShape::getNbVertices() const { return 8; } // Return the position of a given vertex -RP3D_FORCE_INLINE Vector3 BoxShape::getVertexPosition(uint vertexIndex) const { +RP3D_FORCE_INLINE Vector3 BoxShape::getVertexPosition(uint32 vertexIndex) const { assert(vertexIndex < getNbVertices()); switch(vertexIndex) { @@ -222,7 +222,7 @@ RP3D_FORCE_INLINE Vector3 BoxShape::getVertexPosition(uint vertexIndex) const { } // Return the normal vector of a given face of the polyhedron -RP3D_FORCE_INLINE Vector3 BoxShape::getFaceNormal(uint faceIndex) const { +RP3D_FORCE_INLINE Vector3 BoxShape::getFaceNormal(uint32 faceIndex) const { assert(faceIndex < getNbFaces()); switch(faceIndex) { @@ -254,7 +254,7 @@ RP3D_FORCE_INLINE std::string BoxShape::to_string() const { } // Return the number of half-edges of the polyhedron -RP3D_FORCE_INLINE uint BoxShape::getNbHalfEdges() const { +RP3D_FORCE_INLINE uint32 BoxShape::getNbHalfEdges() const { return 24; } diff --git a/include/reactphysics3d/collision/shapes/ConvexPolyhedronShape.h b/include/reactphysics3d/collision/shapes/ConvexPolyhedronShape.h index 68dce6be..a0eb8395 100644 --- a/include/reactphysics3d/collision/shapes/ConvexPolyhedronShape.h +++ b/include/reactphysics3d/collision/shapes/ConvexPolyhedronShape.h @@ -59,28 +59,28 @@ class ConvexPolyhedronShape : public ConvexShape { ConvexPolyhedronShape& operator=(const ConvexPolyhedronShape& shape) = delete; /// Return the number of faces of the polyhedron - virtual uint getNbFaces() const=0; + virtual uint32 getNbFaces() const=0; /// Return a given face of the polyhedron - virtual const HalfEdgeStructure::Face& getFace(uint faceIndex) const=0; + virtual const HalfEdgeStructure::Face& getFace(uint32 faceIndex) const=0; /// Return the number of vertices of the polyhedron - virtual uint getNbVertices() const=0; + virtual uint32 getNbVertices() const=0; /// Return a given vertex of the polyhedron - virtual HalfEdgeStructure::Vertex getVertex(uint vertexIndex) const=0; + virtual HalfEdgeStructure::Vertex getVertex(uint32 vertexIndex) const=0; /// Return the position of a given vertex - virtual Vector3 getVertexPosition(uint vertexIndex) const=0; + virtual Vector3 getVertexPosition(uint32 vertexIndex) const=0; /// Return the normal vector of a given face of the polyhedron - virtual Vector3 getFaceNormal(uint faceIndex) const=0; + virtual Vector3 getFaceNormal(uint32 faceIndex) const=0; /// Return the number of half-edges of the polyhedron - virtual uint getNbHalfEdges() const=0; + virtual uint32 getNbHalfEdges() const=0; /// Return a given half-edge of the polyhedron - virtual const HalfEdgeStructure::Edge& getHalfEdge(uint edgeIndex) const=0; + virtual const HalfEdgeStructure::Edge& getHalfEdge(uint32 edgeIndex) const=0; /// Return true if the collision shape is a polyhedron virtual bool isPolyhedron() const override; @@ -90,7 +90,7 @@ class ConvexPolyhedronShape : public ConvexShape { /// Find and return the index of the polyhedron face with the most anti-parallel face /// normal given a direction vector - uint findMostAntiParallelFace(const Vector3& direction) const; + uint32 findMostAntiParallelFace(const Vector3& direction) const; }; // Return true if the collision shape is a polyhedron @@ -102,10 +102,10 @@ RP3D_FORCE_INLINE bool ConvexPolyhedronShape::isPolyhedron() const { // Find and return the index of the polyhedron face with the most anti-parallel face // normal given a direction vector. This is used to find the incident face on // a polyhedron of a given reference face of another polyhedron -RP3D_FORCE_INLINE uint ConvexPolyhedronShape::findMostAntiParallelFace(const Vector3& direction) const { +RP3D_FORCE_INLINE uint32 ConvexPolyhedronShape::findMostAntiParallelFace(const Vector3& direction) const { decimal minDotProduct = DECIMAL_LARGEST; - uint mostAntiParallelFace = 0; + uint32 mostAntiParallelFace = 0; // For each face of the polyhedron const uint32 nbFaces = getNbFaces(); diff --git a/include/reactphysics3d/engine/Island.h b/include/reactphysics3d/engine/Island.h index dae4ae51..8bb77607 100644 --- a/include/reactphysics3d/engine/Island.h +++ b/include/reactphysics3d/engine/Island.h @@ -54,17 +54,17 @@ class Island { ContactManifold** mContactManifolds; /// Current number of bodies in the island - uint mNbBodies; + uint32 mNbBodies; /// Current number of contact manifold in the island - uint mNbContactManifolds; + uint32 mNbContactManifolds; public: // -------------------- Methods -------------------- // /// Constructor - Island(uint nbMaxBodies, uint nbMaxContactManifolds, MemoryManager& memoryManager); + Island(uint32 nbMaxBodies, uint32 nbMaxContactManifolds, MemoryManager& memoryManager); /// Destructor ~Island(); diff --git a/src/body/RigidBody.cpp b/src/body/RigidBody.cpp index 41031491..770d5cdc 100644 --- a/src/body/RigidBody.cpp +++ b/src/body/RigidBody.cpp @@ -386,7 +386,7 @@ Vector3 RigidBody::computeCenterOfMass() const { const Array& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); for (uint32 i=0; i < colliderEntities.size(); i++) { - const uint colliderIndex = mWorld.mCollidersComponents.getEntityIndex(colliderEntities[i]); + const uint32 colliderIndex = mWorld.mCollidersComponents.getEntityIndex(colliderEntities[i]); const decimal colliderVolume = mWorld.mCollidersComponents.mCollisionShapes[colliderIndex]->getVolume(); const decimal colliderMassDensity = mWorld.mCollidersComponents.mMaterials[colliderIndex].getMassDensity(); @@ -418,7 +418,7 @@ void RigidBody::computeMassAndInertiaTensorLocal(Vector3& inertiaTensorLocal, de const Array& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); for (uint32 i=0; i < colliderEntities.size(); i++) { - const uint colliderIndex = mWorld.mCollidersComponents.getEntityIndex(colliderEntities[i]); + const uint32 colliderIndex = mWorld.mCollidersComponents.getEntityIndex(colliderEntities[i]); const decimal colliderVolume = mWorld.mCollidersComponents.mCollisionShapes[colliderIndex]->getVolume(); const decimal colliderMassDensity = mWorld.mCollidersComponents.mMaterials[colliderIndex].getMassDensity(); @@ -498,7 +498,7 @@ void RigidBody::updateMassFromColliders() { const Array& colliderEntities = mWorld.mCollisionBodyComponents.getColliders(mEntity); for (uint32 i=0; i < colliderEntities.size(); i++) { - const uint colliderIndex = mWorld.mCollidersComponents.getEntityIndex(colliderEntities[i]); + const uint32 colliderIndex = mWorld.mCollidersComponents.getEntityIndex(colliderEntities[i]); const decimal colliderVolume = mWorld.mCollidersComponents.mCollisionShapes[colliderIndex]->getVolume(); const decimal colliderMassDensity = mWorld.mCollidersComponents.mMaterials[colliderIndex].getMassDensity(); diff --git a/src/collision/CollisionCallback.cpp b/src/collision/CollisionCallback.cpp index eb792ab5..27812dee 100644 --- a/src/collision/CollisionCallback.cpp +++ b/src/collision/CollisionCallback.cpp @@ -106,7 +106,7 @@ CollisionCallback::CallbackData::CallbackData(Array /// Note that the returned ContactPoint object is only valid during the call of the CollisionCallback::onContact() /// method. Therefore, you need to get contact data from it and make a copy. Do not make a copy of the ContactPoint /// object itself because it won't be valid after the CollisionCallback::onContact() call. -CollisionCallback::ContactPoint CollisionCallback::ContactPair::getContactPoint(uint index) const { +CollisionCallback::ContactPoint CollisionCallback::ContactPair::getContactPoint(uint32 index) const { assert(index < getNbContactPoints()); diff --git a/src/collision/ContactManifold.cpp b/src/collision/ContactManifold.cpp index 46f886de..ab805085 100644 --- a/src/collision/ContactManifold.cpp +++ b/src/collision/ContactManifold.cpp @@ -32,7 +32,7 @@ using namespace reactphysics3d; // Constructor ContactManifold::ContactManifold(Entity bodyEntity1, Entity bodyEntity2, Entity colliderEntity1, Entity colliderEntity2, - uint contactPointsIndex, uint8 nbContactPoints) + uint32 contactPointsIndex, uint8 nbContactPoints) :contactPointsIndex(contactPointsIndex), bodyEntity1(bodyEntity1), bodyEntity2(bodyEntity2), colliderEntity1(colliderEntity1), colliderEntity2(colliderEntity2), nbContactPoints(nbContactPoints), frictionImpulse1(0), frictionImpulse2(0), frictionTwistImpulse(0), isAlreadyInIsland(false) { diff --git a/src/collision/PolygonVertexArray.cpp b/src/collision/PolygonVertexArray.cpp index a6958b35..60edf886 100644 --- a/src/collision/PolygonVertexArray.cpp +++ b/src/collision/PolygonVertexArray.cpp @@ -43,9 +43,9 @@ using namespace reactphysics3d; * @param vertexDataType Data type of the vertices data * @param indexDataType Data type of the face indices data */ -PolygonVertexArray::PolygonVertexArray(uint nbVertices, const void* verticesStart, int verticesStride, - const void* indexesStart, int indexesStride, - uint nbFaces, PolygonFace* facesStart, +PolygonVertexArray::PolygonVertexArray(uint32 nbVertices, const void* verticesStart, uint32 verticesStride, + const void* indexesStart, uint32 indexesStride, + uint32 nbFaces, PolygonFace* facesStart, VertexDataType vertexDataType, IndexDataType indexDataType) { mNbVertices = nbVertices; mVerticesStart = reinterpret_cast(verticesStart); @@ -62,12 +62,12 @@ PolygonVertexArray::PolygonVertexArray(uint nbVertices, const void* verticesStar /** * @return The index of a vertex (in the array of vertices data) of a given vertex in a face */ -uint PolygonVertexArray::getVertexIndexInFace(uint faceIndex, uint noVertexInFace) const { +uint32 PolygonVertexArray::getVertexIndexInFace(uint32 faceIndex32, uint32 noVertexInFace) const { - assert(faceIndex < mNbFaces); + assert(faceIndex32 < mNbFaces); // Get the face - PolygonFace* face = getPolygonFace(faceIndex); + PolygonFace* face = getPolygonFace(faceIndex32); assert(noVertexInFace < face->nbVertices); diff --git a/src/collision/PolyhedronMesh.cpp b/src/collision/PolyhedronMesh.cpp index f48f0e46..da2e6ef1 100644 --- a/src/collision/PolyhedronMesh.cpp +++ b/src/collision/PolyhedronMesh.cpp @@ -51,7 +51,7 @@ PolyhedronMesh::~PolyhedronMesh() { if (mFacesNormals != nullptr) { - for (uint f=0; f < mHalfEdgeStructure.getNbFaces(); f++) { + for (uint32 f=0; f < mHalfEdgeStructure.getNbFaces(); f++) { mFacesNormals[f].~Vector3(); } @@ -89,22 +89,22 @@ PolyhedronMesh* PolyhedronMesh::create(PolygonVertexArray* polygonVertexArray, M bool PolyhedronMesh::createHalfEdgeStructure() { // For each vertex of the mesh - for (uint v=0; v < mPolygonVertexArray->getNbVertices(); v++) { + for (uint32 v=0; v < mPolygonVertexArray->getNbVertices(); v++) { mHalfEdgeStructure.addVertex(v); } uint32 nbEdges = 0; // For each polygon face of the mesh - for (uint f=0; f < mPolygonVertexArray->getNbFaces(); f++) { + for (uint32 f=0; f < mPolygonVertexArray->getNbFaces(); f++) { // Get the polygon face PolygonVertexArray::PolygonFace* face = mPolygonVertexArray->getPolygonFace(f); - Array faceVertices(mMemoryAllocator, face->nbVertices); + Array faceVertices(mMemoryAllocator, face->nbVertices); // For each vertex of the face - for (uint v=0; v < face->nbVertices; v++) { + for (uint32 v=0; v < face->nbVertices; v++) { faceVertices.add(mPolygonVertexArray->getVertexIndexInFace(f, v)); } @@ -143,15 +143,15 @@ bool PolyhedronMesh::createHalfEdgeStructure() { * @param index Index of a given vertex in the mesh * @return The coordinates of a given vertex in the mesh */ -Vector3 PolyhedronMesh::getVertex(uint index) const { +Vector3 PolyhedronMesh::getVertex(uint32 index) const { assert(index < getNbVertices()); // Get the vertex index in the array with all vertices - uint vertexIndex = mHalfEdgeStructure.getVertex(index).vertexPointIndex; + uint32 vertexIndex = mHalfEdgeStructure.getVertex(index).vertexPointIndex; PolygonVertexArray::VertexDataType vertexType = mPolygonVertexArray->getVertexDataType(); const unsigned char* verticesStart = mPolygonVertexArray->getVerticesStart(); - int vertexStride = mPolygonVertexArray->getVerticesStride(); + uint32 vertexStride = mPolygonVertexArray->getVerticesStride(); Vector3 vertex; if (vertexType == PolygonVertexArray::VertexDataType::VERTEX_FLOAT_TYPE) { @@ -178,7 +178,7 @@ void PolyhedronMesh::computeFacesNormals() { // For each face const uint32 nbFaces = mHalfEdgeStructure.getNbFaces(); - for (uint f=0; f < nbFaces; f++) { + for (uint32 f=0; f < nbFaces; f++) { const HalfEdgeStructure::Face& face = mHalfEdgeStructure.getFace(f); assert(face.faceVertices.size() >= 3); @@ -195,7 +195,7 @@ void PolyhedronMesh::computeCentroid() { mCentroid.setToZero(); - for (uint v=0; v < getNbVertices(); v++) { + for (uint32 v=0; v < getNbVertices(); v++) { mCentroid += getVertex(v); } @@ -203,7 +203,7 @@ void PolyhedronMesh::computeCentroid() { } // Compute and return the area of a face -decimal PolyhedronMesh::getFaceArea(uint faceIndex) const { +decimal PolyhedronMesh::getFaceArea(uint32 faceIndex) const { Vector3 sumCrossProducts(0, 0, 0); @@ -235,7 +235,7 @@ decimal PolyhedronMesh::getVolume() const { decimal sum = 0.0; // For each face of the polyhedron - for (uint f=0; f < getNbFaces(); f++) { + for (uint32 f=0; f < getNbFaces(); f++) { const HalfEdgeStructure::Face& face = mHalfEdgeStructure.getFace(f); const decimal faceArea = getFaceArea(f); diff --git a/src/collision/TriangleVertexArray.cpp b/src/collision/TriangleVertexArray.cpp index 62abd3cd..f287d602 100644 --- a/src/collision/TriangleVertexArray.cpp +++ b/src/collision/TriangleVertexArray.cpp @@ -48,8 +48,8 @@ using namespace reactphysics3d; * @param vertexDataType Type of data for the vertices (float, double) * @param indexDataType Type of data for the indices (short, int) */ -TriangleVertexArray::TriangleVertexArray(uint nbVertices, const void* verticesStart, uint verticesStride, - uint nbTriangles, const void* indexesStart, uint indexesStride, +TriangleVertexArray::TriangleVertexArray(uint32 nbVertices, const void* verticesStart, uint32 verticesStride, + uint32 nbTriangles, const void* indexesStart, uint32 indexesStride, VertexDataType vertexDataType, IndexDataType indexDataType) { mNbVertices = nbVertices; mVerticesStart = static_cast(verticesStart); @@ -85,9 +85,9 @@ TriangleVertexArray::TriangleVertexArray(uint nbVertices, const void* verticesSt * @param vertexDataType Type of data for the vertices (float, double) * @param indexDataType Type of data for the indices (short, int) */ -TriangleVertexArray::TriangleVertexArray(uint nbVertices, const void* verticesStart, uint verticesStride, - const void* verticesNormalsStart, uint verticesNormalsStride, - uint nbTriangles, const void* indexesStart, uint indexesStride, +TriangleVertexArray::TriangleVertexArray(uint32 nbVertices, const void* verticesStart, uint32 verticesStride, + const void* verticesNormalsStart, uint32 verticesNormalsStride, + uint32 nbTriangles, const void* indexesStart, uint32 indexesStride, VertexDataType vertexDataType, NormalDataType normalDataType, IndexDataType indexDataType) { @@ -130,15 +130,15 @@ void TriangleVertexArray::computeVerticesNormals() { float* verticesNormals = new float[mNbVertices * 3]; // Init vertices normals to zero - for (uint i=0; i(triangleIndicesPointer); // For each vertex of the triangle - for (int i=0; i < 3; i++) { + for (uint32 i=0; i < 3; i++) { // Get the index of the current vertex in the triangle if (mIndexDataType == TriangleVertexArray::IndexDataType::INDEX_INTEGER_TYPE) { @@ -226,16 +226,16 @@ void TriangleVertexArray::getTriangleVerticesIndices(uint triangleIndex, uint* o * @param triangleIndex Index of a given triangle in the array * @param[out] outTriangleVertices Pointer to the three output vertex coordinates */ -void TriangleVertexArray::getTriangleVertices(uint triangleIndex, Vector3* outTriangleVertices) const { +void TriangleVertexArray::getTriangleVertices(uint32 triangleIndex, Vector3* outTriangleVertices) const { assert(triangleIndex < mNbTriangles); // Get the three vertex index of the three vertices of the triangle - uint verticesIndices[3]; + uint32 verticesIndices[3]; getTriangleVerticesIndices(triangleIndex, verticesIndices); // For each vertex of the triangle - for (int k=0; k < 3; k++) { + for (uint32 k=0; k < 3; k++) { const uchar* vertexPointerChar = mVerticesStart + verticesIndices[k] * mVerticesStride; const void* vertexPointer = static_cast(vertexPointerChar); @@ -264,16 +264,16 @@ void TriangleVertexArray::getTriangleVertices(uint triangleIndex, Vector3* outTr * @param triangleIndex Index of a given triangle in the array * @param[out] outTriangleVerticesNormals Pointer to the three output vertex normals */ -void TriangleVertexArray::getTriangleVerticesNormals(uint triangleIndex, Vector3* outTriangleVerticesNormals) const { +void TriangleVertexArray::getTriangleVerticesNormals(uint32 triangleIndex, Vector3* outTriangleVerticesNormals) const { assert(triangleIndex < mNbTriangles); // Get the three vertex index of the three vertices of the triangle - uint verticesIndices[3]; + uint32 verticesIndices[3]; getTriangleVerticesIndices(triangleIndex, verticesIndices); // For each vertex of the triangle - for (int k=0; k < 3; k++) { + for (uint32 k=0; k < 3; k++) { const uchar* vertexNormalPointerChar = mVerticesNormalsStart + verticesIndices[k] * mVerticesNormalsStride; const void* vertexNormalPointer = static_cast(vertexNormalPointerChar); @@ -302,7 +302,7 @@ void TriangleVertexArray::getTriangleVerticesNormals(uint triangleIndex, Vector3 * @param vertexIndex Index of a given vertex of the array * @param[out] outVertex Pointer to the output vertex coordinates */ -void TriangleVertexArray::getVertex(uint vertexIndex, Vector3* outVertex) { +void TriangleVertexArray::getVertex(uint32 vertexIndex, Vector3* outVertex) { assert(vertexIndex < mNbVertices); @@ -332,7 +332,7 @@ void TriangleVertexArray::getVertex(uint vertexIndex, Vector3* outVertex) { * @param vertexIndex Index of a given vertex of the array * @param[out] outNormal Pointer to the output vertex normal */ -void TriangleVertexArray::getNormal(uint vertexIndex, Vector3* outNormal) { +void TriangleVertexArray::getNormal(uint32 vertexIndex, Vector3* outNormal) { assert(vertexIndex < mNbVertices); diff --git a/src/collision/broadphase/DynamicAABBTree.cpp b/src/collision/broadphase/DynamicAABBTree.cpp index ddcb3c7e..0c284d17 100644 --- a/src/collision/broadphase/DynamicAABBTree.cpp +++ b/src/collision/broadphase/DynamicAABBTree.cpp @@ -596,7 +596,7 @@ void DynamicAABBTree::reportAllShapesOverlappingWithShapes(const Array& n Stack stack(mAllocator, 64); // For each shape to be tested for overlap - for (uint i=startIndex; i < endIndex; i++) { + for (uint32 i=startIndex; i < endIndex; i++) { assert(nodesToTest[i] != -1); diff --git a/src/collision/narrowphase/CapsuleVsCapsuleAlgorithm.cpp b/src/collision/narrowphase/CapsuleVsCapsuleAlgorithm.cpp index 48f62069..b3fdd4cf 100755 --- a/src/collision/narrowphase/CapsuleVsCapsuleAlgorithm.cpp +++ b/src/collision/narrowphase/CapsuleVsCapsuleAlgorithm.cpp @@ -34,11 +34,11 @@ using namespace reactphysics3d; // Compute the narrow-phase collision detection between two capsules // This technique is based on the "Robust Contact Creation for Physics Simulations" presentation // by Dirk Gregorius. -bool CapsuleVsCapsuleAlgorithm::testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint batchStartIndex, uint batchNbItems, MemoryAllocator& /*memoryAllocator*/) { +bool CapsuleVsCapsuleAlgorithm::testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint32 batchStartIndex, uint32 batchNbItems, MemoryAllocator& /*memoryAllocator*/) { bool isCollisionFound = false; - for (uint batchIndex = batchStartIndex; batchIndex < batchStartIndex + batchNbItems; batchIndex++) { + for (uint32 batchIndex = batchStartIndex; batchIndex < batchStartIndex + batchNbItems; batchIndex++) { assert(narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].nbContactPoints == 0); diff --git a/src/collision/narrowphase/CapsuleVsConvexPolyhedronAlgorithm.cpp b/src/collision/narrowphase/CapsuleVsConvexPolyhedronAlgorithm.cpp index b09df90f..375df540 100644 --- a/src/collision/narrowphase/CapsuleVsConvexPolyhedronAlgorithm.cpp +++ b/src/collision/narrowphase/CapsuleVsConvexPolyhedronAlgorithm.cpp @@ -40,7 +40,7 @@ using namespace reactphysics3d; // This technique is based on the "Robust Contact Creation for Physics Simulations" presentation // by Dirk Gregorius. bool CapsuleVsConvexPolyhedronAlgorithm::testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, - uint batchStartIndex, uint batchNbItems, + uint32 batchStartIndex, uint32 batchNbItems, bool clipWithPreviousAxisIfStillColliding, MemoryAllocator& memoryAllocator) { @@ -63,7 +63,7 @@ bool CapsuleVsConvexPolyhedronAlgorithm::testCollision(NarrowPhaseInfoBatch& nar gjkAlgorithm.testCollision(narrowPhaseInfoBatch, batchStartIndex, batchNbItems, gjkResults); assert(gjkResults.size() == batchNbItems); - for (uint batchIndex = batchStartIndex; batchIndex < batchStartIndex + batchNbItems; batchIndex++) { + for (uint32 batchIndex = batchStartIndex; batchIndex < batchStartIndex + batchNbItems; batchIndex++) { // Get the last frame collision info LastFrameCollisionInfo* lastFrameCollisionInfo = narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].lastFrameCollisionInfo; @@ -99,7 +99,7 @@ bool CapsuleVsConvexPolyhedronAlgorithm::testCollision(NarrowPhaseInfoBatch& nar const ConvexPolyhedronShape* polyhedron = static_cast(isCapsuleShape1 ? narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].collisionShape2 : narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].collisionShape1); // For each face of the polyhedron - for (uint f = 0; f < polyhedron->getNbFaces(); f++) { + for (uint32 f = 0; f < polyhedron->getNbFaces(); f++) { const Transform polyhedronToWorld = isCapsuleShape1 ? narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].shape2ToWorldTransform : narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].shape1ToWorldTransform; const Transform capsuleToWorld = isCapsuleShape1 ? narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].shape1ToWorldTransform : narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].shape2ToWorldTransform; diff --git a/src/collision/narrowphase/ConvexPolyhedronVsConvexPolyhedronAlgorithm.cpp b/src/collision/narrowphase/ConvexPolyhedronVsConvexPolyhedronAlgorithm.cpp index 9630e975..f44347ea 100644 --- a/src/collision/narrowphase/ConvexPolyhedronVsConvexPolyhedronAlgorithm.cpp +++ b/src/collision/narrowphase/ConvexPolyhedronVsConvexPolyhedronAlgorithm.cpp @@ -36,7 +36,7 @@ using namespace reactphysics3d; // This technique is based on the "Robust Contact Creation for Physics Simulations" presentation // by Dirk Gregorius. bool ConvexPolyhedronVsConvexPolyhedronAlgorithm::testCollision(NarrowPhaseInfoBatch &narrowPhaseInfoBatch, - uint batchStartIndex, uint batchNbItems, + uint32 batchStartIndex, uint32 batchNbItems, bool clipWithPreviousAxisIfStillColliding, MemoryAllocator& memoryAllocator) { // Run the SAT algorithm to find the separating axis and compute contact point @@ -51,7 +51,7 @@ bool ConvexPolyhedronVsConvexPolyhedronAlgorithm::testCollision(NarrowPhaseInfoB bool isCollisionFound = satAlgorithm.testCollisionConvexPolyhedronVsConvexPolyhedron(narrowPhaseInfoBatch, batchStartIndex, batchNbItems); - for (uint batchIndex = batchStartIndex; batchIndex < batchStartIndex + batchNbItems; batchIndex++) { + for (uint32 batchIndex = batchStartIndex; batchIndex < batchStartIndex + batchNbItems; batchIndex++) { // Get the last frame collision info LastFrameCollisionInfo* lastFrameCollisionInfo = narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].lastFrameCollisionInfo; diff --git a/src/collision/narrowphase/GJK/GJKAlgorithm.cpp b/src/collision/narrowphase/GJK/GJKAlgorithm.cpp index d35fd6e0..f66f992f 100644 --- a/src/collision/narrowphase/GJK/GJKAlgorithm.cpp +++ b/src/collision/narrowphase/GJK/GJKAlgorithm.cpp @@ -47,13 +47,13 @@ using namespace reactphysics3d; /// algorithm on the enlarged object to obtain a simplex polytope that contains the /// origin, they we give that simplex polytope to the EPA algorithm which will compute /// the correct penetration depth and contact points between the enlarged objects. -void GJKAlgorithm::testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint batchStartIndex, - uint batchNbItems, Array& gjkResults) { +void GJKAlgorithm::testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint32 batchStartIndex, + uint32 batchNbItems, Array& gjkResults) { RP3D_PROFILE("GJKAlgorithm::testCollision()", mProfiler); // For each item in the batch - for (uint batchIndex = batchStartIndex; batchIndex < batchStartIndex + batchNbItems; batchIndex++) { + for (uint32 batchIndex = batchStartIndex; batchIndex < batchStartIndex + batchNbItems; batchIndex++) { Vector3 suppA; // Support point of object A Vector3 suppB; // Support point of object B diff --git a/src/collision/narrowphase/SphereVsCapsuleAlgorithm.cpp b/src/collision/narrowphase/SphereVsCapsuleAlgorithm.cpp index eb75057b..da976307 100755 --- a/src/collision/narrowphase/SphereVsCapsuleAlgorithm.cpp +++ b/src/collision/narrowphase/SphereVsCapsuleAlgorithm.cpp @@ -35,11 +35,11 @@ using namespace reactphysics3d; // Compute the narrow-phase collision detection between a sphere and a capsule // This technique is based on the "Robust Contact Creation for Physics Simulations" presentation // by Dirk Gregorius. -bool SphereVsCapsuleAlgorithm::testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint batchStartIndex, uint batchNbItems, MemoryAllocator& /*memoryAllocator*/) { +bool SphereVsCapsuleAlgorithm::testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint32 batchStartIndex, uint32 batchNbItems, MemoryAllocator& /*memoryAllocator*/) { bool isCollisionFound = false; - for (uint batchIndex = batchStartIndex; batchIndex < batchStartIndex + batchNbItems; batchIndex++) { + for (uint32 batchIndex = batchStartIndex; batchIndex < batchStartIndex + batchNbItems; batchIndex++) { assert(!narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].isColliding); assert(narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].nbContactPoints == 0); diff --git a/src/collision/narrowphase/SphereVsConvexPolyhedronAlgorithm.cpp b/src/collision/narrowphase/SphereVsConvexPolyhedronAlgorithm.cpp index 039aa9bb..4ac31424 100644 --- a/src/collision/narrowphase/SphereVsConvexPolyhedronAlgorithm.cpp +++ b/src/collision/narrowphase/SphereVsConvexPolyhedronAlgorithm.cpp @@ -35,7 +35,7 @@ using namespace reactphysics3d; // Compute the narrow-phase collision detection between a sphere and a convex polyhedron // This technique is based on the "Robust Contact Creation for Physics Simulations" presentation // by Dirk Gregorius. -bool SphereVsConvexPolyhedronAlgorithm::testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint batchStartIndex, uint batchNbItems, +bool SphereVsConvexPolyhedronAlgorithm::testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint32 batchStartIndex, uint32 batchNbItems, bool clipWithPreviousAxisIfStillColliding, MemoryAllocator& memoryAllocator) { // First, we run the GJK algorithm @@ -55,7 +55,7 @@ bool SphereVsConvexPolyhedronAlgorithm::testCollision(NarrowPhaseInfoBatch& narr assert(gjkResults.size() == batchNbItems); // For each item in the batch - for (uint batchIndex = batchStartIndex; batchIndex < batchStartIndex + batchNbItems; batchIndex++) { + for (uint32 batchIndex = batchStartIndex; batchIndex < batchStartIndex + batchNbItems; batchIndex++) { assert(narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].collisionShape1->getType() == CollisionShapeType::CONVEX_POLYHEDRON || narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].collisionShape2->getType() == CollisionShapeType::CONVEX_POLYHEDRON); diff --git a/src/collision/narrowphase/SphereVsSphereAlgorithm.cpp b/src/collision/narrowphase/SphereVsSphereAlgorithm.cpp index 4e9d4b22..87d1829d 100755 --- a/src/collision/narrowphase/SphereVsSphereAlgorithm.cpp +++ b/src/collision/narrowphase/SphereVsSphereAlgorithm.cpp @@ -31,12 +31,12 @@ // We want to use the ReactPhysics3D namespace using namespace reactphysics3d; -bool SphereVsSphereAlgorithm::testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint batchStartIndex, uint batchNbItems, MemoryAllocator& /*memoryAllocator*/) { +bool SphereVsSphereAlgorithm::testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint32 batchStartIndex, uint32 batchNbItems, MemoryAllocator& /*memoryAllocator*/) { bool isCollisionFound = false; // For each item in the batch - for (uint batchIndex = batchStartIndex; batchIndex < batchStartIndex + batchNbItems; batchIndex++) { + for (uint32 batchIndex = batchStartIndex; batchIndex < batchStartIndex + batchNbItems; batchIndex++) { assert(narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].nbContactPoints == 0); assert(!narrowPhaseInfoBatch.narrowPhaseInfos[batchIndex].isColliding); diff --git a/src/collision/shapes/BoxShape.cpp b/src/collision/shapes/BoxShape.cpp index 8db89812..65813ec7 100644 --- a/src/collision/shapes/BoxShape.cpp +++ b/src/collision/shapes/BoxShape.cpp @@ -124,19 +124,19 @@ bool BoxShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, Collider* colli } // Return a given face of the polyhedron -const HalfEdgeStructure::Face& BoxShape::getFace(uint faceIndex) const { +const HalfEdgeStructure::Face& BoxShape::getFace(uint32 faceIndex) const { assert(faceIndex < mPhysicsCommon.mBoxShapeHalfEdgeStructure.getNbFaces()); return mPhysicsCommon.mBoxShapeHalfEdgeStructure.getFace(faceIndex); } // Return a given vertex of the polyhedron -HalfEdgeStructure::Vertex BoxShape::getVertex(uint vertexIndex) const { +HalfEdgeStructure::Vertex BoxShape::getVertex(uint32 vertexIndex) const { assert(vertexIndex < getNbVertices()); return mPhysicsCommon.mBoxShapeHalfEdgeStructure.getVertex(vertexIndex); } // Return a given half-edge of the polyhedron -const HalfEdgeStructure::Edge& BoxShape::getHalfEdge(uint edgeIndex) const { +const HalfEdgeStructure::Edge& BoxShape::getHalfEdge(uint32 edgeIndex) const { assert(edgeIndex < getNbHalfEdges()); return mPhysicsCommon.mBoxShapeHalfEdgeStructure.getHalfEdge(edgeIndex); } diff --git a/src/collision/shapes/ConvexMeshShape.cpp b/src/collision/shapes/ConvexMeshShape.cpp index 95884208..9bc55e37 100644 --- a/src/collision/shapes/ConvexMeshShape.cpp +++ b/src/collision/shapes/ConvexMeshShape.cpp @@ -58,10 +58,10 @@ ConvexMeshShape::ConvexMeshShape(PolyhedronMesh* polyhedronMesh, MemoryAllocator Vector3 ConvexMeshShape::getLocalSupportPointWithoutMargin(const Vector3& direction) const { decimal maxDotProduct = DECIMAL_SMALLEST; - uint indexMaxDotProduct = 0; + uint32 indexMaxDotProduct = 0; // For each vertex of the mesh - for (uint i=0; igetNbVertices(); i++) { + for (uint32 i=0; igetNbVertices(); i++) { // Compute the dot product of the current vertex decimal dotProduct = direction.dot(mPolyhedronMesh->getVertex(i)); @@ -86,7 +86,7 @@ void ConvexMeshShape::recalculateBounds() { mMaxBounds = mPolyhedronMesh->getVertex(0); // For each vertex of the mesh - for (uint i=1; igetNbVertices(); i++) { + for (uint32 i=1; igetNbVertices(); i++) { if (mPolyhedronMesh->getVertex(i).x > mMaxBounds.x) mMaxBounds.x = mPolyhedronMesh->getVertex(i).x; if (mPolyhedronMesh->getVertex(i).x < mMinBounds.x) mMinBounds.x = mPolyhedronMesh->getVertex(i).x; @@ -119,7 +119,7 @@ bool ConvexMeshShape::raycast(const Ray& ray, RaycastInfo& raycastInfo, Collider const HalfEdgeStructure& halfEdgeStructure = mPolyhedronMesh->getHalfEdgeStructure(); // For each face of the convex mesh - for (uint f=0; f < mPolyhedronMesh->getNbFaces(); f++) { + for (uint32 f=0; f < mPolyhedronMesh->getNbFaces(); f++) { const HalfEdgeStructure::Face& face = halfEdgeStructure.getFace(f); const Vector3 faceNormal = mPolyhedronMesh->getFaceNormal(f); @@ -189,7 +189,7 @@ bool ConvexMeshShape::testPointInside(const Vector3& localPoint, Collider* /*col const HalfEdgeStructure& halfEdgeStructure = mPolyhedronMesh->getHalfEdgeStructure(); // For each face plane of the convex mesh - for (uint f=0; f < mPolyhedronMesh->getNbFaces(); f++) { + for (uint32 f=0; f < mPolyhedronMesh->getNbFaces(); f++) { const HalfEdgeStructure::Face& face = halfEdgeStructure.getFace(f); const Vector3 faceNormal = mPolyhedronMesh->getFaceNormal(f); @@ -213,7 +213,7 @@ std::string ConvexMeshShape::to_string() const { ss << "vertices=["; - for (uint v=0; v < mPolyhedronMesh->getNbVertices(); v++) { + for (uint32 v=0; v < mPolyhedronMesh->getNbVertices(); v++) { Vector3 vertex = mPolyhedronMesh->getVertex(v); ss << vertex.to_string(); @@ -225,7 +225,7 @@ std::string ConvexMeshShape::to_string() const { ss << "], faces=["; HalfEdgeStructure halfEdgeStruct = mPolyhedronMesh->getHalfEdgeStructure(); - for (uint f=0; f < mPolyhedronMesh->getNbFaces(); f++) { + for (uint32 f=0; f < mPolyhedronMesh->getNbFaces(); f++) { const HalfEdgeStructure::Face& face = halfEdgeStruct.getFace(f); diff --git a/src/components/Components.cpp b/src/components/Components.cpp index 7a528d4d..3e632ccd 100644 --- a/src/components/Components.cpp +++ b/src/components/Components.cpp @@ -102,7 +102,7 @@ void Components::removeComponent(Entity entity) { assert(mMapEntityToComponentIndex.containsKey(entity)); - uint index = mMapEntityToComponentIndex[entity]; + uint32 index = mMapEntityToComponentIndex[entity]; assert(index < mNbComponents); diff --git a/src/engine/Island.cpp b/src/engine/Island.cpp index 36bdc23d..95a6f049 100644 --- a/src/engine/Island.cpp +++ b/src/engine/Island.cpp @@ -30,7 +30,7 @@ using namespace reactphysics3d; // Constructor -Island::Island(uint nbMaxBodies, uint nbMaxContactManifolds, MemoryManager& memoryManager) +Island::Island(uint32 nbMaxBodies, uint32 nbMaxContactManifolds, MemoryManager& memoryManager) : mBodies(nullptr), mContactManifolds(nullptr), mNbBodies(0), mNbContactManifolds(0) { // Allocate memory for the arrays on the single frame allocator