Chapter 3:
Node Reference
Intro
Anchor
Appearance
AudioClip
Background
Billboard
Box
Collision
Color
ColorInterpolator
Cone
Coordinate
CoordinateInterpolator
Cylinder
CylinderSensor
DirectionalLight
ElevationGrid
Extrusion
Fog
FontStyle
Group
ImageTexture
IndexedFaceSet
IndexedLineSet
Inline
LOD
Material
MovieTexture
NavigationInfo
Normal
NormalInterpolator
OrientationInterpolator
PixelTexture
PlaneSensor
PointLight
PointSet
PositionInterpolator
ProximitySensor
ScalarInterpolator
Script
Shape
Sound
Sphere
SphereSensor
SpotLight
Switch
Text
TextureCoordinate
TextureTransform
TimeSensor
TouchSensor
Transform
Viewpoint
VisibilitySensor
WorldInfo
|
Anchor {
eventIn MFNode addChildren
eventIn MFNode removeChildren
exposedField MFNode children []
exposedField SFString description ""
exposedField MFString parameter []
exposedField MFString url []
field SFVec3f bboxCenter 0 0 0 # (- , )
field SFVec3f bboxSize -1 -1 -1 # (0, ) or -1,-1,-1
}
The Anchor grouping node retrieves the content of a URL when the user
activates (e.g., clicks) some geometry contained within the Anchor
node's children. If the URL points to a valid VRML file, that world
replaces the world of which the Anchor node is a part (except when the
parameter field, described below, alters this behaviour). If
non-VRML data is retrieved, the browser shall determine how to handle
that data; typically, it will be passed to an appropriate non-VRML browser.
TECHNICAL
NOTE:
The name Anchor comes from the HTML Anchor tag (<A HREF=...>),
which is used to create hyperlinks in HTML. It was called WWWAnchor
in VRML 1.0, but the WWW was dropped. |
Exactly how a user activates geometry contained by the Anchor node
depends on the pointing device and is determined by the VRML browser.
Typically, clicking with the pointing device will result in the new
scene replacing the current scene. An Anchor node with an empty url
does nothing when its children are chosen. A description of how multiple
Anchors and pointing-device sensors are resolved on activation is contained
in "2.6.7 Sensor nodes."
A description of children, addChildren, and removeChildren
fields and eventIns may be found in "2.6.5
Grouping and children nodes."
The description field in the Anchor node specifies a textual
description of the Anchor node. This may be used by browser-specific
user interfaces that wish to present users with more detailed information
about the Anchor.
TECHNICAL
NOTE: The candidate Anchor is the Anchor with geometry that
is underneath the pointing device. The pointing device is usually
a mouse (or a mouse substitute like a trackball or touchpad). |
The parameter exposed field may be used to supply any additional
information to be interpreted by the VRML or HTML browser. Each string
shall consist of "keyword=value" pairs. For example, some browsers allow
the specification of a 'target' for a link to display a link in another
part of the HTML document. The parameter field is then:
Anchor {
parameter [ "target=name_of_frame" ]
...
}
TECHNICAL
NOTE:
The parameter field was added to allow Anchors to bring up
hyperlinks in other HTML frames on the same Web page. When VRML
2.0 was originally being designed, Netscape Navigator was the only
HTML browser that supported multiple frames, so instead of adding
a frame or target field just to support that feature,
the more general parameter field was added to Anchor. That
avoided adding any Netscape-specific features to VRML and allows
for future additions.
|
An Anchor node may be used to bind the initial Viewpoint
node in a world by specifying a URL ending with "#ViewpointName" where
"ViewpointName" is the name of a viewpoint defined in the file. For
example:
Anchor {
url "http://www.school.edu/vrml/someScene.wrl#OverView"
children Shape { geometry Box {} }
}
specifies an anchor that loads the file "someScene.wrl" and binds
the initial user view to the Viewpoint node
named "OverView" when the Anchor node's geometry (Box) is activated.
If the named Viewpoint node is not found in the file, the file is loaded
using the default Viewpoint node binding stack rules (see "3.53
Viewpoint").
If the url field only contains a "#ViewpointName" (i.e. no
file name), the Viewpoint node named "ViewpointName" in the current
world shall be bound (set_bind TRUE). See "3.53 Viewpoint" for the Viewpoint transition rules
that specify how browsers shall interpret the transition from the old
Viewpoint node to the new one. For example:
Anchor {
url "#Doorway"
children Shape { geometry Sphere {} }
}
binds the viewer to the viewpoint defined by the "Doorway" viewpoint
in the current world when the sphere is activated. In this case, if
the Viewpoint is not found, nothing is done on activation.
More details on the url field are contained in "2.5 VRML and the World Wide Web."
TIP:
Since navigating
around 3D worlds can be difficult, it is recommended that authors
provide navigation assists whenever possible. The Anchor node serves
as an excellent tool for creating simple guided tours or navigation
aids in a 3D world. Place signposts or other recognizable objects
(e.g., labeled buttons) throughout the world with Anchor nodes as
parents, and define each Anchor to refer to a Viewpoint defined
in the world (e.g., Anchor { url "#someViewpoint" ... }).
Typically, there should be at least one visible signpost from every
Viewpoint. This ensures that the user knows where to go after visiting
each stop. When creating guided tours, authors should include backward
and forward links at each signpost. Remember that VRML does not
specify what happens during the transition to a Viewpoint and thus
could perform a jump cut, an animated movement, or some other transitional
effect. If an author wishes to control the transition precisely,
then the only option is to use TouchSensors with Scripts programmed
to bind and unbind Viewpoints, which are animated by PositionInterpolators
and OrientationInterpolators. This is a much more complicated task
than using the simple Anchor node. |
The bboxCenter and bboxSize fields specify
a bounding box that encloses the Anchor's children. This is a hint
that may be used for optimization purposes. If the specified bounding
box is smaller than the actual bounding box of the children at any
time, the results are undefined. The default bboxSize value,
(-1, -1, -1), implies that the bounding box is not specified
and if needed must be calculated by the browser. A description of
bboxCenter and bboxSize fields may be found in " 2.6.4
Bounding boxes."
TECHNICAL
NOTE: Anchor is equivalent to a prototype containing a couple
of Group nodes, a Touch-Sensor, and a Script. It is a standard node
partly because it makes it easier to convert VRML 1.0 files (which
use WWWAnchor) to VRML 2.0, and partly because it is convenient
to have simple hyperlinking support prepackaged in a convenient
form. There are many hyperlinking tasks for which Anchor is inadequate.
For example, if you want a hyperlink to occur after the user has
accomplished some task, then you must use a Script node that calls
loadURL(). If you want to load several different pieces
of information into several other frames you will also have to use
a Script that makes several calls to loadURL(). The basic
building blocks of Scripts and sensors allow you to do almost anything;
the Anchor node is only meant to address the most basic hyperlinking
tasks |
EXAMPLE
(click to run):
The
following example illustrates typical use of the Anchor node.
The first Anchor links the Box geometry to another VRML world
that replaces this one after the Anchor is activated. The second
Anchor links the Sphere to a Viewpoint in this world. When the
user clicks on the Sphere, the browser's view is transported
to the Viewpoint. The third Anchor links a Cone to a frame on
an HTML page. When the user clicks on the Cone, the frame is
activated:
#VRML V2.0 utf8
Group { children [
Transform {
translation -5 0 0
children Anchor {
url "http://www.barbie.web/~barbie/dollhouse.wrl"
description "Link to Barbie's Home Page pad"
children Shape {
geometry Box {}
appearance DEF A1 Appearance {
material Material {
diffuseColor 1 1 1
ambientIntensity 0.33
specularColor 1 1 1
shininess 0.5
}
}
}
}
}
Transform {
children Anchor {
url "#NiceView"
description "Link to a nice view in this scene"
children Shape { geometry Sphere {} appearance USE A1 }
}
}
Transform {
translation 5 0 0
children Anchor {
url "http://www.barbie.web/~barbie/index.html"
description "Link to frame in Barbie's home page"
parameter "target=name_of_frame"
children Shape {
geometry Cone {}
appearance USE A1 }
}
}
DEF NiceView Viewpoint {
position 0 0 -20
description "A Nice View"
}
]}
|
|