com.jme.scene
Class Controller

java.lang.Object
  extended by com.jme.scene.Controller
All Implemented Interfaces:
Savable, java.io.Serializable
Direct Known Subclasses:
ActionChangeController, ActionController, ActionRepeatController, AnimationController, BumpMapColorController, CameraController, CurveController, DefColorFadeController, FadeInOutController, JointController, KeyframeController, LightStateController, MeshAnimationController, MeshLodController, ParticleController, PoseController, RotationController, SpatialTransformer, TextureAnimationController, TextureKeyframeController, ThrottleController, TimedLifeController

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

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 4131 2009-03-19 20:15:28Z blaine.dev $
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
 java.lang.Class getClassTag()
           
 void getControllerValues(java.util.HashMap<java.lang.String,java.lang.Object> store)
           
 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.
 void read(JMEImporter e)
           
 void setActive(boolean active)
          Sets the active flag of this controller.
 void setControllerValues(java.util.HashMap<java.lang.String,java.lang.Object> values)
           
 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.
 void write(JMEExporter e)
           
 
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

write

public void write(JMEExporter e)
           throws java.io.IOException
Specified by:
write in interface Savable
Throws:
java.io.IOException

read

public void read(JMEImporter e)
          throws java.io.IOException
Specified by:
read in interface Savable
Throws:
java.io.IOException

getClassTag

public java.lang.Class getClassTag()
Specified by:
getClassTag in interface Savable

getControllerValues

public void getControllerValues(java.util.HashMap<java.lang.String,java.lang.Object> store)

setControllerValues

public void setControllerValues(java.util.HashMap<java.lang.String,java.lang.Object> values)