User guide
60
Constructor
As in a class derived from ScenegraphGenerator, the constructor in a class derived from ScenegraphContext can be
used to initialize instance variables, as shown in the following two examples:
CubeRootContext::CubeRootContext(
int numberOfCubes, bool rotateCubes) :
_numberOfCubes(numberOfCubes),
_rotateCubes(rotateCubes)
{
// empty
}
CubeContext::CubeContext(int numberOfCubes,
bool rotateCubes,
int index) :
_numberOfCubes(numberOfCubes),
_rotateCubes(rotateCubes),
_index(index)
{
// empty
}
Destructor
Again, similar to the ScenegraphGenerator-derived class, no special destructor is needed in a class derived from
ScenegraphContext, unless required for releasing previously allocated resources.
Instance Methods for Locations
The following two instance methods define the structure of the scene graph locations that are created by a custom
SGG plug-in:
FnKat::ScenegraphContext* getFirstChild()
Returns an instance of a class derived from ScenegraphContext, which represents the first child location of the
location represented by the current context.
Returns 0x0 if the current location should not contain any child locations. Such locations are sometimes called leaf
locations and typically provide custom geometry in a scene graph hierarchy.
Consider the following example of a root context for an SGG plug-in that creates a number of locations containing
polygonal cube meshes:
FnKat::ScenegraphContext*
8 SCENE GRAPH GENERATOR PLUG-INS | SGG PLUG-IN API CLASSES