Class FadeFilter

java.lang.Object
com.jme3.post.Filter
com.jme3.post.filters.FadeFilter
All Implemented Interfaces:
com.jme3.export.Savable

public class FadeFilter extends com.jme3.post.Filter
Fade Filter allows you to make an animated fade effect on a scene.
Author:
Rémy Bouquet aka Nehon implemented from boxjar implementation
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class com.jme3.post.Filter

    com.jme3.post.Filter.Pass
  • Field Summary

    Fields inherited from class com.jme3.post.Filter

    defaultPass, enabled, material, postRenderPasses, processor
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a FadeFilter
    FadeFilter(float duration)
    Creates a FadeFilter with the given duration
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    fades the scene in (black to scene)
    void
    fades the scene out (scene to black)
    float
    returns the duration of the effect
    protected com.jme3.material.Material
     
    float
    Returns the current fade value.
    protected void
    initFilter(com.jme3.asset.AssetManager manager, com.jme3.renderer.RenderManager renderManager, com.jme3.renderer.ViewPort vp, int w, int h)
     
    void
     
    protected void
    preFrame(float tpf)
     
    void
    read(com.jme3.export.JmeImporter im)
     
    void
    setDuration(float duration)
    Sets the duration of the filter default is 1 second
    void
    setValue(float value)
    Sets the fade value.
    void
    write(com.jme3.export.JmeExporter ex)
     

    Methods inherited from class com.jme3.post.Filter

    cleanup, cleanUpFilter, getDefaultPassDepthFormat, getDefaultPassTextureFormat, getName, getPostRenderPasses, getRenderedTexture, getRenderFrameBuffer, init, isEnabled, isRequiresBilinear, isRequiresDepthTexture, isRequiresSceneTexture, postFilter, postFrame, postQueue, 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 Details

    • FadeFilter

      public FadeFilter()
      Creates a FadeFilter
    • FadeFilter

      public FadeFilter(float duration)
      Creates a FadeFilter with the given duration
      Parameters:
      duration - the desired duration (in seconds, default=1)
  • Method Details

    • getMaterial

      protected com.jme3.material.Material getMaterial()
      Specified by:
      getMaterial in class com.jme3.post.Filter
    • initFilter

      protected void initFilter(com.jme3.asset.AssetManager manager, com.jme3.renderer.RenderManager renderManager, com.jme3.renderer.ViewPort vp, int w, int h)
      Specified by:
      initFilter in class com.jme3.post.Filter
    • preFrame

      protected void preFrame(float tpf)
      Overrides:
      preFrame in class com.jme3.post.Filter
    • getDuration

      public float getDuration()
      returns the duration of the effect
      Returns:
      the duration (in seconds)
    • setDuration

      public void setDuration(float duration)
      Sets the duration of the filter default is 1 second
      Parameters:
      duration - the desired duration (in seconds, default=1)
    • fadeIn

      public void fadeIn()
      fades the scene in (black to scene)
    • fadeOut

      public void fadeOut()
      fades the scene out (scene to black)
    • pause

      public void pause()
    • write

      public void write(com.jme3.export.JmeExporter ex) throws IOException
      Specified by:
      write in interface com.jme3.export.Savable
      Overrides:
      write in class com.jme3.post.Filter
      Throws:
      IOException
    • read

      public void read(com.jme3.export.JmeImporter im) throws IOException
      Specified by:
      read in interface com.jme3.export.Savable
      Overrides:
      read in class com.jme3.post.Filter
      Throws:
      IOException
    • getValue

      public float getValue()
      Returns the current fade value. Can be used to check whether fade is complete (e.g. value=1).
      Returns:
      the fractional progress (≥0, ≤1)
    • setValue

      public void setValue(float value)
      Sets the fade value. Can be used to force all black or all scene.
      Parameters:
      value - the desired value (default=1)