org.xith3d.schedops.movement
Class GroupTranslator

java.lang.Object
  extended by org.xith3d.schedops.movement.GroupAnimator
      extended by org.xith3d.schedops.movement.GroupTranslator
All Implemented Interfaces:
Animatable, ScheduledOperation, Updatable

public class GroupTranslator
extends GroupAnimator

This class is useful to automatically translate a branch in your scenegraph. Unlike the TranslatableGroup it translates a foreign group and does not extend TransformGroup itself.


Field Summary
 
Fields inherited from class org.xith3d.schedops.movement.GroupAnimator
rnd, t3dMain, transformNodes
 
Constructor Summary
GroupTranslator(Transformable tn)
          Creates a new GroupTranslator with default TransformationDirectives in use
GroupTranslator(Transformable tn, TransformationDirectives transDirecs)
          Creates a new GroupTranslator with the given TransformationDirectives in use
GroupTranslator(TransformationDirectives transDirecs)
          Creates a new GroupTranslator with the given TransformationDirectives in use
 
Method Summary
 boolean animate(long gameTime, long frameTime, UpdatingThread.TimingMode timingMode)
          calculates positions and rotation of contained objects to render them at their new placement, if the animation has been started.
protected  DistanceInterpolater getDistanceInterpolater(TransformationDirectives.Axes axis)
           
protected  float getTranslationValue(TransformationDirectives.Axes axis, long gameMicros)
           
 void setTransformationDirectives(TransformationDirectives transDirecs)
          Changes the TransformationDirectives used by this TranslatableGroup
 void startAnimation(long gameTime, UpdatingThread.TimingMode timingMode)
          Starts the animation of this object.
 void stopAnimation()
          Stops the animation of this object.
 
Methods inherited from class org.xith3d.schedops.movement.GroupAnimator
addTransformNode, getNumTransformNodes, getTransformationDirectives, getTransformNode, getTransformNode, isAlive, isAnimating, isPersistent, setAlive, setScale, setTransform, setTransformNode, setTransformNode, setTranslation, setTranslation, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GroupTranslator

public GroupTranslator(Transformable tn,
                       TransformationDirectives transDirecs)
Creates a new GroupTranslator with the given TransformationDirectives in use

Parameters:
tn - the TransformNode to rotate
transDirecs - the new TransformationDirectives

GroupTranslator

public GroupTranslator(TransformationDirectives transDirecs)
Creates a new GroupTranslator with the given TransformationDirectives in use

Parameters:
transDirecs - the new TransformationDirectives

GroupTranslator

public GroupTranslator(Transformable tn)
Creates a new GroupTranslator with default TransformationDirectives in use

Method Detail

getDistanceInterpolater

protected DistanceInterpolater getDistanceInterpolater(TransformationDirectives.Axes axis)
Parameters:
axis - the axis to get the AngleInterpolater for
Returns:
a reference to this group's AngleInterpolater object.

getTranslationValue

protected float getTranslationValue(TransformationDirectives.Axes axis,
                                    long gameMicros)
Parameters:
axis - the axis to get the AngleInterpolater for
gameMicros - the time to get the value at
Returns:
the current translation value [0; 2*pi] of the specified axis

startAnimation

public void startAnimation(long gameTime,
                           UpdatingThread.TimingMode timingMode)
Starts the animation of this object.

Specified by:
startAnimation in interface Animatable
Overrides:
startAnimation in class GroupAnimator

stopAnimation

public void stopAnimation()
Stops the animation of this object.

Specified by:
stopAnimation in interface Animatable
Overrides:
stopAnimation in class GroupAnimator

animate

public boolean animate(long gameTime,
                       long frameTime,
                       UpdatingThread.TimingMode timingMode)
calculates positions and rotation of contained objects to render them at their new placement, if the animation has been started.

Specified by:
animate in class GroupAnimator
Parameters:
gameTime - the amount of milliseconds since the game started
frameTime - miliseconds needed to render one frame
Returns:
a boolean telling whether the rotation has been done or not

setTransformationDirectives

public void setTransformationDirectives(TransformationDirectives transDirecs)
Changes the TransformationDirectives used by this TranslatableGroup

Overrides:
setTransformationDirectives in class GroupAnimator
Parameters:
transDirecs - the new TransformationDirectives