The Scenegraph


Content
 
 

 


Structure of the scenegraph



The Virtual Universe object is the root of our scenegraph. The Locale object is the container for the subgraphs.

Our scenegraph has two subgraphs.The content branchgraph contains our Rubik’s Cube and in the view branchgraph the objects for rendering the Rubik’s Cube are stored.

We built up our scenegraph with the Simple Universe object. This object creates a Virtual Universe, a Locale and a view branchgraph with default values. (That’s sufficient for our Rubik’s Cube.)So we have “only” to look after the implementation of the content branchgraph.
 

back to top



 

The content branchgraph




                           The content branchgraph has two subgraphs:
                           In the Rubik’s Cube branchgraph the Rubik’s Cube is stored.
                           In the light branchgraph the ambient of the cube like background and lights is generated.
 
 

back to top


 

The Rubik’s Cube branchgraph


The Rubik’s Cube branchgraph is one of the subgraphs of the content branchgraph.
 

In the Rubik’s Cube branchgraph the Rubik’s Cube is generated as following:

The Rubik’s Cube Transformgroup (TG) is the root of the Rubik’s Cube object.
This TG is scaled and rotated, so that the Rubik’s Cube is set a little bit back and you can see three sides of the cube(left, right, top).

The mouse rotation and mouse zoom behaviour have a reference to this TG. So it is possible to rotate and zoom the cube.

For rotating the sides of the Rubik's Cube the picking mouse behavior is added to the root.
( This behavior can only be added to BG nodes not to TG nodes ).

The cube pointer constructed with a cone and a cylinder and directed to the topmost little cube in the left corner, is also added to this TG. Is the cube pointer deselected the cube pointer node is detached from the TG. If it is selected again the node is added to the TG.

To the CubesTG node, whose father node is RubiksCubeTG, all the little cubes are added. Each little cube has its own CubesTG node (To keep the picture clear, only one CubesTG is shown).
Each CubesTG node is transformed, so that it sets the little cubes to the right position.
( See also : “How to draw the Rubik’s Cube  " ?) .

The little cubes are real cubes. The real cube is a geometrical object that we have generated. Dependent on the position of the little cube only the visible sides are drawn. So our Rubik’s Cube is hollow.
 
 

back to top



 

The light branchgraph 



    The light branchgraph is one of the subgraphs of the content Branchgraph.
    The light branchgraph creates the ambient of the Rubik’s Cube.
    The ambient contains the background, the ambient light and two lights.
    All these objects are added to the LightsBG node.
    The lights are two spotlights. This type of light allows to set parameters like position and direction . With the spotlight
    we reached the best light effects.
    You can set the position of the lights, turn them on or off and set their colours.
    The ambient light is an instance of the predefined AmbientLight Class.
    It is possible to turn it on or off and to set its colour.
    The background is an instance of the predefined Background Class
    It is possible to change its colour and its intensity.
    For more details have a look at our description of our algorithms and at the javadoc generated files.
 

back to top