29template <
typename HTag,
typename T=
double,
size_t N=2,
typename XTag=HTag>
51 _reg(
reg), _hierarchy(hierarchy) {}
57 const HierarchySystem<HTag>& hierarchy()
const {
return _hierarchy; }
65 auto*
old = _reg.try_get<
LT>(eid);
68 old->child_to_parent =
xf;
73 _reg.emplace<
LT>(eid,
xf);
80 auto*
lt = _reg.try_get<
LT>(eid);
81 if (
lt)
return lt->child_to_parent;
87 auto*
lt = _reg.try_get<
LT>(eid);
88 if (
not lt)
return std::nullopt;
102 entt::entity
cur = node;
103 while (
cur != entt::null) {
104 auto*
lt = _reg.try_get<
LT>(
cur);
106 xf =
lt->child_to_parent *
xf;
126 for (
size_t i = 0;
i <
n; ++
i) {
136 auto*
lt = _reg.try_get<
LT>(
p0[
i]);
142 auto*
lt = _reg.try_get<
LT>(
p1[
i]);
177 template <AnyTraversalConcept Traversal,
typename GetId>
182 ? std::make_optional(
184 *std::forward<Traversal>(t).root,
194 for (
auto g = successors(parent.node);
g; ++
g) {
200 lt ? (parent.node_to_root *
lt->child_to_parent)
201 : parent.node_to_root
211 entt::registry& _reg;
212 HierarchySystem<HTag>& _hierarchy;
234template <
typename XTag=
void,
typename T=
double,
size_t N=2,
typename HTag>
241template <
typename HTag,
typename XTag=HTag>
242using TransformSystem2d = TransformSystem<HTag, double, 2, XTag>;
244template <
typename HTag,
typename XTag=HTag>
245using TransformSystem3d = TransformSystem<HTag, double, 3, XTag>;
SiblingOrder
Controls the iteration order of siblings within a parent.
Core hierarchy system managing parent-child relationships over EnTT entities.
A C++20 coroutine-based generator that lazily yields values of type T.
A system for maintaining parent-child relationships on entities.
entt::entity parent_of(entt::entity node) const
Returns the parent of node, or entt::null if the node is a root or not in the hierarchy.
auto traverse(entt::entity root, SiblingOrder order) const
Returns a Traversal of the hierarchy rooted at root.
TreePath path(entt::entity node) const
Returns the path from the root to the given node.
size_t size() const
The number of non-root nodes in the hierarchy (i.e. entities with a parent).
A node handle yielded by hierarchy traversals and queries.
A lazy description of a rooted graph traversal.
A path from a root entity down to a descendant.
std::remove_cvref_t< T > TraversalValue
Strip references/cv to get the bare Traversal type.
auto make_traversal(std::optional< Node > &&root, Successors &&successors)
Construct a Traversal from an optional root and a successor function.