Class SpotLightShadowRenderer

java.lang.Object
com.jme3.shadow.AbstractShadowRenderer
com.jme3.shadow.SpotLightShadowRenderer
All Implemented Interfaces:
Savable, SceneProcessor, JmeCloneable, Cloneable

public class SpotLightShadowRenderer extends AbstractShadowRenderer
SpotLightShadowRenderer renderer use Parallel Split Shadow Mapping technique (pssm)
It splits the view frustum in several parts and compute a shadow map for each one.
splits are distributed so that the closer they are from the camera, the smaller they are to maximize the resolution used of the shadow map.
This results in a better quality shadow than standard shadow mapping.
for more information on this read http://http.developer.nvidia.com/GPUGems3/gpugems3_ch10.html
  • Field Details

  • Constructor Details

    • SpotLightShadowRenderer

      protected SpotLightShadowRenderer()
      Used for serialization use SpotLightShadowRenderer#SpotLightShadowRenderer(AssetManager assetManager, int shadowMapSize)
    • SpotLightShadowRenderer

      public SpotLightShadowRenderer(AssetManager assetManager, int shadowMapSize)
      Create a SpotLightShadowRenderer This use standard shadow mapping
      Parameters:
      assetManager - the application asset manager
      shadowMapSize - the size of the rendered shadowmaps (512,1024,2048, etc...) The more quality, the fewer fps.
  • Method Details

    • initFrustumCam

      protected void initFrustumCam()
      Description copied from class: AbstractShadowRenderer
      delegates the initialization of the frustum cam to child renderers
      Specified by:
      initFrustumCam in class AbstractShadowRenderer
    • getLight

      public SpotLight getLight()
      return the light used to cast shadows
      Returns:
      the SpotLight
    • setLight

      public void setLight(SpotLight light)
      Sets the light to use to cast shadows
      Parameters:
      light - a SpotLight
    • updateShadowCams

      protected void updateShadowCams(Camera viewCam)
      Description copied from class: AbstractShadowRenderer
      Invoked once per frame to update the shadow cams according to the light view.
      Specified by:
      updateShadowCams in class AbstractShadowRenderer
      Parameters:
      viewCam - the scene cam
    • getOccludersToRender

      protected GeometryList getOccludersToRender(int shadowMapIndex, GeometryList shadowMapOccluders)
      Description copied from class: AbstractShadowRenderer
      Returns a subclass-specific geometryList containing the occluders to be rendered in the shadow map
      Specified by:
      getOccludersToRender in class AbstractShadowRenderer
      Parameters:
      shadowMapIndex - the index of the shadow map being rendered
      shadowMapOccluders - the list of occluders
      Returns:
      the geometryList
    • getReceivers

      protected void getReceivers(GeometryList lightReceivers)
      Specified by:
      getReceivers in class AbstractShadowRenderer
    • getShadowCam

      protected Camera getShadowCam(int shadowMapIndex)
      Description copied from class: AbstractShadowRenderer
      return the shadow camera to use for rendering the shadow map according the given index
      Specified by:
      getShadowCam in class AbstractShadowRenderer
      Parameters:
      shadowMapIndex - the index of the shadow map being rendered
      Returns:
      the shadowCam
    • doDisplayFrustumDebug

      protected void doDisplayFrustumDebug(int shadowMapIndex)
      Description copied from class: AbstractShadowRenderer
      responsible for displaying the frustum of the shadow cam for debug purpose
      Overrides:
      doDisplayFrustumDebug in class AbstractShadowRenderer
      Parameters:
      shadowMapIndex - the index of the shadow map
    • setMaterialParameters

      protected void setMaterialParameters(Material material)
      Description copied from class: AbstractShadowRenderer
      This method is called once per frame and is responsible for setting any material parameters that subclasses may need to set on the post material.
      Specified by:
      setMaterialParameters in class AbstractShadowRenderer
      Parameters:
      material - the material to use for the post shadow pass
    • clearMaterialParameters

      protected void clearMaterialParameters(Material material)
      Description copied from class: AbstractShadowRenderer
      This method is called once per frame and is responsible for clearing any material parameters that subclasses may need to clear on the post material.
      Specified by:
      clearMaterialParameters in class AbstractShadowRenderer
      Parameters:
      material - the material that was used for the post shadow pass
    • cloneFields

      public void cloneFields(Cloner cloner, Object original)
      Description copied from interface: JmeCloneable
      Implemented to perform deep cloning for this object, resolving local cloned references using the specified cloner. The object can call cloner.clone(fieldValue) to deep clone any of its fields.

      Note: during normal clone operations the original object will not be needed as the clone has already had all of the fields shallow copied.

      Specified by:
      cloneFields in interface JmeCloneable
      Overrides:
      cloneFields in class AbstractShadowRenderer
      Parameters:
      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 only clone what it wants.
    • read

      public void read(JmeImporter im) throws IOException
      Description copied from class: AbstractShadowRenderer
      De-serialize this instance, for example when loading from a J3O file.
      Specified by:
      read in interface Savable
      Overrides:
      read in class AbstractShadowRenderer
      Parameters:
      im - importer (not null)
      Throws:
      IOException - from the importer
    • write

      public void write(JmeExporter ex) throws IOException
      Description copied from class: AbstractShadowRenderer
      Serialize this instance, for example when saving to a J3O file.
      Specified by:
      write in interface Savable
      Overrides:
      write in class AbstractShadowRenderer
      Parameters:
      ex - exporter (not null)
      Throws:
      IOException - from the exporter
    • checkCulling

      protected boolean checkCulling(Camera viewCam)
      Specified by:
      checkCulling in class AbstractShadowRenderer
      Parameters:
      viewCam - the viewing Camera to check against
      Returns:
      true if intersects, otherwise false