Renderer for Decal objects.
New objects are added using DecalBatch#add(Decal), there is no limit on how many decals can be added.
Once all the decals have been submitted a call to DecalBatch#flush() will batch them together and send big chunks of
geometry to the GL.
The size of the batch specifies the maximum number of decals that can be batched together before they have to be submitted to
the graphics pipeline. The default size is DecalBatch#DEFAULT_SIZE. If it is known before hand that not as many will be
needed on average the batch can be downsized to save memory. If the game is basically 3d based and decals will only be needed
for an orthogonal HUD it makes sense to tune the size down.
The way the batch handles things depends on the GroupStrategy. Different strategies can be used to customize shaders,
states, culling etc. for more details see the GroupStrategy java doc.
While it shouldn't be necessary to change strategies, if you have to do so, do it before calling add(Decal), and if
you already did, call flush() first.
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private final SortedIntList | |
| private final Pool | |
| private GroupStrategy | |
| private Mesh | |
| private final Array | |
| private float[] |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| protected void | |
| public void | dispose()
Implements com. Frees up memory by dropping the buffer and underlying resources. |
| public void | |
| protected void | flush(ShaderProgram shader, int
Amount of elements from the vertices array to flush verticesPosition)Flushes vertices[0,verticesPosition[ to GL verticesPosition % Decal.SIZE must equal 0 |
| public int | |
| public void | initialize(int
Maximum size of decal objects to hold in memory size)Initializes the batch with the given amount of decal objects the buffer is able to hold when full. |
| protected void | |
| private void | render(ShaderProgram shader, Array<Decal>
Decals to render decals)Renders a group of vertices to the buffer, flushing them to GL when done/full |
| public void |
| DEFAULT_SIZE | back to summary |
|---|---|
| private static final int DEFAULT_SIZE | |
| groupList | back to summary |
|---|---|
| private final SortedIntList<Array<Decal>> groupList | |
| groupPool | back to summary |
|---|---|
| private final Pool<Array<Decal>> groupPool | |
| groupStrategy | back to summary |
|---|---|
| private GroupStrategy groupStrategy | |
| mesh | back to summary |
|---|---|
| private Mesh mesh | |
| usedGroups | back to summary |
|---|---|
| private final Array<Array<Decal>> usedGroups | |
| vertices | back to summary |
|---|---|
| private float[] vertices | |
| DecalBatch | back to summary |
|---|---|
| public DecalBatch(GroupStrategy groupStrategy) Creates a new DecalBatch using the given | |
| DecalBatch | back to summary |
|---|---|
| public DecalBatch(int size, GroupStrategy groupStrategy) | |
| add | back to summary |
|---|---|
| public void add(Decal decal) Add a decal to the batch, marking it for later rendering
| |
| clear | back to summary |
|---|---|
| protected void clear() Remove all decals from batch | |
| dispose | back to summary |
|---|---|
| public void dispose() Implements com. Frees up memory by dropping the buffer and underlying resources. If the batch is needed again after disposing it can be
| |
| flush | back to summary |
|---|---|
| public void flush() Flush this batch sending all contained decals to GL. After flushing the batch is empty once again. | |
| flush | back to summary |
|---|---|
| protected void flush(ShaderProgram shader, int verticesPosition) Flushes vertices[0,verticesPosition[ to GL verticesPosition % Decal.SIZE must equal 0
| |
| getSize | back to summary |
|---|---|
public int getSize()
| |
| initialize | back to summary |
|---|---|
| public void initialize(int size) Initializes the batch with the given amount of decal objects the buffer is able to hold when full.
| |
| render | back to summary |
|---|---|
| protected void render() Renders all decals to the buffer and flushes the buffer to the GL when full/done | |
| render | back to summary |
|---|---|
| private void render(ShaderProgram shader, Array<Decal> decals) Renders a group of vertices to the buffer, flushing them to GL when done/full | |
| setGroupStrategy | back to summary |
|---|---|
| public void setGroupStrategy(GroupStrategy groupStrategy) Sets the
| |