ConvertTexture

ceramic.ConvertTexture (Class)
Implements: ConvertField

Converter for Texture fields in fragments and data serialization.

This converter handles Texture instances by storing and loading them using asset names. During deserialization, textures are loaded from the asset system asynchronously. This allows fragments to reference textures by name without embedding the actual image data.

Instance Members

basicToField(instance: Entity, field: String, assets: Assets, basic: String, done: Function): Void

Convert an image asset name to a Texture instance.

The image is loaded asynchronously from the asset system. If loading fails or the asset name is null, returns null.

Name Type Description
instance Entity The entity that will use this texture
field String The name of the field being converted
assets Assets Assets instance used to load the image
basic String The image asset name to load
done Function Callback invoked with the loaded Texture instance

fieldToBasic(instance: Entity, field: String, value: Texture): String

Convert a Texture instance to its asset name for serialization.

Name Type Description
instance Entity The entity that owns this texture
field String The name of the field being converted
value Texture The Texture instance to convert
Returns Description
String The texture's asset name, or null if the texture or its asset is null

new(): Void

Create a new texture converter instance.