Polygon Crucher SDK - Documentation
Documentation
Loading...
Searching...
No Matches
Traversing the different nodes of the scene

Traversing scene and retrieve nodes

C3DNodePos is an iterator which allows to traverse the scene has shown in the following sample:

C3DBaseObject *object;
C3DNodePos nodepos = scene->GetFirstNode();
while (nodepos)
{
node = GetNextNode(object, nodepos);
...
}
This is the base class for any kind of object.
Definition 3DBaseObject.h:106
Definition 3DScene.h:191
A node matches one element that is part of the C3DScene graph. It references a C3DBaseObject and has ...
Definition 3DSceneNode.h:64
The class defines an x, y, z 3D point which can use int, float or double.
Definition 3DPoint.h:27

The following sample traverse only a single instance of any C3DGeomObject found in anotherNode children.

C3DGeomObject *object;
C3DNodePos pos = scene->GetFirstNode(OBJECT_GEOM, NODEPOS_BRANCH_ONLY|NODEPOS_INSTANCE_ONCE, anotherNode);
while (pos)
{
node = scene->GetNextNode(object, pos);
@ NODEPOS_INSTANCE_ONCE
When traversing the tree, settings this flag returns only once time each object instance....
Definition 3DScene.h:94
@ NODEPOS_BRANCH_ONLY
Traverse provided node childs. If NODEPOS_INCLUDE_NODE specified, traverse also right branch (brother...
Definition 3DScene.h:96
This is the base class for any object containing geometry (curve, polygonal object,...
Definition 3DGeomObject.h:49

Adding NODEPOS_INCLUDE_NODE also allows to return the starting node itself (here anotherNode) at the beginning of the loop.