Engine → Scene → hierarchy.h
hierarchy
| Type | Class |
| Namespace | conjure::scene |
| Include File Path | engine/include/conjure/scene/hierarchy.h |
| Source File Path | engine/src/scene/hierarchy.cpp |
| API ↗ | Scenes, hierarchy and prefabs, Scenes and the hierarchy |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | hierarchy(
ecs::world &world,
const scene_component_ids &ids) noexcept; | |
| public | hierarchy(
const hierarchy &) = default; |
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~hierarchy(); |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mIds | const scene_ | nullptr | |
| private | mWorld | ecs::world * | nullptr |
Functions
Public
children_of
children_of[[nodiscard]] std::span<const ecs::entity> children_of(
ecs::entity target) const noexcept;The children in sibling order; empty for leaves and dead entities. The span is valid until the next structural change.
collect_subtree
collect_subtreevoid collect_subtree(
ecs::entity target,
std::vector<ecs::entity> &out) const;Appends the entity and every descendant to out, depth first in sibling order.
depth_of
depth_of[[nodiscard]] u8 depth_of(
ecs::entity target) const noexcept;Hierarchy depth from the depth tag: 0 for roots and dead entities.
for_each_in_subtree
for_each_in_subtreetemplate <typename Callable> void for_each_in_subtree(
ecs::entity target,
Callable &&callable) const;Invokes callable(entity) for the entity and every descendant, depth first in sibling order, with an explicit stack (never recursive). Nothing happens for a dead entity.
ids
ids[[nodiscard]] const scene_component_ids &ids() const noexcept;The component ids the tree reads.
is_alive
is_alive[[nodiscard]] bool is_alive(
ecs::entity target) const noexcept;True when the entity is alive in the world.
is_ancestor_of
is_ancestor_of[[nodiscard]] bool is_ancestor_of(
ecs::entity ancestor,
ecs::entity target) const noexcept;True when ancestor is a strict ancestor of target.
parent_of
parent_of[[nodiscard]] ecs::entity parent_of(
ecs::entity target) const noexcept;The parent entity; NULL_ENTITY for roots and dead entities.
root_of
root_of[[nodiscard]] ecs::entity root_of(
ecs::entity target) const noexcept;The topmost ancestor (the entity itself for a root); NULL_ENTITY for a dead entity.
sibling_index
sibling_index[[nodiscard]] u32 sibling_index(
ecs::entity target) const noexcept;Position among the parent's children; 0 for roots (their order is scene::roots()) and for dead entities.
subtree_height
subtree_height[[nodiscard]] u8 subtree_height(
ecs::entity target) const noexcept;Number of levels below the entity: 0 for a leaf, 1 when it has children without grandchildren, and so on. 0 for a dead entity.
subtree_size
subtree_size[[nodiscard]] u32 subtree_size(
ecs::entity target) const noexcept;Number of entities in the subtree, the entity included; 0 for a dead entity.