Package org.xj3d.core.eventmodel
Interface EventModelEvaluator
- All Known Implementing Classes:
DefaultEventModelEvaluator
public interface EventModelEvaluator
An abstract representation of a class that would be responsible for
performing all the event model computations and organisation on a per-frame
basis.
This class allows extensibility of the event model implementation by both providing an abstract view of the event model, but also allowing individual node types to have their own managers that are dealt with by the event model.
- Version:
- $Revision: 1.2 $
- Author:
- Justin Couch
-
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.
-
Method Details
-
initialize
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.- 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
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.- Parameters:
nodeType
- The type identifier of the node being observedobs
- The observer instance to add
-
removeNodeObserver
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.- Parameters:
nodeType
- The type identifier of the node being observedobs
- The observer instance to remove
-
shutdown
void shutdown()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 -
setErrorReporter
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.- Parameters:
reporter
- The instance to use or null
-
addExternalView
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.- Parameters:
view
- The new view to add
-
removeExternalView
Remove the external view from this evaluator. If the view is not currently registered, the request is silently ignored.- Parameters:
view
- The new view to remove
-
getLayerManager
Get the layer manager for the the layer ID.- Parameters:
id
- a value >= 0 that is the ID of the layer to get- Returns:
- The layer manager for it
-
getVRMLClock
VRMLClock getVRMLClock()Get the VRMLClock instance in use by this evaluator.- Returns:
- A reference to the clock
-
evaluate
void evaluate(long time) 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.- Parameters:
time
- The timestamp of this frame to evaluate
-
setScene
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.- Parameters:
scene
- The new scene instance to use.useView
- The initial viewpoint DEF name to bind to, Null means normal speced viewpoint.
-
changeViewpoint
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.- Parameters:
vp
- The new viewpoint instance to bind to
-
clear
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. -
getScriptManager
ScriptManager getScriptManager()Get the script manager in use by the evaluator.- Returns:
- The script manager implementation
-
getRouteManager
RouteManager getRouteManager()Get the route manager in use by the evaluator.- Returns:
- The route manager implementation
-
getContentLoader
ContentLoadManager getContentLoader()Get the content loader in use by the evaluator.- Returns:
- The content loader implementation
-
getFrameStateManager
FrameStateManager getFrameStateManager()Get the frame state manager in use by the evaluator.- Returns:
- The frame state manager implementation
-
getNodeManagers
NodeManager[] getNodeManagers()Get the list of external node managers currently in use. If there are no registered managers, returns null.- Returns:
- An array of managers or null
-
setInitListener
Set the listener for intialisation information. Setting null will clear the current instance.- Parameters:
l
- The listener instance to set
-