User guide

61
CubeRootContext::getFirstChild() const
{
if (_numberOfCubes > 0)
{
return new CubeContext(_numberOfCubes, 0);
}
return 0x0;
}
The function checks if a number of cubes has been set and, if so, creates and returns a new instance of the
CubeContext class that represents the first child location under the root location.
The implementation of the same function in the corresponding CubeContext class, which represents locations of
type polymesh, returns 0x0, as a polymesh location does not contain any child locations:
FnKat::ScenegraphContext*
CubeContext::getFirstChild() const
{
return 0x0;
}
FnKat::ScenegraphContext* getNextSibling()
Returns an instance of a class derived from ScenegraphContext that represents the next location at the same level in
the scene graph hierarchy, underneath the same parent as the current location.
Returns 0x0 if the current location does not have any sibling locations. This is typically the case for root locations.
In scenarios with multiple sibling locations, an index number is typically passed on to the next sibling with an
incremented value, as in the following example:
FnKat::ScenegraphContext*
CubeContext::getNextSibling() const
{
if (_index < _numberOfCubes - 1)
{
return new CubeContext(_numberOfCubes,
_rotateCubes,
_index + 1);
}
return 0x0;
}
8 SCENE GRAPH GENERATOR PLUG-INS | SGG PLUG-IN API CLASSES