com.jme.scene.state
Class FogState

java.lang.Object
  extended by com.jme.scene.state.RenderState
      extended by com.jme.scene.state.FogState
All Implemented Interfaces:
Savable
Direct Known Subclasses:
JOGLFogState, 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. Please note that fog does not affect alpha.

Version:
$Id: FogState.java 4137 2009-03-20 18:38:24Z christoph.luder $
Author:
Mark Powell, Joshua Slack

Nested Class Summary
static class FogState.CoordinateSource
           
static class FogState.DensityFunction
           
static class FogState.Quality
           
 
Nested classes/interfaces inherited from class com.jme.scene.state.RenderState
RenderState.StateType
 
Field Summary
protected  ColorRGBA color
           
protected  float density
           
protected  FogState.DensityFunction densityFunction
           
protected  float end
           
protected  FogState.Quality quality
           
protected  FogState.CoordinateSource source
           
protected  float start
           
protected static boolean supportsFogCoords
          True if per vertex fog coords are supported.
protected static boolean supportsFogCoordsDetected
           
 
Fields inherited from class com.jme.scene.state.RenderState
QUICK_COMPARE, RS_BLEND, RS_CLIP, RS_COLORMASK_STATE, RS_CULL, 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
 java.lang.Class<? extends FogState> getClassTag()
           
 ColorRGBA getColor()
           
 float getDensity()
           
 FogState.DensityFunction getDensityFunction()
           
 float getEnd()
           
 FogState.Quality getQuality()
           
 FogState.CoordinateSource getSource()
           
 float getStart()
           
 RenderState.StateType getStateType()
          getStateType returns the type RenderState.StateType.Fog
 int getType()
          Deprecated. As of 2.0, use RenderState.getStateType() instead.
static boolean isFogCoordsSupported()
           
static void overrideFogCoordsSupport(boolean use)
          Override setting of support for mesh based fog coords.
 void read(JMEImporter e)
           
static void resetFogCoordsSupport()
          Reset support for mesh based fog coords to driver-detected setting.
 void setColor(ColorRGBA color)
          setColor sets the color of the fog.
 void setDensity(float density)
          setDensity sets the density of the fog.
 void setDensityFunction(FogState.DensityFunction function)
          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 setQuality(FogState.Quality quality)
          setQuality sets the quality used for the fog attributes.
 void setSource(FogState.CoordinateSource source)
           
 void setStart(float start)
          setStart sets the start distance, or where fog begins to be applied.
 void write(JMEExporter e)
           
 
Methods inherited from class com.jme.scene.state.RenderState
apply, createStateRecord, extract, isEnabled, needsRefresh, setEnabled, setNeedsRefresh, setQuickCompares
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

supportsFogCoords

protected static boolean supportsFogCoords
True if per vertex fog coords are supported.


supportsFogCoordsDetected

protected static boolean supportsFogCoordsDetected

start

protected float start

end

protected float end

density

protected float density

color

protected ColorRGBA color

densityFunction

protected FogState.DensityFunction densityFunction

quality

protected FogState.Quality quality

source

protected FogState.CoordinateSource source
Constructor Detail

FogState

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

Method Detail

setQuality

public void setQuality(FogState.Quality quality)
setQuality sets the quality used for the fog attributes.

Parameters:
quality - the quality used for the fog application.
Throws:
java.lang.IllegalArgumentException - if quality is null

setDensityFunction

public void setDensityFunction(FogState.DensityFunction function)
setDensityFunction sets the density function used for the fog blending.

Parameters:
function - the function used for the fog density.
Throws:
java.lang.IllegalArgumentException - if function is null

setColor

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

Parameters:
color - the color of the fog. This value is COPIED into the state. Further changes to the object after calling this method will have no affect on this state.

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.

setSource

public void setSource(FogState.CoordinateSource source)

getSource

public FogState.CoordinateSource getSource()

getType

public int getType()
Deprecated. As of 2.0, use RenderState.getStateType() instead.

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()

getStateType

public RenderState.StateType getStateType()
getStateType returns the type RenderState.StateType.Fog

Specified by:
getStateType in class RenderState
Returns:
RenderState.StateType.Fog
See Also:
RenderState.getStateType()

getQuality

public FogState.Quality getQuality()

getColor

public ColorRGBA getColor()

getDensity

public float getDensity()

getDensityFunction

public FogState.DensityFunction getDensityFunction()

getEnd

public float getEnd()

getStart

public float getStart()

isFogCoordsSupported

public static boolean isFogCoordsSupported()
Returns:
true if mesh based fog coords are supported

overrideFogCoordsSupport

public static void overrideFogCoordsSupport(boolean use)
Override setting of support for mesh based fog coords.

Parameters:
use -

resetFogCoordsSupport

public static void resetFogCoordsSupport()
Reset support for mesh based fog coords to driver-detected setting.


write

public void write(JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Overrides:
write in class RenderState
Throws:
java.io.IOException

read

public void read(JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Overrides:
read in class RenderState
Throws:
java.io.IOException

getClassTag

public java.lang.Class<? extends FogState> getClassTag()
Specified by:
getClassTag in interface Savable
Overrides:
getClassTag in class RenderState