Package org.xj3d.core.eventmodel
Interface SensorManager
- All Known Implementing Classes:
DefaultSensorManager
public interface SensorManager
An abstract representation of a class that would be responsible for
performing all the management and computations for environmental sensors.
It is expected that the manager will be implemented by each renderer as working out when sensors intersect and interact will require in-depth knowledge of the rendering API.
Because the sensor manager is a renderer-dependent implementation, it is
assumed that it will also function, or have the functionality for
representing the VRMLClock
interface.
- Version:
- $Revision: 1.2 $
- Author:
- Justin Couch
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a per-layer manager to the sensor manager.void
addSensors
(NodeArray sensors) Initialise new sensors that are just about to be added to the scene.void
addViewDependentNodes
(NodeArray nodes) Add view-dependent nodes that need to be updated each frame based on the user's position for rendering.void
clear()
Force clearing all state from this manager now.Get the VRMLClock instance in use by this sensor manager.void
loadScene
(BasicScene scene) Load the contents of this scene into the sensor manager.void
processUserInput
(int layerId, long time) Process the user input to the scene now.void
Remove this layer sensor manager from the system.void
removeSensors
(NodeArray sensors) Cleanup the given sensors and remove them from the list of processing to be done each frame.void
Remove these view-dependent nodes from the scene.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
setInputManager
(InputDeviceManager manager) Set the user input manager to be used by this implementation.void
Set the manager responsible for handling key device sensor.void
setOriginManager
(OriginManager manager) Set the manager for handling dynamic origin calculation.void
setPickingManager
(PickingManager picker) Set the manager that is responsible for handling picking sensors.void
setRenderOrder
(int[] order, int numValid) Set the rendering order for all the layers.void
unloadScene
(BasicScene scene) UnLoad the contents of this scene into the sensor manager.
-
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
-
setInputManager
Set the user input manager to be used by this implementation. User input is generally independent of the main render loop. A value of null may be used to clear the currently set manager and make the handler not process user input.- Parameters:
manager
- The buffer instance to use or null
-
setKeyDeviceSensorManager
Set the manager responsible for handling key device sensor. A value of null may be used to clear the currently set manager and make the handler not process user input.- Parameters:
manager
- Reference to the manager instance to use or null
-
setPickingManager
Set the manager that is responsible for handling picking sensors.- Parameters:
picker
- Reference to the manager instance to use or null
-
setOriginManager
Set the manager for handling dynamic origin calculation.- Parameters:
manager
- Reference to the manager instance to use or null
-
addLayerSensorManager
Add a per-layer manager to the sensor manager. Managers are added once, and calling a manager for a layer ID will replace any manager at that current ID.- Parameters:
mgr
- The layer manager instance to add
-
removeLayerSensorManager
Remove this layer sensor manager from the system.- Parameters:
mgr
- The layer manager instance to remove
-
getVRMLClock
VRMLClock getVRMLClock()Get the VRMLClock instance in use by this sensor manager.- Returns:
- A reference to the clock
-
setRenderOrder
void setRenderOrder(int[] order, int numValid) Set the rendering order for all the layers. This is so that input handling, such as drag sensors are evaluated in the correct order, from front to back.- Parameters:
order
- The index of the list of rendered layers idsnumValid
- The number of valid items in the order list
-
processUserInput
void processUserInput(int layerId, long time) Process the user input to the scene now. User input is the mouse and keyboard processing that would be used to send events to Key/StringSensors and perform navigation and picking duties as well as adjust items like billboards and LODs.- Parameters:
layerId
- The ID of the layer that is active for navigationtime
- The clock time, in Java coordinates, not VRML
-
removeSensors
Cleanup the given sensors and remove them from the list of processing to be done each frame. The list will be created elsewhere (typically the per-frame behaviour as a result of the event model processing) and passed to this manager. The given list will contain instances of VRMLSensorNodeType. There will be no protos as this is just the raw sensor nodes internally.- Parameters:
sensors
- The list of sensors to process
-
addSensors
Initialise new sensors that are just about to be added to the scene. These sensors should also be added to the processing list for dealing with user input. Note that the adding process should only send the initial events, but should not do any processing for environmental effects like collisions or proximity sensing. It is assumed these will be first processed in the next render pass.- Parameters:
sensors
- The list of sensors to process
-
addViewDependentNodes
Add view-dependent nodes that need to be updated each frame based on the user's position for rendering. These are not sensors nodes, but others like Billboard, LOD etc.- Parameters:
nodes
- List of nodes that need to be processed
-
removeViewDependentNodes
Remove these view-dependent nodes from the scene.- Parameters:
nodes
- List of nodes to be removed
-
loadScene
Load the contents of this scene into the sensor manager. The call does not need to be recursive as it is expected the external caller will work with this.- Parameters:
scene
- The scene to source data from
-
unloadScene
UnLoad the contents of this scene into the sensor manager. The call does not need to be recursive as it is expected the external caller will work with this.- Parameters:
scene
- The scene to source data from
-
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.
-