org.xith3d.schedops.movement
Class GroupRotator

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

public class GroupRotator
extends GroupAnimator

This class is useful to automatically rotate a branch in your scenegraph. Unlike the RotatableGroup it rotates 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
GroupRotator(Transformable tn)
          Creates a new GroupRotater with default TransformationDirectives in use.
GroupRotator(Transformable tn, TransformationDirectives rotDirecs)
          Creates a new GroupRotater with the given TransformationDirectives in use.
GroupRotator(TransformationDirectives rotDirecs)
          Creates a new GroupRotater 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  AngleInterpolater getAngleInterpolater(TransformationDirectives.Axes axis)
           
protected  float getRotationValue(TransformationDirectives.Axes axis, long gameMicros)
           
 void setTransformationDirectives(TransformationDirectives rotDirecs)
          Changes the RotationDirectives used by this RotatableGroup.
 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

GroupRotator

public GroupRotator(Transformable tn,
                    TransformationDirectives rotDirecs)
Creates a new GroupRotater with the given TransformationDirectives in use.

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

GroupRotator

public GroupRotator(TransformationDirectives rotDirecs)
Creates a new GroupRotater with the given TransformationDirectives in use.

Parameters:
rotDirecs - the new TransformationDirectives

GroupRotator

public GroupRotator(Transformable tn)
Creates a new GroupRotater with default TransformationDirectives in use.

Method Detail

getAngleInterpolater

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

getRotationValue

protected float getRotationValue(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 rotation 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 rotDirecs)
Changes the RotationDirectives used by this RotatableGroup.

Overrides:
setTransformationDirectives in class GroupAnimator
Parameters:
rotDirecs - the new RotationDirectives