org.xith3d.scenegraph.primitives
Class GeomFactory

java.lang.Object
  extended by org.xith3d.scenegraph.primitives.GeomFactory

public class GeomFactory
extends java.lang.Object

Geometry Util class


Constructor Summary
GeomFactory()
           
 
Method Summary
protected static int calculateFeatures(org.openmali.vecmath2.Tuple3f[] vertices, org.openmali.vecmath2.Vector3f[] normals, org.openmali.vecmath2.Colorf[] colors, org.openmali.vecmath2.TexCoord2f[] texCoords2, org.openmali.vecmath2.TexCoord3f[] texCoords3)
          Calculates the GeometryArray features.
static GeometryConstruct convertGeometryConstructITSA2ITA(GeometryConstruct gcITSA)
          Converts a GeometryConstruct made for IndexedTriangleStripArray to one made for IndexedTriangleArrays.
static GeometryConstruct convertGeometryConstructITSA2TA(GeometryConstruct gcITSA)
          Converts a GeometryConstruct made for IndexedTriangleStripArray to one made for TriangleArrays.
static GeometryConstruct convertGeometryConstructITSA2TSA(GeometryConstruct gcITSA)
          Converts a GeometryConstruct made for IndexedTriangleStripArray to one made for TriangleStripArrays.
protected static TriangleArray createFullFeaturedTriangleArray(GeometryConstruct[] geoms, int features)
          Creates the full-featured TriangleArray.
static TriangleArray createFullFeaturedTriangleArray(org.openmali.vecmath2.Tuple3f[] vertices, org.openmali.vecmath2.Vector3f[] normals, org.openmali.vecmath2.Colorf[] colors, org.openmali.vecmath2.TexCoord2f[] texCoords2, int features, boolean colorAlpha, int texCoordsSize)
          Creates the full-featured TriangleArray.
static GeometryArray createGeometryArray(GeometryConstruct gc)
           
static IndexedTriangleArray createIndexedTriangleArray(GeometryConstruct geomConstruct)
          Creates a IndexedTriangleArray.
static IndexedTriangleArray createIndexedTriangleArray(org.openmali.vecmath2.Tuple3f[] vertices, int[] indices, org.openmali.vecmath2.Vector3f[] normals, org.openmali.vecmath2.Colorf[] colors, org.openmali.vecmath2.TexCoord2f[] texCoords2, org.openmali.vecmath2.TexCoord3f[] texCoords3)
          Creates an IndexedTriangleArray.
static IndexedTriangleStripArray createIndexedTriangleStripArray(GeometryConstruct geomConstruct)
          Creates a IndexedTriangleStripArray.
static IndexedTriangleStripArray createIndexedTriangleStripArray(org.openmali.vecmath2.Tuple3f[] vertices, int[] indices, org.openmali.vecmath2.Vector3f[] normals, org.openmali.vecmath2.Colorf[] colors, org.openmali.vecmath2.TexCoord2f[] texCoords2, org.openmali.vecmath2.TexCoord3f[] texCoords3, int[] stripLengths)
          Creates an IndexedTriangleStripArray.
static IndexedTriangleArray createITAfromITSA(GeometryConstruct gcITSA)
          Creates an IndexedTriangleArray for a Shape3D.
static TriangleArray createTAfromITSA(GeometryConstruct gcITSA)
          Creates a TriangleArray for a Shape3D.
static TriangleArray createTriangleArray(GeometryConstruct geomConstruct)
          Creates a TriangleArray.
static TriangleArray createTriangleArray(org.openmali.vecmath2.Tuple3f[] vertices, org.openmali.vecmath2.Vector3f[] normals, org.openmali.vecmath2.Colorf[] colors, org.openmali.vecmath2.TexCoord2f[] texCoords2, org.openmali.vecmath2.TexCoord3f[] texCoords3)
          Creates a TriangleArray.
static TriangleStripArray createTriangleStripArray(GeometryConstruct geomConstruct)
          Creates a TriangleStripArray.
static TriangleStripArray createTriangleStripArray(org.openmali.vecmath2.Tuple3f[] vertices, org.openmali.vecmath2.Vector3f[] normals, org.openmali.vecmath2.Colorf[] colors, org.openmali.vecmath2.TexCoord2f[] texCoords2, org.openmali.vecmath2.TexCoord3f[] texCoords3, int[] stripLengths)
          Creates a TriangleStripArray.
static TriangleStripArray createTSAfromITSA(GeometryConstruct gcITSA)
          Creates a TriangleStripArray for a Shape3D.
static org.openmali.vecmath2.Colorf[] generateColors(boolean alpha, org.openmali.vecmath2.Tuple3f[] coords)
          Auto-generates the colors.
static org.openmali.vecmath2.Vector3f[] generateNaiveNormals(org.openmali.vecmath2.Tuple3f[] vertices)
          Auto-generates the normals.
