j3d.org Aviatrix3D

org.j3d.aviatrix3d
Class ShapeBackground

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.Node
          extended byorg.j3d.aviatrix3d.Leaf
              extended byorg.j3d.aviatrix3d.Background
                  extended byorg.j3d.aviatrix3d.ShapeBackground
All Implemented Interfaces:
Renderable, RenderableObject

public class ShapeBackground
extends Background

Background node that renders a list of user-provided Shape3D instances.

Rendering is performed in the order the nodes are added to the instance. As such This will set the background colour to a single colour for the entire viewport. If used, this will override the setClearColor() on DrawableSurface.

Version:
$Revision: 1.4 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.Background
dispListMap
 
Fields inherited from class org.j3d.aviatrix3d.Node
bounds, implicitBounds, INVALID_BOUNDS, parent
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, updateHandler, WRITE_TIMING_MSG
 
Constructor Summary
ShapeBackground()
          Constructs a background node for a base colour of black.
ShapeBackground(float[] c)
          Construct a background node for a user-provided colour
 
Method Summary
 void addShape(Shape3D shape)
          Add a shape to be rendered to the end of the listing.
 void getColor(float[] c)
          Get the current drawing colour
 Shape3D getShape(int idx)
          Get the current the shape and the given index position.
protected  void markBoundsDirty()
          Mark this node as having dirty bounds due to one of it's children having their bounds changed.
 void postRender(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
          Restore all openGL state to the given drawable.
 Shape3D removeShape(int idx)
          Remove the shape at the given index position.
 void render(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
          Issue ogl commands needed for this component
 void setColor(float[] c)
          Change the colour to the new colour.
 void setColor(float r, float g, float b, float a)
          Change the colour to the new colour.
protected  void setLive(boolean state)
          Notification that this object is live now.
 void setShape(Shape3D shape, int idx)
          Change the shape at the given index.
protected  void setUpdateHandler(NodeUpdateHandler handler)
          Set the scenegraph update handler for this node.
 
Methods inherited from class org.j3d.aviatrix3d.Node
boundsChanged, checkForCyclicParent, getBounds, getParent, recomputeBounds, removeParent, setBounds, setParent, updateBounds
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, dataChanged, getUserData, isLive, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ShapeBackground

public ShapeBackground()
Constructs a background node for a base colour of black.


ShapeBackground

public ShapeBackground(float[] c)
Construct a background node for a user-provided colour

Method Detail

render

public void render(net.java.games.jogl.GL gl,
                   net.java.games.jogl.GLU glu)
Issue ogl commands needed for this component

Parameters:
gl - The gl context to draw with
glu - The utility context to draw with

postRender

public void postRender(net.java.games.jogl.GL gl,
                       net.java.games.jogl.GLU glu)
Restore all openGL state to the given drawable.

Parameters:
gl - The gl context to draw with
glu - The utility context to draw with

markBoundsDirty

protected void markBoundsDirty()
Mark this node as having dirty bounds due to one of it's children having their bounds changed.

Overrides:
markBoundsDirty in class Node

setUpdateHandler

protected void setUpdateHandler(NodeUpdateHandler handler)
Set the scenegraph update handler for this node. It will notify all its children of the value. A null value will clear the current handler.

Overrides:
setUpdateHandler in class SceneGraphObject
Parameters:
handler - The instance to use as a handler

setLive

protected void setLive(boolean state)
Notification that this object is live now.

Overrides:
setLive in class Node
Parameters:
state - true to set this to live

setColor

public void setColor(float[] c)
              throws InvalidWriteTimingException
Change the colour to the new colour. Colour takes RGBA.

Parameters:
c - The colour to copy in
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

setColor

public void setColor(float r,
                     float g,
                     float b,
                     float a)
              throws InvalidWriteTimingException
Change the colour to the new colour. Colour takes RGBA.

Parameters:
r - The red colour component to use
g - The green colour component to use
b - The blue colour component to use
a - The alpha colour component to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getColor

public void getColor(float[] c)
Get the current drawing colour

Parameters:
c - An array of length 4 or more to copy the colour to

addShape

public void addShape(Shape3D shape)
              throws InvalidWriteTimingException
Add a shape to be rendered to the end of the listing.

Parameters:
shape - The object instance to be rendered
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

removeShape

public Shape3D removeShape(int idx)
Remove the shape at the given index position. If the index is out of range, then this will generate an exception.

Parameters:
idx - The index of the shape to be fetched
Returns:
The shape at the given index

setShape

public void setShape(Shape3D shape,
                     int idx)
Change the shape at the given index. A shape can only be replaced by another shape. If you wish to delete it, then use the remove method, not this one with a null value. A null value is illegal here.

Parameters:
idx - The index of the shape to be fetched
shape - The object instance to be rendered
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getShape

public Shape3D getShape(int idx)
Get the current the shape and the given index position. If the index is out of range, then this will generate an exception.

Parameters:
idx - The index of the shape to be fetched
Returns:
The shape at the given index

j3d.org Aviatrix3D

Latest Info from http://aviatrix3d.j3d.org/
Copyright © 2003 - j3d.org