Xj3D VRML/X3D Code API

org.web3d.browser
Interface BrowserCore

All Known Implementing Classes:
NRUniverse, OGLVRMLGroup, OGLVRMLUniverse, VRMLBranchGroup, VRMLUniverse

public interface BrowserCore

Abstract representation of the core requirements of a browser implementation regardless of the renderer used.

Version:
$Revision: 1.10 $
Author:
Justin Couch

Field Summary
static java.lang.String JAVA3D_ID
          ID String of the Java3D renderer
static int JAVA3D_RENDERER
          Definition of the Java3D renderer
static java.lang.String MOBILE_ID
          ID String of the mobile renderer
static int MOBILE_RENDERER
          Definition of the OpenGL mobile device renderer
static java.lang.String NULL_ID
          ID String of the null renderer
static int NULL_RENDERER
          Definition of the null renderer
static java.lang.String OPENGL_ID
          ID String of the OpenGL renderer
static int OPENGL_RENDERER
          Definition of the OpenGL immersive renderer
 
Method Summary
 void addCoreListener(BrowserCoreListener l)
          Add a listener for browser core events.
 void addNavigationStateListener(NavigationStateListener l)
          Add a listener for navigation state changes.
 void addSensorStatusListener(SensorStatusListener l)
          Add a listener for sensor state changes.
 void addViewpointStatusListener(ViewpointStatusListener l)
          Add a listener for viewpoint status changes.
 void dispose()
          Notify the core that it can dispose all resources.
 void fitToWorld(boolean animated)
          Move the user's location to see the entire world.
 float getCurrentFrameRate()
          Get the current frame rate of the browser in frames per second.
 float getCurrentSpeed()
          Get the current velocity of the bound viewpoint in meters per second.
 java.util.Map getDEFMappings()
          Get the mapping of DEF names to the node instances that they represent.
 java.lang.String getDescription()
          Get the description string currently used by the world.
 java.lang.String getIDString()
          Get the ID string for this renderer.
 int getRendererType()
          Get the type of renderer that implements the browser core.
 VRMLClock getVRMLClock()
          Get the clock instance in use by the core.
 VRMLExecutionSpace getWorldExecutionSpace()
          Convenience method to ask for the execution space that the world is currently operating in.
 java.lang.String getWorldURL()
          Get the fully qualified URL of the currently loaded world.
 void removeCoreListener(BrowserCoreListener l)
          Remove a browser core listener.
 void removeNavigationStateListener(NavigationStateListener l)
          Remove a navigation state listener.
 void removeSensorStatusListener(SensorStatusListener l)
          Remove a sensor state listener.
 void removeViewpointStatusListener(ViewpointStatusListener l)
          Remove a viewpoint state listener.
 void sendURLFailEvent(java.lang.String msg)
          Send to the core listeners the error message that a URL failed to load for some reason.
 void setDescription(java.lang.String desc)
          Set the description of the current world.
 void setEventModelStatusListener(EventModelStatusListener l)
          Set the eventModelStatus listener.
 void setLastRenderTime(long lastTime)
          Set the last frame render time used for FPS calculations.
 void setNavigationMode(java.lang.String mode)
          Set the navigation mode.
 void setScene(VRMLScene scene, java.lang.String viewpoint)
          Set the scene to use within this universe with the specifically named viewpoint.
 

Field Detail

JAVA3D_RENDERER

public static final int JAVA3D_RENDERER
Definition of the Java3D renderer

See Also:
Constant Field Values

JAVA3D_ID

public static final java.lang.String JAVA3D_ID
ID String of the Java3D renderer

See Also:
Constant Field Values

NULL_RENDERER

public static final int NULL_RENDERER
Definition of the null renderer

See Also:
Constant Field Values

NULL_ID

public static final java.lang.String NULL_ID
ID String of the null renderer

See Also:
Constant Field Values

OPENGL_RENDERER

public static final int OPENGL_RENDERER
Definition of the OpenGL immersive renderer

See Also:
Constant Field Values

OPENGL_ID

public static final java.lang.String OPENGL_ID
ID String of the OpenGL renderer

See Also:
Constant Field Values

MOBILE_RENDERER

public static final int MOBILE_RENDERER
Definition of the OpenGL mobile device renderer

See Also:
Constant Field Values

MOBILE_ID

public static final java.lang.String MOBILE_ID
ID String of the mobile renderer

See Also:
Constant Field Values
Method Detail

getRendererType

public int getRendererType()
Get the type of renderer that implements the browser core. The only valid values returned are the constants in this interface.

Returns:
The renderer type

getIDString

public java.lang.String getIDString()
Get the ID string for this renderer.

Returns:
The String token for this renderer.

getVRMLClock

