Class ShadowUtil

java.lang.Object
com.jme3.shadow.ShadowUtil

public class ShadowUtil extends Object
  • Method Details

    • updateFrustumPoints2

      public static void updateFrustumPoints2(Camera viewCam, Vector3f[] points)
      Updates a points arrays with the frustum corners of the provided camera.
      Parameters:
      viewCam - the viewing Camera (not null, unaffected)
      points - storage for the corner coordinates (not null, length≥8, modified)
    • updateFrustumPoints

      public static void updateFrustumPoints(Camera viewCam, float nearOverride, float farOverride, float scale, Vector3f[] points)
      Updates the points array to contain the frustum corners of the given camera. The nearOverride and farOverride variables can be used to override the camera's near/far values with own values. TODO: Reduce creation of new vectors
      Parameters:
      viewCam - the viewing Camera (not null, unaffected)
      nearOverride - distance to the near plane (in world units)
      farOverride - distance to the far plane (in world units)
      scale - scale factor
      points - storage for the corner coordinates (not null, length≥8, modified)
    • computeUnionBound

      public static BoundingBox computeUnionBound(GeometryList list, Transform transform)
      Compute bounds of a geomList
      Parameters:
      list - a list of geometries (not null)
      transform - a coordinate transform
      Returns:
      a new instance
    • computeUnionBound

      public static BoundingBox computeUnionBound(GeometryList list, Matrix4f mat)
      Compute bounds of a geomList
      Parameters:
      list - a list of geometries (not null)
      mat - a coordinate-transform matrix
      Returns:
      a new instance
    • computeUnionBound

      public static BoundingBox computeUnionBound(List<BoundingVolume> bv)
      Computes the bounds of multiple bounding volumes
      Parameters:
      bv - a list of bounding volumes (not null)
      Returns:
      a new instance
    • computeBoundForPoints

      public static BoundingBox computeBoundForPoints(Vector3f[] pts, Transform transform)
      Compute bounds from an array of points
      Parameters:
      pts - an array of location vectors (not null, unaffected)
      transform - a coordinate transform
      Returns:
      a new instance
    • computeBoundForPoints

      public static BoundingBox computeBoundForPoints(Vector3f[] pts, Matrix4f mat)
      Compute bounds from an array of points
      Parameters:
      pts - an array of location vectors (not null, unaffected)
      mat - a coordinate-transform matrix (not null, unaffected)
      Returns:
      a new BoundingBox
    • updateShadowCamera

      public static void updateShadowCamera(Camera shadowCam, Vector3f[] points)
      Updates the shadow camera to properly contain the given points (which contain the eye camera frustum corners)
      Parameters:
      shadowCam - the shadow camera (not null, modified)
      points - an array of location vectors (not null, unaffected)
    • updateShadowCamera

      public static void updateShadowCamera(ViewPort viewPort, GeometryList receivers, Camera shadowCam, Vector3f[] points, GeometryList splitOccluders, float shadowMapSize)
      Updates the shadow camera to properly contain the given points (which contain the eye camera frustum corners) and the shadow occluder objects collected through the traverse of the scene hierarchy
      Parameters:
      viewPort - the ViewPort
      receivers - a list of receiving geometries
      shadowCam - the shadow camera (not null, modified)
      points - an array of location vectors (not null, unaffected)
      splitOccluders - a list of occluding geometries
      shadowMapSize - the size of each edge of the shadow map (in pixels)
    • getGeometriesInCamFrustum

      public static void getGeometriesInCamFrustum(GeometryList inputGeometryList, Camera camera, GeometryList outputGeometryList)
      Populates the outputGeometryList with the geometry of the inputGeometryList that are in the frustum of the given camera
      Parameters:
      inputGeometryList - The list containing all geometries to check against the camera frustum
      camera - the camera to check geometries against
      outputGeometryList - the list of all geometries that are in the camera frustum
    • getGeometriesInCamFrustum

      public static void getGeometriesInCamFrustum(Spatial rootScene, Camera camera, RenderQueue.ShadowMode mode, GeometryList outputGeometryList)
      Populates the outputGeometryList with the rootScene children geometries that are in the frustum of the given camera
      Parameters:
      rootScene - the rootNode of the scene to traverse
      camera - the camera to check geometries against
      mode - the ShadowMode to test for
      outputGeometryList - the list of all geometries that are in the camera frustum
    • getGeometriesInLightRadius

      public static void getGeometriesInLightRadius(GeometryList inputGeometryList, Camera[] cameras, GeometryList outputGeometryList)
      Populates the outputGeometryList with the geometry of the inputGeometryList that are in the radius of a light. The array must contain 6 cameras, initialized to represent the viewspace of a point light.
      Parameters:
      inputGeometryList - The list containing all geometries to check against the camera frustum
      cameras - the camera array to check geometries against
      outputGeometryList - the list of all geometries that are in the camera frustum
    • getLitGeometriesInViewPort

      public static void getLitGeometriesInViewPort(Spatial rootScene, Camera vpCamera, Camera[] cameras, RenderQueue.ShadowMode mode, GeometryList outputGeometryList)
      Populates the outputGeometryList with the geometries of the children of OccludersExtractor.rootScene node that are both in the frustum of the given vpCamera and some camera inside cameras array. The array of cameras must be initialized to represent the light viewspace of some light like pointLight or spotLight
      Parameters:
      rootScene - the root of the scene to traverse (may be null)
      vpCamera - the viewPort camera
      cameras - the camera array to check geometries against, representing the light viewspace
      mode - the ShadowMode to test for
      outputGeometryList - the output list of all geometries that are in the camera frustum