TilemapMesh

EntityVisualMeshceramic.TilemapMesh (Class)

Specialized Mesh visual used to render multiple tiles in a tilemap layer.

TilemapMesh extends the basic Mesh to add tilemap-specific properties and implements object pooling for efficient memory management. Each quad represents a single visible tile within a TilemapLayer and is automatically managed by the layer's rendering system.

Features

  • Object Pooling: Reuses instances to minimize garbage collection
  • Tile Mesh Properties: Stores tile index, position, and tile data
  • Automatic Management: Created and recycled automatically by TilemapLayer

Internal Usage

This class is primarily used internally by TilemapLayer. Direct instantiation is not recommended - use the static get() method to obtain pooled instances.

// Internal usage by TilemapLayer
var mesh = TilemapMesh.get();
mesh.layerIndex = layerIndex;
mesh.textureIndex = textureIndex;
// ... configure visual properties

// When done, recycle back to pool:
mesh.recycle();

Static Members

tilemap
get(): TilemapMesh

Gets a TilemapMesh instance from the object pool. If the pool is empty, creates a new instance. The returned quad will be active and ready for use.

Returns Description
TilemapMesh A TilemapQuad instance ready for configuration

Instance Members

tilemap
layerIndex: Int

The sub-layer index in the rendered layer. Set to -1 when the mesh is not in use.


tilemap
textureIndex: Int

The index of texture being used.


tilemap
nextVertexIndice: Int

tilemap
nextIndexIndice: Int

tilemap
nextColorIndice: Int

tilemap
nextQuadIndice: Int

tilemap
recycle(): Void

Returns this TilemapMesh to the object pool for reuse. Automatically removes the quad from its parent, resets all properties, and marks it as inactive. This method should be called when the mesh is no longer needed to free memory and reduce garbage collection.

Private Members

tilemap
pool: Pool<TilemapMesh>

Static object pool for recycling TilemapMesh instances. Initialized on first use to reduce memory allocation.

Metadata

Name Parameters
:hxGen -
:build ceramic.macros.EntityMacro.buildForCompletion()
:autoBuild ceramic.macros.EntityMacro.buildForCompletion()
:build tracker.macros.EventsMacro.build()
:autoBuild tracker.macros.EventsMacro.build()