This discribes how the VRML IndexedFaceSet parameters are converted into Java3D IndexedTriangleArray or IndexedQuadArray classes.
In VRML the IndexedFaceSet is used to define any arbitrary shape. Under this node there might be coordBean, colorBean, texcoordBean or normalBean to store vertex coordinates and other information about the vertexes, these arrays are all indexed.
In Java3D there are many geometry types, I have chosen to use IndexedTriangleArray or IndexedQuadArray classes as these apprear to be closer to the VRML IndexedFaceSet parameters. So a shape is made up of triangle or quad faces, these are defined by the 3 or 4 vertices at their corners. Because they are indexed, each vertex may be used in several triangles or quads. This indexing is a more efficient way to store the information in terms of requiring less data, however I'm not sure about the runtime efficiency once its passed to the Java3D classes such as IndexedTriangleArray.
So we need to take the VRML parameters and convert them into the arrays required by the Java3D IndexedTriangleArray and IndexedQuadArray nodes as follows.

Processing For Coords
Processing For Normals

Processing For Colors

Processing For TextureCoordinates

ifs_bean class
| Classes written for this program | Java3D classes (scene graph structure) |

VRML2 definition:
IndexedFaceSet {
eventIn MFInt32 set_colorIndex
eventIn MFInt32 set_coordIndex
eventIn MFInt32 set_normalIndex
eventIn MFInt32 set_texCoordIndex
exposedField SFNode color NULL
exposedField SFNode coord NULL
exposedField SFNode normal NULL
exposedField SFNode texCoord NULL
field SFBool ccw TRUE
field MFInt32 colorIndex [] # [-1,∞)
field SFBool colorPerVertex TRUE
field SFBool convex TRUE
field MFInt32 coordIndex [] # [-1,∞)
field SFFloat creaseAngle 0 # [0,∞)
field MFInt32 normalIndex [] # [-1,∞)
field SFBool normalPerVertex TRUE
field SFBool solid TRUE
field MFInt32 texCoordIndex [] # [-1,∞)
}
Color {
exposedField MFColor color [] # [0,1]
}
Coordinate {
exposedField MFVec3f point [] # (-,)
}
Normal {
exposedField MFVec3f vector [] # (-∞,∞)
}
TextureCoordinate {
exposedField MFVec2f point [] # (-,)
}
VRML2 format
When an IFS is saved it looks like this:
#VRML V2.0 utf8
Transform {
children [
Shape
{
geometry IndexedFaceSet {
coord Coordinate {
point
[
0.5 -0.5 0.5,
0.5 0.5 0.5,
-0.5 0.5 0.5,
-0.5 -0.5 0.5,
-0.5 -0.5 -0.5,
-0.5 0.5 -0.5,
0.5 0.5 -0.5,
0.5 -0.5 -0.5,
]
}
coordIndex [
0, 1, 2, 3, -1,
4, 5, 6, 7, -1,
7, 6, 1, 0, -1,
3, 2, 5, 4, -1,
1, 6, 5, 2, -1,
3, 4, 7, 0, -1,
]
normal Normal {
vector
[
0.0 0.0 1.0,
0.0 0.0 -1.0,
1.0 0.0 0.0,
-1.0 0.0 0.0,
0.0 1.0 0.0,
0.0 -1.0 0.0,
]
}
normalIndex [
0, 0, 0, 0, -1,
1, 1, 1, 1, -1,
2, 2, 2, 2, -1,
3, 3, 3, 3, -1,
4, 4, 4, 4, -1,
5, 5, 5, 5, -1,
]
texCoord TextureCoordinate {
point
[
1.0 0.0,
1.0 1.0,
0.0 1.0,
0.0 0.0,
1.0 0.0,
1.0 1.0,
0.0 1.0,
0.0 0.0,
]
}
texCoordIndex [
0, 1, 2, 3, -1,
4, 5, 6, 7, -1,
7, 6, 1, 0, -1,
3, 2, 5, 4, -1,
1, 6, 5, 2, -1,
3, 4, 7, 0, -1,
]
}
}
]
}






