com.jme.scene.shadow
Class MeshShadows

java.lang.Object
  extended by com.jme.scene.shadow.MeshShadows

public class MeshShadows
extends java.lang.Object

MeshShadows A grouping of the ShadowVolumes for a single TriMesh.

Version:
$Id: MeshShadows.java 4131 2009-03-19 20:15:28Z blaine.dev $
Author:
Mike Talbot (some code from a shadow implementation written Jan 2005), Joshua Slack

Field Summary
protected static Vector3f compVect
          Static computation field
protected  java.util.ArrayList<ShadowTriangle> faces
          The triangles of our occluding mesh (one per triangle in the mesh)
protected  java.util.BitSet facing
          A bitset used for storing directional flags.
protected  Quaternion oldWorldRotation
          The world rotation of the target at the last mesh construction
protected  Vector3f oldWorldScale
          The world scale of the trimesh at the last mesh construction
protected  Vector3f oldWorldTranslation
          The world translation of the trimesh at the last mesh construction
protected  float projectionLength
          the distance to which shadow volumes will be projected
protected  TriMesh target
          The mesh that is the target of this shadow volume
static long throttle
           
protected  java.util.ArrayList<ShadowVolume> volumes
          The arraylist of shadowvolumes in this grouping
 
Constructor Summary
MeshShadows(TriMesh target)
          Constructor for MeshShadows
 
Method Summary
 void createGeometry(LightState lightState)
          createGeometry creates or updates the ShadowVolume geometries for the target TriMesh - one for each applicable Light in the given LightState.
protected  float getIntersectTime(Plane p, Vector3f p0, Vector3f v)
           
 float getProjectionLength()
           
 ShadowVolume getShadowVolume(Light light)
          getShadowVolume returns the shadow volume contained in this grouping for a particular light
 java.util.ArrayList<ShadowVolume> getVolumes()
           
 void recreateFaces()
          recreateFaces creates a triangle array for every triangle in the target occluder mesh and stores it in the faces field.
 void setProjectionLength(float projectionLength)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

projectionLength

protected float projectionLength
the distance to which shadow volumes will be projected


faces

protected java.util.ArrayList<ShadowTriangle> faces
The triangles of our occluding mesh (one per triangle in the mesh)


facing

protected java.util.BitSet facing
A bitset used for storing directional flags.


target

protected TriMesh target
The mesh that is the target of this shadow volume


volumes

protected java.util.ArrayList<ShadowVolume> volumes
The arraylist of shadowvolumes in this grouping


oldWorldRotation

protected Quaternion oldWorldRotation
The world rotation of the target at the last mesh construction


oldWorldTranslation

protected Vector3f oldWorldTranslation
The world translation of the trimesh at the last mesh construction


oldWorldScale

protected Vector3f oldWorldScale
The world scale of the trimesh at the last mesh construction


throttle

public static long throttle

compVect

protected static Vector3f compVect
Static computation field

Constructor Detail

MeshShadows

public MeshShadows(TriMesh target)
Constructor for MeshShadows

Parameters:
target - the mesh that will be the target of the shadow volumes held in this grouping
Method Detail

createGeometry

public void createGeometry(LightState lightState)
createGeometry creates or updates the ShadowVolume geometries for the target TriMesh - one for each applicable Light in the given LightState. Only Directional and Point lights are currently supported. ShadowVolume geometry is only regen'd when light or occluder aspects change.

Parameters:
lightState - is the current lighting state

getIntersectTime

protected float getIntersectTime(Plane p,
                                 Vector3f p0,
                                 Vector3f v)

recreateFaces

public void recreateFaces()
recreateFaces creates a triangle array for every triangle in the target occluder mesh and stores it in the faces field. This is only done rarely in general.


getShadowVolume

public ShadowVolume getShadowVolume(Light light)
getShadowVolume returns the shadow volume contained in this grouping for a particular light

Parameters:
light - the light whose shadow volume should be returned
Returns:
a shadow volume for the light or null if one does not exist

getProjectionLength

public float getProjectionLength()
Returns:
Returns the projectionLength.

setProjectionLength

public void setProjectionLength(float projectionLength)
Parameters:
projectionLength - The projectionLength to set.

getVolumes

public java.util.ArrayList<ShadowVolume> getVolumes()
Returns:
Returns the volumes.