j3d.org Aviatrix3D

org.j3d.aviatrix3d
Class Fog

java.lang.Object
  extended byorg.j3d.aviatrix3d.SceneGraphObject
      extended byorg.j3d.aviatrix3d.Node
          extended byorg.j3d.aviatrix3d.Leaf
              extended byorg.j3d.aviatrix3d.Fog

public class Fog
extends Leaf

Describes a a fog rendering effect.

All types of fog are reprensented in a single class. If the parameter type is not useful for the fog mode, it is ignored.

Version:
$Revision: 1.9 $
Author:
Justin Couch

Field Summary
static int EXPONENTIAL
          Set the fog mode to exponential curve
static int EXPONENTIAL_2
          Set the fog mode to exponential-squared curve
static int LINEAR
          Set the fog mode to linear
 
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
Fog()
          Constructs a fog node with the default mode set to linear and the colour set to white.
Fog(int mode)
          Construct a fog using the given mode and the colour set to white.
Fog(int mode, float[] c)
          Construct a fog using the given mode and colour.
 
Method Summary
 void getColor(float[] c)
          Get the current drawing colour
 float getDensityRate()
          Get the current decay rate.
 void getLinearDistance(float[] values)
          Get the two distance values for the linear fog settings.
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.
 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 fog colour to the new colour.
 void setDensityRate(float rate)
          Set the exponential decay factor.
 void setLinearDistance(float start, float end)
          Set the distance functions for the fog when in linear mode.
 
Methods inherited from class org.j3d.aviatrix3d.Node
boundsChanged, checkForCyclicParent, getBounds, getParent, recomputeBounds, removeParent, setBounds, setLive, setParent, updateBounds
 
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

EXPONENTIAL

public static final int EXPONENTIAL
Set the fog mode to exponential curve

See Also:
Constant Field Values

EXPONENTIAL_2

public static final int EXPONENTIAL_2
Set the fog mode to exponential-squared curve

See Also:
Constant Field Values

LINEAR

public static final int LINEAR
Set the fog mode to linear

See Also:
Constant Field Values
Constructor Detail

Fog

public Fog()
Constructs a fog node with the default mode set to linear and the colour set to white.


Fog

public Fog(int mode)
Construct a fog using the given mode and the colour set to white.


Fog

public Fog(int mode,
           float[] c)
Construct a fog using the given mode and 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

Overrides:
render in class Node
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.

Overrides:
postRender in class Node
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

setColor

public void setColor(float[] c)
              throws InvalidWriteTimingException
Change the fog colour to the new colour. Fog colour only takes RGB.

Parameters:
c - The colour to copy in
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 3 or more to copy the colour to

setLinearDistance

public void setLinearDistance(float start,
                              float end)
                       throws InvalidWriteTimingException
Set the distance functions for the fog when in linear mode.

Parameters:
start - The closest distance that fog starts at
end - The distance that the fog is fully opaque at
Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getLinearDistance

public void getLinearDistance(float[] values)
Get the two distance values for the linear fog settings. The values are returned in the provided array with index 0 being the start and index 1 being the end.

Parameters:
values - An array to copy the values into

setDensityRate

public void setDensityRate(float rate)
                    throws InvalidWriteTimingException
Set the exponential decay factor.

Throws:
InvalidWriteTimingException - An attempt was made to write outside of the NodeUpdateListener callback method

getDensityRate

public float getDensityRate()
Get the current decay rate.

Returns:
a value > 0

j3d.org Aviatrix3D

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