Class dnx.lr.node.ViewpointNode
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class dnx.lr.node.ViewpointNode

java.lang.Object
   |
   +----dnx.util.DNXObject
           |
           +----dnx.lr.Node
                   |
                   +----dnx.lr.LeafNode
                           |
                           +----dnx.lr.BindableNode
                                   |
                                   +----dnx.lr.ViewNode
                                           |
                                           +----dnx.lr.node.ViewpointNode

public class ViewpointNode
extends ViewNode
 Viewpoint {
    eventIn      SFBool       set_bind        
    exposedField SFFloat      fieldOfView     0.785398
    exposedField SFBool       jump            TRUE
    exposedField SFRotation   orientation     0 0 1  0
    exposedField SFVec3f      position        0 0 10
    field        SFString     description     ""
    eventOut     SFTime       bindTime        
    eventOut     SFBool       isBound         
 }

The Viewpoint node defines a specific location in a local coordinate system from which the user might view the scene. Viewpoints are "Concepts - Bindable Children Nodes" and thus there exists a Viewpoint stack in the browser in which the top-most Viewpoint on the stack is the currently active Viewpoint. If a TRUE value is sent to the set_bind eventIn of a Viewpoint, it is moved to the top of the Viewpoint stack and thus activated. When a Viewpoint is at the top of the stack, the user's view is conceptually re-parented as a child of the Viewpoint. All subsequent changes to the Viewpoint's coordinate system change the user's view (e.g. changes to any parent transformation nodes or to the Viewpoint's position or orientation fields). Sending a set_bind FALSE event removes the Viewpoint from the stack and results in isBound FALSE and bindTime events. If the popped Viewpoint is at the top of the viewpoint stack the user's view is re-parented to the next entry in the stack. See "Concepts - Bindable Children Nodes" for more details on the the binding stacks. When a Viewpoint is moved to the top of the stack, the existing top of stack Viewpoint sends an isBound FALSE event and is pushed onto the stack.

Viewpoints have the additional requirement from other binding nodes in that they store the relative transformation from the user view to the current Viewpoint when they are moved to the top of stack. This is needed by the jump field, described below.

An author can automatically move the user's view through the world by binding the user to a Viewpoint and then animating either the Viewpoint or the transformations above it. Browsers shall allow the user view to be navigated relative to the coordinate system defined by the Viewpoint (and the transformations above it), even if the Viewpoint or its parent transformations are being animated.

The bindTime eventOut sends the time at which the Viewpoint is bound or unbound. This can happen during loading, when a set_bind event is sent to the Viewpoint, or when the browser binds to the Viewpoint via its user interface (see below).

The position and orientation fields of the Viewpoint node specify relative locations in the local coordinate system. Position is relative to the coordinate system's origin (0,0,0), while orientation specifies a rotation relative to the default orientation; the default orientation has the user looking down the -Z axis with +X to the right and +Y straight up. Viewpoints are affected by the transformation hierarchy.

Navigation types (see NavigationInfo) that require a definition of a down vector (e.g. terrain following) shall use the negative Y-axis of the coordinate system of the currently bound Viewpoint. Likewise navigation types (see NavigationInfo) that require a definition of an up vector shall use the positive Y-axis of the coordinate system of the currently bound Viewpoint. Note that the orientation field of the Viewpoint does not affect the definition of the down or up vectors. This allows the author to separate the viewing direction from the gravity direction.

