Aviatrix3D 1.0

org.j3d.aviatrix3d
Class BoxBackground

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.BoxBackground
All Implemented Interfaces:
DeletableSceneGraphObject, Renderable, RenderableObject

public class BoxBackground
extends Background
implements DeletableSceneGraphObject

Background node that renders a sky box using any or all of the 6 textures.

Note that this will take any 2D texture component as the source. However, if that image defines mipmapping, the background ignores it. Only the first (primary) image is used to render the texture.

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.6 $
Author:
Justin Couch

Field Summary
static int NEGATIVE_X
          The texture belongs to the negative X axis
static int NEGATIVE_Y
          The texture belongs to the negative Y axis
static int NEGATIVE_Z
          The texture belongs to the negative Z axis
static int POSITIVE_X
          The texture belongs to the positive X axis
static int POSITIVE_Y
          The texture belongs to the positive Y axis
static int POSITIVE_Z
          The texture belongs to the positive Z axis
protected  boolean stateChanged
          Flag to say that the display lists must be cleared and regenerated because some state changed
protected  java.util.HashMap[] textureIdMap
          The mapping of GL context to OpenGL texture ID
 
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, LISTENER_SET_NOT_LIVE_MESSAGE, updateHandler, WRITE_TIMING_MSG
 
Constructor Summary
BoxBackground()
          Constructs a background node for a base colour of black.
BoxBackground(float[] c)
          Construct a background node for a user-provided colour
 
Method Summary
 void cleanup(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
          Cleanup the object now for the given GL context.
 void getColor(float[] c)
          Get the current drawing colour
 TextureComponent2D getTexture(int side)
          Get the current image that is being used on the background.
 void postRender(net.java.games.jogl.GL gl, net.java.games.jogl.GLU glu)
          Restore all openGL state to the given drawable.
 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.
 void setTexture(int side, TextureComponent2D srcImage)
          Set the image source to be used for the background.
 
Methods inherited from class org.j3d.aviatrix3d.Background
markBoundsDirty
 
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
 

Field Detail

POSITIVE_X

public static final int POSITIVE_X
The texture belongs to the positive X axis

See Also:
Constant Field Values

NEGATIVE_X

public static final int NEGATIVE_X
The texture belongs to the negative X axis

See Also:
Constant Field Values

POSITIVE_Y

public static final int POSITIVE_Y
The texture belongs to the positive Y axis

See Also:
Constant Field Values

NEGATIVE_Y

public static final int NEGATIVE_Y
The texture belongs to the negative Y axis

See Also:
Constant Field Values

POSITIVE_Z

public static final int POSITIVE_Z
The texture belongs to the positive Z axis

See Also:
Constant Field Values

NEGATIVE_Z

public static final int NEGATIVE_Z
The texture belongs to the negative Z axis

See Also:
Constant Field Values

stateChanged

protected boolean stateChanged
Flag to say that the display lists must be cleared and regenerated because some state changed


textureIdMap

protected java.util.HashMap[] textureIdMap
The mapping of GL context to OpenGL texture ID

Constructor Detail

BoxBackground

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


BoxBackground

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

Method Detail

cleanup

public void cleanup(net.java.games.jogl.GL gl,
                    net.java.games.jogl.GLU glu)
Cleanup the object now for the given GL context.

Specified by:
cleanup in interface DeletableSceneGraphObject
Parameters:
gl - The gl context to draw with
glu - The utility context to draw with

render

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

Specified by:
render in interface RenderableObject
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.

Specified by:
postRender in interface RenderableObject
Parameters:
gl - The gl context to draw with
glu - The utility context to draw with

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

setTexture

public void setTexture(int side,
                       TextureComponent2D srcImage)
                throws InvalidWriteTimingException
Set the image source to be used for the background.

Parameters:
side - Which side of the box to get the texture for
srcImage - The image data to use
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getTexture

public TextureComponent2D getTexture(int side)
Get the current image that is being used on the background. If none is defined, return null.

Parameters:
side - Which side of the box to get the texture for
Returns:
The current texture source or null

Aviatrix3D 1.0

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