Aviatrix3D
2.0 Dev

org.j3d.aviatrix3d
Class Background

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.Node
          extended byorg.j3d.aviatrix3d.Leaf
              extended byorg.j3d.aviatrix3d.Background
All Implemented Interfaces:
java.lang.Comparable, Renderable, RenderableObject
Direct Known Subclasses:
BoxBackground, ColorBackground, ShapeBackground, SphereBackground

public abstract class Background
extends Leaf
implements RenderableObject

Base collection of functionality marking background nodes of various types.

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].

As such, backgrounds are not typically subject to most rendering effects, such as lighting, fog, perspective projection etc.

Version:
$Revision: 1.9 $
Author:
Justin Couch

Field Summary
protected  float[] color
          Base colour of the background
protected  java.util.HashMap dispListMap
          Map of display contexts to maps
 
Fields inherited from class org.j3d.aviatrix3d.Node
bounds, implicitBounds, INVALID_BOUNDS, parent
 
Fields inherited from class org.j3d.aviatrix3d.SceneGraphObject
alive, LISTENER_SET_NOT_LIVE_MESSAGE, updateHandler, WRITE_TIMING_MSG
 
Constructor Summary
protected Background()
          Constructs a background node with the colour set to opaque black.
protected Background(float[] c)
          Construct a background node for a user-provided colour.
 
Method Summary
protected  int compareColor4(float[] a, float[] b)
          Compare 2 color arrays of length 3 for equality
protected  boolean equalsColor4(float[] a, float[] b)
          Compare 2 color arrays of length 4 for equality
 void getColor(float[] c)
          Get the current drawing colour
 Renderable getRenderable(int bufferId)
          Get the Renderable instance needed to process this object for the given buffer ID.
protected  void markBoundsDirty()
          Mark this node as having dirty bounds due to one of it's children having their bounds changed.
 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.
 
Methods inherited from class org.j3d.aviatrix3d.Node
boundsChanged, checkForCyclicParent, getBounds, getParent, recomputeBounds, removeParent, setBounds, setLive, setParent, updateBounds, updateParentBounds
 
Methods inherited from class org.j3d.aviatrix3d.SceneGraphObject
checkForCyclicChild, dataChanged, getUserData, isLive, setUpdateHandler, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.j3d.aviatrix3d.RenderableObject
postRender, render
 
Methods inherited from interface org.j3d.aviatrix3d.Renderable
equals
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

color

protected float[] color
Base colour of the background


dispListMap

protected java.util.HashMap dispListMap
Map of display contexts to maps

Constructor Detail

Background

protected Background()
Constructs a background node with the colour set to opaque black.


Background

protected Background(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

getRenderable

public Renderable getRenderable(int bufferId)
Get the Renderable instance needed to process this object for the given buffer ID.

Overrides:
getRenderable in class Leaf
Parameters:
bufferId - The ID of the buffer for the renderable to encapsulate
Returns:
The renderable object, or null if nothing to render

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

setColor

public void setColor(float[] c)
              throws InvalidWriteTimingException,
                     java.lang.IllegalArgumentException
Change the colour to the new colour. Colour takes RGBA. If a 3 component colour is set, assume a fully opaque colour. A null parameter sets the colour back to black.

Parameters:
c - The colour to copy in
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method
java.lang.IllegalArgumentException - The colour array is not long enough

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

compareColor4

protected int compareColor4(float[] a,
                            float[] b)
Compare 2 color arrays of length 3 for equality

Parameters:
a - The first colour array to check
b - The first colour array to check
Returns:
-1 if a[i] < b[i], +1 if a[i] > b[i], otherwise 0

equalsColor4

protected boolean equalsColor4(float[] a,
                               float[] b)
Compare 2 color arrays of length 4 for equality

Parameters:
a - The first colour array to check
b - The first colour array to check
Returns:
true if they have the same values, false otherwise

Aviatrix3D
2.0 Dev

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