Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class ShapeBackground

java.lang.Object
  extended by org.j3d.aviatrix3d.SceneGraphObject
      extended by org.j3d.aviatrix3d.Node
          extended by org.j3d.aviatrix3d.Leaf
              extended by org.j3d.aviatrix3d.Background
                  extended by org.j3d.aviatrix3d.ShapeBackground
All Implemented Interfaces:
java.lang.Comparable, BackgroundRenderable, Cullable, EnvironmentCullable, ObjectRenderable, Renderable

public class ShapeBackground
extends Background

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

Backgrounds are rendered as the first item but do not interact with the normal geometry in the rendering process. Typically, backgrounds are rendered in a fixed volume (a unit box or sphere is the most common) with depthbuffer reads and writes disabled. Ordinary geometry is then drawn over the top. Backgrounds must fit within clipping planes of [0.1,1]. Rendering is performed in the order the nodes are added to the instance.

Internationalisation Resource Names

Version:
$Revision: 1.18 $
Author:
Justin Couch

Field Summary
 
Fields inherited from class org.j3d.aviatrix3d.Background
color, dispListMap, INVALID_ALPHA_PROP, INVALID_BLUE_PROP, INVALID_GREEN_PROP, INVALID_RED_PROP, useClearColor
 
Fields inherited from class org.j3d.aviatrix3d.Node
bounds, implicitBounds, INVALID_BOUNDS, parent
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_TIMING_ERR_PROP, updateHandler
 
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.
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 int compareTo(ShapeBackground bg)
          Compares this object with the specified object for order.
 boolean equals(java.lang.Object o)
          Compare this object for equality to the given object.
 boolean equals(ShapeBackground bg)
          Compares this object with the specified object to check for equivalence.
 Shape3D getShape(int idx)
          Get the current the shape and the given index position.
 boolean is2D()
          Check to see whether this shape is something that represents 2D or 3D renderable background.
 void postRender(javax.media.opengl.GL gl)
          Restore all openGL state to the given drawable.
 Shape3D removeShape(int idx)
          Remove the shape at the given index position.
 void render(javax.media.opengl.GL gl)
          Issue ogl commands needed for this component
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.Background
compareColor4, equalsColor4, getColor, getCullableParent, getRenderable, isColorClearEnabled, markBoundsDirty, setColor, setColor, setColorClearEnabled
 
Methods inherited from class org.j3d.aviatrix3d.Node
boundsChanged, checkForCyclicParent, getBounds, getParent, recomputeBounds, removeParent, requestBoundsUpdate, setBounds, setParent, updateBounds, updateParentBounds
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, dataChanged, getAppUpdateWriteTimingMessage, getBoundsWriteTimingMessage, getDataWriteTimingMessage, getUserData, isLive, setUserData
 
Methods inherited from class java.lang.Object
clone, 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. The colour provided should have 3 or 4 elements. If 3 are provided, a fully opaque background is assumed. If less than 3 elements are provided, an exception is generated. If the array is null, this assumes the a default black background.

Parameters:
c - The array of colours to use, or null
Throws:
java.lang.IllegalArgumentException - The colour array is not long enough
Method Detail

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 SceneGraphObject
Parameters:
state - true to set this to live

is2D

public boolean is2D()
Check to see whether this shape is something that represents 2D or 3D renderable background. Pure 2D backgrounds do not need transformation stacks or frustums set up to render - they can blit straight to the screen as needed.

Returns:
True if this is 2D background, false if this is 3D

render

public void render(javax.media.opengl.GL gl)
Issue ogl commands needed for this component

Parameters:
gl - The gl context to draw with

postRender

public void postRender(javax.media.opengl.GL gl)
Restore all openGL state to the given drawable.

Parameters:
gl - The gl context to draw with

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Parameters:
o - The objec to be compared
Returns:
-1, 0 or 1 depending on order
Throws:
java.lang.ClassCastException - The specified object's type prevents it from being compared to this Object

equals

public boolean equals(java.lang.Object o)
Compare this object for equality to the given object.

Specified by:
equals in interface Renderable
Overrides:
equals in class java.lang.Object
Parameters:
o - The object to be compared
Returns:
True if these represent the same values

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 data changed 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
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data changed callback method

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 data changed 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

compareTo

public int compareTo(ShapeBackground bg)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Parameters:
bg - The argument instance to be compared
Returns:
-1, 0 or 1 depending on order

equals

public boolean equals(ShapeBackground bg)
Compares this object with the specified object to check for equivalence.

Parameters:
bg - The background instance to be compared
Returns:
true if the objects represent identical values

Aviatrix3D
2.1.0

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