Class TexturePool
java.lang.Object
dev.prozilla.pine.common.asset.pool.AssetPool<TextureBase>
dev.prozilla.pine.common.asset.pool.TexturePool
- All Implemented Interfaces:
Destructible
-
Field Summary
Fields inherited from class dev.prozilla.pine.common.asset.pool.AssetPool
eventDispatcher
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the pool of texture arrays.protected TextureBase
createAsset
(String path) Creates a new asset from a normalized path.createTextureArray
(int width, int height) Creates a texture array that can be used to load multiple textures with the same resolution into.createTextureArray
(int width, int height, int layers) Creates a texture array that can be used to load multiple textures with the same resolution into.Loads an asset from a path or retrieves it from the pool if it has already been loaded once.loadInTextureArray
(String path) protected void
Prepares this pool for the next asset.void
void
printTextureArraysInfo
(Logger logger) Logs the dimensions and layer usage of every texture array in the resource pool.protected boolean
Removes an asset from this pool.boolean
removeTextureArray
(TextureArray textureArray) Removes a texture array and all its textures from the resource pool.int
Returns the amount of texture arrays in this pool.
-
Constructor Details
-
TexturePool
-
-
Method Details
-
load
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 classAssetPool<TextureBase>
- Parameters:
path
- The path of the asset- Returns:
- The asset, or
null
if it failed to load.
-
loadInTextureArray
-
createAsset
Description copied from class:AssetPool
Creates a new asset from a normalized path.- Specified by:
createAsset
in classAssetPool<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 classAssetPool<TextureBase>
-
remove
Description copied from class:AssetPool
Removes an asset from this pool.- Overrides:
remove
in classAssetPool<TextureBase>
- Parameters:
path
- The path of the asset to remove- Returns:
false
ifpath
does not match any asset in this pool.
-
removeTextureArray
Removes a texture array and all its textures from the resource pool.- Parameters:
textureArray
- Texture array to remove
-
createTextureArray
Creates a texture array that can be used to load multiple textures with the same resolution into.- Parameters:
width
- The width of the texturesheight
- The height of the textures
-
createTextureArray
Creates a texture array that can be used to load multiple textures with the same resolution into.- Parameters:
width
- The width of the texturesheight
- The height of the textureslayers
- 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
- Overrides:
printInfo
in classAssetPool<TextureBase>
-
printTextureArraysInfo
Logs the dimensions and layer usage of every texture array in the resource pool.
-