diff --git a/jme3-core/src/main/java/com/jme3/light/LightList.java b/jme3-core/src/main/java/com/jme3/light/LightList.java index dfeb65405..5ae42ea58 100644 --- a/jme3-core/src/main/java/com/jme3/light/LightList.java +++ b/jme3-core/src/main/java/com/jme3/light/LightList.java @@ -186,7 +186,7 @@ public final class LightList implements Iterable, Savable, Cloneable, Jme listSize = 0; } - + /** * Sorts the elements in the list according to their Comparator. * There are two reasons why lights should be resorted. @@ -219,6 +219,18 @@ public final class LightList implements Iterable, Savable, Cloneable, Jme } } + public void sort(Comparator comparator) { + if (listSize > 1) { + if (tlist == null || tlist.length != list.length) { + tlist = list.clone(); + } else { + System.arraycopy(list, 0, tlist, 0, list.length); + } + + SortUtil.msort(tlist, list, 0, listSize - 1, comparator); + } + } + /** * Updates a "world-space" light list, using the spatial's local-space * light list and its parent's world-space light list.