Controlling color on coordinate-based geometry
scatter.wrl
#VRML V2.0 utf8
Viewpoint {
position 0.0 0.0 10.0
description "Entry view"
}
NavigationInfo {
type [ "EXAMINE", "ANY" ]
headlight TRUE
}
Transform {
translation -5.0 -4.0 0.0
children [
# Axes
Shape {
appearance Appearance {
material Material { }
}
geometry IndexedLineSet {
coord Coordinate {
point [
0.0 0.0 0.0, 10.0 0.0 0.0, 0.0 8.0 0.0
]
}
color Color {
color [
1.0 1.0 1.0,
1.0 1.0 1.0,
1.0 1.0 1.0,
]
}
coordIndex [ 0, 1, -1, 0, 2, -1 ]
colorPerVertex TRUE
}
}
# Scatter plot with different color points
Shape {
# no appearance, use emissive coloring
geometry PointSet {
coord Coordinate {
point [
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,
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,
]
}
color Color {
color [
0.0 1.0 0.0, 0.0 1.0 0.0,
1.0 0.0 0.0, 0.0 1.0 1.0,
0.0 1.0 0.0, 0.0 1.0 0.0,
0.0 1.0 1.0, 1.0 0.0 1.0,
0.0 1.0 0.0, 1.0 0.0 0.0,
1.0 0.0 0.0, 1.0 0.0 0.0,
0.0 1.0 1.0, 1.0 0.0 1.0,
1.0 0.0 0.0, 0.0 1.0 0.0,
0.0 0.0 1.0, 0.0 1.0 1.0,
1.0 1.0 1.0, 1.0 1.0 0.0,
]
}
}
}
]
}