javax.media.ding3d.utils.geometry.compression
Class CompressionStream

java.lang.Object
  extended by javax.media.ding3d.utils.geometry.compression.CompressionStream

public class CompressionStream
extends java.lang.Object

This class is used as input to a geometry compressor. It collects elements such as vertices, normals, colors, mesh references, and quantization parameters in an ordered stream. This stream is then traversed during the compression process and used to build the compressed output buffer.

Since:
Java 3D 1.5
See Also:
GeometryCompressor

Constructor Summary
CompressionStream(GeometryInfo[] geometry)
          Creates a CompressionStream from an array of GeometryInfo objects.
CompressionStream(int positionQuant, int colorQuant, int normalQuant, GeometryInfo[] geometry)
          Creates a CompressionStream from an array of GeometryInfo objects.
CompressionStream(int positionQuant, int colorQuant, int normalQuant, Shape3D[] shapes)
          Creates a CompressionStream from an array of Shape3D scene graph objects.
CompressionStream(Shape3D[] shapes)
          Creates a CompressionStream from an array of Shape3D scene graph objects.
 
Method Summary
 Point3d[] getModelBounds()
          Get the original bounds of the coordinate data, in modeling coordinates.
 Point3d[] getNormalizedBounds()
          Get the bounds of the compressed object in normalized coordinates.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompressionStream

public CompressionStream(int positionQuant,
                         int colorQuant,
                         int normalQuant,
                         Shape3D[] shapes)
Creates a CompressionStream from an array of Shape3D scene graph objects. These Shape3D objects may only consist of a GeometryArray component and an optional Appearance component. The resulting stream may be used as input to the GeometryCompressor methods.

Each Shape3D in the array must be of the same dimensionality (point, line, or surface) and have the same vertex format as the others. Texture coordinates are ignored.

If a color is specified in the material attributes for a Shape3D then that color is added to the CompressionStream as the current global color. Subsequent colors as well as any colors bundled with vertices will override it. Only the material diffuse colors are used; all other appearance attributes are ignored.

Parameters:
positionQuant - number of bits to quantize each position's X, Y, and Z components, ranging from 1 to 16
colorQuant - number of bits to quantize each color's R, G, B, and alpha components, ranging from 2 to 16
normalQuant - number of bits for quantizing each normal's U and V components, ranging from 0 to 6
shapes - an array of Shape3D scene graph objects containing GeometryArray objects, all with the same vertex format and dimensionality
Throws:
java.lang.IllegalArgumentException - if any Shape3D has an inconsistent dimensionality or vertex format, or if any Shape3D contains a geometry component that is not a GeometryArray
See Also:
Shape3D, GeometryArray, GeometryCompressor

CompressionStream

public CompressionStream(Shape3D[] shapes)
Creates a CompressionStream from an array of Shape3D scene graph objects. These Shape3D objects may only consist of a GeometryArray component and an optional Appearance component. The resulting stream may be used as input to the GeometryCompressor methods.

Each Shape3D in the array must be of the same dimensionality (point, line, or surface) and have the same vertex format as the others. Texture coordinates are ignored.

If a color is specified in the material attributes for a Shape3D then that color is added to the CompressionStream as the current global color. Subsequent colors as well as any colors bundled with vertices will override it. Only the material diffuse colors are used; all other appearance attributes are ignored.

Defaults of 16, 9, and 6 bits are used as the quantization values for positions, colors, and normals respectively. These are the maximum resolution values defined for positions and normals; the default of 9 for color is the equivalent of the 8 bits of RGBA component resolution commonly available in graphics frame buffers.

Parameters:
shapes - an array of Shape3D scene graph objects containing GeometryArray objects, all with the same vertex format and dimensionality.
Throws:
java.lang.IllegalArgumentException - if any Shape3D has an inconsistent dimensionality or vertex format, or if any Shape3D contains a geometry component that is not a GeometryArray
See Also:
Shape3D, GeometryArray, GeometryCompressor

CompressionStream

public CompressionStream(int positionQuant,
                         int colorQuant,
                         int normalQuant,
                         GeometryInfo[] geometry)
Creates a CompressionStream from an array of GeometryInfo objects. The resulting stream may be used as input to the GeometryCompressor methods.

Each GeometryInfo in the array must be of the same dimensionality (point, line, or surface) and have the same vertex format as the others. Texture coordinates are ignored.

Parameters:
positionQuant - number of bits to quantize each position's X, Y, and Z components, ranging from 1 to 16
colorQuant - number of bits to quantize each color's R, G, B, and alpha components, ranging from 2 to 16
normalQuant - number of bits for quantizing each normal's U and V components, ranging from 0 to 6
geometry - an array of GeometryInfo objects, all with the same vertex format and dimensionality
Throws:
java.lang.IllegalArgumentException - if any GeometryInfo object has an inconsistent dimensionality or vertex format
See Also:
GeometryInfo, GeometryCompressor

CompressionStream

public CompressionStream(GeometryInfo[] geometry)
Creates a CompressionStream from an array of GeometryInfo objects. The resulting stream may be used as input to the GeometryCompressor methods.

Each GeometryInfo in the array must be of the same dimensionality (point, line, or surface) and have the same vertex format as the others. Texture coordinates are ignored.

Defaults of 16, 9, and 6 bits are used as the quantization values for positions, colors, and normals respectively. These are the maximum resolution values defined for positions and normals; the default of 9 for color is the equivalent of the 8 bits of RGBA component resolution commonly available in graphics frame buffers.

Parameters:
geometry - an array of GeometryInfo objects, all with the same vertex format and dimensionality
Throws:
java.lang.IllegalArgumentException - if any GeometryInfo object has an inconsistent dimensionality or vertex format
See Also:
GeometryInfo, GeometryCompressor
Method Detail

getModelBounds

public Point3d[] getModelBounds()
Get the original bounds of the coordinate data, in modeling coordinates. Coordinate data is positioned and scaled to a normalized cube after compression.

Returns:
Point3d array of length 2, where the 1st Point3d is the lower bounds and the 2nd Point3d is the upper bounds.
Since:
Java 3D 1.3

getNormalizedBounds

public Point3d[] getNormalizedBounds()
Get the bounds of the compressed object in normalized coordinates. These have an maximum bounds by [-1.0 .. +1.0] across each axis.

Returns:
Point3d array of length 2, where the 1st Point3d is the lower bounds and the 2nd Point3d is the upper bounds.
Since:
Java 3D 1.3