com.jme3.post
Class FilterPostProcessor

java.lang.Object
  extended by com.jme3.post.FilterPostProcessor
All Implemented Interfaces:
Savable, SceneProcessor

public class FilterPostProcessor
extends java.lang.Object
implements SceneProcessor, Savable

A FilterPostProcessor is a processor that can apply several Filters to a rendered scene
It manages a list of filters that will be applied in the order in which they've been added to the list


Constructor Summary
FilterPostProcessor()
          Don't use this constructor, use FilterPostProcessor(AssetManager assetManager)
This constructor is used for serialization only
FilterPostProcessor(AssetManager assetManager)
          Create a FilterProcessor
 
Method Summary
 void addFilter(Filter filter)
          Adds a filter to the filters list
 void cleanup()
          Called when the SP is removed from the RM.
 Texture2D getDepthTexture()
          For internal use only
returns the depth texture of the scene
 java.util.Iterator<Filter> getFilterIterator()
           
 Texture2D getFilterTexture()
          For internal use only
returns the rendered texture of the scene
 int getNumSamples()
          return the number of samples for antialiasing
 void initialize(RenderManager rm, ViewPort vp)
          Called in the render thread to initialize the scene processor.
 boolean isInitialized()
           
 void postFrame(FrameBuffer out)
          Called after a frame has been rendered and the queue flushed.
 void postQueue(RenderQueue rq)
          Called after the scene graph has been queued, but before it is flushed.
 void preFrame(float tpf)
          Called before a frame
 void read(JmeImporter im)
           
 void removeAllFilters()
          Removes all the filters from this processor
 void removeFilter(Filter filter)
          removes this filters from the filters list
 void reshape(ViewPort vp, int w, int h)
          Called when the resolution of the viewport has been changed.
 void setAssetManager(AssetManager assetManager)
          Sets the asset manager for this processor
protected  void setFilterState(Filter filter, boolean enabled)
          sets the filter to enabled or disabled
 void setNumSamples(int numSamples)
          Sets the number of samples for antialiasing
 void write(JmeExporter ex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilterPostProcessor

public FilterPostProcessor(AssetManager assetManager)
Create a FilterProcessor

Parameters:
assetManager - the assetManager

FilterPostProcessor

public FilterPostProcessor()
Don't use this constructor, use FilterPostProcessor(AssetManager assetManager)
This constructor is used for serialization only

Method Detail

addFilter

public void addFilter(Filter filter)
Adds a filter to the filters list

Parameters:
filter - the filter to add

removeFilter

public void removeFilter(Filter filter)
removes this filters from the filters list

Parameters:
filter -

getFilterIterator

public java.util.Iterator<Filter> getFilterIterator()

initialize

public void initialize(RenderManager rm,
                       ViewPort vp)
Description copied from interface: SceneProcessor
Called in the render thread to initialize the scene processor.

Specified by:
initialize in interface SceneProcessor
Parameters:
rm - The render manager to which the SP was added to
vp - The viewport to which the SP is assigned

isInitialized

public boolean isInitialized()
Specified by:
isInitialized in interface SceneProcessor
Returns:
True if initialize() has been called on this SceneProcessor, false if otherwise.

postQueue

public void postQueue(RenderQueue rq)
Description copied from interface: SceneProcessor
Called after the scene graph has been queued, but before it is flushed.

Specified by:
postQueue in interface SceneProcessor
Parameters:
rq - The render queue

postFrame

public void postFrame(FrameBuffer out)
Description copied from interface: SceneProcessor
Called after a frame has been rendered and the queue flushed.

Specified by:
postFrame in interface SceneProcessor
Parameters:
out - The FB to which the scene was rendered.

preFrame

public void preFrame(float tpf)
Description copied from interface: SceneProcessor
Called before a frame

Specified by:
preFrame in interface SceneProcessor
Parameters:
tpf - Time per frame

setFilterState

protected void setFilterState(Filter filter,
                              boolean enabled)
sets the filter to enabled or disabled

Parameters:
filter -
enabled -

cleanup

public void cleanup()
Description copied from interface: SceneProcessor
Called when the SP is removed from the RM.

Specified by:
cleanup in interface SceneProcessor

reshape

public void reshape(ViewPort vp,
                    int w,
                    int h)
Description copied from interface: SceneProcessor
Called when the resolution of the viewport has been changed.

Specified by:
reshape in interface SceneProcessor

getNumSamples

public int getNumSamples()
return the number of samples for antialiasing

Returns:
numSamples

removeAllFilters

public void removeAllFilters()
Removes all the filters from this processor


setNumSamples

public void setNumSamples(int numSamples)
Sets the number of samples for antialiasing

Parameters:
numSamples - the number of Samples

setAssetManager

public void setAssetManager(AssetManager assetManager)
Sets the asset manager for this processor

Parameters:
assetManager -

write

public void write(JmeExporter ex)
           throws java.io.IOException
Specified by:
write in interface Savable
Throws:
java.io.IOException

read

public void read(JmeImporter im)
          throws java.io.IOException
Specified by:
read in interface Savable
Throws:
java.io.IOException

getDepthTexture

public Texture2D getDepthTexture()
For internal use only
returns the depth texture of the scene

Returns:
the depth texture

getFilterTexture

public Texture2D getFilterTexture()
For internal use only
returns the rendered texture of the scene

Returns:
the filter texture