vertices [index++] = vertex.z;
}
}
// Create path from triangles or quadrilaterals of geometry
GeneralPath geometryPath = null;
if (geometryArray instanceof IndexedGeometryArray) {
if (geometryArray instanceof IndexedTriangleArray) {
IndexedTriangleArray triangleArray = (IndexedTriangleArray)geometryArray;
geometryPath = new GeneralPath(GeneralPath.WIND_NON_ZERO, 1000);
for (int i = 0, triangleIndex = 0, n = triangleArray.getIndexCount(); i < n; i += 3) {
addIndexedTriangleToPath(triangleArray, i, i + 1, i + 2, vertices,
geometryPath, triangleIndex++, nodeArea);
}
} else if (geometryArray instanceof IndexedQuadArray) {
IndexedQuadArray quadArray = (IndexedQuadArray)geometryArray;
geometryPath = new GeneralPath(GeneralPath.WIND_NON_ZERO, 1000);
for (int i = 0, quadrilateralIndex = 0, n = quadArray.getIndexCount(); i < n; i += 4) {
addIndexedQuadrilateralToPath(quadArray, i, i + 1, i + 2, i + 3, vertices,
geometryPath, quadrilateralIndex++, nodeArea);
}
} else if (geometryArray instanceof IndexedGeometryStripArray) {
IndexedGeometryStripArray geometryStripArray = (IndexedGeometryStripArray)geometryArray;
int [] stripIndexCounts = new int [geometryStripArray.getNumStrips()];
geometryStripArray.getStripIndexCounts(stripIndexCounts);
geometryPath = new GeneralPath(GeneralPath.WIND_NON_ZERO, 1000);
int initialIndex = 0;
if (geometryStripArray instanceof IndexedTriangleStripArray) {
for (int strip = 0, triangleIndex = 0; strip < stripIndexCounts.length; strip++) {
for (int i = initialIndex, n = initialIndex + stripIndexCounts [strip] - 2, j = 0; i < n; i++, j++) {
if (j % 2 == 0) {
addIndexedTriangleToPath(geometryStripArray, i, i + 1, i + 2, vertices,
geometryPath, triangleIndex++, nodeArea);
} else { // Vertices of odd triangles are in reverse order
addIndexedTriangleToPath(geometryStripArray, i, i + 2, i + 1, vertices,
geometryPath, triangleIndex++, nodeArea);
}
}
initialIndex += stripIndexCounts [strip];
}
} else if (geometryStripArray instanceof IndexedTriangleFanArray) {
for (int strip = 0, triangleIndex = 0; strip < stripIndexCounts.length; strip++) {
for (int i = initialIndex, n = initialIndex + stripIndexCounts [strip] - 2; i < n; i++) {
addIndexedTriangleToPath(geometryStripArray, initialIndex, i + 1, i + 2, vertices,
geometryPath, triangleIndex++, nodeArea);
}
initialIndex += stripIndexCounts [strip];
}
}
}
} else {
if (geometryArray instanceof TriangleArray) {
TriangleArray triangleArray = (TriangleArray)geometryArray;
geometryPath = new GeneralPath(GeneralPath.WIND_NON_ZERO, 1000);
for (int i = 0, triangleIndex = 0; i < vertexCount; i += 3) {
addTriangleToPath(triangleArray, i, i + 1, i + 2, vertices,
geometryPath, triangleIndex++, nodeArea);
}
} else if (geometryArray instanceof QuadArray) {
QuadArray quadArray = (QuadArray)geometryArray;
geometryPath = new GeneralPath(GeneralPath.WIND_NON_ZERO, 1000);
for (int i = 0, quadrilateralIndex = 0; i < vertexCount; i += 4) {
addQuadrilateralToPath(quadArray, i, i + 1, i + 2, i + 3, vertices,
geometryPath, quadrilateralIndex++, nodeArea);
}
} else if (geometryArray instanceof GeometryStripArray) {
GeometryStripArray geometryStripArray = (GeometryStripArray)geometryArray;
int [] stripVertexCounts = new int [geometryStripArray.getNumStrips()];
geometryStripArray.getStripVertexCounts(stripVertexCounts);
geometryPath = new GeneralPath(GeneralPath.WIND_NON_ZERO, 1000);
int initialIndex = 0;
if (geometryStripArray instanceof TriangleStripArray) {
for (int strip = 0, triangleIndex = 0; strip < stripVertexCounts.length; strip++) {
for (int i = initialIndex, n = initialIndex + stripVertexCounts [strip] - 2, j = 0; i < n; i++, j++) {