NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
math_geometry.h
1
#ifndef NW4R_MATH_GEOMETRY_H
2
#define NW4R_MATH_GEOMETRY_H
3
#include <nw4r/types_nw4r.h>
4
5
#include <nw4r/math/math_types.h>
6
7
namespace
nw4r {
8
namespace
math
{
9
10
// Forward declarations
11
struct
AABB
;
12
13
enum
IntersectionResult {
14
INTERSECTION_NONE,
15
INTERSECTION_1,
16
INTERSECTION_2,
17
18
INTERSECTION_LINE3_ON_PLANE = INTERSECTION_2,
19
INTERSECTION_RAY3_ON_PLANE = INTERSECTION_2,
20
INTERSECTION_SEGMENT3_ON_PLANE = INTERSECTION_2,
21
22
INTERSECTION_OUTSIDE = 0,
23
INTERSECTION_INSIDE,
24
INTERSECTION_INTERSECT
25
};
26
27
bool
IntersectionAABB(
const
AABB
* pA,
const
AABB
* pB);
28
29
/******************************************************************************
30
*
31
* Plane
32
*
33
******************************************************************************/
34
struct
PLANE {
35
PLANE() {}
36
37
f32 Test(
const
VEC3
& rPoint)
const
{
38
return
d + VEC3Dot(&n, &rPoint);
39
}
40
41
void
Set(
const
VEC3
* p0,
const
VEC3
* p1,
const
VEC3
* p2);
42
43
VEC3
n;
// at 0x0
44
f32 d;
// at 0xC
45
};
46
47
/******************************************************************************
48
*
49
* Axis-aligned bounding box
50
*
51
******************************************************************************/
52
struct
AABB {
53
AABB() {}
54
55
void
Set(
const
VEC3
* pPoints,
unsigned
int
num);
56
void
Set(
const
AABB* pBox,
const
MTX34
* pMtx);
57
58
VEC3
min;
// at 0x0
59
VEC3
max;
// at 0xC
60
};
61
62
/******************************************************************************
63
*
64
* Frustum
65
*
66
******************************************************************************/
67
class
FRUSTUM
{
68
private
:
69
enum
Point {
70
POINT_NEAR_TL,
71
POINT_NEAR_TR,
72
POINT_NEAR_BR,
73
POINT_NEAR_BL,
74
75
POINT_FAR_TL,
76
POINT_FAR_TR,
77
POINT_FAR_BR,
78
POINT_FAR_BL,
79
80
POINT_MAX
81
};
82
83
enum
Plane {
84
PLANE_L,
85
PLANE_R,
86
PLANE_N,
87
PLANE_F,
88
PLANE_T,
89
PLANE_B,
90
91
PLANE_MAX
92
};
93
94
public
:
95
void
Set(f32 fovy, f32 aspect, f32 n, f32 f,
const
MTX34
& rCamMtx);
96
void
Set(f32 t, f32 b, f32 l, f32 r, f32 n, f32 f,
const
MTX34
& rCamMtx);
97
98
IntersectionResult IntersectAABB_Ex(
const
AABB
* pBox)
const
;
99
100
private
:
101
MTX34
mCamMtx;
// at 0x0
102
PLANE
mPlaneL;
// at 0x30
103
PLANE
mPlaneR;
// at 0x40
104
PLANE
mPlaneT;
// at 0x50
105
PLANE
mPlaneB;
// at 0x60
106
f32 mNearZ;
// at 0x70
107
f32 mFarZ;
// at 0x74
108
AABB
mBox;
// at 0x78
109
PLANE
mPlanes[PLANE_MAX];
// at 0x90
110
};
111
112
}
// namespace math
113
}
// namespace nw4r
114
115
#endif
nw4r::math::FRUSTUM
Definition
math_geometry.h:67
nw4r::math
Math library.
Definition
math_arithmetic.h:12
nw4r::math::AABB
Definition
math_geometry.h:52
nw4r::math::MTX34
Definition
math_types.h:208
nw4r::math::PLANE
Definition
math_geometry.h:34
nw4r::math::VEC3
Definition
math_types.h:81
include
lib
nw4r
math
math_geometry.h
Made with ❤️ by
CLF78
and
RootCubed
. Logos by
Chasical
and
B1
. Website generated by
Doxygen
1.13.2