The jump field specifies whether the user's view `jumps' (or animates) to the position and orientation of a bound Viewpoint. Regardless of the value of jump at bind time, the relative viewing transformation between the user's view and the current Viewpoint shall be stored with the current Viewpoint for later use when un-jumping. The following is a re-write of the general bind stack rules described in "Concepts - Bindable Child Nodes, Bind Stack Behavior" with additional rules regarding Viewpoints (in bold):

  1. During read:
  2. When a set_bind TRUE eventIn is received by a Viewpoint:
  3. When a set_bind FALSE eventIn is received by a Viewpoint:
  4. If a set_bind FALSE eventIn is received by a node not in the stack, the event is ignored and isBound events are not sent.
  5. When a node replaces another node at the top of the stack, the isBound TRUE and FALSE eventOuts from the two nodes are sent simultaneously (i.e. identical timestamps).
  6. If a bound node is deleted then it behaves as if it received a set_bind FALSE event (see #3).

Note that the jump field may change after a Viewpoint is bound - the rules described above still apply. If jump was TRUE when the Viewpoint is bound, but changed to FALSE before the set_bind FALSE is sent, then the Viewpoint does not un-jump during unbind. If jump was FALSE when the Viewpoint is bound, but changed to TRUE before the set_bind FALSE is sent, then the Viewpoint does perform the un-jump during unbind.

The fieldOfView field specifies a preferred field of view from this viewpoint, in radians. A small field of view roughly corresponds to a telephoto lens; a large field of view roughly corresponds to a wide-angle lens. The field of view should be greater than zero and smaller than PI; the default value corresponds to a 45 degree field of view. The value of fieldOfView represents the maximum viewing angle in any direction axis of the view. For example, a browser with a rectangular viewing projection shall use an angle of fieldOfView for the larger direction (depending on aspect ratio) and fieldOfView times aspect ratio in the smaller direction. If the aspect ratio is 2x1 (i.e. horizontal twice the vertical) and the fieldOfView is 1.0, then the horizontal viewing angle would be 1.0 and the vertical viewing angle would be 0.5. fieldOfView is a hint to the browser and may be ignored.

The description field identifies Viewpoints that are recommended to be publicly accessible through the browser's user interface (e.g. Viewpoints menu). The string in the description field should be displayed if this functionality is implemented. If description is empty, then the Viewpoint should not appear in any public user interface. It is recommended that the browser bind and move to a Viewpoint when its description is selected, either animating to the new position or jumping directly there. Once the new position is reached both the isBound and bindTime eventOuts are sent.

The URL syntax ".../scene.wrl#ViewpointName" specifies the user's initial view when entering "scene.wrl" to be the first Viewpoint in file "scene.wrl" that appears as "DEF ViewpointName Viewpoint { ... }" - this overrides the first Viewpoint in the file as the initial user view and receives a set_bind TRUE message. If the Viewpoint "ViewpointName" is not found, then assume that no Viewpoint was specified and use the first Viewpoint in the file. The URL syntax "#ViewpointName" specifies a view within the existing file. If this is loaded, then receives a set_bind TRUE message.

If a Viewpoint is bound (set_bind) and is the child of an LOD, Switch, or any node or prototype that disables its children, then the result is undefined. If a Viewpoint is bound that results in collision with geometry, then the browser performs its self-defined navigation adjustments as if the user navigated to this point (see Collision).


Variable Index

 o bindTime
 o description
 o fieldOfView
 o isBound
 o jump
 o orientation
 o position

Constructor Index

 o ViewpointNode()

Method Index

 o createNodeDefinition(NodeDefinition)
Create the node definition.
 o getNodeOrientation(Quaternion)
 o getNodePosition(Point3)
 o getProjection()
 o handleEvent(SceneEvent)
Handle an event.
 o handleFieldChange(Field)
Handle a field change.
 o initFields()
Initialize field values.
 o postIsBoundEvent()
 o postIsUnboundEvent()
 o setProjection(Projection)

Variables

 o fieldOfView
  public SFFloat fieldOfView
 o jump
  public SFBool jump
 o orientation
  public SFRotation orientation
 o position
  public SFVec3f position
 o description
  public SFString description
 o bindTime
  public SFTime bindTime
 o isBound
  public SFBool isBound

Constructors

 o ViewpointNode
  public ViewpointNode()

Methods

 o createNodeDefinition
  protected void createNodeDefinition(NodeDefinition def)
Create the node definition.
Overrides:
createNodeDefinition in class Node
 o initFields
  protected void initFields()
Initialize field values.
Overrides:
initFields in class Node
 o handleEvent
  protected void handleEvent(SceneEvent ev)
Handle an event.
Overrides:
handleEvent in class Node
 o postIsBoundEvent
  public void postIsBoundEvent()
Overrides:
postIsBoundEvent in class BindableNode
 o postIsUnboundEvent
  public void postIsUnboundEvent()
Overrides:
postIsUnboundEvent in class BindableNode
 o setProjection
  public final synchronized void setProjection(Projection projection)
Overrides:
setProjection in class ViewNode
 o getNodePosition
  public final void getNodePosition(Point3 point)
Overrides:
getNodePosition in class ViewNode
 o getNodeOrientation
  public final void getNodeOrientation(Quaternion quat)
Overrides:
getNodeOrientation in class ViewNode
 o getProjection
  public Projection getProjection()
Overrides:
getProjection in class ViewNode
 o handleFieldChange
  public final synchronized void handleFieldChange(Field f)
Handle a field change.
Overrides:
handleFieldChange in class Node

All Packages  Class Hierarchy  This Package  Previous  Next  Index