com.jme3.post.filters
Class FogFilter

java.lang.Object
  extended by com.jme3.post.Filter
      extended by com.jme3.post.filters.FogFilter
All Implemented Interfaces:
Savable

public class FogFilter
extends Filter

A filter to render a fog effect


Nested Class Summary
 
Nested classes/interfaces inherited from class com.jme3.post.Filter
Filter.Pass
 
Field Summary
 
Fields inherited from class com.jme3.post.Filter
defaultPass, enabled, material, postRenderPasses, processor
 
Constructor Summary
FogFilter()
          Creates a FogFilter
FogFilter(ColorRGBA fogColor, float fogDensity, float fogDistance)
          Create a fog filter
 
Method Summary
 ColorRGBA getFogColor()
          returns the fog color
 float getFogDensity()
          returns the fog density
 float getFogDistance()
          returns the fog distance
protected  Material getMaterial()
          Must return the material used for this filter.
protected  void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h)
          Initialization of sub classes filters This method is called once when the filter is added to the FilterPostProcessor It should contain Material initializations and extra passes initialization
protected  boolean isRequiresDepthTexture()
          Override this method and return true if your Filter needs the depth texture
 void read(JmeImporter im)
          Override this method if you want to load extra properties when the filter is loaded else only basic properties of the filter will be loaded This method should always begin by super.read(im);
 void setFogColor(ColorRGBA fogColor)
          Sets the color of the fog
 void setFogDensity(float fogDensity)
          Sets the density of the fog, a high value gives a thick fog
 void setFogDistance(float fogDistance)
          the distance of the fog.
 void write(JmeExporter ex)
          Override this method if you want to save extra properties when the filter is saved else only basic properties of the filter will be saved This method should always begin by super.write(ex);
 
Methods inherited from class com.jme3.post.Filter
cleanup, cleanUpFilter, getDefaultPassDepthFormat, getDefaultPassTextureFormat, getName, getPostRenderPasses, getRenderedTexture, getRenderFrameBuffer, init, isEnabled, isRequiresSceneTexture, postFrame, postQueue, preFrame, setDepthTexture, setEnabled, setName, setProcessor, setRenderedTexture, setRenderFrameBuffer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FogFilter

public FogFilter()
Creates a FogFilter


FogFilter

public FogFilter(ColorRGBA fogColor,
                 float fogDensity,
                 float fogDistance)
Create a fog filter

Parameters:
fogColor - the color of the fog (default is white)
fogDensity - the density of the fog (default is 0.7)
fogDistance - the distance of the fog (default is 1000)
Method Detail

isRequiresDepthTexture

protected boolean isRequiresDepthTexture()
Description copied from class: Filter
Override this method and return true if your Filter needs the depth texture

Overrides:
isRequiresDepthTexture in class Filter
Returns:
true if your Filter need the depth texture

initFilter

protected void initFilter(AssetManager manager,
                          RenderManager renderManager,
                          ViewPort vp,
                          int w,
                          int h)
Description copied from class: Filter
Initialization of sub classes filters This method is called once when the filter is added to the FilterPostProcessor It should contain Material initializations and extra passes initialization

Specified by:
initFilter in class Filter
Parameters:
manager - the assetManager
renderManager - the renderManager
vp - the viewPort where this filter is rendered
w - the width of the filter
h - the height of the filter

getMaterial

protected Material getMaterial()
Description copied from class: Filter
Must return the material used for this filter. this method is called every frame.

Specified by:
getMaterial in class Filter
Returns:
the material used for this filter.

getFogColor

public ColorRGBA getFogColor()
returns the fog color

Returns:

setFogColor

public void setFogColor(ColorRGBA fogColor)
Sets the color of the fog

Parameters:
fogColor -

getFogDensity

public float getFogDensity()
returns the fog density

Returns:

setFogDensity

public void setFogDensity(float fogDensity)
Sets the density of the fog, a high value gives a thick fog

Parameters:
fogDensity -

getFogDistance

public float getFogDistance()
returns the fog distance

Returns:

setFogDistance

public void setFogDistance(float fogDistance)
the distance of the fog. the higer the value the distant the fog looks

Parameters:
fogDistance -

write

public void write(JmeExporter ex)
           throws java.io.IOException
Description copied from class: Filter
Override this method if you want to save extra properties when the filter is saved else only basic properties of the filter will be saved This method should always begin by super.write(ex);

Specified by:
write in interface Savable
Overrides:
write in class Filter
Throws:
java.io.IOException

read

public void read(JmeImporter im)
          throws java.io.IOException
Description copied from class: Filter
Override this method if you want to load extra properties when the filter is loaded else only basic properties of the filter will be loaded This method should always begin by super.read(im);

Specified by:
read in interface Savable
Overrides:
read in class Filter
Throws:
java.io.IOException