resonance 1.0.1
Loading...
Searching...
No Matches
collectchildren.h
Go to the documentation of this file.
1#pragma once
2
3#include <list>
4
5#include "rnd/animatable.h"
6#include "rnd/collideable.h"
7#include "rnd/drawable.h"
8#include "rnd/object.h"
9#include "rnd/transformable.h"
10
11namespace Rnd {
12
13// Each overload appends every descendant along one relation, depth first, each object before its
14// own descendants. A null start appends nothing. The four are defined in this header, and every
15// unit that uses them emits its own copies: Rnd::Manager's at `0x00519fc8`, `0x0051a0e0`,
16// `0x0051a1f8`, and `0x0051a310`, and ScrollingList's at `0x003fcf20`, `0x003fd038`,
17// `0x003fd150`, and `0x003fd268`.
18
27inline void CollectChildren(std::list<Object *> &objects, Animatable *pAnimatable) {
28 if (pAnimatable == nullptr) {
29 return;
30 }
31 for (std::list<Animatable *>::iterator it = pAnimatable->mAnims.begin();
32 it != pAnimatable->mAnims.end();
33 ++it) {
34 objects.push_back(*it);
35 CollectChildren(objects, *it);
36 }
37}
38
47inline void CollectChildren(std::list<Object *> &objects, Collideable *pCollideable) {
48 if (pCollideable == nullptr) {
49 return;
50 }
51 for (std::list<Collideable *>::iterator it = pCollideable->mCollides.begin();
52 it != pCollideable->mCollides.end();
53 ++it) {
54 objects.push_back(*it);
55 CollectChildren(objects, *it);
56 }
57}
58
67inline void CollectChildren(std::list<Object *> &objects, Drawable *pDrawable) {
68 if (pDrawable == nullptr) {
69 return;
70 }
71 std::list<Drawable *> &draws = pDrawable->GetDraws();
72 for (std::list<Drawable *>::iterator it = draws.begin(); it != draws.end(); ++it) {
73 objects.push_back(*it);
74 CollectChildren(objects, *it);
75 }
76}
77
86inline void CollectChildren(std::list<Object *> &objects, Transformable *pTransformable) {
87 if (pTransformable == nullptr) {
88 return;
89 }
90 for (std::list<Transformable *>::iterator it = pTransformable->mTransList.begin();
91 it != pTransformable->mTransList.end();
92 ++it) {
93 objects.push_back(*it);
94 CollectChildren(objects, *it);
95 }
96}
97
98} // namespace Rnd
Animatable()
Construct an animatable with no children, no filters, and a zero frame.
Collideable()
Construct a collideable with no children.
Mix-in for an object that draws itself and then a list of other drawables.
Definition drawable.h:32
std::list< Drawable * > & GetDraws()
Report the child list.
Definition drawable.h:213
Transformable()
Construct a dirty transformable with identity transforms and no children.
The rendering engine.
Definition animhelper.h:3
void CollectChildren(std::list< Object * > &objects, Animatable *pAnimatable)
Append every animation descendant of an animatable.
Definition collectchildren.h:27