Class ModelCache.SimpleMeshPool

  • All Implemented Interfaces:
    ModelCache.MeshPool, Disposable
    Enclosing class:
    ModelCache

    public static class ModelCache.SimpleMeshPool
    extends java.lang.Object
    implements ModelCache.MeshPool
    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 Detail

      • SimpleMeshPool

        public SimpleMeshPool()
    • Method Detail

      • obtain

        public Mesh obtain​(VertexAttributes vertexAttributes,
                           int vertexCount,
                           int indexCount)
        Description copied from interface: ModelCache.MeshPool
        Will try to reuse or, when not possible to reuse, optionally create a Mesh that meets the specified criteria.
        Specified by:
        obtain in interface ModelCache.MeshPool
        Parameters:
        vertexAttributes - the vertex attributes of the mesh to obtain
        vertexCount - the minimum amount vertices the mesh should be able to store
        indexCount - 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 interface Disposable