Xj3D VRML/X3D Code API

org.web3d.vrml.renderer.common.input
Class BaseSensorManager

java.lang.Object
  extended byorg.web3d.vrml.renderer.common.input.BaseSensorManager
All Implemented Interfaces:
SensorManager
Direct Known Subclasses:
DefaultSensorManager, DefaultSensorManager

public abstract class BaseSensorManager
extends java.lang.Object
implements SensorManager

Default implementation of the SensorManager interface for all renderers.

Version:
$Revision: 1.3 $
Author:
Alan Hudson

Field Summary
protected  boolean backgroundGroundChanged
          Flag to say the background ground values changed
protected  org.web3d.vrml.renderer.common.input.BaseSensorManager.BackgroundListener backgroundListener
          Listener instance for dealing with the current background node
protected  boolean backgroundSkyChanged
          Flag to say the background sky values changed
protected  BindableNodeManager backgroundStack
          Bindable stack for backgrounds
protected  VRMLViewpointNodeType currentViewpoint
          The bound viewpoint used last frame
protected static int DEFAULT_EVENT_SIZE
          Default size of the event arrays
protected  ErrorReporter errorReporter
          Reporter instance for handing out errors
protected  boolean fogDetailsChanged
          Flag to say fog color or range value changed.
protected  org.web3d.vrml.renderer.common.input.BaseSensorManager.FogListener fogListener
          Listener instance for dealing with the current fog node
protected  BindableNodeManager fogStack
          Bindable stack for fog
protected  boolean fogTypeChanged
          Flag to say the fog type
protected  boolean initialised
          Flag to say whether this class has completed its initialisation
protected  UserInputHandler inputHandler
          Input manager for doing the user interaction from the input devices This can be used for navigation and various pointing device sensor implementations.
protected  InputDeviceManager inputManager
          Buffer for input events
protected  float invWorldScale
           
protected  java.awt.event.KeyEvent[] keyEvents
          holder of key events each frame
protected  KeyDeviceSensorManager keySensors
          Manager of key devices
protected  boolean navigationEnabled
          Flag to say if navigation handling should be disabled
protected  BindableNodeManager navInfoStack
          Bindable stack for navigationInfo nodes
protected  int numAreaListeners
          The number of proximity sensors
protected  int numPointingDeviceSensors
          The number of pointing device sensors
protected  int numVisibilityListeners
          The number of visibility sensors
protected  PickingManager pickManager
          Picking manager for intersection testing
protected  TimeSensorManager timeSensors
          Manager of TimeSensor nodes
protected  BindableNodeManager viewStack
          Bindable stack for viewpoints
protected  float worldScale
          The world scale
 
Constructor Summary
BaseSensorManager()
          Create a new default instance of the manager.
 
Method Summary
 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.
protected  void clearChangeFlags()
          Clear the flags currently set because the listener has changed or been processed.
 boolean getNavigationEnabled()
          Get the currently set navigation state.
 UserInputHandler getUserInputHandler()
          Get the user input handler.
 VRMLClock getVRMLClock()
          Get the VRMLClock instance in use by this sensor manager.
