Package org.xj3d.impl.core.eventmodel
Class VirtualTimeSensorManager
java.lang.Object
org.xj3d.impl.core.eventmodel.VirtualTimeSensorManager
- All Implemented Interfaces:
VRMLClock
,TimeSensorManager
A manager for time sensor nodes that allows application control
of the clock.
- Version:
- $Revision: 1.2 $
- Author:
- Rex Melton
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a time listener to this clock.void
clear()
Force clearing all state from this manager now.void
clockTick
(long time) Process the event that builds the current time.int
Return the increment for each virtual clock tick in milliseconds.double
getTime()
Request the current time from the system clock.long
Request the time in wall-clock coordinates.void
Remove a time listener to this clock.void
Reset the clock to the current time as time zero.void
setErrorReporter
(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion.void
setTickIncrement
(int tickIncrement) Set the increment for each virtual clock tick in milliseconds.void
tick()
Adjust the clock by a tick increment
-
Constructor Details
-
VirtualTimeSensorManager
public VirtualTimeSensorManager()Create a new time scheduler behaviour
-
-
Method Details
-
getTime
-
getWallTime
public long getWallTime()Request the time in wall-clock coordinates. This is standard Unix epoch time.- Specified by:
getWallTime
in interfaceVRMLClock
- Returns:
- The current wall-clock time
-
resetTimeZero
public void resetTimeZero()Reset the clock to the current time as time zero. This can only be called when the timer is not enabled. The last wall clock time is set to now so that fraction information will be correctly oriented for the next time it is enabled called to issue a clock tick.- Specified by:
resetTimeZero
in interfaceVRMLClock
-
addTimeListener
Add a time listener to this clock. Only one instance of each listener will be registered and null references are ignored.- Specified by:
addTimeListener
in interfaceVRMLClock
- Parameters:
l
- The listener instance to add
-
removeTimeListener
Remove a time listener to this clock. If the listener is not known to this implementation, it is silently ignored.- Specified by:
removeTimeListener
in interfaceVRMLClock
- Parameters:
l
- The listener instance to add
-
setErrorReporter
public void setErrorReporter(org.j3d.util.ErrorReporter reporter) Register an error reporter with the engine so that any errors generated by the loading of script code can be reported in a nice, pretty fashion. Setting a value of null will clear the currently set reporter. If one is already set, the new value replaces the old.- Specified by:
setErrorReporter
in interfaceTimeSensorManager
- Parameters:
reporter
- The instance to use or null
-
clockTick
public void clockTick(long time) Process the event that builds the current time.- Specified by:
clockTick
in interfaceTimeSensorManager
- Parameters:
time
- The current clock cycle time in milliseconds
-
clear
public void clear()Force clearing all state from this manager now. This is used to indicate that a new world is about to be loaded and everything should be cleaned out now.- Specified by:
clear
in interfaceTimeSensorManager
-
tick
public void tick()Adjust the clock by a tick increment -
setTickIncrement
public void setTickIncrement(int tickIncrement) Set the increment for each virtual clock tick in milliseconds.- Parameters:
tickIncrement
- The increment for each virtual clock tick.
-
getTickIncrement
public int getTickIncrement()Return the increment for each virtual clock tick in milliseconds.- Returns:
- The increment for each virtual clock tick.
-