summaryrefslogtreecommitdiff
path: root/src/KingSystem/Physics/RigidBody/Shape/List/physListShapeRigidBody.h
blob: 8eb340a18d7dc7b10f1c5eee862085e5613a0156 (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
66
67
68
#pragma once

#include "KingSystem/Physics/RigidBody/physRigidBodyFromShape.h"

namespace ksys::phys {

struct BoxShapeParam;
struct CapsuleShapeParam;
struct CharacterPrismShapeParam;
struct CylinderShapeParam;
struct PolytopeShapeParam;
struct SphereShapeParam;

class ListShape;

class ListShapeRigidBody : public RigidBodyFromShape {
    SEAD_RTTI_OVERRIDE(ListShapeRigidBody, RigidBodyFromShape)
public:
    static ListShapeRigidBody* make(RigidBodyInstanceParam* param, sead::Heap* heap);

    ListShapeRigidBody(hkpRigidBody* hk_body, ListShape* shape, ContactLayerType layer_type,
                       const sead::SafeString& name, bool set_flag_10, sead::Heap* heap);
    ~ListShapeRigidBody() override;

    /// Replace the shape at the specified index with a new sphere shape.
    /// The shape that is being replaced will be deleted.
    Shape* replaceWithNewSphere(int index, const SphereShapeParam& param, sead::Heap* heap);

    /// Replace the shape at the specified index with a new capsule shape.
    /// The shape that is being replaced will be deleted.
    Shape* replaceWithNewCapsule(int index, const CapsuleShapeParam& param, sead::Heap* heap);

    /// Replace the shape at the specified index with a new cylinder shape.
    /// The shape that is being replaced will be deleted.
    Shape* replaceWithNewCylinder(int index, const CylinderShapeParam& param, sead::Heap* heap);

    /// Replace the shape at the specified index with a new box shape.
    /// The shape that is being replaced will be deleted.
    Shape* replaceWithNewBox(int index, const BoxShapeParam& param, sead::Heap* heap);

    /// Replace the shape at the specified index with a new polytope shape.
    /// The shape that is being replaced will be deleted.
    Shape* replaceWithNewPolytope(int index, const PolytopeShapeParam& param, sead::Heap* heap);

    /// Replace the shape at the specified index with a new character prism.
    /// The shape that is being replaced will be deleted.
    Shape* replaceWithNewCharacterPrism(int index, const CharacterPrismShapeParam& param,
                                        sead::Heap* heap);

    /// Set the material mask for the shape at the specified index.
    void setMaterialMask(const MaterialMask& mask, int index);

    /// Get the material mask for the shape at the specified index.
    const MaterialMask& getMaterialMask(int index) const;

    float getVolume() override;

protected:
    Shape* getShape_() override;
    const Shape* getShape_() const override;
    u32 getCollisionMasks(RigidBody::CollisionMasks* masks, const u32* unk,
                          const sead::Vector3f& contact_point) override;

private:
    ListShape* mShape{};
};

}  // namespace ksys::phys