ksys/phys: Start adding BoxRigidBody

This commit is contained in:
Léo Lam 2022-01-30 18:39:00 +01:00
parent 716916d863
commit ff2e2f9ff7
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
9 changed files with 86 additions and 19 deletions

View File

@ -83084,7 +83084,7 @@ Address,Quality,Size,Name
0x0000007100f93e28,O,000176,_ZN4ksys4phys9RigidBody18setLinkedRigidBodyEPS1_ 0x0000007100f93e28,O,000176,_ZN4ksys4phys9RigidBody18setLinkedRigidBodyEPS1_
0x0000007100f93ed8,O,000156,_ZNK4ksys4phys9RigidBody26isSensorMotionFlag40000SetEv 0x0000007100f93ed8,O,000156,_ZNK4ksys4phys9RigidBody26isSensorMotionFlag40000SetEv
0x0000007100f93f74,O,000008,_ZN4ksys4phys9RigidBody12updateScale_Eff 0x0000007100f93f74,O,000008,_ZN4ksys4phys9RigidBody12updateScale_Eff
0x0000007100f93f7c,O,000008,_ZN4ksys4phys9RigidBody2m4Ev 0x0000007100f93f7c,O,000008,_ZN4ksys4phys9RigidBody9getVolumeEv
0x0000007100f93f84,O,000152,_ZN4ksys4phys9RigidBody21setWaterBuoyancyScaleEf 0x0000007100f93f84,O,000152,_ZN4ksys4phys9RigidBody21setWaterBuoyancyScaleEf
0x0000007100f9401c,O,000148,_ZNK4ksys4phys9RigidBody21getWaterBuoyancyScaleEv 0x0000007100f9401c,O,000148,_ZNK4ksys4phys9RigidBody21getWaterBuoyancyScaleEv
0x0000007100f940b0,O,000152,_ZN4ksys4phys9RigidBody25setWaterFlowEffectiveRateEf 0x0000007100f940b0,O,000152,_ZN4ksys4phys9RigidBody25setWaterFlowEffectiveRateEf
@ -83147,12 +83147,12 @@ Address,Quality,Size,Name
0x0000007100f97004,O,000112,_ZNK4ksys4phys9RigidBody27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE 0x0000007100f97004,O,000112,_ZNK4ksys4phys9RigidBody27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
0x0000007100f97074,O,000092,_ZNK4ksys4phys9RigidBody18getRuntimeTypeInfoEv 0x0000007100f97074,O,000092,_ZNK4ksys4phys9RigidBody18getRuntimeTypeInfoEv
0x0000007100f970d0,O,000140,_ZNK4sead15RuntimeTypeInfo6DeriveIN4ksys4phys14MotionAccessorEE9isDerivedEPKNS0_9InterfaceE 0x0000007100f970d0,O,000140,_ZNK4sead15RuntimeTypeInfo6DeriveIN4ksys4phys14MotionAccessorEE9isDerivedEPKNS0_9InterfaceE
0x0000007100f9715c,U,000004,j__ZN4ksys4phys16RigidBodyFactory9createBoxEPNS0_18RigidBodyParamViewEPN4sead4HeapE 0x0000007100f9715c,O,000004,_ZN4ksys4phys12BoxRigidBody4makeEPNS0_22RigidBodyInstanceParamEPN4sead4HeapE
0x0000007100f97160,U,000084, 0x0000007100f97160,O,000084,_ZN4ksys4phys12BoxRigidBodyC1EP12hkpRigidBodyPNS0_8BoxShapeENS0_16ContactLayerTypeERKN4sead14SafeStringBaseIcEEbPNS7_4HeapE
0x0000007100f971b4,U,000088, 0x0000007100f971b4,O,000088,_ZN4ksys4phys12BoxRigidBodyD1Ev
0x0000007100f9720c,U,000088, 0x0000007100f9720c,O,000088,_ZThn32_N4ksys4phys12BoxRigidBodyD1Ev
0x0000007100f97264,U,000096, 0x0000007100f97264,O,000096,_ZN4ksys4phys12BoxRigidBodyD0Ev
0x0000007100f972c4,U,000096, 0x0000007100f972c4,O,000096,_ZThn32_N4ksys4phys12BoxRigidBodyD0Ev
0x0000007100f97324,U,000056, 0x0000007100f97324,U,000056,
0x0000007100f9735c,U,000056, 0x0000007100f9735c,U,000056,
0x0000007100f97394,U,000012, 0x0000007100f97394,U,000012,
@ -83160,12 +83160,12 @@ Address,Quality,Size,Name
0x0000007100f973ac,U,000072, 0x0000007100f973ac,U,000072,
0x0000007100f973f4,U,000008, 0x0000007100f973f4,U,000008,
0x0000007100f973fc,U,000012, 0x0000007100f973fc,U,000012,
0x0000007100f97408,U,000016, 0x0000007100f97408,O,000016,_ZN4ksys4phys12BoxRigidBody9getVolumeEv
0x0000007100f97418,U,000008, 0x0000007100f97418,O,000008,_ZN4ksys4phys12BoxRigidBody9getShape_Ev
0x0000007100f97420,U,000008, 0x0000007100f97420,O,000008,_ZNK4ksys4phys12BoxRigidBody9getShape_Ev
0x0000007100f97428,U,000068, 0x0000007100f97428,U,000068,
0x0000007100f9746c,U,000288, 0x0000007100f9746c,O,000288,_ZNK4ksys4phys12BoxRigidBody27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
0x0000007100f9758c,U,000092, 0x0000007100f9758c,O,000092,_ZNK4ksys4phys12BoxRigidBody18getRuntimeTypeInfoEv
0x0000007100f975e8,U,000004, 0x0000007100f975e8,U,000004,
0x0000007100f975ec,U,000088, 0x0000007100f975ec,U,000088,
0x0000007100f97644,U,000076, 0x0000007100f97644,U,000076,

