| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include <Jolt/Physics/Collision/Shape/Shape.h> |
| 8 |
#include <Jolt/Physics/Collision/PhysicsMaterial.h> |
| 9 |
|
| 10 |
JPH_NAMESPACE_BEGIN |
| 11 |
|
| 12 |
|
| 13 |
class JPH_EXPORT EmptyShapeSettings final : public ShapeSettings |
| 14 |
{ |
| 15 |
JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, EmptyShapeSettings) |
| 16 |
|
| 17 |
public: |
| 18 |
EmptyShapeSettings() = default; |
| 19 |
explicit EmptyShapeSettings(Vec3Arg inCenterOfMass) : mCenterOfMass(inCenterOfMass) { } |
| 20 |
|
| 21 |
ShapeResult Create() const override; |
| 22 |
|
| 23 |
Vec3 mCenterOfMass = Vec3::sZero(); |
| 24 |
}; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
class JPH_EXPORT EmptyShape final : public Shape |
| 35 |
{ |
| 36 |
public: |
| 37 |
|
| 38 |
EmptyShape() : Shape(EShapeType::Empty, EShapeSubType::Empty) { } |
| 39 |
explicit EmptyShape(Vec3Arg inCenterOfMass) : Shape(EShapeType::Empty, EShapeSubType::Empty), mCenterOfMass(inCenterOfMass) { } |
| 40 |
EmptyShape(const EmptyShapeSettings &inSettings, ShapeResult &outResult) : Shape(EShapeType::Empty, EShapeSubType::Empty, inSettings, outResult), mCenterOfMass(inSettings.mCenterOfMass) { outResult.Set(this); } |
| 41 |
|
| 42 |
|
| 43 |
Vec3 GetCenterOfMass() const override { return mCenterOfMass; } |
| 44 |
AABox GetLocalBounds() const override { return { Vec3::sZero(), Vec3::sZero() }; } |
| 45 |
uint GetSubShapeIDBitsRecursive() const override { return 0; } |
| 46 |
float GetInnerRadius() const override { return 0.0f; } |
| 47 |
MassProperties GetMassProperties() const override; |
| 48 |
const PhysicsMaterial * GetMaterial([[maybe_unused]] const SubShapeID &inSubShapeID) const override { return PhysicsMaterial::sDefault; } |
| 49 |
virtual Vec3 GetSurfaceNormal(const SubShapeID &inSubShapeID, Vec3Arg inLocalSurfacePosition) const override { return Vec3::sZero(); } |
| 50 |
virtual void GetSubmergedVolume(Mat44Arg inCenterOfMassTransform, Vec3Arg inScale, const Plane &inSurface, float &outTotalVolume, float &outSubmergedVolume, Vec3 &outCenterOfBuoyancy |
| 51 |
#ifdef JPH_DEBUG_RENDERER |
| 52 |
, RVec3Arg inBaseOffset |
| 53 |
#endif |
| 54 |
) const override { outTotalVolume = 0.0f; outSubmergedVolume = 0.0f; outCenterOfBuoyancy = Vec3::sZero(); } |
| 55 |
#ifdef JPH_DEBUG_RENDERER |
| 56 |
virtual void Draw([[maybe_unused]] DebugRenderer *inRenderer, [[maybe_unused]] RMat44Arg inCenterOfMassTransform, [[maybe_unused]] Vec3Arg inScale, [[maybe_unused]] ColorArg inColor, [[maybe_unused]] bool inUseMaterialColors, [[maybe_unused]] bool inDrawWireframe) const override; |
| 57 |
#endif |
| 58 |
virtual bool CastRay([[maybe_unused]] const RayCast &inRay, [[maybe_unused]] const SubShapeIDCreator &inSubShapeIDCreator, [[maybe_unused]] RayCastResult &ioHit) const override { return false; } |
| 59 |
virtual void CastRay([[maybe_unused]] const RayCast &inRay, [[maybe_unused]] const RayCastSettings &inRayCastSettings, [[maybe_unused]] const SubShapeIDCreator &inSubShapeIDCreator, [[maybe_unused]] CastRayCollector &ioCollector, [[maybe_unused]] const ShapeFilter &inShapeFilter = { }) const override { } |
| 60 |
virtual void CollidePoint([[maybe_unused]] Vec3Arg inPoint, [[maybe_unused]] const SubShapeIDCreator &inSubShapeIDCreator, [[maybe_unused]] CollidePointCollector &ioCollector, [[maybe_unused]] const ShapeFilter &inShapeFilter = { }) const override { } |
| 61 |
virtual void CollideSoftBodyVertices([[maybe_unused]] Mat44Arg inCenterOfMassTransform, [[maybe_unused]] Vec3Arg inScale, [[maybe_unused]] const CollideSoftBodyVertexIterator &inVertices, [[maybe_unused]] uint inNumVertices, [[maybe_unused]] int inCollidingShapeIndex) const override { } |
| 62 |
virtual void GetTrianglesStart([[maybe_unused]] GetTrianglesContext &ioContext, [[maybe_unused]] const AABox &inBox, [[maybe_unused]] Vec3Arg inPositionCOM, [[maybe_unused]] QuatArg inRotation, [[maybe_unused]] Vec3Arg inScale) const override { } |
| 63 |
virtual int GetTrianglesNext([[maybe_unused]] GetTrianglesContext &ioContext, [[maybe_unused]] int inMaxTrianglesRequested, [[maybe_unused]] Float3 *outTriangleVertices, [[maybe_unused]] const PhysicsMaterial **outMaterials = nullptr) const override { return 0; } |
| 64 |
Stats GetStats() const override { return { sizeof(*this), 0 }; } |
| 65 |
float GetVolume() const override { return 0.0f; } |
| 66 |
bool IsValidScale([[maybe_unused]] Vec3Arg inScale) const override { return true; } |
| 67 |
|
| 68 |
|
| 69 |
static void sRegister(); |
| 70 |
|
| 71 |
private: |
| 72 |
Vec3 mCenterOfMass = Vec3::sZero(); |
| 73 |
}; |
| 74 |
|
| 75 |
JPH_NAMESPACE_END |