From ece8cea0c70cadd8e926aa225942e34b3ef6a493 Mon Sep 17 00:00:00 2001 From: Irlan <-> Date: Fri, 20 Apr 2018 19:23:36 -0300 Subject: [PATCH] move qhull limits inside base class --- include/bounce/collision/shapes/hull.h | 9 +++++++++ include/bounce/collision/shapes/qhull.h | 12 ++---------- include/bounce/common/settings.h | 1 + 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/include/bounce/collision/shapes/hull.h b/include/bounce/collision/shapes/hull.h index 2b87ca1..d9bb004 100644 --- a/include/bounce/collision/shapes/hull.h +++ b/include/bounce/collision/shapes/hull.h @@ -21,6 +21,15 @@ #include +// 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; diff --git a/include/bounce/collision/shapes/qhull.h b/include/bounce/collision/shapes/qhull.h index 82043ab..cdb540f 100644 --- a/include/bounce/collision/shapes/qhull.h +++ b/include/bounce/collision/shapes/qhull.h @@ -21,15 +21,6 @@ #include -// The maximum number of vertices that a hull can have. -#define B3_MAX_HULL_VERTICES (256) - -// The maximum number of half-edges a hull can have. -#define B3_MAX_HULL_EDGES (256) - -// The maximum number of faces and planes a hull can have. -#define B3_MAX_HULL_FACES (256) - // This hull can be constructed from an array of points. struct b3QHull : public b3Hull { @@ -52,8 +43,9 @@ struct b3QHull : public b3Hull } // Create a convex hull from an array of points. - // If the points define a degenerate polyhedron the hull is not overwritten. + // The counter must be in the range [0, B3_MAX_HULL_VERTICES]. // Coincident points are removed. + // Some coplanar faces are merged. void Set(const b3Vec3* points, u32 count); // Set this hull as a cylinder located at the origin. diff --git a/include/bounce/common/settings.h b/include/bounce/common/settings.h index ab13799..b665914 100644 --- a/include/bounce/common/settings.h +++ b/include/bounce/common/settings.h @@ -41,6 +41,7 @@ typedef float float32; #define B3_MAX_FLOAT (FLT_MAX) #define B3_EPSILON (FLT_EPSILON) +#define B3_MAX_U8 (0xFF) #define B3_MAX_U32 (0xFFFFFFFF) // Collision