public class Armature extends java.lang.Object implements JmeCloneable, Savable
Modifier | Constructor and Description |
---|---|
protected |
Armature()
Serialization only
|
|
Armature(Joint[] jointList)
Creates an armature from a joint list.
|
Modifier and Type | Method and Description |
---|---|
void |
applyBindPose()
This method sets this armature to its bind pose (aligned with the mesh to deform).
|
void |
applyInitialPose()
Applies the initial pose to this armature
|
void |
cloneFields(Cloner cloner,
java.lang.Object original)
Implemented to perform deep cloning for this object, resolving
local cloned references using the specified cloner.
|
Matrix4f[] |
computeSkinningMatrices()
Compute the skinning matrices for each bone of the armature that would be used to transform vertices of associated meshes
|
Joint |
getJoint(int index)
return a joint for the given index
|
Joint |
getJoint(java.lang.String name)
returns the joint with the given name
|
int |
getJointCount()
returns the number of joints of this armature
|
int |
getJointIndex(Joint joint)
returns the bone index of the given bone
|
int |
getJointIndex(java.lang.String name)
returns the joint index of the joint that has the given name
|
java.util.List<Joint> |
getJointList()
Access all joints in this Armature.
|
Joint[] |
getRoots()
returns the array of all root joints of this Armature
|
java.lang.Object |
jmeClone()
Performs a regular shallow clone of the object.
|
void |
read(JmeImporter im)
De-serialize this Armature from the specified importer, for example when
loading from a J3O file.
|
void |
saveBindPose()
Saves the current Armature state as its bind pose.
|
void |
saveInitialPose()
Saves the current local transform as the initial transform.
|
void |
setModelTransformClass(java.lang.Class<? extends JointModelTransform> modelTransformClass)
Sets the JointModelTransform implementation
Default is
MatrixJointModelTransform |
void |
update()
Update all joints in this Armature.
|
void |
write(JmeExporter ex)
Serialize this Armature to the specified exporter, for example when
saving to a J3O file.
|
protected Armature()
public Armature(Joint[] jointList)
Note that using this constructor will cause the joints in the list to have their bind pose recomputed based on their local transforms.
jointList
- The list of joints to manage by this Armaturepublic void update()
public void setModelTransformClass(java.lang.Class<? extends JointModelTransform> modelTransformClass)
MatrixJointModelTransform
modelTransformClass
- which implementation to useJointModelTransform
,
MatrixJointModelTransform
,
SeparateJointModelTransform
public Joint[] getRoots()
public java.util.List<Joint> getJointList()
public Joint getJoint(int index)
index
- a zero-based joint index (≥0)public Joint getJoint(java.lang.String name)
name
- the name to search forpublic int getJointIndex(Joint joint)
joint
- the Joint to search forpublic int getJointIndex(java.lang.String name)
name
- the name to search forpublic void saveBindPose()
public void applyBindPose()
public void saveInitialPose()
public void applyInitialPose()
public Matrix4f[] computeSkinningMatrices()
public int getJointCount()
public java.lang.Object jmeClone()
JmeCloneable
This method is separate from the regular clone() method so that objects might still maintain their own regular java clone() semantics (perhaps even using Cloner for those methods). However, because Java's clone() has specific features in the sense of Object's clone() implementation, it's usually best to have some path for subclasses to bypass the public clone() method that might be cloning fields and instead get at the superclass protected clone() methods. For example, through super.jmeClone() or another protected clone method that some base class eventually calls super.clone() in.
jmeClone
in interface JmeCloneable
public void cloneFields(Cloner cloner, java.lang.Object original)
JmeCloneable
Note: during normal clone operations the original object will not be needed as the clone has already had all of the fields shallow copied.
cloneFields
in interface JmeCloneable
cloner
- The cloner that is performing the cloning operation. The
cloneFields method can call back into the cloner to make
clones of its subordinate fields.original
- The original object from which this object was cloned.
This is provided for the very rare case that this object needs
to refer to its original for some reason. In general, all of
the relevant values should have been transferred during the
shallow clone and this object need merely clone what it wants.public void read(JmeImporter im) throws java.io.IOException
public void write(JmeExporter ex) throws java.io.IOException