|
ToyMaker Game Engine 0.0.2
ToyMaker is a game engine developed and maintained by Zoheb Shujauddin.
|
A class designed around finding which pairs of AABBs may be intersecting (so as to limit the number of full collision checks that need be performed). More...
#include <sweep_prune.hpp>
Classes | |
| struct | Object |
| Contains the start and end indices of a sweep and prune object in each dimension's edge list. More... | |
| struct | Edge |
| Represents the projection of a bounding box along the axis represented by the edge list that this item appears in. More... | |
Public Member Functions | |
| std::set< CollisionPair > | getCollisionPairs () |
| Returns all collision pairs that have been detected thus far. | |
| void | addObject (EntityID entity, const AxisAlignedBounds &bounds) |
| Adds an object for sweep and prune to track. | |
| void | removeObject (EntityID entity) |
| Removes an object from Sweep and Prune's tracking lists. | |
| void | updateObject (EntityID entity, const AxisAlignedBounds &bounds) |
Private Types | |
| enum | Axis : uint8_t { X , Y , Z } |
| using | EdgeIndex = std::size_t |
Private Attributes | |
| std::unordered_map< EntityID, Object > | mObjects {} |
| Indices into edge lists for each axis per entity. | |
| std::set< CollisionPair > | mCollisionPairs {} |
| Storage for all detected collision pairs. | |
| std::array< std::vector< Edge >, 3 > | mEdges {} |
| Sorted list of edges along each axis. | |
| std::array< std::set< CollisionPair >, 3 > | mOverlaps {} |
| Pairs of entities which are overlapping on each axis. | |
| bool | mRecomputeCollisions { true } |
| Whether collision pairs need to be recomputed, as they would after an update. | |
A class designed around finding which pairs of AABBs may be intersecting (so as to limit the number of full collision checks that need be performed).
| void SweepPrune::updateObject | ( | EntityID | entity, |
| const AxisAlignedBounds & | bounds ) |
Updates the values of the boundaries of an object tracked by sweep and prune.