public VRMLClock getVRMLClock()
Get the clock instance in use by the core. We need this for when new nodes are added to the scene to make sure they are all appropriately configured.

Returns:
The clock used by the browser core

setScene

public void setScene(VRMLScene scene,
                     java.lang.String viewpoint)
Set the scene to use within this universe with the specifically named viewpoint. If null, this will clear this scene and de-register all listeners.

Parameters:
scene - The new scene to load, or null
viewpoint - The viewpoint.description to bind to or null for default

getDEFMappings

public java.util.Map getDEFMappings()
Get the mapping of DEF names to the node instances that they represent. Primarily used for the EAI functionality. The map instance changes each time a new world is loaded so will need to be re-fetched. If no mappings are available (eg scripting replaceWorld() type call) then the map will be empty.

Returns:
The current mapping of DEF names to node instances

getWorldExecutionSpace

public VRMLExecutionSpace getWorldExecutionSpace()
Convenience method to ask for the execution space that the world is currently operating in. Sometimes this is not known, particularly if the end user has called a loadURL type function that is asynchronous. This will change each time a new scene is loaded.

Returns:
The current world execution space.

getDescription

public java.lang.String getDescription()
Get the description string currently used by the world. Returns null if not set or supported.

Returns:
The current description string or null

setDescription

public void setDescription(java.lang.String desc)
Set the description of the current world. If the world is operating as part of a web browser then it shall attempt to set the title of the window. If the browser is from a component then the result is dependent on the implementation

Parameters:
desc - The description string to set.

getCurrentSpeed

public float getCurrentSpeed()
Get the current velocity of the bound viewpoint in meters per second. The velocity is defined in terms of the world values, not the local coordinate system of the viewpoint.

Returns:
The velocity in m/s or 0.0 if not supported

getCurrentFrameRate

public float getCurrentFrameRate()
Get the current frame rate of the browser in frames per second.

Returns:
The current frame rate or 0.0 if not supported

getWorldURL

public java.lang.String getWorldURL()
Get the fully qualified URL of the currently loaded world. This returns the entire URL including any possible arguments that might be associated with a CGI call or similar mechanism. If the initial world is replaced with loadURL then the string will reflect the new URL. If replaceWorld is called then the URL still represents the original world.

Returns:
A string of the URL or null if not supported.

addCoreListener

public void addCoreListener(BrowserCoreListener l)
Add a listener for browser core events. These events are used to notify all listeners of internal structure changes, such as the browser starting and stopping. A listener can only be added once. Duplicate requests are ignored.

Parameters:
l - The listener to add

removeCoreListener

public void removeCoreListener(BrowserCoreListener l)
Remove a browser core listener. If the reference is null or not known, the request is silently ignored.

Parameters:
l - The listener to remove

sendURLFailEvent

public void sendURLFailEvent(java.lang.String msg)
Send to the core listeners the error message that a URL failed to load for some reason. This is for the EAI/ESAI spec conformance.

Parameters:
msg - The message to send

setNavigationMode

public void setNavigationMode(java.lang.String mode)
Set the navigation mode.

Parameters:
mode - The mode as defined in the NavigationInfo.type field.

fitToWorld

public void fitToWorld(boolean animated)
Move the user's location to see the entire world. Change the users orientation to look at the center of the world.

Parameters:
animated - Should the transistion be animated. Defaults to FALSE.

setLastRenderTime

public void setLastRenderTime(long lastTime)
Set the last frame render time used for FPS calculations. Only the per frame mamanger should call this.

Parameters:
lastTime - The time it took to render the last frame in milliseconds.

setEventModelStatusListener

public void setEventModelStatusListener(EventModelStatusListener l)
Set the eventModelStatus listener.

Parameters:
l - The listener. Null will clear it.

addNavigationStateListener

public void addNavigationStateListener(NavigationStateListener l)
Add a listener for navigation state changes. A listener can only be added once. Duplicate requests are ignored.

Parameters:
l - The listener to add

removeNavigationStateListener

public void removeNavigationStateListener(NavigationStateListener l)
Remove a navigation state listener. If the reference is null or not known, the request is silently ignored.

Parameters:
l - The listener to remove

addSensorStatusListener

public void addSensorStatusListener(SensorStatusListener l)
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

public void removeSensorStatusListener(SensorStatusListener l)
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

public void addViewpointStatusListener(ViewpointStatusListener l)
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

public void removeViewpointStatusListener(ViewpointStatusListener l)
Remove a viewpoint state listener. If the reference is null or not known, the request is silently ignored.

Parameters:
l - The listener to remove

dispose

public void dispose()
Notify the core that it can dispose all resources. The core cannot be used for rendering after that.


Xj3D VRML/X3D Code API

Copyright © 2001 - 2005 Web3D Consortium