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 of AbstractShadowRendererVR).
All Implemented Interfaces:
Savable
Direct Known Subclasses:
DirectionalLightShadowFilterVR

public abstract class AbstractShadowFilterVR<T extends AbstractShadowRendererVR> extends Filter
Generic abstract filter that holds common implementations for the different shadow filters.
  • Field Details

  • Constructor Details

    • AbstractShadowFilterVR

      protected AbstractShadowFilterVR(AssetManager manager, int shadowMapSize, T shadowRenderer)
      Abstract class constructor
      Parameters:
      manager - the application asset manager
      shadowMapSize - 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

      protected Material getMaterial()
      Description copied from class: Filter
      Must return the material used for this filter. this method is called every frame.
      Specified by:
      getMaterial in class Filter
      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 class Filter
      Returns:
      true if your Filter need the depth texture
    • getShadowMaterial

      public Material getShadowMaterial()
      Get the material 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
      Overrides:
      preFrame in class Filter
      Parameters:
      tpf - the time used to render the previous frame
    • postQueue

      protected void postQueue(RenderQueue queue)
      Description copied from class: Filter
      Override this method if you want to make a pre pass, before the actual rendering of the frame
      Overrides:
      postQueue in class Filter
      Parameters:
      queue - the RenderQueue
    • 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
      Overrides:
      postFrame in class Filter
      Parameters:
      renderManager - for rendering
      viewPort - for rendering
      prevFilterBuffer - the FrameBuffer of the previous filter
      sceneBuffer - the FrameBuffer of the scene
    • 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 class Filter
      Parameters:
      manager - the assetManager
      renderManager - the renderManager
      vp - the viewPort where this filter is rendered
      w - the width of the filter
      h - 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 public boolean isFlushQueues()
      Deprecated.
      does nothing and is kept only for backward compatibility.
      isFlushQueues does nothing and is kept only for backward compatibility.
      Returns:
      false
    • setShadowCompareMode

      public final void setShadowCompareMode(CompareMode compareMode)
      Sets the shadow compare mode (see CompareMode for more info).
      Parameters:
      compareMode - the compare mode.
    • getShadowCompareMode

      public CompareMode getShadowCompareMode()
      Get the shadow compare mode.
      Returns:
      the shadow compare mode.
      See Also:
    • setEdgeFilteringMode

      public final void setEdgeFilteringMode(EdgeFilteringMode filterMode)
      Sets the filtering mode for shadow edges see EdgeFilteringMode for more info
      Parameters:
      filterMode - the filtering mode for shadow edges.
    • setRenderBackFacesShadows

      public void setRenderBackFacesShadows(Boolean renderBackFacesShadows)
      WARNING this parameter is defaulted to true for the shadow filter. Setting it to true, may produce edges artifacts on shadows.

      Set to true 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 using 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.
      Parameters:
      renderBackFacesShadows - true if back faces shadows on geometries have to be rendered and false otherwise.
    • isRenderBackFacesShadows

      public boolean isRenderBackFacesShadows()
      Is this filter renders back faces shadows.
      Returns:
      true if this filter renders back faces shadows and false otherwise.
    • getPreShadowForcedRenderState

      public RenderState 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

      public EdgeFilteringMode getEdgeFilteringMode()
      Get the edge filtering mode.
      Returns:
      the edge filtering mode.
    • write

      public void write(JmeExporter ex) throws IOException
      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 interface Savable
      Overrides:
      write in class Filter
      Parameters:
      ex - the exporter (not null)
      Throws:
      IOException - from the exporter
    • read

      public void read(JmeImporter im) throws IOException
      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 interface Savable
      Overrides:
      read in class Filter
      Throws:
      IOException