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

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

namespace ksys::phys {

class RigidBodyFromResource : public RigidBody {
    SEAD_RTTI_OVERRIDE(RigidBodyFromResource, RigidBody)
public:
    RigidBodyFromResource(float volume, hkpRigidBody* hk_body, ContactLayerType layer_type,
                          sead::Heap* heap, Type type);
    ~RigidBodyFromResource() override;

    bool init(const RigidBodyInstanceParam& param, sead::Heap* heap);

    bool isBvTreeOrStaticCompound() const;
    bool isMaterial(Material material) const;

    float getVolume() override;
    u32 getCollisionMasks(RigidBody::CollisionMasks* masks, const u32* unk,
                          const sead::Vector3f& contact_point) override;

protected:
    float updateScale_(float scale, float old_scale) override;
    const hkpShape* getNewHavokShape_() override;

private:
    const hkpShape* mShape = nullptr;
    float mVolume = 1.0;
    float mCurrentScale = 1.0;
    float mNewScale = 1.0;
};

}  // namespace ksys::phys