protected  void initialise()
          One-shot to initialise the internals structures once the event model has started to kick in.
 void loadScene(BasicScene scene)
          Load the contents of this scene into the sensor manager.
 void removeSensors(NodeArray sensors)
          Cleanup the given sensors and remove them from the list of processing to be done each frame.
 void removeViewDependentNodes(NodeArray nodes)
          Remove these view-dependent nodes from the scene.
 void setErrorReporter(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 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 setPickingManager(PickingManager picker)
          Set the manager that is responsible for handling picking sensors.
 void setTerrainSectorManager(TerrainSectorManager tsm)
          Set the terrain sector manager.
 void unloadScene(BasicScene scene)
          UnLoad the contents of this scene into the sensor manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.web3d.vrml.nodes.runtime.SensorManager
processUserInput, updateViewMatrix
 

Field Detail

DEFAULT_EVENT_SIZE

protected static final int DEFAULT_EVENT_SIZE
Default size of the event arrays

See Also:
Constant Field Values

initialised

protected boolean initialised
Flag to say whether this class has completed its initialisation


timeSensors

protected TimeSensorManager timeSensors
Manager of TimeSensor nodes


keySensors

protected KeyDeviceSensorManager keySensors
Manager of key devices


pickManager

protected PickingManager pickManager
Picking manager for intersection testing


keyEvents

protected java.awt.event.KeyEvent[] keyEvents
holder of key events each frame


inputManager

protected InputDeviceManager inputManager
Buffer for input events


errorReporter

protected ErrorReporter errorReporter
Reporter instance for handing out errors


inputHandler

protected UserInputHandler inputHandler
Input manager for doing the user interaction from the input devices This can be used for navigation and various pointing device sensor implementations.


viewStack

protected BindableNodeManager viewStack
Bindable stack for viewpoints


navInfoStack

protected BindableNodeManager navInfoStack
Bindable stack for navigationInfo nodes


backgroundStack

protected BindableNodeManager backgroundStack
Bindable stack for backgrounds


fogStack

protected BindableNodeManager fogStack
Bindable stack for fog


currentViewpoint

protected VRMLViewpointNodeType currentViewpoint
The bound viewpoint used last frame


navigationEnabled

protected boolean navigationEnabled
Flag to say if navigation handling should be disabled


fogTypeChanged

protected boolean fogTypeChanged
Flag to say the fog type


fogDetailsChanged

protected boolean fogDetailsChanged
Flag to say fog color or range value changed.


backgroundSkyChanged

protected boolean backgroundSkyChanged
Flag to say the background sky values changed


backgroundGroundChanged

protected boolean backgroundGroundChanged
Flag to say the background ground values changed


backgroundListener

protected org.web3d.vrml.renderer.common.input.BaseSensorManager.BackgroundListener backgroundListener
Listener instance for dealing with the current background node


fogListener

protected org.web3d.vrml.renderer.common.input.BaseSensorManager.FogListener fogListener
Listener instance for dealing with the current fog node


worldScale

protected float worldScale
The world scale


invWorldScale

protected float invWorldScale

numVisibilityListeners

protected int numVisibilityListeners
The number of visibility sensors


numAreaListeners

protected int numAreaListeners
The number of proximity sensors


numPointingDeviceSensors

protected int numPointingDeviceSensors
The number of pointing device sensors

Constructor Detail

BaseSensorManager

public BaseSensorManager()
Create a new default instance of the manager. It will only register a handler for TimeSensors. Anything other than that will require the end user code to register an appropriate manager.

Method Detail

setErrorReporter

public void setErrorReporter(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.

Specified by:
setErrorReporter in interface SensorManager
Parameters:
reporter - The instance to use or null

getUserInputHandler

public UserInputHandler getUserInputHandler()
Get the user input handler. Exposed so that bindable node management can interact with the navigation system.

Specified by:
getUserInputHandler in interface SensorManager
Returns:
The user input handler instance in use

getNavigationEnabled

public boolean getNavigationEnabled()
Get the currently set navigation state.

Returns:
true for the current state

setNavigationEnabled

public void setNavigationEnabled(boolean state)
Enable or disable navigation processing sub-section of the user input processing. By default the navigation processing is enabled.

Parameters:
state - true to enable navigation

setTerrainSectorManager

public void setTerrainSectorManager(TerrainSectorManager tsm)
Set the terrain sector manager.

Specified by:
setTerrainSectorManager in interface SensorManager
Parameters:
tsm - The sector manager.

setInputManager

public void setInputManager(InputDeviceManager manager)
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.

Specified by:
setInputManager in interface SensorManager
Parameters:
manager - The input manager instance to use

setPickingManager

public void setPickingManager(PickingManager picker)
Set the manager that is responsible for handling picking sensors.

Specified by:
setPickingManager in interface SensorManager
Parameters:
picker - Reference to the manager instance to use or null

setNavigationStacks

public void setNavigationStacks(BindableNodeManager vp,
                                BindableNodeManager nav,
                                BindableNodeManager back,
                                BindableNodeManager fog)
Set the bindable stacks used for viewpoint and navigation nodes. Used by the sensor for computing navigation and sensor information.

Specified by:
setNavigationStacks in interface SensorManager
Parameters:
vp - The stack for viewpoints
nav - The stack for navigationInfo nodes
back - The stack for background nodes
fog - The stack for fog nodes

removeSensors

public void removeSensors(NodeArray sensors)
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.

Specified by:
removeSensors in interface SensorManager
Parameters:
sensors - The list of sensors to process

addSensors

public void addSensors(NodeArray sensors)
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.

Specified by:
addSensors in interface SensorManager
Parameters:
sensors - The list of sensors to process

addViewDependentNodes

public void addViewDependentNodes(NodeArray nodes)
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.

Specified by:
addViewDependentNodes in interface SensorManager
Parameters:
nodes - List of nodes that need to be processed

removeViewDependentNodes

public void removeViewDependentNodes(NodeArray nodes)
Remove these view-dependent nodes from the scene.

Specified by:
removeViewDependentNodes in interface SensorManager
Parameters:
nodes - List of nodes to be removed

loadScene

public void loadScene(BasicScene scene)
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.

Specified by:
loadScene in interface SensorManager
Parameters:
scene - The scene to source data from

unloadScene

public void unloadScene(BasicScene scene)
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.

Specified by:
unloadScene in interface SensorManager
Parameters:
scene - The scene to source data from

clear

public 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.

Specified by:
clear in interface SensorManager

getVRMLClock

public VRMLClock getVRMLClock()
Get the VRMLClock instance in use by this sensor manager.

Specified by:
getVRMLClock in interface SensorManager
Returns:
A reference to the clock

initialise

protected void initialise()
One-shot to initialise the internals structures once the event model has started to kick in.


clearChangeFlags

protected void clearChangeFlags()
Clear the flags currently set because the listener has changed or been processed.


Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium