mirror of
https://github.com/zeldaret/botw
synced 2026-08-22 06:28:58 -04:00
ksys/phys: Add more ContactListener functions and Havok prereqs
This commit is contained in:
@@ -92,6 +92,7 @@ add_library(hkStubs OBJECT
|
||||
Havok/Physics2012/Collide/Agent/Collidable/hkpCdBody.h
|
||||
Havok/Physics2012/Collide/Agent/Collidable/hkpCollidable.h
|
||||
Havok/Physics2012/Collide/Agent/Collidable/hkpCollidableQualityType.h
|
||||
Havok/Physics2012/Collide/Agent/ContactMgr/hkpContactMgr.h
|
||||
Havok/Physics2012/Collide/Agent3/BvTree3/hkpBvTreeAgent3.h
|
||||
Havok/Physics2012/Collide/Agent3/Machine/Nn/hkpAgentNnTrack.h
|
||||
Havok/Physics2012/Collide/Agent3/Machine/Nn/hkpLinkedCollidable.h
|
||||
@@ -133,6 +134,7 @@ add_library(hkStubs OBJECT
|
||||
Havok/Physics2012/Collide/Util/Welding/hkpWeldingUtility.h
|
||||
|
||||
Havok/Physics2012/Dynamics/Action/hkpAction.h
|
||||
Havok/Physics2012/Dynamics/Collide/hkpDynamicsContactMgr.h
|
||||
Havok/Physics2012/Dynamics/Collide/hkpResponseModifier.h
|
||||
Havok/Physics2012/Dynamics/Collide/ContactListener/hkpCollisionEvent.h
|
||||
Havok/Physics2012/Dynamics/Collide/ContactListener/hkpContactListener.h
|
||||
|
||||
@@ -0,0 +1,117 @@
|
||||
#pragma once
|
||||
|
||||
#include <Havok/Common/Base/hkBase.h>
|
||||
#include "Havok/Common/Base/Types/Physics/ContactPoint/hkContactPoint.h"
|
||||
|
||||
class hkCollisionConstraintOwner;
|
||||
|
||||
class hkpCdBody;
|
||||
class hkpCollidable;
|
||||
class hkpContactPointProperties;
|
||||
class hkpGskCache;
|
||||
struct hkpProcessCollisionData;
|
||||
struct hkpProcessCollisionInput;
|
||||
struct hkpProcessCollisionOutput;
|
||||
|
||||
class hkpContactMgr : public hkReferencedObject {
|
||||
public:
|
||||
HK_DECLARE_CLASS_ALLOCATOR(hkpContactMgr)
|
||||
|
||||
enum Type {
|
||||
TYPE_SIMPLE_CONSTRAINT_CONTACT_MGR,
|
||||
TYPE_REPORT_CONTACT_MGR,
|
||||
TYPE_CONVEX_LIST_CONTACT_MGR,
|
||||
TYPE_NULL_CONTACT_MGR,
|
||||
TYPE_USER_CONTACT_MGR,
|
||||
TYPE_MAX
|
||||
};
|
||||
|
||||
enum ToiAccept { TOI_ACCEPT = 0, TOI_REJECT = 1 };
|
||||
|
||||
explicit hkpContactMgr(Type type) : m_type(type) {}
|
||||
|
||||
HK_FORCE_INLINE hkContactPointId addContactPoint(const hkpCdBody& a, const hkpCdBody& b,
|
||||
const hkpProcessCollisionInput& input,
|
||||
hkpProcessCollisionOutput& output,
|
||||
const hkpGskCache* contactCache,
|
||||
hkContactPoint& cp);
|
||||
|
||||
HK_FORCE_INLINE hkResult reserveContactPoints(int numPoints);
|
||||
|
||||
HK_FORCE_INLINE void removeContactPoint(hkContactPointId cpId,
|
||||
hkCollisionConstraintOwner& constraintOwner);
|
||||
|
||||
HK_FORCE_INLINE void processContact(const hkpCollidable& a, const hkpCollidable& b,
|
||||
const hkpProcessCollisionInput& input,
|
||||
hkpProcessCollisionData& collisionData);
|
||||
|
||||
HK_FORCE_INLINE ToiAccept addToi(const hkpCdBody& a, const hkpCdBody& b,
|
||||
const hkpProcessCollisionInput& input,
|
||||
hkpProcessCollisionOutput& output, hkTime toi,
|
||||
hkContactPoint& cp, const hkpGskCache* gskCache,
|
||||
hkReal& projectedVelocity,
|
||||
hkpContactPointProperties& propertiesOut);
|
||||
|
||||
HK_FORCE_INLINE void removeToi(class hkCollisionConstraintOwner& constraintOwner,
|
||||
hkpContactPointProperties& properties);
|
||||
|
||||
protected:
|
||||
virtual hkContactPointId addContactPointImpl(const hkpCdBody& a, const hkpCdBody& b,
|
||||
const hkpProcessCollisionInput& input,
|
||||
hkpProcessCollisionOutput& output,
|
||||
const hkpGskCache* contactCache,
|
||||
hkContactPoint& cp) = 0;
|
||||
virtual hkResult reserveContactPointsImpl(int numPoints) = 0;
|
||||
virtual void removeContactPointImpl(hkContactPointId cpId,
|
||||
hkCollisionConstraintOwner& constraintOwner) = 0;
|
||||
virtual void processContactImpl(const hkpCollidable& a, const hkpCollidable& b,
|
||||
const hkpProcessCollisionInput& input,
|
||||
hkpProcessCollisionData& collisionData) = 0;
|
||||
virtual ToiAccept addToiImpl(const hkpCdBody& a, const hkpCdBody& b,
|
||||
const hkpProcessCollisionInput& input,
|
||||
hkpProcessCollisionOutput& output, hkTime toi, hkContactPoint& cp,
|
||||
const hkpGskCache* gskCache, hkReal& projectedVelocity,
|
||||
hkpContactPointProperties& propertiesOut) = 0;
|
||||
virtual void removeToiImpl(class hkCollisionConstraintOwner& constraintOwner,
|
||||
hkpContactPointProperties& properties) = 0;
|
||||
virtual void cleanup() {}
|
||||
|
||||
public:
|
||||
Type m_type;
|
||||
};
|
||||
|
||||
inline hkContactPointId hkpContactMgr::addContactPoint(const hkpCdBody& a, const hkpCdBody& b,
|
||||
const hkpProcessCollisionInput& input,
|
||||
hkpProcessCollisionOutput& output,
|
||||
const hkpGskCache* contactCache,
|
||||
hkContactPoint& cp) {
|
||||
return addContactPointImpl(a, b, input, output, contactCache, cp);
|
||||
}
|
||||
|
||||
inline hkResult hkpContactMgr::reserveContactPoints(int numPoints) {
|
||||
return reserveContactPointsImpl(numPoints);
|
||||
}
|
||||
|
||||
inline void hkpContactMgr::removeContactPoint(hkContactPointId cpId,
|
||||
hkCollisionConstraintOwner& constraintOwner) {
|
||||
removeContactPointImpl(cpId, constraintOwner);
|
||||
}
|
||||
|
||||
inline void hkpContactMgr::processContact(const hkpCollidable& a, const hkpCollidable& b,
|
||||
const hkpProcessCollisionInput& input,
|
||||
hkpProcessCollisionData& collisionData) {
|
||||
processContactImpl(a, b, input, collisionData);
|
||||
}
|
||||
|
||||
inline hkpContactMgr::ToiAccept
|
||||
hkpContactMgr::addToi(const hkpCdBody& a, const hkpCdBody& b, const hkpProcessCollisionInput& input,
|
||||
hkpProcessCollisionOutput& output, hkTime toi, hkContactPoint& cp,
|
||||
const hkpGskCache* gskCache, hkReal& projectedVelocity,
|
||||
hkpContactPointProperties& propertiesOut) {
|
||||
return addToiImpl(a, b, input, output, toi, cp, gskCache, projectedVelocity, propertiesOut);
|
||||
}
|
||||
|
||||
inline void hkpContactMgr::removeToi(hkCollisionConstraintOwner& constraintOwner,
|
||||
hkpContactPointProperties& properties) {
|
||||
removeToiImpl(constraintOwner, properties);
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
#include <Havok/Physics2012/Collide/Agent/ContactMgr/hkpContactMgr.h>
|
||||
|
||||
class hkContactPoint;
|
||||
class hkpContactPointProperties;
|
||||
class hkpWorld;
|
||||
|
||||
/// An interface to access contact point information.
|
||||
class hkpDynamicsContactMgr : public hkpContactMgr {
|
||||
public:
|
||||
HK_DECLARE_CLASS_ALLOCATOR(hkpDynamicsContactMgr)
|
||||
|
||||
explicit hkpDynamicsContactMgr(Type type) : hkpContactMgr(type) {}
|
||||
|
||||
virtual hkpContactPointProperties* getContactPointProperties(hkContactPointId id) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
virtual hkContactPoint* getContactPoint(hkContactPointId id) { return nullptr; }
|
||||
|
||||
virtual void getAllContactPointIds(hkArray<hkContactPointId>& contactPointIds) const {}
|
||||
|
||||
virtual Type getType() const = 0;
|
||||
|
||||
virtual void toiCollisionResponseBeginCallback(const hkContactPoint& cp,
|
||||
struct hkpSimpleConstraintInfoInitInput& inA,
|
||||
struct hkpBodyVelocity& velA,
|
||||
hkpSimpleConstraintInfoInitInput& inB,
|
||||
hkpBodyVelocity& velB) {}
|
||||
|
||||
virtual void toiCollisionResponseEndCallback(const hkContactPoint& cp, hkReal impulseApplied,
|
||||
struct hkpSimpleConstraintInfoInitInput& inA,
|
||||
struct hkpBodyVelocity& velA,
|
||||
hkpSimpleConstraintInfoInitInput& inB,
|
||||
hkpBodyVelocity& velB) {}
|
||||
|
||||
virtual class hkpConstraintInstance* getConstraintInstance() { return nullptr; }
|
||||
|
||||
virtual hkBool fireCallbacksForEarliestToi(struct hkpToiEvent& event, hkReal& rotateNormal) {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void confirmToi(struct hkpToiEvent& event, hkReal rotateNormal,
|
||||
class hkArray<class hkpEntity*>& outToBeActivated) {}
|
||||
|
||||
protected:
|
||||
hkpWorld* m_world;
|
||||
};
|
||||
+1
-1
Submodule lib/sead updated: 1b10f7f596...5327840d10
Reference in New Issue
Block a user