Node::EnumerateNodes
Defined in: C4Node.h
Enumerates all nodes of a specified type within a given sphere.
Prototype
EnumerationResult EnumerateNodes(NodeType type, const Point3D& center, float radius, NodeEnumProc *proc, void *data = nullptr);
Parameters
type |
The type of node to enumerate.
|
center |
The world-space center of the sphere.
|
radius |
The radius of the sphere.
|
proc |
A pointer to the callback function that is called for each node enumerated.
|
data |
A pointer to user-defined data the caller wishes to pass to the callback function.
|
Description
The EnumerateNodes function enumerates all nodes in the tree rooted at the node for which the function is called. For each node whose type matches the type parameter and whose bounding sphere intersects the sphere specified by the center and radius parameters, the callback procedure specified by the proc parameter is invoked. The NodeEnumProc type is defined as follows.
typedef EnumerationResult NodeEnumProc(Node *, const Point3D&, float, void *);
The first parameter passed to the callback procedure is a pointer to the currently enumerated node, the second parameter is the center of the sphere, the third parameter is the radius of the sphere, and the last parameter is the value given by the data parameter of the EnumerateNodes function. The callback function should return one of the following values indicating how the enumeration should proceed.
kEnumerationStop |
Stop the enumeration at the current node.
|
kEnumerationSkipSubtree |
Do not visit any subnodes of the current node.
|
kEnumerationContinue |
Continue visting nodes normally.
|
The return value of the EnumerateNodes function is the result returned by the final call to the callback function.
NOTE. To enumerate geometries, this function may be called with a value of kNodeGeometry for the type parameter, but it would be more efficient to call the Node::EnumerateGeometries function.
|
See Also
Node::EnumerateGeometries
|