Development SIG Toolkit

You are not logged in. Would you like to login or register?

9/25/2019 4:06 pm  #1

Creating your own scene node

You can create your own scene node by deriving one of 5 main base nodes, as explained in SnNode comments:
/*! \class SnNode sn_node.h
    \brief base of all scene node classes

    Defines a base class for all scene nodes.
    1. It cannot be directly instantiated by the user, and so there is no
       public constructor available.
    2. Scene nodes start with Sn (scene actions start with Sa, see sa_action.h).
    3. A reference counter is used for automatically deleting unused nodes,
       see ref() and unref() methods in the parent class GsShareable.
    4. Each node is of a given type among 5 possible ones:
    1. a group manages a list of children nodes;
    2. a transform defines a transformation to affect children nodes;
    3. a shape defines a geometric shape to be rendered;
    4. an editor node handles events, a transformation, and children nodes;
    5. a material node gives material info to the next shape for geometry sharing. */

The functionality of your derived node will then be interpreted according to the base class you select. You may also derive from an existing scene node already derived from one of the 5 types listed above. For example, SnPrimitive derives SnModel in order to re-use the rendering calls from SnModel.

If you'd like to create your own shape node you have to derive SnShape, and in addition, provide a class to perform the rendering calls. You can see the needed classes in the self-contained example provided in examples\sigmynode.7z. A more complex shape node is SnModel, which uses class GlrModel for the OpenGL rendering calls.



Board footera


Powered by Boardhost. Create a Free Forum