Package org.xj3d.core.eventmodel
Interface LayerSensorManager
- All Known Implementing Classes:
BaseLayerSensorManager
,DefaultLayerSensorManager
public interface LayerSensorManager
An abstract representation of a per-layer sensor manager supplement to
the main sensor manager.
The main sensor manager can handle most of the common code, but certain sections need to be handled in a per-layer manner. For example visibility sensors have to be picked based on the layer that they're in and the viewpoint they current have in that layer. This interface is registered with the sensor manager for processing this per-layer information.
- Version:
- $Revision: 1.3 $
- Author:
- Justin Couch
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.boolean
See if this layer is currently pickable.int
Get the ID of the layer this sensor manager works with.boolean
Get the currently set navigation state.Get the handler for user input.void
loadScene
(BasicScene scene) Load the contents of this scene into the sensor manager.boolean
processUserInput
(long time) Process the user input to the scene now.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
setIsPickable
(boolean val) Set whether this layer is currently pickable.void
setNavigationEnabled
(boolean state) Enable or disable navigation processing sub-section of the user input processing.void
setNavigationStacks
(BindableNodeManager vp, BindableNodeManager nav, BindableNodeManager back, BindableNodeManager fog) Set the bindable stacks used for viewpoint and navigation nodes.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
setVRMLClock
(VRMLClock clk) Set the VRML clock instance that we are using so that we can set the bind time information for nodes that require it.void
unloadScene
(BasicScene scene) UnLoad the contents of this scene into the sensor manager.void
Update the viewing matrix.
-
Method Details
-
getLayerId
int getLayerId()Get the ID of the layer this sensor manager works with. The ID is the rendering order, starting from 0. Once set, this shouldn't change.- Returns:
- the ID of the layer
-
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
-
setVRMLClock
Set the VRML clock instance that we are using so that we can set the bind time information for nodes that require it. A value of null can be used to clear the current clock instance.- Parameters:
clk
- The new clock to set
-
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
-
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
-
processUserInput
boolean processUserInput(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:
time
- The clock time, in Java coordinates, not VRML- Returns:
- true if the user input was processed and performed an action for this layer
-
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
-
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
-
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. -
updateViewMatrix
void updateViewMatrix()Update the viewing matrix. Call this when you want the SensorManager to update the viewing matrix. Typically after all user input and events have resolved. -
getUserInputHandler
UserInputHandler getUserInputHandler()Get the handler for user input.- Returns:
- The user input handler
-
getIsPickable
boolean getIsPickable()See if this layer is currently pickable.- Returns:
- true if the contents of this layer can be picked
-
setIsPickable
void setIsPickable(boolean val) Set whether this layer is currently pickable.- Parameters:
val
- Whether the layer is pickable
-