summaryrefslogtreecommitdiff
path: root/src/KingSystem/Physics/RigidBody/Shape/physCylinderWaterShape.h
blob: 02e8de2433eb90106640f138e1e0be970dac35e4 (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
#pragma once

#include <prim/seadTypedBitFlag.h>
#include <thread/seadAtomic.h>
#include "KingSystem/Physics/RigidBody/Shape/physCylinderShape.h"
#include "KingSystem/Physics/RigidBody/physRigidBody.h"
#include "KingSystem/Physics/RigidBody/physRigidBodyParam.h"
#include "KingSystem/Physics/physMaterialMask.h"

namespace ksys::phys {

class HavokCylinderWaterShape;

class CylinderWaterShape : public Shape {
    SEAD_RTTI_OVERRIDE(CylinderWaterShape, Shape)
public:
    enum class Flag {
        Dirty = 1 << 0,
    };

    static CylinderWaterShape* make(const CylinderShapeParam& param, sead::Heap* heap);

    CylinderWaterShape(const CylinderShapeParam& param, HavokCylinderWaterShape* shape);
    ~CylinderWaterShape() override;

    void setMaterialMask(const MaterialMask& mask);
    bool setRadius(float radius);
    bool setHeight(float height);

    CylinderWaterShape* clone(sead::Heap* heap) const;

    const MaterialMask& getMaterialMask() const { return mMaterialMask; }
    float getRadius() const;
    float getHeight() const;

    float getVolume() const override;
    hkpShape* getHavokShape() override;
    const hkpShape* getHavokShape() const override;
    const hkpShape* updateHavokShape() override;
    void setScale(float scale) override;
    ShapeType getType() const override { return ShapeType::CylinderWater; }

private:
    MaterialMask mMaterialMask;
    sead::TypedBitFlag<Flag, sead::Atomic<u32>> mFlags;
    HavokCylinderWaterShape* mHavokShape;
};

}  // namespace ksys::phys