SceneGraph

Home About XEngine Engine API SceneGraph Changelog Programming Guide

Index

| Scene Description Language | camera | directory | eventmessage | geometry | group | input | light | node | primitives | root | spinner | transformation | user |


The SceneGraph Scene Description Language in General

The scene description is provided as an XML file, whose schema provides declarations for basic elements such as geometry, transformations and groups, but also an event-driven message passing mechanism to trigger functions and alter states and properties of nodes at run time.

The basic and mandatory building brick of the scene file is the world node, which represents the entire 3D scene. Other node declarations are nested within the world node opening and closing tags, representing the containment of these nodes in the world. In a similar fassion, many other grouping nodes contain more nested nodes etc., thus building the directed scene graph.

Almost every node type in the scene graph triggers events, which signify a change in its state. For instance, a proximity trigger produces an enter and an exit event when at least one of a number of predefined nodes enters or leaves its area of effect respectively and the root of the scene graph (the "world") triggers an init event when the world is parsed and ready for display. In order to use the occuring events for dynamically altering the behavior or state of the scene, SceneGraph supports event messages. The corresponding XML tag can be placed inside any other node declaration and provides the association between an event type, another named node, which is going to receive the message (the recipient) and the command message to deliver. Messages contain instructions or attributes for redefining the look or behavior of the target node. For instance, the message text for a light source could contain the command "color 1.0, 0.95, 0.8" that changes the light color to the given rgb values. Multiple messages can be issued to a node by repeating the assignment of an event type to a new message.

To access a node for posting a message or using it as an attribute to another node (common when "attaching" a node to another, as is the case with the camera) one must reference the node by its name. Naming the nodes in the XML scene file is optional, but this is the only case where a unique name is required in order for the scene graph to be able to identify the target node correctly. A special name is reserved for the root of the scene graph, namely the "%root". Names, node types and attributes are all case sensitive.

One feature central to the design of the particular scene graph is the disassociation of the of the user, the camera and the input control entities. In fact, an arbitrary number of users, cameras and input control nodes can populate a scene, each one connected to the others in any combination. This provides an easy way to model a multi-user environment, where the user entities can be controller by humans (via input device nodes) or automata, which can be controlled by a behavioral animation controller. Switching among these options is simply done by assigning a different controller to each user on the fly with the corresponding message. The same mechanism goes for the camera nodes as well, which can follow any node or be left standing alone.

In the reference pages of this manual you can find the detailed description of each node type, its events and acceptable messages as well as examples of using the node in a scene file.


Last updated: 27 May. 2013