Package com.jme3.post.filters
Class FadeFilter
java.lang.Object
com.jme3.post.Filter
com.jme3.post.filters.FadeFilter
- All Implemented Interfaces:
Savable
Fade Filter allows you to make an animated fade effect on a scene.
-
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
ConstructorDescriptionCreates a FadeFilterFadeFilter
(float duration) Creates a FadeFilter with the given duration -
Method Summary
Modifier and TypeMethodDescriptionvoid
fadeIn()
fades the scene in (black to scene)void
fadeOut()
fades the scene out (scene to black)float
returns the duration of the effectprotected Material
Must return the material used for this filter.float
getValue()
Returns the current fade value.protected void
initFilter
(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) Initialization of filter subclasses.void
pause()
protected void
preFrame
(float tpf) Override this method if you want to modify parameters according to tpf before the rendering of the frame.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
setDuration
(float duration) Sets the duration of the filter default is 1 secondvoid
setValue
(float value) Sets the fade value.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, isRequiresBilinear, isRequiresDepthTexture, isRequiresSceneTexture, postFilter, postFrame, postQueue, setDepthTexture, setEnabled, setName, setProcessor, setRenderedTexture, setRenderFrameBuffer
-
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
Description copied from class:Filter
Must return the material used for this filter. this method is called every frame.- Specified by:
getMaterial
in classFilter
- Returns:
- the material used for this filter.
-
initFilter
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) Description copied from class:Filter
Initialization of filter subclasses. 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 classFilter
- Parameters:
manager
- the assetManagerrenderManager
- the renderManagervp
- the viewPort where this filter is renderedw
- the width of the filterh
- the height of the filter
-
preFrame
protected void preFrame(float tpf) Description copied from class:Filter
Override this method if you want to modify parameters according to tpf before the rendering of the frame. This is useful for animated filters Also it can be the place to render pre passes -
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
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 interfaceSavable
- Overrides:
write
in classFilter
- Parameters:
ex
- the exporter (not null)- Throws:
IOException
- from the exporter
-
read
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 interfaceSavable
- Overrides:
read
in classFilter
- 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)
-