summaryrefslogtreecommitdiff
path: root/src/KingSystem/Physics/RigidBody/Shape/BoxWater/physBoxWaterRigidBody.cpp
blob: 3f30214fc5f3f0dc11964a8f3d225fca0e4e34f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "KingSystem/Physics/RigidBody/Shape/BoxWater/physBoxWaterRigidBody.h"
#include "KingSystem/Physics/RigidBody/Shape/BoxWater/physBoxWaterShape.h"

namespace ksys::phys {

BoxWaterRigidBody* BoxWaterRigidBody::make(RigidBodyInstanceParam* param, sead::Heap* heap) {
    return createBoxWater(param, heap);
}

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, const u32* unk,
                                         const sead::Vector3f& contact_point) {
    masks->ignored_layers = ~mContactMask.getDirect();
    masks->collision_filter_info = getCollisionFilterInfo();
    masks->material_mask = getMaterialMask().getRawData();
    return 0;
}

}  // namespace ksys::phys