Replace some uint declarations to uint32

This commit is contained in:
Daniel Chappuis 2021-08-25 20:48:05 +02:00
parent b2b72036ac
commit f65cc68915
34 changed files with 190 additions and 190 deletions

View File

@ -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;
}

View File

@ -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 -------------------- //

View File

@ -41,26 +41,26 @@ class HalfEdgeStructure {
public:
using VerticesPair = Pair<uint, uint>;
using VerticesPair = Pair<uint32, uint32>;
/// 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<uint> faceVertices; // Index of the vertices of the face
uint32 edgeIndex; // Index of an half-edge of the face
Array<uint32> faceVertices; // Index of the vertices of the face
/// Constructor
Face(MemoryAllocator& allocator) : faceVertices(allocator) {}
/// Constructor
Face(Array<uint> vertices) : faceVertices(vertices) {}
Face(Array<uint32> 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<uint> faceVertices);
void addFace(Array<uint32> 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<uint> faceVertices) {
RP3D_FORCE_INLINE void HalfEdgeStructure::addFace(Array<uint32> faceVertices) {
// Create a new face
Face face(faceVertices);

View File

@ -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];
}

View File

@ -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];
}

View File

@ -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 ---------- //

View File

@ -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;
}

View File

@ -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);
};
}

View File

@ -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);
};

View File

@ -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);
};

View File

@ -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<GJKResult>& gjkResults);
void testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint32 batchStartIndex,
uint32 batchNbItems, Array<GJKResult>& gjkResults);
#ifdef IS_RP3D_PROFILING_ENABLED

View File

@ -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);
};
}

View File

@ -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);
};

View File

@ -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;
}

View File

@ -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();

View File

@ -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();

View File

@ -386,7 +386,7 @@ Vector3 RigidBody::computeCenterOfMass() const {
const Array<Entity>& 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<Entity>& 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<Entity>& 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();

View File

@ -106,7 +106,7 @@ CollisionCallback::CallbackData::CallbackData(Array<reactphysics3d::ContactPair>
/// 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());

View File

@ -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) {

View File

@ -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<const unsigned char*>(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);

View File

@ -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<uint> faceVertices(mMemoryAllocator, face->nbVertices);
Array<uint32> 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);

View File

@ -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<const uchar*>(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<mNbVertices * 3; i++) {
for (uint32 i=0; i<mNbVertices * 3; i++) {
verticesNormals[i] = 0.0f;
}
// For each triangle face in the array
for (uint f=0; f < mNbTriangles; f++) {
for (uint32 f=0; f < mNbTriangles; f++) {
// Get the indices of the three vertices of the triangle in the array
uint verticesIndices[3];
uint32 verticesIndices[3];
getTriangleVerticesIndices(f, verticesIndices);
// Get the triangle vertices
@ -152,10 +152,10 @@ void TriangleVertexArray::computeVerticesNormals() {
edgesLengths[2] = (triangleVertices[0] - triangleVertices[2]).length();
// For each vertex of the face
for (uint v=0; v < 3; v++) {
for (uint32 v=0; v < 3; v++) {
uint previousVertex = (v == 0) ? 2 : v-1;
uint nextVertex = (v == 2) ? 0 : v+1;
uint32 previousVertex = (v == 0) ? 2 : v-1;
uint32 nextVertex = (v == 2) ? 0 : v+1;
Vector3 a = triangleVertices[nextVertex] - triangleVertices[v];
Vector3 b = triangleVertices[previousVertex] - triangleVertices[v];
@ -178,7 +178,7 @@ void TriangleVertexArray::computeVerticesNormals() {
}
// Normalize the computed vertices normals
for (uint v=0; v<mNbVertices * 3; v += 3) {
for (uint32 v=0; v<mNbVertices * 3; v += 3) {
// Normalize the normal
Vector3 normal(verticesNormals[v], verticesNormals[v + 1], verticesNormals[v + 2]);
@ -198,7 +198,7 @@ void TriangleVertexArray::computeVerticesNormals() {
* @param triangleIndex Index of a given triangle in the array
* @param[out] outVerticesIndices Pointer to the three output vertex indices
*/
void TriangleVertexArray::getTriangleVerticesIndices(uint triangleIndex, uint* outVerticesIndices) const {
void TriangleVertexArray::getTriangleVerticesIndices(uint32 triangleIndex, uint32 *outVerticesIndices) const {
assert(triangleIndex < mNbTriangles);
@ -206,7 +206,7 @@ void TriangleVertexArray::getTriangleVerticesIndices(uint triangleIndex, uint* o
const void* startTriangleIndices = static_cast<const void*>(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<const void*>(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<const void*>(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);

View File

@ -596,7 +596,7 @@ void DynamicAABBTree::reportAllShapesOverlappingWithShapes(const Array<int32>& n
Stack<int32> 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);

View File

@ -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);

View File

@ -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<const ConvexPolyhedronShape*>(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;

View File

@ -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;

View File

@ -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<GJKResult>& gjkResults) {
void GJKAlgorithm::testCollision(NarrowPhaseInfoBatch& narrowPhaseInfoBatch, uint32 batchStartIndex,
uint32 batchNbItems, Array<GJKResult>& 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

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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; i<mPolyhedronMesh->getNbVertices(); i++) {
for (uint32 i=0; i<mPolyhedronMesh->getNbVertices(); 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; i<mPolyhedronMesh->getNbVertices(); i++) {
for (uint32 i=1; i<mPolyhedronMesh->getNbVertices(); 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);

View File

@ -102,7 +102,7 @@ void Components::removeComponent(Entity entity) {
assert(mMapEntityToComponentIndex.containsKey(entity));
uint index = mMapEntityToComponentIndex[entity];
uint32 index = mMapEntityToComponentIndex[entity];
assert(index < mNbComponents);

View File

@ -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