summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2022-01-07 19:44:59 +0100
committerLéo Lam <leo@leolam.fr>2022-01-07 19:58:20 +0100
commit674ff09c548de5fad01b43c2ccd171eadf3fd202 (patch)
tree1fbe5aa59a2d724ce268db02dc10aa8b57863a60 /lib
parent16ae321058a44be0271513ef43dad85493119c57 (diff)
Havok: Add hkpEntity getters/setters
Diffstat (limited to 'lib')
-rw-r--r--lib/hkStubs/Havok/Common/Base/Container/Array/hkSmallArray.h13
-rw-r--r--lib/hkStubs/Havok/Physics2012/Dynamics/Entity/hkpEntity.h146
2 files changed, 159 insertions, 0 deletions
diff --git a/lib/hkStubs/Havok/Common/Base/Container/Array/hkSmallArray.h b/lib/hkStubs/Havok/Common/Base/Container/Array/hkSmallArray.h
index 091c1e3e..79b27273 100644
--- a/lib/hkStubs/Havok/Common/Base/Container/Array/hkSmallArray.h
+++ b/lib/hkStubs/Havok/Common/Base/Container/Array/hkSmallArray.h
@@ -28,6 +28,9 @@ public:
HK_FORCE_INLINE int getSize() const;
HK_FORCE_INLINE int getCapacity() const;
+ HK_FORCE_INLINE T& operator[](int i);
+ HK_FORCE_INLINE const T& operator[](int i) const;
+
protected:
void releaseMemory();
@@ -56,6 +59,16 @@ inline int hkSmallArray<T>::getCapacity() const {
}
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>
inline void hkSmallArray<T>::releaseMemory() {
if ((m_capacityAndFlags & DONT_DEALLOCATE_FLAG) == 0)
hkDeallocateChunk(m_data, getCapacity());
diff --git a/lib/hkStubs/Havok/Physics2012/Dynamics/Entity/hkpEntity.h b/lib/hkStubs/Havok/Physics2012/Dynamics/Entity/hkpEntity.h
index 9afc4cdd..15d2fd68 100644
--- a/lib/hkStubs/Havok/Physics2012/Dynamics/Entity/hkpEntity.h
+++ b/lib/hkStubs/Havok/Physics2012/Dynamics/Entity/hkpEntity.h
@@ -12,6 +12,7 @@ class hkpAction;
class hkpBreakableBody;
class hkpConstraintInstance;
class hkpContactListener;
+class hkpDynamicsContactMgr;
class hkpEntityActivationListener;
class hkpEntityListener;
class hkpSimulationIsland;
@@ -67,6 +68,70 @@ public:
explicit hkpEntity(hkFinishLoadedObjectFlag flag);
~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();
hkMotionState* getMotionState() override { return nullptr; }
@@ -93,3 +158,84 @@ public:
mutable ExtendedListeners* m_extendedListeners;
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();
+}