com.jme.scene.state
Class FogState

java.lang.Object
  extended bycom.jme.scene.state.RenderState
      extended bycom.jme.scene.state.FogState
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
LWJGLFogState

public abstract class FogState
extends RenderState

FogState maintains the fog qualities for a node and it's children. The fogging function, color, start, end and density are all set and maintained.

Version:
$Id: FogState.java,v 1.2 2004/04/22 22:26:55 renanse Exp $
Author:
Mark Powell
See Also:
Serialized Form

Field Summary
static int AF_PER_PIXEL
          Defines the rendering method for the fogging, where each pixel color is altered by the fogging function.
static int AF_PER_VERTEX
          Defines the rendering method for the fogging, where each vertex color is altered by the fogging function.
protected  int applyFunction
           
protected  ColorRGBA color
           
protected  float density
           
protected  int densityFunction
           
static int DF_EXP
          The fog blending function defined as: e^-(density*z)
static int DF_EXPSQR
          The fog blending function defined as: e^((-density*z)^2)
static int DF_LINEAR
          The fog blending function defined as: (end - z) / (end - start).
protected  float end
           
protected  float start
           
 
Fields inherited from class com.jme.scene.state.RenderState
RS_ALPHA, RS_ATTRIBUTE, RS_CULL, RS_DITHER, RS_FOG, RS_FRAGMENT_PROGRAM, RS_GLSL_SHADER_OBJECTS, RS_LIGHT, RS_MATERIAL, RS_MAX_STATE, RS_SHADE, RS_STENCIL, RS_TEXTURE, RS_VERTEX_PROGRAM, RS_WIREFRAME, RS_ZBUFFER
 
Constructor Summary
FogState()
          Constructor instantiates a new FogState with default fog values.
 
Method Summary
 int getType()
          getType returns the render state type of the fog state.
 void setApplyFunction(int applyFunction)
          setApplyFunction sets the apply function used for the fog attributes.
 void setColor(ColorRGBA color)
          setColor sets the color of the fog.
 void setDensity(float density)
          setDensity sets the density of the fog.
 void setDensityFunction(int densityFunction)
          setDensityFunction sets the density function used for the fog blending.
 void setEnd(float end)
          setEnd sets the end distance, or the distance where fog is at it's thickest.
 void setStart(float start)
          setStart sets the start distance, or where fog begins to be applied.
 
Methods inherited from class com.jme.scene.state.RenderState
apply, extract, isEnabled, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DF_LINEAR

public static final int DF_LINEAR
The fog blending function defined as: (end - z) / (end - start).

See Also:
Constant Field Values

DF_EXP

public static final int DF_EXP
The fog blending function defined as: e^-(density*z)

See Also:
Constant Field Values

DF_EXPSQR

public static final int DF_EXPSQR
The fog blending function defined as: e^((-density*z)^2)

See Also:
Constant Field Values

AF_PER_VERTEX

public static final int AF_PER_VERTEX
Defines the rendering method for the fogging, where each vertex color is altered by the fogging function.

See Also:
Constant Field Values

AF_PER_PIXEL

public static final int AF_PER_PIXEL
Defines the rendering method for the fogging, where each pixel color is altered by the fogging function.

See Also:
Constant Field Values

start

protected float start

end

protected float end

density

protected float density

color

protected ColorRGBA color

densityFunction

protected int densityFunction

applyFunction

protected int applyFunction
Constructor Detail

FogState

public FogState()
Constructor instantiates a new FogState with default fog values.

Method Detail

setApplyFunction

public void setApplyFunction(int applyFunction)
setApplyFunction sets the apply function used for the fog attributes. If an invalid value is passed in, the default function is set to AF_PER_VERTEX.

Parameters:
applyFunction - the function used for the fog application.

setDensityFunction

public void setDensityFunction(int densityFunction)
setDensityFunction sets the density function used for the fog blending. If an invalid value is passed, the default function is set to DF_LINEAR.

Parameters:
densityFunction - the function used for the fog density.

setColor

public void setColor(ColorRGBA color)
setColor sets the color of the fog.

Parameters:
color - the color of the fog.

setDensity

public void setDensity(float density)
setDensity sets the density of the fog. This value is clamped to [0, 1].

Parameters:
density - the density of the fog.

setEnd

public void setEnd(float end)
setEnd sets the end distance, or the distance where fog is at it's thickest.

Parameters:
end - the distance where the fog is the thickest.

setStart

public void setStart(float start)
setStart sets the start distance, or where fog begins to be applied.

Parameters:
start - the start distance of the fog.

getType

public int getType()
getType returns the render state type of the fog state. (RS_FOG).

Specified by:
getType in class RenderState
Returns:
An int identifying this render state.
See Also:
RenderState.getType()