public class Joint extends java.lang.Object implements Savable, JmeCloneable, HasLocalTransform
Constructor and Description |
---|
Joint()
Instantiate a nameless Joint.
|
Joint(java.lang.String name)
Instantiate a Joint with the specified name.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(Joint child)
Add the specified Joint as a child.
|
void |
applyBindPose()
Sets the local transform with the bind transforms
|
protected void |
applyInitialPose()
Sets the local transform with the initial transform
|
void |
cloneFields(Cloner cloner,
java.lang.Object original)
Callback from
Cloner to convert this
shallow-cloned Joint into a deep-cloned one, using the specified Cloner
and original to resolve copied fields. |
protected Node |
getAttachmentsNode(int jointIndex,
SafeArrayList<Geometry> targets)
Access the attachments node of this joint.
|
java.util.List<Joint> |
getChildren()
Access the list of child joints.
|
int |
getId()
Determine this joint's index in the Armature that contains it.
|
Transform |
getInitialTransform()
Access the initial transform.
|
Matrix4f |
getInverseModelBindMatrix()
Determine the inverse model bind matrix.
|
protected JointModelTransform |
getJointModelTransform()
Access the accumulated model transform.
|
Quaternion |
getLocalRotation()
Access the local rotation.
|
Vector3f |
getLocalScale()
Access the local scale vector.
|
Transform |
getLocalTransform()
Access the local transform.
|
Vector3f |
getLocalTranslation()
Access the local translation vector.
|
Transform |
getModelTransform()
Determine the model transform.
|
java.lang.String |
getName()
Determine the name.
|
protected void |
getOffsetTransform(Matrix4f outTransform)
Stores the skinning transform in the specified Matrix4f.
|
Joint |
getParent()
Access the parent joint.
|
java.lang.Object |
jmeClone()
Create a shallow clone for the JME cloner.
|
void |
read(JmeImporter im)
De-serialize this Joint from the specified importer, for example when
loading from a J3O file.
|
protected void |
saveBindPose()
Sets the current localTransform as the Bind transform.
|
protected void |
saveInitialPose()
Sets the current local transforms as the initial transform.
|
void |
setId(int id)
Alter this joint's index in the Armature that contains it.
|
void |
setInverseModelBindMatrix(Matrix4f inverseModelBindMatrix)
Replace the inverse model bind matrix.
|
protected void |
setJointModelTransform(JointModelTransform jointModelTransform)
Replace the accumulated model transform.
|
void |
setLocalRotation(Quaternion rotation)
Alter the local rotation.
|
void |
setLocalScale(Vector3f scale)
Alter the local scale vector.
|
void |
setLocalTransform(Transform localTransform)
Alter the local transform.
|
void |
setLocalTranslation(Vector3f translation)
Alter the local translation vector.
|
void |
setName(java.lang.String name)
Alter the name.
|
void |
update()
Updates world transforms for this bone and its children.
|
void |
updateModelTransforms()
Updates the model transforms for this bone and for the attachments node
if not null.
|
void |
write(JmeExporter ex)
Serialize this Joint to the specified exporter, for example when saving
to a J3O file.
|
public Joint()
public Joint(java.lang.String name)
name
- the desired namepublic final void update()
public final void updateModelTransforms()
The model transform of this bone is computed by combining the parent's model transform with this bone's local transform.
protected void getOffsetTransform(Matrix4f outTransform)
This assumes that the world transforms for the entire bone hierarchy have already been computed, otherwise this method will return undefined results.
outTransform
- storage for the result (modified)protected void saveBindPose()
protected void saveInitialPose()
public void applyBindPose()
protected void applyInitialPose()
protected JointModelTransform getJointModelTransform()
protected void setJointModelTransform(JointModelTransform jointModelTransform)
jointModelTransform
- the transform to use (alias created)public Vector3f getLocalTranslation()
public Quaternion getLocalRotation()
public Vector3f getLocalScale()
public void setLocalTranslation(Vector3f translation)
translation
- the desired offset vector (not null, unaffected)public void setLocalRotation(Quaternion rotation)
rotation
- the desired rotation (not null, unaffected)public void setLocalScale(Vector3f scale)
scale
- the desired scale factors (not null, unaffected)public void addChild(Joint child)
child
- the Joint to add (not null, modified)public void setName(java.lang.String name)
name
- the desired namepublic void setLocalTransform(Transform localTransform)
setLocalTransform
in interface HasLocalTransform
localTransform
- the desired Transform (not null, unaffected)public void setInverseModelBindMatrix(Matrix4f inverseModelBindMatrix)
inverseModelBindMatrix
- the matrix to use (alias created)public java.lang.String getName()
public Joint getParent()
public java.util.List<Joint> getChildren()
protected Node getAttachmentsNode(int jointIndex, SafeArrayList<Geometry> targets)
jointIndex
- this bone's index in its armature (≥0)targets
- a list of geometries animated by this bone's skeleton (not
null, unaffected)public Transform getInitialTransform()
public Transform getLocalTransform()
getLocalTransform
in interface HasLocalTransform
public Transform getModelTransform()
public Matrix4f getInverseModelBindMatrix()
public int getId()
public void setId(int id)
id
- the desired index (≥0)public java.lang.Object jmeClone()
jmeClone
in interface JmeCloneable
public void cloneFields(Cloner cloner, java.lang.Object original)
Cloner
to convert this
shallow-cloned Joint into a deep-cloned one, using the specified Cloner
and original to resolve copied fields.cloneFields
in interface JmeCloneable
cloner
- the Cloner that's cloning this Joint (not null)original
- the instance from which this Joint was shallow-cloned
(not null, unaffected)public void read(JmeImporter im) throws java.io.IOException
public void write(JmeExporter ex) throws java.io.IOException