public class ShadowUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ShadowUtil.OccludersExtractor
OccludersExtractor is a helper class to collect splitOccluders from scene recursively.
|
Modifier and Type | Method and Description |
---|---|
static BoundingBox |
computeBoundForPoints(Vector3f[] pts,
Matrix4f mat)
Compute bounds from an array of points
|
static BoundingBox |
computeBoundForPoints(Vector3f[] pts,
Transform transform)
Compute bounds from an array of points
|
static BoundingBox |
computeUnionBound(GeometryList list,
Matrix4f mat)
Compute bounds of a geomList
|
static BoundingBox |
computeUnionBound(GeometryList list,
Transform transform)
Compute bounds of a geomList
|
static BoundingBox |
computeUnionBound(java.util.List<BoundingVolume> bv)
Computes the bounds of multiple bounding volumes
|
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
|
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
|
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.
|
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.
|
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.
|
static void |
updateFrustumPoints2(Camera viewCam,
Vector3f[] points)
Updates a points arrays with the frustum corners of the provided camera.
|
static void |
updateShadowCamera(Camera shadowCam,
Vector3f[] points)
Updates the shadow camera to properly contain the given points (which
contain the eye camera frustum corners)
|
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
|
public static void updateFrustumPoints2(Camera viewCam, Vector3f[] points)
viewCam
- the viewing Camera (not null, unaffected)points
- storage for the corner coordinates (not null, length≥8,
modified)public static void updateFrustumPoints(Camera viewCam, float nearOverride, float farOverride, float scale, Vector3f[] points)
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 factorpoints
- storage for the corner coordinates (not null, length≥8,
modified)public static BoundingBox computeUnionBound(GeometryList list, Transform transform)
list
- a list of geometries (not null)transform
- a coordinate transformpublic static BoundingBox computeUnionBound(GeometryList list, Matrix4f mat)
list
- a list of geometries (not null)mat
- a coordinate-transform matrixpublic static BoundingBox computeUnionBound(java.util.List<BoundingVolume> bv)
bv
- a list of bounding volumes (not null)public static BoundingBox computeBoundForPoints(Vector3f[] pts, Transform transform)
pts
- an array of location vectors (not null, unaffected)transform
- a coordinate transformpublic static BoundingBox computeBoundForPoints(Vector3f[] pts, Matrix4f mat)
pts
- an array of location vectors (not null, unaffected)mat
- a coordinate-transform matrix (not null, unaffected)public static void updateShadowCamera(Camera shadowCam, Vector3f[] points)
shadowCam
- the shadow camera (not null, modified)points
- an array of location vectors (not null, unaffected)public static void updateShadowCamera(ViewPort viewPort, GeometryList receivers, Camera shadowCam, Vector3f[] points, GeometryList splitOccluders, float shadowMapSize)
viewPort
- the ViewPortreceivers
- a list of receiving geometriesshadowCam
- the shadow camera (not null, modified)points
- an array of location vectors (not null, unaffected)splitOccluders
- a list of occluding geometriesshadowMapSize
- the size of each edge of the shadow map (in pixels)public static void getGeometriesInCamFrustum(GeometryList inputGeometryList, Camera camera, GeometryList outputGeometryList)
inputGeometryList
- The list containing all geometries to check
against the camera frustumcamera
- the camera to check geometries againstoutputGeometryList
- the list of all geometries that are in the
camera frustumpublic static void getGeometriesInCamFrustum(Spatial rootScene, Camera camera, RenderQueue.ShadowMode mode, GeometryList outputGeometryList)
rootScene
- the rootNode of the scene to traversecamera
- the camera to check geometries againstmode
- the ShadowMode to test foroutputGeometryList
- the list of all geometries that are in the
camera frustumpublic static void getGeometriesInLightRadius(GeometryList inputGeometryList, Camera[] cameras, GeometryList outputGeometryList)
inputGeometryList
- The list containing all geometries to check
against the camera frustumcameras
- the camera array to check geometries againstoutputGeometryList
- the list of all geometries that are in the
camera frustumpublic static void getLitGeometriesInViewPort(Spatial rootScene, Camera vpCamera, Camera[] cameras, RenderQueue.ShadowMode mode, GeometryList outputGeometryList)
rootScene
- the root of the scene to traverse (may be null)vpCamera
- the viewPort cameracameras
- the camera array to check geometries against, representing the light viewspacemode
- the ShadowMode to test foroutputGeometryList
- the output list of all geometries that are in the camera frustum