C4 Engine Terathon Software C4 Engine API Documentation

• World Manager

API Links
Developer Links

Node::EnumerateGeometries

Defined in:  C4Node.h
Enumerates all geometries within a given sphere.
Prototype

bool EnumerateGeometries(const Point3D& center, float radius, GeometryEnumProc *proc, void *data = nullptr);

Parameters
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 EnumerateGeometries function enumerates all geometry nodes in the tree rooted at the node for which the function is called. For each geometry node whose bounding volume intersects the sphere specified by the center and radius parameters, the callback procedure specified by the proc parameter is invoked. The GeometryEnumProc type is defined as follows.

typedef bool GeometryEnumProc(Geometry *, const Point3D&, floatvoid *);

The first parameter passed to the callback procedure is a pointer to the currently enumerated geometry node, 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 EnumerateGeometries function. The callback function should return true to continue enumeration and false to stop it.

The EnumerateGeometries is more efficient than the Node::EnumerateNodes would be for enumerating geometries because some geometry primitives have special functions that can more precisely determine whether they intersect a sphere.
See Also

Node::EnumerateNodes