/** * Sorts the elements in the list according 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. * * * @param transformChanged Whether the spatial's transform has changed */ public void sort(boolean transformChanged) { if (listSize > 1) { // resize or populate our temporary array as necessary if (tlist == null || tlist.length != list.length) { tlist = list.clone(); } else { System.arraycopy(list, 0, tlist, 0, list.length); } if (transformChanged){ // check distance of each light for (int i = 0; i < listSize; i++){ list[i].computeLastDistance(owner); } } // now merge sort tlist into list SortUtil.msort(tlist, list, 0, listSize - 1, c); } }
/** * Sorts the elements in the list according 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. * * * @param transformChanged Whether the spatial's transform has changed */ public void sort(boolean transformChanged) { if (listSize > 1) { // resize or populate our temporary array as necessary if (tlist == null || tlist.length != list.length) { tlist = list.clone(); } else { System.arraycopy(list, 0, tlist, 0, list.length); } if (transformChanged){ // check distance of each light for (int i = 0; i < listSize; i++){ list[i].computeLastDistance(owner); } } // now merge sort tlist into list SortUtil.msort(tlist, list, 0, listSize - 1, c); } }
/** * 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. * * * @param transformChanged Whether the spatial's transform has changed */ public void sort(boolean transformChanged) { if (listSize > 1) { // resize or populate our temporary array as necessary if (tlist == null || tlist.length != list.length) { tlist = list.clone(); } else { System.arraycopy(list, 0, tlist, 0, list.length); } if (transformChanged){ // check distance of each light for (int i = 0; i < listSize; i++){ list[i].computeLastDistance(owner); } } // now merge sort tlist into list SortUtil.msort(tlist, list, 0, listSize - 1, c); } }