|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.scene.Controller
com.jme.animation.SpatialTransformer
public class SpatialTransformer
Started Date: Jul 9, 2004
This class animates spatials by interpolating between various
transformations. The user defines objects to be transformed and what
rotation/translation/scale to give each object at various points in time. The
user must call interpolateMissing() before using the controller in order to
interpolate unspecified translation/rotation/scale.
Nested Class Summary | |
---|---|
static class |
SpatialTransformer.PointInTime
Defines a point in time where at time time , ohject
toChange[i] will assume transformation
look[i] . |
Field Summary | |
---|---|
java.util.ArrayList<SpatialTransformer.PointInTime> |
keyframes
Interpolated array of keyframe states |
int[] |
parentIndexes
parentIndexes[i] states that toChange[i]'s parent is toChange[parentIndex[i]]. |
Spatial[] |
toChange
Refrences to the objects that will be changed. |
Fields inherited from class com.jme.scene.Controller |
---|
RT_CLAMP, RT_CYCLE, RT_WRAP |
Constructor Summary | |
---|---|
SpatialTransformer()
|
|
SpatialTransformer(int numObjects)
Constructs a new SpatialTransformer that will operate on numObjects Spatials |
Method Summary | |
---|---|
(package private) int[] |
findIndicesBeforeAfter(float giventime)
Finds indices i in keyframes such that
keyframes.get(i[0]).time < giventime <= keyframes.get(i[1]).time
if no keyframe was found before or after giventime , the
corresponding value will clamp to 0 resp. |
float |
getCurTime()
Gets the current time in the animation |
int |
getNumObjects()
Returns the number of Objects used by this SpatialTransformer |
void |
interpolateMissing()
This must be called one time, once all translations/rotations/scales have been set. |
void |
read(JMEImporter e)
|
void |
setCurTime(float time)
Sets the current time in the animation |
void |
setMaxTime(float maxTime)
overridden by SpatialTransformer to always set a time inside the first and the last keyframe's time in the animation |
void |
setMinTime(float minTime)
overridden by SpatialTransformer to always set a time inside the first and the last keyframe's time in the animation. |
void |
setNewAnimationTimes(float newBeginTime,
float newEndTime)
Sets the new animation boundaries for this controller. |
void |
setObject(Spatial objChange,
int index,
int parentIndex)
Sets an object to animate. |
void |
setPosition(int indexInST,
float time,
Vector3f position)
Sets object with index indexInST to translate by
position at time time . |
void |
setRotation(int indexInST,
float time,
Quaternion rot)
Sets object with index indexInST to rotate by
rot at time time . |
void |
setScale(int indexInST,
float time,
Vector3f scale)
Sets object with index indexInST to scale by
scale at time time . |
void |
update(float time)
Defined by extending classes, update is a signal to
Controller that it should update whatever object(s) it is controlling. |
void |
write(JMEExporter e)
|
Methods inherited from class com.jme.scene.Controller |
---|
getClassTag, getControllerValues, getMaxTime, getMinTime, getRepeatType, getSpeed, isActive, setActive, setControllerValues, setRepeatType, setSpeed |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public Spatial[] toChange
public int[] parentIndexes
public java.util.ArrayList<SpatialTransformer.PointInTime> keyframes
Constructor Detail |
---|
public SpatialTransformer()
public SpatialTransformer(int numObjects)
numObjects
Spatials
numObjects
- The number of spatials to changeMethod Detail |
---|
public void update(float time)
Controller
update
is a signal to
Controller that it should update whatever object(s) it is controlling.
update
in class Controller
time
- The time in seconds between the last call to update and the
current onepublic void setMinTime(float minTime)
setMinTime
in class Controller
minTime
- The new minimum time.public void setMaxTime(float maxTime)
setMaxTime
in class Controller
maxTime
- The new maximum timepublic void setNewAnimationTimes(float newBeginTime, float newEndTime)
newBeginTime
- The starting timenewEndTime
- The ending timepublic float getCurTime()
public void setCurTime(float time)
time
- The time this Controller should continue atint[] findIndicesBeforeAfter(float giventime)
keyframes.get(i[0]).time < giventime <= keyframes.get(i[1]).time
if no keyframe was found before or after giventime
, the
corresponding value will clamp to 0
resp.
keyframes.size() - 1
public void setObject(Spatial objChange, int index, int parentIndex)
index
and
it's parent index is parentIndex
. A parent index of -1
indicates it has no parent.
objChange
- The spatial that will be updated by this SpatialTransformer.index
- The index of that spatial in this transformer's arrayparentIndex
- The parentIndex in this transformer's array for this Spatialpublic void setRotation(int indexInST, float time, Quaternion rot)
indexInST
to rotate by
rot
at time time
.
indexInST
- The index of the spatial to changetime
- The time for the spatial to take this rotationrot
- The rotation to takepublic void setPosition(int indexInST, float time, Vector3f position)
indexInST
to translate by
position
at time time
.
indexInST
- The index of the spatial to changetime
- The time for the spatial to take this translationposition
- The position to takepublic void setScale(int indexInST, float time, Vector3f scale)
indexInST
to scale by
scale
at time time
.
indexInST
- The index of the spatial to changetime
- The time for the spatial to take this scalescale
- The scale to takepublic void interpolateMissing()
public int getNumObjects()
public void write(JMEExporter e) throws java.io.IOException
write
in interface Savable
write
in class Controller
java.io.IOException
public void read(JMEImporter e) 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 |