summaryrefslogtreecommitdiff
path: root/include/SSystem/SComponent/c_m3d_g_sph.h
blob: dcc7d4151333e25a88486fcfeadb41ab16de4790 (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
#ifndef C_M3D_G_SPH_H_
#define C_M3D_G_SPH_H_

#include "SSystem/SComponent/c_m3d.h"
#include "SSystem/SComponent/c_xyz.h"
#include "global.h"

class cM3dGCyl;

struct cM3dGSphS {
    /* 0x0 */ Vec mCenter;
    /* 0xC */ f32 mRadius;
};  // Size: 0x10

class cM3dGSph {
public:
    /* 0x00 */ cXyz mCenter;
    /* 0x0C */ f32 mRadius;
    /* 0x10 vtable */

    cM3dGSph() {}
    virtual ~cM3dGSph() {}
#if VERSION == VERSION_DEMO
    void SetC(const cXyz& p) { mCenter = p; }
    void SetR(f32 r) { mRadius = r; }
#else
    void SetC(const cXyz& p);
    void SetR(f32 r);
#endif
    void SetC(f32 x, f32 y, f32 z) { mCenter.x = x; mCenter.y = y; mCenter.z = z; }
    void Set(const cM3dGSphS & src) {
        SetC(src.mCenter);
        SetR(src.mRadius);
    }
    void Set(const cXyz& srcCenter, f32 srcRadius) {
        SetC(srcCenter);
        SetR(srcRadius);
    }
    bool Cross(const cM3dGCps* cps, cXyz* dst) const {
        return cM3d_Cross_CpsSph(*cps, *this, dst);
    }
    bool Cross(const cM3dGTri& tri, cXyz* dst) const {
        return cM3d_Cross_SphTri(this, &tri, dst);
    }
    bool cross(const cM3dGCyl*, cXyz*) const;
    bool cross(const cM3dGSph*, cXyz*) const;
    bool cross(const cM3dGSph*, f32*) const;
    bool cross(const cM3dGCyl* cyl, f32* out) const {
        cXyz temp;
        return cM3d_Cross_CylSph(cyl, this, &temp, out);
    }
    bool cross(const cM3dGTri *param_1) const {
        return cM3d_Cross_SphTri(this, param_1);
    }
    const cXyz& GetC() const { return mCenter; }
    cXyz& GetC() { return mCenter; }
    const cXyz* GetCP() const { return &mCenter; }
    cXyz* GetCP() { return &mCenter; }
    const f32 GetR() const { return mRadius; }
    f32 GetCX() const { return mCenter.x; }
    f32 GetCY() const { return mCenter.y; }
    f32 GetCZ() const { return mCenter.z; }
};  // Size = 0x14

STATIC_ASSERT(0x14 == sizeof(cM3dGSph));

#endif