Class TexturePool

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

public final class TexturePool extends AssetPool<TextureAsset> implements MultiAssetLoader<TextureAsset>
  • Constructor Details

    • TexturePool

      public TexturePool(ImagePool imagePool)
  • Method Details

    • load

      public TextureAsset load(String path, Texture.Wrap wrap)
    • load

      public TextureAsset load(String path, Texture.Filter filter)
    • load

      public TextureAsset load(String path, Texture.Wrap wrap, Texture.Filter filter)
    • load

      public TextureAsset 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.

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

      public TextureAsset loadInTextureArray(String path)
    • createAsset

      protected TextureAsset createAsset(String path)
      Description copied from class: AssetPool
      Creates a new asset from a normalized path.
      Specified by:
      createAsset in class AssetPool<TextureAsset>
      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<TextureAsset>
    • remove

      protected boolean remove(String path)
      Description copied from class: AssetPool
      Removes an asset from this pool.
      Overrides:
      remove in class AssetPool<TextureAsset>
      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.
    • setDefaultTextureArrayPolicy

      public void setDefaultTextureArrayPolicy(TextureArrayPolicy defaultTextureArrayPolicy)
    • setDefaultTextureWrap

      public void setDefaultTextureWrap(Texture.Wrap defaultTextureWrap)
    • setDefaultTextureFilter

      public void setDefaultTextureFilter(Texture.Filter defaultTextureFilter)
    • 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<TextureAsset>
    • printTextureArraysInfo

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