| Cover | TOC | Chap | Prev Chap | Prev Fig | Next Fig | Next Chap |
|
Figure 16.2
A line plot with the polylines colored using colors from a Color node. |
|
|
Click on the image to view the VRML scene. |
#VRML V2.0 utf8
# The VRML 2.0 Sourcebook
# Copyright (c) 1997
# Andrea L. Ames, David R. Nadeau, and John L. Moreland
Group {
children [
# Axes
Shape {
appearance Appearance {
material Material {
emissiveColor 1.0 1.0 1.0
diffuseColor 1.0 1.0 1.0
}
}
geometry IndexedLineSet {
coord Coordinate {
point [
0.0 0.0 0.0, 10.0 0.0 0.0, 0.0 8.0 0.0
]
}
coordIndex [ 0, 1, -1, 0, 2, -1 ]
}
},
# Line plot with different color lines
Shape {
# no appearance, use emissive coloring
geometry IndexedLineSet {
coord Coordinate {
point [
# Green line
1.0 1.0 0.0, 2.0 4.0 0.0,
3.0 5.0 0.0, 4.0 4.0 0.0,
5.0 6.0 0.0, 6.0 7.0 0.0,
7.0 5.0 0.0, 8.0 6.0 0.0,
9.0 4.0 0.0, 10.0 3.0 0.0,
# Yellow line
1.0 3.0 0.0, 2.0 2.0 0.0,
3.0 2.0 0.0, 4.0 1.0 0.0,
5.0 2.0 0.0, 6.0 4.0 0.0,
7.0 3.0 0.0, 8.0 5.0 0.0,
9.0 5.0 0.0, 10.0 6.0 0.0,
]
}
coordIndex [
# Green line
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1,
# Yellow line
10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1
]
colorPerVertex FALSE
color Color {
color [ 0.0 1.0 0.0, 1.0 1.0 0.0 ]
}
colorIndex [ 0, 1 ]
}
}
]
}