mirror of https://github.com/zeldaret/botw.git
Havok: Add phantom stubs
This commit is contained in:
parent
12505b6379
commit
bef04a727c
|
@ -95,6 +95,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/Agent/ContactMgr/hkpContactMgr.h
|
Havok/Physics2012/Collide/Agent/ContactMgr/hkpContactMgr.h
|
||||||
|
Havok/Physics2012/Collide/Agent/Query/hkpCdBodyPairCollector.h
|
||||||
Havok/Physics2012/Collide/Agent/Query/hkpCdPointCollector.h
|
Havok/Physics2012/Collide/Agent/Query/hkpCdPointCollector.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/hkpAgentNnTrack.h
|
||||||
|
@ -102,6 +103,7 @@ add_library(hkStubs OBJECT
|
||||||
Havok/Physics2012/Collide/BroadPhase/hkpBroadPhaseHandle.h
|
Havok/Physics2012/Collide/BroadPhase/hkpBroadPhaseHandle.h
|
||||||
Havok/Physics2012/Collide/BroadPhase/hkpTypedBroadPhaseHandle.h
|
Havok/Physics2012/Collide/BroadPhase/hkpTypedBroadPhaseHandle.h
|
||||||
Havok/Physics2012/Collide/Dispatch/hkpCollisionDispatcher.h
|
Havok/Physics2012/Collide/Dispatch/hkpCollisionDispatcher.h
|
||||||
|
Havok/Physics2012/Collide/Dispatch/BroadPhase/hkpBroadPhaseListener.h
|
||||||
Havok/Physics2012/Collide/Dispatch/ContactMgr/hkpContactMgrFactory.h
|
Havok/Physics2012/Collide/Dispatch/ContactMgr/hkpContactMgrFactory.h
|
||||||
Havok/Physics2012/Collide/Filter/hkpCollidableCollidableFilter.h
|
Havok/Physics2012/Collide/Filter/hkpCollidableCollidableFilter.h
|
||||||
Havok/Physics2012/Collide/Filter/hkpCollisionFilter.cpp
|
Havok/Physics2012/Collide/Filter/hkpCollisionFilter.cpp
|
||||||
|
@ -169,7 +171,15 @@ add_library(hkStubs OBJECT
|
||||||
Havok/Physics2012/Dynamics/Motion/Rigid/hkpFixedRigidMotion.h
|
Havok/Physics2012/Dynamics/Motion/Rigid/hkpFixedRigidMotion.h
|
||||||
Havok/Physics2012/Dynamics/Motion/Rigid/hkpKeyframedRigidMotion.h
|
Havok/Physics2012/Dynamics/Motion/Rigid/hkpKeyframedRigidMotion.h
|
||||||
Havok/Physics2012/Dynamics/Motion/Rigid/hkpSphereMotion.h
|
Havok/Physics2012/Dynamics/Motion/Rigid/hkpSphereMotion.h
|
||||||
|
Havok/Physics2012/Dynamics/Phantom/hkpAabbPhantom.h
|
||||||
|
Havok/Physics2012/Dynamics/Phantom/hkpCachingShapePhantom.h
|
||||||
|
Havok/Physics2012/Dynamics/Phantom/hkpPhantom.h
|
||||||
|
Havok/Physics2012/Dynamics/Phantom/hkpPhantomBroadPhaseListener.h
|
||||||
|
Havok/Physics2012/Dynamics/Phantom/hkpPhantomListener.h
|
||||||
Havok/Physics2012/Dynamics/Phantom/hkpPhantomOverlapListener.h
|
Havok/Physics2012/Dynamics/Phantom/hkpPhantomOverlapListener.h
|
||||||
|
Havok/Physics2012/Dynamics/Phantom/hkpPhantomType.h
|
||||||
|
Havok/Physics2012/Dynamics/Phantom/hkpShapePhantom.h
|
||||||
|
Havok/Physics2012/Dynamics/Phantom/hkpSimpleShapePhantom.h
|
||||||
Havok/Physics2012/Dynamics/World/hkpPhysicsSystem.h
|
Havok/Physics2012/Dynamics/World/hkpPhysicsSystem.h
|
||||||
Havok/Physics2012/Dynamics/World/hkpSimulationIsland.h
|
Havok/Physics2012/Dynamics/World/hkpSimulationIsland.h
|
||||||
Havok/Physics2012/Dynamics/World/hkpWorld.h
|
Havok/Physics2012/Dynamics/World/hkpWorld.h
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Havok/Common/Base/hkBase.h>
|
||||||
|
|
||||||
|
class hkpCdBody;
|
||||||
|
|
||||||
|
class hkpCdBodyPairCollector {
|
||||||
|
public:
|
||||||
|
HK_DECLARE_CLASS_ALLOCATOR(hkpCdBodyPairCollector)
|
||||||
|
|
||||||
|
inline hkpCdBodyPairCollector();
|
||||||
|
virtual ~hkpCdBodyPairCollector();
|
||||||
|
|
||||||
|
virtual void addCdBodyPair(const hkpCdBody& bodyA, const hkpCdBody& bodyB) = 0;
|
||||||
|
virtual void reset();
|
||||||
|
|
||||||
|
inline hkBool getEarlyOut() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
hkBool m_earlyOut;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline hkpCdBodyPairCollector::hkpCdBodyPairCollector() {
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
inline hkpCdBodyPairCollector::~hkpCdBodyPairCollector() = default;
|
||||||
|
|
||||||
|
inline void hkpCdBodyPairCollector::reset() {
|
||||||
|
m_earlyOut = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline hkBool hkpCdBodyPairCollector::getEarlyOut() const {
|
||||||
|
return m_earlyOut;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
class hkpTypedBroadPhaseHandlePair;
|
||||||
|
|
||||||
|
class hkpBroadPhaseListener {
|
||||||
|
public:
|
||||||
|
virtual ~hkpBroadPhaseListener() = default;
|
||||||
|
|
||||||
|
virtual void addCollisionPair(hkpTypedBroadPhaseHandlePair& pair) = 0;
|
||||||
|
|
||||||
|
virtual void removeCollisionPair(hkpTypedBroadPhaseHandlePair& pair) = 0;
|
||||||
|
};
|
|
@ -0,0 +1,64 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Havok/Common/Base/Types/Geometry/Aabb/hkAabb.h>
|
||||||
|
#include <Havok/Physics2012/Dynamics/Phantom/hkpPhantom.h>
|
||||||
|
|
||||||
|
class hkpCdPointCollector;
|
||||||
|
struct hkpLinearCastInput;
|
||||||
|
struct hkpWorldRayCastInput;
|
||||||
|
struct hkpWorldRayCastOutput;
|
||||||
|
|
||||||
|
class hkpAabbPhantom : public hkpPhantom {
|
||||||
|
public:
|
||||||
|
HK_DECLARE_CLASS_ALLOCATOR(hkpAabbPhantom)
|
||||||
|
HK_DECLARE_REFLECTION()
|
||||||
|
|
||||||
|
explicit hkpAabbPhantom(const hkAabb& aabb, hkUint32 collisionFilterInfo = 0);
|
||||||
|
explicit hkpAabbPhantom(hkFinishLoadedObjectFlag flag);
|
||||||
|
~hkpAabbPhantom() override;
|
||||||
|
|
||||||
|
hkpPhantomType getType() const override;
|
||||||
|
|
||||||
|
inline hkArray<hkpCollidable*>& getOverlappingCollidables();
|
||||||
|
|
||||||
|
void castRay(const hkpWorldRayCastInput& input, hkpRayHitCollector& collector) const;
|
||||||
|
void castRay(const hkpWorldRayCastInput& input, hkpWorldRayCastOutput& output) const;
|
||||||
|
|
||||||
|
void linearCast(const hkpCollidable* const toBeCast, const hkpLinearCastInput& input,
|
||||||
|
hkpCdPointCollector& castCollector, hkpCdPointCollector* startCollector) const;
|
||||||
|
|
||||||
|
void calcAabb(hkAabb& aabb) override;
|
||||||
|
void addOverlappingCollidable(hkpCollidable* collidable) override;
|
||||||
|
hkBool isOverlappingCollidableAdded(const hkpCollidable* collidable) override;
|
||||||
|
void removeOverlappingCollidable(hkpCollidable* collidable) override;
|
||||||
|
hkpPhantom* clone() const override;
|
||||||
|
|
||||||
|
void setAabb(const hkAabb& newAabb);
|
||||||
|
inline const hkAabb& getAabb() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
hkMotionState* getMotionState() override { return nullptr; }
|
||||||
|
|
||||||
|
friend class hkpPhantomBatchMoveUtil;
|
||||||
|
|
||||||
|
hkAabb m_aabb;
|
||||||
|
hkArray<hkpCollidable*> m_overlappingCollidables;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void ensureDeterministicOrder() override;
|
||||||
|
|
||||||
|
class OrderByUid;
|
||||||
|
hkBool m_orderDirty;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Internal.
|
||||||
|
void deallocateInternalArrays() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline hkArray<hkpCollidable*>& hkpAabbPhantom::getOverlappingCollidables() {
|
||||||
|
return m_overlappingCollidables;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const hkAabb& hkpAabbPhantom::getAabb() const {
|
||||||
|
return m_aabb;
|
||||||
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Havok/Physics2012/Dynamics/Phantom/hkpShapePhantom.h>
|
||||||
|
|
||||||
|
class hkpCollisionAgent;
|
||||||
|
|
||||||
|
class hkpCachingShapePhantom : public hkpShapePhantom {
|
||||||
|
public:
|
||||||
|
HK_DECLARE_CLASS_ALLOCATOR(hkpCachingShapePhantom)
|
||||||
|
HK_DECLARE_REFLECTION()
|
||||||
|
|
||||||
|
hkpCachingShapePhantom(const hkpShape* shape, const hkTransform& transform,
|
||||||
|
hkUint32 m_collisionFilterInfo = 0);
|
||||||
|
explicit hkpCachingShapePhantom(hkFinishLoadedObjectFlag flag) : hkpShapePhantom(flag) {}
|
||||||
|
|
||||||
|
~hkpCachingShapePhantom() override;
|
||||||
|
|
||||||
|
hkpPhantomType getType() const override;
|
||||||
|
|
||||||
|
void setPositionAndLinearCast(const hkVector4& position, const hkpLinearCastInput& input,
|
||||||
|
hkpCdPointCollector& castCollector,
|
||||||
|
hkpCdPointCollector* startCollector) override;
|
||||||
|
|
||||||
|
void setTransformAndLinearCast(const hkTransform& transform, const hkpLinearCastInput& input,
|
||||||
|
hkpCdPointCollector& castCollector,
|
||||||
|
hkpCdPointCollector* startCollector) override;
|
||||||
|
|
||||||
|
hkpPhantom* clone() const override;
|
||||||
|
|
||||||
|
void getClosestPoints(hkpCdPointCollector& collector, const hkpCollisionInput* input) override;
|
||||||
|
|
||||||
|
void ensureDeterministicOrder() override;
|
||||||
|
|
||||||
|
void getPenetrations(hkpCdBodyPairCollector& collector,
|
||||||
|
const hkpCollisionInput* input) override;
|
||||||
|
|
||||||
|
struct CollisionDetail {
|
||||||
|
HK_DECLARE_CLASS_ALLOCATOR(CollisionDetail)
|
||||||
|
|
||||||
|
hkpCollisionAgent* m_agent;
|
||||||
|
hkpCollidable* m_collidable;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline hkArray<CollisionDetail>& getCollisionDetails();
|
||||||
|
|
||||||
|
void addOverlappingCollidable(hkpCollidable* collidable) override;
|
||||||
|
void removeOverlappingCollidable(hkpCollidable* collidable) override;
|
||||||
|
hkBool isOverlappingCollidableAdded(const hkpCollidable* collidable) override;
|
||||||
|
void updateShapeCollectionFilter() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
hkArray<CollisionDetail> m_collisionDetails;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void deallocateInternalArrays() override;
|
||||||
|
|
||||||
|
hkBool m_orderDirty;
|
||||||
|
|
||||||
|
class OrderByUid;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline hkArray<hkpCachingShapePhantom::CollisionDetail>&
|
||||||
|
hkpCachingShapePhantom::getCollisionDetails() {
|
||||||
|
return m_collisionDetails;
|
||||||
|
}
|
|
@ -0,0 +1,113 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Havok/Common/Base/hkBase.h>
|
||||||
|
#include <Havok/Physics2012/Dynamics/Phantom/hkpPhantomOverlapListener.h>
|
||||||
|
#include <Havok/Physics2012/Dynamics/Phantom/hkpPhantomType.h>
|
||||||
|
#include <Havok/Physics2012/Dynamics/World/hkpWorldObject.h>
|
||||||
|
|
||||||
|
class hkpPhantomListener;
|
||||||
|
class hkpPhantomOverlapListener;
|
||||||
|
|
||||||
|
class hkpPhantom : public hkpWorldObject {
|
||||||
|
public:
|
||||||
|
HK_DECLARE_CLASS_ALLOCATOR(hkpPhantom)
|
||||||
|
HK_DECLARE_REFLECTION()
|
||||||
|
|
||||||
|
explicit hkpPhantom(hkFinishLoadedObjectFlag flag) : hkpWorldObject(flag) {}
|
||||||
|
~hkpPhantom() override;
|
||||||
|
|
||||||
|
virtual hkpPhantomType getType() const = 0;
|
||||||
|
|
||||||
|
virtual void calcAabb(hkAabb& aabb) = 0;
|
||||||
|
|
||||||
|
virtual void addOverlappingCollidable(hkpCollidable* collidable) = 0;
|
||||||
|
|
||||||
|
virtual hkBool isOverlappingCollidableAdded(const hkpCollidable* collidable) = 0;
|
||||||
|
|
||||||
|
virtual void removeOverlappingCollidable(hkpCollidable* collidable) = 0;
|
||||||
|
|
||||||
|
virtual void ensureDeterministicOrder() = 0;
|
||||||
|
|
||||||
|
virtual hkpPhantom* clone() const = 0;
|
||||||
|
|
||||||
|
void addPhantomListener(hkpPhantomListener* el);
|
||||||
|
void removePhantomListener(hkpPhantomListener* el);
|
||||||
|
|
||||||
|
void addPhantomOverlapListener(hkpPhantomOverlapListener* el);
|
||||||
|
void removePhantomOverlapListener(hkpPhantomOverlapListener* el);
|
||||||
|
|
||||||
|
inline const hkArray<hkpPhantomListener*>& getPhantomListeners() const;
|
||||||
|
inline const hkArray<hkpPhantomOverlapListener*>& getPhantomOverlapListeners() const;
|
||||||
|
|
||||||
|
virtual void updateShapeCollectionFilter() {}
|
||||||
|
|
||||||
|
void updateBroadPhase(const hkAabb& aabb);
|
||||||
|
void setBoundingVolumeData(const hkAabb& aabb);
|
||||||
|
|
||||||
|
void firePhantomAdded();
|
||||||
|
void firePhantomRemoved();
|
||||||
|
void firePhantomShapeSet();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
inline explicit hkpPhantom(const hkpShape* shape);
|
||||||
|
|
||||||
|
inline hkpCollidableAccept fireCollidableAdded(const hkpCollidable* collidable);
|
||||||
|
inline void fireCollidableRemoved(const hkpCollidable* collidable, hkBool collidableWasAdded);
|
||||||
|
void firePhantomDeleted();
|
||||||
|
|
||||||
|
hkArray<hkpPhantomOverlapListener*> m_overlapListeners;
|
||||||
|
hkArray<hkpPhantomListener*> m_phantomListeners;
|
||||||
|
|
||||||
|
friend class hkpPhantomBatchMoveUtil;
|
||||||
|
|
||||||
|
void removeNullOverlapListeners();
|
||||||
|
void removeNullPhantomListeners();
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Internal.
|
||||||
|
virtual void deallocateInternalArrays();
|
||||||
|
};
|
||||||
|
|
||||||
|
inline hkpPhantom* hkpGetPhantom(const hkpCollidable* collidable) {
|
||||||
|
if (collidable->getType() == hkpWorldObject::BROAD_PHASE_PHANTOM)
|
||||||
|
return static_cast<hkpPhantom*>(hkpGetWorldObject(collidable));
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const hkArray<hkpPhantomListener*>& hkpPhantom::getPhantomListeners() const {
|
||||||
|
return m_phantomListeners;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const hkArray<hkpPhantomOverlapListener*>& hkpPhantom::getPhantomOverlapListeners() const {
|
||||||
|
return m_overlapListeners;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline hkpPhantom::hkpPhantom(const hkpShape* shape) : hkpWorldObject(shape, BROAD_PHASE_PHANTOM) {
|
||||||
|
m_collidable.setOwner(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline hkpCollidableAccept hkpPhantom::fireCollidableAdded(const hkpCollidable* collidable) {
|
||||||
|
hkpCollidableAddedEvent event;
|
||||||
|
event.m_collidable = collidable;
|
||||||
|
event.m_phantom = this;
|
||||||
|
event.m_collidableAccept = HK_COLLIDABLE_ACCEPT;
|
||||||
|
|
||||||
|
for (int i = m_overlapListeners.getSize() - 1; i >= 0; i--) {
|
||||||
|
if (m_overlapListeners[i])
|
||||||
|
m_overlapListeners[i]->collidableAddedCallback(event);
|
||||||
|
}
|
||||||
|
return event.m_collidableAccept;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void hkpPhantom::fireCollidableRemoved(const hkpCollidable* collidable,
|
||||||
|
hkBool collidableWasAdded) {
|
||||||
|
hkpCollidableRemovedEvent event;
|
||||||
|
event.m_collidable = collidable;
|
||||||
|
event.m_phantom = this;
|
||||||
|
event.m_collidableWasAdded = collidableWasAdded;
|
||||||
|
|
||||||
|
for (int i = m_overlapListeners.getSize() - 1; i >= 0; i--) {
|
||||||
|
if (m_overlapListeners[i])
|
||||||
|
m_overlapListeners[i]->collidableRemovedCallback(event);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Havok/Common/Base/hkBase.h>
|
||||||
|
#include <Havok/Physics2012/Collide/Dispatch/BroadPhase/hkpBroadPhaseListener.h>
|
||||||
|
|
||||||
|
class hkpPhantomBroadPhaseListener : public hkReferencedObject, public hkpBroadPhaseListener {
|
||||||
|
public:
|
||||||
|
HK_DECLARE_CLASS_ALLOCATOR(hkpPhantomBroadPhaseListener)
|
||||||
|
|
||||||
|
hkpPhantomBroadPhaseListener() = default;
|
||||||
|
|
||||||
|
void addCollisionPair(hkpTypedBroadPhaseHandlePair& pair) override;
|
||||||
|
void removeCollisionPair(hkpTypedBroadPhaseHandlePair& pair) override;
|
||||||
|
};
|
|
@ -0,0 +1,21 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Havok/Physics2012/Dynamics/Phantom/hkpPhantom.h>
|
||||||
|
|
||||||
|
class hkpPhantomListener {
|
||||||
|
public:
|
||||||
|
virtual ~hkpPhantomListener() = default;
|
||||||
|
|
||||||
|
virtual void phantomAddedCallback(hkpPhantom* phantom) {}
|
||||||
|
|
||||||
|
virtual void phantomRemovedCallback(hkpPhantom* phantom) {}
|
||||||
|
|
||||||
|
virtual void phantomShapeSetCallback(hkpPhantom* phantom) {
|
||||||
|
if (phantom->getWorld()) {
|
||||||
|
phantomRemovedCallback(phantom);
|
||||||
|
phantomAddedCallback(phantom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void phantomDeletedCallback(hkpPhantom* phantom) {}
|
||||||
|
};
|
|
@ -0,0 +1,26 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
enum hkpPhantomType {
|
||||||
|
/// hkpAabbPhantom
|
||||||
|
HK_PHANTOM_AABB = 0,
|
||||||
|
|
||||||
|
/// hkpSimpleShapePhantom
|
||||||
|
HK_PHANTOM_SIMPLE_SHAPE = 1,
|
||||||
|
|
||||||
|
/// hkpCachingShapePhantom
|
||||||
|
HK_PHANTOM_CACHING_SHAPE = 2,
|
||||||
|
|
||||||
|
/// User-defined types
|
||||||
|
HK_PHANTOM_USER0,
|
||||||
|
HK_PHANTOM_USER1,
|
||||||
|
HK_PHANTOM_USER2,
|
||||||
|
HK_PHANTOM_USER3,
|
||||||
|
HK_PHANTOM_USER4,
|
||||||
|
HK_PHANTOM_USER5,
|
||||||
|
HK_PHANTOM_USER6,
|
||||||
|
HK_PHANTOM_USER7,
|
||||||
|
HK_PHANTOM_USER8,
|
||||||
|
HK_PHANTOM_USER9,
|
||||||
|
|
||||||
|
HK_PHANTOM_MAX_ID
|
||||||
|
};
|
|
@ -0,0 +1,56 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Havok/Common/Base/Types/Physics/MotionState/hkMotionState.h>
|
||||||
|
#include <Havok/Physics2012/Dynamics/Phantom/hkpPhantom.h>
|
||||||
|
|
||||||
|
class hkpCdBodyPairCollector;
|
||||||
|
class hkpCdPointCollector;
|
||||||
|
struct hkpCollisionInput;
|
||||||
|
struct hkpLinearCastInput;
|
||||||
|
|
||||||
|
class hkpShapePhantom : public hkpPhantom {
|
||||||
|
public:
|
||||||
|
HK_DECLARE_CLASS_ALLOCATOR(hkpShapePhantom)
|
||||||
|
HK_DECLARE_REFLECTION()
|
||||||
|
|
||||||
|
hkpShapePhantom(const hkpShape* shape, const hkTransform& transform);
|
||||||
|
explicit hkpShapePhantom(hkFinishLoadedObjectFlag flag) : hkpPhantom(flag) {}
|
||||||
|
|
||||||
|
virtual void setPositionAndLinearCast(const hkVector4& position,
|
||||||
|
const hkpLinearCastInput& input,
|
||||||
|
hkpCdPointCollector& castCollector,
|
||||||
|
hkpCdPointCollector* startCollector) = 0;
|
||||||
|
|
||||||
|
virtual void setTransformAndLinearCast(const hkTransform& transform,
|
||||||
|
const hkpLinearCastInput& input,
|
||||||
|
hkpCdPointCollector& castCollector,
|
||||||
|
hkpCdPointCollector* startCollector) = 0;
|
||||||
|
|
||||||
|
virtual void getClosestPoints(hkpCdPointCollector& collector,
|
||||||
|
const hkpCollisionInput* input) = 0;
|
||||||
|
void getClosestPoints(hkpCdPointCollector& collector) { getClosestPoints(collector, nullptr); }
|
||||||
|
|
||||||
|
virtual void getPenetrations(hkpCdBodyPairCollector& collector,
|
||||||
|
const hkpCollisionInput* input) = 0;
|
||||||
|
void getPenetrations(hkpCdBodyPairCollector& collector) { getPenetrations(collector, nullptr); }
|
||||||
|
|
||||||
|
inline const hkTransform& getTransform() const;
|
||||||
|
void setTransform(const hkTransform& transform);
|
||||||
|
|
||||||
|
void setPosition(const hkVector4& position, hkReal extraTolerance = 0.0f);
|
||||||
|
|
||||||
|
hkWorldOperation::Result setShape(const hkpShape* shape) override;
|
||||||
|
|
||||||
|
void calcAabb(hkAabb& aabb) override;
|
||||||
|
|
||||||
|
hkMotionState* getMotionState() override;
|
||||||
|
|
||||||
|
hkMotionState m_motionState;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void deallocateInternalArrays() override;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline const hkTransform& hkpShapePhantom::getTransform() const {
|
||||||
|
return m_motionState.getTransform();
|
||||||
|
}
|
|
@ -0,0 +1,62 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <Havok/Physics2012/Dynamics/Phantom/hkpShapePhantom.h>
|
||||||
|
|
||||||
|
class hkpSimpleShapePhantom : public hkpShapePhantom {
|
||||||
|
public:
|
||||||
|
HK_DECLARE_CLASS_ALLOCATOR(hkpSimpleShapePhantom)
|
||||||
|
HK_DECLARE_REFLECTION()
|
||||||
|
|
||||||
|
hkpSimpleShapePhantom(const hkpShape* shape, const hkTransform& transform,
|
||||||
|
hkUint32 m_collisionFilterInfo = 0);
|
||||||
|
explicit hkpSimpleShapePhantom(hkFinishLoadedObjectFlag flag) : hkpShapePhantom(flag) {}
|
||||||
|
~hkpSimpleShapePhantom() override;
|
||||||
|
|
||||||
|
hkpPhantomType getType() const override;
|
||||||
|
|
||||||
|
void setPositionAndLinearCast(const hkVector4& position, const hkpLinearCastInput& input,
|
||||||
|
hkpCdPointCollector& castCollector,
|
||||||
|
hkpCdPointCollector* startCollector) override;
|
||||||
|
|
||||||
|
void setTransformAndLinearCast(const hkTransform& transform, const hkpLinearCastInput& input,
|
||||||
|
hkpCdPointCollector& castCollector,
|
||||||
|
hkpCdPointCollector* startCollector) override;
|
||||||
|
|
||||||
|
void getClosestPoints(hkpCdPointCollector& collector, const hkpCollisionInput* input) override;
|
||||||
|
|
||||||
|
void ensureDeterministicOrder() override;
|
||||||
|
|
||||||
|
void getPenetrations(hkpCdBodyPairCollector& collector,
|
||||||
|
const hkpCollisionInput* input) override;
|
||||||
|
|
||||||
|
hkpPhantom* clone() const override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void addOverlappingCollidable(hkpCollidable* collidable) override;
|
||||||
|
hkBool isOverlappingCollidableAdded(const hkpCollidable* collidable) override;
|
||||||
|
void removeOverlappingCollidable(hkpCollidable* collidable) override;
|
||||||
|
|
||||||
|
struct CollisionDetail {
|
||||||
|
HK_DECLARE_CLASS_ALLOCATOR(CollisionDetail)
|
||||||
|
HK_DECLARE_REFLECTION()
|
||||||
|
|
||||||
|
hkpCollidable* m_collidable;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline hkArray<CollisionDetail>& getCollisionDetails();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
hkArray<CollisionDetail> m_collisionDetails;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void deallocateInternalArrays() override;
|
||||||
|
|
||||||
|
hkBool m_orderDirty;
|
||||||
|
|
||||||
|
class OrderByUid;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline hkArray<hkpSimpleShapePhantom::CollisionDetail>&
|
||||||
|
hkpSimpleShapePhantom::getCollisionDetails() {
|
||||||
|
return m_collisionDetails;
|
||||||
|
}
|
Loading…
Reference in New Issue