ksys/phys: Add BoxWaterRigidBody

This commit is contained in:
Léo Lam 2022-02-02 15:09:28 +01:00
parent 2af9e079d0
commit 55164640d5
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
4 changed files with 122 additions and 20 deletions

View File

@ -83167,22 +83167,22 @@ Address,Quality,Size,Name
0x0000007100f9746c,O,000288,_ZNK4ksys4phys12BoxRigidBody27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
0x0000007100f9758c,O,000092,_ZNK4ksys4phys12BoxRigidBody18getRuntimeTypeInfoEv
0x0000007100f975e8,U,000004,
0x0000007100f975ec,U,000088,
0x0000007100f97644,U,000076,
0x0000007100f97690,U,000076,
0x0000007100f976dc,U,000084,
0x0000007100f97730,U,000084,
0x0000007100f97784,U,000056,
0x0000007100f977bc,U,000056,
0x0000007100f977f4,U,000012,
0x0000007100f97800,U,000008,
0x0000007100f97808,U,000012,
0x0000007100f97814,U,000016,
0x0000007100f97824,U,000008,
0x0000007100f9782c,U,000008,
0x0000007100f97834,U,000068,
0x0000007100f97878,U,000288,
0x0000007100f97998,U,000092,
0x0000007100f975ec,O,000088,_ZN4ksys4phys17BoxWaterRigidBodyC1EP12hkpRigidBodyPNS0_13BoxWaterShapeENS0_16ContactLayerTypeERKN4sead14SafeStringBaseIcEEbPNS7_4HeapE
0x0000007100f97644,O,000076,_ZN4ksys4phys17BoxWaterRigidBodyD1Ev
0x0000007100f97690,O,000076,_ZThn32_N4ksys4phys17BoxWaterRigidBodyD1Ev
0x0000007100f976dc,O,000084,_ZN4ksys4phys17BoxWaterRigidBodyD0Ev
0x0000007100f97730,O,000084,_ZThn32_N4ksys4phys17BoxWaterRigidBodyD0Ev
0x0000007100f97784,O,000056,_ZN4ksys4phys17BoxWaterRigidBody10setExtentsERKN4sead7Vector3IfEE
0x0000007100f977bc,O,000056,_ZN4ksys4phys17BoxWaterRigidBody12setTranslateERKN4sead7Vector3IfEE
0x0000007100f977f4,O,000012,_ZNK4ksys4phys17BoxWaterRigidBody10getExtentsEv
0x0000007100f97800,O,000008,_ZN4ksys4phys17BoxWaterRigidBody15setMaterialMaskERKNS0_12MaterialMaskE
0x0000007100f97808,O,000012,_ZNK4ksys4phys17BoxWaterRigidBody15getMaterialMaskEv
0x0000007100f97814,O,000016,_ZN4ksys4phys17BoxWaterRigidBody9getVolumeEv
0x0000007100f97824,O,000008,_ZN4ksys4phys17BoxWaterRigidBody9getShape_Ev
0x0000007100f9782c,O,000008,_ZNK4ksys4phys17BoxWaterRigidBody9getShape_Ev
0x0000007100f97834,O,000068,_ZN4ksys4phys17BoxWaterRigidBody17getCollisionMasksEPNS0_9RigidBody14CollisionMasksE
0x0000007100f97878,O,000288,_ZNK4ksys4phys17BoxWaterRigidBody27checkDerivedRuntimeTypeInfoEPKN4sead15RuntimeTypeInfo9InterfaceE
0x0000007100f97998,O,000092,_ZNK4ksys4phys17BoxWaterRigidBody18getRuntimeTypeInfoEv
0x0000007100f979f4,U,000004,j__ZN4ksys4phys16RigidBodyFactory13createCapsuleEPNS0_18RigidBodyParamViewEPN4sead4HeapE
0x0000007100f979f8,U,000084,
0x0000007100f97a4c,U,000088,

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

View File

