Package org.xj3d.impl.core.eventmodel
Class DefaultEventModelEvaluator
java.lang.Object
org.xj3d.impl.core.eventmodel.DefaultEventModelEvaluator
- All Implemented Interfaces:
EventModelEvaluator
Default implementation of the event model evaluator that is
renderer-independent.
Event model evaluation works for both VRML97 and X3D, with mixtures of file types.
- Version:
- $Revision: 1.25 $
- Author:
- Justin Couch
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addExternalView
(ExternalView view) Add an external view to the evaluator.void
addNodeObserver
(int nodeType, NodeObserver obs) Add an observer for a specific node type.void
Request that this viewpoint object is bound at the start of the next frame.void
clear()
Force clearing all state from this manager now.void
evaluate
(long time) Run the event model for this frame now.Get the content loader in use by the evaluator.Get the frame state manager in use by the evaluator.getLayerManager
(int id) Get the layer manager for the the layer ID.Get the list of external node managers currently in use.Get the route manager in use by the evaluator.Get the script manager in use by the evaluator.Get the VRMLClock instance in use by this evaluator.void
initialize
(ScriptManager scripts, RouteManager router, SensorManager sensors, FrameStateManager fsm, ContentLoadManager elm, ViewpointManager vm, LayerManagerFactory lmf, LayerRenderingManager lrm, NodeManager[] extManagers) Initialise the evaluator with the given managers.void
Remove the external view from this evaluator.void
removeNodeObserver
(int nodeType, NodeObserver obs) Remove the given node observer instance for the specific node type.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
Set the listener for intialisation information.void
Used to set the scene to the new content.void
shutdown()
Shutdown the node manager now.
-
Constructor Details
-
DefaultEventModelEvaluator
public DefaultEventModelEvaluator()Construct a new instance of the evaluator.
-
-
Method Details
-
initialize
public void initialize(ScriptManager scripts, RouteManager router, SensorManager sensors, FrameStateManager fsm, ContentLoadManager elm, ViewpointManager vm, LayerManagerFactory lmf, LayerRenderingManager lrm, NodeManager[] extManagers) Description copied from interface:EventModelEvaluator
Initialise the evaluator with the given managers.- Specified by:
initialize
in interfaceEventModelEvaluator
- Parameters:
scripts
- The manager for loading scriptsrouter
- The manager for handling routessensors
- The manager for all sensorsfsm
- State manager for the frameelm
- Manager for loading external contentvm
- Manager of viewpoint interactionslmf
- Factory for producing new layer managerslrm
- Manager for handling layer renderingextManagers
- List of external managers to handle
-
addNodeObserver
Description copied from interface:EventModelEvaluator
Add an observer for a specific node type. A single instance may be registered for more than one type. Each type registered will result in a separate call per frame - one per type. If the observer is currently added for this type ID, the request is ignored.- Specified by:
addNodeObserver
in interfaceEventModelEvaluator
- Parameters:
nodeType
- The type identifier of the node being observedobs
- The observer instance to add
-
removeNodeObserver
Description copied from interface:EventModelEvaluator
Remove the given node observer instance for the specific node type. It will not be removed for any other requested node types. If the instance is not registered for the given node type ID, the request will be silently ignored.- Specified by:
removeNodeObserver
in interfaceEventModelEvaluator
- Parameters:
nodeType
- The type identifier of the node being observedobs
- The observer instance to remove
-
shutdown
public void shutdown()Description copied from interface:EventModelEvaluator
Shutdown the node manager now. If this is using any external resources it should remove those now as the entire application is about to die- Specified by:
shutdown
in interfaceEventModelEvaluator
-
setErrorReporter
public void setErrorReporter(org.j3d.util.ErrorReporter reporter) Description copied from interface:EventModelEvaluator
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 interfaceEventModelEvaluator
- Parameters:
reporter
- The instance to use or null
-
getLayerManager
Description copied from interface:EventModelEvaluator
Get the layer manager for the the layer ID.- Specified by:
getLayerManager
in interfaceEventModelEvaluator
- Parameters:
id
- a value >= 0 that is the ID of the layer to get- Returns:
- The layer manager for it
-
getVRMLClock
Description copied from interface:EventModelEvaluator
Get the VRMLClock instance in use by this evaluator.- Specified by:
getVRMLClock
in interfaceEventModelEvaluator
- Returns:
- A reference to the clock
-
addExternalView
Description copied from interface:EventModelEvaluator
Add an external view to the evaluator. A view can only be added once. If the view is added more than once, the second and subsequent calls are ignored.- Specified by:
addExternalView
in interfaceEventModelEvaluator
- Parameters:
view
- The new view to add
-
removeExternalView
Description copied from interface:EventModelEvaluator
Remove the external view from this evaluator. If the view is not currently registered, the request is silently ignored.- Specified by:
removeExternalView
in interfaceEventModelEvaluator
- Parameters:
view
- The new view to remove
-
setScene
Description copied from interface:EventModelEvaluator
Used to set the scene to the new content. Will automatically shutdown the old scene. Assumes a valid scene instance is passed. Also assumes that no clock ticks will be received during the setup phase.- Specified by:
setScene
in interfaceEventModelEvaluator
- Parameters:
scene
- The new scene instance to use.useView
- The initial viewpoint DEF name to bind to, Null means normal speced viewpoint.
-
changeViewpoint
Description copied from interface:EventModelEvaluator
Request that this viewpoint object is bound at the start of the next frame. This method should only be called by external users such as UI toolkits, etc., that need to synchronize the viewpoint change with rendering loop, but are not able to synchronize themselves because they exist on a different thread that cannot block.- Specified by:
changeViewpoint
in interfaceEventModelEvaluator
- Parameters:
vp
- The new viewpoint instance to bind to
-
clear
public void clear()Description copied from interface:EventModelEvaluator
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 interfaceEventModelEvaluator
-
evaluate
public void evaluate(long time) Description copied from interface:EventModelEvaluator
Run the event model for this frame now. This is a blocking call and does not return until the event model is complete for this frame. The time should be system clock time, not VRML time.- Specified by:
evaluate
in interfaceEventModelEvaluator
- Parameters:
time
- The timestamp of this frame to evaluate
-
setInitListener
Description copied from interface:EventModelEvaluator
Set the listener for intialisation information. Setting null will clear the current instance.- Specified by:
setInitListener
in interfaceEventModelEvaluator
- Parameters:
l
- The listener instance to set
-
getScriptManager
Description copied from interface:EventModelEvaluator
Get the script manager in use by the evaluator.- Specified by:
getScriptManager
in interfaceEventModelEvaluator
- Returns:
- The script manager implementation
-
getRouteManager
Description copied from interface:EventModelEvaluator
Get the route manager in use by the evaluator.- Specified by:
getRouteManager
in interfaceEventModelEvaluator
- Returns:
- The route manager implementation
-
getContentLoader
Description copied from interface:EventModelEvaluator
Get the content loader in use by the evaluator.- Specified by:
getContentLoader
in interfaceEventModelEvaluator
- Returns:
- The content loader implementation
-
getFrameStateManager
Description copied from interface:EventModelEvaluator
Get the frame state manager in use by the evaluator.- Specified by:
getFrameStateManager
in interfaceEventModelEvaluator
- Returns:
- The frame state manager implementation
-
getNodeManagers
Description copied from interface:EventModelEvaluator
Get the list of external node managers currently in use. If there are no registered managers, returns null.- Specified by:
getNodeManagers
in interfaceEventModelEvaluator
- Returns:
- An array of managers or null
-