|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.scene.Controller
com.jmex.model.animation.KeyframeController
public class KeyframeController
Started Date: Jun 12, 2004
Class can do linear interpolation of a TriMesh between units of time. Similar
to VertexKeyframeController
but interpolates float units of
time instead of integer keyframes.
Controller.setSpeed(float) sets a speed relative to the defined speed. For
example, the default is 1. A speed of 2 would run twice as fast and a speed
of .5 would run half as fast
Controller.setMinTime(float) and Controller.setMaxTime(float) both define the
bounds that KeyframeController should follow. It is the programmer's
responsiblity to make sure that the MinTime and MaxTime are within the span
of the defined setKeyframe
Controller functions RepeatType and isActive are both defined in their
default way for KeyframeController
When this controller is saved/loaded to XML format, it assumes that the mesh
it morphs is the TriMesh it belongs to, so it is recomended to only attach
this controller to the TriMesh it animates.
Nested Class Summary | |
---|---|
static class |
KeyframeController.PointInTime
This class defines a point in time that states morphShape
should look like newShape at time seconds |
Field Summary | |
---|---|
java.util.ArrayList<KeyframeController.PointInTime> |
keyframes
An array of PointInTime s that defines the animation |
Fields inherited from class com.jme.scene.Controller |
---|
RT_CLAMP, RT_CYCLE, RT_WRAP |
Constructor Summary | |
---|---|
KeyframeController()
Default constructor. |
Method Summary | |
---|---|
float |
getBlendTime()
Gets the currently set blending time for smooth animation transitions |
int |
getCurrentFrame()
|
float |
getCurrentTime()
|
float |
getCurTime()
Gets the current time in the animation |
boolean |
getModelUpdate()
Returns true if the model's bounding volume is being updated every frame. |
TriMesh |
getMorphMesh()
|
void |
read(JMEImporter im)
|
void |
setBlendTime(float blendTime)
If repeat type RT_WRAP is set, after reaching the last frame of the currently set
animation maxTime (see Controller.setMaxTime ), there will be an additional blendTime
seconds long phase inserted, morphing from the last frame to the first. |
void |
setCurTime(float time)
Sets the current time in the animation |
void |
setKeyframe(float time,
TriMesh shape)
Tells the controller to change its morphMesh to shape at
time seconds. |
void |
setModelUpdate(boolean update)
If true, the model's bounding volume will be updated every frame. |
void |
setMorphingMesh(TriMesh morph)
Sets the Mesh that will be physically changed by this KeyframeController |
void |
setNewAnimationTimes(float newBeginTime,
float newEndTime)
Sets the new animation boundaries for this controller. |
void |
setSmoothTranslation(float newTimeToReach,
float translationLen,
float newBeginTime,
float newEndTime)
This function will do a smooth translation between a keframe's current look, to the look directly at newTimeToReach. |
void |
shallowSetMorphMesh(TriMesh morph)
|
void |
update(float time)
As defined in Controller |
void |
write(JMEExporter ex)
|
Methods inherited from class com.jme.scene.Controller |
---|
getClassTag, getControllerValues, getMaxTime, getMinTime, getRepeatType, getSpeed, isActive, setActive, setControllerValues, setMaxTime, setMinTime, setRepeatType, setSpeed |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public transient java.util.ArrayList<KeyframeController.PointInTime> keyframes
PointInTime
s that defines the animation
Constructor Detail |
---|
public KeyframeController()
Method Detail |
---|
public float getCurrentTime()
public int getCurrentFrame()
public float getCurTime()
public void setCurTime(float time)
time
- The time this Controller should continue atpublic void setMorphingMesh(TriMesh morph)
morph
- The new mesh to morphpublic void shallowSetMorphMesh(TriMesh morph)
public void setKeyframe(float time, TriMesh shape)
shape
at
time
seconds. Time must be >=0 and shape must be non-null
and shape must have the same number of vertexes as the current shape. If
not, then nothing happens. It is also required that
setMorphingMesh(TriMesh)
is called before
setKeyframe
. It is assumed that shape.indices ==
morphMesh.indices, otherwise morphing may look funny
time
- The time for the changeshape
- The new shape at that timepublic void setSmoothTranslation(float newTimeToReach, float translationLen, float newBeginTime, float newEndTime)
newTimeToReach
- The time to reach.translationLen
- How long it takesnewBeginTime
- The new cycle begining timenewEndTime
- The new cycle ending time.public void setNewAnimationTimes(float newBeginTime, float newEndTime)
newBeginTime
- The starting timenewEndTime
- The ending timepublic void update(float time)
update
in class Controller
time
- as defined in Controllerpublic void setModelUpdate(boolean update)
update
- The new update model volume per frame value.public boolean getModelUpdate()
public void setBlendTime(float blendTime)
RT_WRAP
is set, after reaching the last frame of the currently set
animation maxTime (see Controller.setMaxTime
), there will be an additional blendTime
seconds long phase inserted, morphing from the last frame to the first.
blendTime
- The blend time to setpublic float getBlendTime()
setBlendTime(float blendTime)
public TriMesh getMorphMesh()
public void write(JMEExporter ex) throws java.io.IOException
write
in interface Savable
write
in class Controller
java.io.IOException
public void read(JMEImporter im) throws java.io.IOException
read
in interface Savable
read
in class Controller
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |