Package com.jme3.post

Class FilterPostProcessor

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

public class FilterPostProcessor extends 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
  • Field Details

    • FPP

      public static final String FPP
  • Constructor Details

    • FilterPostProcessor

      public FilterPostProcessor(AssetManager assetManager)
      Create a FilterProcessor
      Parameters:
      assetManager - the assetManager
    • FilterPostProcessor

      protected FilterPostProcessor()
      Don't use this constructor, use FilterPostProcessor(AssetManager assetManager)
      This constructor is used for serialization only
  • Method Details

    • 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 - the Filter to remove (not null)
    • getFilterIterator

      public 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
    • getDefaultPassTextureFormat

      public Image.Format getDefaultPassTextureFormat()
    • 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 - the Filter to modify (not null)
      enabled - true to enable, false to disable
    • cleanup

      public void cleanup()
      Description copied from interface: SceneProcessor
      Called when the SP is removed from the RM.
      Specified by:
      cleanup in interface SceneProcessor
    • setProfiler

      public void setProfiler(AppProfiler profiler)
      Description copied from interface: SceneProcessor
      Sets a profiler Instance for this processor.
      Specified by:
      setProfiler in interface SceneProcessor
      Parameters:
      profiler - the profiler instance.
    • 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
      Parameters:
      vp - the affected ViewPort
      w - the new width (in pixels)
      h - the new height (in pixels)
    • 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 - to load assets
    • setFrameBufferFormat

      public void setFrameBufferFormat(Image.Format fbFormat)
      Sets the format to be used for the internal frame buffer's color buffer
      Parameters:
      fbFormat - the format
    • setFrameBufferDepthFormat

      public void setFrameBufferDepthFormat(Image.Format depthFormat)
      Sets the format to be used for the internal frame buffer's depth buffer
      Parameters:
      depthFormat - the format
    • getFrameBufferDepthFormat

      public Image.Format getFrameBufferDepthFormat()
      Returns the depth format currently used for the internal frame buffer's depth buffer
      Returns:
      the depth format
    • write

      public void write(JmeExporter ex) throws IOException
      Specified by:
      write in interface Savable
      Throws:
      IOException
    • read

      public void read(JmeImporter im) throws IOException
      Specified by:
      read in interface Savable
      Throws:
      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
    • getFilter

      public <T extends Filter> T getFilter(Class<T> filterType)
      returns the first filter in the list assignable from the given type
      Type Parameters:
      T - the filter type
      Parameters:
      filterType - the filter type
      Returns:
      a filter assignable from the given type
    • getFilterList

      public List<Filter> getFilterList()
      returns an unmodifiable version of the filter list.
      Returns:
      the filters list