Class MorphTarget

java.lang.Object
com.jme3.scene.mesh.MorphTarget
All Implemented Interfaces:
Savable

public class MorphTarget extends Object implements Savable
`MorphTarget` represents a single morph target within a `Mesh`. A morph target contains a set of `FloatBuffer` instances, each corresponding to a `VertexBuffer.Type` (e.g., `POSITION`, `NORMAL`, `TANGENT`). These buffers store the delta (difference) values that, when added to the base mesh's corresponding vertex buffers, create a deformed version of the mesh.

Morph targets are primarily used for skeletal animation blending, facial animation, or other mesh deformation effects. Each `MorphTarget` can optionally have a name for identification and control.

  • Constructor Details

    • MorphTarget

      public MorphTarget()
      Required for jME deserialization.
    • MorphTarget

      public MorphTarget(String name)
      Creates a new `MorphTarget` with the specified name.
      Parameters:
      name - The name of this morph target (can be null).
  • Method Details

    • setName

      public void setName(String name)
      Sets the name of this morph target.
      Parameters:
      name - The new name for this morph target (can be null).
    • getName

      public String getName()
      Returns the name of this morph target.
      Returns:
      The name of this morph target, or null if not set.
    • setBuffer

      public void setBuffer(VertexBuffer.Type type, FloatBuffer buffer)
      Associates a `FloatBuffer` with a specific `VertexBuffer.Type` for this morph target. This buffer typically contains the delta values for the specified vertex attribute.
      Parameters:
      type - The type of vertex buffer (e.g., `POSITION`, `NORMAL`).
      buffer - The `FloatBuffer` containing the delta data for the given type.
    • getBuffer

      public FloatBuffer getBuffer(VertexBuffer.Type type)
      Retrieves the `FloatBuffer` associated with a specific `VertexBuffer.Type` for this morph target.
      Parameters:
      type - The type of vertex buffer.
      Returns:
      The `FloatBuffer` for the given type, or null if not set.
    • getBuffers

      public EnumMap<VertexBuffer.Type,FloatBuffer> getBuffers()
      Returns the `EnumMap` containing all the `FloatBuffer` instances associated with their `VertexBuffer.Type` for this morph target.
      Returns:
      An `EnumMap` of vertex buffer types to their corresponding `FloatBuffer`s.
    • getNumBuffers

      public int getNumBuffers()
      Returns the number of `FloatBuffer`s (i.e., vertex attribute types) contained within this morph target.
      Returns:
      The count of buffers in this morph target.
    • write

      public void write(JmeExporter ex) throws IOException
      Specified by:
      write in interface Savable
      Throws:
      IOException
    • read

      public void read(JmeImporter im) throws IOException
      Specified by:
      read in interface Savable
      Throws:
      IOException