<<VRML 2.0 - An Introductory view by examples

IndexedLineSet

[example]                                                      [run] 

This node defines a 3D geometry formed by polylines.

{
eventIn MFInt32 set_colorIndex
eventIn MFInt32 set_coordIndex
field MFInt32 2 coordIndex [ ] # indexes defining the sequence of vertices
exposedField SFNode coord NULL # a coordinate node
field SFBool colorPerVertex TRUE#
field MFInt32 colorIndex [ ] # indexes defining the color of each line
exposedField SFNode color NULL # a color node
}

Usage :

Shape{
   geometry IndexedLineSet{
              coordIndex [ 0, 1, 2, 0, -1, 0, 2, 3, 0, -1 ]
              coord Coordinate 
                     {point [0 0 0, 1 0 0, 0 1 0, 0 0 1]} ;points coordinate
              colorPerVertex TRUE
              colorIndex [ 0, 0, 0, 0, -1, 1, 1, 1, 1, -1]
              color Color {[ 1 0 0, 0 1 0]} ; color for each point
                     }
   appearance Appearance {
              material Material { }
                          }  
      }