Package com.jme3.shadow
Class AbstractShadowFilterVR<T extends AbstractShadowRendererVR>
java.lang.Object
com.jme3.post.Filter
com.jme3.shadow.AbstractShadowFilterVR<T>
- Type Parameters:
T
- the type of the underlying renderer (subclass ofAbstractShadowRendererVR
).
- All Implemented Interfaces:
Savable
- Direct Known Subclasses:
DirectionalLightShadowFilterVR
Generic abstract filter that holds common implementations for the different
shadow filters.
-
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
ModifierConstructorDescriptionprotected
AbstractShadowFilterVR
(AssetManager manager, int shadowMapSize, T shadowRenderer) Abstract class constructorprotected
AbstractShadowFilterVR
(AssetManager manager, int shadowMapSize, T shadowRenderer, String useMatDef) -
Method Summary
Modifier and TypeMethodDescriptionGet the edge filtering mode.int
returns the edges thicknessprotected Material
Must return the material used for this filter.Get the pre-shadows pass render state.Get the shadow compare mode.float
returns the shadow intensityGet thematerial
used by this filter.float
How far the shadows are rendered in the viewfloat
get the length over which the shadow will fade out when using a shadowZextendprotected void
initFilter
(AssetManager manager, RenderManager renderManager, ViewPort vp, int w, int h) Initialization of filter subclasses.boolean
Deprecated.does nothing and is kept only for backward compatibility.boolean
Is this filter renders back faces shadows.protected boolean
Override this method and return true if your Filter needs the depth textureprotected 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 renderingprotected void
postQueue
(RenderQueue queue) Override this method if you want to make a pre pass, before the actual rendering of the frameprotected 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);final void
setEdgeFilteringMode
(EdgeFilteringMode filterMode) Sets the filtering mode for shadow edges seeEdgeFilteringMode
for more infovoid
setEdgesThickness
(int edgesThickness) Sets the shadow edge thickness.void
setRenderBackFacesShadows
(Boolean renderBackFacesShadows) WARNING this parameter is defaulted totrue
for the shadow filter.final void
setShadowCompareMode
(CompareMode compareMode) Sets the shadow compare mode (seeCompareMode
for more info).final 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.7void
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 shadowZextendvoid
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, isRequiresSceneTexture, postFilter, setDepthTexture, setEnabled, setName, setProcessor, setRenderedTexture, setRenderFrameBuffer
-
Field Details
-
shadowRenderer
-
viewPort
-
-
Constructor Details
-
AbstractShadowFilterVR
Abstract class constructor- Parameters:
manager
- the application asset managershadowMapSize
- the size of the rendered shadowmaps (512,1024,2048, etc...)shadowRenderer
- the shadowRenderer to use for this Filter
-
AbstractShadowFilterVR
protected AbstractShadowFilterVR(AssetManager manager, int shadowMapSize, T shadowRenderer, String useMatDef)
-
-
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.
-
isRequiresDepthTexture
protected boolean isRequiresDepthTexture()Description copied from class:Filter
Override this method and return true if your Filter needs the depth texture- Overrides:
isRequiresDepthTexture
in classFilter
- Returns:
- true if your Filter need the depth texture
-
getShadowMaterial
Get thematerial
used by this filter.- Returns:
- the
material
used by this 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 -
postQueue
Description copied from class:Filter
Override this method if you want to make a pre pass, before the actual rendering of the frame -
postFrame
protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) Description copied from class:Filter
Override this method if you want to make a pass just after the frame has been rendered and just before the filter rendering -
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
-
getShadowZExtend
public float getShadowZExtend()How far the shadows are rendered in the view- Returns:
- shadowZExtend
- See Also:
-
setShadowZExtend
public 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.- Parameters:
zFar
- the zFar values that override the computed one
-
setShadowZFadeLength
public void setShadowZFadeLength(float length) Define the length over which the shadow will fade out when using a shadowZextend- Parameters:
length
- the fade length in world units
-
getShadowZFadeLength
public float getShadowZFadeLength()get the length over which the shadow will fade out when using a shadowZextend- Returns:
- the fade length in world units
-
getShadowIntensity
public float getShadowIntensity()returns the shadow intensity- Returns:
- shadowIntensity
- See Also:
-
setShadowIntensity
public final 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- Parameters:
shadowIntensity
- the darkness of the shadow
-
getEdgesThickness
public int getEdgesThickness()returns the edges thickness- Returns:
- edgesThickness
- See Also:
-
setEdgesThickness
public void setEdgesThickness(int edgesThickness) Sets the shadow edge thickness. Default is 1. Setting it to lower values can help to reduce the jagged effect of the shadow edges.- Parameters:
edgesThickness
- the edge thickness.
-
isFlushQueues
Deprecated.does nothing and is kept only for backward compatibility.isFlushQueues does nothing and is kept only for backward compatibility.- Returns:
false
-
setShadowCompareMode
Sets the shadow compare mode (seeCompareMode
for more info).- Parameters:
compareMode
- the compare mode.
-
getShadowCompareMode
Get the shadow compare mode.- Returns:
- the shadow compare mode.
- See Also:
-
setEdgeFilteringMode
Sets the filtering mode for shadow edges seeEdgeFilteringMode
for more info- Parameters:
filterMode
- the filtering mode for shadow edges.
-
setRenderBackFacesShadows
WARNING this parameter is defaulted totrue
for the shadow filter. Setting it totrue
, may produce edges artifacts on shadows.
Set totrue
if you want back faces shadows on geometries. Note that back faces shadows will be blended over dark lighten areas and may produce overly dark lighting.
Setting this parameter will override this parameter for ALL materials in the scene. This also will automatically adjust the face cull mode and the PolyOffset of the pre shadow pass. You can modify them by usinggetPreShadowForcedRenderState()
.
If you want to set it differently for each material in the scene you have to use the ShadowRenderer instead of the shadow filter.- Parameters:
renderBackFacesShadows
-true
if back faces shadows on geometries have to be rendered andfalse
otherwise.
-
isRenderBackFacesShadows
public boolean isRenderBackFacesShadows()Is this filter renders back faces shadows.- Returns:
true
if this filter renders back faces shadows andfalse
otherwise.
-
getPreShadowForcedRenderState
Get the pre-shadows pass render state. use it to adjust the RenderState parameters of the pre shadow pass. Note that this will be overridden if the preShadow technique in the material has a ForcedRenderState- Returns:
- the pre shadow render state.
-
getEdgeFilteringMode
Get the edge filtering mode.- Returns:
- the edge filtering mode.
-
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
-