wobs.scene3d.player
Interface Browser


public interface Browser

This interface is used to access, replace and create X3DScene's, and also provides methods to load resources.
To access the Browser object associated with a 3D Scene, you access the 3D Scene Wob through calls to getParent and getChild and cast the Wob to Browser.

Example:
In a Java Object located in the same Scene as a 3D Scene Object named "Your 3D Scene", the Browser for the 3D Scene would be accessed by:
Browser browser = (Browser) getParent().getChild("Your 3D Scene");


Method Summary
 java.io.InputStream getResource(java.net.URL url)
          Retrieves an InputStream of the resource specified by the URL.
 X3DScene getScene()
          Retrieves the X3D scene that is active in the Browser display.
 X3DScene loadScene(java.lang.String sceneFileName)
          Loads and creates a X3D scene.
 Texture3D loadTexture(java.lang.String textureImageFileName, java.lang.String alphaImageFileName)
          Loads a texture with the specified texture image file name and alpha image file name.
 void replaceScene(X3DScene newScene)
          Replaces the X3D scene.
 

Method Detail

getResource

java.io.InputStream getResource(java.net.URL url)
Retrieves an InputStream of the resource specified by the URL.

Parameters:
url - The URL for the resource

getScene

X3DScene getScene()
Retrieves the X3D scene that is active in the Browser display.

Returns:
the active scene.

loadScene

X3DScene loadScene(java.lang.String sceneFileName)
Loads and creates a X3D scene. The resulting X3DScene object will contain the scene graph of the specified WireFusion W3F file (.w3f).

Parameters:
sceneFileName - the name of the file to load.
Returns:
the loaded scene.

loadTexture

Texture3D loadTexture(java.lang.String textureImageFileName,
                      java.lang.String alphaImageFileName)
Loads a texture with the specified texture image file name and alpha image file name. The returned object can be used to set the image field of a Texture node (in the wobs.scene3d.nodes package) as follows:
aTextureNode.getField(Texture.image).set(myBrowser.loadTexture("myImage.jpg")) Specifying an empty string or null for either the texture or the alpha file name will load a texture without the respective texture or alpha.

Parameters:
textureImageFileName - the name of the texture image file to load.
alphaImageFileName - the name of the alpha image file to load.
Returns:
the texture in the WireFusion 3D texture format.

replaceScene

void replaceScene(X3DScene newScene)
Replaces the X3D scene. The previously displayed X3D scene will be discarded, and the new X3D scene will become active in the Browser display.

Parameters:
newScene - the new X3D scene to be used.