|
|
VRML Script Tutorial
Full list
VRML Interactive Tutorial
Introduction
VRML File Structure
Drawing: Shape node
Geometry Nodes:
Appearance
Let there be Light
Materials with Colored Lights
Hierarchical Node Structures
Inlining Files
Defining and Instancing Nodes
Defining Levels of Detail
Events in VRML
Interpolators
Let the Music Play
Bindable Nodes
Adding Realism to the world
Information about your world
Definition for Auxiliary Nodes
|
|
|
|
Group Node
If you're not familiar to grouping nodes in VRML see the section Creating
Hierarchical Node Structures for general information on grouping.
The group node lets you treat a set of nodes as a single entity.
The following fields are present:
children which contains all the nodes included in the group.
bboxCenter specifies the center of a box that encloses the nodes
in the group. The value for this field is a 3D point.
bboxSize specifies where the size of a box that encloses the nodes
in the group. By default this field has a value of -1 -1 -1, which implies
that no box is defined. The values for this field must be greater than
or equal to zero. If the children nodes do not fit inside the box defined
the results are undefined.
The latter two fields are optional. They can be used by the browser for
optimization purposes.
Syntax:
|
Group
{ |
children []
bboxCenter 0 0 0
bboxSize -1 -1 -1
|
} |
|
The following hierarchical structure of a VRML file exemplifies scoping
with the group node:
Group g1 {
-
Shape A
-
Directional Light 1
-
Group g2 {
-
DirectionalLight 2
-
Shape B
-
}
} |
The directional
light in group 1 will lit both shapes A and B because a directional
light lits all nodes within the same group and in descendent groups. However,
the directional
light in group 2 will only lit shape B. Shape A is placed outside the
group where the light is defined and therefore it is not lit by the directional
light in group 2.
The following code exemplifies the syntax of the Group node:
Example:
-
#VRML V2.0 utf8
Group {
-
children [
-
Shape {
-
geometry Cylinder {
-
height 5.0
-
radius 0.5
-
}
-
}
-
Shape {
-
geometry Sphere {}
-
}
-
]
}
|