| java.lang.Object com.sun.j3d.utils.geometry.GeometryInfo
GeometryInfo | public class GeometryInfo (Code) | | The GeometryInfo object holds data for processing by the Java3D geometry
utility tools.
The NormalGenerator adds normals to geometry without normals.
The Stripifier combines adjacent triangles into triangle strips for
more efficent rendering.
Also, the GeometryCompressor can take a set of GeometryInfo objects in a
CompressionSteam and generate a CompressedGeometry object from the
geometry.
Geometry is loaded into a GeometryInfo in a manner similar to the
GeometryArray methods. The constructor for the GeometryInfo takes a flag
that specifies the kind of data being loaded. The vertex data is
specified using methods that are similar to the GeometryArray methods, but
with fewer variations.
The major difference between GeometryInfo and GeometryArray is
that the number of vertices, vertex format, and other data are specified
implictly, rather than as part of the constructor. The number of verticies
comes from the number of coordinates passed to the setCoordinates()
method. The format comes from the set of data components that are
specified. For example, calling the setCoordinates(), setColors3() and
setTextureCoordinatesParames(1, 2) methods implies a
format of COORDINATES | COLOR_3
| TEXTURE_COORDINATE_2. Indexed representation is specified by calling
the methods that specify the indices, for example
setCoordinateIndices().
Stripped primitives are loaded using the TRIANGLE_FAN_ARRAY or
TRIANGLE_STRIP_ARRAY flags to the constructor. The setStripCounts()
method specifies the length of each strip.
A set of complex polygons is loaded using the POLYGON_ARRAY
flag to the constructor. The setStripCounts() method specifies the length
of each contour of the polygons. The setContourCounts() method specifies
the number of countours in each polygon. For example, a triangle with a
triangular hole would have strip counts [3, 3] (indicating two contours of
three points) and contour counts [2] (indicating a single polygon with two
contours).
GeometryInfo itelf contains some simple utilities, such as
calculating indices for non-indexed data ("indexifying") and getting rid
of unused data in your indexed geometry ("compacting").
The geometry utility tools modify the contents of the
GeometryInfo. After processing, the resulting geometry can be extracted
from the GeometryInfo by calling getGeometryArray(). If multiple tools
are used, the order of processing should be: generate normals, then
stripify. For example, to convert a general mesh of polygons without
normals into an optimized mesh call:
GeometryInfo gi = new GeometryInfo(GeometryInfo.POLYGON_ARRAY);
// initialize the geometry info here
// generate normals
NormalGenerator ng = new NormalGenerator();
ng.generateNormals(gi);
// stripify
Stripifier st = new Stripifier();
st.stripify(gi);
GeometryArray result = gi.getGeometryArray();
See Also: NormalGenerator See Also: Stripifier See Also: com.sun.j3d.utils.compression.CompressionStream See Also: com.sun.j3d.utils.compression.GeometryCompressor See Also: javax.media.j3d.GeometryArray |
Field Summary | |
final public static int | POLYGON_ARRAY Send to the constructor to inform that the data is arranged as
possibly multi-contour, possible non-planar polygons.
The stripCounts array indicates how many vertices to use
for each contour, and the contourCounts array indicates how many
stripCounts entries to use for each polygon. | final public static int | QUAD_ARRAY | final public static int | TRIANGLE_ARRAY | final public static int | TRIANGLE_FAN_ARRAY Send to the constructor to inform that the data will be arranged so
that the stripCounts array indicates how many vertices to use
for each triangle fan. | final public static int | TRIANGLE_STRIP_ARRAY Send to the constructor to inform that the data will be arranged so
that the stripCounts array indicates how many vertices to use
for each triangle strip. |
Method Summary | |
Object[] | allocateArray(Object data, int num) Allocates an array of the same type as the input type. | public void | compact() Remove unused data from an indexed dataset.
Indexed data may contain data entries that are never referenced by
the dataset. | public void | convertToIndexedTriangles() Convert the GeometryInfo object to have primitive type TRIANGLE_ARRAY
and be indexed. | void | forgetOldPrim() | public int[] | getColorIndices() Retrieves a reference to the array of indices into the
color array.
This method should be considered for advanced users only.
Novice users should just use getGeometryArray() to retrieve
their data so that the internal format of GeometryInfo is
of no concern.
Depending on which of the utility routines you've called
on your GeometryInfo object, the results may not be what you
expect. | public Object[] | getColors() Retrieves a reference to the colors array. | public int[] | getContourCounts() Retrieves a reference to the array of contourCounts. | public int[] | getCoordinateIndices() Retrieves a reference to the array of indices into the
coordinate array.
This method should be considered for advanced users only.
Novice users should just use getGeometryArray() to retrieve
their data so that the internal format of GeometryInfo is
of no concern.
Depending on which of the utility routines you've called
on your GeometryInfo object, the results may not be what you
expect. | public Point3f[] | getCoordinates() Retrieves a reference to the coordinate array. | public GeometryArray | getGeometryArray(boolean byRef, boolean interleaved, boolean nio) Creates and returns a non-indexed Java 3D GeometryArray object
based on the data in the GeometryInfo object. | public GeometryArray | getGeometryArray() Creates and returns a non-indexed Java 3D GeometryArray object
based on the data in the GeometryInfo object. | public IndexedGeometryArray | getIndexedGeometryArray(boolean compact, boolean byRef, boolean interleaved, boolean useCoordIndexOnly, boolean nio) Creates and returns a IndexedGeometryArray
based on the data in the GeometryInfo object. | public IndexedGeometryArray | getIndexedGeometryArray(boolean compact) Creates and returns an IndexedGeometryArray
based on the data in the GeometryInfo object. | public IndexedGeometryArray | getIndexedGeometryArray() Creates and returns an IndexedGeometryArray
based on the data in the GeometryInfo object. | int[] | getListIndices(Object list) | public int[] | getNormalIndices() Retrieves a reference to the array of indices into the
Normal array.
This method should be considered for advanced users only.
Novice users should just use getGeometryArray() to retrieve
their data so that the internal format of GeometryInfo is
of no concern.
Depending on which of the utility routines you've called
on your GeometryInfo object, the results may not be what you
expect. | public Vector3f[] | getNormals() Retrieves a reference to the normal array. | public int | getNumColorComponents() Returns the number of color data components stored per vertex
in the current GeometryInfo object (3 for RGB or 4 for RGBA). | public int | getNumTexCoordComponents() Returns the number of texture coordinate components that are stored
per vertex. | int | getOldPrim() | public int | getPrimitive() Get the current primitive. | public int[] | getStripCounts() Retrieves a reference to the array of stripCounts.
This method should be considered for advanced users only.
Novice users should just use getGeometryArray() to retrieve
their data so that the internal format of GeometryInfo is
of no concern.
Depending on which of the utility routines you've called
on your GeometryInfo object, the results may not be what you
expect. | public int | getTexCoordSetCount() Returns the number of texture coordinate sets in this GeometryInfo.
This value is set with setTextureCoordinateParams().
If setTextureCoordinateParams()
has not been called, 0 is returned unless one of the deprecated
texture coordinate methods has been called. | public int[] | getTexCoordSetMap() Returns a reference to the texture coordinate set map. | public int[] | getTextureCoordinateIndices(int texCoordSet) Retrieves a reference to the specified array of texture
coordinate indices.
This method should be considered for advanced users only.
Novice users should just use getGeometryArray() to retrieve
their data so that the internal format of GeometryInfo is
of no concern.
Depending on which of the utility routines you've called
on your GeometryInfo object, the results may not be what you
expect. | public int[] | getTextureCoordinateIndices() Returns a reference to texture coordinate index set 0. | public Object[] | getTextureCoordinates(int texCoordSet) Returns a reference to the indicated texture coordinate array.
The return type will be TexCoord2f[] , TexCoord3f[]
, or TexCoord4f[] depending on the
current dimensionality of the texture coordinates in the GeometryInfo
object. | public Object[] | getTextureCoordinates() Retrieves a reference to texture coordinate set 0.
The return type will be TexCoord2f[] , TexCoord3f[]
, or TexCoord4f[] depending on the
current dimensionality of the texture coordinates in the GeometryInfo
object. | public boolean | getUseCoordIndexOnly() Returns true if the data in this GeometryInfo is currently
formatted in the USE_COORD_INDEX_ONLY format where a single
index list is used to index into all data lists. | public void | indexify(boolean useCoordIndexOnly) Create index lists for all data lists.
Identical data entries are guaranteed to
use the same index value. | public void | indexify() | public void | recomputeIndices() Redo indexes to guarantee connection information.
Use this routine if your original data is in indexed format, but
you don't trust that the indexing is correct. | void | rememberOldPrim() | public void | reset(int primitive) Removes all data from the GeometryInfo and resets the primitive. | public void | reset(GeometryArray ga) Removes all data from this GeometryInfo and populates it with
the geometry from the GeometryArray. | public void | reverse() Reverse the order of all lists. | public void | setColorIndices(int colorIndices) Sets the array of indices into the Color array.
No data copying is done - a reference to user data is used. | public void | setColors(Color3f colors) Sets the colors array. | public void | setColors(Color4f colors) Sets the colors array. | public void | setColors(Color3b colors) Sets the colors array. | public void | setColors(Color4b colors) Sets the colors array. | public void | setColors3(float colors) Sets the colors array. | public void | setColors3(byte colors) Sets the colors array. | public void | setColors4(float colors) Sets the colors array. | public void | setColors4(byte colors) Sets the colors array. | public void | setContourCounts(int contourCounts) Sets the list of contour counts. | public void | setCoordinateIndices(int coordinateIndices) Sets the array of indices into the Coordinate array.
No data copying is done - a reference to user data is used. | public void | setCoordinates(Point3f coordinates) Sets the coordinates array. | public void | setCoordinates(Point3d coordinates) Sets the coordinates array. | public void | setCoordinates(float coordinates) Sets the coordinates array. | public void | setCoordinates(double coordinates) Sets the coordinates array. | public void | setNormalIndices(int normalIndices) Sets the array of indices into the Normal array.
No data copying is done - a reference to user data is used. | public void | setNormals(Vector3f normals) Sets the normals array. | public void | setNormals(float normals) Sets the normals array. | void | setPrimitive(int primitive) Set the current primitive. | public void | setStripCounts(int stripCounts) Sets the array of strip counts. | public void | setTexCoordSetMap(int map) Sets the mapping between texture coordinate sets and texture units.
See the
GeometryArray constructor for further details.
Note: If the texCoordSetMap is not set, multi-texturing is
turned off. | public void | setTextureCoordinateIndices(int texCoordSet, int texIndices) Sets one of the texture coordinate index arrays.
No data copying is done - a reference to user data is used. | public void | setTextureCoordinateIndices(int texIndices) Sets the array of indices into texture coordinate set 0. | public void | setTextureCoordinateParams(int numSets, int dim) This method is used to specify the number of texture coordinate sets
and the dimensionality of the texture coordinates.
The number of texture coordinate sets must be specified to the GeometryInfo
class before any of the sets are specified. | public void | setTextureCoordinates(int texCoordSet, TexCoord2f texCoords) Sets the 2D texture coordinates for the specified set.
No data copying is done - a reference to user data is used. | public void | setTextureCoordinates(Point2f texCoords) Sets the TextureCoordinates array by copying the data
into the GeometryInfo object. | public void | setTextureCoordinates(int texCoordSet, TexCoord3f texCoords) Sets the texture coordinates array for the specified set.
No data copying is done - a reference to user data is used. | public void | setTextureCoordinates(Point3f texCoords) Sets the TextureCoordinates array by copying the data
into the GeometryInfo object. | public void | setTextureCoordinates(int texCoordSet, TexCoord4f texCoords) Sets the texture coordinates array for the specified set.
No data copying is done - a reference to user data is used. | public void | setTextureCoordinates(int texCoordSet, float texCoords) Sets the texture coordinates array by copying the data into the
GeometryInfo object. | public void | setTextureCoordinates2(float texCoords) Sets the texture coordinates array by copying the data
into the GeometryInfo object, assuming two numbers
(S and T) per vertex. | public void | setTextureCoordinates3(float texCoords) Sets the TextureCoordinates array by copying the data
into the GeometryInfo object, assuming three numbers
(S, T, & R) per vertex. | public void | setUseCoordIndexOnly(boolean useCoordIndexOnly) Tells the GeometryInfo that its data is formatted in the
USE_COORD_INDEX_ONLY format with a single index list
(the coordinate index list) that indexes into all data
lists (coordinates, normals, colors, and texture
coordinates). | public void | unindexify() Get rid of index lists by reorganizing data into an un-indexed
format. |
POLYGON_ARRAY | final public static int POLYGON_ARRAY(Code) | | Send to the constructor to inform that the data is arranged as
possibly multi-contour, possible non-planar polygons.
The stripCounts array indicates how many vertices to use
for each contour, and the contourCounts array indicates how many
stripCounts entries to use for each polygon. The first
contour is the bounding polygon, and subsequent contours are
"holes." If contourCounts is left null, the default is
one contour per polygon.
|
QUAD_ARRAY | final public static int QUAD_ARRAY(Code) | | Send to the constructor to inform that the data will be arranged so
that each set of four vertices form an independent quad
|
TRIANGLE_ARRAY | final public static int TRIANGLE_ARRAY(Code) | | Send to the constructor to inform that the data will be arranged so
that each set of three vertices form an independent triangle
|
TRIANGLE_FAN_ARRAY | final public static int TRIANGLE_FAN_ARRAY(Code) | | Send to the constructor to inform that the data will be arranged so
that the stripCounts array indicates how many vertices to use
for each triangle fan.
|
TRIANGLE_STRIP_ARRAY | final public static int TRIANGLE_STRIP_ARRAY(Code) | | Send to the constructor to inform that the data will be arranged so
that the stripCounts array indicates how many vertices to use
for each triangle strip.
|
GeometryInfo | public GeometryInfo(int primitive)(Code) | | Constructor.
Creates an empty GeometryInfo object.
Parameters: primitive - Tells the GeometryInfo object the type ofprimitive data to be storedin it, so it will know the format of the data. It can be one ofTRIANGLE_ARRAY, QUAD_ARRAY, TRIANGLE_FAN_ARRAY, TRIANGLE_STRIP_ARRAY, or POLYGON_ARRAY. |
GeometryInfo | public GeometryInfo(GeometryArray ga)(Code) | | Contructor. Populates the GeometryInfo with the geometry from
the GeometryArray.
If the GeometryArray uses the Initial and
Valid GeometryArray methods (
setInitialVertexIndex() and setValidVertexCount()
and their cousins) then only the needed geometry
is copied into the GeometryInfo.
|
allocateArray | Object[] allocateArray(Object data, int num)(Code) | | Allocates an array of the same type as the input type. This allows us to
use a generic compactData method.
Parameters: data - Array of coordinate, color, normal or texture coordinate dataThe data can be in one of the following formats - Point3f, Color3f, Color4f, TexCoord2f, TexCoord3f, TexCoord4f. Parameters: num - The size of the array to be allocated An array of size num of the same type as the input type exception: IllegalArgumentException - if the input array is not one of the types listed above. |
compact | public void compact()(Code) | | Remove unused data from an indexed dataset.
Indexed data may contain data entries that are never referenced by
the dataset. This routine will remove those entries where
appropriate and renumber the indices to match the new values.
throws: IllegalArgumentException - if coordinate data is missing,if the index lists aren't all thesame length, if an index list is set and the corresponding datalist isn't set, if a data list is set and the correspondingindex list is unset (unless all index lists are unset or inUSE_COORD_INDEX_ONLY format),if StripCounts or ContourCounts is inconsistent with the currentprimitive, if the sum of the contourCounts array doesn't equalthe length of the StripCounts array, or if the number of verticesisn't a multiple of three (for triangles) or four (for quads). |
convertToIndexedTriangles | public void convertToIndexedTriangles()(Code) | | Convert the GeometryInfo object to have primitive type TRIANGLE_ARRAY
and be indexed.
throws: IllegalArgumentException - if coordinate data is missing,if the index lists aren't all thesame length, if an index list is set and the corresponding datalist isn't set, if a data list is set and the correspondingindex list is unset (unless all index lists are unset or inUSE_COORD_INDEX_ONLY format),if StripCounts or ContourCounts is inconsistent with the currentprimitive, if the sum of the contourCounts array doesn't equalthe length of the StripCounts array, or if the number of verticesisn't a multiple of three (for triangles) or four (for quads). |
forgetOldPrim | void forgetOldPrim()(Code) | | |
getColorIndices | public int[] getColorIndices()(Code) | | Retrieves a reference to the array of indices into the
color array.
This method should be considered for advanced users only.
Novice users should just use getGeometryArray() to retrieve
their data so that the internal format of GeometryInfo is
of no concern.
Depending on which of the utility routines you've called
on your GeometryInfo object, the results may not be what you
expect. If you've called the Stripifier, your GeometryInfo
object's Primitive has been changed to indexed TRIANGLE_STRIP_ARRAY
and your data will be formatted accordingly. Similarly, if
you've called the Triangulator, your data is in indexed
TRIANGLE_ARRAY format. Generating normals with the NormalGenerator
utility will convert your data to indexed TRIANGLE_ARRAY also,
but if you call getGeometryArray without calling the Stripifier or
Triangulator, your data will be converted back to the original
primitive type when creating the GeometryArray object to pass
back. However, if your creaseAngle was not Math.PI (no creases -
smooth shading), then the introduction of
creases into your model may have split primitives, lengthening
the StripCounts and index arrays from your original data.
|
getColors | public Object[] getColors()(Code) | | Retrieves a reference to the colors array. Will be either
Color3f[] or Color4f[] depending on
the type of the input data. Call
getNumColorComponents() to find out which version is returned.
|
getContourCounts | public int[] getContourCounts()(Code) | | Retrieves a reference to the array of contourCounts.
|
getCoordinateIndices | public int[] getCoordinateIndices()(Code) | | Retrieves a reference to the array of indices into the
coordinate array.
This method should be considered for advanced users only.
Novice users should just use getGeometryArray() to retrieve
their data so that the internal format of GeometryInfo is
of no concern.
Depending on which of the utility routines you've called
on your GeometryInfo object, the results may not be what you
expect. If you've called the Stripifier, your GeometryInfo
object's Primitive has been changed to indexed TRIANGLE_STRIP_ARRAY
and your data will be formatted accordingly. Similarly, if
you've called the Triangulator, your data is in indexed
TRIANGLE_ARRAY format. Generating normals with the NormalGenerator
utility will convert your data to indexed TRIANGLE_ARRAY also,
but if you call getGeometryArray without calling the Stripifier or
Triangulator, your data will be converted back to the original
primitive type when creating the GeometryArray object to pass
back. However, if your creaseAngle was not Math.PI (no creases -
smooth shading), then the introduction of
creases into your model may have split primitives, lengthening
the StripCounts and index arrays from your original data.
|
getCoordinates | public Point3f[] getCoordinates()(Code) | | Retrieves a reference to the coordinate array.
|
getGeometryArray | public GeometryArray getGeometryArray(boolean byRef, boolean interleaved, boolean nio)(Code) | | Creates and returns a non-indexed Java 3D GeometryArray object
based on the data in the GeometryInfo object. This object is
suitable to be attached to a Shape3D node for rendering.
Parameters: byRef - Use geometry BY_REFERENCE Parameters: interleaved - Use INTERLEAVED geometry. Implies byRef istrue as well. Parameters: nio - Create GeometryArray using java.nio.Buffer forgeometry arrays. Only usable on JDK 1.4 or higher. ImpliesbyRef is true as well. throws: IllegalArgumentException - if coordinate data is missing,if the index lists aren't all thesame length, if an index list is set and the corresponding datalist isn't set, if a data list is set and the correspondingindex list is unset (unless all index lists are unset or inUSE_COORD_INDEX_ONLY format),if StripCounts or ContourCounts is inconsistent with the currentprimitive, if the sum of the contourCounts array doesn't equalthe length of the StripCounts array, or if the number of verticesisn't a multiple of three (for triangles) or four (for quads). |
getGeometryArray | public GeometryArray getGeometryArray()(Code) | | Creates and returns a non-indexed Java 3D GeometryArray object
based on the data in the GeometryInfo object. This object is
suitable to be attached to a Shape3D node for rendering.
The geometry is not created using data BY_REFERENCE,
INTERLEAVED, or USE_NIO_BUFFER.
throws: IllegalArgumentException - if coordinate data is missing,if the index lists aren't all thesame length, if an index list is set and the corresponding datalist isn't set, if a data list is set and the correspondingindex list is unset (unless all index lists are unset or inUSE_COORD_INDEX_ONLY format),if StripCounts or ContourCounts is inconsistent with the currentprimitive, if the sum of the contourCounts array doesn't equalthe length of the StripCounts array, or if the number of verticesisn't a multiple of three (for triangles) or four (for quads). |
getIndexedGeometryArray | public IndexedGeometryArray getIndexedGeometryArray(boolean compact, boolean byRef, boolean interleaved, boolean useCoordIndexOnly, boolean nio)(Code) | | Creates and returns a IndexedGeometryArray
based on the data in the GeometryInfo object. This object is
suitable to be attached to a Shape3D node for rendering.
Parameters: compact - Remove Coordinates, Colors, Normals, and TextureCoordinates that aren't referenced by any indices. Parameters: byRef - Create the IndexedGeometryArray using geometryBY_REFERENCE. Parameters: interleaved - Use INTERLEAVED geometry. Implies byRef istrue as well. Parameters: nio - Create GeometryArray using java.nio.Buffer forgeometry arrays. Only usable on JDK 1.4 or higher. ImpliesbyRef is true as well. Parameters: useCoordIndexOnly - Create the IndexedGeometryArray usingUSE_COORD_INDEX_ONLY. Values from the coordinate index arrayare used as a single set of indices into all vertex component arrays (coord, color, normal, and texCoord). throws: IllegalArgumentException - if coordinate data is missing,if the index lists aren't all thesame length, if an index list is set and the corresponding datalist isn't set, if a data list is set and the correspondingindex list is unset (unless all index lists are unset or inUSE_COORD_INDEX_ONLY format),if StripCounts or ContourCounts is inconsistent with the currentprimitive, if the sum of the contourCounts array doesn't equalthe length of the StripCounts array, or if the number of verticesisn't a multiple of three (for triangles) or four (for quads). |
getIndexedGeometryArray | public IndexedGeometryArray getIndexedGeometryArray(boolean compact)(Code) | | Creates and returns an IndexedGeometryArray
based on the data in the GeometryInfo object. This object is
suitable to be attached to a Shape3D node for rendering.
Equivalent to getIndexedGeometryArray(compact, false,
false, false, false) .
Parameters: compact - Remove Coordinates, Colors, Normals, and TextureCoordinates that aren't referenced by any indices. throws: IllegalArgumentException - if coordinate data is missing,if the index lists aren't all thesame length, if an index list is set and the corresponding datalist isn't set, if a data list is set and the correspondingindex list is unset (unless all index lists are unset or inUSE_COORD_INDEX_ONLY format),if StripCounts or ContourCounts is inconsistent with the currentprimitive, if the sum of the contourCounts array doesn't equalthe length of the StripCounts array, or if the number of verticesisn't a multiple of three (for triangles) or four (for quads). |
getIndexedGeometryArray | public IndexedGeometryArray getIndexedGeometryArray()(Code) | | Creates and returns an IndexedGeometryArray
based on the data in the GeometryInfo object. This object is
suitable to be attached to a Shape3D node for rendering.
Equivalent to getIndexedGeometryArray(false, false,
false, false, false) .
throws: IllegalArgumentException - if coordinate data is missing,if the index lists aren't all thesame length, if an index list is set and the corresponding datalist isn't set, if a data list is set and the correspondingindex list is unset (unless all index lists are unset or inUSE_COORD_INDEX_ONLY format),if StripCounts or ContourCounts is inconsistent with the currentprimitive, if the sum of the contourCounts array doesn't equalthe length of the StripCounts array, or if the number of verticesisn't a multiple of three (for triangles) or four (for quads). |
getNormalIndices | public int[] getNormalIndices()(Code) | | Retrieves a reference to the array of indices into the
Normal array.
This method should be considered for advanced users only.
Novice users should just use getGeometryArray() to retrieve
their data so that the internal format of GeometryInfo is
of no concern.
Depending on which of the utility routines you've called
on your GeometryInfo object, the results may not be what you
expect. If you've called the Stripifier, your GeometryInfo
object's Primitive has been changed to indexed TRIANGLE_STRIP_ARRAY
and your data will be formatted accordingly. Similarly, if
you've called the Triangulator, your data is in indexed
TRIANGLE_ARRAY format. Generating normals with the NormalGenerator
utility will convert your data to indexed TRIANGLE_ARRAY also,
but if you call getGeometryArray without calling the Stripifier or
Triangulator, your data will be converted back to the original
primitive type when creating the GeometryArray object to pass
back. However, if your creaseAngle was not Math.PI (no creases -
smooth shading), then the introduction of
creases into your model may have split primitives, lengthening
the StripCounts and index arrays from your original data.
|
getNormals | public Vector3f[] getNormals()(Code) | | Retrieves a reference to the normal array.
|
getNumColorComponents | public int getNumColorComponents()(Code) | | Returns the number of color data components stored per vertex
in the current GeometryInfo object (3 for RGB or 4 for RGBA).
If no colors are currently defined, 0 is returned.
|
getNumTexCoordComponents | public int getNumTexCoordComponents()(Code) | | Returns the number of texture coordinate components that are stored
per vertex. Returns 2 for ST (2D), 3 for STR (3D),
or 4 for STRQ (4D), aslo known as the "dimensionality" of the
coordinates. This value is set with
setTextureCoordinateParams(). If setTextureCoordinateParams()
has not been called, 0 is returned unless one of the deprecated
texture coordinate methods has been called. Calling one of the
deprecated texture coordinate methods sets the dimensionality
explicitly (if you called setTextureCoordinates(Point2f[]) then
2 is returned).
The deprecated texture coordinate methods are those that don't
take texCoordSet as the first parameter.
|
getOldPrim | int getOldPrim()(Code) | | |
getPrimitive | public int getPrimitive()(Code) | | Get the current primitive. Some of the utilities may change the
primitive type of the data stored in the GeometryInfo object
(for example, the stripifyer will change it to TRIANGLE_STRIP_ARRAY).
|
getStripCounts | public int[] getStripCounts()(Code) | | Retrieves a reference to the array of stripCounts.
This method should be considered for advanced users only.
Novice users should just use getGeometryArray() to retrieve
their data so that the internal format of GeometryInfo is
of no concern.
Depending on which of the utility routines you've called
on your GeometryInfo object, the results may not be what you
expect. If you've called the Stripifier, your GeometryInfo
object's Primitive has been changed to indexed TRIANGLE_STRIP_ARRAY
and your data will be formatted accordingly. Similarly, if
you've called the Triangulator, your data is in indexed
TRIANGLE_ARRAY format. Generating normals with the NormalGenerator
utility will convert your data to indexed TRIANGLE_ARRAY also,
but if you call getGeometryArray without calling the Stripifier or
Triangulator, your data will be converted back to the original
primitive type when creating the GeometryArray object to pass
back. However, if your creaseAngle was not Math.PI (no creases -
smooth shading), then the introduction of
creases into your model may have split primitives, lengthening
the StripCounts and index arrays from your original data.
|
getTexCoordSetCount | public int getTexCoordSetCount()(Code) | | Returns the number of texture coordinate sets in this GeometryInfo.
This value is set with setTextureCoordinateParams().
If setTextureCoordinateParams()
has not been called, 0 is returned unless one of the deprecated
texture coordinate methods has been called. Calling one of the
deprecated texture coordinate methods sets the count to 1.
The deprecated texture coordinate methods are those that don't
take texCoordSet as the first parameter.
the number of texture coordinate sets in thisGeometryInfo. |
getTexCoordSetMap | public int[] getTexCoordSetMap()(Code) | | Returns a reference to the texture coordinate set map.
See the
GeometryArray constructor for further details.
|
getTextureCoordinateIndices | public int[] getTextureCoordinateIndices(int texCoordSet)(Code) | | Retrieves a reference to the specified array of texture
coordinate indices.
This method should be considered for advanced users only.
Novice users should just use getGeometryArray() to retrieve
their data so that the internal format of GeometryInfo is
of no concern.
Depending on which of the utility routines you've called
on your GeometryInfo object, the results may not be what you
expect. If you've called the Stripifier, your GeometryInfo
object's Primitive has been changed to indexed TRIANGLE_STRIP_ARRAY
and your data will be formatted accordingly. Similarly, if
you've called the Triangulator, your data is in indexed
TRIANGLE_ARRAY format. Generating normals with the NormalGenerator
utility will convert your data to indexed TRIANGLE_ARRAY also,
but if you call getGeometryArray without calling the Stripifier or
Triangulator, your data will be converted back to the original
primitive type when creating the GeometryArray object to pass
back. However, if your creaseAngle was not Math.PI (no creases -
smooth shading), then the introduction of
creases into your model may have split primitives, lengthening
the StripCounts and index arrays from your original data.
Parameters: texCoordSet - The texture coordinate index set to beretrieved. Integer array of the texture coordinate indices for the specifiedset. |
getTextureCoordinateIndices | public int[] getTextureCoordinateIndices()(Code) | | Returns a reference to texture coordinate index set 0.
Equivalent to
getTextureCoordinateIndices(0) .
Integer array of the texture coordinate indices for set 0 |
getTextureCoordinates | public Object[] getTextureCoordinates(int texCoordSet)(Code) | | Returns a reference to the indicated texture coordinate array.
The return type will be TexCoord2f[] , TexCoord3f[]
, or TexCoord4f[] depending on the
current dimensionality of the texture coordinates in the GeometryInfo
object. Use getNumTexCoordComponents() to find out which
version is returned.
Parameters: texCoordSet - The index of the texture coordinate set toretrieve. An array of texture coordinates at the specified index throws: IllegalArgumentException - If texCoordSet < 0or texCoordSet >= texCoordSetCount |
getTextureCoordinates | public Object[] getTextureCoordinates()(Code) | | Retrieves a reference to texture coordinate set 0.
The return type will be TexCoord2f[] , TexCoord3f[]
, or TexCoord4f[] depending on the
current dimensionality of the texture coordinates in the GeometryInfo
object. Use getNumTexCoordComponents() to find out which
version is returned. Equivalent to getTextureCoordinates(0) .
An array of texture coordinates for set 0. |
indexify | public void indexify(boolean useCoordIndexOnly)(Code) | | Create index lists for all data lists.
Identical data entries are guaranteed to
use the same index value. Does not remove unused data values
from the object - call compact() to do this.
Parameters: useCoordIndexOnly - Reformat the data into theGeometryArray.USE_COORD_INDEX_ONLY format where there is onlyone index list. If the data is already in the USE_COORD_INDEX_ONLYformat, sending false (or calling indexify()) will changeit to the normal indexed format. throws: IllegalArgumentException - if coordinate data is missing,if the index lists aren't all thesame length, if an index list is set and the corresponding datalist isn't set, if a data list is set and the correspondingindex list is unset (unless all index lists are unset or inUSE_COORD_INDEX_ONLY format),if StripCounts or ContourCounts is inconsistent with the currentprimitive, if the sum of the contourCounts array doesn't equalthe length of the StripCounts array, or if the number of verticesisn't a multiple of three (for triangles) or four (for quads). |
indexify | public void indexify()(Code) | | |
recomputeIndices | public void recomputeIndices()(Code) | | Redo indexes to guarantee connection information.
Use this routine if your original data is in indexed format, but
you don't trust that the indexing is correct. After this
routine it is guaranteed that two points with the same
position will have the same coordinate index (for example).
Try this if you see
glitches in your normals or stripification, to rule out
bad indexing as the source of the problem. Works with normal
indexed format or USE_COORD_INDEX_ONLY format.
throws: IllegalArgumentException - if coordinate data is missing,if the index lists aren't all thesame length, if an index list is set and the corresponding datalist isn't set, if a data list is set and the correspondingindex list is unset (unless all index lists are unset or inUSE_COORD_INDEX_ONLY format),if StripCounts or ContourCounts is inconsistent with the currentprimitive, if the sum of the contourCounts array doesn't equalthe length of the StripCounts array, or if the number of verticesisn't a multiple of three (for triangles) or four (for quads). |
rememberOldPrim | void rememberOldPrim()(Code) | | |
reset | public void reset(int primitive)(Code) | | Removes all data from the GeometryInfo and resets the primitive.
After a call to reset(), the GeometryInfo object will be just like
it was when it was newly constructed.
Parameters: primitive - Either TRIANGLE_ARRAY, QUAD_ARRAY,TRIANGLE_FAN_ARRAY, TRIANGLE_STRIP_ARRAY, or POLYGON_ARRAY.Tells the GeometryInfo object the type of primitive data to be storedin it, so it will know the format of the data. |
reset | public void reset(GeometryArray ga)(Code) | | Removes all data from this GeometryInfo and populates it with
the geometry from the GeometryArray.
|
reverse | public void reverse()(Code) | | Reverse the order of all lists. If your polygons are formatted with
clockwise winding, you will always see the back and never the front.
(Java 3D always wants vertices specified with a counter-clockwise
winding.)
This method will (in effect) reverse the winding of your data by
inverting all of the index lists and the stripCounts
and contourCounts lists.
throws: IllegalArgumentException - if coordinate data is missing,if the index lists aren't all thesame length, if an index list is set and the corresponding datalist isn't set, if a data list is set and the correspondingindex list is unset (unless all index lists are unset or inUSE_COORD_INDEX_ONLY format),if StripCounts or ContourCounts is inconsistent with the currentprimitive, if the sum of the contourCounts array doesn't equalthe length of the StripCounts array, or if the number of verticesisn't a multiple of three (for triangles) or four (for quads). |
setColorIndices | public void setColorIndices(int colorIndices)(Code) | | Sets the array of indices into the Color array.
No data copying is done - a reference to user data is used.
|
setColors | public void setColors(Color3f colors)(Code) | | Sets the colors array.
No data copying is done because a reference to
user data is used.
|
setColors | public void setColors(Color4f colors)(Code) | | Sets the colors array.
No data copying is done because a reference to
user data is used.
|
setColors | public void setColors(Color3b colors)(Code) | | Sets the colors array.
The points are copied into the GeometryInfo object.
|
setColors | public void setColors(Color4b colors)(Code) | | Sets the colors array.
The points are copied into the GeometryInfo object.
|
setColors3 | public void setColors3(float colors)(Code) | | Sets the colors array.
The points are copied into the GeometryInfo object, assuming
3 components (R, G, and B) per vertex.
|
setColors3 | public void setColors3(byte colors)(Code) | | Sets the colors array.
The points are copied into the GeometryInfo object, assuming
3 components (R, G, and B) per vertex.
|
setColors4 | public void setColors4(float colors)(Code) | | Sets the colors array.
The points are copied into the GeometryInfo object, assuming
4 components (R, G, B, and A) per vertex.
|
setColors4 | public void setColors4(byte colors)(Code) | | Sets the colors array.
The points are copied into the GeometryInfo object, assuming
4 components (R, G, B, and A) per vertex.
|
setContourCounts | public void setContourCounts(int contourCounts)(Code) | | Sets the list of contour counts. Only used with the POLYGON_ARRAY
primitive. Polygons can be made of several vertex lists
called contours. The first list is the polygon, and
subsequent lists are "holes" that are removed from the
polygon. All of the holes must be contained entirely
within the polygon.
|
setCoordinateIndices | public void setCoordinateIndices(int coordinateIndices)(Code) | | Sets the array of indices into the Coordinate array.
No data copying is done - a reference to user data is used.
|
setCoordinates | public void setCoordinates(Point3f coordinates)(Code) | | Sets the coordinates array.
No data copying is done because a reference to user data is used.
|
setCoordinates | public void setCoordinates(Point3d coordinates)(Code) | | Sets the coordinates array.
The points are copied into the GeometryInfo object.
|
setCoordinates | public void setCoordinates(float coordinates)(Code) | | Sets the coordinates array.
The points are copied into the GeometryInfo object.
|
setCoordinates | public void setCoordinates(double coordinates)(Code) | | Sets the coordinates array.
The points are copied into the GeometryInfo object.
|
setNormalIndices | public void setNormalIndices(int normalIndices)(Code) | | Sets the array of indices into the Normal array.
No data copying is done - a reference to user data is used.
|
setNormals | public void setNormals(Vector3f normals)(Code) | | Sets the normals array.
No data copying is done because a reference to
user data is used.
|
setNormals | public void setNormals(float normals)(Code) | | Sets the normals array.
The points are copied into the GeometryInfo object.
|
setPrimitive | void setPrimitive(int primitive)(Code) | | Set the current primitive. Some of the utilities may change the
primitive type of the data stored in the GeometryInfo object
(for example, the stripifyer will change it to TRIANGLE_STRIP_ARRAY).
But the user can't change the primitive type - it is set in the
constructor. Therefore, this method has package scope.
|
setStripCounts | public void setStripCounts(int stripCounts)(Code) | | Sets the array of strip counts. If index lists have been set for
this GeomteryInfo object then the data is indexed and the stripCounts
are like stripIndexCounts. If no index lists have been set then
the data is non-indexed and the stripCounts are like
stripVertexCounts.
See Also: GeometryStripArray#GeometryStripArray(int, int,
* int[] stripVertexCounts) See Also: IndexedGeometryStripArray#IndexedGeometryStripArray(int, int, int,
* int[] stripIndexCounts) |
setTexCoordSetMap | public void setTexCoordSetMap(int map)(Code) | | Sets the mapping between texture coordinate sets and texture units.
See the
GeometryArray constructor for further details.
Note: If the texCoordSetMap is not set, multi-texturing is
turned off. Only the texture coordinate set at index 0 (if set) will be
used. Any other sets specified by the GeometryInfo.setTextureCoordinate*
methods will be ignored.
|
setTextureCoordinateIndices | public void setTextureCoordinateIndices(int texCoordSet, int texIndices)(Code) | | Sets one of the texture coordinate index arrays.
No data copying is done - a reference to user data is used.
Parameters: texCoordSet - The texture coordinate set for which these coordinate indices are being specified. Parameters: texIndices - The integer array of indices into the specified texture coordinate set throws: IllegalArgumentException - If texCoordSet < 0 ortexCoordSet >= texCoordSetCount . |
setTextureCoordinateIndices | public void setTextureCoordinateIndices(int texIndices)(Code) | | Sets the array of indices into texture coordinate set 0. Do not
call this method if you are using more than one set of texture
coordinates.
No data is copied - a reference to the user data is used.
throws: IllegalArgumentException - If texCoordSetCount > 1 . |
setTextureCoordinateParams | public void setTextureCoordinateParams(int numSets, int dim)(Code) | | This method is used to specify the number of texture coordinate sets
and the dimensionality of the texture coordinates.
The number of texture coordinate sets must be specified to the GeometryInfo
class before any of the sets are specified. The dimensionality of the
texture coordinates may be 2, 3, or 4, corresponding to 2D, 3D, or 4D
texture coordinates respectively.(All sets must have the same
dimensionality.) The default is zero, 2D texture coordinate sets.
This method should be called before any texture coordinate sets are
specified because calling this method will delete all previously
specified texture coordinate and texture coordinate index arrays
associated with this GeometryInfo. For example:
geomInfo.setTextureCoordinateParams(2, 3);
geomInfo.setTextureCoordinates(0, tex0);
geomInfo.setTextureCoordinates(1, tex1);
geomInfo.setTextureCoordinateParams(1, 2);
geomInfo.getTexCoordSetCount();
The second call to setTextureCoordinateParams will erase all
the texture coordinate arrays, so the subsequent call to
getTexCoordSetCount will return 1.
Parameters: numSets - The number of texture coordinate sets that will be specified for this GeometryInfo object. Parameters: dim - The dimensionality of the texture coordinates. Has to be 2, 3 or 4. throws: IllegalArgumentException - if the dimensionality of the texture coordinates is not one of 2, 3 or 4. |
setTextureCoordinates | public void setTextureCoordinates(int texCoordSet, TexCoord2f texCoords)(Code) | | Sets the 2D texture coordinates for the specified set.
No data copying is done - a reference to user data is used.
Parameters: texCoordSet - The texture coordinate set for which these coordinates are being specified. Parameters: texCoords - Array of 2D texture coordinates. throws: IllegalArgumentException - if texCoordSet < 0 ortexCoordSet >= texCoordSetCount ,or the texture coordinate parameters were not previously set bycalling setTextureCoordinateParams(texCoordSetCount, 2) . |
setTextureCoordinates | public void setTextureCoordinates(Point2f texCoords)(Code) | | Sets the TextureCoordinates array by copying the data
into the GeometryInfo object.
This method sets the number of texture coordinate sets to 1,
sets the dimensionality of the texture coordinates to 2,
and sets the coordinates for texture coordinate set 0.
|
setTextureCoordinates | public void setTextureCoordinates(int texCoordSet, TexCoord3f texCoords)(Code) | | Sets the texture coordinates array for the specified set.
No data copying is done - a reference to user data is used.
Parameters: texCoordSet - The texture coordinate set for which these coordinates are being specified. Parameters: texCoords - Array of 3D texture coordinates. throws: IllegalArgumentException - if texCoordSet < 0 ortexCoordSet >= texCoordSetCount ,or the texture coordinate parameters were not previously set bycalling setTextureCoordinateParams(texCoordSetCount, 3) . |
setTextureCoordinates | public void setTextureCoordinates(Point3f texCoords)(Code) | | Sets the TextureCoordinates array by copying the data
into the GeometryInfo object.
This method sets the number of texture coordinate sets to 1,
sets the dimensionality of the texture coordinates to 3,
and sets the coordinates for texture coordinate set 0.
|
setTextureCoordinates | public void setTextureCoordinates(int texCoordSet, TexCoord4f texCoords)(Code) | | Sets the texture coordinates array for the specified set.
No data copying is done - a reference to user data is used.
Parameters: texCoordSet - The texture coordinate set for which these coordinates are being specified. Parameters: texCoords - Array of 4D texture coordinates. throws: IllegalArgumentException - if texCoordSet < 0 ortexCoordSet >= texCoordSetCount ,or the texture coordinate parameters were not previously set bycalling setTextureCoordinateParams(texCoordSetCount, 4) . |
setTextureCoordinates | public void setTextureCoordinates(int texCoordSet, float texCoords)(Code) | | Sets the texture coordinates array by copying the data into the
GeometryInfo object. The number of sets and dimensionality of
the sets must have been set previously with
setTextureCoordinateParams(texCoordSetCount, dim).
Parameters: texCoordSet - The texture coordinate set for which these coordinates are being specified. Parameters: texCoords - The float array of texture coordinates. For n texture coordinates with dimensionality d, there must be d*n floats in the array. throws: IllegalArgumentException - if texCoordSet < 0 ortexCoordSet >= texCoordSetCount ,or the texture coordinate parameters were not previously set bycalling setTextureCoordinateParams . |
setTextureCoordinates2 | public void setTextureCoordinates2(float texCoords)(Code) | | Sets the texture coordinates array by copying the data
into the GeometryInfo object, assuming two numbers
(S and T) per vertex.
This method sets the number of texture coordinate sets to 1,
sets the dimensionality of the texture coordinates to 2,
and sets the coordinates for texture coordinate set 0.
|
setTextureCoordinates3 | public void setTextureCoordinates3(float texCoords)(Code) | | Sets the TextureCoordinates array by copying the data
into the GeometryInfo object, assuming three numbers
(S, T, & R) per vertex.
This method sets the number of texture coordinate sets to 1,
sets the dimensionality of the texture coordinates to 3,
and sets the coordinates for texture coordinate set 0.
|
setUseCoordIndexOnly | public void setUseCoordIndexOnly(boolean useCoordIndexOnly)(Code) | | Tells the GeometryInfo that its data is formatted in the
USE_COORD_INDEX_ONLY format with a single index list
(the coordinate index list) that indexes into all data
lists (coordinates, normals, colors, and texture
coordinates). NOTE: this will not convert the data
for you. This method is for when you are sending in
data useng the setCoordinates, setNormals, setColors,
and/or setTextureCoordinates methods, and you are only
setting one index using setCoordinateIndices(). If
you want GeometryInfo to convert your data to the
USE_COORD_INDEX_ONLY format, use indexify(true) or
getIndexedGeometryArray with the useCoordIndexOnly
parameter set to true.
See Also: GeometryInfo.indexify(boolean) See Also: GeometryInfo.getIndexedGeometryArray(booleanbooleanbooleanbooleanboolean) |
unindexify | public void unindexify()(Code) | | Get rid of index lists by reorganizing data into an un-indexed
format. Does nothing if no index lists are set.
throws: IllegalArgumentException - if coordinate data is missing,if the index lists aren't all thesame length, if an index list is set and the corresponding datalist isn't set, if a data list is set and the correspondingindex list is unset (unless all index lists are unset or inUSE_COORD_INDEX_ONLY format),if StripCounts or ContourCounts is inconsistent with the currentprimitive, if the sum of the contourCounts array doesn't equalthe length of the StripCounts array, or if the number of verticesisn't a multiple of three (for triangles) or four (for quads). |
|
|