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
|
#pragma once
#include <prim/seadRuntimeTypeInfo.h>
#include <prim/seadSafeString.h>
#include "KingSystem/Physics/physDefines.h"
#include "KingSystem/Physics/physMaterialMask.h"
class hkpShape;
namespace ksys::phys {
enum class ShapeType {
Sphere = 0,
Capsule = 1,
Box = 2,
Cylinder = 3,
Polytope = 4,
List = 5,
CharacterPrism = 6,
BoxWater = 7,
CylinderWater = 8,
Unknown = -1,
};
class Shape {
SEAD_RTTI_BASE(Shape)
public:
Shape() = default;
virtual ShapeType getType() const = 0;
virtual float getVolume() const = 0;
virtual ~Shape() = default;
virtual hkpShape* getHavokShape() = 0;
virtual const hkpShape* getHavokShape() const = 0;
/// Update the underlying Havok shape if necessary. This may recreate the Havok shape.
/// @return a pointer to the new underlying Havok shape if it was recreated, null otherwise
virtual const hkpShape* updateHavokShape() = 0;
/// @param scale New scale (relative to the current scale)
virtual void setScale(float scale) = 0;
const hkpShape* getHavokShapeConst() const { return getHavokShape(); }
};
struct CommonShapeParam {
MaterialMask getMaterialMask(bool flag = false) const {
return {material, sub_material, floor_code, wall_code, flag};
}
Material material;
const char* sub_material = sead::SafeString::cEmptyString.cstr();
FloorCode floor_code;
WallCode wall_code;
bool item_code_disable_stick = false;
};
} // namespace ksys::phys
|