public abstract class AbstractShadowFilter<T extends AbstractShadowRenderer> extends Filter implements java.lang.Cloneable, JmeCloneable
Filter.Pass
Modifier and Type | Field and Description |
---|---|
protected T |
shadowRenderer |
protected ViewPort |
viewPort |
defaultPass, enabled, material, postRenderPasses, processor
Modifier | Constructor and Description |
---|---|
protected |
AbstractShadowFilter()
used for serialization
|
protected |
AbstractShadowFilter(AssetManager manager,
int shadowMapSize,
T shadowRenderer)
Abstract class constructor
|
Modifier and Type | Method and Description |
---|---|
void |
cloneFields(Cloner cloner,
java.lang.Object original)
Implemented to perform deep cloning for this object, resolving
local cloned references using the specified cloner.
|
EdgeFilteringMode |
getEdgeFilteringMode()
returns the edge filtering mode
|
int |
getEdgesThickness()
returns the edges thickness
|
protected Material |
getMaterial()
Must return the material used for this filter.
|
int |
getNumShadowMaps()
Read the number of shadow maps rendered by this filter.
|
RenderState |
getPreShadowForcedRenderState()
returns the pre shadows pass render state.
|
CompareMode |
getShadowCompareMode()
returns the shadow compare mode
|
float |
getShadowIntensity()
returns the shadow intensity
|
int |
getShadowMapSize()
Read the size of each shadow map rendered by this filter.
|
Material |
getShadowMaterial() |
float |
getShadowZExtend()
How far the shadows are rendered in the view
|
float |
getShadowZFadeLength()
get the length over which the shadow will fade out when using a
shadowZextend
|
protected 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 |
isFlushQueues()
Deprecated.
|
boolean |
isRenderBackFacesShadows()
if this filter renders back faces shadows
|
protected boolean |
isRequiresDepthTexture()
Override this method and return true if your Filter needs the depth texture
|
AbstractShadowFilter<T> |
jmeClone()
Performs a regular shallow clone of the object.
|
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(RenderQueue queue)
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);
|
void |
setEdgeFilteringMode(EdgeFilteringMode filterMode)
Sets the filtering mode for shadow edges see
EdgeFilteringMode
for more info |
void |
setEdgesThickness(int edgesThickness)
Sets the shadow edges thickness.
|
void |
setFlushQueues(boolean flushQueues)
Deprecated.
|
void |
setRenderBackFacesShadows(java.lang.Boolean renderBackFacesShadows)
!! WARNING !! this parameter is defaulted to true for the ShadowFilter.
|
void |
setShadowCompareMode(CompareMode compareMode)
sets the shadow compare mode see
CompareMode for more info |
void |
setShadowIntensity(float shadowIntensity)
Set the shadowIntensity, the value should be between 0 and 1, a 0 value
gives a bright and invisible shadow, a 1 value gives a pitch black
shadow, default is 0.7
|
void |
setShadowZExtend(float zFar)
Set the distance from the eye where the shadows will be rendered default
value is dynamically computed to the shadow casters/receivers union bound
zFar, capped to view frustum far value.
|
void |
setShadowZFadeLength(float length)
Define the length over which the shadow will fade out when using a
shadowZextend
|
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);
|
cleanup, cleanUpFilter, getDefaultPassDepthFormat, getDefaultPassTextureFormat, getName, getPostRenderPasses, getRenderedTexture, getRenderFrameBuffer, init, isEnabled, isRequiresBilinear, isRequiresSceneTexture, postFilter, setDepthTexture, setEnabled, setName, setProcessor, setRenderedTexture, setRenderFrameBuffer
protected T extends AbstractShadowRenderer shadowRenderer
protected ViewPort viewPort
protected AbstractShadowFilter()
protected AbstractShadowFilter(AssetManager manager, int shadowMapSize, T shadowRenderer)
manager
- the application asset managershadowMapSize
- the size of the rendered shadowmaps (512,1024,2048,
etc...)shadowRenderer
- the shadowRenderer to use for this Filterprotected Material getMaterial()
Filter
getMaterial
in class Filter
protected boolean isRequiresDepthTexture()
Filter
isRequiresDepthTexture
in class Filter
public Material getShadowMaterial()
protected void preFrame(float tpf)
Filter
protected void postQueue(RenderQueue queue)
Filter
protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer)
Filter
protected void initFilter(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h)
Filter
initFilter
in class Filter
manager
- the assetManagerrenderManager
- the renderManagervp
- the viewPort where this filter is renderedw
- the width of the filterh
- the height of the filterpublic float getShadowZExtend()
setShadowZExtend(float zFar)
public void setShadowZExtend(float zFar)
zFar
- the zFar values that override the computed onepublic void setShadowZFadeLength(float length)
length
- the fade length in world unitspublic float getShadowZFadeLength()
public float getShadowIntensity()
setShadowIntensity(float shadowIntensity)
public final void setShadowIntensity(float shadowIntensity)
shadowIntensity
- the darkness of the shadowpublic int getEdgesThickness()
setEdgesThickness(int edgesThickness)
public void setEdgesThickness(int edgesThickness)
edgesThickness
- @Deprecated public boolean isFlushQueues()
@Deprecated public void setFlushQueues(boolean flushQueues)
public final void setShadowCompareMode(CompareMode compareMode)
CompareMode
for more infocompareMode
- public CompareMode getShadowCompareMode()
CompareMode
public final void setEdgeFilteringMode(EdgeFilteringMode filterMode)
EdgeFilteringMode
for more infofilterMode
- public void setRenderBackFacesShadows(java.lang.Boolean renderBackFacesShadows)
getPreShadowForcedRenderState()
If you want to set it differently for each material in the scene you have to use the ShadowRenderer instead
of the shadow filter.renderBackFacesShadows
- true or false.public boolean isRenderBackFacesShadows()
public RenderState getPreShadowForcedRenderState()
public EdgeFilteringMode getEdgeFilteringMode()
EdgeFilteringMode
public int getNumShadowMaps()
public int getShadowMapSize()
public AbstractShadowFilter<T> jmeClone()
JmeCloneable
This method is separate from the regular clone() method so that objects might still maintain their own regular java clone() semantics (perhaps even using Cloner for those methods). However, because Java's clone() has specific features in the sense of Object's clone() implementation, it's usually best to have some path for subclasses to bypass the public clone() method that might be cloning fields and instead get at the superclass protected clone() methods. For example, through super.jmeClone() or another protected clone method that some base class eventually calls super.clone() in.
jmeClone
in interface JmeCloneable
public void cloneFields(Cloner cloner, java.lang.Object original)
JmeCloneable
Note: during normal clone operations the original object will not be needed as the clone has already had all of the fields shallow copied.
cloneFields
in interface JmeCloneable
cloner
- The cloner that is performing the cloning operation. The
cloneFields method can call back into the cloner to make
clones of its subordinate fields.original
- The original object from which this object was cloned.
This is provided for the very rare case that this object needs
to refer to its original for some reason. In general, all of
the relevant values should have been transferred during the
shallow clone and this object need merely clone what it wants.public void write(JmeExporter ex) throws java.io.IOException
Filter
public void read(JmeImporter im) throws java.io.IOException
Filter