From 509d557731ce02136f79026ce1e1d5683c93876f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Lam?= Date: Mon, 21 Mar 2022 00:30:56 +0100 Subject: [PATCH] ksys/phys: RayCastPlusBody -> RayCastBodyQuery for clarity --- data/uking_functions.csv | 18 ++++++------ src/KingSystem/Physics/CMakeLists.txt | 4 +-- .../Physics/System/physRayCastBodyQuery.cpp | 29 +++++++++++++++++++ ...yCastPlusBody.h => physRayCastBodyQuery.h} | 9 +++--- .../Physics/System/physRayCastPlusBody.cpp | 29 ------------------- 5 files changed, 45 insertions(+), 44 deletions(-) create mode 100644 src/KingSystem/Physics/System/physRayCastBodyQuery.cpp rename src/KingSystem/Physics/System/{physRayCastPlusBody.h => physRayCastBodyQuery.h} (59%) delete mode 100644 src/KingSystem/Physics/System/physRayCastPlusBody.cpp diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 729bc1f2..abff23a2 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -84055,15 +84055,15 @@ Address,Quality,Size,Name 0x0000007100fc5218,O,000112,_ZNK4ksys4phys7RayCast27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE 0x0000007100fc5288,O,000092,_ZNK4ksys4phys7RayCast18getRuntimeTypeInfoEv 0x0000007100fc52e4,O,000004,_ZN4ksys4phys7RayCast14onRigidBodyHitEPNS0_9RigidBodyE -0x0000007100fc52e8,O,000056,_ZN4ksys4phys15RayCastPlusBodyC1EPNS0_18SystemGroupHandlerENS0_9GroundHitE -0x0000007100fc5320,O,000004,_ZN4ksys4phys15RayCastPlusBodyD1Ev -0x0000007100fc5324,O,000036,_ZN4ksys4phys15RayCastPlusBodyD0Ev -0x0000007100fc5348,O,000008,_ZN4ksys4phys15RayCastPlusBody12worldRayCastENS0_16ContactLayerTypeE -0x0000007100fc5350,O,000008,_ZN4ksys4phys15RayCastPlusBody12shapeRayCastEPNS0_9RigidBodyE -0x0000007100fc5358,O,000008,_ZN4ksys4phys15RayCastPlusBody14phantomRayCastEPNS0_7PhantomE -0x0000007100fc5360,O,000008,_ZN4ksys4phys15RayCastPlusBody14onRigidBodyHitEPNS0_9RigidBodyE -0x0000007100fc5368,O,000204,_ZNK4ksys4phys15RayCastPlusBody27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE -0x0000007100fc5434,O,000092,_ZNK4ksys4phys15RayCastPlusBody18getRuntimeTypeInfoEv +0x0000007100fc52e8,O,000056,_ZN4ksys4phys16RayCastBodyQueryC1EPNS0_18SystemGroupHandlerENS0_9GroundHitE +0x0000007100fc5320,O,000004,_ZN4ksys4phys16RayCastBodyQueryD1Ev +0x0000007100fc5324,O,000036,_ZN4ksys4phys16RayCastBodyQueryD0Ev +0x0000007100fc5348,O,000008,_ZN4ksys4phys16RayCastBodyQuery12worldRayCastENS0_16ContactLayerTypeE +0x0000007100fc5350,O,000008,_ZN4ksys4phys16RayCastBodyQuery12shapeRayCastEPNS0_9RigidBodyE +0x0000007100fc5358,O,000008,_ZN4ksys4phys16RayCastBodyQuery14phantomRayCastEPNS0_7PhantomE +0x0000007100fc5360,O,000008,_ZN4ksys4phys16RayCastBodyQuery14onRigidBodyHitEPNS0_9RigidBodyE +0x0000007100fc5368,O,000204,_ZNK4ksys4phys16RayCastBodyQuery27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE +0x0000007100fc5434,O,000092,_ZNK4ksys4phys16RayCastBodyQuery18getRuntimeTypeInfoEv 0x0000007100fc5490,O,000140,_ZNK4sead15RuntimeTypeInfo6DeriveIN4ksys4phys7RayCastEE9isDerivedEPKNS0_9InterfaceE 0x0000007100fc551c,U,000076,phys::RayCastDerived2::ctor 0x0000007100fc5568,U,000004,phys::RayCastDerived2::dtor diff --git a/src/KingSystem/Physics/CMakeLists.txt b/src/KingSystem/Physics/CMakeLists.txt index f70aee39..e0ff7ea0 100644 --- a/src/KingSystem/Physics/CMakeLists.txt +++ b/src/KingSystem/Physics/CMakeLists.txt @@ -145,8 +145,8 @@ target_sources(uking PRIVATE System/physQueryContactPointInfo.h System/physRayCast.cpp System/physRayCast.h - System/physRayCastPlusBody.cpp - System/physRayCastPlusBody.h + System/physRayCastBodyQuery.cpp + System/physRayCastBodyQuery.h System/physSensorContactListener.cpp System/physSensorContactListener.h System/physSensorGroupFilter.cpp diff --git a/src/KingSystem/Physics/System/physRayCastBodyQuery.cpp b/src/KingSystem/Physics/System/physRayCastBodyQuery.cpp new file mode 100644 index 00000000..ce86f71f --- /dev/null +++ b/src/KingSystem/Physics/System/physRayCastBodyQuery.cpp @@ -0,0 +1,29 @@ +#include "KingSystem/Physics/System/physRayCastBodyQuery.h" + +namespace ksys::phys { + +RayCastBodyQuery::RayCastBodyQuery(SystemGroupHandler* group_handler, GroundHit ground_hit) + : RayCast(group_handler, ground_hit) {} + +RayCastBodyQuery::~RayCastBodyQuery() = default; + +bool RayCastBodyQuery::worldRayCast(ContactLayerType layer_type) { + mHitRigidBody = nullptr; + return RayCast::worldRayCast(layer_type); +} + +bool RayCastBodyQuery::shapeRayCast(RigidBody* rigid_body) { + mHitRigidBody = nullptr; + return RayCast::shapeRayCast(rigid_body); +} + +bool RayCastBodyQuery::phantomRayCast(Phantom* phantom) { + mHitRigidBody = nullptr; + return RayCast::phantomRayCast(phantom); +} + +void RayCastBodyQuery::onRigidBodyHit(RigidBody* body) { + mHitRigidBody = body; +} + +} // namespace ksys::phys diff --git a/src/KingSystem/Physics/System/physRayCastPlusBody.h b/src/KingSystem/Physics/System/physRayCastBodyQuery.h similarity index 59% rename from src/KingSystem/Physics/System/physRayCastPlusBody.h rename to src/KingSystem/Physics/System/physRayCastBodyQuery.h index daceddb8..ee0a65df 100644 --- a/src/KingSystem/Physics/System/physRayCastPlusBody.h +++ b/src/KingSystem/Physics/System/physRayCastBodyQuery.h @@ -4,11 +4,12 @@ namespace ksys::phys { -class RayCastPlusBody : public RayCast { - SEAD_RTTI_OVERRIDE(RayCastPlusBody, RayCast) +/// A RayCast that keeps track of the first rigid body that collided with the ray (if any). +class RayCastBodyQuery : public RayCast { + SEAD_RTTI_OVERRIDE(RayCastBodyQuery, RayCast) public: - RayCastPlusBody(SystemGroupHandler* group_handler, GroundHit ground_hit); - ~RayCastPlusBody() override; + RayCastBodyQuery(SystemGroupHandler* group_handler, GroundHit ground_hit); + ~RayCastBodyQuery() override; bool worldRayCast(ContactLayerType layer_type); bool shapeRayCast(RigidBody* rigid_body); diff --git a/src/KingSystem/Physics/System/physRayCastPlusBody.cpp b/src/KingSystem/Physics/System/physRayCastPlusBody.cpp deleted file mode 100644 index d32e6d5a..00000000 --- a/src/KingSystem/Physics/System/physRayCastPlusBody.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include "KingSystem/Physics/System/physRayCastPlusBody.h" - -namespace ksys::phys { - -RayCastPlusBody::RayCastPlusBody(SystemGroupHandler* group_handler, GroundHit ground_hit) - : RayCast(group_handler, ground_hit) {} - -RayCastPlusBody::~RayCastPlusBody() = default; - -bool RayCastPlusBody::worldRayCast(ContactLayerType layer_type) { - mHitRigidBody = nullptr; - return RayCast::worldRayCast(layer_type); -} - -bool RayCastPlusBody::shapeRayCast(RigidBody* rigid_body) { - mHitRigidBody = nullptr; - return RayCast::shapeRayCast(rigid_body); -} - -bool RayCastPlusBody::phantomRayCast(Phantom* phantom) { - mHitRigidBody = nullptr; - return RayCast::phantomRayCast(phantom); -} - -void RayCastPlusBody::onRigidBodyHit(RigidBody* body) { - mHitRigidBody = body; -} - -} // namespace ksys::phys