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 TypeMethodDescriptionvoidaddExternalView(ExternalView view) Add an external view to the evaluator.voidaddNodeObserver(int nodeType, NodeObserver obs) Add an observer for a specific node type.voidRequest that this viewpoint object is bound at the start of the next frame.voidclear()Force clearing all state from this manager now.voidevaluate(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.voidinitialize(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.voidRemove the external view from this evaluator.voidremoveNodeObserver(int nodeType, NodeObserver obs) Remove the given node observer instance for the specific node type.voidsetErrorReporter(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.voidSet the listener for intialisation information.voidUsed to set the scene to the new content.voidshutdown()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:EventModelEvaluatorInitialise the evaluator with the given managers.- Specified by:
initializein 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:EventModelEvaluatorAdd 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:
addNodeObserverin interfaceEventModelEvaluator- Parameters:
nodeType- The type identifier of the node being observedobs- The observer instance to add
-
removeNodeObserver
Description copied from interface:EventModelEvaluatorRemove 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:
removeNodeObserverin interfaceEventModelEvaluator- Parameters:
nodeType- The type identifier of the node being observedobs- The observer instance to remove
-
shutdown
public void shutdown()Description copied from interface:EventModelEvaluatorShutdown 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:
shutdownin interfaceEventModelEvaluator
-
setErrorReporter
public void setErrorReporter(org.j3d.util.ErrorReporter reporter) Description copied from interface:EventModelEvaluatorRegister 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:
setErrorReporterin interfaceEventModelEvaluator- Parameters:
reporter- The instance to use or null
-
getLayerManager
Description copied from interface:EventModelEvaluatorGet the layer manager for the the layer ID.- Specified by:
getLayerManagerin 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:EventModelEvaluatorGet the VRMLClock instance in use by this evaluator.- Specified by:
getVRMLClockin interfaceEventModelEvaluator- Returns:
- A reference to the clock
-
addExternalView
Description copied from interface:EventModelEvaluatorAdd 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:
addExternalViewin interfaceEventModelEvaluator- Parameters:
view- The new view to add
-
removeExternalView
Description copied from interface:EventModelEvaluatorRemove the external view from this evaluator. If the view is not currently registered, the request is silently ignored.- Specified by:
removeExternalViewin interfaceEventModelEvaluator- Parameters:
view- The new view to remove
-
setScene
Description copied from interface:EventModelEvaluatorUsed 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:
setScenein 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:EventModelEvaluatorRequest 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:
changeViewpointin interfaceEventModelEvaluator- Parameters:
vp- The new viewpoint instance to bind to
-
clear
public void clear()Description copied from interface:EventModelEvaluatorForce 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:
clearin interfaceEventModelEvaluator
-
evaluate
public void evaluate(long time) Description copied from interface:EventModelEvaluatorRun 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:
evaluatein interfaceEventModelEvaluator- Parameters:
time- The timestamp of this frame to evaluate
-
setInitListener
Description copied from interface:EventModelEvaluatorSet the listener for intialisation information. Setting null will clear the current instance.- Specified by:
setInitListenerin interfaceEventModelEvaluator- Parameters:
l- The listener instance to set
-
getScriptManager
Description copied from interface:EventModelEvaluatorGet the script manager in use by the evaluator.- Specified by:
getScriptManagerin interfaceEventModelEvaluator- Returns:
- The script manager implementation
-
getRouteManager
Description copied from interface:EventModelEvaluatorGet the route manager in use by the evaluator.- Specified by:
getRouteManagerin interfaceEventModelEvaluator- Returns:
- The route manager implementation
-
getContentLoader
Description copied from interface:EventModelEvaluatorGet the content loader in use by the evaluator.- Specified by:
getContentLoaderin interfaceEventModelEvaluator- Returns:
- The content loader implementation
-
getFrameStateManager
Description copied from interface:EventModelEvaluatorGet the frame state manager in use by the evaluator.- Specified by:
getFrameStateManagerin interfaceEventModelEvaluator- Returns:
- The frame state manager implementation
-
getNodeManagers
Description copied from interface:EventModelEvaluatorGet the list of external node managers currently in use. If there are no registered managers, returns null.- Specified by:
getNodeManagersin interfaceEventModelEvaluator- Returns:
- An array of managers or null
-