Class CascadeShadowMap

java.lang.Object
gaiasky.util.gdx.model.gltf.scene3d.scene.CascadeShadowMap
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable

public class CascadeShadowMap extends Object implements com.badlogic.gdx.utils.Disposable
  • Field Details

    • lights

      public final com.badlogic.gdx.utils.Array<DirectionalShadowLight> lights
    • attribute

      public final CascadeShadowMapAttribute attribute
    • cascadeCount

      protected final int cascadeCount
    • splitRates

      protected final com.badlogic.gdx.utils.FloatArray splitRates
  • Constructor Details

    • CascadeShadowMap

      public CascadeShadowMap(int cascadeCount)
      Parameters:
      cascadeCount - how many extra cascades
  • Method Details

    • dispose

      public void dispose()
      Specified by:
      dispose in interface com.badlogic.gdx.utils.Disposable
    • setCascades

      public void setCascades(com.badlogic.gdx.graphics.Camera sceneCamera, DirectionalShadowLight base, float minLlightDepth, float splitDivisor)
      Setup base light and extra cascades based on scene camera frustum. With automatic split rates.
      Parameters:
      sceneCamera - the camera used to render the scene (frustum should be up to date)
      base - the default shadow light, used for far shadows
      minLlightDepth - minimum shadow box depth, depends on the scene, big value means more objects casted but less precision. A zero value restricts shadow box depth to the frustrum (only visible objects by the scene camera).
      splitDivisor - Describe how to split scene camera frustum. . With a value of 4, far cascade covers the range: 1/4 to 1/1, next cascade, the range 1/16 to 1/4, and so on. The closest one covers the remaining starting from 0. When used with 2 extra cascades (3 areas), split points are: 0.0, 1/16, 1/4, 1.0.
    • setCascades

      public void setCascades(com.badlogic.gdx.graphics.Camera sceneCamera, DirectionalShadowLight base, float minLlightDepth, com.badlogic.gdx.utils.FloatArray splitRates)
      Setup base light and extra cascades based on scene camera frustum. With user defined split rates.
      Parameters:
      sceneCamera - the camera used to render the scene (frustum should be up to date)
      base - the default shadow light, used for far shadows
      minLlightDepth - minimum shadow box depth, depends on the scene, big value means more objects casted but less precision. A zero value restricts shadow box depth to the frustrum (only visible objects by the scene camera).
      splitRates - Describe how to split scene camera frustum. The first 2 values define near and far rate for the closest cascade, Second and third value define near and far rate for the second cascade, and so on. When used with 2 extra cascades (3 areas), 4 split rates are expected. Eg: [0.0, 0.1, 0.3, 1.0].
    • syncExtraCascades

      protected void syncExtraCascades(DirectionalShadowLight base)
      create or recreate, if necessary ,extra cascades with same resolution as the default shadow light.
      Parameters:
      base - the default shadow light
    • createLight

      protected DirectionalShadowLight createLight(int width, int height)
      Allow subclass to use their own shadow light implementation.
      Parameters:
      width -
      height -
      Returns:
      a new directional shadow light.