Package com.jme3.scene.mesh
Class MorphTarget
java.lang.Object
com.jme3.scene.mesh.MorphTarget
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionRequired for jME deserialization.MorphTarget
(String name) Creates a new `MorphTarget` with the specified name. -
Method Summary
Modifier and TypeMethodDescriptiongetBuffer
(VertexBuffer.Type type) Retrieves the `FloatBuffer` associated with a specific `VertexBuffer.Type` for this morph target.Returns the `EnumMap` containing all the `FloatBuffer` instances associated with their `VertexBuffer.Type` for this morph target.getName()
Returns the name of this morph target.int
Returns the number of `FloatBuffer`s (i.e., vertex attribute types) contained within this morph target.void
read
(JmeImporter im) void
setBuffer
(VertexBuffer.Type type, FloatBuffer buffer) Associates a `FloatBuffer` with a specific `VertexBuffer.Type` for this morph target.void
Sets the name of this morph target.void
write
(JmeExporter ex)
-
Constructor Details
-
MorphTarget
public MorphTarget()Required for jME deserialization. -
MorphTarget
Creates a new `MorphTarget` with the specified name.- Parameters:
name
- The name of this morph target (can be null).
-
-
Method Details
-
setName
Sets the name of this morph target.- Parameters:
name
- The new name for this morph target (can be null).
-
getName
Returns the name of this morph target.- Returns:
- The name of this morph target, or null if not set.
-
setBuffer
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
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
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
- Specified by:
write
in interfaceSavable
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Throws:
IOException
-