Plasma Engine  2.0
Loading...
Searching...
No Matches
JoltCustomShapeInfo.h
1#pragma once
2
3#include <Jolt/Physics/Collision/Shape/DecoratedShape.h>
4
5class plJoltCustomShapeInfo : public JPH::DecoratedShape
6{
7public:
9 : DecoratedShape(JPH::EShapeSubType::User1)
10 {
11 }
12
13 plJoltCustomShapeInfo(const Shape* pInInnerShape)
14 : DecoratedShape(JPH::EShapeSubType::User1, pInInnerShape)
15 {
16 }
17
18 float m_fDensity = 1.0f;
20
21 virtual const JPH::PhysicsMaterial* GetMaterial(const JPH::SubShapeID& subShapeID) const override;
22 virtual JPH::uint64 GetSubShapeUserData(const JPH::SubShapeID& subShapeID) const override;
23 virtual JPH::MassProperties GetMassProperties() const override;
24 virtual JPH::Vec3 GetCenterOfMass() const override;
25
26 // all these just pass through to the inner shape
27 virtual JPH::AABox GetLocalBounds() const override;
28 virtual float GetInnerRadius() const override;
29 virtual JPH::Vec3 GetSurfaceNormal(const JPH::SubShapeID& subShapeID, JPH::Vec3Arg inLocalSurfacePosition) const override;
30 virtual void GetSubmergedVolume(JPH::Mat44Arg centerOfMassTransform, JPH::Vec3Arg inScale, const JPH::Plane& surface, float& out_fTotalVolume, float& out_fSubmergedVolume, JPH::Vec3& out_centerOfBuoyancy
31#ifdef JPH_DEBUG_RENDERER // Not using JPH_IF_DEBUG_RENDERER for Doxygen
32 ,
33 JPH::RVec3Arg inBaseOffset
34#endif
35
36 ) const override;
37 virtual void Draw(JPH::DebugRenderer* pInRenderer, JPH::Mat44Arg centerOfMassTransform, JPH::Vec3Arg inScale, JPH::ColorArg inColor, bool bInUseMaterialColors, bool bInDrawWireframe) const override;
38 virtual bool CastRay(const JPH::RayCast& ray, const JPH::SubShapeIDCreator& subShapeIDCreator, JPH::RayCastResult& ref_hit) const override;
39 virtual void CastRay(const JPH::RayCast& ray, const JPH::RayCastSettings& rayCastSettings, const JPH::SubShapeIDCreator& subShapeIDCreator, JPH::CastRayCollector& ref_collector, const JPH::ShapeFilter& shapeFilter) const override;
40 virtual void CollidePoint(JPH::Vec3Arg inPoint, const JPH::SubShapeIDCreator& subShapeIDCreator, JPH::CollidePointCollector& ref_collector, const JPH::ShapeFilter& shapeFilter) const override;
41 virtual void GetTrianglesStart(JPH::Shape::GetTrianglesContext& ref_context, const JPH::AABox& box, JPH::Vec3Arg inPositionCOM, JPH::QuatArg inRotation, JPH::Vec3Arg inScale) const override;
42 virtual int GetTrianglesNext(JPH::Shape::GetTrianglesContext& ref_context, int iInMaxTrianglesRequested, JPH::Float3* pTriangleVertices, const JPH::PhysicsMaterial** pMaterials = nullptr) const override;
43 virtual Stats GetStats() const override { return Stats(sizeof(*this), 0); }
44 virtual float GetVolume() const override;
45
46 // Register shape functions with the registry
47 static void sRegister();
48
49 void CollideSoftBodyVertices(JPH::Mat44Arg centerOfMassTransform, JPH::Vec3Arg scale, JPH::SoftBodyVertex* pVertices, JPH::uint numVertices, float fDeltaTime, JPH::Vec3Arg displacementDueToGravity, int iCollidingShapeIndex) const override;
50
51 virtual void CollectTransformedShapes(const JPH::AABox& box, JPH::Vec3Arg positionCOM, JPH::QuatArg rotation, JPH::Vec3Arg scale, const JPH::SubShapeIDCreator& subShapeIDCreator, JPH::TransformedShapeCollector& ref_ioCollector, const JPH::ShapeFilter& shapeFilter) const override;
52
53private:
54 // Helper functions called by CollisionDispatch
55 static void sCollideUser1VsShape(const JPH::Shape* inShape1, const JPH::Shape* inShape2, JPH::Vec3Arg inScale1, JPH::Vec3Arg inScale2, JPH::Mat44Arg inCenterOfMassTransform1, JPH::Mat44Arg inCenterOfMassTransform2, const JPH::SubShapeIDCreator& inSubShapeIDCreator1, const JPH::SubShapeIDCreator& inSubShapeIDCreator2, const JPH::CollideShapeSettings& inCollideShapeSettings, JPH::CollideShapeCollector& ioCollector, const JPH::ShapeFilter& inShapeFilter);
56 static void sCollideShapeVsUser1(const JPH::Shape* inShape1, const JPH::Shape* inShape2, JPH::Vec3Arg inScale1, JPH::Vec3Arg inScale2, JPH::Mat44Arg inCenterOfMassTransform1, JPH::Mat44Arg inCenterOfMassTransform2, const JPH::SubShapeIDCreator& inSubShapeIDCreator1, const JPH::SubShapeIDCreator& inSubShapeIDCreator2, const JPH::CollideShapeSettings& inCollideShapeSettings, JPH::CollideShapeCollector& ioCollector, const JPH::ShapeFilter& inShapeFilter);
57 static void sCastUser1VsShape(const JPH::ShapeCast& inShapeCast, const JPH::ShapeCastSettings& inShapeCastSettings, const Shape* inShape, JPH::Vec3Arg inScale, const JPH::ShapeFilter& inShapeFilter, JPH::Mat44Arg inCenterOfMassTransform2, const JPH::SubShapeIDCreator& inSubShapeIDCreator1, const JPH::SubShapeIDCreator& inSubShapeIDCreator2, JPH::CastShapeCollector& ioCollector);
58 static void sCastShapeVsUser1(const JPH::ShapeCast& inShapeCast, const JPH::ShapeCastSettings& inShapeCastSettings, const Shape* inShape, JPH::Vec3Arg inScale, const JPH::ShapeFilter& inShapeFilter, JPH::Mat44Arg inCenterOfMassTransform2, const JPH::SubShapeIDCreator& inSubShapeIDCreator1, const JPH::SubShapeIDCreator& inSubShapeIDCreator2, JPH::CastShapeCollector& ioCollector);
59};
A hybrid array uses in-place storage to handle the first few elements without any allocation....
Definition HybridArray.h:12
Definition JoltCustomShapeInfo.h:6