summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2022-02-01 16:49:05 +0100
committerLéo Lam <leo@leolam.fr>2022-02-01 16:49:05 +0100
commit2cd2d9dc69ca2da025b8a5a350f57fe343998650 (patch)
treed556d244e50afc74888c665cfb530bdb30b6a15b /lib
parent6b302518fb6cd6537cb68984f87378fd66525006 (diff)
Havok: Add hkpPlaneShape
Diffstat (limited to 'lib')
-rw-r--r--lib/hkStubs/CMakeLists.txt2
-rw-r--r--lib/hkStubs/Havok/Physics2012/Collide/Shape/HeightField/Plane/hkpPlaneShape.h36
-rw-r--r--lib/hkStubs/Havok/Physics2012/Collide/Shape/HeightField/hkpHeightFieldShape.h40
3 files changed, 78 insertions, 0 deletions
diff --git a/lib/hkStubs/CMakeLists.txt b/lib/hkStubs/CMakeLists.txt
index 9f36a461..d4cb5892 100644
--- a/lib/hkStubs/CMakeLists.txt
+++ b/lib/hkStubs/CMakeLists.txt
@@ -115,7 +115,9 @@ add_library(hkStubs OBJECT
Havok/Physics2012/Collide/Shape/Convex/Box/hkpBoxShape.h
Havok/Physics2012/Collide/Shape/Convex/Capsule/hkpCapsuleShape.h
Havok/Physics2012/Collide/Shape/Convex/ConvexTransform/hkpConvexTransformShape.h
+ Havok/Physics2012/Collide/Shape/HeightField/hkpHeightFieldShape.h
Havok/Physics2012/Collide/Shape/HeightField/hkpSphereRepShape.h
+ Havok/Physics2012/Collide/Shape/HeightField/Plane/hkpPlaneShape.h
Havok/Physics2012/Collide/Shape/Query/hkpRayShapeCollectionFilter.h
Havok/Physics2012/Collide/Shape/Query/hkpShapeRayCastInput.h
Havok/Physics2012/Collide/Util/Welding/hkpWeldingUtility.h
diff --git a/lib/hkStubs/Havok/Physics2012/Collide/Shape/HeightField/Plane/hkpPlaneShape.h b/lib/hkStubs/Havok/Physics2012/Collide/Shape/HeightField/Plane/hkpPlaneShape.h
new file mode 100644
index 00000000..135528ee
--- /dev/null
+++ b/lib/hkStubs/Havok/Physics2012/Collide/Shape/HeightField/Plane/hkpPlaneShape.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#include <Havok/Physics2012/Collide/Shape/HeightField/hkpHeightFieldShape.h>
+
+class hkpPlaneShape : public hkpHeightFieldShape {
+public:
+ HK_DECLARE_CLASS_ALLOCATOR(hkpPlaneShape)
+ HK_DECLARE_REFLECTION()
+ HKCD_DECLARE_SHAPE_TYPE(hkcdShapeType::PLANE)
+
+ hkpPlaneShape(const hkVector4& plane, const hkAabb& aabb);
+
+ hkpPlaneShape(const hkVector4& direction, const hkVector4& center,
+ const hkVector4& halfExtents);
+
+ explicit hkpPlaneShape(hkFinishLoadedObjectFlag flag);
+
+ const hkVector4& getPlane() const { return m_plane; }
+ const hkVector4& getAabbCenter() const { return m_aabbCenter; }
+ const hkVector4& getAabbHalfExtents() const { return m_aabbHalfExtents; }
+
+ void getAabb(const hkTransform& localToWorld, hkReal tolerance, hkAabb& out) const override;
+ hkBool castRay(const hkpShapeRayCastInput& input,
+ hkpShapeRayCastOutput& results) const override;
+ void castRayWithCollector(const hkpShapeRayCastInput& input, const hkpCdBody& cdBody,
+ hkpRayHitCollector& collector) const override;
+ void castSphere(const hkpSphereCastInput& input, const hkpCdBody& cdBody,
+ hkpRayHitCollector& collector) const override;
+ void collideSpheres(const CollideSpheresInput& input,
+ SphereCollisionOutput* outputArray) const override;
+
+protected:
+ hkVector4 m_plane;
+ hkVector4 m_aabbCenter;
+ hkVector4 m_aabbHalfExtents;
+};
diff --git a/lib/hkStubs/Havok/Physics2012/Collide/Shape/HeightField/hkpHeightFieldShape.h b/lib/hkStubs/Havok/Physics2012/Collide/Shape/HeightField/hkpHeightFieldShape.h
new file mode 100644
index 00000000..753fef20
--- /dev/null
+++ b/lib/hkStubs/Havok/Physics2012/Collide/Shape/HeightField/hkpHeightFieldShape.h
@@ -0,0 +1,40 @@
+#pragma once
+
+#include <Havok/Common/Base/hkBase.h>
+#include <Havok/Physics2012/Collide/Shape/Query/hkpShapeRayCastInput.h>
+#include <Havok/Physics2012/Collide/Shape/hkpShape.h>
+
+class hkpHeightFieldShape : public hkpShape {
+public:
+ HK_DECLARE_CLASS_ALLOCATOR(hkpHeightFieldShape)
+ HK_DECLARE_REFLECTION()
+ HKCD_DECLARE_SHAPE_TYPE(hkcdShapeType::HEIGHT_FIELD);
+
+ struct CollideSpheresInput {
+ HK_DECLARE_CLASS_ALLOCATOR(CollideSpheresInput)
+
+ hkSphere* m_spheres;
+ int m_numSpheres;
+ hkReal m_tolerance;
+ };
+
+ using SphereCollisionOutput = hkVector4;
+
+ struct hkpSphereCastInput : public hkpShapeRayCastInput {
+ HK_DECLARE_CLASS_ALLOCATOR(hkpSphereCastInput)
+
+ hkReal m_radius;
+ hkReal m_maxExtraPenetration;
+ };
+
+ explicit hkpHeightFieldShape(ShapeType type) : hkpShape(type) {}
+
+ explicit hkpHeightFieldShape(hkFinishLoadedObjectFlag flag) : hkpShape(flag) {
+ setType(HKCD_SHAPE_TYPE_FROM_CLASS(hkpHeightFieldShape));
+ }
+
+ virtual void collideSpheres(const CollideSpheresInput& input,
+ SphereCollisionOutput* outputArray) const = 0;
+ virtual void castSphere(const hkpSphereCastInput& input, const hkpCdBody& cdBody,
+ hkpRayHitCollector& collector) const = 0;
+};