Package org.xj3d.core.eventmodel
Interface LayerManager
public interface LayerManager
An abstract representation of a class that would be responsible for
performing management of a single layer.
The manager is responsible for all input and sensor handling for this layer instance. Sensors and other interactions can be enabled on a per-layer basis. Typically, for any scene, only one layer is the focus for navigation input.
- Version:
- $Revision: 1.9 $
- Author:
- Justin Couch
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The layer contains a viewport that is configurable to use either fixed or proportional size on each dimension.static final int
The layer contains a viewport that takes up a fixed pixel size.static final int
The layer contains a viewport that takes up the full window space.static final int
The layer contains a viewport that takes up a percentage of the window.static final int
The layer contains a viewport that is currently undefined due to externproto resolution. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a listener for navigation state changes.void
Add a listener for sensor state changes.void
Add a listener for viewpoint status changes.void
clear()
Force clearing all currently managed nodes from this manager now.void
fitToWorld
(boolean animated) Move the user's location to see the entire world in this layer.getBindableManager
(int type) Get the bindable node manager for the given node type.int
Get the currently set rendering style.void
getUserPosition
(javax.vecmath.Vector3f pos, javax.vecmath.AxisAngle4f ori) Get the user's location and orientation.Get the Viewport node that this layer uses.int
Check to see if this is an unmanaged size layer.void
Perform the initial bind for a new scene.void
initialise
(SensorManager sensors) Complete the initialization of the layer manager now.boolean
Check to see if this is the active navigation layer.void
Remove a navigation state listener.void
Remove a sensor state listener.void
Remove a viewpoint state listener.void
setActiveNavigationLayer
(boolean state) Enable or disable this layer to be currently navigable layer.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
setHardwareFOV
(float fov) Override the file field of view values with a value that suits the given output device.void
setLayerId
(int id) Set or reset the layer ID to the new ID value.void
setManagedLayer
(VRMLLayerNodeType layer) Set the contents that this layer manages the specific layer instance provided.void
Set the contents that this layer manages to be the ungrouped nodes of the scene.boolean
setNavigationMode
(String mode) Set the desired navigation mode.void
setRenderingStyle
(int style) Change the rendering style that the browser should currently be using for all layers.void
setSpecVersion
(int major, int minor) Set the specification version that should be handled by this manager.void
setStereoEnabled
(boolean enabled) Set whether stereo is enabled for all layers.void
shutdown()
Shutdown the node manager now.void
Update the viewing matrix.
-
Field Details
-
VIEWPORT_UNDEFINED
static final int VIEWPORT_UNDEFINEDThe layer contains a viewport that is currently undefined due to externproto resolution. In this case, treat the viewport as having zero width and height - ie invisible. This is defined to be the same value asVRMLViewportNodeType.VIEWPORT_UNDEFINED
- See Also:
-
VIEWPORT_FULLWINDOW
static final int VIEWPORT_FULLWINDOWThe layer contains a viewport that takes up the full window space. This is defined to be the same value asVRMLViewportNodeType.VIEWPORT_FULLWINDOW
- See Also:
-
VIEWPORT_PROPORTIONAL
static final int VIEWPORT_PROPORTIONALThe layer contains a viewport that takes up a percentage of the window. This is defined to be the same value asVRMLViewportNodeType.VIEWPORT_PROPORTIONAL
- See Also:
-
VIEWPORT_FIXED
static final int VIEWPORT_FIXEDThe layer contains a viewport that takes up a fixed pixel size. This is defined to be the same value asVRMLViewportNodeType.VIEWPORT_FIXED
- See Also:
-
VIEWPORT_CUSTOM
static final int VIEWPORT_CUSTOMThe layer contains a viewport that is configurable to use either fixed or proportional size on each dimension. This is defined to be the same value asVRMLViewportNodeType.VIEWPORT_CUSTOM
- See Also:
-
-
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
-
initialise
Complete the initialization of the layer manager now.- Parameters:
sensors
- The sensor manager to start with from the global list
-
setLayerId
void setLayerId(int id) Set or reset the layer ID to the new ID value.- Parameters:
id
- A non-negative ID for the layer
-
setSpecVersion
void setSpecVersion(int major, int minor) Set the specification version that should be handled by this manager. This is needed so that the correct version of the default bindables are instantiated before the rest of the world loads. For example, the default nav type for VRML is different to X3D, so this makes sure all the right spec stuff is catered for.- Parameters:
major
- The spec major version numberminor
- The spec minor version number
-
getUserPosition
void getUserPosition(javax.vecmath.Vector3f pos, javax.vecmath.AxisAngle4f ori) Get the user's location and orientation. This will use the viewpoint bound in the active layer.- Parameters:
pos
- The current user positionori
- The current user orientation
-
fitToWorld
void fitToWorld(boolean animated) Move the user's location to see the entire world in this layer. Change the users orientation to look at the center of the world.- Parameters:
animated
- Should the transition be animated. Defaults to FALSE.
-
setManagedNodes
Set the contents that this layer manages to be the ungrouped nodes of the scene. The code should take all the children nodes from this node that are not part of a layer and render them as this layer.- Parameters:
root
- The root of the world to handle
-
setManagedLayer
Set the contents that this layer manages the specific layer instance provided.- Parameters:
layer
- The root of the layer to handle
-
setHardwareFOV
void setHardwareFOV(float fov) Override the file field of view values with a value that suits the given output device. A value of 0 = no, otherwise use this instead of content- Parameters:
fov
- The fov in degrees.
-
setStereoEnabled
void setStereoEnabled(boolean enabled) Set whether stereo is enabled for all layers.- Parameters:
enabled
-
-
setRenderingStyle
Change the rendering style that the browser should currently be using for all layers. Various options are available based on the constants defined in this interface.- Parameters:
style
- One of the RENDER_* constants from LayerRenderingManager- Throws:
IllegalArgumentException
- A style constant that is not recognized by the implementation was provided
-
getRenderingStyle
int getRenderingStyle()Get the currently set rendering style. The default style is RENDER_SHADED.- Returns:
- one of the RENDER_ constants from LayerRenderingManager
-
initialBind
void initialBind()Perform the initial bind for a new scene. This is typically called some time just after the clear() method with a new scene. This will automatically reset the current navigation state for this layer to be inactive, even if it was previously active. -
getBindableManager
Get the bindable node manager for the given node type. If the node type does not have a bindable manager for it, one will be created.- Parameters:
type
- The type constant of the node type for the manager- Returns:
- The bindable manager for it
- See Also:
-
getViewportType
int getViewportType()Check to see if this is an unmanaged size layer. A layer that has no specific viewport set, or a percentage size.- Returns:
- One of the VIEWPORT_* constants
-
getViewport
VRMLViewportNodeType getViewport()Get the Viewport node that this layer uses. If the layer does not have a viewport set, then it returns null. The value is the real X3DViewportNode instance stripped from any surrounding proto shells etc.- Returns:
- The current viewport node instance used by the layer
-
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 -
updateViewMatrix
void updateViewMatrix()Update the viewing matrix. Call this when you want the LayerManager to update the viewing matrix. Typically after all user input and events have resolved. -
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. Everything also includes all the currently registered listener instances. -
addSensorStatusListener
Add a listener for sensor state changes. A listener can only be added once. Duplicate requests are ignored.- Parameters:
l
- The listener to add
-
removeSensorStatusListener
Remove a sensor state listener. If the reference is null or not known, the request is silently ignored.- Parameters:
l
- The listener to remove
-
addViewpointStatusListener
Add a listener for viewpoint status changes. A listener can only be added once. Duplicate requests are ignored.- Parameters:
l
- The listener to add
-
removeViewpointStatusListener
Remove a viewpoint state listener. If the reference is null or not known, the request is silently ignored.- Parameters:
l
- The listener to remove
-