net.jinx.video
Class SceneGraph

java.lang.Object
  extended by net.jinx.video.SceneGraph
All Implemented Interfaces:
MultipassVisible, Visible
Direct Known Subclasses:
VariableSceneGraph

public class SceneGraph
extends java.lang.Object
implements MultipassVisible

SceneGraph allows the use of multiple Visibles within the same Renderer.

API Stability: Stable.


Nested Class Summary
static class SceneGraph.SceneGraphElement
          SceneGraphElement allows for the fixed translation, rotation and scaling of other Visible objects.
 
Constructor Summary
SceneGraph()
          Constructs a new SceneGraph.
 
Method Summary
 boolean add(Visible d)
          Adds a Visible to the scene.
 void clear()
          Wipes all Visibles from the scene.
 boolean contains(Visible d)
          Provides the means to check if the given Visible is already in the scene.
 void deinit(Context opt)
          Deinitializes this Visible, disposing of any resources that it may be using.
 void draw(Context opt)
          Renders this Visible to glDrawable.
 void drawPass(Context opt, Pass pass)
           
 void init(Context opt)
          Initializes this Visible, preparing it for rendering.
 boolean isEmpty()
          Provides the means to check if the scene is empty or not.
 java.util.Iterator iterator()
           
protected  void predraw(Visible v)
          Does nothing, but can be overriden to perform operations on Visible objects before they're drawn.
 boolean remove(Visible d)
          Removes a Visible from the scene.
 int size()
          Provides the number of Visibles in the scene.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SceneGraph

public SceneGraph()
Constructs a new SceneGraph.

Method Detail

init

public void init(Context opt)
Description copied from interface: Visible
Initializes this Visible, preparing it for rendering. If this Visible contains other Visibles, then their init methods MUST be called first. This is essential for DisplayList objects to function properly and efficiently.

Specified by:
init in interface Visible
Parameters:
opt - describes the rendering options that are being used.

deinit

public void deinit(Context opt)
Description copied from interface: Visible
Deinitializes this Visible, disposing of any resources that it may be using. If this Visible contains other Visibles, then their deinit methods MUST be called last. This is important for display lists.

Specified by:
deinit in interface Visible
Parameters:
opt - describes the rendering options that are being used.

add

public boolean add(Visible d)
Adds a Visible to the scene.

Parameters:
d - the Visible.
Returns:
true if it was added, false otherwise.

remove

public boolean remove(Visible d)
Removes a Visible from the scene.

Parameters:
d - the Visible.
Returns:
true if the Visible was removed, false otherwise.

contains

public boolean contains(Visible d)
Provides the means to check if the given Visible is already in the scene.

Parameters:
d - the Visible.
Returns:
true if the Visible is in the scene, false otherwise.

clear

public void clear()
Wipes all Visibles from the scene.


isEmpty

public boolean isEmpty()
Provides the means to check if the scene is empty or not.

Returns:
true if the scene is empty, false otherwise.

size

public int size()
Provides the number of Visibles in the scene.

Returns:
the number of Visible objects.

predraw

protected void predraw(Visible v)
Does nothing, but can be overriden to perform operations on Visible objects before they're drawn. This is called just before the draw method of v is invoked and just after attributes are pushed on the stack.

Parameters:
v - the Visible to manipulate.

draw

public void draw(Context opt)
Description copied from interface: Visible
Renders this Visible to glDrawable.

Specified by:
draw in interface Visible
Parameters:
opt - describes the rendering options that are being used.

drawPass

public void drawPass(Context opt,
                     Pass pass)
Specified by:
drawPass in interface MultipassVisible

iterator

public java.util.Iterator iterator()