static org.openmali.vecmath2.TexCoord2f[] generateTexCoords2(org.openmali.vecmath2.Tuple3f[] vertices)
          Auto-generates the texture coordinates.
static org.openmali.vecmath2.TexCoord3f[] generateTexCoords3(org.openmali.vecmath2.Tuple3f[] vertices)
          Auto-generates the texture coordinates.
static int getFeaturesFromAppearance(Appearance app)
          Retrieves the GeometryArray features from the Appearance, that are at least necessary to handle this Appearance.
static int getTexCoordsSize(Appearance app)
          Retrieves the GeometryArray features from the Appearance, that are at least necessary to handle this Appearance.
static void reverseWinding(GeometryArray ga)
          Swaps vertex 0 and 2 of each following 3.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GeomFactory

public GeomFactory()
Method Detail

reverseWinding

public static void reverseWinding(GeometryArray ga)
Swaps vertex 0 and 2 of each following 3.

Parameters:
ga -

getFeaturesFromAppearance

public static int getFeaturesFromAppearance(Appearance app)
Retrieves the GeometryArray features from the Appearance, that are at least necessary to handle this Appearance.

Parameters:
app -
Returns:
the collected GoometryArray features

getTexCoordsSize

public static int getTexCoordsSize(Appearance app)
Retrieves the GeometryArray features from the Appearance, that are at least necessary to handle this Appearance.

Parameters:
app -
Returns:
the collected GoometryArray features

generateNaiveNormals

public static org.openmali.vecmath2.Vector3f[] generateNaiveNormals(org.openmali.vecmath2.Tuple3f[] vertices)
Auto-generates the normals.

Parameters:
vertices -
Returns:
the normals-array

generateTexCoords2

public static org.openmali.vecmath2.TexCoord2f[] generateTexCoords2(org.openmali.vecmath2.Tuple3f[] vertices)
Auto-generates the texture coordinates.

Parameters:
vertices -
Returns:
the tex-coords-array

generateTexCoords3

public static org.openmali.vecmath2.TexCoord3f[] generateTexCoords3(org.openmali.vecmath2.Tuple3f[] vertices)
Auto-generates the texture coordinates.

Parameters:
vertices -
Returns:
the tex-coords-array

generateColors

public static org.openmali.vecmath2.Colorf[] generateColors(boolean alpha,
                                                            org.openmali.vecmath2.Tuple3f[] coords)
Auto-generates the colors.

Parameters:
alpha -
coords -
scale -
Returns:
the colors-array

createFullFeaturedTriangleArray

public static TriangleArray createFullFeaturedTriangleArray(org.openmali.vecmath2.Tuple3f[] vertices,
                                                            org.openmali.vecmath2.Vector3f[] normals,
                                                            org.openmali.vecmath2.Colorf[] colors,
                                                            org.openmali.vecmath2.TexCoord2f[] texCoords2,
                                                            int features,
                                                            boolean colorAlpha,
                                                            int texCoordsSize)
Creates the full-featured TriangleArray.

Parameters:
vertices -
normals -
colors -
texCoords2 -
features -
colorAlpha -
texCoordsSize -
Returns:
the TriangleArray

createFullFeaturedTriangleArray

protected static TriangleArray createFullFeaturedTriangleArray(GeometryConstruct[] geoms,
                                                               int features)
Creates the full-featured TriangleArray.

Parameters:
geoms -
Returns:
the TriangleArray

calculateFeatures

protected static int calculateFeatures(org.openmali.vecmath2.Tuple3f[] vertices,
                                       org.openmali.vecmath2.Vector3f[] normals,
                                       org.openmali.vecmath2.Colorf[] colors,
                                       org.openmali.vecmath2.TexCoord2f[] texCoords2,
                                       org.openmali.vecmath2.TexCoord3f[] texCoords3)
Calculates the GeometryArray features.

Parameters:
vertices -
normals -
texCoords2 -
texCoords3 -
colors -
Returns:
the GeometryArray features

createTriangleArray

public static TriangleArray createTriangleArray(org.openmali.vecmath2.Tuple3f[] vertices,
                                                org.openmali.vecmath2.Vector3f[] normals,
                                                org.openmali.vecmath2.Colorf[] colors,
                                                org.openmali.vecmath2.TexCoord2f[] texCoords2,
                                                org.openmali.vecmath2.TexCoord3f[] texCoords3)
Creates a TriangleArray.

Parameters:
vertices -
normals -
texCoords2 -
texCoords3 -
colors -
Returns:
the TriangleArray

createTriangleArray

public static TriangleArray createTriangleArray(GeometryConstruct geomConstruct)
Creates a TriangleArray.

Parameters:
geomConstruct -
Returns:
the TriangleArray

createIndexedTriangleArray

