Package com.badlogic.gdx.graphics.g3d
Class ModelCache.SimpleMeshPool
java.lang.Object
com.badlogic.gdx.graphics.g3d.ModelCache.SimpleMeshPool
- All Implemented Interfaces:
ModelCache.MeshPool
,Disposable
- Enclosing class:
- ModelCache
A basic
ModelCache.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).-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Releases all resources of this object.void
flush()
Releases all previously obtainedMesh
es using the theModelCache.MeshPool.obtain(VertexAttributes, int, int)
method.obtain
(VertexAttributes vertexAttributes, int vertexCount, int indexCount) Will try to reuse or, when not possible to reuse, optionally create aMesh
that meets the specified criteria.
-
Constructor Details
-
SimpleMeshPool
public SimpleMeshPool()
-
-
Method Details
-
flush
public void flush()Description copied from interface:ModelCache.MeshPool
Releases all previously obtainedMesh
es using the theModelCache.MeshPool.obtain(VertexAttributes, int, int)
method.- Specified by:
flush
in interfaceModelCache.MeshPool
-
obtain
Description copied from interface:ModelCache.MeshPool
Will try to reuse or, when not possible to reuse, optionally create aMesh
that meets the specified criteria.- Specified by:
obtain
in interfaceModelCache.MeshPool
- Parameters:
vertexAttributes
- the vertex attributes of the mesh to obtainvertexCount
- the minimum amount vertices the mesh should be able to storeindexCount
- the minimum amount of indices the mesh should be able to store- Returns:
- the obtained Mesh, or null when no mesh could be obtained.
-
dispose
public void dispose()Description copied from interface:Disposable
Releases all resources of this object.- Specified by:
dispose
in interfaceDisposable
-