Package jme3utilities.wes
Class Pose
java.lang.Object
jme3utilities.wes.Pose
- All Implemented Interfaces:
com.jme3.util.clone.JmeCloneable,Cloneable
Encapsulate a pose for a specific Armature or Skeleton.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyTo(com.jme3.anim.Armature targetArmature) Apply this Pose to the specified Armature.voidapplyTo(com.jme3.animation.Skeleton targetSkeleton) Apply this Pose to the specified Skeleton.com.jme3.math.TransformbindTransform(int boneIndex, com.jme3.math.Transform storeResult) Copy the local bind transform of the indexed joint/bone.com.jme3.animation.AnimationConvert this Pose to an Animation.com.jme3.anim.AnimClipcaptureToClip(String clipName) Convert this Pose to a new AnimClip.voidcloneFields(com.jme3.util.clone.Cloner cloner, Object original) Convert this shallow-cloned instance into a deep-cloned one, using the specified cloner and original to resolve copied fields.intCount the joints/bones in this Pose.intFind the index of the named joint/bone in this Pose.Access the Armature or Skeleton, if known.jmeClone()Create a shallow clone for the JME cloner.com.jme3.math.QuaternionlocalRotation(int boneIndex, com.jme3.math.Quaternion storeResult) Calculate the local rotation of the indexed joint/bone.com.jme3.math.TransformlocalTransform(int boneIndex, com.jme3.math.Transform storeResult) Calculate the local transform of the indexed joint/bone.com.jme3.math.Vector3fmodelLocation(int boneIndex, com.jme3.math.Vector3f storeResult) Calculate the location of the indexed bone in the coordinate system of an animated spatial.com.jme3.math.QuaternionmodelOrientation(int boneIndex, com.jme3.math.Quaternion storeResult) Calculate the orientation of the indexed joint/bone in the coordinate system of an animated spatial.com.jme3.math.TransformmodelTransform(int boneIndex, com.jme3.math.Transform storeResult) Calculate the model transform of the indexed joint/bone.static PosenewInstance(com.jme3.scene.control.AbstractControl sControl) Instantiate bind pose for the specified SkeletonControl or SkinningControl.int[]Enumerate all bones/joints in a pre-order depth-first traversal of the skeleton/armature, such that child bones/joints are never visited before their ancestors.voidresetRotation(int boneIndex) Reset the user/animation rotation of the indexed joint/bone to identity.voidresetScale(int boneIndex) Reset the user/animation scale of the indexed joint/bone to identity.voidresetTranslation(int boneIndex) Reset the user/animation translation of the indexed joint/bone to zero.int[]Enumerate all root bones/joints in the skeleton/armature.voidset(int boneIndex, com.jme3.math.Transform transform) Alter the user/animation transform of the indexed joint/bone.voidsetRotation(int boneIndex, com.jme3.math.Quaternion rotation) Alter the user/animation rotation of the indexed joint/bone.voidsetScale(int boneIndex, com.jme3.math.Vector3f scale) Alter the user/animation scale of the indexed joint/bone.voidsetToAnimation(com.jme3.animation.Animation animation, float time, TweenTransforms techniques) Configure this Pose for the specified Animation at the specified time.voidConfigure this Pose to represent bind pose.voidsetToClip(com.jme3.anim.AnimClip clip, double time) Configure this Pose for the specified AnimClip at the specified time.voidsetToRetarget(Pose sourcePose, SkeletonMapping map) Configure this Pose by re-targeting the specified source pose.voidsetTranslation(int boneIndex, com.jme3.math.Vector3f translation) Alter the user/animation translation of the indexed joint/bone.com.jme3.math.Matrix4f[]skin(com.jme3.math.Matrix4f[] storeResult) Calculate skinning matrices for this Pose.com.jme3.math.TransformuserForLocal(int boneIndex, com.jme3.math.Transform localTransform, com.jme3.math.Transform storeResult) Determine the user/animation Transform for the indexed joint/bone to give it the specified local Transform.com.jme3.math.QuaternionuserForModel(int boneIndex, com.jme3.math.Quaternion modelOrientation, com.jme3.math.Quaternion storeResult) Calculate the user/animation rotation for the indexed joint/bone to give it the specified orientation in the coordinate system of an animated spatial.com.jme3.math.QuaternionuserRotation(int boneIndex, com.jme3.math.Quaternion storeResult) Copy the user/animation rotation of the indexed joint/bone.com.jme3.math.Vector3fuserScale(int boneIndex, com.jme3.math.Vector3f storeResult) Copy the user/animation scale of the indexed joint/bone.com.jme3.math.TransformuserTransform(int boneIndex, com.jme3.math.Transform storeResult) Copy the user/animation transform of the indexed joint/bone.com.jme3.math.Vector3fuserTranslation(int boneIndex, com.jme3.math.Vector3f storeResult) Copy the user/animation translation of the indexed joint/bone.
-
Constructor Details
-
Pose
public Pose(com.jme3.anim.Armature armature) Instantiate bind pose for the specified Armature.- Parameters:
armature- (may be null, otherwise an alias is created)
-
Pose
public Pose(com.jme3.animation.Skeleton skeleton) Instantiate bind pose for the specified Skeleton.- Parameters:
skeleton- (may be null, otherwise an alias is created)
-
-
Method Details
-
applyTo
public void applyTo(com.jme3.anim.Armature targetArmature) Apply this Pose to the specified Armature.- Parameters:
targetArmature- the Armature to modify (not null)
-
applyTo
public void applyTo(com.jme3.animation.Skeleton targetSkeleton) Apply this Pose to the specified Skeleton.- Parameters:
targetSkeleton- the Skeleton to modify (not null)
-
bindTransform
public com.jme3.math.Transform bindTransform(int boneIndex, com.jme3.math.Transform storeResult) Copy the local bind transform of the indexed joint/bone.- Parameters:
boneIndex- which joint/bone (≥0)storeResult- storage for the result (modified if not null)- Returns:
- transform (either storeResult or a new instance)
-
capture
Convert this Pose to an Animation. The resulting Animation will have zero duration, a single keyframe at t=0, and all its tracks will be BoneTracks.- Parameters:
animationName- name for the new Animation (not null)- Returns:
- a new instance
-
captureToClip
Convert this Pose to a new AnimClip. The result will have zero duration, a single keyframe at t=0, and all its tracks will be TransformTracks.- Parameters:
clipName- name for the new clip (not null)- Returns:
- a new instance
-
countBones
public int countBones()Count the joints/bones in this Pose.- Returns:
- count (≥0)
-
findBone
Find the index of the named joint/bone in this Pose.- Parameters:
boneName- which joint/bone (not null)- Returns:
- the joint/bone index (≥0) or -1 if not found
-
findSkeleton
Access the Armature or Skeleton, if known.- Returns:
- the pre-existing instance, or null
-
localRotation
public com.jme3.math.Quaternion localRotation(int boneIndex, com.jme3.math.Quaternion storeResult) Calculate the local rotation of the indexed joint/bone.- Parameters:
boneIndex- which joint/bone (≥0)storeResult- storage for the result (modified if not null)- Returns:
- the rotation in local coordinates (either storeResult or a new instance)
-
localTransform
public com.jme3.math.Transform localTransform(int boneIndex, com.jme3.math.Transform storeResult) Calculate the local transform of the indexed joint/bone.- Parameters:
boneIndex- which joint/bone (≥0)storeResult- storage for the result (modified if not null)- Returns:
- the Transform in local coordinates (either storeResult or a new instance)
-
modelLocation
public com.jme3.math.Vector3f modelLocation(int boneIndex, com.jme3.math.Vector3f storeResult) Calculate the location of the indexed bone in the coordinate system of an animated spatial.- Parameters:
boneIndex- which bone (≥0)storeResult- storage for the result (modified if not null)- Returns:
- location in model space (either storeResult or a new instance)
-
modelOrientation
public com.jme3.math.Quaternion modelOrientation(int boneIndex, com.jme3.math.Quaternion storeResult) Calculate the orientation of the indexed joint/bone in the coordinate system of an animated spatial.- Parameters:
boneIndex- which joint/bone (≥0)storeResult- storage for the result (modified if not null)- Returns:
- orientation in model space (either storeResult or a new instance)
-
modelTransform
public com.jme3.math.Transform modelTransform(int boneIndex, com.jme3.math.Transform storeResult) Calculate the model transform of the indexed joint/bone. When applied as a left factor, the model transform converts from the joint/bone local coordinate system to the coordinate system of an animated spatial.- Parameters:
boneIndex- which joint/bone (≥0)storeResult- storage for the result (modified if not null)- Returns:
- transform (either storeResult or a new instance)
-
newInstance
Instantiate bind pose for the specified SkeletonControl or SkinningControl.- Parameters:
sControl- the Control to use (not null, must be a SkeletonControl or a SkinningControl)- Returns:
- a new instance
-
preOrderIndices
public int[] preOrderIndices()Enumerate all bones/joints in a pre-order depth-first traversal of the skeleton/armature, such that child bones/joints are never visited before their ancestors.- Returns:
- a new array of joint/bone indices
-
resetRotation
public void resetRotation(int boneIndex) Reset the user/animation rotation of the indexed joint/bone to identity.- Parameters:
boneIndex- which joint/bone (≥0)
-
resetScale
public void resetScale(int boneIndex) Reset the user/animation scale of the indexed joint/bone to identity.- Parameters:
boneIndex- which joint/bone (≥0)
-
resetTranslation
public void resetTranslation(int boneIndex) Reset the user/animation translation of the indexed joint/bone to zero.- Parameters:
boneIndex- which joint/bone (≥0)
-
rootBoneIndices
public int[] rootBoneIndices()Enumerate all root bones/joints in the skeleton/armature.- Returns:
- a new array of indices
-
set
public void set(int boneIndex, com.jme3.math.Transform transform) Alter the user/animation transform of the indexed joint/bone.- Parameters:
boneIndex- which joint/bone to transform (≥0)transform- the desired Transform (not null, unaffected)
-
setRotation
public void setRotation(int boneIndex, com.jme3.math.Quaternion rotation) Alter the user/animation rotation of the indexed joint/bone.- Parameters:
boneIndex- which joint/bone to rotate (≥0)rotation- the desired rotation (not null, unaffected)
-
setScale
public void setScale(int boneIndex, com.jme3.math.Vector3f scale) Alter the user/animation scale of the indexed joint/bone.- Parameters:
boneIndex- which joint/bone to scale (≥0)scale- the desired scale factor for each axis (not null, unaffected)
-
setToAnimation
public void setToAnimation(com.jme3.animation.Animation animation, float time, TweenTransforms techniques) Configure this Pose for the specified Animation at the specified time.- Parameters:
animation- which Animation (not null, unaffected)time- the animation time (in seconds)techniques- the tweening techniques to use (not null, unaffected)
-
setToBind
public void setToBind()Configure this Pose to represent bind pose. -
setToClip
public void setToClip(com.jme3.anim.AnimClip clip, double time) Configure this Pose for the specified AnimClip at the specified time.- Parameters:
clip- which AnimClip (not null, unaffected)time- the animation time (in seconds)
-
setToRetarget
Configure this Pose by re-targeting the specified source pose.- Parameters:
sourcePose- which source pose to re-target (not null, unaffected)map- the skeleton map to use (not null, unaffected)
-
setTranslation
public void setTranslation(int boneIndex, com.jme3.math.Vector3f translation) Alter the user/animation translation of the indexed joint/bone.- Parameters:
boneIndex- which joint/bone to translate (≥0)translation- the desired translation (not null, unaffected)
-
skin
public com.jme3.math.Matrix4f[] skin(com.jme3.math.Matrix4f[] storeResult) Calculate skinning matrices for this Pose.- Parameters:
storeResult- storage for the results (modified if not null)- Returns:
- skinning matrices (either storeResult or a new instance)
-
userForLocal
public com.jme3.math.Transform userForLocal(int boneIndex, com.jme3.math.Transform localTransform, com.jme3.math.Transform storeResult) Determine the user/animation Transform for the indexed joint/bone to give it the specified local Transform.- Parameters:
boneIndex- the index of the subject bone/joint (≥0)localTransform- the desired local Transform (not null)storeResult- storage for the result (modified if not null, may be localTransform)- Returns:
- the required user Transform (either storeResult or a new instance)
-
userForModel
public com.jme3.math.Quaternion userForModel(int boneIndex, com.jme3.math.Quaternion modelOrientation, com.jme3.math.Quaternion storeResult) Calculate the user/animation rotation for the indexed joint/bone to give it the specified orientation in the coordinate system of an animated spatial.- Parameters:
boneIndex- which joint/bone (≥0)modelOrientation- desired orientation (not null, not zero, unaffected)storeResult- storage for the result (modified if not null)- Returns:
- transform (either storeResult or a new instance)
-
userRotation
public com.jme3.math.Quaternion userRotation(int boneIndex, com.jme3.math.Quaternion storeResult) Copy the user/animation rotation of the indexed joint/bone.- Parameters:
boneIndex- which joint/bone (≥0)storeResult- storage for the result (modified if not null)- Returns:
- the user rotation (either storeResult or a new instance)
-
userScale
public com.jme3.math.Vector3f userScale(int boneIndex, com.jme3.math.Vector3f storeResult) Copy the user/animation scale of the indexed joint/bone.- Parameters:
boneIndex- which joint/bone (≥0)storeResult- storage for the result (modified if not null)- Returns:
- the user scale factor for each axis (either storeResult or a new instance)
-
userTransform
public com.jme3.math.Transform userTransform(int boneIndex, com.jme3.math.Transform storeResult) Copy the user/animation transform of the indexed joint/bone.- Parameters:
boneIndex- which joint/bone (≥0)storeResult- storage for the result (modified if not null)- Returns:
- transform (either storeResult or a new instance)
-
userTranslation
public com.jme3.math.Vector3f userTranslation(int boneIndex, com.jme3.math.Vector3f storeResult) Copy the user/animation translation of the indexed joint/bone.- Parameters:
boneIndex- which joint/bone (≥0)storeResult- storage for the result (modified if not null)- Returns:
- user translation (either storeResult or a new instance)
-
cloneFields
Convert this shallow-cloned instance into a deep-cloned one, using the specified cloner and original to resolve copied fields.- Specified by:
cloneFieldsin interfacecom.jme3.util.clone.JmeCloneable- Parameters:
cloner- the cloner currently cloning this control (not null)original- the control from which this control was shallow-cloned (not null)
-
jmeClone
Create a shallow clone for the JME cloner.- Specified by:
jmeClonein interfacecom.jme3.util.clone.JmeCloneable- Returns:
- a new instance
-