dao::scene

Declared in dao/Scene.h.

Classes

Class  
Node One node of a graphics object.
Object One graphics object of the scene.

Enumerations

Kind

enum class Kind : std::uint8_t

What a node is.

Value  
Node a plain node, a dummy that places its children
Bone a bone of the model’s skeleton
Crust a crust hook: where an effect on a creature goes
SnapPoint a snap-to point
UsePoint a use point
EmitterTarget where an emitter’s particles go
Mesh a mesh, a visual effect’s mesh among them
Emitter a particle emitter: sprites, ribbons or meshes
EmitterGroup a group of emitters
Terrain  
Cloth  
WeaponTrail  
Light a light: point, ambient, or a light probe
Other a kind this library does not name

Next

enum class Next : std::uint8_t

What a walk does after a visit.

Value  
Descend go on into this one’s nodes, or children
Skip go on, past them
Stop end the walk

Functions

ForEach()

void ForEach(Kind kind, const std::function<void(const Object &object, const Node &node)> &each)

Hands every node of a kind in the current area’s scene, with the object it is part of (its root empty), to each, in the scene’s order and each object’s tree’s order.

The fastest way to find one kind of thing: it reads only the objects that have one.

Call it on the game thread, as Objects.

Objects()

std::vector<Object> Objects()

Returns every graphics object of the current area’s scene, in the scene’s order, each with its tree of nodes; none before an area is loaded.

Call it on the game thread, and keep nothing of it past the frame: the engine adds and removes objects as rooms load and creatures come and go. It reads everything, a millisecond or so in a castle’s courtyard; to find one kind of thing, ForEach reads only the objects that have one, and Walk only what its visitors go into.

Walk()

void Walk(const std::function<Next(const Object &object)> &object, const std::function<Next(const Node &node, int depth)> &node)

Walks the current area’s scene, reading only what the visitors go into.

Call it on the game thread, as Objects.

Parameter  
object gets each object with its fields and no nodes (its root is empty), and answers whether to walk its nodes
node gets each node walked, with no children (they come after it), and its depth below the object’s root, and answers whether to walk its children