com.jme.util
Class LightStateCreator

java.lang.Object
  extended bycom.jme.util.LightStateCreator

public class LightStateCreator
extends java.lang.Object

The LightStateCreator class is used to sort lights in a scene. The utility allows the user to place multiple lights in a single container and the best eight lights (those lights that most directly affect a Spatial) will be applied.

Author:
Badmi

Constructor Summary
LightStateCreator()
          Creates a new instance of LightStateCreator
 
Method Summary
 void addLight(Light l)
          Adds a light for the controller to sort into a spatial.
 LightState createLightState(Spatial sp)
          Creates a new LightState for a spatial placing the "best" eight lights currently maintained by the LightStateCreator.
 Light get(int i)
          Gets the Ith light from the creator.
protected  float getColorValue(Light l)
           
protected  float getValueFor(Light l, BoundingVolume val)
           
protected  float max(ColorRGBA a)
           
 int numberOfLights()
          Returns the number of lights in the creator.
protected  void quickSort(int minindex, int maxindex, Spatial sp)
           
 void resortLightsFor(LightState ls, Spatial sp)
          Gives the LightState the best possible lights for the Spatial.
protected  void swap(int a, int b)
          Swaps point a and b in the list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LightStateCreator

public LightStateCreator()
Creates a new instance of LightStateCreator

Method Detail

addLight

public void addLight(Light l)
Adds a light for the controller to sort into a spatial. All the lights must be added before the lights could be sorted.


get

public Light get(int i)
Gets the Ith light from the creator. The placement of the light is subject to change.


numberOfLights

public int numberOfLights()
Returns the number of lights in the creator.


createLightState

public LightState createLightState(Spatial sp)
Creates a new LightState for a spatial placing the "best" eight lights currently maintained by the LightStateCreator.


resortLightsFor

public void resortLightsFor(LightState ls,
                            Spatial sp)
Gives the LightState the best possible lights for the Spatial. The spatial must be using bounding volumes for this process to work properly.


quickSort

protected void quickSort(int minindex,
                         int maxindex,
                         Spatial sp)

swap

protected void swap(int a,
                    int b)
Swaps point a and b in the list


max

protected float max(ColorRGBA a)

getColorValue

protected float getColorValue(Light l)

getValueFor

protected float getValueFor(Light l,
                            BoundingVolume val)