A bounding box. Often used to encompass object's bounds in the world. More...
Public Member Functions | |
BoundingBox () noexcept | |
BoundingBox (nkMemory::BufferView< const nkMaths::Vector > points) noexcept | |
BoundingBox (const nkMaths::Vector ¢er, float cubeHalfSide) noexcept | |
BoundingBox (const nkMaths::Vector ¢er, const nkMaths::Vector &axisAlignedHalfSides) noexcept | |
~BoundingBox () | |
nkMemory::BufferView< const nkMaths::Vector > | getPoints () const |
nkMemory::BufferView< const nkMaths::Vector > | getTransformedPoints () const |
nkMaths::Vector | getCenter () const |
nkMaths::Vector | getTransformedCenter () const |
nkMaths::Vector | getAxisAlignedSides () const |
void | setPoints (nkMemory::BufferView< const nkMaths::Vector > points) |
void | setTransformedPoints (nkMemory::BufferView< const nkMaths::Vector > points) |
void | updateTransformation (const nkMaths::Matrix &transform) |
bool | checkAgainst (const Frustum &frustum) const |
A bounding box. Often used to encompass object's bounds in the world.
Can be used to check against a frustum and do culling.
|
noexcept |
Default constructor.
|
noexcept |
Points constructor.
points | The points forming the bounds, in no particular order. |
|
noexcept |
Axis aligned constructor with a constant size on 3 axis.
center | The center of the box to create. |
cubeHalfSide | The half extent, uniform along the 3 axis (x, y, z), used to form a cube. |
|
noexcept |
Axis aligned constructor with separated size on 3 axis.
center | The center of the box to create. |
axisAlignedHalfSides | The half extents, for each axis. |
nkGraphics::BoundingBox::~BoundingBox | ( | ) |
Destructor.
nkMemory::BufferView<const nkMaths::Vector> nkGraphics::BoundingBox::getPoints | ( | ) | const |
nkMemory::BufferView<const nkMaths::Vector> nkGraphics::BoundingBox::getTransformedPoints | ( | ) | const |
nkMaths::Vector nkGraphics::BoundingBox::getCenter | ( | ) | const |
nkMaths::Vector nkGraphics::BoundingBox::getTransformedCenter | ( | ) | const |
nkMaths::Vector nkGraphics::BoundingBox::getAxisAlignedSides | ( | ) | const |
void nkGraphics::BoundingBox::setPoints | ( | nkMemory::BufferView< const nkMaths::Vector > | points | ) |
Sets new points to use for the box.
points | The points to use. |
void nkGraphics::BoundingBox::setTransformedPoints | ( | nkMemory::BufferView< const nkMaths::Vector > | points | ) |
Sets new transformed points to use for the box.
points | The points to use. |
void nkGraphics::BoundingBox::updateTransformation | ( | const nkMaths::Matrix & | transform | ) |
Updates the transformed points with a transformation matrix.
transform | The transformation matrix to use. |
bool nkGraphics::BoundingBox::checkAgainst | ( | const Frustum & | frustum | ) | const |
Checks the box against a frustum to know if it is inside or not.
frustum | The frustum to check against. |