mirror of https://github.com/zeldaret/botw.git
				
				
				
			Havok: Add stubs for hkpRigidBody parent classes
This commit is contained in:
		
							parent
							
								
									b4bbaf141f
								
							
						
					
					
						commit
						15741ce3ae
					
				| 
						 | 
				
			
			@ -6,9 +6,24 @@ add_library(hkStubs OBJECT
 | 
			
		|||
  Havok/Common/Base/Container/hkContainerAllocators.h
 | 
			
		||||
  Havok/Common/Base/Container/Array/hkArray.h
 | 
			
		||||
  Havok/Common/Base/Container/Array/hkArrayUtil.h
 | 
			
		||||
  Havok/Common/Base/Container/Array/hkSmallArray.h
 | 
			
		||||
  Havok/Common/Base/Container/String/hkStringPtr.h
 | 
			
		||||
 | 
			
		||||
  Havok/Common/Base/DebugUtil/MultiThreadCheck/hkMultiThreadCheck.h
 | 
			
		||||
 | 
			
		||||
  Havok/Common/Base/Math/hkMath.h
 | 
			
		||||
  Havok/Common/Base/Math/Matrix/hkMatrix3.h
 | 
			
		||||
  Havok/Common/Base/Math/Matrix/hkMatrix3f.h
 | 
			
		||||
  Havok/Common/Base/Math/Matrix/hkRotation.h
 | 
			
		||||
  Havok/Common/Base/Math/Matrix/hkRotationf.h
 | 
			
		||||
  Havok/Common/Base/Math/Matrix/hkTransform.h
 | 
			
		||||
  Havok/Common/Base/Math/Matrix/hkTransformf.h
 | 
			
		||||
  Havok/Common/Base/Math/Quaternion/hkQuaternion.h
 | 
			
		||||
  Havok/Common/Base/Math/Quaternion/hkQuaternionf.h
 | 
			
		||||
  Havok/Common/Base/Math/SweptTransform/hkSweptTransform.h
 | 
			
		||||
  Havok/Common/Base/Math/SweptTransform/hkSweptTransformf.h
 | 
			
		||||
  Havok/Common/Base/Math/Vector/hkSimdFloat32.h
 | 
			
		||||
  Havok/Common/Base/Math/Vector/hkSimdReal.h
 | 
			
		||||
  Havok/Common/Base/Math/Vector/hkVector4.h
 | 
			
		||||
  Havok/Common/Base/Math/Vector/hkVector4f.h
 | 
			
		||||
  Havok/Common/Base/Math/Vector/hkVector4Comparison.h
 | 
			
		||||
| 
						 | 
				
			
			@ -28,6 +43,8 @@ add_library(hkStubs OBJECT
 | 
			
		|||
  Havok/Common/Base/Reflection/hkClassMember.h
 | 
			
		||||
  Havok/Common/Base/Reflection/hkTypeInfo.h
 | 
			
		||||
 | 
			
		||||
  Havok/Common/Base/System/StackTracer/hkStackTracer.h
 | 
			
		||||
 | 
			
		||||
  Havok/Common/Base/Thread/Atomic/hkAtomicPrimitives.h
 | 
			
		||||
  Havok/Common/Base/Thread/Thread/hkThreadLocalData.h
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -36,6 +53,8 @@ add_library(hkStubs OBJECT
 | 
			
		|||
  Havok/Common/Base/Types/hkRefPtr.h
 | 
			
		||||
  Havok/Common/Base/Types/hkRefVariant.h
 | 
			
		||||
  Havok/Common/Base/Types/Geometry/Aabb/hkAabb.h
 | 
			
		||||
  Havok/Common/Base/Types/Physics/MotionState/hkMotionState.h
 | 
			
		||||
  Havok/Common/Base/Types/Properties/hkSimpleProperty.h
 | 
			
		||||
 | 
			
		||||
  Havok/Common/Serialize/Resource/hkResource.h
 | 
			
		||||
  Havok/Common/Serialize/Util/hkNativePackfileUtils.h
 | 
			
		||||
| 
						 | 
				
			
			@ -49,6 +68,7 @@ add_library(hkStubs OBJECT
 | 
			
		|||
  Havok/Physics2012/Collide/Agent/Collidable/hkpCollidable.h
 | 
			
		||||
  Havok/Physics2012/Collide/Agent/Collidable/hkpCollidableQualityType.h
 | 
			
		||||
  Havok/Physics2012/Collide/Agent3/BvTree3/hkpBvTreeAgent3.h
 | 
			
		||||
  Havok/Physics2012/Collide/Agent3/Machine/Nn/hkpLinkedCollidable.h
 | 
			
		||||
  Havok/Physics2012/Collide/BroadPhase/hkpBroadPhaseHandle.h
 | 
			
		||||
  Havok/Physics2012/Collide/BroadPhase/hkpTypedBroadPhaseHandle.h
 | 
			
		||||
  Havok/Physics2012/Collide/Dispatch/hkpCollisionDispatcher.h
 | 
			
		||||
| 
						 | 
				
			
			@ -74,14 +94,17 @@ add_library(hkStubs OBJECT
 | 
			
		|||
  Havok/Physics2012/Collide/Shape/Query/hkpShapeRayCastInput.h
 | 
			
		||||
  Havok/Physics2012/Collide/Util/Welding/hkpWeldingUtility.h
 | 
			
		||||
 | 
			
		||||
  Havok/Physics2012/Dynamics/Common/hkpMaterial.h
 | 
			
		||||
  Havok/Physics2012/Dynamics/Common/hkpProperty.h
 | 
			
		||||
  Havok/Physics2012/Dynamics/Entity/hkpEntity.h
 | 
			
		||||
  Havok/Physics2012/Dynamics/Entity/hkpRigidBody.h
 | 
			
		||||
  Havok/Physics2012/Dynamics/Motion/hkpMotion.h
 | 
			
		||||
  Havok/Physics2012/Dynamics/Motion/Rigid/hkpKeyframedRigidMotion.h
 | 
			
		||||
  Havok/Physics2012/Dynamics/World/hkpPhysicsSystem.h
 | 
			
		||||
  Havok/Physics2012/Dynamics/World/hkpWorld.cpp
 | 
			
		||||
  Havok/Physics2012/Dynamics/World/hkpWorld.h
 | 
			
		||||
  Havok/Physics2012/Dynamics/World/hkpWorldCinfo.cpp
 | 
			
		||||
  Havok/Physics2012/Dynamics/World/hkpWorldCinfo.h
 | 
			
		||||
  Havok/Physics2012/Dynamics/World/hkpWorldEntity.h
 | 
			
		||||
  Havok/Physics2012/Dynamics/World/hkpWorldObject.h
 | 
			
		||||
  Havok/Physics2012/Dynamics/World/Memory/hkpWorldMemoryAvailableWatchDog.h
 | 
			
		||||
  Havok/Physics2012/Dynamics/World/Memory/Default/hkpDefaultWorldMemoryWatchDog.h
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,62 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Memory/Router/hkMemoryRouter.h>
 | 
			
		||||
#include <Havok/Common/Base/Types/hkBaseDefs.h>
 | 
			
		||||
#include <Havok/Common/Base/Types/hkBaseTypes.h>
 | 
			
		||||
 | 
			
		||||
template <typename T>
 | 
			
		||||
class hkSmallArray {
 | 
			
		||||
public:
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkSmallArray)
 | 
			
		||||
 | 
			
		||||
    enum : int {
 | 
			
		||||
        CAPACITY_MASK = hkUint16(0x3fff),
 | 
			
		||||
        FLAG_MASK = hkUint16(0xC000),
 | 
			
		||||
        DONT_DEALLOCATE_FLAG = hkUint16(0x8000),
 | 
			
		||||
        LOCKED_FLAG = hkUint16(0x4000),
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    HK_FORCE_INLINE hkSmallArray();
 | 
			
		||||
    // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
 | 
			
		||||
    explicit hkSmallArray(hkFinishLoadedObjectFlag f) {}
 | 
			
		||||
 | 
			
		||||
    hkSmallArray(const hkSmallArray&) = delete;
 | 
			
		||||
    auto operator=(const hkSmallArray&) = delete;
 | 
			
		||||
 | 
			
		||||
    HK_FORCE_INLINE ~hkSmallArray();
 | 
			
		||||
 | 
			
		||||
    HK_FORCE_INLINE int getSize() const;
 | 
			
		||||
    HK_FORCE_INLINE int getCapacity() const;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    void releaseMemory();
 | 
			
		||||
 | 
			
		||||
    T* m_data;
 | 
			
		||||
    hkUint16 m_size;
 | 
			
		||||
    hkUint16 m_capacityAndFlags;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
template <typename T>
 | 
			
		||||
inline hkSmallArray<T>::hkSmallArray()
 | 
			
		||||
    : m_data(nullptr), m_size(0), m_capacityAndFlags(DONT_DEALLOCATE_FLAG) {}
 | 
			
		||||
 | 
			
		||||
template <typename T>
 | 
			
		||||
inline hkSmallArray<T>::~hkSmallArray() {
 | 
			
		||||
    releaseMemory();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename T>
 | 
			
		||||
inline int hkSmallArray<T>::getSize() const {
 | 
			
		||||
    return m_size;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename T>
 | 
			
		||||
inline int hkSmallArray<T>::getCapacity() const {
 | 
			
		||||
    return m_capacityAndFlags & CAPACITY_MASK;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename T>
 | 
			
		||||
inline void hkSmallArray<T>::releaseMemory() {
 | 
			
		||||
    if ((m_capacityAndFlags & DONT_DEALLOCATE_FLAG) == 0)
 | 
			
		||||
        hkDeallocateChunk(m_data, getCapacity());
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,59 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/System/StackTracer/hkStackTracer.h>
 | 
			
		||||
#include <Havok/Common/Base/hkBase.h>
 | 
			
		||||
 | 
			
		||||
class hkCriticalSection;
 | 
			
		||||
 | 
			
		||||
class hkMultiThreadCheck {
 | 
			
		||||
public:
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkMultiThreadCheck)
 | 
			
		||||
    HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
    enum AccessType {
 | 
			
		||||
        HK_ACCESS_IGNORE = 0,
 | 
			
		||||
        HK_ACCESS_RO = 1,
 | 
			
		||||
        HK_ACCESS_RW = 2,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    enum ReadMode {
 | 
			
		||||
        THIS_OBJECT_ONLY,
 | 
			
		||||
        RECURSIVE,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    enum : hkUint32 {
 | 
			
		||||
        MARKED_RO = 0xffffffe1,  // and all children
 | 
			
		||||
        MARKED_RO_SELF_ONLY = 0xffffffc1,
 | 
			
		||||
        UNMARKED = 0xfffffff1
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    HK_FORCE_INLINE hkMultiThreadCheck();
 | 
			
		||||
 | 
			
		||||
    HK_FORCE_INLINE void init();
 | 
			
		||||
 | 
			
		||||
    HK_FORCE_INLINE void markForRead(ReadMode mode = RECURSIVE) {}
 | 
			
		||||
    HK_FORCE_INLINE void markForWrite() {}
 | 
			
		||||
    HK_FORCE_INLINE bool isMarkedForWrite() { return true; }
 | 
			
		||||
    HK_FORCE_INLINE bool isMarkedForReadRecursive() { return true; }
 | 
			
		||||
    HK_FORCE_INLINE void unmarkForRead() {}
 | 
			
		||||
    HK_FORCE_INLINE void unmarkForWrite() {}
 | 
			
		||||
 | 
			
		||||
    hkUint32 m_threadId;
 | 
			
		||||
    static hkStackTracer s_stackTracer;
 | 
			
		||||
    static hkStackTracer::CallTree* s_stackTree;
 | 
			
		||||
    int m_stackTraceId;
 | 
			
		||||
    hkUint16 m_markCount;
 | 
			
		||||
    static hkCriticalSection* m_criticalSection;
 | 
			
		||||
    static void globalCriticalSectionLock();
 | 
			
		||||
    static void globalCriticalSectionUnlock();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    hkUint16 m_markBitStack;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline hkMultiThreadCheck::hkMultiThreadCheck() : m_threadId(UNMARKED), m_markCount(0x8000) {}
 | 
			
		||||
 | 
			
		||||
inline void hkMultiThreadCheck::init() {
 | 
			
		||||
    m_threadId = UNMARKED;
 | 
			
		||||
    m_markCount = 0x8000;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/Matrix/hkMatrix3f.h>
 | 
			
		||||
 | 
			
		||||
using hkMatrix3 = hkMatrix3f;
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,12 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/Vector/hkVector4f.h>
 | 
			
		||||
 | 
			
		||||
class hkMatrix3f {
 | 
			
		||||
public:
 | 
			
		||||
    hkMatrix3f() {}  // NOLINT(modernize-use-equals-default)
 | 
			
		||||
 | 
			
		||||
    hkVector4f m_col0;
 | 
			
		||||
    hkVector4f m_col1;
 | 
			
		||||
    hkVector4f m_col2;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/Matrix/hkRotationf.h>
 | 
			
		||||
 | 
			
		||||
using hkRotation = hkRotationf;
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/Matrix/hkMatrix3f.h>
 | 
			
		||||
 | 
			
		||||
class hkRotationf : public hkMatrix3f {};
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/Matrix/hkTransformf.h>
 | 
			
		||||
 | 
			
		||||
using hkTransform = hkTransformf;
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/Matrix/hkRotationf.h>
 | 
			
		||||
#include <Havok/Common/Base/Math/Vector/hkVector4f.h>
 | 
			
		||||
 | 
			
		||||
class hkTransformf {
 | 
			
		||||
public:
 | 
			
		||||
    hkRotationf m_rotation;
 | 
			
		||||
    hkVector4f m_translation;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/Quaternion/hkQuaternionf.h>
 | 
			
		||||
 | 
			
		||||
using hkQuaternion = hkQuaternionf;
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/Vector/hkVector4f.h>
 | 
			
		||||
 | 
			
		||||
class hkQuaternionf {
 | 
			
		||||
public:
 | 
			
		||||
    hkQuaternionf() {}  // NOLINT(modernize-use-equals-default)
 | 
			
		||||
 | 
			
		||||
    hkVector4f m_vec;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,5 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/SweptTransform/hkSweptTransformf.h>
 | 
			
		||||
 | 
			
		||||
using hkSweptTransform = hkSweptTransformf;
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,15 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/Quaternion/hkQuaternionf.h>
 | 
			
		||||
#include <Havok/Common/Base/Math/Vector/hkVector4f.h>
 | 
			
		||||
 | 
			
		||||
class hkSweptTransformf {
 | 
			
		||||
public:
 | 
			
		||||
    hkSweptTransformf() {}
 | 
			
		||||
 | 
			
		||||
    hkVector4f m_centerOfMass0;
 | 
			
		||||
    hkVector4f m_centerOfMass1;
 | 
			
		||||
    hkQuaternionf m_rotation0;
 | 
			
		||||
    hkQuaternionf m_rotation1;
 | 
			
		||||
    hkVector4f m_centerOfMassLocal;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,8 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Types/hkBaseTypes.h>
 | 
			
		||||
 | 
			
		||||
class hkSimdFloat32 {
 | 
			
		||||
public:
 | 
			
		||||
    hkFloat32 m_real;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/Vector/hkSimdFloat32.h>
 | 
			
		||||
 | 
			
		||||
using hkSimdReal = hkSimdFloat32;
 | 
			
		||||
using hkSimdRealParameter = const hkSimdReal&;
 | 
			
		||||
| 
						 | 
				
			
			@ -1,3 +1,6 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/Vector/hkVector4f.h>
 | 
			
		||||
 | 
			
		||||
using hkVector4 = hkVector4f;
 | 
			
		||||
using hkVector4Parameter = const hkVector4f&;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,3 +1,6 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/Vector/hkVector4fComparison.h>
 | 
			
		||||
 | 
			
		||||
using hkVector4Comparison = hkVector4fComparison;
 | 
			
		||||
using hkVector4ComparisonParameter = const hkVector4Comparison&;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -9,6 +9,9 @@
 | 
			
		|||
#define HK_VECTOR4F_AARCH64_NEON
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
using hkVector4fParameter = const class hkVector4f&;
 | 
			
		||||
using hkVector4fComparisonParameter = const class hkVector4fComparison&;
 | 
			
		||||
 | 
			
		||||
class hkVector4f {
 | 
			
		||||
public:
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkVector4f)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,15 +2,10 @@
 | 
			
		|||
 | 
			
		||||
#include <Havok/Common/Base/Types/hkBaseTypes.h>
 | 
			
		||||
 | 
			
		||||
class hkVector4f;
 | 
			
		||||
using hkVector4fParameter = const hkVector4f&;
 | 
			
		||||
class hkVector4fComparison;
 | 
			
		||||
using hkVector4fComparisonParameter = const hkVector4fComparison&;
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/Matrix/hkMatrix3.h>
 | 
			
		||||
#include <Havok/Common/Base/Math/Matrix/hkRotation.h>
 | 
			
		||||
#include <Havok/Common/Base/Math/Matrix/hkTransform.h>
 | 
			
		||||
#include <Havok/Common/Base/Math/Quaternion/hkQuaternion.h>
 | 
			
		||||
#include <Havok/Common/Base/Math/Vector/hkSimdReal.h>
 | 
			
		||||
#include <Havok/Common/Base/Math/Vector/hkVector4.h>
 | 
			
		||||
#include <Havok/Common/Base/Math/Vector/hkVector4Comparison.h>
 | 
			
		||||
 | 
			
		||||
using hkVector4 = hkVector4f;
 | 
			
		||||
using hkVector4Parameter = const hkVector4f&;
 | 
			
		||||
using hkVector4Comparison = hkVector4fComparison;
 | 
			
		||||
using hkVector4ComparisonParameter = hkVector4fComparisonParameter;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -70,6 +70,18 @@ protected:
 | 
			
		|||
    static HK_THREAD_LOCAL(hkMemoryRouter*) s_memoryRouter;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
template <typename TYPE>
 | 
			
		||||
HK_FORCE_INLINE TYPE* hkAllocateChunk(int numberOfObjects) {
 | 
			
		||||
    return static_cast<TYPE*>(hkMemoryRouter::getInstance().heap().blockAlloc(
 | 
			
		||||
        numberOfObjects * hkSizeOfTypeOrVoid<TYPE>::val));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
template <typename TYPE>
 | 
			
		||||
HK_FORCE_INLINE void hkDeallocateChunk(TYPE* ptr, int numberOfObjects) {
 | 
			
		||||
    hkMemoryRouter::getInstance().heap().blockFree(static_cast<void*>(ptr),
 | 
			
		||||
                                                   numberOfObjects * hkSizeOfTypeOrVoid<TYPE>::val);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define HK_DECLARE_CLASS_ALLOCATOR_IMPL(CLASS_TYPE, ALLOCATOR)                                     \
 | 
			
		||||
    /* clang-tidy fails to understand that the operator delete matches the operator new  */        \
 | 
			
		||||
    /* NOLINTNEXTLINE(misc-new-delete-overloads) */                                                \
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,9 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
class hkStackTracer {
 | 
			
		||||
public:
 | 
			
		||||
    class CallTree;
 | 
			
		||||
 | 
			
		||||
    hkStackTracer();
 | 
			
		||||
    virtual ~hkStackTracer();
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,52 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/SweptTransform/hkSweptTransform.h>
 | 
			
		||||
#include <Havok/Common/Base/hkBase.h>
 | 
			
		||||
 | 
			
		||||
class hkMotionState {
 | 
			
		||||
public:
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkMotionState)
 | 
			
		||||
    HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
    inline hkMotionState();
 | 
			
		||||
 | 
			
		||||
    void initMotionState(const hkVector4& position, const hkQuaternion& rotation);
 | 
			
		||||
 | 
			
		||||
    inline hkTransform& getTransform();
 | 
			
		||||
    inline const hkTransform& getTransform() const;
 | 
			
		||||
 | 
			
		||||
    inline hkSweptTransform& getSweptTransform();
 | 
			
		||||
    inline const hkSweptTransform& getSweptTransform() const;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    hkTransform m_transform;
 | 
			
		||||
    hkSweptTransform m_sweptTransform;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    hkVector4 m_deltaAngle;
 | 
			
		||||
    hkReal m_objectRadius;
 | 
			
		||||
    hkHalf m_linearDamping;
 | 
			
		||||
    hkHalf m_angularDamping;
 | 
			
		||||
    hkHalf m_timeFactor;
 | 
			
		||||
    hkUFloat8 m_maxLinearVelocity;
 | 
			
		||||
    hkUFloat8 m_maxAngularVelocity;
 | 
			
		||||
    hkUint8 m_deactivationClass;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline hkMotionState::hkMotionState() = default;
 | 
			
		||||
 | 
			
		||||
inline hkTransform& hkMotionState::getTransform() {
 | 
			
		||||
    return m_transform;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline const hkTransform& hkMotionState::getTransform() const {
 | 
			
		||||
    return m_transform;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkSweptTransform& hkMotionState::getSweptTransform() {
 | 
			
		||||
    return m_sweptTransform;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline const hkSweptTransform& hkMotionState::getSweptTransform() const {
 | 
			
		||||
    return m_sweptTransform;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,118 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/hkBase.h>
 | 
			
		||||
 | 
			
		||||
struct hkSimplePropertyValue {
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkSimplePropertyValue)
 | 
			
		||||
    HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
    hkUint64 m_data;
 | 
			
		||||
 | 
			
		||||
    inline hkSimplePropertyValue() = default;
 | 
			
		||||
    inline hkSimplePropertyValue(int i);       // NOLINT(google-explicit-constructor)
 | 
			
		||||
    inline hkSimplePropertyValue(hkUint32 i);  // NOLINT(google-explicit-constructor)
 | 
			
		||||
    inline hkSimplePropertyValue(hkUint64 i);  // NOLINT(google-explicit-constructor)
 | 
			
		||||
    inline hkSimplePropertyValue(hkReal r);    // NOLINT(google-explicit-constructor)
 | 
			
		||||
    inline hkSimplePropertyValue(void* p);     // NOLINT(google-explicit-constructor)
 | 
			
		||||
 | 
			
		||||
    inline void setInt(int i);
 | 
			
		||||
    inline void setUint64(hkUint64 i);
 | 
			
		||||
    inline void setReal(hkReal r);
 | 
			
		||||
    inline void setPtr(void* p);
 | 
			
		||||
 | 
			
		||||
    inline int getInt() const;
 | 
			
		||||
    inline hkUint64 getUint64() const;
 | 
			
		||||
    inline hkReal getReal() const;
 | 
			
		||||
    inline void* getPtr() const;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class hkSimpleProperty {
 | 
			
		||||
public:
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkSimpleProperty)
 | 
			
		||||
    HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
    inline hkSimpleProperty();
 | 
			
		||||
    inline hkSimpleProperty(hkUint32 key, hkSimplePropertyValue value);
 | 
			
		||||
    explicit hkSimpleProperty(hkFinishLoadedObjectFlag flag) {}
 | 
			
		||||
 | 
			
		||||
    static void mapStringToKey(const char* string, hkUint32& keyOut);
 | 
			
		||||
 | 
			
		||||
    hkUint32 m_key;
 | 
			
		||||
    hkUint32 m_alignmentPadding;
 | 
			
		||||
    hkSimplePropertyValue m_value;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline void hkSimplePropertyValue::setInt(const int i) {
 | 
			
		||||
    m_data = i;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkSimplePropertyValue::setUint64(hkUint64 i) {
 | 
			
		||||
    m_data = i;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkSimplePropertyValue::setReal(const hkReal r) {
 | 
			
		||||
    union {
 | 
			
		||||
        hkReal r;
 | 
			
		||||
#if defined(HK_REAL_IS_DOUBLE)
 | 
			
		||||
        hkUint64 u;
 | 
			
		||||
#else
 | 
			
		||||
        hkUint32 u;
 | 
			
		||||
#endif
 | 
			
		||||
    } u;
 | 
			
		||||
    u.r = r;
 | 
			
		||||
    m_data = u.u;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkSimplePropertyValue::setPtr(void* p) {
 | 
			
		||||
    m_data = reinterpret_cast<hkUlong>(p);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkSimplePropertyValue::hkSimplePropertyValue(const int i) {
 | 
			
		||||
    setInt(i);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkSimplePropertyValue::hkSimplePropertyValue(const hkUint32 i) {
 | 
			
		||||
    setInt(static_cast<int>(i));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkSimplePropertyValue::hkSimplePropertyValue(const hkUint64 i) {
 | 
			
		||||
    setUint64(i);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkSimplePropertyValue::hkSimplePropertyValue(const hkReal r) {
 | 
			
		||||
    setReal(r);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkSimplePropertyValue::hkSimplePropertyValue(void* p) {
 | 
			
		||||
    setPtr(p);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline int hkSimplePropertyValue::getInt() const {
 | 
			
		||||
    return static_cast<int>(m_data);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkUint64 hkSimplePropertyValue::getUint64() const {
 | 
			
		||||
    return m_data;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkReal hkSimplePropertyValue::getReal() const {
 | 
			
		||||
    union {
 | 
			
		||||
        hkReal r;
 | 
			
		||||
#if defined(HK_REAL_IS_DOUBLE)
 | 
			
		||||
        hkUint64 u;
 | 
			
		||||
#else
 | 
			
		||||
        hkUint32 u;
 | 
			
		||||
#endif
 | 
			
		||||
    } u;
 | 
			
		||||
    u.u = m_data;
 | 
			
		||||
    return u.r;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void* hkSimplePropertyValue::getPtr() const {
 | 
			
		||||
    return reinterpret_cast<void*>(static_cast<hkUlong>(m_data));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkSimpleProperty::hkSimpleProperty() = default;
 | 
			
		||||
 | 
			
		||||
inline hkSimpleProperty::hkSimpleProperty(hkUint32 key, hkSimplePropertyValue value)
 | 
			
		||||
    : m_key(key), m_value(value) {}
 | 
			
		||||
| 
						 | 
				
			
			@ -24,6 +24,9 @@ using hk_size_t = std::size_t;
 | 
			
		|||
using hkLong = long;
 | 
			
		||||
using hkUlong = unsigned long;
 | 
			
		||||
 | 
			
		||||
using hkObjectIndex = hkUint16;
 | 
			
		||||
using hkTime = hkReal;
 | 
			
		||||
 | 
			
		||||
using m128 = __attribute((vector_size(16))) float;
 | 
			
		||||
 | 
			
		||||
class hkHalf {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,69 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Types/hkBaseDefs.h>
 | 
			
		||||
#include <Havok/Common/Base/Types/hkBaseTypes.h>
 | 
			
		||||
 | 
			
		||||
#define HK_UFLOAT8_MAX_VALUE 256
 | 
			
		||||
#define hkUFloat8_eps 0.01f
 | 
			
		||||
#define hkUFloat8_maxValue 1000000.0f
 | 
			
		||||
 | 
			
		||||
class hkUFloat8 {
 | 
			
		||||
public:
 | 
			
		||||
    enum {
 | 
			
		||||
        MAX_VALUE = HK_UFLOAT8_MAX_VALUE,
 | 
			
		||||
 | 
			
		||||
        // Constants used in compressing / decompressing the values table
 | 
			
		||||
        ENCODED_EXPONENT_BITS = 5,
 | 
			
		||||
        ENCODED_MANTISSA_BITS = (16 - ENCODED_EXPONENT_BITS),
 | 
			
		||||
        ENCODED_EXPONENT_BIAS = 119,
 | 
			
		||||
        ENCODED_EXPONENT_MASK = (1 << ENCODED_EXPONENT_BITS) - 1,
 | 
			
		||||
        ENCODED_MANTISSA_MASK = (1 << ENCODED_MANTISSA_BITS) - 1,
 | 
			
		||||
 | 
			
		||||
        FLOAT_MANTISSA_BITS = 23,
 | 
			
		||||
        FLOAT_MANTISSA_MASK = (1 << FLOAT_MANTISSA_BITS) - 1,
 | 
			
		||||
 | 
			
		||||
        ENCODE_MANTISSA_SHIFT = (FLOAT_MANTISSA_BITS - ENCODED_MANTISSA_BITS),
 | 
			
		||||
        DECODE_EXPONENT_BIAS =
 | 
			
		||||
            (ENCODED_EXPONENT_BIAS << (FLOAT_MANTISSA_BITS - ENCODE_MANTISSA_SHIFT)),
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    HK_FORCE_INLINE hkUFloat8() {}
 | 
			
		||||
    HK_FORCE_INLINE hkUFloat8(float f) { *this = f; }   // NOLINT(google-explicit-constructor)
 | 
			
		||||
    HK_FORCE_INLINE hkUFloat8(double d) { *this = d; }  // NOLINT(google-explicit-constructor)
 | 
			
		||||
 | 
			
		||||
    hkUFloat8& operator=(const double& dv);
 | 
			
		||||
    hkUFloat8& operator=(const float& fv);
 | 
			
		||||
 | 
			
		||||
    HK_FORCE_INLINE bool isZero() const { return m_value == 0; }
 | 
			
		||||
    HK_FORCE_INLINE void setZero() { m_value = 0; }
 | 
			
		||||
 | 
			
		||||
    HK_FORCE_INLINE bool isMax() const { return m_value == 255; }
 | 
			
		||||
    HK_FORCE_INLINE void setMax() { m_value = 255; }
 | 
			
		||||
 | 
			
		||||
    HK_FORCE_INLINE hkBool operator==(const hkUFloat8& other) const {
 | 
			
		||||
        return m_value == other.m_value;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    HK_FORCE_INLINE void setArithmeticMean(const hkUFloat8& a, const hkUFloat8& b) {
 | 
			
		||||
        m_value = hkUint8((int(a.m_value) + int(b.m_value)) >> 1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // NOLINTNEXTLINE(google-explicit-constructor)
 | 
			
		||||
    HK_FORCE_INLINE operator float() const { return decodeFloat(getEncodedFloat(m_value)); }
 | 
			
		||||
 | 
			
		||||
    static HK_FORCE_INLINE float decodeFloat(const hkUint16 i) {
 | 
			
		||||
        const int intExpo = (i + hkUFloat8::DECODE_EXPONENT_BIAS)
 | 
			
		||||
                            << hkUFloat8::ENCODE_MANTISSA_SHIFT;
 | 
			
		||||
        union {
 | 
			
		||||
            const float* f;
 | 
			
		||||
            const int* i;
 | 
			
		||||
        } f2i;
 | 
			
		||||
        f2i.i = &intExpo;
 | 
			
		||||
        return i ? *f2i.f : 0.0f;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    hkUint8 m_value;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    static hkUint16 getEncodedFloat(hkUint8 index);
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -6,10 +6,12 @@
 | 
			
		|||
#include <Havok/Common/Base/Types/hkBaseTypes.h>
 | 
			
		||||
#include <Havok/Common/Base/Types/hkRefPtr.h>
 | 
			
		||||
#include <Havok/Common/Base/Types/hkRefVariant.h>
 | 
			
		||||
#include <Havok/Common/Base/Types/hkUFloat8.h>
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Math/hkMath.h>
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Memory/Router/hkMemoryRouter.h>
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Container/Array/hkArray.h>
 | 
			
		||||
#include <Havok/Common/Base/Container/Array/hkSmallArray.h>
 | 
			
		||||
#include <Havok/Common/Base/Container/String/hkStringPtr.h>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,6 @@
 | 
			
		|||
#include <Havok/Physics2012/Collide/Shape/hkpShape.h>
 | 
			
		||||
 | 
			
		||||
class hkMotionState;
 | 
			
		||||
class hkTransform;
 | 
			
		||||
class hkpCollidable;
 | 
			
		||||
 | 
			
		||||
class hkpCdBody {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,52 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/hkBase.h>
 | 
			
		||||
#include <Havok/Physics2012/Collide/Agent/Collidable/hkpCollidable.h>
 | 
			
		||||
 | 
			
		||||
struct hkpAgentNnEntry;
 | 
			
		||||
 | 
			
		||||
class hkpLinkedCollidable : public hkpCollidable {
 | 
			
		||||
public:
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkpLinkedCollidable)
 | 
			
		||||
    HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
    struct CollisionEntry {
 | 
			
		||||
        HK_DECLARE_CLASS_ALLOCATOR(CollisionEntry)
 | 
			
		||||
 | 
			
		||||
        hkpAgentNnEntry* m_agentEntry;
 | 
			
		||||
        hkpLinkedCollidable* m_partner;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    inline hkpLinkedCollidable(const hkpShape* shape, const hkMotionState* ms, int type = 0);
 | 
			
		||||
    explicit hkpLinkedCollidable(hkFinishLoadedObjectFlag flag) : hkpCollidable(flag) {}
 | 
			
		||||
    inline ~hkpLinkedCollidable();
 | 
			
		||||
 | 
			
		||||
    void getCollisionEntriesSorted(hkArray<CollisionEntry>& entries) const;
 | 
			
		||||
 | 
			
		||||
    hkArray<CollisionEntry>& getCollisionEntriesDeterministicUnchecked();
 | 
			
		||||
    const hkArray<CollisionEntry>& getCollisionEntriesDeterministicUnchecked() const;
 | 
			
		||||
 | 
			
		||||
    hkArray<CollisionEntry>& getCollisionEntriesNonDeterministic();
 | 
			
		||||
    const hkArray<CollisionEntry>& getCollisionEntriesNonDeterministic() const;
 | 
			
		||||
 | 
			
		||||
    void sortEntries();
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    hkArray<CollisionEntry> m_collisionEntries;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline hkpLinkedCollidable::hkpLinkedCollidable(const hkpShape* shape, const hkMotionState* ms,
 | 
			
		||||
                                                int type)
 | 
			
		||||
    : hkpCollidable(shape, ms, type) {}
 | 
			
		||||
 | 
			
		||||
inline hkpLinkedCollidable::~hkpLinkedCollidable() = default;
 | 
			
		||||
 | 
			
		||||
inline hkArray<hkpLinkedCollidable::CollisionEntry>&
 | 
			
		||||
hkpLinkedCollidable::getCollisionEntriesNonDeterministic() {
 | 
			
		||||
    return m_collisionEntries;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline const hkArray<hkpLinkedCollidable::CollisionEntry>&
 | 
			
		||||
hkpLinkedCollidable::getCollisionEntriesNonDeterministic() const {
 | 
			
		||||
    return m_collisionEntries;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -32,3 +32,26 @@ public:
 | 
			
		|||
 | 
			
		||||
    hkUlong m_userData;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class hkpShapeKeyPair {
 | 
			
		||||
public:
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkpShapeKeyPair)
 | 
			
		||||
 | 
			
		||||
    hkpShapeKey m_shapeKeyA;
 | 
			
		||||
    hkpShapeKey m_shapeKeyB;
 | 
			
		||||
 | 
			
		||||
    HK_FORCE_INLINE bool operator==(const hkpShapeKeyPair& p1) const {
 | 
			
		||||
        return m_shapeKeyB == p1.m_shapeKeyB && m_shapeKeyA == p1.m_shapeKeyA;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    HK_FORCE_INLINE bool operator<(const hkpShapeKeyPair& p1) const {
 | 
			
		||||
        return (m_shapeKeyA < p1.m_shapeKeyA) ||
 | 
			
		||||
               (m_shapeKeyA == p1.m_shapeKeyA && m_shapeKeyB < p1.m_shapeKeyB);
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class hkpShapeModifier {
 | 
			
		||||
public:
 | 
			
		||||
    virtual ~hkpShapeModifier() = default;
 | 
			
		||||
    virtual void modifyShape(hkpShape* shapeInOut) = 0;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,7 +8,6 @@ using hkpShapeKey = hkUint32;
 | 
			
		|||
 | 
			
		||||
class hkAabb;
 | 
			
		||||
class hkSphere;
 | 
			
		||||
class hkTransform;
 | 
			
		||||
class hkcdVertex;
 | 
			
		||||
class hkpCdBody;
 | 
			
		||||
class hkpRayHitCollector;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,92 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/hkBase.h>
 | 
			
		||||
#include <cmath>
 | 
			
		||||
 | 
			
		||||
class hkpMaterial {
 | 
			
		||||
public:
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkpMaterial)
 | 
			
		||||
    HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
    enum ResponseType {
 | 
			
		||||
        RESPONSE_INVALID,
 | 
			
		||||
        RESPONSE_SIMPLE_CONTACT,
 | 
			
		||||
        RESPONSE_REPORTING,
 | 
			
		||||
        RESPONSE_NONE,
 | 
			
		||||
        RESPONSE_MAX_ID
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    inline hkpMaterial();
 | 
			
		||||
    explicit hkpMaterial(hkFinishLoadedObjectFlag flag) {}
 | 
			
		||||
 | 
			
		||||
    inline hkReal getFriction() const;
 | 
			
		||||
    inline void setFriction(hkReal newFriction);
 | 
			
		||||
    static inline hkReal getCombinedFriction(hkReal frictionA, hkReal frictionB);
 | 
			
		||||
 | 
			
		||||
    inline hkReal getRestitution() const;
 | 
			
		||||
    inline void setRestitution(hkReal newRestitution);
 | 
			
		||||
    static inline hkReal getCombinedRestitution(hkReal restitutionA, hkReal restitutionB);
 | 
			
		||||
 | 
			
		||||
    inline hkReal getRollingFrictionMultiplier() const;
 | 
			
		||||
    inline void setRollingFrictionMultiplier(hkReal newRollingFrictionMultiplier);
 | 
			
		||||
    static inline hkReal getCombinedRollingFrictionMultiplier(hkReal multiplierA,
 | 
			
		||||
                                                              hkReal multiplierB);
 | 
			
		||||
 | 
			
		||||
    inline enum hkpMaterial::ResponseType getResponseType() const;
 | 
			
		||||
    inline void setResponseType(enum hkpMaterial::ResponseType t);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    hkEnum<ResponseType, hkInt8> m_responseType;
 | 
			
		||||
    hkHalf m_rollingFrictionMultiplier;
 | 
			
		||||
    hkReal m_friction;
 | 
			
		||||
    hkReal m_restitution;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline hkpMaterial::hkpMaterial() : m_friction(0.5), m_restitution(0.4) {
 | 
			
		||||
    m_rollingFrictionMultiplier.setZero();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkReal hkpMaterial::getFriction() const {
 | 
			
		||||
    return m_friction;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkpMaterial::setFriction(hkReal newFriction) {
 | 
			
		||||
    m_friction = newFriction;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkReal hkpMaterial::getCombinedFriction(hkReal frictionA, hkReal frictionB) {
 | 
			
		||||
    return std::sqrt(frictionA * frictionB);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkReal hkpMaterial::getRestitution() const {
 | 
			
		||||
    return m_restitution;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkpMaterial::setRestitution(hkReal newRestitution) {
 | 
			
		||||
    m_restitution = newRestitution;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkReal hkpMaterial::getCombinedRestitution(hkReal restitutionA, hkReal restitutionB) {
 | 
			
		||||
    return std::sqrt(restitutionA * restitutionB);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkReal hkpMaterial::getRollingFrictionMultiplier() const {
 | 
			
		||||
    return m_rollingFrictionMultiplier;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkpMaterial::setRollingFrictionMultiplier(hkReal newRollingFrictionMultiplier) {
 | 
			
		||||
    m_rollingFrictionMultiplier = newRollingFrictionMultiplier;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkReal hkpMaterial::getCombinedRollingFrictionMultiplier(hkReal multiplierA,
 | 
			
		||||
                                                                hkReal multiplierB) {
 | 
			
		||||
    return std::sqrt(multiplierA * multiplierB);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkpMaterial::ResponseType hkpMaterial::getResponseType() const {
 | 
			
		||||
    return m_responseType;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkpMaterial::setResponseType(hkpMaterial::ResponseType t) {
 | 
			
		||||
    m_responseType = t;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,6 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Types/Properties/hkSimpleProperty.h>
 | 
			
		||||
 | 
			
		||||
using hkpPropertyValue = hkSimplePropertyValue;
 | 
			
		||||
using hkpProperty = hkSimpleProperty;
 | 
			
		||||
| 
						 | 
				
			
			@ -1,25 +1,95 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Physics2012/Dynamics/World/hkpWorldEntity.h>
 | 
			
		||||
#include <Havok/Common/Base/hkBase.h>
 | 
			
		||||
#include <Havok/Physics2012/Dynamics/Common/hkpMaterial.h>
 | 
			
		||||
#include <Havok/Physics2012/Dynamics/Motion/Rigid/hkpKeyframedRigidMotion.h>
 | 
			
		||||
#include <Havok/Physics2012/Dynamics/World/hkpWorldObject.h>
 | 
			
		||||
 | 
			
		||||
class hkpMotion {
 | 
			
		||||
struct hkConstraintInternal;
 | 
			
		||||
class hkLocalFrame;
 | 
			
		||||
class hkSpuCollisionCallbackUtil;
 | 
			
		||||
class hkpAction;
 | 
			
		||||
class hkpBreakableBody;
 | 
			
		||||
class hkpConstraintInstance;
 | 
			
		||||
class hkpContactListener;
 | 
			
		||||
class hkpEntityActivationListener;
 | 
			
		||||
class hkpEntityListener;
 | 
			
		||||
class hkpSimulationIsland;
 | 
			
		||||
 | 
			
		||||
class hkpEntity : public hkpWorldObject {
 | 
			
		||||
public:
 | 
			
		||||
    virtual ~hkpMotion();
 | 
			
		||||
    hkUchar _0[0xc0];
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkpEntity)
 | 
			
		||||
    HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
    /* 0xc8 */ hkHalf m_motionState__m_timeFactor;
 | 
			
		||||
    /*       */ hkUchar _cc[0x128 - 0xcc];
 | 
			
		||||
    /* 0x128 */ void* _128;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct hkpMaxSizeMotion : hkpMotion {
 | 
			
		||||
    hkUchar fill[0x140 - sizeof(hkpMotion)];
 | 
			
		||||
};  // 0x140
 | 
			
		||||
 | 
			
		||||
class hkpEntity : public hkpWorldEntity {
 | 
			
		||||
public:
 | 
			
		||||
    virtual ~hkpEntity();
 | 
			
		||||
 | 
			
		||||
    /*       */ hkUchar _133[0x150 - 0x133];
 | 
			
		||||
    /* 0x150 */ hkpMaxSizeMotion m_motion;
 | 
			
		||||
    enum SpuCollisionCallbackEventFilter {
 | 
			
		||||
        SPU_SEND_NONE = 0x00,
 | 
			
		||||
        SPU_SEND_CONTACT_POINT_ADDED = 0x01,
 | 
			
		||||
        SPU_SEND_CONTACT_POINT_PROCESS = 0x02,
 | 
			
		||||
        SPU_SEND_CONTACT_POINT_REMOVED = 0x04,
 | 
			
		||||
        SPU_SEND_CONTACT_POINT_ADDED_OR_PROCESS =
 | 
			
		||||
            SPU_SEND_CONTACT_POINT_ADDED | SPU_SEND_CONTACT_POINT_PROCESS,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    class SmallArraySerializeOverrideType {
 | 
			
		||||
    public:
 | 
			
		||||
        HK_DECLARE_CLASS_ALLOCATOR(SmallArraySerializeOverrideType)
 | 
			
		||||
        HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
        void* m_data;
 | 
			
		||||
        hkUint16 m_size;
 | 
			
		||||
        hkUint16 m_capacityAndFlags;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    struct SpuCollisionCallback {
 | 
			
		||||
        HK_DECLARE_CLASS_ALLOCATOR(hkpEntity::SpuCollisionCallback)
 | 
			
		||||
        HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
        SpuCollisionCallback()
 | 
			
		||||
            : m_util(nullptr), m_capacity(0),
 | 
			
		||||
              m_eventFilter(SPU_SEND_CONTACT_POINT_ADDED_OR_PROCESS), m_userFilter(0x01) {}
 | 
			
		||||
        // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
 | 
			
		||||
        explicit SpuCollisionCallback(hkFinishLoadedObjectFlag flag) {}
 | 
			
		||||
 | 
			
		||||
        hkSpuCollisionCallbackUtil* m_util;
 | 
			
		||||
        hkUint16 m_capacity;
 | 
			
		||||
        hkUint8 m_eventFilter;
 | 
			
		||||
        hkUint8 m_userFilter;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    struct ExtendedListeners {
 | 
			
		||||
        HK_DECLARE_CLASS_ALLOCATOR(ExtendedListeners)
 | 
			
		||||
        HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
        hkSmallArray<hkpEntityActivationListener*> m_activationListeners;
 | 
			
		||||
        hkSmallArray<hkpEntityListener*> m_entityListeners;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    explicit hkpEntity(hkFinishLoadedObjectFlag flag);
 | 
			
		||||
    ~hkpEntity() override;
 | 
			
		||||
 | 
			
		||||
    virtual void deallocateInternalArrays();
 | 
			
		||||
    hkMotionState* getMotionState() override { return nullptr; }
 | 
			
		||||
 | 
			
		||||
    hkpMaterial m_material;
 | 
			
		||||
    void* m_limitContactImpulseUtilAndFlag;
 | 
			
		||||
    hkReal m_damageMultiplier;
 | 
			
		||||
    hkpBreakableBody* m_breakableBody;
 | 
			
		||||
    hkUint32 m_solverData;
 | 
			
		||||
    hkObjectIndex m_storageIndex;
 | 
			
		||||
    hkUint16 m_contactPointCallbackDelay;
 | 
			
		||||
    hkSmallArray<hkConstraintInternal> m_constraintsMaster;
 | 
			
		||||
    hkArray<hkpConstraintInstance*> m_constraintsSlave;
 | 
			
		||||
    hkArray<hkUint8> m_constraintRuntime;
 | 
			
		||||
    hkpSimulationIsland* m_simulationIsland;
 | 
			
		||||
    hkInt8 m_autoRemoveLevel;
 | 
			
		||||
    hkUint8 m_numShapeKeysInContactPointProperties;
 | 
			
		||||
    hkUint8 m_responseModifierFlags;
 | 
			
		||||
    hkUint32 m_uid;
 | 
			
		||||
    SpuCollisionCallback m_spuCollisionCallback;
 | 
			
		||||
    hkpMaxSizeMotion m_motion;
 | 
			
		||||
    hkSmallArray<hkpContactListener*> m_contactListeners;
 | 
			
		||||
    hkSmallArray<hkpAction*> m_actions;
 | 
			
		||||
    hkRefPtr<hkLocalFrame> m_localFrame;
 | 
			
		||||
    mutable ExtendedListeners* m_extendedListeners;
 | 
			
		||||
    hkUint32 m_npData;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,11 +2,33 @@
 | 
			
		|||
 | 
			
		||||
#include <Havok/Physics2012/Dynamics/Entity/hkpEntity.h>
 | 
			
		||||
 | 
			
		||||
class hkpRigidBodyCinfo;
 | 
			
		||||
 | 
			
		||||
class hkpRigidBody : public hkpEntity {
 | 
			
		||||
public:
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkpRigidBody)
 | 
			
		||||
    HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
    virtual ~hkpRigidBody();
 | 
			
		||||
    hkpRigidBody(const hkpRigidBodyCinfo& info);
 | 
			
		||||
    explicit hkpRigidBody(hkFinishLoadedObjectFlag flag);
 | 
			
		||||
 | 
			
		||||
    ~hkpRigidBody() override;
 | 
			
		||||
 | 
			
		||||
    virtual hkpRigidBody* clone() const;
 | 
			
		||||
 | 
			
		||||
    void enableDeactivation(bool _enableDeactivation);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    hkMotionState* getMotionState() override;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline hkpRigidBody* hkpGetRigidBody(const hkpCollidable* collidable) {
 | 
			
		||||
    if (collidable->getType() == hkpWorldObject::BROAD_PHASE_ENTITY) {
 | 
			
		||||
        return static_cast<hkpRigidBody*>(hkpGetWorldObject(collidable));
 | 
			
		||||
    }
 | 
			
		||||
    return nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkpRigidBody* hkpGetRigidBodyUnchecked(const hkpCollidable* collidable) {
 | 
			
		||||
    return static_cast<hkpRigidBody*>(hkpGetWorldObject(collidable));
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,59 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/hkBase.h>
 | 
			
		||||
#include <Havok/Physics2012/Dynamics/Motion/hkpMotion.h>
 | 
			
		||||
 | 
			
		||||
class hkpKeyframedRigidMotion : public hkpMotion {
 | 
			
		||||
public:
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkpKeyframedRigidMotion)
 | 
			
		||||
    HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
    hkpKeyframedRigidMotion(const hkVector4& position, const hkQuaternion& rotation);
 | 
			
		||||
    explicit hkpKeyframedRigidMotion(hkFinishLoadedObjectFlag flag) : hkpMotion(flag) {}
 | 
			
		||||
    ~hkpKeyframedRigidMotion() override;
 | 
			
		||||
 | 
			
		||||
    void setMass(hkReal m) override;
 | 
			
		||||
    void setMass(hkSimdRealParameter m) override;
 | 
			
		||||
 | 
			
		||||
    void setMassInv(hkReal mInv) override;
 | 
			
		||||
    void setMassInv(hkSimdRealParameter mInv) override;
 | 
			
		||||
 | 
			
		||||
    void getInertiaLocal(hkMatrix3& inertia) const override;
 | 
			
		||||
    void setInertiaLocal(const hkMatrix3& inertia) override;
 | 
			
		||||
    void getInertiaWorld(hkMatrix3& inertiaOut) const override;
 | 
			
		||||
    void setInertiaInvLocal(const hkMatrix3& inertiaInv) override;
 | 
			
		||||
    void getInertiaInvLocal(hkMatrix3& inertiaInv) const override;
 | 
			
		||||
    void getInertiaInvWorld(hkMatrix3& inertiaInvOut) const override;
 | 
			
		||||
 | 
			
		||||
    void getProjectedPointVelocity(const hkVector4& p, const hkVector4& normal, hkReal& velOut,
 | 
			
		||||
                                   hkReal& invVirtMassOut) const override;
 | 
			
		||||
    void getProjectedPointVelocitySimd(const hkVector4& p, const hkVector4& normal,
 | 
			
		||||
                                       hkSimdReal& velOut,
 | 
			
		||||
                                       hkSimdReal& invVirtMassOut) const override;
 | 
			
		||||
 | 
			
		||||
    void applyLinearImpulse(const hkVector4& imp) override;
 | 
			
		||||
    void applyPointImpulse(const hkVector4& imp, const hkVector4& p) override;
 | 
			
		||||
    void applyAngularImpulse(const hkVector4& imp) override;
 | 
			
		||||
 | 
			
		||||
    void applyForce(const hkReal deltaTime, const hkVector4& force) override;
 | 
			
		||||
    void applyForce(const hkReal deltaTime, const hkVector4& force, const hkVector4& p) override;
 | 
			
		||||
    void applyTorque(const hkReal deltaTime, const hkVector4& torque) override;
 | 
			
		||||
 | 
			
		||||
    virtual void setStepPosition(hkReal position, hkReal timestep);
 | 
			
		||||
    virtual void setStoredMotion(hkpMaxSizeMotion* savedMotion);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    hkpKeyframedRigidMotion() : hkpMotion() { m_savedMotion = nullptr; }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class hkpMaxSizeMotion : public hkpKeyframedRigidMotion {
 | 
			
		||||
public:
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkpMaxSizeMotion)
 | 
			
		||||
    HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
    hkpMaxSizeMotion() : hkpKeyframedRigidMotion() {}
 | 
			
		||||
    explicit hkpMaxSizeMotion(hkFinishLoadedObjectFlag flag) : hkpKeyframedRigidMotion(flag) {}
 | 
			
		||||
 | 
			
		||||
    hkpMaxSizeMotion(const hkpMaxSizeMotion&) = delete;
 | 
			
		||||
    auto operator=(const hkpMaxSizeMotion&) = delete;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,97 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/Types/Physics/MotionState/hkMotionState.h>
 | 
			
		||||
#include <Havok/Common/Base/hkBase.h>
 | 
			
		||||
 | 
			
		||||
class hkpMaxSizeMotion;
 | 
			
		||||
 | 
			
		||||
class hkpMotion : public hkReferencedObject {
 | 
			
		||||
public:
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkpMotion)
 | 
			
		||||
    HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
    enum MotionType {
 | 
			
		||||
        MOTION_INVALID,
 | 
			
		||||
        MOTION_DYNAMIC,
 | 
			
		||||
        MOTION_SPHERE_INERTIA,
 | 
			
		||||
        MOTION_BOX_INERTIA,
 | 
			
		||||
        MOTION_KEYFRAMED,
 | 
			
		||||
        MOTION_FIXED,
 | 
			
		||||
        MOTION_THIN_BOX_INERTIA,
 | 
			
		||||
        MOTION_CHARACTER,
 | 
			
		||||
        MOTION_MAX_ID
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    enum { NUM_INACTIVE_FRAMES_TO_DEACTIVATE = 5 };
 | 
			
		||||
 | 
			
		||||
    hkpMotion();
 | 
			
		||||
    hkpMotion(const hkVector4& position, const hkQuaternion& rotation,
 | 
			
		||||
              bool wantDeactivation = false);
 | 
			
		||||
    explicit hkpMotion(hkFinishLoadedObjectFlag flag) : hkReferencedObject(flag) {
 | 
			
		||||
        if (flag.m_finishing) {
 | 
			
		||||
            m_gravityFactor.setOne();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    inline MotionType getType() const { return m_type; }
 | 
			
		||||
 | 
			
		||||
    virtual void setMass(hkReal m);
 | 
			
		||||
    virtual void setMass(hkSimdRealParameter m);
 | 
			
		||||
 | 
			
		||||
    virtual void setMassInv(hkReal mInv);
 | 
			
		||||
    virtual void setMassInv(hkSimdRealParameter mInv);
 | 
			
		||||
 | 
			
		||||
    virtual void getInertiaLocal(hkMatrix3& inertiaOut) const = 0;
 | 
			
		||||
    virtual void getInertiaWorld(hkMatrix3& inertiaOut) const = 0;
 | 
			
		||||
    virtual void setInertiaLocal(const hkMatrix3& inertia) = 0;
 | 
			
		||||
    virtual void setInertiaInvLocal(const hkMatrix3& inertiaInv) = 0;
 | 
			
		||||
    virtual void getInertiaInvLocal(hkMatrix3& inertiaInvOut) const = 0;
 | 
			
		||||
    virtual void getInertiaInvWorld(hkMatrix3& inertiaInvOut) const = 0;
 | 
			
		||||
    virtual void setCenterOfMassInLocal(const hkVector4& centerOfMass);
 | 
			
		||||
 | 
			
		||||
    virtual void setPosition(const hkVector4& position);
 | 
			
		||||
 | 
			
		||||
    virtual void setRotation(const hkQuaternion& rotation);
 | 
			
		||||
 | 
			
		||||
    virtual void setPositionAndRotation(const hkVector4& position, const hkQuaternion& rotation);
 | 
			
		||||
 | 
			
		||||
    virtual void setTransform(const hkTransform& transform);
 | 
			
		||||
 | 
			
		||||
    virtual void setLinearVelocity(const hkVector4& newVel);
 | 
			
		||||
    virtual void setAngularVelocity(const hkVector4& newVel);
 | 
			
		||||
    virtual void getProjectedPointVelocity(const hkVector4& p, const hkVector4& normal,
 | 
			
		||||
                                           hkReal& velOut, hkReal& invVirtMassOut) const = 0;
 | 
			
		||||
    virtual void getProjectedPointVelocitySimd(const hkVector4& p, const hkVector4& normal,
 | 
			
		||||
                                               hkSimdReal& velOut,
 | 
			
		||||
                                               hkSimdReal& invVirtMassOut) const = 0;
 | 
			
		||||
 | 
			
		||||
    virtual void applyLinearImpulse(const hkVector4& imp);
 | 
			
		||||
    virtual void applyPointImpulse(const hkVector4& imp, const hkVector4& p) = 0;
 | 
			
		||||
    virtual void applyAngularImpulse(const hkVector4& imp) = 0;
 | 
			
		||||
 | 
			
		||||
    virtual void applyForce(hkReal deltaTime, const hkVector4& force) = 0;
 | 
			
		||||
    virtual void applyForce(hkReal deltaTime, const hkVector4& force, const hkVector4& p) = 0;
 | 
			
		||||
    virtual void applyTorque(hkReal deltaTime, const hkVector4& torque) = 0;
 | 
			
		||||
 | 
			
		||||
    virtual void getMotionStateAndVelocitiesAndDeactivationType(hkpMotion* motionOut);
 | 
			
		||||
 | 
			
		||||
    hkEnum<MotionType, hkUint8> m_type;
 | 
			
		||||
    hkUint8 m_deactivationIntegrateCounter;
 | 
			
		||||
    hkUint16 m_deactivationNumInactiveFrames[2];
 | 
			
		||||
    hkMotionState m_motionState;
 | 
			
		||||
    hkVector4 m_inertiaAndMassInv;
 | 
			
		||||
    hkVector4 m_linearVelocity;
 | 
			
		||||
    hkVector4 m_angularVelocity;
 | 
			
		||||
    hkVector4 m_deactivationRefPosition[2];
 | 
			
		||||
    hkUint32 m_deactivationRefOrientation[2];
 | 
			
		||||
    hkpMaxSizeMotion* m_savedMotion;
 | 
			
		||||
    hkUint16 m_savedQualityTypeIndex;
 | 
			
		||||
    hkHalf m_gravityFactor;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class hkpRigidMotion : public hkpMotion {
 | 
			
		||||
public:
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkpRigidMotion)
 | 
			
		||||
 | 
			
		||||
    explicit hkpRigidMotion(hkFinishLoadedObjectFlag flag) : hkpMotion(flag) {}
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -2,7 +2,6 @@
 | 
			
		|||
 | 
			
		||||
#include <Havok/Common/Base/hkBase.h>
 | 
			
		||||
 | 
			
		||||
class hkTransform;
 | 
			
		||||
class hkpRigidBody;
 | 
			
		||||
class hkpConstraintInstance;
 | 
			
		||||
class hkpAction;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,21 +0,0 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Physics2012/Collide/Shape/hkpShape.h>
 | 
			
		||||
 | 
			
		||||
class hkpWorldEntity : public hkReferencedObject {
 | 
			
		||||
public:
 | 
			
		||||
    virtual ~hkpWorldEntity() {}
 | 
			
		||||
 | 
			
		||||
    void setUserData(void* data) { m_userData = data; }
 | 
			
		||||
 | 
			
		||||
    void setName(const char* name) { m_name = name; }
 | 
			
		||||
 | 
			
		||||
    /*       */ hkUchar _8[0x18 - 0x8];
 | 
			
		||||
    /* 0x018 */ void* m_userData;
 | 
			
		||||
    /*       */ hkUchar _20[0x88 - 0x20];
 | 
			
		||||
    /* 0x088 */ hkReal _88;
 | 
			
		||||
    /*       */ hkUchar _8c[0xb0 - 0x8c];
 | 
			
		||||
    /* 0x0b0 */ hkStringPtr m_name;
 | 
			
		||||
    /*       */ hkUchar _b8[0x132 - 0xb8];
 | 
			
		||||
    /* 0x132 */ hkUchar _132;
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -1,11 +1,24 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
#include <Havok/Common/Base/DebugUtil/MultiThreadCheck/hkMultiThreadCheck.h>
 | 
			
		||||
#include <Havok/Common/Base/hkBase.h>
 | 
			
		||||
#include <Havok/Physics2012/Collide/Agent3/Machine/Nn/hkpLinkedCollidable.h>
 | 
			
		||||
#include <Havok/Physics2012/Dynamics/Common/hkpProperty.h>
 | 
			
		||||
 | 
			
		||||
class hkpShapeModifier;
 | 
			
		||||
class hkpWorld;
 | 
			
		||||
 | 
			
		||||
namespace hkWorldOperation {
 | 
			
		||||
enum Result {
 | 
			
		||||
    POSTPONED,
 | 
			
		||||
    DONE,
 | 
			
		||||
};
 | 
			
		||||
}  // namespace hkWorldOperation
 | 
			
		||||
 | 
			
		||||
// FIXME: incomplete
 | 
			
		||||
class hkpWorldObject : public hkReferencedObject {
 | 
			
		||||
public:
 | 
			
		||||
    HK_DECLARE_CLASS_ALLOCATOR(hkpWorldObject)
 | 
			
		||||
    HK_DECLARE_REFLECTION()
 | 
			
		||||
 | 
			
		||||
    enum BroadPhaseType {
 | 
			
		||||
        BROAD_PHASE_INVALID,
 | 
			
		||||
| 
						 | 
				
			
			@ -17,4 +30,177 @@ public:
 | 
			
		|||
        BROAD_PHASE_BORDER,
 | 
			
		||||
        BROAD_PHASE_MAX_ID
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    enum MtChecks {
 | 
			
		||||
        MULTI_THREADING_CHECKS_ENABLE,
 | 
			
		||||
        MULTI_THREADING_CHECKS_IGNORE,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    explicit hkpWorldObject(hkFinishLoadedObjectFlag flag);
 | 
			
		||||
 | 
			
		||||
    void addProperty(hkUint32 key, hkpPropertyValue value);
 | 
			
		||||
    hkpPropertyValue removeProperty(hkUint32 key);
 | 
			
		||||
    void setProperty(hkUint32 key, hkpPropertyValue value);
 | 
			
		||||
    void editProperty(hkUint32 key, hkpPropertyValue value,
 | 
			
		||||
                      MtChecks mtCheck = MULTI_THREADING_CHECKS_ENABLE);
 | 
			
		||||
    inline hkpPropertyValue getProperty(hkUint32 key,
 | 
			
		||||
                                        MtChecks mtCheck = MULTI_THREADING_CHECKS_ENABLE) const;
 | 
			
		||||
    inline bool hasProperty(hkUint32 key, MtChecks mtCheck = MULTI_THREADING_CHECKS_ENABLE) const;
 | 
			
		||||
    void lockProperty(hkUint32 key);
 | 
			
		||||
    void unlockProperty(hkUint32 key);
 | 
			
		||||
    inline void clearAndDeallocateProperties();
 | 
			
		||||
 | 
			
		||||
    inline hkpCollidable* getCollidableRw();
 | 
			
		||||
    inline const hkpCollidable* getCollidable() const;
 | 
			
		||||
    inline hkpLinkedCollidable* getLinkedCollidable();
 | 
			
		||||
    inline const hkpLinkedCollidable* getLinkedCollidable() const;
 | 
			
		||||
    inline const hkpLinkedCollidable* getCollidableMtUnchecked() const;
 | 
			
		||||
 | 
			
		||||
    inline hkBool isAddedToWorld() const;
 | 
			
		||||
    inline hkpWorld* getWorld() const;
 | 
			
		||||
 | 
			
		||||
    inline hkUlong getUserData() const;
 | 
			
		||||
    inline void setUserData(hkUlong data);
 | 
			
		||||
 | 
			
		||||
    inline const char* getName() const;
 | 
			
		||||
    inline void setName(const char* name);
 | 
			
		||||
 | 
			
		||||
    virtual hkWorldOperation::Result setShape(const hkpShape* shape);
 | 
			
		||||
    virtual hkWorldOperation::Result updateShape(hkpShapeModifier* shapeModifier);
 | 
			
		||||
 | 
			
		||||
    inline hkMultiThreadCheck& getMultiThreadCheck();
 | 
			
		||||
    inline void markForRead();
 | 
			
		||||
    inline void markForWrite();
 | 
			
		||||
    void markForWriteImpl();
 | 
			
		||||
    inline void unmarkForRead();
 | 
			
		||||
    inline void unmarkForWrite();
 | 
			
		||||
 | 
			
		||||
    void checkReadWrite();
 | 
			
		||||
    void checkReadOnly() const;
 | 
			
		||||
 | 
			
		||||
    inline ~hkpWorldObject() override;
 | 
			
		||||
 | 
			
		||||
    virtual class hkMotionState* getMotionState() = 0;
 | 
			
		||||
 | 
			
		||||
    inline void copyProperties(const hkpWorldObject* otherObj);
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
    friend class hkpWorld;
 | 
			
		||||
    friend class hkpWorldOperationUtil;
 | 
			
		||||
    inline void setWorld(hkpWorld* world);
 | 
			
		||||
 | 
			
		||||
    hkpWorldObject(const hkpShape* shape, BroadPhaseType type);
 | 
			
		||||
 | 
			
		||||
    hkpWorld* m_world;
 | 
			
		||||
    hkUlong m_userData;
 | 
			
		||||
    hkpLinkedCollidable m_collidable;
 | 
			
		||||
    hkMultiThreadCheck m_multiThreadCheck;
 | 
			
		||||
    hkStringPtr m_name;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
    hkArray<hkpProperty> m_properties;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline hkpWorldObject* hkpGetWorldObject(const hkpCollidable* collidable) {
 | 
			
		||||
    return reinterpret_cast<hkpWorldObject*>(const_cast<void*>(collidable->getOwner()));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkpPropertyValue hkpWorldObject::getProperty(hkUint32 key, hkpWorldObject::MtChecks) const {
 | 
			
		||||
    for (int i = 0; i < m_properties.getSize(); ++i) {
 | 
			
		||||
        if (m_properties[i].m_key == key) {
 | 
			
		||||
            return m_properties[i].m_value;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline bool hkpWorldObject::hasProperty(hkUint32 key, hkpWorldObject::MtChecks) const {
 | 
			
		||||
    for (int i = 0; i < m_properties.getSize(); ++i) {
 | 
			
		||||
        if (m_properties[i].m_key == key) {
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkpWorldObject::clearAndDeallocateProperties() {
 | 
			
		||||
    m_properties.clearAndDeallocate();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkpCollidable* hkpWorldObject::getCollidableRw() {
 | 
			
		||||
    return &m_collidable;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline const hkpCollidable* hkpWorldObject::getCollidable() const {
 | 
			
		||||
    return &m_collidable;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkpLinkedCollidable* hkpWorldObject::getLinkedCollidable() {
 | 
			
		||||
    return &m_collidable;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline const hkpLinkedCollidable* hkpWorldObject::getLinkedCollidable() const {
 | 
			
		||||
    return &m_collidable;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline const hkpLinkedCollidable* hkpWorldObject::getCollidableMtUnchecked() const {
 | 
			
		||||
    return &m_collidable;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkBool hkpWorldObject::isAddedToWorld() const {
 | 
			
		||||
    return m_world != nullptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkpWorld* hkpWorldObject::getWorld() const {
 | 
			
		||||
    return m_world;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkUlong hkpWorldObject::getUserData() const {
 | 
			
		||||
    return m_userData;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkpWorldObject::setUserData(hkUlong data) {
 | 
			
		||||
    m_userData = data;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline const char* hkpWorldObject::getName() const {
 | 
			
		||||
    return m_name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkpWorldObject::setName(const char* name) {
 | 
			
		||||
    m_name = name;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkMultiThreadCheck& hkpWorldObject::getMultiThreadCheck() {
 | 
			
		||||
    return m_multiThreadCheck;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkpWorldObject::markForRead() {
 | 
			
		||||
    getMultiThreadCheck().markForRead();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkpWorldObject::markForWrite() {
 | 
			
		||||
    getMultiThreadCheck().markForWrite();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkpWorldObject::unmarkForRead() {
 | 
			
		||||
    getMultiThreadCheck().unmarkForRead();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkpWorldObject::unmarkForWrite() {
 | 
			
		||||
    getMultiThreadCheck().unmarkForWrite();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline hkpWorldObject::~hkpWorldObject() {
 | 
			
		||||
    if (m_collidable.getShape()) {
 | 
			
		||||
        m_collidable.getShape()->removeReference();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkpWorldObject::copyProperties(const hkpWorldObject* otherObj) {
 | 
			
		||||
    m_properties = otherObj->m_properties;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
inline void hkpWorldObject::setWorld(hkpWorld* world) {
 | 
			
		||||
    m_world = world;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,13 +11,13 @@ RigidBody::RigidBody(u32 a, u32 mass_scaling, hkpRigidBody* hk_body, const sead:
 | 
			
		|||
    if (!name.isEmpty()) {
 | 
			
		||||
        hk_body->setName(name.cstr());
 | 
			
		||||
    }
 | 
			
		||||
    hk_body->setUserData(this);
 | 
			
		||||
    hk_body->m_motion._128 = nullptr;
 | 
			
		||||
    hk_body->m_motion.m_motionState__m_timeFactor.setOne();
 | 
			
		||||
    hk_body->setUserData(reinterpret_cast<hkUlong>(this));
 | 
			
		||||
    hk_body->m_motion.m_savedMotion = nullptr;
 | 
			
		||||
    hk_body->m_motion.m_motionState.m_timeFactor.setOne();
 | 
			
		||||
    hk_body->enableDeactivation(true);
 | 
			
		||||
    hk_body->_88 = 0.1f;
 | 
			
		||||
    hk_body->getCollidableRw()->m_allowedPenetrationDepth = 0.1f;
 | 
			
		||||
    if (mFlags.isOn(Flag1::MassScaling)) {
 | 
			
		||||
        hk_body->_132 |= 1;
 | 
			
		||||
        hk_body->m_responseModifierFlags |= 1;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    mFlags.change(Flag1::_80, _b4 == 5);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue