switch hull indices to 32-bit indices

This commit is contained in:
Irlan
2018-07-19 13:05:14 -03:00
parent ad7c13005f
commit 261c5fc044
18 changed files with 137 additions and 167 deletions

View File

@@ -21,26 +21,17 @@
#include <bounce/common/geometry.h>
// The maximum number of vertices that a hull can have.
#define B3_MAX_HULL_VERTICES (B3_MAX_U8 + 1)
// The maximum number of half-edges a hull can have.
#define B3_MAX_HULL_EDGES (B3_MAX_U8 + 1)
// The maximum number of faces and planes a hull can have.
#define B3_MAX_HULL_FACES (B3_MAX_U8 + 1)
struct b3Face
{
u8 edge;
u32 edge;
};
struct b3HalfEdge
{
u8 origin;
u8 twin;
u8 face;
u8 next;
u32 origin;
u32 twin;
u32 face;
u32 next;
};
struct b3Hull

View File

@@ -1,10 +1,10 @@
inline b3HalfEdge b3MakeEdge(u32 origin, u32 twin, u32 face, u32 next)
{
b3HalfEdge edge;
edge.origin = u8(origin);
edge.twin = u8(twin);
edge.face = u8(face);
edge.next = u8(next);
edge.origin = origin;
edge.twin = twin;
edge.face = face;
edge.next = next;
return edge;
}

View File

@@ -20,25 +20,25 @@
#define B3_Q_HULL_H
#include <bounce/collision/shapes/hull.h>
#include <bounce/common/template/array.h>
// This hull can be constructed from an array of points.
struct b3QHull : public b3Hull
{
b3Vec3 hullVertices[B3_MAX_HULL_VERTICES];
b3HalfEdge hullEdges[B3_MAX_HULL_EDGES];
b3Face hullFaces[B3_MAX_HULL_FACES];
b3Plane hullPlanes[B3_MAX_HULL_FACES];
b3StackArray<b3Vec3, 256> hullVertices;
b3StackArray<b3HalfEdge, 256> hullEdges;
b3StackArray<b3Face, 256> hullFaces;
b3StackArray<b3Plane, 256> hullPlanes;
b3QHull()
{
// Zero the counters since the user manipulates via setters
vertices = hullVertices;
vertices = hullVertices.Begin();
vertexCount = 0;
edges = hullEdges;
edges = hullEdges.Begin();
edgeCount = 0;
faces = hullFaces;
faces = hullFaces.Begin();
faceCount = 0;
planes = hullPlanes;
planes = hullPlanes.Begin();
centroid.SetZero();
}