com.jme3.light
Class LightList

java.lang.Object
  extended by com.jme3.light.LightList
All Implemented Interfaces:
Savable, java.lang.Cloneable, java.lang.Iterable<Light>

public final class LightList
extends java.lang.Object
implements java.lang.Iterable<Light>, Savable, java.lang.Cloneable

LightList is used internally by Spatials to manage lights that are attached to them.


Constructor Summary
LightList()
          Default constructor for serialization.
LightList(Spatial owner)
          Creates a LightList for the given Spatial.
 
Method Summary
 void add(Light l)
          Adds a light to the list.
 void clear()
          Resets list size to 0.
 LightList clone()
           
 Light get(int num)
           
 java.util.Iterator<Light> iterator()
          Returns an iterator that can be used to iterate over this LightList.
 void read(JmeImporter im)
           
 void remove(int index)
          Remove the light at the given index.
 void remove(Light l)
          Removes the given light from the LightList.
 void setOwner(Spatial owner)
          Set the owner of the LightList.
 int size()
           
 void sort(boolean transformChanged)
          Sorts the elements in the list acording to their Comparator.
 void update(LightList local, LightList parent)
          Updates a "world-space" light list, using the spatial's local-space light list and its parent's world-space light list.
 void write(JmeExporter ex)
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LightList

public LightList()
Default constructor for serialization. Do not use


LightList

public LightList(Spatial owner)
Creates a LightList for the given Spatial.

Parameters:
owner - The spatial owner
Method Detail

setOwner

public void setOwner(Spatial owner)
Set the owner of the LightList. Only used for cloning.

Parameters:
owner -

add

public void add(Light l)
Adds a light to the list. List size is doubled if there is no room.

Parameters:
l - The light to add.

remove

public void remove(int index)
Remove the light at the given index.

Parameters:
index -

remove

public void remove(Light l)
Removes the given light from the LightList.

Parameters:
l - the light to remove

size

public int size()
Returns:
The size of the list.

get

public Light get(int num)
Returns:
the light at the given index.
Throws:
java.lang.IndexOutOfBoundsException - If the given index is outside bounds.

clear

public void clear()
Resets list size to 0.


sort

public void sort(boolean transformChanged)
Sorts the elements in the list acording to their Comparator. There are two reasons why lights should be resorted. First, if the lights have moved, that means their distance to the spatial changed. Second, if the spatial itself moved, it means the distance from it to the individual lights might have changed.

Parameters:
transformChanged - Whether the spatial's transform has changed

update

public void update(LightList local,
                   LightList parent)
Updates a "world-space" light list, using the spatial's local-space light list and its parent's world-space light list.

Parameters:
local -
parent -

iterator

public java.util.Iterator<Light> iterator()
Returns an iterator that can be used to iterate over this LightList.

Specified by:
iterator in interface java.lang.Iterable<Light>
Returns:
an iterator that can be used to iterate over this LightList.

clone

public LightList clone()
Overrides:
clone in class java.lang.Object

write

public void write(JmeExporter ex)
           throws java.io.IOException
Specified by:
write in interface Savable
Throws:
java.io.IOException

read

public void read(JmeImporter im)
          throws java.io.IOException
Specified by:
read in interface Savable
Throws:
java.io.IOException