All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----dnx.util.DNXObject | +----dnx.lr.Node | +----dnx.lr.LeafNode | +----dnx.lr.BindableNode | +----dnx.lr.ViewNode | +----dnx.lr.node.ViewpointNode
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):
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).
public SFFloat fieldOfView
public SFBool jump
public SFRotation orientation
public SFVec3f position
public SFString description
public SFTime bindTime
public SFBool isBound
public ViewpointNode()
protected void createNodeDefinition(NodeDefinition def)
protected void initFields()
protected void handleEvent(SceneEvent ev)
public void postIsBoundEvent()
public void postIsUnboundEvent()
public final synchronized void setProjection(Projection projection)
public final void getNodePosition(Point3 point)
public final void getNodeOrientation(Quaternion quat)
public Projection getProjection()
public final synchronized void handleFieldChange(Field f)
All Packages Class Hierarchy This Package Previous Next Index