10#ifdef JPH_DEBUG_RENDERER
31 virtual ShapeResult
Create()
const override;
66 virtual Vec3 GetSurfaceNormal(
const SubShapeID &inSubShapeID,
Vec3Arg inLocalSurfacePosition)
const override;
69 virtual void GetSupportingFace(
const SubShapeID &inSubShapeID,
Vec3Arg inDirection,
Vec3Arg inScale,
Mat44Arg inCenterOfMassTransform, SupportingFace &outVertices)
const override;
72 virtual const Support * GetSupportFunction(ESupportMode inMode, SupportBuffer &inBuffer,
Vec3Arg inScale)
const override;
77#ifdef JPH_DEBUG_RENDERER
90 virtual void CollidePoint(
Vec3Arg inPoint,
const SubShapeIDCreator &inSubShapeIDCreator,
CollidePointCollector &ioCollector,
const ShapeFilter &inShapeFilter = { })
const override;
93 virtual void CollideSoftBodyVertices(
Mat44Arg inCenterOfMassTransform,
Vec3Arg inScale,
const CollideSoftBodyVertexIterator &inVertices,
uint inNumVertices,
int inCollidingShapeIndex)
const override;
96 virtual void GetTrianglesStart(GetTrianglesContext &ioContext,
const AABox &inBox,
Vec3Arg inPositionCOM,
QuatArg inRotation,
Vec3Arg inScale)
const override;
99 virtual int GetTrianglesNext(GetTrianglesContext &ioContext,
int inMaxTrianglesRequested, Float3 *outTriangleVertices,
const PhysicsMaterial **outMaterials =
nullptr)
const override;
102 virtual void SaveBinaryState(StreamOut &inStream)
const override;
105 virtual Stats GetStats()
const override;
108 virtual float GetVolume()
const override {
return mVolume; }
135 const Face &face = mFaces[inFaceIndex];
136 const uint8 *first_vertex = mVertexIdx.data() + face.mFirstVertex;
137 uint num_vertices = min<uint>(face.mNumVertices, inMaxVertices);
138 for (
uint i = 0; i < num_vertices; ++i)
139 outVertices[i] = first_vertex[i];
140 return face.mNumVertices;
144 static void sRegister();
146#ifdef JPH_DEBUG_RENDERER
157 bool CastRayHelper(
const RayCast &inRay,
float &outMinFraction,
float &outMaxFraction)
const;
173 static_assert(
sizeof(Face) == 4,
"Unexpected size");
174 static_assert(
alignof(Face) == 2,
"Unexpected alignment");
180 int mFaces[3] = { -1, -1, -1 };
183 static_assert(
sizeof(
Point) == 32,
"Unexpected size");
184 static_assert(
alignof(
Point) == JPH_VECTOR_ALIGNMENT,
"Unexpected alignment");
189 Array<Point> mPoints;
191 Array<Plane> mPlanes;
192 Array<uint8> mVertexIdx;
193 float mConvexRadius = 0.0f;
195 float mInnerRadius = FLT_MAX;
197#ifdef JPH_DEBUG_RENDERER
Color ColorArg
Type to use for passing arguments to a function.
Definition Color.h:12
@ Point
Definition Constraint.h:36
std::uint8_t uint8
Definition Core.h:501
#define JPH_EXPORT
Definition Core.h:275
unsigned int uint
Definition Core.h:500
#define JPH_NAMESPACE_END
Definition Core.h:425
#define JPH_IF_DEBUG_RENDERER(...)
Definition Core.h:589
#define JPH_NAMESPACE_BEGIN
Definition Core.h:419
std::uint16_t uint16
Definition Core.h:502
const Quat QuatArg
Definition MathTypes.h:28
const Vec3 Vec3Arg
Definition MathTypes.h:19
const Mat44 & Mat44Arg
Definition MathTypes.h:29
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition Memory.h:50
constexpr float cDefaultConvexRadius
How much padding to add around objects.
Definition PhysicsSettings.h:16
Vec3Arg RVec3Arg
Definition Real.h:30
Mat44Arg RMat44Arg
Definition Real.h:32
#define JPH_DECLARE_SERIALIZABLE_VIRTUAL(linkage, class_name)
Definition SerializableObject.h:109
CollisionCollector< RayCastResult, CollisionCollectorTraitsCastRay > CastRayCollector
Definition Shape.h:44
EShapeSubType
This enumerates all shape types, each shape can return its type through Shape::GetSubType.
Definition Shape.h:77
@ ConvexHull
Definition Shape.h:85
CollisionCollector< CollidePointResult, CollisionCollectorTraitsCollidePoint > CollidePointCollector
Definition Shape.h:46
Axis aligned box.
Definition AABox.h:16
Definition ConvexHullShape.cpp:1169
Definition ConvexHullShape.cpp:397
Definition ConvexHullShape.cpp:449
Definition ConvexHullShape.cpp:488
A convex hull.
Definition ConvexHullShape.h:41
virtual Vec3 GetCenterOfMass() const override
All shapes are centered around their center of mass. This function returns the center of mass positio...
Definition ConvexHullShape.h:54
virtual float GetVolume() const override
Definition ConvexHullShape.h:108
virtual void RestoreBinaryState(StreamIn &inStream) override
This function should not be called directly, it is used by sRestoreFromBinaryState.
Definition ConvexHullShape.cpp:1271
static bool sDrawFaceOutlines
Draw the outlines of the faces of the convex hull when drawing the shape.
Definition ConvexHullShape.h:148
uint GetFaceVertices(uint inFaceIndex, uint inMaxVertices, uint *outVertices) const
Definition ConvexHullShape.h:133
static JPH_OVERRIDE_NEW_DELETE constexpr int cMaxPointsInHull
Definition ConvexHullShape.h:47
virtual float GetInnerRadius() const override
Definition ConvexHullShape.h:60
virtual AABox GetLocalBounds() const override
Get local bounding box including convex radius, this box is centered around the center of mass rather...
Definition ConvexHullShape.h:57
uint GetNumVerticesInFace(uint inFaceIndex) const
Get the number of vertices in a face.
Definition ConvexHullShape.h:126
Vec3 GetPoint(uint inIndex) const
Get a vertex of this convex hull relative to the center of mass.
Definition ConvexHullShape.h:120
const Array< Plane > & GetPlanes() const
Get the planes of this convex hull.
Definition ConvexHullShape.h:114
uint GetNumFaces() const
Get the number of faces in this convex hull.
Definition ConvexHullShape.h:123
ConvexHullShape()
Constructor.
Definition ConvexHullShape.h:50
uint GetNumPoints() const
Get the number of vertices in this convex hull.
Definition ConvexHullShape.h:117
float GetConvexRadius() const
Get the convex radius of this convex hull.
Definition ConvexHullShape.h:111
Class that constructs a ConvexHullShape.
Definition ConvexHullShape.h:18
ConvexHullShapeSettings(const Array< Vec3 > &inPoints, float inConvexRadius=cDefaultConvexRadius, const PhysicsMaterial *inMaterial=nullptr)
Definition ConvexHullShape.h:28
Array< Vec3 > mPoints
Points to create the hull from. Note that these points don't need to be the vertices of the convex hu...
Definition ConvexHullShape.h:33
ConvexHullShapeSettings()=default
Default constructor for deserialization.
float mMaxConvexRadius
Convex radius as supplied by the constructor. Note that during hull creation the convex radius can be...
Definition ConvexHullShape.h:34
float mHullTolerance
Points are allowed this far outside of the hull (increasing this yields a hull with less vertices)....
Definition ConvexHullShape.h:36
ConvexHullShapeSettings(const Vec3 *inPoints, int inNumPoints, float inMaxConvexRadius=cDefaultConvexRadius, const PhysicsMaterial *inMaterial=nullptr)
Definition ConvexHullShape.h:27
float mMaxErrorConvexRadius
Maximum distance between the shrunk hull + convex radius and the actual hull.
Definition ConvexHullShape.h:35
JPH_OVERRIDE_NEW_DELETE ConvexShape(EShapeSubType inSubType)
Constructor.
Definition ConvexShape.h:41
ConvexShapeSettings()=default
Constructor.
Definition DebugRenderer.h:47
Ref< Geometry > GeometryRef
Handle for a lodded triangle batch.
Definition DebugRenderer.h:246
Describes the mass and inertia properties of a body. Used during body construction only.
Definition MassProperties.h:16
Definition PhysicsMaterial.h:23
An infinite plane described by the formula X . Normal + Constant = 0.
Definition Plane.h:11
Specialization of cast result against a shape.
Definition CastResult.h:30
Settings to be passed with a ray cast.
Definition RayCast.h:70
Filter class.
Definition ShapeFilter.h:17
virtual ShapeResult Create() const =0
Create a shape according to the settings specified by this object.
Simple binary input stream.
Definition StreamIn.h:13
Definition SubShapeID.h:108
A sub shape id contains a path to an element (usually a triangle or other primitive type) of a compou...
Definition SubShapeID.h:23