|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme3.post.Filter
public abstract class Filter
Filters are 2D effects applied to the rendered scene.
The filter is fed with the rendered scene image rendered in an offscreen frame buffer.
This texture is applied on a fullscreen quad, with a special material.
This material uses a shader that aplly the desired effect to the scene texture.
This class is abstract, any Filter must extend it.
Any filter holds a frameBuffer and a texture
The getMaterial must return a Material that use a GLSL shader immplementing the desired effect
Nested Class Summary | |
---|---|
class |
Filter.Pass
Inner class Pass Pass are like filters in filters. |
Field Summary | |
---|---|
protected Filter.Pass |
defaultPass
|
protected boolean |
enabled
|
protected Material |
material
|
protected java.util.List<Filter.Pass> |
postRenderPasses
|
protected FilterPostProcessor |
processor
|
Constructor Summary | |
---|---|
protected |
Filter()
contruct a Filter |
|
Filter(java.lang.String name)
|
Method Summary | |
---|---|
protected void |
cleanup(Renderer r)
cleanup this filter |
protected void |
cleanUpFilter(Renderer r)
override this method if you have some cleanup to do |
protected Image.Format |
getDefaultPassDepthFormat()
returns the default pass depth format |
protected Image.Format |
getDefaultPassTextureFormat()
returns the default pass texture format |
protected abstract Material |
getMaterial()
Must return the material used for this filter. |
java.lang.String |
getName()
returns the name of the filter |
protected java.util.List<Filter.Pass> |
getPostRenderPasses()
returns the list of the postRender passes |
protected Texture2D |
getRenderedTexture()
returns the rendered texture of this filter |
protected FrameBuffer |
getRenderFrameBuffer()
returns the default pass frame buffer |
protected void |
init(AssetManager manager,
RenderManager renderManager,
ViewPort vp,
int w,
int h)
initialize this filter use InitFilter for overriding filter initialization |
protected abstract 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 |
boolean |
isEnabled()
returns ttrue if the filter is enabled |
protected boolean |
isRequiresDepthTexture()
Override this method and return true if your Filter needs the depth texture |
protected boolean |
isRequiresSceneTexture()
Override this method and return false if your Filter does not need the scene texture |
protected void |
postFrame(RenderManager renderManager,
ViewPort viewPort,
FrameBuffer prevFilterBuffer,
FrameBuffer sceneBuffer)
Override this method if you want to make a pass just after the frame has been rendered and just before the filter rendering |
protected void |
postQueue(RenderManager renderManager,
ViewPort viewPort)
Override this method if you want to make a pre pass, before the actual rendering of the frame |
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); |
protected void |
setDepthTexture(Texture depthTexture)
Override if you want to do something special with the depth texture; |
void |
setEnabled(boolean enabled)
Enable or disable this filter |
void |
setName(java.lang.String name)
Sets the name of the filter |
protected void |
setProcessor(FilterPostProcessor proc)
sets a reference to the FilterPostProcessor ti which this filter is attached |
protected void |
setRenderedTexture(Texture2D renderedTexture)
sets the rendered texture of this filter |
protected void |
setRenderFrameBuffer(FrameBuffer renderFrameBuffer)
sets the default pas frame buffer |
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Filter.Pass defaultPass
protected java.util.List<Filter.Pass> postRenderPasses
protected Material material
protected boolean enabled
protected FilterPostProcessor processor
Constructor Detail |
---|
public Filter(java.lang.String name)
protected Filter()
Method Detail |
---|
protected Image.Format getDefaultPassTextureFormat()
protected Image.Format getDefaultPassDepthFormat()
protected final void init(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h)
manager
- the assetManagerrenderManager
- the renderManagervp
- the viewportw
- the widthh
- the heightprotected final void cleanup(Renderer r)
r
- protected abstract void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h)
manager
- the assetManagerrenderManager
- the renderManagervp
- the viewPort where this filter is renderedw
- the width of the filterh
- the height of the filterprotected void cleanUpFilter(Renderer r)
r
- the rendererprotected abstract Material getMaterial()
protected void setDepthTexture(Texture depthTexture)
depthTexture
- protected void postQueue(RenderManager renderManager, ViewPort viewPort)
renderManager
- viewPort
- protected void preFrame(float tpf)
tpf
- the time used to render the previous frameprotected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer)
renderManager
- viewPort
- prevFilterBuffer
- sceneBuffer
- public void write(JmeExporter ex) throws java.io.IOException
write
in interface Savable
ex
-
java.io.IOException
public void read(JmeImporter im) throws java.io.IOException
read
in interface Savable
java.io.IOException
public java.lang.String getName()
public void setName(java.lang.String name)
name
- protected FrameBuffer getRenderFrameBuffer()
protected void setRenderFrameBuffer(FrameBuffer renderFrameBuffer)
renderFrameBuffer
- protected Texture2D getRenderedTexture()
protected void setRenderedTexture(Texture2D renderedTexture)
renderedTexture
- protected boolean isRequiresDepthTexture()
protected boolean isRequiresSceneTexture()
protected java.util.List<Filter.Pass> getPostRenderPasses()
public void setEnabled(boolean enabled)
enabled
- true to enablepublic boolean isEnabled()
protected void setProcessor(FilterPostProcessor proc)
proc
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |