As you may know, I was working on a quite massive cleanup patch regarding the Testcases and especially the Shape extensions (the classes in org.xith3d.shapes in xith-tk). Finally I'm finished

.
Now they are all streamlined and usable the same way. Most of the "spherical" shapes (Sphere, Torus, etc.) are made of IndexedTriangleStripArrays or IndexedTriangleArrays or TriangleStripArray or TriangleArrays. Just as you want it. the default is IndexedTriangleStripArray, since it's the most efficient one. You can switch that by invoking this method (e.g.):
Sphere.setGeometryConstructionTypeHint( GeometryType.TRIANGLE_ARRAY );
All shapes are created through their constructors and take the following kinds of parameters (all in that order):
- size (radius, length, etc.)
- precision (slices, stacks)
- features or
- Texture, Color or Appearance
You can create the Geometries, the shapes are made of, separately by invoking one of the static createGeometryXXXX() methods, where XXXX is one of TA (=TriangleArray), ITA (=IndexedTriangleArray), TSA (=TriangleStripArray), ITSA (=IndexedTriangleStripArray).
These Geometries are constructed of an instance of the new new so called GeometryConstruct class. It contains all information necessary to create an appropriate GeometryArray. You can also retrieve such an instance by using the createGoemetryConstructXXXX() methods. You can even create a GeometryConstruct instance, modify it and use it to create a GeometryArray of it. If you don't want to do that manually, simply use the new GeomFactory class. It provides several static methods to convert GeometryConstructs (of various types), to create GeometryArrays and much more.
If you're creating a custom Geometry with normals and want to see, if your normals are correct, you can visualize them by the help of the new class NormalsVisualizer. It works like this:
TransformGroup torusTG = new TranformGroup();
Torus torus = new Torus( ... );
torusTG.addChild( torus );
NormalsVisualizer nv = new NormalsVisualizer( torus );
nv.setNormalScale( 5.0f );
torusTG.addChild( nv );
(Make sure to add the NormalsVisualizer to the same parent TranformGroup as the sample Shape3D.)
(and see the screenshot below)
There's also a new Shape extension called "Raster". It is nothing more than a rectangular raster of vertices made of an (Indexed)Triangle(Strip)Array. It is especially meant to be modified by shaders.
@Mathias: Is this maybe useful for your Terrain implementation?
I hope, you have a lot of fun with the new Shape-extensions.
Marvin
EDIT: Added Schreenshot