IndexedLineArray lineArray = (IndexedLineArray)geometryArray;
for (int i = 0, n = lineArray.getIndexCount(); i < n; i += 2) {
writeIndexedLine(lineArray, i, i + 1, vertexIndexSubstitutes, textureCoordinatesIndexSubstitutes);
}
} else if (geometryArray instanceof IndexedTriangleArray) {
IndexedTriangleArray triangleArray = (IndexedTriangleArray)geometryArray;
for (int i = 0, n = triangleArray.getIndexCount(); i < n; i += 3) {
writeIndexedTriangle(triangleArray, i, i + 1, i + 2,
vertexIndexSubstitutes, normalIndexSubstitutes, oppositeSideNormalIndexSubstitutes,
normalsDefined, textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, cullFace);
}
} else if (geometryArray instanceof IndexedQuadArray) {
IndexedQuadArray quadArray = (IndexedQuadArray)geometryArray;
for (int i = 0, n = quadArray.getIndexCount(); i < n; i += 4) {
writeIndexedQuadrilateral(quadArray, i, i + 1, i + 2, i + 3,
vertexIndexSubstitutes, normalIndexSubstitutes, oppositeSideNormalIndexSubstitutes,
normalsDefined, textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, cullFace);
}
} else if (geometryArray instanceof IndexedGeometryStripArray) {
IndexedGeometryStripArray geometryStripArray = (IndexedGeometryStripArray)geometryArray;
int [] stripIndexCounts = new int [geometryStripArray.getNumStrips()];
geometryStripArray.getStripIndexCounts(stripIndexCounts);
int initialIndex = 0;
if (geometryStripArray instanceof IndexedLineStripArray) {
for (int strip = 0; strip < stripIndexCounts.length; strip++) {
for (int i = initialIndex, n = initialIndex + stripIndexCounts [strip] - 1; i < n; i++) {
writeIndexedLine(geometryStripArray, i, i + 1,
vertexIndexSubstitutes, textureCoordinatesIndexSubstitutes);
}
initialIndex += stripIndexCounts [strip];
}
} else if (geometryStripArray instanceof IndexedTriangleStripArray) {
for (int strip = 0; strip < stripIndexCounts.length; strip++) {
for (int i = initialIndex, n = initialIndex + stripIndexCounts [strip] - 2, j = 0; i < n; i++, j++) {
if (j % 2 == 0) {
writeIndexedTriangle(geometryStripArray, i, i + 1, i + 2,
vertexIndexSubstitutes, normalIndexSubstitutes, oppositeSideNormalIndexSubstitutes,
normalsDefined, textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, cullFace);
} else { // Vertices of odd triangles are in reverse order
writeIndexedTriangle(geometryStripArray, i, i + 2, i + 1,
vertexIndexSubstitutes, normalIndexSubstitutes, oppositeSideNormalIndexSubstitutes,
normalsDefined, textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, cullFace);
}
}
initialIndex += stripIndexCounts [strip];
}
} else if (geometryStripArray instanceof IndexedTriangleFanArray) {
for (int strip = 0; strip < stripIndexCounts.length; strip++) {
for (int i = initialIndex, n = initialIndex + stripIndexCounts [strip] - 2; i < n; i++) {
writeIndexedTriangle(geometryStripArray, initialIndex, i + 1, i + 2,
vertexIndexSubstitutes, normalIndexSubstitutes, oppositeSideNormalIndexSubstitutes,
normalsDefined, textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, cullFace);
}
initialIndex += stripIndexCounts [strip];
}
}
}
} else {
if (geometryArray instanceof LineArray) {
LineArray lineArray = (LineArray)geometryArray;
for (int i = 0, n = lineArray.getVertexCount(); i < n; i += 2) {
writeLine(lineArray, i, i + 1, vertexIndexSubstitutes, textureCoordinatesIndexSubstitutes);
}
} else if (geometryArray instanceof TriangleArray) {
TriangleArray triangleArray = (TriangleArray)geometryArray;
for (int i = 0, n = triangleArray.getVertexCount(); i < n; i += 3) {
writeTriangle(triangleArray, i, i + 1, i + 2,
vertexIndexSubstitutes, normalIndexSubstitutes, oppositeSideNormalIndexSubstitutes,
normalsDefined, textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, cullFace);
}
} else if (geometryArray instanceof QuadArray) {