mirror of https://github.com/zeldaret/botw.git
Havok: Add hkpEntity getters/setters
This commit is contained in:
parent
16ae321058
commit
674ff09c54
|
@ -28,6 +28,9 @@ public:
|
||||||
HK_FORCE_INLINE int getSize() const;
|
HK_FORCE_INLINE int getSize() const;
|
||||||
HK_FORCE_INLINE int getCapacity() const;
|
HK_FORCE_INLINE int getCapacity() const;
|
||||||
|
|
||||||
|
HK_FORCE_INLINE T& operator[](int i);
|
||||||
|
HK_FORCE_INLINE const T& operator[](int i) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void releaseMemory();
|
void releaseMemory();
|
||||||
|
|
||||||
|
@ -55,6 +58,16 @@ inline int hkSmallArray<T>::getCapacity() const {
|
||||||
return m_capacityAndFlags & CAPACITY_MASK;
|
return m_capacityAndFlags & CAPACITY_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
inline T& hkSmallArray<T>::operator[](int i) {
|
||||||
|
return m_data[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
inline const T& hkSmallArray<T>::operator[](int i) const {
|
||||||
|
return m_data[i];
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void hkSmallArray<T>::releaseMemory() {
|
inline void hkSmallArray<T>::releaseMemory() {
|
||||||
if ((m_capacityAndFlags & DONT_DEALLOCATE_FLAG) == 0)
|
if ((m_capacityAndFlags & DONT_DEALLOCATE_FLAG) == 0)
|
||||||
|
|
|
@ -12,6 +12,7 @@ class hkpAction;
|
||||||
class hkpBreakableBody;
|
class hkpBreakableBody;
|
||||||
class hkpConstraintInstance;
|
class hkpConstraintInstance;
|
||||||
class hkpContactListener;
|
class hkpContactListener;
|
||||||
|
class hkpDynamicsContactMgr;
|
||||||
class hkpEntityActivationListener;
|
class hkpEntityActivationListener;
|
||||||
class hkpEntityListener;
|
class hkpEntityListener;
|
||||||
class hkpSimulationIsland;
|
class hkpSimulationIsland;
|
||||||
|
@ -67,6 +68,70 @@ public:
|
||||||
explicit hkpEntity(hkFinishLoadedObjectFlag flag);
|
explicit hkpEntity(hkFinishLoadedObjectFlag flag);
|
||||||
~hkpEntity() override;
|
~hkpEntity() override;
|
||||||
|
|
||||||
|
void addEntityListener(hkpEntityListener* el);
|
||||||
|
void removeEntityListener(hkpEntityListener* el);
|
||||||
|
|
||||||
|
void addEntityActivationListener(hkpEntityActivationListener* el);
|
||||||
|
void removeEntityActivationListener(hkpEntityActivationListener* el);
|
||||||
|
|
||||||
|
void addContactListener(hkpContactListener* cl);
|
||||||
|
void removeContactListener(hkpContactListener* cl);
|
||||||
|
|
||||||
|
inline const hkSmallArray<hkpEntityListener*>& getEntityListeners() const;
|
||||||
|
inline const hkSmallArray<hkpEntityActivationListener*>& getEntityActivationListeners() const;
|
||||||
|
inline const hkSmallArray<hkpContactListener*>& getContactListeners() const;
|
||||||
|
inline bool areContactListenersAdded() const;
|
||||||
|
|
||||||
|
inline hkUint16 getContactPointCallbackDelay() const;
|
||||||
|
inline void setContactPointCallbackDelay(hkUint16 delay);
|
||||||
|
|
||||||
|
inline hkpMaterial& getMaterial();
|
||||||
|
inline const hkpMaterial& getMaterial() const;
|
||||||
|
|
||||||
|
inline hkBool isFixed() const;
|
||||||
|
inline hkBool isFixedOrKeyframed() const;
|
||||||
|
inline hkUint32 getUid() const;
|
||||||
|
|
||||||
|
hkpDynamicsContactMgr* findContactMgrTo(const hkpEntity* entity) const;
|
||||||
|
|
||||||
|
hkpBreakableBody* getBreakableBody() const;
|
||||||
|
|
||||||
|
void activate();
|
||||||
|
void requestDeactivation();
|
||||||
|
void deactivate();
|
||||||
|
void activateAsCriticalOperation();
|
||||||
|
void requestDeactivationAsCriticalOperation();
|
||||||
|
void deactivateAsCriticalOperation();
|
||||||
|
hkBool isActive() const;
|
||||||
|
|
||||||
|
inline int getNumActions() const;
|
||||||
|
inline hkpAction* getAction(int i);
|
||||||
|
|
||||||
|
int getNumConstraints() const;
|
||||||
|
hkpConstraintInstance* getConstraint(int i);
|
||||||
|
void getAllConstraints(hkArray<hkpConstraintInstance*>& constraints);
|
||||||
|
const hkpConstraintInstance* getConstraint(int i) const;
|
||||||
|
inline const hkSmallArray<struct hkConstraintInternal>& getConstraintMasters() const;
|
||||||
|
inline hkSmallArray<struct hkConstraintInternal>& getConstraintMastersRw();
|
||||||
|
inline const hkArray<class hkpConstraintInstance*>& getConstraintSlaves() const;
|
||||||
|
|
||||||
|
void sortConstraintsSlavesDeterministically();
|
||||||
|
|
||||||
|
void setCachedShapeData(const hkpWorld* world, const hkpShape* shape);
|
||||||
|
|
||||||
|
void updateCachedAabb();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
const hkSmallArray<struct hkConstraintInternal>& getConstraintMastersImpl() const;
|
||||||
|
hkSmallArray<struct hkConstraintInternal>& getConstraintMastersRwImpl();
|
||||||
|
const hkArray<class hkpConstraintInstance*>& getConstraintSlavesImpl() const;
|
||||||
|
|
||||||
|
explicit hkpEntity(const hkpShape* shape);
|
||||||
|
|
||||||
|
public:
|
||||||
|
inline hkpMotion* getMotion();
|
||||||
|
inline hkpSimulationIsland* getSimulationIsland() const;
|
||||||
|
|
||||||
virtual void deallocateInternalArrays();
|
virtual void deallocateInternalArrays();
|
||||||
hkMotionState* getMotionState() override { return nullptr; }
|
hkMotionState* getMotionState() override { return nullptr; }
|
||||||
|
|
||||||
|
@ -93,3 +158,84 @@ public:
|
||||||
mutable ExtendedListeners* m_extendedListeners;
|
mutable ExtendedListeners* m_extendedListeners;
|
||||||
hkUint32 m_npData;
|
hkUint32 m_npData;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline const hkSmallArray<hkpEntityListener*>& hkpEntity::getEntityListeners() const {
|
||||||
|
if (!m_extendedListeners)
|
||||||
|
m_extendedListeners = new ExtendedListeners;
|
||||||
|
return m_extendedListeners->m_entityListeners;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const hkSmallArray<hkpEntityActivationListener*>&
|
||||||
|
hkpEntity::getEntityActivationListeners() const {
|
||||||
|
if (!m_extendedListeners)
|
||||||
|
m_extendedListeners = new ExtendedListeners;
|
||||||
|
return m_extendedListeners->m_activationListeners;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const hkSmallArray<hkpContactListener*>& hkpEntity::getContactListeners() const {
|
||||||
|
return m_contactListeners;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool hkpEntity::areContactListenersAdded() const {
|
||||||
|
return m_contactListeners.getSize() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline hkUint16 hkpEntity::getContactPointCallbackDelay() const {
|
||||||
|
return m_contactPointCallbackDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void hkpEntity::setContactPointCallbackDelay(hkUint16 delay) {
|
||||||
|
m_contactPointCallbackDelay = delay;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline hkpMaterial& hkpEntity::getMaterial() {
|
||||||
|
return m_material;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const hkpMaterial& hkpEntity::getMaterial() const {
|
||||||
|
return m_material;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline hkBool hkpEntity::isFixed() const {
|
||||||
|
return m_motion.getType() == hkpMotion::MOTION_FIXED;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline hkBool hkpEntity::isFixedOrKeyframed() const {
|
||||||
|
return isFixed() || m_motion.getType() == hkpMotion::MOTION_KEYFRAMED;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline hkUint32 hkpEntity::getUid() const {
|
||||||
|
return m_uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline hkpBreakableBody* hkpEntity::getBreakableBody() const {
|
||||||
|
return m_breakableBody;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const hkSmallArray<struct hkConstraintInternal>& hkpEntity::getConstraintMasters() const {
|
||||||
|
return getConstraintMastersImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline hkSmallArray<struct hkConstraintInternal>& hkpEntity::getConstraintMastersRw() {
|
||||||
|
return getConstraintMastersRwImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const hkArray<class hkpConstraintInstance*>& hkpEntity::getConstraintSlaves() const {
|
||||||
|
return getConstraintSlavesImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline hkpMotion* hkpEntity::getMotion() {
|
||||||
|
return &m_motion;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline hkpSimulationIsland* hkpEntity::getSimulationIsland() const {
|
||||||
|
return m_simulationIsland;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline hkpAction* hkpEntity::getAction(int i) {
|
||||||
|
return m_actions[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int hkpEntity::getNumActions() const {
|
||||||
|
return m_actions.getSize();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue