Hi,
Creatin these primitives in Xith3D is very simple. Take a look at createSphere(float R, int divisions) in TestUtils and you will easily get the idea of how to do indexed triangle array.
Additionally, you can use GeometryCreator and XithGeometryInfo in utility/geometry package to create geometry in OpenGL glBegin/glEnd way and get it out as GPU-cache-optimized Xith3D Shape.
Here is a short example on how to use it:
GeometryCreator gc = new GeometryCreator();
for (int i = 0; i < indexedVertexes.length/3; i++)
{
gc.addCoordinate(indexedVertexes[i*3],indexedVertexes[i*3+1],indexedVertexes[i*3+2]);
if (indexedNormals.length > 0)
gc.addNormal(indexedNormals[i*3],indexedNormals[i*3+1],indexedNormals[i*3+2]);
if (indexedTexCoords.length > 0)
gc.addTexCoord(indexedTexCoords[i*2],indexedTexCoords[i*2+1]);
}
for (int i = 0; i < indexes.length/3; i++)
{
// System.out.println("Face " + indexes[i*3] + " " + indexes[i*3+1] + " " + indexes[i*3+2]);
gc.addCoordIndex(indexes[i*3]);
gc.addCoordIndex(indexes[i*3+1]);
gc.addCoordIndex(indexes[i*3+2]);
if (indexedNormals.length > 0)
{
gc.addNormalIndex(indexes[i*3]);
gc.addNormalIndex(indexes[i*3+1]);
gc.addNormalIndex(indexes[i*3+2]);
}
if (indexedTexCoords.length > 0)
{
gc.addTexIndex(indexes[i*3]);
gc.addTexIndex(indexes[i*3+1]);
gc.addTexIndex(indexes[i*3+2]);
}
gc.nextFace();
}
XithGeometryInfo xgi = new XithGeometryInfo();
gc.fillGeometryInfo(xgi);
xgi.weldVertices();
xgi.optimizeTrianglesForCache();
IndexedTriangleArray shapeGeom = xgi.createIndexedTriangleArray(geomFlags);
shape.setGeometry(shapeGeom);
As of docs, you can take a look at Java3D docs - it uses similar format for data in GeometryArrays.
Yuri