com.jme.scene
Class Controller

java.lang.Object
  extended bycom.jme.scene.Controller
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CurveController, FadeInOutController, JointController, KeyframeController, LightStateController, ParticleManager, SpatialTransformer

public abstract class Controller
extends java.lang.Object
implements java.io.Serializable

Controller provides a base class for creation of controllers to modify nodes and render states over time. The base controller provides a repeat type, min and max time, as well as speed. Subclasses of this will provide the update method that takes the time between the last call and the current one and modifies an object in a application specific way.

Version:
$Id: Controller.java,v 1.11 2005/01/03 19:00:15 renanse Exp $
Author:
Mark Powell
See Also:
Serialized Form

Field Summary
static int RT_CLAMP
          A clamped repeat type signals that the controller should look like its final state when it's done
Example: 0 1 5 8 9 10 10 10 10 10 10 10 10 10 10 10...
static int RT_CYCLE
          A cycled repeat type signals that the controller should cycle it's states forwards and backwards
Example: 0 1 5 8 9 10 9 8 5 1 0 1 5 8 9 10 9 ....
static int RT_WRAP
          A wrapped repeat type signals that the controller should start back at the begining when it's final state is reached
Example: 0 1 5 8 9 10 0 1 5 8 9 10 0 1 5 ....
 
Constructor Summary
Controller()
           
 
Method Summary
 float getMaxTime()
          Returns the current maximum time for this controller.
 float getMinTime()
          Returns the current minimum time of this controller
 int getRepeatType()
          Returns the current repeat type of this controller.
 float getSpeed()
          Returns the speed of this controller.
 boolean isActive()
          Returns if this Controller is active or not.
 Controller putClone(Controller store, CloneCreator properties)
          This function should be overridden by any Spatial objects that want their Controller cloned by a CloneCreator.
 void setActive(boolean active)
          Sets the active flag of this controller.
 void setMaxTime(float maxTime)
          Sets the maximum time for this controller
 void setMinTime(float minTime)
          Sets the minimum time of this controller
 void setRepeatType(int repeatType)
          Sets the repeat type of this controller.
 void setSpeed(float speed)
          Sets the speed of this controller
abstract  void update(float time)
          Defined by extending classes, update is a signal to Controller that it should update whatever object(s) it is controlling.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RT_CLAMP

public static final int RT_CLAMP
A clamped repeat type signals that the controller should look like its final state when it's done
Example: 0 1 5 8 9 10 10 10 10 10 10 10 10 10 10 10...

See Also:
Constant Field Values

RT_WRAP

public static final int RT_WRAP
A wrapped repeat type signals that the controller should start back at the begining when it's final state is reached
Example: 0 1 5 8 9 10 0 1 5 8 9 10 0 1 5 ....

See Also:
Constant Field Values

RT_CYCLE

public static final int RT_CYCLE
A cycled repeat type signals that the controller should cycle it's states forwards and backwards
Example: 0 1 5 8 9 10 9 8 5 1 0 1 5 8 9 10 9 ....

See Also:
Constant Field Values
Constructor Detail

Controller

public Controller()
Method Detail

getSpeed

public float getSpeed()
Returns the speed of this controller. Speed is 1 by default.

Returns:

setSpeed

public void setSpeed(float speed)
Sets the speed of this controller

Parameters:
speed - The new speed

getMaxTime

public float getMaxTime()
Returns the current maximum time for this controller.

Returns:
This controller's maximum time.

setMaxTime

public void setMaxTime(float maxTime)
Sets the maximum time for this controller

Parameters:
maxTime - The new maximum time

getMinTime

public float getMinTime()
Returns the current minimum time of this controller

Returns:
This controller's minimum time

setMinTime

public void setMinTime(float minTime)
Sets the minimum time of this controller

Parameters:
minTime - The new minimum time.

getRepeatType

public int getRepeatType()
Returns the current repeat type of this controller.

Returns:
The current repeat type

setRepeatType

public void setRepeatType(int repeatType)
Sets the repeat type of this controller.

Parameters:
repeatType - The new repeat type.

setActive

public void setActive(boolean active)
Sets the active flag of this controller. Note: updates on controllers are still called even if this flag is set to false. It is the responsibility of the extending class to check isActive if it wishes to be turn-off-able.

Parameters:
active - The new active state.

isActive

public boolean isActive()
Returns if this Controller is active or not.

Returns:
True if this controller is set to active, false if not.

update

public abstract void update(float time)
Defined by extending classes, update is a signal to Controller that it should update whatever object(s) it is controlling.

Parameters:
time - The time in seconds between the last call to update and the current one

putClone

public Controller putClone(Controller store,
                           CloneCreator properties)
This function should be overridden by any Spatial objects that want their Controller cloned by a CloneCreator. It stores into "store" the properties of this Controller.

Parameters:
store - The Controller to store properties into. If null, null is returned.
properties - The CloneCreator controlling how things should be copied into the store Controller.
Returns:
The store controller, after a copy.