<<VRML 2.0 - An Introductory view by examples

IndexedFaceSet

[indexedface example]                            [run-example] 

This node defines a 3D shape formed by polygons faces defined from vertices.

{
eventIn MFInt32 set_colorIndex # input event for defining colorIndex
eventIn MFInt32 set_coordIndex # input event for defining coordIndex
eventIn MFInt32 set_normalIndex # input event for defining normalIndex
eventIn MFInt32 set_texCoordIndex # input event for defining texCoordIndex

field SFBool solid TRUE # visibility of faces
field SFBool convex TRUE # convexibility of faces

field MFInt32 2 coordIndex [ ] # indexes defining the sequence of vertices
exposedField SFNode coord NULL # the coordinate node

field SFBool colorPerVertex TRUE#
field MFInt32 colorIndex [ ] # indexes defining the color of each vertice or face
exposedField SFNode color NULL # the color node

field SFBool normalPerVertex TRUE#
field MFInt32 2 normalIndex [ ] # indexes defining the vertices or faces normal
exposedField SFNode normal NULL # the normal node
field SFFloat creaseAngle 0 #
field SFBool ccw TRUE # normal orientation

field MFInt32 2 texCoorIndex [ ] # indexes defining the
exposedField SFNode texCoord NULL #
}

Usage :

Shape{
   geometry IndexedFaceSet{

refazer

              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
                     }
      }