ksys/phys: Add RigidBodyFromResource

This commit is contained in:
Léo Lam
2022-02-07 14:58:48 +01:00
parent a3e72dd6f8
commit 635be7c1e4
21 changed files with 271 additions and 29 deletions
+4 -1
View File
@@ -108,8 +108,9 @@ add_library(hkStubs OBJECT
Havok/Physics2012/Collide/Query/CastUtil/hkpWorldRayCastInput.h
Havok/Physics2012/Collide/Shape/hkpShape.h
Havok/Physics2012/Collide/Shape/hkpShapeBase.h
Havok/Physics2012/Collide/Shape/hkpShapeType.h
Havok/Physics2012/Collide/Shape/hkpShapeBuffer.h
Havok/Physics2012/Collide/Shape/hkpShapeContainer.h
Havok/Physics2012/Collide/Shape/hkpShapeType.h
Havok/Physics2012/Collide/Shape/Compound/Collection/hkpShapeCollection.h
Havok/Physics2012/Collide/Shape/Compound/Collection/List/hkpListShape.h
Havok/Physics2012/Collide/Shape/Compound/Tree/hkpBvTreeShape.h
@@ -168,6 +169,8 @@ add_library(hkStubs OBJECT
Havok/Physics2012/Internal/Collide/Mopp/Code/hkpMoppCode.h
Havok/Physics2012/Utilities/Collide/ShapeUtils/ShapeScaling/hkpShapeScalingUtility.h
Havok/Physics2012/Utilities/Dynamics/ScaleSystem/hkpSystemScalingUtility.h
Havok/Physics2012/Utilities/Serialize/hkpPhysicsData.h
)
@@ -0,0 +1,14 @@
#pragma once
constexpr int HK_SHAPE_BUFFER_SIZE = 512;
struct hkpShapeBufferStorage {
alignas(16) char m_storage[HK_SHAPE_BUFFER_SIZE];
template <typename T>
operator T*() { // NOLINT(google-explicit-constructor)
return reinterpret_cast<T*>(m_storage);
}
};
using hkpShapeBuffer = hkpShapeBufferStorage;
@@ -2,8 +2,7 @@
#include <Havok/Common/Base/hkBase.h>
#include <Havok/Physics2012/Collide/Shape/hkpShape.h>
class hkpShapeBuffer;
#include <Havok/Physics2012/Collide/Shape/hkpShapeBuffer.h>
class hkpShapeContainer {
public:
@@ -0,0 +1,25 @@
#pragma once
#include <Havok/Common/Base/hkBase.h>
class hkpShape;
class hkpShapeScalingUtility {
public:
HK_DECLARE_CLASS_ALLOCATOR(hkpShapeScalingUtility)
struct ShapePair {
HK_DECLARE_CLASS_ALLOCATOR(ShapePair)
hkpShape* originalShape;
hkpShape* newShape;
};
static hkpShape* scaleShapeSimd(hkpShape* shape, hkSimdRealParameter scale,
hkArray<ShapePair>* doneShapes = nullptr);
static hkpShape* scaleShape(hkpShape* shape, hkReal scale,
hkArray<ShapePair>* doneShapes = nullptr) {
return scaleShapeSimd(shape, hkSimdReal(scale), doneShapes);
}
};
@@ -0,0 +1,17 @@
#pragma once
#include <Havok/Common/Base/hkBase.h>
#include <Havok/Physics2012/Utilities/Collide/ShapeUtils/ShapeScaling/hkpShapeScalingUtility.h>
class hkpPhysicsSystem;
class hkpSystemScalingUtility {
public:
static void scaleSystemSimd(hkpPhysicsSystem* system, hkSimdRealParameter scale,
hkArray<hkpShapeScalingUtility::ShapePair>* doneShapes = nullptr);
static void scaleSystem(hkpPhysicsSystem* system, hkReal scale,
hkArray<hkpShapeScalingUtility::ShapePair>* doneShapes = nullptr) {
scaleSystemSimd(system, hkSimdReal(scale), doneShapes);
}
};