Class AnimatableGroup

  extended by org.xith3d.scenegraph.SceneGraphObject
      extended by org.xith3d.scenegraph.Node
          extended by org.xith3d.scenegraph.GroupNode
              extended by org.xith3d.scenegraph.Group
                  extended by org.xith3d.scenegraph.TransformGroup
                      extended by org.xith3d.schedops.movement.AnimatableGroup
All Implemented Interfaces:
org.jagatoo.datatypes.NamableObject, org.jagatoo.datatypes.NamedObject, org.openmali.spatial.SpatialNode, Animatable, ScheduledOperation, Updatable, Transformable
Direct Known Subclasses:
RotatableGroup, TranslatableGroup

public class AnimatableGroup
extends TransformGroup
implements Animatable

This class is useful to automatically animate a branch in your scenegraph.

Field Summary
protected  GroupAnimator groupAnimator
protected static java.util.Random RND
Fields inherited from class org.xith3d.scenegraph.GroupNode
children, hostGroup, numChildren, totalNumChildren, totalNumShapes
Fields inherited from class org.xith3d.scenegraph.Node
bounds, boundsAutoCompute, boundsDirty, globalIgnoreBounds, instanceBoundsTypeHint, transformGroup, untransformedBounds
Fields inherited from class org.xith3d.scenegraph.SceneGraphObject
Constructor Summary
AnimatableGroup(GroupAnimator groupAnimator)
          Creates a new AnimatableGroup.
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.
 GroupAnimator getGroupAnimator()
 TransformationDirectives getTransformationDirectives()
 boolean isAlive()
          if false, the object will be removed from the scheduler next loop iteration
 boolean isAnimating()
 boolean isPersistent()
          If this operation is persistent, it remains scheduled after beeing executed once.
 void setAlive(boolean alive)
          Sets this Object alive or dead
 void setScale(float factor)
          Sets this group's scale to the specified factor.
 void setTransformationDirectives(TransformationDirectives tfDirecs)
          Changes the TransformationDirectives used by this AnimatableGroup.
 void setTranslation(float transX, float transY, float transZ)
          Moves this Group by the specified vector-components.
 void setTranslation(org.openmali.vecmath2.Vector3f translation)
          Moves this Group by the specified vector.
 void startAnimation(long gameTime, UpdatingThread.TimingMode timingMode)
          Starts the animation of this object.
 void stopAnimation()
          Stops the animation of this object.
 void update(long gameTime, long frameTime, UpdatingThread.TimingMode timingMode)
          Updates this Updatable object.
Methods inherited from class org.xith3d.scenegraph.TransformGroup
getLocalTransform, getLocalTransform, getPosition, getPosition, getTransform, getTransform, getWorldTransform, newInstance, onTransformChanged, setLocalTransform, setPosition, setPosition, setTransform, traverse, updateTransform
Methods inherited from class org.xith3d.scenegraph.Group
Methods inherited from class org.xith3d.scenegraph.GroupNode
absorbDetails, addChild, addChild, checkChild, dump, dump, ensureCapacity, expandBounds, findAll, findAll, findFirst, findFirst, freeOpenGLResources, getChild, getChildren, getChildren, getClipper, getPickHost, getScissorRect, getTotalNumChildren, getTotalNumShapes, indexOf, isPickHost, mergeInheritedClipper, mergeInheritedNodes, mergeInheritedScissorRect, numChildren, removeAllChildren, removeChild, removeChild, setBoundsDirty, setBoundsDirtyUpward, setChild, setClipper, setLive, setPickHost, setPickHost, setScissorRect, setShowBounds, sharedCopy, sharedCopy, traverse, unmergeInheritedFog, unmergeInheritedLight, unmergeInheritedNodes, updateBounds, updateBoundsCheap
Methods inherited from class org.xith3d.scenegraph.Node
cloneNode, detach, duplicateNode, freeOpenGLResources, getBounds, getBoundsAutoCompute, getBoundsType, getBoundsTypeHint, getDefaultPickable, getIndentString, getInheritedNodeAttributes, getModListener, getOrderedChild, getOrderedState, getParent, getRoot, getShadowAttachment, getShowBounds, getTransformGroup, getTreeCell, getWorldBounds, getWorldTransform, isBillboard, isIgnoreBounds, isOccluder, isPickable, isRenderable, isUpdatableNode, popGlobalIgnoreBounds, printBounds, pushGlobalIgnoreBounds, setBounds, setBoundsAutoCompute, setBoundsTypeHint, setDefaultPickable, setGlobalIgnoreBounds, setIgnoreBounds, setIsOccluder, setModListener, setOrderedChild, setParent, setPickable, setPickableRecursive, setPickableRecursive, setRenderable, setShadowAttachment, setShowBounds, setTransformGroup, setTreeCell, updateOrderedChild, updateTransformGroup, updateWorldTransform
Methods inherited from class org.xith3d.scenegraph.SceneGraphObject
getName, getUserData, getUserData, getUserDataMap, isLive, setName, setUserData, setUserData, setUserDataRecursive, setUserDataRecursive, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.xith3d.scenegraph.Transformable
getName, setName

Field Detail


protected static final java.util.Random RND


protected final GroupAnimator groupAnimator
Constructor Detail


public AnimatableGroup(GroupAnimator groupAnimator)
Creates a new AnimatableGroup.

groupAnimator - the GroupAnimator used to animate this group
Method Detail


public GroupAnimator getGroupAnimator()


public TransformationDirectives getTransformationDirectives()
the directives for this Group's rotation


public void setTransformationDirectives(TransformationDirectives tfDirecs)
Changes the TransformationDirectives used by this AnimatableGroup.

tfDirecs - the new TransformationDirectives


public boolean isAnimating()

Specified by:
isAnimating in interface Animatable
is this object's animation running


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

Specified by:
startAnimation in interface Animatable


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

Specified by:
stopAnimation in interface Animatable


public boolean isPersistent()
If this operation is persistent, it remains scheduled after beeing executed once.

Specified by:
isPersistent in interface ScheduledOperation


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.

gameTime - the amount of milliseconds since the game started
frameTime - miliseconds needed to render one frame
a boolean telling whether the rotation has been done or not


public void update(long gameTime,
                   long frameTime,
                   UpdatingThread.TimingMode timingMode)
Updates this Updatable object.

Specified by:
update in interface Updatable
gameTime - the gameTime in Milliseconds
frameTime - the frameTime in Milliseconds (needed time for the last frame)
timingMode - the TimingMode to use for frameTime.


public void setAlive(boolean alive)
Sets this Object alive or dead

Specified by:
setAlive in interface ScheduledOperation
alive - if false, the object will be removed from the scheduler next loop iteration


public boolean isAlive()
if false, the object will be removed from the scheduler next loop iteration

Specified by:
isAlive in interface ScheduledOperation


public void setTranslation(float transX,
                           float transY,
                           float transZ)
Moves this Group by the specified vector-components.

transX - the x-amount to move by
transY - the y-amount to move by
transZ - the z-amount to move by


public void setTranslation(org.openmali.vecmath2.Vector3f translation)
Moves this Group by the specified vector.

translation - the amount to move by


public void setScale(float factor)
Sets this group's scale to the specified factor. should be implemented in the TransformGroup class to economize coding!

factor - the factor to scale to