diff --git a/lib/hkStubs/CMakeLists.txt b/lib/hkStubs/CMakeLists.txt index d4cb5892..c4f499f5 100644 --- a/lib/hkStubs/CMakeLists.txt +++ b/lib/hkStubs/CMakeLists.txt @@ -63,6 +63,7 @@ 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/Geometry/Sphere/hkSphere.h Havok/Common/Base/Types/Physics/hkStepInfo.h Havok/Common/Base/Types/Physics/ContactPoint/hkContactPointMaterial.h Havok/Common/Base/Types/Physics/MotionState/hkMotionState.h diff --git a/lib/hkStubs/Havok/Common/Base/Types/Geometry/Sphere/hkSphere.h b/lib/hkStubs/Havok/Common/Base/Types/Geometry/Sphere/hkSphere.h new file mode 100644 index 00000000..1e502f0a --- /dev/null +++ b/lib/hkStubs/Havok/Common/Base/Types/Geometry/Sphere/hkSphere.h @@ -0,0 +1,77 @@ +#pragma once + +#include + +class hkSphere { +public: + HK_DECLARE_CLASS_ALLOCATOR(hkSphere) + HK_DECLARE_REFLECTION() + + inline hkSphere(); + inline hkSphere(hkVector4Parameter pt, hkReal radius); + inline hkSphere(hkVector4Parameter pt, hkSimdRealParameter radius); + + inline hkReal getRadius() const; + inline hkSimdReal getRadiusSimdReal() const; + + inline void setRadius(hkReal newRadius); + inline void setRadius(hkSimdRealParameter newRadius); + + inline const hkVector4& getPositionAndRadius() const; + inline hkVector4& getPositionAndRadius(); + + inline void setPosition(hkVector4Parameter newPos); + inline void setPositionAndRadius(hkVector4Parameter newPos); + inline void setPositionAndRadius(hkVector4Parameter newPos, hkSimdRealParameter newRadius); + +protected: + // the radius is stored in w + hkVector4 m_pos; +}; + +inline hkSphere::hkSphere() = default; + +inline hkSphere::hkSphere(hkVector4Parameter pt, hkReal radius) { + m_pos = pt; + setRadius(radius); +} + +inline hkSphere::hkSphere(hkVector4Parameter pt, hkSimdRealParameter radius) { + m_pos.setXYZ_W(pt, radius); +} + +inline hkReal hkSphere::getRadius() const { + return m_pos(3); +} + +inline hkSimdReal hkSphere::getRadiusSimdReal() const { + return m_pos.getW(); +} + +inline void hkSphere::setRadius(hkReal newRadius) { + m_pos(3) = newRadius; +} + +inline void hkSphere::setRadius(hkSimdRealParameter newRadius) { + m_pos.setW(newRadius); +} + +inline const hkVector4& hkSphere::getPositionAndRadius() const { + return m_pos; +} + +inline hkVector4& hkSphere::getPositionAndRadius() { + return m_pos; +} + +inline void hkSphere::setPositionAndRadius(const hkVector4f& newPos) { + m_pos.setXYZ(newPos); +} + +inline void hkSphere::setPosition(const hkVector4f& newPos) { + m_pos = newPos; +} + +inline void hkSphere::setPositionAndRadius(const hkVector4f& newPos, const hkSimdReal& newRadius) { + m_pos.setXYZ_W(newPos, newRadius); +}