@ -40,12 +40,14 @@ target_sources(uking PRIVATE
RigidBody/physRigidBodySetParam.cpp
RigidBody/physRigidBodySetParam.h
RigidBody/Shape/physBoxShape.cpp
RigidBody/Shape/physBoxShape.h
RigidBody/Shape/physBoxWaterShape.cpp
RigidBody/Shape/physBoxWaterShape.h
RigidBody/Shape/physBoxRigidBody.cpp
RigidBody/Shape/physBoxRigidBody.h
RigidBody/Shape/physBoxShape.cpp
RigidBody/Shape/physBoxShape.h
RigidBody/Shape/physBoxWaterRigidBody.cpp
RigidBody/Shape/physBoxWaterRigidBody.h
RigidBody/Shape/physBoxWaterShape.cpp
RigidBody/Shape/physBoxWaterShape.h
RigidBody/Shape/physCapsuleShape.cpp
RigidBody/Shape/physCapsuleShape.h
RigidBody/Shape/physCharacterPrismShape.cpp

View File

@ -0,0 +1,60 @@
#include "KingSystem/Physics/RigidBody/Shape/physBoxWaterRigidBody.h"
#include "KingSystem/Physics/RigidBody/Shape/physBoxWaterShape.h"
namespace ksys::phys {
BoxWaterRigidBody::BoxWaterRigidBody(hkpRigidBody* hk_body, BoxWaterShape* shape,
ContactLayerType layer_type, const sead::SafeString& name,
bool unused, sead::Heap* heap)
: RigidBodyFromShape(hk_body, layer_type, name, true, heap), mShape(shape) {}
BoxWaterRigidBody::~BoxWaterRigidBody() {
delete mShape;
}
void BoxWaterRigidBody::setExtents(const sead::Vector3f& extents) {
if (mShape->setExtents(extents))
updateShape();
}
void BoxWaterRigidBody::setTranslate(const sead::Vector3f& translate) {
if (mShape->setTranslate(translate))
updateShape();
}
const sead::Vector3f& BoxWaterRigidBody::getExtents() const {
return mShape->mExtents;
}
const sead::Vector3f& BoxWaterRigidBody::getTranslate() const {
return mShape->mTranslate;
}
void BoxWaterRigidBody::setMaterialMask(const MaterialMask& mask) {
mShape->setMaterialMask(mask);
}
const MaterialMask& BoxWaterRigidBody::getMaterialMask() const {
return mShape->mMaterialMask;
}
float BoxWaterRigidBody::getVolume() {
return mShape->getVolume();
}
Shape* BoxWaterRigidBody::getShape_() {
return mShape;
}
const Shape* BoxWaterRigidBody::getShape_() const {
return mShape;
}
u32 BoxWaterRigidBody::getCollisionMasks(RigidBody::CollisionMasks* masks) {
masks->ignored_layers = ~mContactMask.getDirect();
masks->collision_filter_info = getCollisionFilterInfo();
masks->material_mask = getMaterialMask().getRawData();
return 0;
}
} // namespace ksys::phys

View File

@ -0,0 +1,40 @@
#pragma once
#include "KingSystem/Physics/RigidBody/physRigidBodyFromShape.h"
namespace ksys::phys {
class BoxWaterShape;
class BoxWaterRigidBody : public RigidBodyFromShape {
SEAD_RTTI_OVERRIDE(BoxWaterRigidBody, RigidBodyFromShape)
public:
static BoxWaterRigidBody* make(RigidBodyInstanceParam* param, sead::Heap* heap);
BoxWaterRigidBody(hkpRigidBody* hk_body, BoxWaterShape* shape, ContactLayerType layer_type,
const sead::SafeString& name, bool unused, sead::Heap* heap);
~BoxWaterRigidBody() override;
/// Set the box extents and trigger a shape update.
void setExtents(const sead::Vector3f& extents);
/// Set the box translation and trigger a shape update.
void setTranslate(const sead::Vector3f& translate);
const sead::Vector3f& getExtents() const;
const sead::Vector3f& getTranslate() const;
void setMaterialMask(const MaterialMask& mask);
const MaterialMask& getMaterialMask() const;
float getVolume() override;
protected:
Shape* getShape_() override;
const Shape* getShape_() const override;
u32 getCollisionMasks(CollisionMasks* masks) override;
BoxWaterShape* mShape;
u32 _d8{};
};
} // namespace ksys::phys