Set of bounding boxes for a SceneObject, calculated based on the vertices of a Model.
More...
#include <BoundingBoxSet.hpp>
|
struct | extremes |
| Structure to hold the coordinates of the extremes of each box.
|
|
|
int | getNumBoxes () const |
| Get the number of boxes contained in the set.
|
|
| BoundingBoxSet () |
| Default constructor.
|
|
| BoundingBoxSet (const std::vector< float > &vertexData, const Vec3 &scale, uint32_t subdivisions) |
| Constructor that creates a box set, constructed based on the vertex data that can be found in a Model. More...
|
|
| ~BoundingBoxSet ()=default |
| Destructor.
|
|
bool | contains (const Vec3 point, const Vec3 thisOffset, const Mat4 thisRotation) const |
| Check if a point is inside any of the boxes. More...
|
|
bool | containsCorners (const BoundingBoxSet &otherBoxSet, const Vec3 thisOffset, const Mat4 thisRotation, const Vec3 otherOffset, const Mat4 otherRotation) const |
| Check any of the corners of another set of bounding boxes is inside any of the boxes of this set. More...
|
|
std::vector< Model > | getModels () |
| Get the bounding boxes in a set of Models that can be rendered. More...
|
|
|
std::vector< extremes > | boxExtremes |
| The extreme coordinates (max and min) of each box.
|
|
std::vector< std::vector< float > > | vertices |
| Vertex coordinates.
|
|
std::vector< std::vector< unsigned int > > | facesVertexIndexes |
| Faces vertex indexes (rectangles)
|
|
std::vector< std::vector< unsigned int > > | facesVertexIndexesTriangulated |
| Faces vertex indexes (triangles, for rendering)
|
|
Set of bounding boxes for a SceneObject, calculated based on the vertices of a Model.
◆ BoundingBoxSet()
small3d::BoundingBoxSet::BoundingBoxSet |
( |
const std::vector< float > & |
vertexData, |
|
|
const Vec3 & |
scale, |
|
|
uint32_t |
subdivisions |
|
) |
| |
Constructor that creates a box set, constructed based on the vertex data that can be found in a Model.
- Parameters
-
vertexData | The vertex data. Array of floats to be interpreted as an array of 4 component vertex coordinates. |
scale | Scale applied to the vertexData before calculating boxes. |
subdivisions | How many times to subdivide the initially one created bounding box, getting more accurate collision detection at the expense of performance. |
◆ contains()
bool small3d::BoundingBoxSet::contains |
( |
const Vec3 |
point, |
|
|
const Vec3 |
thisOffset, |
|
|
const Mat4 |
thisRotation |
|
) |
| const |
Check if a point is inside any of the boxes.
- Parameters
-
point | The point (as a vector) |
thisOffset | The offset (location) of the box set |
thisRotation | The rotation transformation of the box set |
- Returns
- True the point is inside a box, False if not.
◆ containsCorners()
bool small3d::BoundingBoxSet::containsCorners |
( |
const BoundingBoxSet & |
otherBoxSet, |
|
|
const Vec3 |
thisOffset, |
|
|
const Mat4 |
thisRotation, |
|
|
const Vec3 |
otherOffset, |
|
|
const Mat4 |
otherRotation |
|
) |
| const |
Check any of the corners of another set of bounding boxes is inside any of the boxes of this set.
- Parameters
-
otherBoxSet | The other box set |
thisOffset | The offset (location) of this box set |
thisRotation | The rotation transformation of this box set |
otherOffset | The offset (location) of the other box set |
otherRotation | The rotation transformation of the other box set |
- Returns
- True if a corner of the other bounding box set is contained in this set, False otherwise.
◆ getModels()
std::vector< Model > small3d::BoundingBoxSet::getModels |
( |
| ) |
|
Get the bounding boxes in a set of Models that can be rendered.
- Returns
- The set of bounding boxes as Models
The documentation for this class was generated from the following files: