| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
#pragma once |
| 6 |
|
| 7 |
#include <Jolt/Physics/Collision/Shape/Shape.h> |
| 8 |
|
| 9 |
JPH_NAMESPACE_BEGIN |
| 10 |
|
| 11 |
|
| 12 |
class JPH_EXPORT DecoratedShapeSettings : public ShapeSettings |
| 13 |
{ |
| 14 |
JPH_DECLARE_SERIALIZABLE_VIRTUAL(JPH_EXPORT, DecoratedShapeSettings) |
| 15 |
|
| 16 |
public: |
| 17 |
|
| 18 |
DecoratedShapeSettings() = default; |
| 19 |
|
| 20 |
|
| 21 |
explicit DecoratedShapeSettings(const ShapeSettings *inShape) : mInnerShape(inShape) { } |
| 22 |
explicit DecoratedShapeSettings(const Shape *inShape) : mInnerShapePtr(inShape) { } |
| 23 |
|
| 24 |
RefConst<ShapeSettings> mInnerShape; |
| 25 |
RefConst<Shape> mInnerShapePtr; |
| 26 |
}; |
| 27 |
|
| 28 |
|
| 29 |
class JPH_EXPORT DecoratedShape : public Shape |
| 30 |
{ |
| 31 |
public: |
| 32 |
JPH_OVERRIDE_NEW_DELETE |
| 33 |
|
| 34 |
|
| 35 |
explicit DecoratedShape(EShapeSubType inSubType) : Shape(EShapeType::Decorated, inSubType) { } |
| 36 |
DecoratedShape(EShapeSubType inSubType, const Shape *inInnerShape) : Shape(EShapeType::Decorated, inSubType), mInnerShape(inInnerShape) { } |
| 37 |
DecoratedShape(EShapeSubType inSubType, const DecoratedShapeSettings &inSettings, ShapeResult &outResult); |
| 38 |
|
| 39 |
|
| 40 |
const Shape * GetInnerShape() const { return mInnerShape; } |
| 41 |
|
| 42 |
|
| 43 |
virtual bool MustBeStatic() const override { return mInnerShape->MustBeStatic(); } |
| 44 |
|
| 45 |
|
| 46 |
virtual Vec3 GetCenterOfMass() const override { return mInnerShape->GetCenterOfMass(); } |
| 47 |
|
| 48 |
|
| 49 |
virtual uint GetSubShapeIDBitsRecursive() const override { return mInnerShape->GetSubShapeIDBitsRecursive(); } |
| 50 |
|
| 51 |
|
| 52 |
virtual const Shape * GetLeafShape(const SubShapeID &inSubShapeID, SubShapeID &outRemainder) const override { return mInnerShape->GetLeafShape(inSubShapeID, outRemainder); } |
| 53 |
|
| 54 |
|
| 55 |
virtual const PhysicsMaterial * GetMaterial(const SubShapeID &inSubShapeID) const override; |
| 56 |
|
| 57 |
|
| 58 |
virtual void GetSupportingFace(const SubShapeID &inSubShapeID, Vec3Arg inDirection, Vec3Arg inScale, Mat44Arg inCenterOfMassTransform, SupportingFace &outVertices) const override; |
| 59 |
|
| 60 |
|
| 61 |
virtual uint64 GetSubShapeUserData(const SubShapeID &inSubShapeID) const override; |
| 62 |
|
| 63 |
|
| 64 |
virtual void SaveSubShapeState(ShapeList &outSubShapes) const override; |
| 65 |
virtual void RestoreSubShapeState(const ShapeRefC *inSubShapes, uint inNumShapes) override; |
| 66 |
|
| 67 |
|
| 68 |
virtual Stats GetStatsRecursive(VisitedShapes &ioVisitedShapes) const override; |
| 69 |
|
| 70 |
|
| 71 |
virtual bool IsValidScale(Vec3Arg inScale) const override { return mInnerShape->IsValidScale(inScale); } |
| 72 |
|
| 73 |
|
| 74 |
virtual Vec3 MakeScaleValid(Vec3Arg inScale) const override { return mInnerShape->MakeScaleValid(inScale); } |
| 75 |
|
| 76 |
protected: |
| 77 |
RefConst<Shape> mInnerShape; |
| 78 |
}; |
| 79 |
|
| 80 |
JPH_NAMESPACE_END |