Implement A New Node

Introduction

The first step is to determine node functionality. You do not need to have a particularly detailed idea or specification but you need to have some basic idea before you can determine how to derive the node. Deriving works like all other C++ APIs. The subclass inherits all the properties of the superclass and can specify additional properties.

Derive From Node

If you want to implement a node that stores data or performs a very simple function, implement your new node as a subclass of node. Subclasses of node inherit the name and metadata properties and nothing else. This leaves you free to implement all the rest of the details yourself.

Derive From Group

If you want your node to use a bounding box or be considered during the culling process then you should derive from group. At minimum, nodes derived from group inherit all the properties of node and group. This includes name, traversal, bounding box, and transformation parameters. A level-of-detail node is a good example of a node derived from group. This is one of the more common superclasses.

Derive From Mesh

This is a less common superclass as new primitives or modifications to mesh geometry must be implemented as modifiers. However if you wish to create a new mesh class then you should derive from mesh if you do not wish to implement an entirely new type of mesh.

Derive From Material

This is a less common superclass. However if you wish to implement your own material class then derive from group or node.

Derive From Light

This is a less common superclass. However if you wish to implement your own light class then derive from light or node.

Derive From Modifier

If you wish to implement a new geometric primitive or make any change to a mesh you must implement a modifier. If you wish to create an interactive drawing mode that allows you to click to insert vertices into a mesh-edge then you write a drawing mode that allows the user to interact with the mesh and you instruct the drawing mode to create a modifier that stores the resulting edge subdivision.

Unimplemented Nodes As Examples

At present Scenome does not have any of the following nodes. For the purposes of this example, the node types are listed and appropriate superclasses are indicated: