Renderable#worldTransform might not be suitable for sorting anymore (such
as the default sorter of ModelBatch does).
| Modifier and Type | Class and Description |
|---|---|
| public static interface | ModelCache.
Allows to reuse one or more meshes while avoiding creating new objects. |
| public static class | ModelCache.
A basic |
| public static class | ModelCache.
A |
| public static class | ModelCache.
A tight |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private Camera | |
| private Array | |
| private MeshBuilder | |
| private FlushablePool | |
| private ModelCache. | |
| private Array | |
| private FlushablePool | |
| private RenderableSorter | |
| private Array |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ModelCache(RenderableSorter sorter, ModelCache.
Create a ModelCache using the specified |
| Modifier and Type | Method and Description |
|---|---|
| public void | add(Renderable
The renderable)Renderable to add, should not change while the cache is needed.Adds the specified |
| public void | add(final RenderableProvider renderableProvider)
Adds the specified |
| public <T extends RenderableProvider> void | add(final Iterable<T> renderableProviders)
Adds the specified |
| public void | |
| public void | begin(Camera
The camera)Camera that will passed to the RenderableSorterBegin creating the cache, must be followed by a call to |
| public void | dispose()
Implements com. Releases all resources of this object. |
| public void | |
| public void | getRenderables(Array<Renderable> renderables, Pool<Renderable> pool)
Implements com. Returns |
| private Renderable |
| building | back to summary |
|---|---|
| private boolean building | |
| camera | back to summary |
|---|---|
| private Camera camera | |
| items | back to summary |
|---|---|
| private Array<Renderable> items | |
| meshBuilder | back to summary |
|---|---|
| private MeshBuilder meshBuilder | |
| meshPartPool | back to summary |
|---|---|
| private FlushablePool<MeshPart> meshPartPool | |
| meshPool | back to summary |
|---|---|
| private ModelCache. | |
| renderables | back to summary |
|---|---|
| private Array<Renderable> renderables | |
| renderablesPool | back to summary |
|---|---|
| private FlushablePool<Renderable> renderablesPool | |
| sorter | back to summary |
|---|---|
| private RenderableSorter sorter | |
| tmp | back to summary |
|---|---|
| private Array<Renderable> tmp | |
| ModelCache | back to summary |
|---|---|
| public ModelCache() Create a ModelCache using the default | |
| ModelCache | back to summary |
|---|---|
| public ModelCache(RenderableSorter sorter, ModelCache. Create a ModelCache using the specified | |
| add | back to summary |
|---|---|
| public void add(Renderable renderable) Adds the specified
| |
| add | back to summary |
|---|---|
| public void add(final RenderableProvider renderableProvider) Adds the specified | |
| add | back to summary |
|---|---|
| public <T extends RenderableProvider> void add(final Iterable<T> renderableProviders) Adds the specified | |
| begin | back to summary |
|---|---|
| public void begin() Begin creating the cache, must be followed by a call to | |
| begin | back to summary |
|---|---|
| public void begin(Camera camera) Begin creating the cache, must be followed by a call to
| |
| dispose | back to summary |
|---|---|
| public void dispose() Implements com. Doc from com. Releases all resources of this object.
| |
| end | back to summary |
|---|---|
| public void end() Finishes creating the cache, must be called after a call to | |
| getRenderables | back to summary |
|---|---|
| public void getRenderables(Array<Renderable> renderables, Pool<Renderable> pool) Implements com. Doc from com. Returns
| |
| obtainRenderable | back to summary |
|---|---|
| private Renderable obtainRenderable(Material material, int primitiveType) | |
obtain(VertexAttributes, int, int) method to obtain a mesh which can at minimum the
specified amount of vertices and indices. Call the flush() method to flush the pool ant release all previously
obtained meshes.
| Modifier and Type | Method and Description |
|---|---|
| public void | flush()
Releases all previously obtained |
| public Mesh | Returns: the obtained Mesh, or null when no mesh could be obtained.the vertex attributes of the mesh to obtain vertexAttributes, int the minimum amount vertices the mesh should be able to store vertexCount, int the minimum amount of indices the mesh should be able to store indexCount)Will try to reuse or, when not possible to reuse, optionally create a |
| flush | back to summary |
|---|---|
| public void flush() Releases all previously obtained | |
| obtain | back to summary |
|---|---|
| public Mesh obtain(VertexAttributes vertexAttributes, int vertexCount, int indexCount) Will try to reuse or, when not possible to reuse, optionally create a
| |
MeshPool implementation that avoids creating new meshes at the cost of memory usage. It does this by making
the mesh always the maximum (64k) size. Use this when for dynamic caching where you need to obtain meshes very frequently
(typically every frame).
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | dispose()
Implements com. Releases all resources of this object. |
| public void | flush()
Implements com. Releases all previously obtained |
| public Mesh | obtain(VertexAttributes vertexAttributes, int vertexCount, int indexCount)
Implements com. Will try to reuse or, when not possible to reuse, optionally create a |
| freeMeshes | back to summary |
|---|---|
| private Array<Mesh> freeMeshes | |
| usedMeshes | back to summary |
|---|---|
| private Array<Mesh> usedMeshes | |
| SimpleMeshPool | back to summary |
|---|---|
| public SimpleMeshPool() | |
| dispose | back to summary |
|---|---|
| public void dispose() Implements com. Doc from com. Releases all resources of this object.
| |
| flush | back to summary |
|---|---|
| public void flush() Implements com. Doc from com. Releases all previously obtained
| |
| obtain | back to summary |
|---|---|
| public Mesh obtain(VertexAttributes vertexAttributes, int vertexCount, int indexCount) Implements com. Doc from com. Will try to reuse or, when not possible to reuse, optionally create a
| |
RenderableSorter that sorts by vertex attributes, material attributes and primitive types (in that order), so
that meshes can be easily merged.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | compare(Renderable arg0, Renderable arg1)
Implements java. Compares its two arguments for order. |
| public void | sort(Camera camera, Array<Renderable> renderables)
Implements com. Sorts the array of |
| Sorter | back to summary |
|---|---|
| public Sorter() | |
| compare | back to summary |
|---|---|
| public int compare(Renderable arg0, Renderable arg1) Implements java. Doc from java. Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
The implementor must ensure that
The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that
| |
| sort | back to summary |
|---|---|
| public void sort(Camera camera, Array<Renderable> renderables) Implements com. Doc from com. Sorts the array of
| |
MeshPool implementation, which is typically used for static meshes (create once, use many).
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | dispose()
Implements com. Releases all resources of this object. |
| public void | flush()
Implements com. Releases all previously obtained |
| public Mesh | obtain(VertexAttributes vertexAttributes, int vertexCount, int indexCount)
Implements com. Will try to reuse or, when not possible to reuse, optionally create a |
| freeMeshes | back to summary |
|---|---|
| private Array<Mesh> freeMeshes | |
| usedMeshes | back to summary |
|---|---|
| private Array<Mesh> usedMeshes | |
| TightMeshPool | back to summary |
|---|---|
| public TightMeshPool() | |
| dispose | back to summary |
|---|---|
| public void dispose() Implements com. Doc from com. Releases all resources of this object.
| |
| flush | back to summary |
|---|---|
| public void flush() Implements com. Doc from com. Releases all previously obtained
| |
| obtain | back to summary |
|---|---|
| public Mesh obtain(VertexAttributes vertexAttributes, int vertexCount, int indexCount) Implements com. Doc from com. Will try to reuse or, when not possible to reuse, optionally create a
| |