Sponsored by: Magnetar Games

Functions

The functions are operational parts of the scene graph that handle things like light, fog, etc. They are associated with a specific part of the structure, but they are not structural in nature.

There are a few advantages to separating the functions from the structure nodes.  These are:

  • The scene graph does not have to be organized around functions, so unrelated objects that share the same function do not need to group together. Instead, they are placed in their appropriate spot according to the structure, and then simply linked to the function node.
  • It is easier to add new functions to the scene. Since functions are simply linked to nodes in the scene graph, not an integral part of its core structure, adding new functions simply means creating and linking a new function node to the appropriate structure nodes. This scene graph structure does not require you to completely rearrange your scene graph in order to add a new function.

Function Element Interface

Each functional element has the same interface, which consists of three functions:

  • Before traversal function
  • After traversal function
  • The interaction handler

The before traversal function ...

The after traversal function ...

The interaction handler responds to keyboard and mouse commands. It is part of the function node because ...