SpineTextureLoader

ceramic.SpineTextureLoader (Class)

Custom texture loader implementation for integrating Spine with Ceramic's asset system.

This class implements Spine's TextureLoader interface to handle texture loading for Spine animations. It acts as a bridge between Spine's texture atlas system and Ceramic's asset management, ensuring textures are loaded through Ceramic's pipeline with proper caching, hot-reloading, and resource management.

The loader is used internally by SpineAsset when parsing texture atlases. It delegates the actual loading work to the SpineAsset instance, which handles the integration with Ceramic's texture loading system.

Key responsibilities:

  • Loading texture pages (images) referenced in Spine atlases
  • Managing texture lifecycle (load/unload)
  • Handling path resolution with optional base paths
See: SpineAsset for the actual texture loading implementation

Instance Members

spine
loadPage(page: spine.support.graphics.AtlasPage, path: String): Void

Loads a texture page (image) for the atlas.

This method is called by the Spine runtime when parsing an atlas file. It delegates to the SpineAsset to load the texture through Ceramic's asset system, ensuring proper caching and resource management.

Name Type Description
page spine.support.graphics.AtlasPage The AtlasPage to load the texture for. The loader should set the page's rendererObject to the loaded texture.
path String The path to the texture file as specified in the atlas

spine
loadRegion(region: spine.support.graphics.AtlasRegion): Void

Called after a region is loaded from the atlas.

This method is part of the TextureLoader interface but is not used in Ceramic's implementation. Region setup is handled automatically by the Spine runtime after the page texture is loaded.

Name Type Description
region spine.support.graphics.AtlasRegion The atlas region that was just loaded

spine
unloadPage(page: spine.support.graphics.AtlasPage): Void

Unloads a texture page to free resources.

This method is called when an atlas is being disposed. It delegates to the SpineAsset to properly clean up the texture and remove it from Ceramic's texture cache.

Name Type Description
page spine.support.graphics.AtlasPage The AtlasPage whose texture should be unloaded

spine
new(asset: SpineAsset, ?basePath: String): Void

Creates a new SpineTextureLoader instance.

Name Type Default Description
asset SpineAsset The SpineAsset that will handle texture loading operations
basePath String (optional) Optional base path to prepend to texture paths in the atlas

Private Members

spine
asset: SpineAsset

The SpineAsset instance that handles the actual texture loading. This asset manages the integration with Ceramic's asset system.


spine
basePath: Null<String>

Optional base path prepended to texture paths in the atlas.

This allows atlases to use relative paths while the actual texture files are located in a specific directory. For example, if basePath is "characters/hero/", a texture path "body.png" in the atlas would resolve to "characters/hero/body.png".

Metadata

Name Parameters
:access ceramic.SpineAsset