|
Saga
Saga Game Engine
|
A tree of bounding volumes, with leaf nodes containing a collection of triangles. Useful as a space-accelerant structure to speed up collision detection. More...
#include <bvh.h>
Classes | |
| struct | BoundedShapeData |
| Data on a bounded triangle, which includes the triangle itself and its BoundingBox. More... | |
| struct | TriangleData |
| Data on a single triangles in the structure. More... | |
Public Types | |
| using | TracedData = std::tuple< TriangleData *, float > |
| Information about a trace operation on this datastructure, including a pointer to the first TriangleData that the trace hits, as well as time t where it hits this triangle. | |
Public Member Functions | |
| void | build (const std::vector< TriangleData > &triangles) |
| Build a BoundingVolumeHierarchy based on a collection of TriangleData. | |
| std::optional< TracedData > | traceEllipsoid (glm::vec3 pos, glm::vec3 dir, glm::vec3 scale) |
| Trace an ellipsoid through the Bounding Volume Hierarchy, reporting the first intersection if it exists. | |
A tree of bounding volumes, with leaf nodes containing a collection of triangles. Useful as a space-accelerant structure to speed up collision detection.
| using Saga::BoundingVolumeHierarchy::TracedData = std::tuple<TriangleData*, float> |
Information about a trace operation on this datastructure, including a pointer to the first TriangleData that the trace hits, as well as time t where it hits this triangle.
| void Saga::BoundingVolumeHierarchy::build | ( | const std::vector< TriangleData > & | triangles | ) |
Build a BoundingVolumeHierarchy based on a collection of TriangleData.
| triangles | all the triangles to use to build this BoundingVolumeHierarchy. |
| std::optional< BoundingVolumeHierarchy::TracedData > Saga::BoundingVolumeHierarchy::traceEllipsoid | ( | glm::vec3 | pos, |
| glm::vec3 | dir, | ||
| glm::vec3 | scale | ||
| ) |
Trace an ellipsoid through the Bounding Volume Hierarchy, reporting the first intersection if it exists.
| pos | the starting position of the ellipsoid. |
| dir | the direction the ellipsoid is heading. We only trace up to this direction, meaning if the intersection happens further than pos + dir, we do not count it |
| scale | the radius of the ellipsoid in the three cardinal directions. |
