49 virtual void CollidePoint(
Vec3Arg inPoint,
const SubShapeIDCreator &inSubShapeIDCreator,
CollidePointCollector &ioCollector,
const ShapeFilter &inShapeFilter = { })
const override;
52 virtual void CollectTransformedShapes(
const AABox &inBox,
Vec3Arg inPositionCOM,
QuatArg inRotation,
Vec3Arg inScale,
const SubShapeIDCreator &inSubShapeIDCreator,
TransformedShapeCollector &ioCollector,
const ShapeFilter &inShapeFilter)
const override;
55 virtual int GetIntersectingSubShapes(
const AABox &inBox,
uint *outSubShapeIndices,
int inMaxSubShapeIndices)
const override;
58 virtual int GetIntersectingSubShapes(
const OrientedBox &inBox,
uint *outSubShapeIndices,
int inMaxSubShapeIndices)
const override;
61 virtual void SaveBinaryState(StreamOut &inStream)
const override;
81 void RemoveShape(
uint inIndex);
99 void ModifyShapes(
uint inStartIndex,
uint inNumber,
const Vec3 *inPositions,
const Quat *inRotations,
uint inPositionStride =
sizeof(
Vec3),
uint inRotationStride =
sizeof(
Quat));
105 void AdjustCenterOfMass();
110 static void sRegister();
114 virtual void RestoreBinaryState(
StreamIn &inStream)
override;
118 template <
class BoxType>
119 struct GetIntersectingSubShapesVisitorMC :
public GetIntersectingSubShapesVisitor<BoxType>
121 using GetIntersectingSubShapesVisitor<BoxType>::GetIntersectingSubShapesVisitor;
127 return GetIntersectingSubShapesVisitor<BoxType>::TestBounds(inBoundsMinX, inBoundsMinY, inBoundsMinZ, inBoundsMaxX, inBoundsMaxY, inBoundsMaxZ);
130 JPH_INLINE
bool ShouldVisitBlock(
UVec4Arg inResult)
const
135 JPH_INLINE
bool ShouldVisitSubShape(
UVec4Arg inResult,
uint inIndexInBlock)
const
137 return inResult[inIndexInBlock] != 0;
142 inline uint GetNumBlocks()
const {
return ((
uint)mSubShapes.size() + 3) >> 2; }
145 void EnsureSubShapeBoundsCapacity();
150 void CalculateSubShapeBounds(
uint inStartIdx,
uint inNumber);
153 void CalculateLocalBounds();
155 template <
class Visitor>
156 JPH_INLINE
void WalkSubShapes(Visitor &ioVisitor)
const;
159 static void sCollideCompoundVsShape(
const Shape *inShape1,
const Shape *inShape2,
Vec3Arg inScale1,
Vec3Arg inScale2,
Mat44Arg inCenterOfMassTransform1,
Mat44Arg inCenterOfMassTransform2,
const SubShapeIDCreator &inSubShapeIDCreator1,
const SubShapeIDCreator &inSubShapeIDCreator2,
const CollideShapeSettings &inCollideShapeSettings,
CollideShapeCollector &ioCollector,
const ShapeFilter &inShapeFilter);
160 static void sCollideShapeVsCompound(
const Shape *inShape1,
const Shape *inShape2,
Vec3Arg inScale1,
Vec3Arg inScale2,
Mat44Arg inCenterOfMassTransform1,
Mat44Arg inCenterOfMassTransform2,
const SubShapeIDCreator &inSubShapeIDCreator1,
const SubShapeIDCreator &inSubShapeIDCreator2,
const CollideShapeSettings &inCollideShapeSettings,
CollideShapeCollector &ioCollector,
const ShapeFilter &inShapeFilter);
161 static void sCastShapeVsCompound(
const ShapeCast &inShapeCast,
const ShapeCastSettings &inShapeCastSettings,
const Shape *inShape,
Vec3Arg inScale,
const ShapeFilter &inShapeFilter,
Mat44Arg inCenterOfMassTransform2,
const SubShapeIDCreator &inSubShapeIDCreator1,
const SubShapeIDCreator &inSubShapeIDCreator2,
CastShapeCollector &ioCollector);
173 Array<Bounds> mSubShapeBounds;
#define JPH_EXPORT
Definition Core.h:275
unsigned int uint
Definition Core.h:500
#define JPH_NAMESPACE_END
Definition Core.h:425
std::uint32_t uint32
Definition Core.h:503
#define JPH_NAMESPACE_BEGIN
Definition Core.h:419
const Vec4 Vec4Arg
Definition MathTypes.h:25
const Quat QuatArg
Definition MathTypes.h:28
const Vec3 Vec3Arg
Definition MathTypes.h:19
const Mat44 & Mat44Arg
Definition MathTypes.h:29
const UVec4 UVec4Arg
Definition MathTypes.h:26
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition Memory.h:50
#define JPH_DECLARE_SERIALIZABLE_VIRTUAL(linkage, class_name)
Definition SerializableObject.h:109
CollisionCollector< RayCastResult, CollisionCollectorTraitsCastRay > CastRayCollector
Definition Shape.h:44
CollisionCollector< ShapeCastResult, CollisionCollectorTraitsCastShape > CastShapeCollector
Definition Shape.h:45
EShapeSubType
This enumerates all shape types, each shape can return its type through Shape::GetSubType.
Definition Shape.h:77
@ MutableCompound
Definition Shape.h:89
CollisionCollector< TransformedShape, CollisionCollectorTraitsCollideShape > TransformedShapeCollector
Definition Shape.h:48
CollisionCollector< CollidePointResult, CollisionCollectorTraitsCollidePoint > CollidePointCollector
Definition Shape.h:46
CollisionCollector< CollideShapeResult, CollisionCollectorTraitsCollideShape > CollideShapeCollector
Definition Shape.h:47
Settings to be passed with a collision query.
Definition CollideShape.h:94
JPH_OVERRIDE_NEW_DELETE CompoundShape(EShapeSubType inSubType)
Constructor.
Definition CompoundShape.h:58
SubShapes mSubShapes
Definition CompoundShape.h:346
CompoundShapeSettings()=default
Constructor. Use AddShape to add the parts.
void AddShape(Vec3Arg inPosition, QuatArg inRotation, const ShapeSettings *inShape, uint32 inUserData=0)
Add a shape to the compound.
Definition CompoundShape.cpp:37
Definition MutableCompoundShape.h:33
JPH_OVERRIDE_NEW_DELETE MutableCompoundShape()
Constructor.
Definition MutableCompoundShape.h:38
virtual Stats GetStats() const override
Get stats of this shape. Use for logging / data collection purposes only. Does not add values from ch...
Definition MutableCompoundShape.h:64
Class that constructs a MutableCompoundShape.
Definition MutableCompoundShape.h:15
Specialization of cast result against a shape.
Definition CastResult.h:30
Settings to be passed with a ray cast.
Definition RayCast.h:70
Definition Reference.h:107
Helper class that either contains a valid result or an error.
Definition Result.h:12
Filter class.
Definition ShapeFilter.h:17
Base class for all shapes (collision volume of a body). Defines a virtual interface for collision det...
Definition Shape.h:186
virtual ShapeResult Create() const =0
Create a shape according to the settings specified by this object.
Result< Ref< Shape > > ShapeResult
Definition Shape.h:151
Simple binary input stream.
Definition StreamIn.h:13
Definition SubShapeID.h:108
JPH_INLINE bool TestAnyTrue() const
Test if any of the components are true (true is when highest bit of component is set).
Definition UVec4.inl:453
Definition CompoundShape.h:142
Class that holds information about the shape that can be used for logging / data collection purposes.
Definition Shape.h:408