mirror of https://github.com/zeldaret/botw.git
Havok: Add hkpAgentNnTrack stub
This commit is contained in:
parent
0c734c4cbd
commit
4935a8c950
|
@ -77,6 +77,7 @@ add_library(hkStubs OBJECT
|
||||||
Havok/Physics2012/Collide/Agent/Collidable/hkpCollidable.h
|
Havok/Physics2012/Collide/Agent/Collidable/hkpCollidable.h
|
||||||
Havok/Physics2012/Collide/Agent/Collidable/hkpCollidableQualityType.h
|
Havok/Physics2012/Collide/Agent/Collidable/hkpCollidableQualityType.h
|
||||||
Havok/Physics2012/Collide/Agent3/BvTree3/hkpBvTreeAgent3.h
|
Havok/Physics2012/Collide/Agent3/BvTree3/hkpBvTreeAgent3.h
|
||||||
|
Havok/Physics2012/Collide/Agent3/Machine/Nn/hkpAgentNnTrack.h
|
||||||
Havok/Physics2012/Collide/Agent3/Machine/Nn/hkpLinkedCollidable.h
|
Havok/Physics2012/Collide/Agent3/Machine/Nn/hkpLinkedCollidable.h
|
||||||
Havok/Physics2012/Collide/BroadPhase/hkpBroadPhaseHandle.h
|
Havok/Physics2012/Collide/BroadPhase/hkpBroadPhaseHandle.h
|
||||||
Havok/Physics2012/Collide/BroadPhase/hkpTypedBroadPhaseHandle.h
|
Havok/Physics2012/Collide/BroadPhase/hkpTypedBroadPhaseHandle.h
|
||||||
|
|
|
@ -122,6 +122,27 @@ protected:
|
||||||
HK_FORCE_INLINE hkArray(const hkArray& other);
|
HK_FORCE_INLINE hkArray(const hkArray& other);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T, unsigned N, typename Allocator = hkContainerHeapAllocator>
|
||||||
|
class hkInplaceArray : public hkArray<T, Allocator> {
|
||||||
|
public:
|
||||||
|
HK_DECLARE_CLASS_ALLOCATOR(hkInplaceArray)
|
||||||
|
|
||||||
|
HK_FORCE_INLINE explicit hkInplaceArray(int size = 0);
|
||||||
|
HK_FORCE_INLINE hkInplaceArray(const hkInplaceArray& other);
|
||||||
|
explicit hkInplaceArray(hkFinishLoadedObjectFlag f) : hkArray<T, Allocator>(f) {}
|
||||||
|
HK_FORCE_INLINE ~hkInplaceArray() = default;
|
||||||
|
|
||||||
|
using hkArray<T, Allocator>::operator=;
|
||||||
|
|
||||||
|
HK_FORCE_INLINE void optimizeCapacity(int numFreeElemsLeft, hkBool32 shrinkExact = false);
|
||||||
|
|
||||||
|
HK_FORCE_INLINE hkBool wasReallocated() const;
|
||||||
|
|
||||||
|
HK_FORCE_INLINE int stillInplaceUsingMask() const;
|
||||||
|
|
||||||
|
T m_storage[N];
|
||||||
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline hkArrayBase<T>::hkArrayBase()
|
inline hkArrayBase<T>::hkArrayBase()
|
||||||
: m_data(nullptr), m_size(0), m_capacityAndFlags(DONT_DEALLOCATE_FLAG) {}
|
: m_data(nullptr), m_size(0), m_capacityAndFlags(DONT_DEALLOCATE_FLAG) {}
|
||||||
|
@ -358,3 +379,23 @@ template <typename T, typename Allocator>
|
||||||
inline void hkArray<T, Allocator>::pushBack(const T& e) {
|
inline void hkArray<T, Allocator>::pushBack(const T& e) {
|
||||||
this->_pushBack(AllocatorType().get(), e);
|
this->_pushBack(AllocatorType().get(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, unsigned N, typename Allocator>
|
||||||
|
inline hkInplaceArray<T, N, Allocator>::hkInplaceArray(int size)
|
||||||
|
: hkArray<T, Allocator>(m_storage, size, N) {}
|
||||||
|
|
||||||
|
template <typename T, unsigned N, typename Allocator>
|
||||||
|
inline hkInplaceArray<T, N, Allocator>::hkInplaceArray(const hkInplaceArray& other)
|
||||||
|
: hkArray<T, Allocator>(m_storage, 0, N) {
|
||||||
|
*this = other;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, unsigned N, typename Allocator>
|
||||||
|
inline hkBool hkInplaceArray<T, N, Allocator>::wasReallocated() const {
|
||||||
|
return this->m_data != m_storage;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, unsigned N, typename Allocator>
|
||||||
|
inline int hkInplaceArray<T, N, Allocator>::stillInplaceUsingMask() const {
|
||||||
|
return hkArray<T, Allocator>::m_capacityAndFlags & hkArrayBase<T>::DONT_DEALLOCATE_FLAG;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Havok/Common/Base/hkBase.h>
|
||||||
|
|
||||||
|
#define HK_AGENT3_MIDPHASE_AGENT_SIZE 80
|
||||||
|
#define HK_AGENT3_NARROWPHASE_AGENT_SIZE 160
|
||||||
|
#define HK_AGENT3_MAX_AGENT_SIZE 160
|
||||||
|
#define HK_AGENT3_SECTOR_SIZE 960
|
||||||
|
|
||||||
|
struct hkpAgentNnEntry;
|
||||||
|
|
||||||
|
enum hkpAgentNnTrackType {
|
||||||
|
HK_AGENT3_INVALID_TRACK = 0,
|
||||||
|
HK_AGENT3_MIDPHASE_TRACK = 1,
|
||||||
|
HK_AGENT3_NARROWPHASE_TRACK = 2,
|
||||||
|
};
|
||||||
|
|
||||||
|
struct hkpAgentNnSector {
|
||||||
|
HK_DECLARE_CLASS_ALLOCATOR(hkpAgentNnSector)
|
||||||
|
|
||||||
|
hkpAgentNnEntry* getBegin() { return reinterpret_cast<hkpAgentNnEntry*>(m_data); }
|
||||||
|
|
||||||
|
hkpAgentNnEntry* getEnd() {
|
||||||
|
return reinterpret_cast<hkpAgentNnEntry*>(m_data + HK_AGENT3_SECTOR_SIZE);
|
||||||
|
}
|
||||||
|
|
||||||
|
hkUint8 m_data[HK_AGENT3_SECTOR_SIZE];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct hkpAgentNnTrack {
|
||||||
|
HK_DECLARE_CLASS_ALLOCATOR(hkpAgentNnTrack)
|
||||||
|
|
||||||
|
explicit hkpAgentNnTrack(hkpAgentNnTrackType nnTrackType) {
|
||||||
|
m_bytesUsedInLastSector = HK_AGENT3_SECTOR_SIZE;
|
||||||
|
m_nnTrackType = nnTrackType;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getSectorSize(int sectorIndex) const;
|
||||||
|
HK_FORCE_INLINE static unsigned int getAgentSize(hkpAgentNnTrackType nnTrackType);
|
||||||
|
HK_FORCE_INLINE unsigned int getAgentSize() const;
|
||||||
|
|
||||||
|
hkUint16 m_bytesUsedInLastSector;
|
||||||
|
|
||||||
|
/// Does the track contain midphase or narrowphase agent entries?
|
||||||
|
hkEnum<hkpAgentNnTrackType, hkUint8> m_nnTrackType;
|
||||||
|
hkUint8 m_padding;
|
||||||
|
|
||||||
|
hkInplaceArray<hkpAgentNnSector*, 1> m_sectors;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline int hkpAgentNnTrack::getSectorSize(int sectorIndex) const {
|
||||||
|
if (sectorIndex + 1 == m_sectors.getSize()) {
|
||||||
|
return m_bytesUsedInLastSector;
|
||||||
|
}
|
||||||
|
return HK_AGENT3_SECTOR_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline unsigned int hkpAgentNnTrack::getAgentSize(hkpAgentNnTrackType nnTrackType) {
|
||||||
|
return nnTrackType * HK_AGENT3_MIDPHASE_AGENT_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline unsigned int hkpAgentNnTrack::getAgentSize() const {
|
||||||
|
return getAgentSize(m_nnTrackType);
|
||||||
|
}
|
Loading…
Reference in New Issue