|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.miso.client.DirtyItemList
public class DirtyItemList
The dirty item list keeps track of dirty sprites and object tiles in a scene.
| Nested Class Summary | |
|---|---|
class |
DirtyItemList.DirtyItem
A class to hold the items inserted in the dirty list along with all of the information necessary to render their dirty regions to the target graphics context when the time comes to do so. |
protected static class |
DirtyItemList.OriginComparator
A comparator class for use in sorting dirty items in ascending origin x- or y-axis coordinate order. |
protected class |
DirtyItemList.RenderComparator
A comparator class for use in sorting the dirty sprites and objects in a scene in ascending x- and y-coordinate order suitable for rendering in the isometric view with proper visual results. |
| Field Summary | |
|---|---|
protected SortableArrayList<DirtyItemList.DirtyItem> |
_ditems
The list of dirty items sorted by rear-depth. |
protected ArrayList<DirtyItemList.DirtyItem> |
_freelist
Unused dirty items. |
protected SortableArrayList<DirtyItemList.DirtyItem> |
_items
The list of dirty items. |
protected Comparator<DirtyItemList.DirtyItem> |
_rcomp
The render comparator we'll use for our final, magical sort. |
protected SortableArrayList<DirtyItemList.DirtyItem> |
_xitems
The list of dirty items sorted by x-position. |
protected SortableArrayList<DirtyItemList.DirtyItem> |
_yitems
The list of dirty items sorted by y-position. |
protected static boolean |
DEBUG_COMPARE
Whether to log debug info when comparing pairs of dirty items. |
protected static boolean |
DEBUG_SORT
Whether to log debug info for the main dirty item sorting algorithm. |
protected static Comparator<DirtyItemList.DirtyItem> |
ORIGIN_X_COMP
The comparator used to sort dirty items in ascending origin x-coordinate order. |
protected static Comparator<DirtyItemList.DirtyItem> |
ORIGIN_Y_COMP
The comparator used to sort dirty items in ascending origin y-coordinate order. |
protected static Comparator<DirtyItemList.DirtyItem> |
REAR_DEPTH_COMP
The comparator used to sort dirty items in ascending "rear-depth" order. |
protected static int |
X_AXIS
Constants used to denote axis sorting constraints. |
protected static int |
Y_AXIS
|
| Constructor Summary | |
|---|---|
DirtyItemList()
Creates a dirt item list that will handle dirty items for the specified view. |
|
| Method Summary | |
|---|---|
void |
appendDirtyObject(SceneObject scobj)
Appends the dirty object tile at the given coordinates to the dirty item list. |
void |
appendDirtySprite(Sprite sprite,
int tx,
int ty)
Appends the dirty sprite at the given coordinates to the dirty item list. |
void |
clear()
Clears out any items that were in this list. |
DirtyItemList.DirtyItem |
get(int idx)
Returns the dirty item at the given index in the list. |
protected DirtyItemList.DirtyItem |
getDirtyItem()
Obtains a new dirty item instance, reusing an old one if possible or creating a new one otherwise. |
void |
paintAndClear(Graphics2D gfx)
Paints all the dirty items in this list using the supplied graphics context. |
int |
size()
Returns the number of items in the dirty item list. |
void |
sort()
Returns an array of the DirtyItemList.DirtyItem objects in the list sorted in proper rendering
order. |
protected static String |
toString(DirtyItemList.DirtyItem a)
Returns an abbreviated string representation of the given dirty item describing only its origin coordinates and render priority. |
protected static String |
toString(DirtyItemList.DirtyItem a,
DirtyItemList.DirtyItem b)
Returns an abbreviated string representation of the two given dirty items. |
protected static String |
toString(SortableArrayList<DirtyItemList.DirtyItem> items)
Returns an abbreviated string representation of the given dirty items. |
protected static void |
toString(StringBuilder buf,
DirtyItemList.DirtyItem item)
Helper function for toString(DirtyItem). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected SortableArrayList<DirtyItemList.DirtyItem> _items
protected SortableArrayList<DirtyItemList.DirtyItem> _xitems
protected SortableArrayList<DirtyItemList.DirtyItem> _yitems
protected SortableArrayList<DirtyItemList.DirtyItem> _ditems
protected Comparator<DirtyItemList.DirtyItem> _rcomp
protected ArrayList<DirtyItemList.DirtyItem> _freelist
protected static final boolean DEBUG_COMPARE
protected static final boolean DEBUG_SORT
protected static final int X_AXIS
protected static final int Y_AXIS
protected static final Comparator<DirtyItemList.DirtyItem> ORIGIN_X_COMP
protected static final Comparator<DirtyItemList.DirtyItem> ORIGIN_Y_COMP
protected static final Comparator<DirtyItemList.DirtyItem> REAR_DEPTH_COMP
| Constructor Detail |
|---|
public DirtyItemList()
| Method Detail |
|---|
public void appendDirtySprite(Sprite sprite,
int tx,
int ty)
sprite - the dirty sprite itself.tx - the sprite's x tile position.ty - the sprite's y tile position.public void appendDirtyObject(SceneObject scobj)
scobj - the scene object that is dirty.public DirtyItemList.DirtyItem get(int idx)
public void sort()
DirtyItemList.DirtyItem objects in the list sorted in proper rendering
order.
public void paintAndClear(Graphics2D gfx)
public void clear()
public int size()
protected DirtyItemList.DirtyItem getDirtyItem()
protected static String toString(DirtyItemList.DirtyItem a)
protected static String toString(DirtyItemList.DirtyItem a,
DirtyItemList.DirtyItem b)
toString(DirtyItem).
protected static String toString(SortableArrayList<DirtyItemList.DirtyItem> items)
toString(DirtyItem).
protected static void toString(StringBuilder buf,
DirtyItemList.DirtyItem item)
toString(DirtyItem).
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||