Havok: Add hkpShapeRayCastOutput

This commit is contained in:
Léo Lam 2022-02-02 10:21:35 +01:00
parent 1a9e217dc1
commit 5861ce0011
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
3 changed files with 84 additions and 0 deletions

View File

@ -120,6 +120,7 @@ add_library(hkStubs OBJECT
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/hkpShapeRayCastCollectorOutput.h
Havok/Physics2012/Collide/Shape/Query/hkpShapeRayCastInput.h
Havok/Physics2012/Collide/Util/Welding/hkpWeldingUtility.h

View File

@ -0,0 +1,31 @@
#pragma once
#include <Havok/Common/Base/hkBase.h>
struct hkpShapeRayCastCollectorOutput {
HK_DECLARE_CLASS_ALLOCATOR(hkpShapeRayCastCollectorOutput)
inline hkpShapeRayCastCollectorOutput();
inline hkBool hasHit() const;
inline void reset();
hkVector4 m_normal;
hkReal m_hitFraction;
int m_extraInfo;
int m_pad[2];
};
inline hkpShapeRayCastCollectorOutput::hkpShapeRayCastCollectorOutput() {
reset();
}
inline hkBool hkpShapeRayCastCollectorOutput::hasHit() const {
return m_hitFraction < 1.0f;
}
inline void hkpShapeRayCastCollectorOutput::reset() {
m_hitFraction = 1.0f;
m_extraInfo = -1;
}

View File

@ -0,0 +1,52 @@
#pragma once
#include <Havok/Physics2012/Collide/Shape/Query/hkpShapeRayCastCollectorOutput.h>
#include <Havok/Physics2012/Collide/Shape/hkpShape.h>
#include <Havok/Physics2012/Collide/Shape/hkpShapeBase.h>
struct hkpShapeRayCastOutput : public hkpShapeRayCastCollectorOutput {
HK_DECLARE_CLASS_ALLOCATOR(hkpShapeRayCastOutput)
static constexpr int MAX_HIERARCHY_DEPTH = 8;
HK_FORCE_INLINE hkpShapeRayCastOutput();
HK_FORCE_INLINE void changeLevel(int delta);
HK_FORCE_INLINE void setKey(hkpShapeKey key);
HK_FORCE_INLINE int getLevel() const;
HK_FORCE_INLINE void reset();
hkpShapeKey m_shapeKeys[MAX_HIERARCHY_DEPTH];
private:
HK_FORCE_INLINE void _reset();
int m_shapeKeyIndex;
};
inline hkpShapeRayCastOutput::hkpShapeRayCastOutput() {
_reset();
}
inline void hkpShapeRayCastOutput::changeLevel(int delta) {
m_shapeKeyIndex += delta;
}
inline void hkpShapeRayCastOutput::setKey(hkpShapeKey key) {
m_shapeKeys[m_shapeKeyIndex] = key;
}
inline int hkpShapeRayCastOutput::getLevel() const {
return m_shapeKeyIndex;
}
inline void hkpShapeRayCastOutput::reset() {
hkpShapeRayCastCollectorOutput::reset();
_reset();
}
inline void hkpShapeRayCastOutput::_reset() {
m_shapeKeyIndex = 0;
m_shapeKeys[0] = HK_INVALID_SHAPE_KEY;
}