public static IndexedTriangleArray createIndexedTriangleArray(org.openmali.vecmath2.Tuple3f[] vertices,
                                                              int[] indices,
                                                              org.openmali.vecmath2.Vector3f[] normals,
                                                              org.openmali.vecmath2.Colorf[] colors,
                                                              org.openmali.vecmath2.TexCoord2f[] texCoords2,
                                                              org.openmali.vecmath2.TexCoord3f[] texCoords3)
Creates an IndexedTriangleArray.

Parameters:
vertices -
indices -
normals -
colors -
texCoords2 -
texCoords3 -
Returns:
the IndexedTriangleArray

createIndexedTriangleArray

public static IndexedTriangleArray createIndexedTriangleArray(GeometryConstruct geomConstruct)
Creates a IndexedTriangleArray.

Parameters:
geomConstruct -
Returns:
the IndexedTriangleArray

createTriangleStripArray

public static TriangleStripArray createTriangleStripArray(org.openmali.vecmath2.Tuple3f[] vertices,
                                                          org.openmali.vecmath2.Vector3f[] normals,
                                                          org.openmali.vecmath2.Colorf[] colors,
                                                          org.openmali.vecmath2.TexCoord2f[] texCoords2,
                                                          org.openmali.vecmath2.TexCoord3f[] texCoords3,
                                                          int[] stripLengths)
Creates a TriangleStripArray.

Parameters:
vertices -
normals -
colors -
texCoords2 -
texCoords3 -
stripLengths -
Returns:
the TriangleStripArray

createTriangleStripArray

public static TriangleStripArray createTriangleStripArray(GeometryConstruct geomConstruct)
Creates a TriangleStripArray.

Parameters:
geomConstruct -
Returns:
the TriangleStripArray

createIndexedTriangleStripArray

public static IndexedTriangleStripArray createIndexedTriangleStripArray(org.openmali.vecmath2.Tuple3f[] vertices,
                                                                        int[] indices,
                                                                        org.openmali.vecmath2.Vector3f[] normals,
                                                                        org.openmali.vecmath2.Colorf[] colors,
                                                                        org.openmali.vecmath2.TexCoord2f[] texCoords2,
                                                                        org.openmali.vecmath2.TexCoord3f[] texCoords3,
                                                                        int[] stripLengths)
Creates an IndexedTriangleStripArray.

Parameters:
vertices -
indices -
normals -
colors -
texCoords2 -
texCoords3 -
stripLengths -
Returns:
the IndexedTriangleStripArray

createIndexedTriangleStripArray

public static IndexedTriangleStripArray createIndexedTriangleStripArray(GeometryConstruct geomConstruct)
Creates a IndexedTriangleStripArray.

Parameters:
geomConstruct -
Returns:
the IndexedTriangleStripArray

createGeometryArray

public static GeometryArray createGeometryArray(GeometryConstruct gc)

convertGeometryConstructITSA2ITA

public static GeometryConstruct convertGeometryConstructITSA2ITA(GeometryConstruct gcITSA)
Converts a GeometryConstruct made for IndexedTriangleStripArray to one made for IndexedTriangleArrays.
The data instances will be the same for both GeometryConstructs!

Parameters:
gcITSA - the source GeometryConstruct made for IndexedTriangleStripArrays
Returns:
the new GeometryConstruct made for IndexedTriangleArrays

convertGeometryConstructITSA2TSA

public static GeometryConstruct convertGeometryConstructITSA2TSA(GeometryConstruct gcITSA)
Converts a GeometryConstruct made for IndexedTriangleStripArray to one made for TriangleStripArrays.
The data instances will be the same for both GeometryConstructs!

Parameters:
gcITSA - the source GeometryConstruct made for IndexedTriangleStripArrays
Returns:
the new GeometryConstruct made for TriangleStripArrays

convertGeometryConstructITSA2TA

public static GeometryConstruct convertGeometryConstructITSA2TA(GeometryConstruct gcITSA)
Converts a GeometryConstruct made for IndexedTriangleStripArray to one made for TriangleArrays.
The data instances will be the same for both GeometryConstructs!

Parameters:
gcITSA - the source GeometryConstruct made for IndexedTriangleStripArrays
Returns:
the new GeometryConstruct made for TriangleArrays

createITAfromITSA

public static IndexedTriangleArray createITAfromITSA(GeometryConstruct gcITSA)
Creates an IndexedTriangleArray for a Shape3D.

Parameters:
gcITSA - the GeometryConstruct to build it from

createTSAfromITSA

public static TriangleStripArray createTSAfromITSA(GeometryConstruct gcITSA)
Creates a TriangleStripArray for a Shape3D.

Parameters:
gcITSA - the GeometryConstruct to build it from

createTAfromITSA

public static TriangleArray createTAfromITSA(GeometryConstruct gcITSA)
Creates a TriangleArray for a Shape3D.

Parameters:
gcITSA - the GeometryConstruct to build it from