Interface NodeManager
- All Known Subinterfaces:
NetworkManager
- All Known Implementing Classes:
DefaultHumanoidManager
,DefaultNetworkManager
,DefaultParticleSystemManager
,DefaultRigidBodyPhysicsManager
VRML and X3D have a collection of nodes that require some sort of per-frame
management that is part of the event loop. This may be as simple as
synchronising with external devices or the network, or as complex as a
high-detail terrain renderer. This interface allows the user to provide an
abstracted way of registering new capabilities with the
EventModelEvaluator
without needing
edit and recompile the entire Xj3D codebase.
An implementation of this interface may handle pre event model updates (eg sensor-style nodes), post event model updates (eg particle systems) or a both at the same time. Methods are used to indicate which of these classifications the manager wants to perform. This is asked once at the start of the browser's lifetime. It is not possible to change these settings after startup, even if there are no nodes of the desired type in the system.
- Version:
- $Revision: 1.2 $
- Author:
- Justin Couch
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addManagedNode
(VRMLNodeType node) Add a node of the require type to be managed.void
clear()
Force clearing all currently managed nodes from this manager now.boolean
Ask whether this manager needs to be run after the event model has been evaluated for this frame.boolean
Ask whether this manager needs to be run before the event model has been evaluated for this frame.void
executePostEventModel
(long time) Run the post-event modeling for this frame now.void
executePreEventModel
(long time) Run the pre-event modeling for this frame now.int[]
Get the list of node type IDs that this manager wants to handle.Get the list of component names that this manager would normally manage.boolean
Initialise the node manager now with any per-manager setup that is needed.void
Remove a node of the require type to be managed.void
Reset the local time zero for the manager.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
setVRMLClock
(VRMLClock clk) Set the VRMLClock instance in use by this manager.void
shutdown()
Shutdown the node manager now.
-
Method Details
-
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
-
getSupportedComponents
ComponentInfo[] getSupportedComponents()Get the list of component names that this manager would normally manage. The component definition is assumed to be the same across all versions of the specifications that the browser supports. The level of the component is assumed to be the lowest level supported (ie if the given level fails, then levels above this cannot be supported, but those below can still be).Mostly this is used for when initialization fails and we wish to disable support for loading of nodes in that component.
- Returns:
- The collection of components that this manager supports
-
setVRMLClock
Set the VRMLClock instance in use by this manager.- Parameters:
clk
- A reference to the clock to use
-
getManagedNodeTypes
int[] getManagedNodeTypes()Get the list of node type IDs that this manager wants to handle. These should be the constants fromTypeConstants
.- Returns:
- A list of managed node identifiers
-
evaluatePreEventModel
boolean evaluatePreEventModel()Ask whether this manager needs to be run before the event model has been evaluated for this frame.- Returns:
- true if this is to be run pre-event model, false otherwise
-
evaluatePostEventModel
boolean evaluatePostEventModel()Ask whether this manager needs to be run after the event model has been evaluated for this frame.- Returns:
- true if this is to be run post event model, false otherwise
-
addManagedNode
Add a node of the require type to be managed.- Parameters:
node
- The node instance to add for management
-
removeManagedNode
Remove a node of the require type to be managed.- Parameters:
node
- The node instance to add for management
-
executePreEventModel
void executePreEventModel(long time) Run the pre-event modeling 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
-
executePostEventModel
void executePostEventModel(long time) Run the post-event modeling 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
-
resetTimeZero
void resetTimeZero()Reset the local time zero for the manager. This is called when a new root world has been loaded and any manager that needs to rely on delta time from the start of the world loading can reset it's local reference from the passed inVRMLClock
instance. -
clear
void clear()Force clearing all currently managed nodes 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. -
initialize
boolean initialize()Initialise the node manager now with any per-manager setup that is needed. If this returns false, then the node manager is assumed to have failed some part of the setup and will be removed from the system- Returns:
- true if initialization was successful
-
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
-