This is a special node that combines multiple independently-moving rigid nodes into one Geom internally (or as few Geoms as possible), for the purposes of improving rendering performance.
To use it, parent a number of moving objects to this node and call
collect(). A child node is identified as “moving” if (a) it has a non- identity transform initially, or (b) it is a
ModelNodewith the preserve_transform flag set. Any other nodes will be considered static, and later transforms applied to them will not be identified.
You should call
collect()only at startup or if you change the set of children; it is a relatively expensive call.
RenderEffectssuch as Billboards are not supported below this node.
explicit RigidBodyCombiner(std::string const &name)
Walks through the entire subgraph of nodes rooted at this node, accumulates all of the
RenderAttribsand Geoms below this node, flattening them into just one Geom (or as few as possible, if there are multiple different states).
Nodes that have transforms on them at the time of collect(), or any
ModelNodeswith the preserve_transform flag, will be identified as “moving” nodes, and their transforms will be monitored as they change in future frames and each new transform directly applied to the vertices.
This call must be made after adding any nodes to or removing any nodes from the subgraph rooted at this node. It should not be made too often, as it is a relatively expensive call. If you need to hide children of this node, consider scaling them to zero (or very near zero), or moving them behind the camera, instead.
Returns a special
NodePaththat represents the internal node of this object. This is the node that is actually sent to the graphics card for rendering; it contains the collection of the children of this node into as few Geoms as possible.
This node is filled up by the last call to
- explicit RigidBodyCombiner(std::string const &name)