Class TexturePool

java.lang.Object
dev.prozilla.pine.common.asset.pool.AssetPool<TextureBase>
dev.prozilla.pine.common.asset.pool.TexturePool
All Implemented Interfaces:
Destructible

public final class TexturePool extends AssetPool<TextureBase>
  • Constructor Details

    • TexturePool

      public TexturePool(ImagePool imagePool)
  • Method Details

    • load

      public TextureBase load(String path)
      Description copied from class: AssetPool
      Loads an asset from a path or retrieves it from the pool if it has already been loaded once.

      This method is protected because some subclasses may require additional parameters to load an asset.

      Overrides:
      load in class AssetPool<TextureBase>
      Parameters:
      path - The path of the asset
      Returns:
      The asset, or null if it failed to load.
    • loadInTextureArray

      public TextureBase loadInTextureArray(String path)
    • createAsset

      protected TextureBase createAsset(String path)
      Description copied from class: AssetPool
      Creates a new asset from a normalized path.
      Specified by:
      createAsset in class AssetPool<TextureBase>
      Parameters:
      path - The normalized path
      Returns:
      The new asset, or null if the asset creation failed.
    • prepareNext

      protected void prepareNext()
      Description copied from class: AssetPool
      Prepares this pool for the next asset.
      Overrides:
      prepareNext in class AssetPool<TextureBase>
    • remove

      protected boolean remove(String path)
      Description copied from class: AssetPool
      Removes an asset from this pool.
      Overrides:
      remove in class AssetPool<TextureBase>
      Parameters:
      path - The path of the asset to remove
      Returns:
      false if path does not match any asset in this pool.
    • removeTextureArray

      public boolean removeTextureArray(TextureArray textureArray)
      Removes a texture array and all its textures from the resource pool.
      Parameters:
      textureArray - Texture array to remove
    • createTextureArray

      public TextureArray createTextureArray(int width, int height)
      Creates a texture array that can be used to load multiple textures with the same resolution into.
      Parameters:
      width - The width of the textures
      height - The height of the textures
    • createTextureArray

      public TextureArray createTextureArray(int width, int height, int layers)
      Creates a texture array that can be used to load multiple textures with the same resolution into.
      Parameters:
      width - The width of the textures
      height - The height of the textures
      layers - The amount of textures to fit into the texture array
    • clearTextureArrays

      public void clearTextureArrays()
      Clears the pool of texture arrays.
    • textureArrayCount

      public int textureArrayCount()
      Returns the amount of texture arrays in this pool.
      Returns:
      The amount of texture arrays in this pool.
    • printInfo

      public void printInfo(Logger logger)
      Overrides:
      printInfo in class AssetPool<TextureBase>
    • printTextureArraysInfo

      public void printTextureArraysInfo(Logger logger)
      Logs the dimensions and layer usage of every texture array in the resource pool.