mirror of https://github.com/zeldaret/botw.git
ksys/phys: Add SphereBasedClosestPointQuery
This commit is contained in:
parent
62959cc554
commit
6830bcbb64
|
|
@ -83711,18 +83711,18 @@ Address,Quality,Size,Name
|
|||
0x0000007100fb0db0,O,000092,_ZNK4ksys4phys17ClosestPointQuery18getRuntimeTypeInfoEv
|
||||
0x0000007100fb0e0c,O,000072,_ZN4ksys4phys25ClosestPointQueryWithInfoD1Ev
|
||||
0x0000007100fb0e54,O,000080,_ZN4ksys4phys25ClosestPointQueryWithInfoD0Ev
|
||||
0x0000007100fb0ea4,U,000540,physCollisionQuery::ctor
|
||||
0x0000007100fb10c0,U,000544,
|
||||
0x0000007100fb12e0,U,000548,
|
||||
0x0000007100fb1504,U,000212,
|
||||
0x0000007100fb15d8,U,000124,
|
||||
0x0000007100fb1654,U,000132,
|
||||
0x0000007100fb0ea4,O,000540,_ZN4ksys4phys28SphereBasedClosestPointQueryC1ERKN4sead7Vector3IfEEfNS0_12ContactLayerENS0_9GroundHitEPNS0_18SystemGroupHandlerEiRKNS2_14SafeStringBaseIcEEiNS0_11LowPriorityE
|
||||
0x0000007100fb10c0,O,000544,_ZN4ksys4phys28SphereBasedClosestPointQueryC1ERKN4sead7Vector3IfEEfNS0_12ContactLayerERKNS0_16LayerMaskBuilderEiRKNS2_14SafeStringBaseIcEEiNS0_11LowPriorityE
|
||||
0x0000007100fb12e0,O,000548,_ZN4ksys4phys28SphereBasedClosestPointQueryC1ERKN4sead7Vector3IfEEfRKNS0_19SensorCollisionMaskEPNS0_18SystemGroupHandlerEiRKNS2_14SafeStringBaseIcEEiNS0_11LowPriorityE
|
||||
0x0000007100fb1504,O,000212,_ZN4ksys4phys28SphereBasedClosestPointQueryC1EPNS0_9RigidBodyERKN4sead7Vector3IfEEiRKNS4_14SafeStringBaseIcEEiNS0_11LowPriorityE
|
||||
0x0000007100fb15d8,O,000124,_ZN4ksys4phys28SphereBasedClosestPointQueryD1Ev
|
||||
0x0000007100fb1654,O,000132,_ZN4ksys4phys28SphereBasedClosestPointQueryD0Ev
|
||||
0x0000007100fb16d8,O,000204,_ZNK4ksys4phys25ClosestPointQueryWithInfo27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
|
||||
0x0000007100fb17a4,O,000092,_ZNK4ksys4phys25ClosestPointQueryWithInfo18getRuntimeTypeInfoEv
|
||||
0x0000007100fb1800,U,000288,
|
||||
0x0000007100fb1920,U,000092,
|
||||
0x0000007100fb1800,O,000288,_ZNK4ksys4phys28SphereBasedClosestPointQuery27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
|
||||
0x0000007100fb1920,O,000092,_ZNK4ksys4phys28SphereBasedClosestPointQuery18getRuntimeTypeInfoEv
|
||||
0x0000007100fb197c,O,000140,_ZNK4sead15RuntimeTypeInfo6DeriveIN4ksys4phys17ClosestPointQueryEE9isDerivedEPKNS0_9InterfaceE
|
||||
0x0000007100fb1a08,U,000140,
|
||||
0x0000007100fb1a08,O,000140,_ZNK4sead15RuntimeTypeInfo6DeriveIN4ksys4phys25ClosestPointQueryWithInfoEE9isDerivedEPKNS0_9InterfaceE
|
||||
0x0000007100fb1a94,U,000312,
|
||||
0x0000007100fb1bcc,U,000240,
|
||||
0x0000007100fb1cbc,U,000020,
|
||||
|
|
|
|||
|
Can't render this file because it is too large.
|
|
|
@ -1,4 +1,6 @@
|
|||
#include "KingSystem/Physics/System/physClosestPointQueryWithInfo.h"
|
||||
#include "KingSystem/Physics/RigidBody/Shape/Sphere/physSphereRigidBody.h"
|
||||
#include "KingSystem/Physics/RigidBody/Shape/Sphere/physSphereShape.h"
|
||||
#include "KingSystem/Physics/System/physQueryContactPointInfo.h"
|
||||
#include "KingSystem/Physics/System/physSystem.h"
|
||||
|
||||
|
|
@ -19,4 +21,91 @@ ClosestPointQueryWithInfo::~ClosestPointQueryWithInfo() {
|
|||
}
|
||||
}
|
||||
|
||||
SphereBasedClosestPointQuery::SphereBasedClosestPointQuery(
|
||||
const sead::Vector3f& position, float sphere_radius, ContactLayer layer, GroundHit ground_hit,
|
||||
SystemGroupHandler* group_handler, int num_points, const sead::SafeString& name, int a,
|
||||
LowPriority low_priority)
|
||||
: ClosestPointQueryWithInfo(nullptr, num_points, name, a, low_priority) {
|
||||
auto* heap = System::instance()->getPhysicsTempHeap(low_priority);
|
||||
|
||||
SphereParam sphere_param;
|
||||
sphere_param.name = sead::SafeString::cEmptyString.cstr();
|
||||
sphere_param.radius = sphere_radius;
|
||||
sphere_param.contact_layer = layer;
|
||||
sphere_param.groundhit = ground_hit;
|
||||
sphere_param.motion_type = MotionType::Fixed;
|
||||
sphere_param._90 = true;
|
||||
sphere_param.system_group_handler = group_handler;
|
||||
makeAndSetSphere(&sphere_param, heap, position);
|
||||
}
|
||||
|
||||
SphereBasedClosestPointQuery::SphereBasedClosestPointQuery(
|
||||
const sead::Vector3f& position, float sphere_radius, ContactLayer layer,
|
||||
const LayerMaskBuilder& layer_mask_builder, int num_points, const sead::SafeString& name, int a,
|
||||
LowPriority low_priority)
|
||||
: ClosestPointQueryWithInfo(nullptr, num_points, name, a, low_priority) {
|
||||
auto* heap = System::instance()->getPhysicsTempHeap(low_priority);
|
||||
|
||||
SphereParam sphere_param;
|
||||
sphere_param.name = sead::SafeString::cEmptyString.cstr();
|
||||
sphere_param.radius = sphere_radius;
|
||||
sphere_param.contact_layer = layer;
|
||||
sphere_param.motion_type = MotionType::Fixed;
|
||||
sphere_param._90 = true;
|
||||
makeAndSetSphere(&sphere_param, heap, position, &layer_mask_builder);
|
||||
}
|
||||
|
||||
SphereBasedClosestPointQuery::SphereBasedClosestPointQuery(
|
||||
const sead::Vector3f& position, float sphere_radius, const SensorCollisionMask& mask,
|
||||
SystemGroupHandler* group_handler, int num_points, const sead::SafeString& name, int a,
|
||||
LowPriority low_priority)
|
||||
: ClosestPointQueryWithInfo(nullptr, num_points, name, a, low_priority) {
|
||||
auto* heap = System::instance()->getPhysicsTempHeap(low_priority);
|
||||
|
||||
SphereParam sphere_param;
|
||||
sphere_param.name = sead::SafeString::cEmptyString.cstr();
|
||||
sphere_param.radius = sphere_radius;
|
||||
sphere_param.contact_layer = ContactLayer::SensorCustomReceiver;
|
||||
sphere_param.groundhit = GroundHit::HitAll;
|
||||
sphere_param.receiver_mask = mask;
|
||||
sphere_param.motion_type = MotionType::Fixed;
|
||||
sphere_param.system_group_handler = group_handler;
|
||||
sphere_param._90 = true;
|
||||
makeAndSetSphere(&sphere_param, heap, position);
|
||||
}
|
||||
|
||||
SphereBasedClosestPointQuery::SphereBasedClosestPointQuery(RigidBody* sphere,
|
||||
const sead::Vector3f& position,
|
||||
int num_points,
|
||||
const sead::SafeString& name, int a,
|
||||
LowPriority low_priority)
|
||||
: ClosestPointQueryWithInfo(sphere, num_points, name, a, low_priority) {
|
||||
[[maybe_unused]] auto* heap = System::instance()->getPhysicsTempHeap(low_priority);
|
||||
mSphere = sphere;
|
||||
mMtx.setTranslation(position);
|
||||
}
|
||||
|
||||
SphereBasedClosestPointQuery::~SphereBasedClosestPointQuery() {
|
||||
if (mStatus == Status::_2 || mStatus == Status::_3) {
|
||||
delete mSphere;
|
||||
}
|
||||
}
|
||||
|
||||
void SphereBasedClosestPointQuery::makeAndSetSphere(RigidBodyInstanceParam* sphere_param,
|
||||
sead::Heap* heap,
|
||||
const sead::Vector3f& position,
|
||||
const LayerMaskBuilder* layer_mask_builder) {
|
||||
mSphere = SphereRigidBody::make(sphere_param, heap);
|
||||
mBody = mSphere;
|
||||
|
||||
if (layer_mask_builder != nullptr) {
|
||||
setLayerMasksAndBodyCollisionFilterInfo(*layer_mask_builder);
|
||||
}
|
||||
|
||||
if (mBody) {
|
||||
mMtx.setTranslation(position);
|
||||
mStatus = Status::_3;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ksys::phys
|
||||
|
|
|
|||
|
|
@ -1,11 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include <math/seadVector.h>
|
||||
#include "KingSystem/Physics/System/physClosestPointQuery.h"
|
||||
#include "KingSystem/Physics/System/physSystem.h"
|
||||
|
||||
namespace ksys::phys {
|
||||
|
||||
// A ClosestPointQuery with an owned QueryContactPointInfo.
|
||||
struct RigidBodyInstanceParam;
|
||||
|
||||
/// A ClosestPointQuery with an owned QueryContactPointInfo.
|
||||
class ClosestPointQueryWithInfo : public ClosestPointQuery {
|
||||
SEAD_RTTI_OVERRIDE(ClosestPointQueryWithInfo, ClosestPointQuery)
|
||||
public:
|
||||
|
|
@ -23,4 +26,37 @@ protected:
|
|||
Status mStatus{};
|
||||
};
|
||||
|
||||
/// A closest point query using a sphere rigid body.
|
||||
class SphereBasedClosestPointQuery : public ClosestPointQueryWithInfo {
|
||||
SEAD_RTTI_OVERRIDE(SphereBasedClosestPointQuery, ClosestPointQueryWithInfo)
|
||||
public:
|
||||
SphereBasedClosestPointQuery(const sead::Vector3f& position, float sphere_radius,
|
||||
ContactLayer layer, GroundHit ground_hit,
|
||||
SystemGroupHandler* group_handler, int num_points,
|
||||
const sead::SafeString& name, int a, LowPriority low_priority);
|
||||
|
||||
SphereBasedClosestPointQuery(const sead::Vector3f& position, float sphere_radius,
|
||||
ContactLayer layer, const LayerMaskBuilder& layer_mask_builder,
|
||||
int num_points, const sead::SafeString& name, int a,
|
||||
LowPriority low_priority);
|
||||
|
||||
SphereBasedClosestPointQuery(const sead::Vector3f& position, float sphere_radius,
|
||||
const SensorCollisionMask& mask, SystemGroupHandler* group_handler,
|
||||
int num_points, const sead::SafeString& name, int a,
|
||||
LowPriority low_priority);
|
||||
|
||||
// TODO: figure out if this is really only used with spheres
|
||||
SphereBasedClosestPointQuery(RigidBody* sphere, const sead::Vector3f& position, int num_points,
|
||||
const sead::SafeString& name, int a, LowPriority low_priority);
|
||||
|
||||
~SphereBasedClosestPointQuery() override;
|
||||
|
||||
protected:
|
||||
void makeAndSetSphere(RigidBodyInstanceParam* sphere_param, sead::Heap* heap,
|
||||
const sead::Vector3f& position,
|
||||
const LayerMaskBuilder* layer_mask_builder = nullptr);
|
||||
|
||||
RigidBody* mSphere;
|
||||
};
|
||||
|
||||
} // namespace ksys::phys
|
||||
|
|
|
|||
Loading…
Reference in New Issue