NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
m_frustum.hpp
1#pragma once
2
3#include <types.h>
4#include <game/mLib/m_aabb.hpp>
5#include <game/mLib/m_mtx.hpp>
6#include <game/mLib/m_sphere.hpp>
7
8/// @brief A view frustum, used to cull objects outside of the camera's field of view.
9/// @ingroup mlib
11public:
12 mFrustum_c() {} ///< Constructs an empty frustum.
13
14 /**
15 * @brief Builds a symmetric perspective frustum.
16 * @param fovy The vertical field of view, in degrees.
17 * @param aspect The aspect ratio (width / height).
18 * @param near The distance to the near clipping plane.
19 * @param far The distance to the far clipping plane.
20 * @param cameraMtx The matrix defining the camera's transform in world space.
21 */
22 void set(f32 fovy, f32 aspect, f32 n, f32 f, const mMtx_c &cameraMtx);
23
24 /**
25 * @brief Builds an arbitrary perspective or orthographic frustum.
26 * @param top The top boundary.
27 * @param bottom The bottom boundary.
28 * @param left The left boundary.
29 * @param right The right boundary.
30 * @param near The distance to the near clipping plane.
31 * @param far The distance to the far clipping plane.
32 * @param cameraMtx The matrix defining the camera's transform in world space.
33 * @param orthographic @p true for orthographic projection, @p false for perspective projection.
34 */
35 void set(f32 top, f32 bottom, f32 left, f32 right, f32 near, f32 far, const mMtx_c &cameraMtx, bool orthographic);
36
37 /// @brief Checks whether the given sphere is at least partially inside the frustum.
38 bool intersectSphere(const mSphere_c *sphere) const;
39
40 /// @brief Checks whether the given bounding box is at least partially inside the frustum.
41 bool intersectAABB(const mAABB_c *box) const;
42};
An axis-aligned bounding box.
Definition m_aabb.hpp:7
bool intersectAABB(const mAABB_c *box) const
Checks whether the given bounding box is at least partially inside the frustum.
void set(f32 fovy, f32 aspect, f32 n, f32 f, const mMtx_c &cameraMtx)
Builds a symmetric perspective frustum.
Definition m_frustum.cpp:4
mFrustum_c()
Constructs an empty frustum.
Definition m_frustum.hpp:12
bool intersectSphere(const mSphere_c *sphere) const
Checks whether the given sphere is at least partially inside the frustum.
Definition m_frustum.cpp:93
A 3x4 matrix.
Definition m_mtx.hpp:9