public class BatchableSorter<T extends Batchable & SortableBatchable<T>>
extends java.lang.Object
Batchables to ensure proper render order before passing them to a FlexBatch.
Opaque Batchables are sorted by texture configuration to minimize flushes and drawn first. Blended Batchables are sorted by distance from camera and drawn far to near.
| Modifier and Type | Field and Description |
|---|---|
protected com.badlogic.gdx.math.Vector3 |
cameraPosition |
protected int |
opaqueInitialCapacityPerTexture |
| Constructor and Description |
|---|
BatchableSorter(com.badlogic.gdx.graphics.Camera camera) |
BatchableSorter(com.badlogic.gdx.graphics.Camera camera,
int opaqueIntialTextureCapacity,
int opaqueInitialCapacityPerTexture,
int blendedInitialCapacity) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(T batchable)
Add a Batchable to the queue.
|
void |
clear()
Clear the queue without drawing anything.
|
void |
draw(FlexBatch<T> flexBatch)
Sort (if necessary) and draw the queued Batchables without clearing them.
|
void |
flush(FlexBatch<T> flexBatch)
Sort (if necessary), draw, and clear references to the queued Batchables.
|
void |
setCamera(com.badlogic.gdx.graphics.Camera camera)
Sets the camera that is used for distance comparisons to sort the blended Batchables.
|
protected final int opaqueInitialCapacityPerTexture
protected com.badlogic.gdx.math.Vector3 cameraPosition
public BatchableSorter(com.badlogic.gdx.graphics.Camera camera)
public BatchableSorter(com.badlogic.gdx.graphics.Camera camera,
int opaqueIntialTextureCapacity,
int opaqueInitialCapacityPerTexture,
int blendedInitialCapacity)
public void clear()
public void draw(FlexBatch<T> flexBatch)
FlexBatch.begin() and FlexBatch.end().public void flush(FlexBatch<T> flexBatch)
FlexBatch.begin() and FlexBatch.end().public void add(T batchable)
public void setCamera(com.badlogic.gdx.graphics.Camera camera)