Package com.jme3.anim
Class MorphTrack
java.lang.Object
com.jme3.anim.MorphTrack
- All Implemented Interfaces:
AnimTrack<float[]>
,Savable
,JmeCloneable
,Cloneable
Contains a list of weights and times for each keyframe.
-
Constructor Summary
ModifierConstructorDescriptionprotected
Serialization-only.MorphTrack
(Geometry target, float[] times, float[] weights, int nbMorphTargets) Creates a morph track with the given Geometry as a target -
Method Summary
Modifier and TypeMethodDescriptionvoid
cloneFields
(Cloner cloner, Object original) Implemented to perform deep cloning for this object, resolving local cloned references using the specified cloner.void
getDataAtTime
(double t, float[] store) Determine the track value for the specified time.Access the FrameInterpolator.double
Determine the duration of the track.int
Access the target geometry.float[]
getTimes()
returns the arrays of time for this trackfloat[]
return the array of weights of this trackjmeClone()
Performs a regular shallow clone of the object.void
read
(JmeImporter im) De-serialize this track from the specified importer, for example when loading from a J3O file.void
setFrameInterpolator
(FrameInterpolator interpolator) Replace the FrameInterpolator.void
setKeyframes
(float[] times, float[] weights) Sets the times and weights for this morph track.void
setKeyframesWeight
(float[] weights) Set the weights for this morph track.void
setNbMorphTargets
(float[] weights, int nbMorphTargets) Sets the number of morph targets and the corresponding weights.void
Replace the target geometry.void
setTimes
(float[] times) Sets the keyframes times for this Joint trackvoid
write
(JmeExporter ex) Serialize this track to the specified exporter, for example when saving to a J3O file.
-
Constructor Details
-
MorphTrack
protected MorphTrack()Serialization-only. Do not use. -
MorphTrack
Creates a morph track with the given Geometry as a target- Parameters:
target
- the desired target (alias created)times
- a float array with the time of each frame (alias created -- do not modify after passing it to this constructor)weights
- the morphs for each frames (alias created -- do not modify after passing it to this constructor)nbMorphTargets
- the desired number of morph targets
-
-
Method Details
-
getWeights
public float[] getWeights()return the array of weights of this track- Returns:
- the pre-existing array -- do not modify
-
setKeyframesWeight
public void setKeyframesWeight(float[] weights) Set the weights for this morph track. Note that the number of weights must equal the number of frames times the number of morph targets.- Parameters:
weights
- the weights of the morphs for each frame (alias created -- do not modify after passing it to this setter)- Throws:
IllegalStateException
- if this track does not have times setIllegalArgumentException
- if weights is an empty array or if the number of weights violates the frame count constraint
-
getTimes
public float[] getTimes()returns the arrays of time for this track- Returns:
- the pre-existing array -- do not modify
-
setTimes
public void setTimes(float[] times) Sets the keyframes times for this Joint track- Parameters:
times
- the keyframes times (alias created -- do not modify after passing it to this setter)- Throws:
IllegalArgumentException
- if times is empty
-
setKeyframes
public void setKeyframes(float[] times, float[] weights) Sets the times and weights for this morph track. Note that the number of weights must equal the number of frames times the number of morph targets.- Parameters:
times
- a float array with the time of each frame (alias created -- do not modify after passing it to this setter)weights
- the weights of the morphs for each frame (alias created -- do not modify after passing it to this setter)
-
getNbMorphTargets
public int getNbMorphTargets()- Returns:
- the number of morph targets
-
setNbMorphTargets
public void setNbMorphTargets(float[] weights, int nbMorphTargets) Sets the number of morph targets and the corresponding weights. Note that the number of weights must equal the number of frames times the number of morph targets.- Parameters:
weights
- the weights for each frame (alias created -- do not modify after passing it to this setter)nbMorphTargets
- the desired number of morph targets- Throws:
IllegalArgumentException
- if the number of weights and the new number of morph targets violate the frame count constraint
-
getLength
public double getLength()Description copied from interface:AnimTrack
Determine the duration of the track. -
getDataAtTime
public void getDataAtTime(double t, float[] store) Description copied from interface:AnimTrack
Determine the track value for the specified time.- Specified by:
getDataAtTime
in interfaceAnimTrack<float[]>
- Parameters:
t
- the track time (in seconds)store
- storage for the value (not null, modified)
-
getFrameInterpolator
Access the FrameInterpolator.- Returns:
- the pre-existing instance or null
-
setFrameInterpolator
Replace the FrameInterpolator.- Parameters:
interpolator
- the interpolator to use (alias created)
-
getTarget
Access the target geometry.- Returns:
- the pre-existing instance
-
setTarget
Replace the target geometry.- Parameters:
target
- the Geometry to use as the target (alias created)
-
write
Serialize this track to the specified exporter, for example when saving to a J3O file.- Specified by:
write
in interfaceSavable
- Parameters:
ex
- the exporter to write to (not null)- Throws:
IOException
- from the exporter
-
read
De-serialize this track from the specified importer, for example when loading from a J3O file.- Specified by:
read
in interfaceSavable
- Parameters:
im
- the importer to use (not null)- Throws:
IOException
- from the importer
-
jmeClone
Description copied from interface:JmeCloneable
Performs a regular shallow clone of the object. Some fields may also be cloned but generally only if they will never be shared with other objects. (For example, local Vector3fs and so on.)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.
- Specified by:
jmeClone
in interfaceJmeCloneable
- Returns:
- a new instance
-
cloneFields
Description copied from interface:JmeCloneable
Implemented to perform deep cloning for this object, resolving local cloned references using the specified cloner. The object can call cloner.clone(fieldValue) to deep clone any of its fields.Note: during normal clone operations the original object will not be needed as the clone has already had all of the fields shallow copied.
- Specified by:
cloneFields
in interfaceJmeCloneable
- Parameters:
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 only clone what it wants.
-