// Write texture coordinates
if (texCoordGeneration != null) {
if (textureCoordinatesGenerated) {
for (int index = 0, i = vertexSize - 3, n = geometryArray.getVertexCount();
index < n; index++, i += vertexSize) {
TexCoord2f textureCoordinates = generateTextureCoordinates(
vertexData [i], vertexData [i + 1], vertexData [i + 2], planeS, planeT);
writeTextureCoordinates(textureCoordinates, index, textureCoordinatesIndexSubstitutes);
}
}
} else if (textureCoordinatesDefined) {
for (int index = 0, i = 0, n = geometryArray.getVertexCount();
index < n; index++, i += vertexSize) {
TexCoord2f textureCoordinates = new TexCoord2f(vertexData [i], vertexData [i + 1]);
writeTextureCoordinates(textureCoordinates, index, textureCoordinatesIndexSubstitutes);
}
}
// Write normals
if (normalsDefined) {
for (int index = 0, i = vertexSize - 6, n = geometryArray.getVertexCount();
normalsDefined && index < n; index++, i += vertexSize) {
Vector3f normal = new Vector3f(vertexData [i], vertexData [i + 1], vertexData [i + 2]);
normalsDefined = writeNormal(normalsBuffer, parentTransformations, normal, index,
normalIndexSubstitutes, oppositeSideNormalIndexSubstitutes, cullFace, backFaceNormalFlip);
}
}
} else {
// Write vertices coordinates
float [] vertexCoordinates = geometryArray.getCoordRefFloat();
for (int index = 0, i = 0, n = geometryArray.getVertexCount(); index < n; index++, i += 3) {
Point3f vertex = new Point3f(vertexCoordinates [i], vertexCoordinates [i + 1], vertexCoordinates [i + 2]);
writeVertex(parentTransformations, vertex, index,
vertexIndexSubstitutes);
}
// Write texture coordinates
if (texCoordGeneration != null) {
if (textureCoordinatesGenerated) {
for (int index = 0, i = 0, n = geometryArray.getVertexCount(); index < n; index++, i += 3) {
TexCoord2f textureCoordinates = generateTextureCoordinates(
vertexCoordinates [i], vertexCoordinates [i + 1], vertexCoordinates [i + 2], planeS, planeT);
writeTextureCoordinates(textureCoordinates, index, textureCoordinatesIndexSubstitutes);
}
}
} else if (textureCoordinatesDefined) {
float [] textureCoordinatesArray = geometryArray.getTexCoordRefFloat(0);
for (int index = 0, i = 0, n = geometryArray.getVertexCount(); index < n; index++, i += 2) {
TexCoord2f textureCoordinates = new TexCoord2f(textureCoordinatesArray [i], textureCoordinatesArray [i + 1]);
writeTextureCoordinates(textureCoordinates, index, textureCoordinatesIndexSubstitutes);
}
}
// Write normals
if (normalsDefined) {
float [] normalCoordinates = geometryArray.getNormalRefFloat();
for (int index = 0, i = 0, n = geometryArray.getVertexCount(); normalsDefined && index < n; index++, i += 3) {
Vector3f normal = new Vector3f(normalCoordinates [i], normalCoordinates [i + 1], normalCoordinates [i + 2]);
normalsDefined = writeNormal(normalsBuffer, parentTransformations, normal, index,
normalIndexSubstitutes, oppositeSideNormalIndexSubstitutes, cullFace, backFaceNormalFlip);
}
}
}
} else {
// Write vertices coordinates
for (int index = 0, n = geometryArray.getVertexCount(); index < n; index++) {
Point3f vertex = new Point3f();
geometryArray.getCoordinate(index, vertex);
writeVertex(parentTransformations, vertex, index,
vertexIndexSubstitutes);
}
// Write texture coordinates
if (texCoordGeneration != null) {
if (textureCoordinatesGenerated) {
for (int index = 0, n = geometryArray.getVertexCount(); index < n; index++) {
Point3f vertex = new Point3f();
geometryArray.getCoordinate(index, vertex);
TexCoord2f textureCoordinates = generateTextureCoordinates(
vertex.x, vertex.y, vertex.z, planeS, planeT);
writeTextureCoordinates(textureCoordinates, index, textureCoordinatesIndexSubstitutes);
}
}
} else if (textureCoordinatesDefined) {
for (int index = 0, n = geometryArray.getVertexCount(); index < n; index++) {
TexCoord2f textureCoordinates = new TexCoord2f();
geometryArray.getTextureCoordinate(0, index, textureCoordinates);
writeTextureCoordinates(textureCoordinates, index, textureCoordinatesIndexSubstitutes);
}
}
// Write normals