Aviatrix3D
2.1.0

org.j3d.aviatrix3d
Class Background

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
All Implemented Interfaces:
java.lang.Comparable, BackgroundRenderable, Cullable, EnvironmentCullable, ObjectRenderable, Renderable
Direct Known Subclasses:
BoxBackground, ColorBackground, ImageBackground, ShapeBackground, SphereBackground

public abstract class Background
extends Leaf
implements BackgroundRenderable, EnvironmentCullable

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.

Internationalisation Resource Names

Version:
$Revision: 1.13 $
Author:
Justin Couch

Field Summary
protected  float[] color
          Base colour of the background
protected  java.util.HashMap dispListMap
          Map of display contexts to maps
protected static java.lang.String INVALID_ALPHA_PROP
          Message when the drawing mode is not a valid value
protected static java.lang.String INVALID_BLUE_PROP
          Message when the drawing mode is not a valid value
protected static java.lang.String INVALID_GREEN_PROP
          Message when the drawing mode is not a valid value
protected static java.lang.String INVALID_RED_PROP
          Message when the drawing mode is not a valid value
protected  boolean useClearColor
          Flag whether the background should perform a clear of the colour buffer before being drawn.
 
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
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
 Cullable getCullableParent()
          Get the parent cullable of this instance.
 Renderable getRenderable()
          Get the renderable that represents the environment node rendering.
 boolean isColorClearEnabled()
          Check to see if the clearing of the colour buffer is enabled for this instance.
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.
 void setColorClearEnabled(boolean state)
          Enable or disable the clearing of the colour buffer before drawing the background contents.
 
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, setLive, 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.rendering.BackgroundRenderable
is2D
 
Methods inherited from interface org.j3d.aviatrix3d.rendering.ObjectRenderable
postRender, render
 
Methods inherited from interface org.j3d.aviatrix3d.rendering.Renderable
equals
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

INVALID_RED_PROP

protected static final java.lang.String INVALID_RED_PROP
Message when the drawing mode is not a valid value

See Also:
Constant Field Values

INVALID_GREEN_PROP

protected static final java.lang.String INVALID_GREEN_PROP
Message when the drawing mode is not a valid value

See Also:
Constant Field Values

INVALID_BLUE_PROP

protected static final java.lang.String INVALID_BLUE_PROP
Message when the drawing mode is not a valid value

See Also:
Constant Field Values

INVALID_ALPHA_PROP

protected static final java.lang.String INVALID_ALPHA_PROP
Message when the drawing mode is not a valid value

See Also:
Constant Field Values

color

protected float[] color
Base colour of the background


dispListMap

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


useClearColor

protected boolean useClearColor
Flag whether the background should perform a clear of the colour buffer before being drawn. In multilayer systems, we may not want to do that, and instead just blend this layer's background with whatever is previously rendered. By default this is set to always clear.

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

getCullableParent

public Cullable getCullableParent()
Get the parent cullable of this instance.

Specified by:
getCullableParent in interface EnvironmentCullable
Returns:
The parent instance

getRenderable

public Renderable getRenderable()
Get the renderable that represents the environment node rendering.

Specified by:
getRenderable in interface EnvironmentCullable
Returns:
The renderable responsible for this node

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

setColorClearEnabled

public void setColorClearEnabled(boolean state)
                          throws InvalidWriteTimingException
Enable or disable the clearing of the colour buffer before drawing the background contents. The default value is true.

Parameters:
state - True to enable clearing of the colour buffer
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener data callback method

isColorClearEnabled

public boolean isColorClearEnabled()
Check to see if the clearing of the colour buffer is enabled for this instance. The default value is true.

Returns:
true if clearing of the colour buffer is currently performed

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 data 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 data 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.1.0

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