MorphTargetBuffer

class MorphTargetBuffer(nativeHandle: NativePointer)

A container for vertex morphing data that supports both automatic and manual morphing.

MorphTargetBuffer operates in a hybrid model depending on the attribute being morphed:

1. Automatic for Built-ins (positions/tangents): Enable via withPositions(true) or withTangents(true). The MorphTargetBuffer will allocate internal storage and hold the data for these attributes, which you upload via setPositionsAt() or setTangentsAt(). The framework automatically applies the morphing logic in the vertex shader.

2. Manual for Custom Data (e.g., UVs, colors): The MorphTargetBuffer does NOT hold data for custom targets. The user is responsible for the full data pipeline:

  • Create and manage a separate Texture to hold the morph target data (offsets).

  • In the material, declare a sampler2d_array parameter.

  • Bind the Texture to the material instance.

  • In the vertex shader, manually call morphData2, morphData3, or morphData4 with the custom sampler to apply the morphing.

A MorphTargetBuffer object must be associated with a Renderable via RenderableManager.Builder.morphing() to enable the morphing pipeline.

See also

Constructors

Link copied to clipboard
constructor(nativeHandle: NativePointer)

Types

Link copied to clipboard
class Builder

Builder for creating MorphTargetBuffer instances.

Properties

Link copied to clipboard
val count: Int

Gets the number of morph targets (blend shapes) allocated.

Link copied to clipboard

Indicates whether this buffer supports automatic position morphing.

Link copied to clipboard

Indicates whether this buffer supports automatic tangent morphing.

Link copied to clipboard

Indicates whether custom morphing is enabled for user-defined attributes.

Link copied to clipboard

The native object, for interop with code calling the Fila* C API directly. Read-only: this wrapper owns it.

Link copied to clipboard

Gets the number of vertices this MorphTargetBuffer can hold.

Functions

Link copied to clipboard
fun setPositionsAt(engine: Engine, targetIndex: Int, positions: FloatArray, count: Int, offset: Int = 0)

Updates positions for the given morph target. Requires a buffer built with withPositions(true); the 4th component is 1.0.

Link copied to clipboard
fun setTangentsAt(engine: Engine, targetIndex: Int, tangents: ShortArray, count: Int, offset: Int = 0)

Updates tangents for the given morph target. Requires a buffer built with withTangents(true).