Can't render this file because it is too large.

View File

@ -42,6 +42,8 @@ target_sources(uking PRIVATE
RigidBody/Shape/physBoxShape.cpp RigidBody/Shape/physBoxShape.cpp
RigidBody/Shape/physBoxShape.h RigidBody/Shape/physBoxShape.h
RigidBody/Shape/physBoxRigidBody.cpp
RigidBody/Shape/physBoxRigidBody.h
RigidBody/Shape/physCapsuleShape.cpp RigidBody/Shape/physCapsuleShape.cpp
RigidBody/Shape/physCapsuleShape.h RigidBody/Shape/physCapsuleShape.h
RigidBody/Shape/physCharacterPrismShape.cpp RigidBody/Shape/physCharacterPrismShape.cpp

View File

@ -0,0 +1,34 @@
#include "KingSystem/Physics/RigidBody/Shape/physBoxRigidBody.h"
#include "KingSystem/Physics/RigidBody/Shape/physBoxShape.h"
#include "KingSystem/Physics/RigidBody/physRigidBodyFactory.h"
namespace ksys::phys {
BoxRigidBody* BoxRigidBody::make(RigidBodyInstanceParam* param, sead::Heap* heap) {
return RigidBodyFactory::createBox(param, heap);
}
BoxRigidBody::BoxRigidBody(hkpRigidBody* hk_body, BoxShape* shape, ContactLayerType layer_type,
const sead::SafeString& name, bool set_flag_10, sead::Heap* heap)
: RigidBodyFromShape(hk_body, layer_type, name, set_flag_10, heap), mShape(shape) {}
BoxRigidBody::~BoxRigidBody() {
if (hasFlag(RigidBody::Flag::_10) && mShape) {
delete mShape;
mShape = nullptr;
}
}
float BoxRigidBody::getVolume() {
return mShape->getVolume();
}
Shape* BoxRigidBody::getShape_() {
return mShape;
}
const Shape* BoxRigidBody::getShape_() const {
return mShape;
}
} // namespace ksys::phys

View File

@ -0,0 +1,29 @@
#pragma once
#include "KingSystem/Physics/RigidBody/physRigidBodyFromShape.h"
namespace ksys::phys {
struct BoxShape;
struct RigidBodyInstanceParam;
class BoxRigidBody : public RigidBodyFromShape {
SEAD_RTTI_OVERRIDE(BoxRigidBody, RigidBodyFromShape)
public:
static BoxRigidBody* make(RigidBodyInstanceParam* param, sead::Heap* heap);
BoxRigidBody(hkpRigidBody* hk_body, BoxShape* shape, ContactLayerType layer_type,
const sead::SafeString& name, bool set_flag_10, sead::Heap* heap);
~BoxRigidBody() override;
float getVolume() override;
protected:
Shape* getShape_() override;
const Shape* getShape_() const override;
void m9() override;
BoxShape* mShape;
};
} // namespace ksys::phys

View File

@ -8,11 +8,12 @@
namespace ksys::phys { namespace ksys::phys {
class BoxParam; class BoxParam;
class BoxRigidBody;
struct BoxShape { struct BoxShape : Shape {
virtual ~BoxShape(); ~BoxShape() override;
RigidBody* createBody(bool flag, const RigidBodyInstanceParam& params, sead::Heap* heap); BoxRigidBody* createBody(bool flag, const RigidBodyInstanceParam& params, sead::Heap* heap);
}; };
struct BoxShapeParam { struct BoxShapeParam {

View File

@ -1486,7 +1486,7 @@ float RigidBody::updateScale_(float scale, float old_scale) {
return old_scale; return old_scale;
} }
float RigidBody::m4() { float RigidBody::getVolume() {
return 0.0; return 0.0;
} }

View File

@ -128,7 +128,7 @@ public:
const sead::SafeString& name, sead::Heap* heap, bool set_flag_10); const sead::SafeString& name, sead::Heap* heap, bool set_flag_10);
~RigidBody() override; ~RigidBody() override;
virtual float m4(); virtual float getVolume();
bool initMotionAccessorForDynamicMotion(sead::Heap* heap); bool initMotionAccessorForDynamicMotion(sead::Heap* heap);
bool initMotionAccessor(const RigidBodyInstanceParam& param, sead::Heap* heap, bool initMotionAccessor(const RigidBodyInstanceParam& param, sead::Heap* heap,

View File

@ -44,7 +44,7 @@ RigidBody* RigidBodyFactory::createCylinderWater(RigidBodyInstanceParam* params,
return shape->createBody(true, *params, heap); return shape->createBody(true, *params, heap);
} }
RigidBody* RigidBodyFactory::createBox(RigidBodyInstanceParam* params, sead::Heap* heap) { BoxRigidBody* RigidBodyFactory::createBox(RigidBodyInstanceParam* params, sead::Heap* heap) {
if (params->isDynamicSensor()) if (params->isDynamicSensor())
params->motion_type = MotionType::Keyframed; params->motion_type = MotionType::Keyframed;

View File

@ -8,6 +8,7 @@ class Heap;
namespace ksys::phys { namespace ksys::phys {
class BoxRigidBody;
class RigidBody; class RigidBody;
struct RigidBodyInstanceParam; struct RigidBodyInstanceParam;
@ -17,7 +18,7 @@ public:
static RigidBody* createCapsule(RigidBodyInstanceParam* params, sead::Heap* heap); static RigidBody* createCapsule(RigidBodyInstanceParam* params, sead::Heap* heap);
static RigidBody* createCylinder(RigidBodyInstanceParam* params, sead::Heap* heap); static RigidBody* createCylinder(RigidBodyInstanceParam* params, sead::Heap* heap);
static RigidBody* createCylinderWater(RigidBodyInstanceParam* params, sead::Heap* heap); static RigidBody* createCylinderWater(RigidBodyInstanceParam* params, sead::Heap* heap);
static RigidBody* createBox(RigidBodyInstanceParam* params, sead::Heap* heap); static BoxRigidBody* createBox(RigidBodyInstanceParam* params, sead::Heap* heap);
static RigidBody* createWaterBox(RigidBodyInstanceParam* params, sead::Heap* heap); static RigidBody* createWaterBox(RigidBodyInstanceParam* params, sead::Heap* heap);
static RigidBody* createPolytope(RigidBodyInstanceParam* params, sead::Heap* heap); static RigidBody* createPolytope(RigidBodyInstanceParam* params, sead::Heap* heap);
static RigidBody* createCollection(RigidBodyInstanceParam* params, sead::Heap* heap); static RigidBody* createCollection(RigidBodyInstanceParam* params, sead::Heap* heap);