The spatial query system, an ECS System that tracks and updates spatial query data for objects in the scene, and which exposes spatial query methods.
More...
#include <spatial_query_system.hpp>
|
static std::string | getSystemTypeName () |
| Gets the system type string associated with this class.
|
|
|
void | updateBounds (EntityID entity) |
| Updates the axis aligned bounds of an entity, based on its ObjectBounds.
|
|
void | rebuildOctree () |
| Triggers the destruction of any presently existing octree and replaces it with a new one.
|
|
void | onSimulationActivated () override |
| Marks this system as requiring initialization on the nearest update.
|
|
void | onSimulationStep (uint32_t timestepMillis) override |
| Initializes the tree if necessary, and recomputes octree position for entities whose ObjectBounds were updated.
|
|
void | onEntityEnabled (EntityID entityID) override |
| Marks this entity as requiring an octree update on the nearest simulation step.
|
|
void | onEntityDisabled (EntityID entityID) override |
| Removes this entity from the Octree.
|
|
void | onEntityUpdated (EntityID entityID) override |
| Marks this entity as requiring an octree update on the nearest simulation step.
|
|
|
std::unique_ptr< Octree > | mOctree { nullptr } |
| Pointer to the octree, the data structure responsible for spatially indexing scene objects.
|
|
std::set< EntityID > | mComputeQueue {} |
| A list of entities whose AABBs should be recomputed at the next simulation step.
|
|
bool | mRequiresInitialization { true } |
| Whether a fresh Octree should be built for this system as soon as possible.
|
|
The spatial query system, an ECS System that tracks and updates spatial query data for objects in the scene, and which exposes spatial query methods.
It is presently implemented as an octree, and only answers questions that take the form of a Ray or an AABB.
- Todo
- SceneHierarchyData isn't required by this system, as far as I can tell.
◆ findEntitiesOverlapping() [1/2]
Returns a list of entities (by their IDs) overlapping a search AABB.
- Parameters
-
searchBounds | The AABB defining the search region. |
- Returns
- std::vector<std::pair<EntityID, AxisAlignedBounds>> The list of entities overlapping with the search region.
◆ findEntitiesOverlapping() [2/2]
Returns a list of entities (by their IDs) intersecting a search ray.
- Parameters
-
ray | The ray intersecting which a list of entities should be found. |
- Returns
- std::vector<std::pair<EntityID, AxisAlignedBounds>> A list of entities intersected by the query ray.
◆ findNodesOverlapping() [1/2]
Gets a list of nodes which overlap some search region (in the form of an AABB).
- Parameters
-
searchBounds | The search region (as an AABB). |
- Returns
- std::vector<std::shared_ptr<SceneNodeCore>> The list of nodes contained by or overlapping the search region.
◆ findNodesOverlapping() [2/2]
std::vector< std::shared_ptr< SceneNodeCore > > SpatialQuerySystem::findNodesOverlapping |
( |
const Ray & | searchRay | ) |
|
Gets a list of nodes (by their base class pointers) intersecting a search ray.
- Parameters
-
searchRay | The ray intersecting which a list of nodes should be found. |
- Returns
- std::vector<std::shared_ptr<SceneNodeCore>> A list of nodes intersecting the search ray.
◆ getSystemTypeName()
static std::string ToyMaker::SpatialQuerySystem::getSystemTypeName |
( |
| ) |
|
|
inlinestatic |
Gets the system type string associated with this class.
- Returns
- std::string This class' system type string.
◆ onEntityDisabled()
void SpatialQuerySystem::onEntityDisabled |
( |
EntityID | entityID | ) |
|
|
overrideprivate |
Removes this entity from the Octree.
- Parameters
-
entityID | The entity being removed. |
◆ onEntityEnabled()
void SpatialQuerySystem::onEntityEnabled |
( |
EntityID | entityID | ) |
|
|
overrideprivate |
Marks this entity as requiring an octree update on the nearest simulation step.
- Parameters
-
entityID | The entity in need of an update. |
◆ onEntityUpdated()
void SpatialQuerySystem::onEntityUpdated |
( |
EntityID | entityID | ) |
|
|
overrideprivate |
Marks this entity as requiring an octree update on the nearest simulation step.
- Parameters
-
entityID | The entity in need of an AABB update. |
◆ onSimulationStep()
void SpatialQuerySystem::onSimulationStep |
( |
uint32_t | timestepMillis | ) |
|
|
overrideprivate |
Initializes the tree if necessary, and recomputes octree position for entities whose ObjectBounds were updated.
- Parameters
-
timestepMillis | The time by which the simulation will be advanced this simulation frame. |
◆ updateBounds()
void SpatialQuerySystem::updateBounds |
( |
EntityID | entity | ) |
|
|
private |
Updates the axis aligned bounds of an entity, based on its ObjectBounds.
- Parameters
-
entity | The entity whose axis aligned bounds are being updated. |
The documentation for this class was generated from the following files: