public final class LightList extends java.lang.Object implements java.lang.Iterable<Light>, Savable, java.lang.Cloneable, JmeCloneable
LightList
is used internally by Spatial
s to manage
lights that are attached to them.Modifier | Constructor and Description |
---|---|
protected |
LightList()
constructor for serialization.
|
|
LightList(Spatial owner)
Creates a
LightList for the given Spatial . |
Modifier and Type | Method and Description |
---|---|
void |
add(Light l)
Adds a light to the list.
|
void |
clear()
Resets list size to 0.
|
LightList |
clone() |
void |
cloneFields(Cloner cloner,
java.lang.Object original)
Implemented to perform deep cloning for this object, resolving
local cloned references using the specified cloner.
|
Light |
get(int num) |
java.util.Iterator<Light> |
iterator()
Returns an iterator that can be used to iterate over this LightList.
|
LightList |
jmeClone()
Performs a regular shallow clone of the object.
|
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 according 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) |
public void setOwner(Spatial owner)
owner
- the desired owner (alias created)public void add(Light l)
l
- The light to add.public void remove(int index)
index
- the zero-based index of the Light to be removed (≥0)public void remove(Light l)
l
- the light to removepublic int size()
public Light get(int num)
num
- the zero-based index of the light to be accessed (≥0)java.lang.IndexOutOfBoundsException
- If the given index is outside bounds.public void clear()
public void sort(boolean transformChanged)
transformChanged
- Whether the spatial's transform has changedpublic void update(LightList local, LightList parent)
local
- the local-space LightList (not null)parent
- the parent's world-space LightListpublic java.util.Iterator<Light> iterator()
iterator
in interface java.lang.Iterable<Light>
public LightList clone()
clone
in class java.lang.Object
public LightList jmeClone()
JmeCloneable
This method is separate from the regular clone() method so that objects might still maintain their own regular java clone() semantics (perhaps even using Cloner for those methods). However, because Java's clone() has specific features in the sense of Object's clone() implementation, it's usually best to have some path for subclasses to bypass the public clone() method that might be cloning fields and instead get at the superclass protected clone() methods. For example, through super.jmeClone() or another protected clone method that some base class eventually calls super.clone() in.
jmeClone
in interface JmeCloneable
public void cloneFields(Cloner cloner, java.lang.Object original)
JmeCloneable
Note: during normal clone operations the original object will not be needed as the clone has already had all of the fields shallow copied.
cloneFields
in interface JmeCloneable
cloner
- The cloner that is performing the cloning operation. The
cloneFields method can call back into the cloner to make
clones of its subordinate fields.original
- The original object from which this object was cloned.
This is provided for the very rare case that this object needs
to refer to its original for some reason. In general, all of
the relevant values should have been transferred during the
shallow clone, and this object need only clone what it wants.public void write(JmeExporter ex) throws java.io.IOException
public void read(JmeImporter im) throws java.io.IOException