wobs.scene3d.player
Class X3DScene

java.lang.Object
  extended by wobs.scene3d.player.X3DNode
      extended by wobs.scene3d.player.X3DScene
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
Scene

public class X3DScene
extends X3DNode

This class represent a X3D/VRML scene graph by acting as the root node for the scene graph hierarchy.
Access into the scene graph is given by methods found in the super-class X3DNode, and is used in the same way as from any other node. For a listing of fields contained in a X3DScene object see the class wobs.scene3d.nodes.Scene.

An instance of this class can be accessed from the class Browser.

See Also:
Browser

Field Summary
 
Fields inherited from class wobs.scene3d.player.X3DNode
name, type
 
Method Summary
 void addRoute(X3DField sourceField, X3DField destinationField)
          Adds a X3D/VRML Route between two fields of the same type.
 java.lang.Object clone()
          Creates and returns a copy of this object.
 void deleteRoute(X3DField sourceField, X3DField destinationField)
          Deletes an existing Route between the two fields specified.
 X3DNode getCurrentView()
          Creates a new Viewpoint node from the current view.
 void setViewpoint(X3DNode viewpoint)
          Sets the current view to the specified viewpoint node.
 void viewpointMove(float moveX, float moveY, float moveZ)
          Moves the viewpoint.
 void viewpointRotN(float Nx, float Ny, float Nz, float angle)
          Rotates the viewpoint.
 
Methods inherited from class wobs.scene3d.player.X3DNode
addChild, getChildren, getField, getName, getNode, getNode, getParent, getType, move, removeChild, rotN, scale
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

clone

public java.lang.Object clone()
Creates and returns a copy of this object.

Specified by:
clone in class X3DNode
Returns:
a clone of this instance.

addRoute

public void addRoute(X3DField sourceField,
                     X3DField destinationField)
Adds a X3D/VRML Route between two fields of the same type. Adding a Route will cause any modifications made on the specified source field to be propagated to the specified destination field. As long as the Route exists and after a modification to the source field, the destination field will be modified to contain the same value as the source field.

Parameters:
sourceField - The source field
destinationField - The destination field

deleteRoute

public void deleteRoute(X3DField sourceField,
                        X3DField destinationField)
Deletes an existing Route between the two fields specified.

Parameters:
sourceField - The source field
destinationField - The destination field

setViewpoint

public void setViewpoint(X3DNode viewpoint)
Sets the current view to the specified viewpoint node.

Parameters:
viewpoint - The new viewpoint to use

viewpointMove

public void viewpointMove(float moveX,
                          float moveY,
                          float moveZ)
Moves the viewpoint.

Parameters:
moveX - the movement along the x axis
moveY - the movement along the y axis
moveZ - the movement along the z axis

viewpointRotN

public void viewpointRotN(float Nx,
                          float Ny,
                          float Nz,
                          float angle)
Rotates the viewpoint. The parameters specify a normalised rotation vector (specifying a direction to rotate around) and an angle (in radians) that control the amount of rotation. A normalised vector means that sqrt(Nx*Nx + Ny*Ny + Nz*Nz) = 1, which can be ensured by dividing each Nx, Ny and Nz by the amount sqrt(Nx*Nx + Ny*Ny + Nz*Nz).

For example, rotating 45 degrees (PI/4 radians) around the y-axis would be achieved by calling viewpointRotN(0, 1, 0, Math.PI/4)

Parameters:
Nx - the x coordinate of the normalised rotation vector
Ny - the y coordinate of the normalised rotation vector
Nz - the z coordinate of the normalised rotation vector
angle - the rotation angle, in radians (1 radian = PI/180 degrees)

getCurrentView

public X3DNode getCurrentView()
Creates a new Viewpoint node from the current view.
The resulting Viewpoint node will have its fields 'position' and 'orientation' generated from the current view.
The values for the other fields will be set to the same values as the currently set Viewpoint node.

Returns:
the new Viewpoint
See Also:
Viewpoint