com.sun.j3d.utils.geometry.compression
Class CompressionStream

java.lang.Object
  extended by com.sun.j3d.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

Nested Class Summary
private  class CompressionStream.ByCopyGeometry
          This class implements the GeometryAccessor interface for geometry arrays accessed with by-copy semantics.
private  class CompressionStream.ByRefGeometry
          This class implements the GeometryAccessor interface for non-interleaved geometry arrays accessed with by-reference semantics.
private  class CompressionStream.ByRefGeometryNIO
          This class implements the GeometryAccessor interface for non-interleaved geometry arrays accessed with NIO.
private  class CompressionStream.ColorQuant
          Stream element that sets color quantization during quantize pass.
private static interface CompressionStream.GeometryAccessor
          Interface to access GeometryArray vertex components and add them to the compression stream.
private static class CompressionStream.IndexArrays
          Class which holds index array references for a geometry array.
private  class CompressionStream.IndexedByCopyGeometry
          This class implements the GeometryAccessor interface for indexed geometry arrays accessed with by-copy semantics.
private  class CompressionStream.IndexedByRefGeometry
          This class implements the GeometryAccessor interface for indexed non-interleaved geometry arrays accessed with by-reference semantics.
private  class CompressionStream.IndexedByRefGeometryNIO
          This class implements the GeometryAccessor interface for non-interleaved indexed geometry arrays accessed with NIO.
private  class CompressionStream.IndexedInterleavedGeometryFloat
          This class implements the GeometryAccessor interface for indexed interleaved geometry arrays.
private  class CompressionStream.IndexedInterleavedGeometryNIO
          This class implements the GeometryAccessor interface for indexed interleaved NIO geometry arrays.
private  class CompressionStream.InterleavedGeometry
          This abstract class implements the GeometryAccessor interface for concrete subclasses which handle float and NIO interleaved geometry arrays.
private  class CompressionStream.InterleavedGeometryFloat
          This class implements the GeometryAccessor interface for float interleaved geometry arrays.
private  class CompressionStream.InterleavedGeometryNIO
          This class implements the GeometryAccessor interface for interleaved NIO geometry arrays.
private  class CompressionStream.MeshReference
          Stream element that references the mesh buffer.
private  class CompressionStream.NormalQuant
          Stream element that sets normal quantization during quantize pass.
private  class CompressionStream.PositionQuant
          Stream element that sets position quantization during quantize pass.
private static class CompressionStream.VertexCopy
           
private static class CompressionStream.VertexIndices
          Class which holds indices for a specific vertex of an IndexedGeometryArray.
 
Field Summary
private static boolean benchmark
           
(package private)  int byteCount
          The total number of bytes used to create the uncompressed geometric elements in this stream, useful for performance analysis.
(package private) static float ByteToFloatScale
          Byte to float scale factor for scaling byte color components.
private  Color3f c3f
           
private  Color4f c4f
           
(package private)  double[] center
          Center for normalizing positions to the unit cube.
(package private)  int colorQuant
          Current color component (R, G, B, A) quantization value.
(package private)  boolean colorQuantChanged
          Flag indicating color quantization change.
private static boolean debug
           
(package private)  boolean firstColor
          Flag indicating the first color in this stream.
(package private)  boolean firstNormal
          Flag indicating the first normal in this stream.
(package private)  boolean firstPosition
          Flag indicating the first position in this stream.
(package private)  int[] lastColor
          Last quantized color.
private  boolean lastElementColor
           
private  boolean lastElementNormal
           
private  boolean lastLastElementColor
           
private  boolean lastLastElementNormal
           
(package private)  int lastOctant
          Last quantized normal's octant.
(package private)  int[] lastPosition
          Last quantized position.
(package private)  int lastSextant
          Last quantized normal's sextant.
(package private)  boolean lastSpecialNormal
          Flag indicating last normal used a special encoding.
(package private)  int lastU
          Last quantized normal's U encoding parameter.
(package private)  int lastV
          Last quantized normal's V encoding parameter.
(package private)  Point3d[] mcBounds
          Axes-aligned box enclosing all vertices in model coordinates.
(package private) static int MESH_PUSH
          This flag indicates that a vertex is to be pushed into the mesh buffer.
(package private)  MeshBuffer meshBuffer
          Mesh buffer mirror used for computing deltas during quantization pass and a limited meshing algorithm for unstripped data.
(package private)  int meshReferenceCount
          The number of mesh buffer references created for this stream.
private  Vector3f n3f
           
(package private)  Point3d[] ncBounds
          Axes-aligned box enclosing all vertices in normalized coordinates.
(package private) static int NO_MESH_PUSH
          This flag indicates that a vertex does not use the mesh buffer.
private static boolean noMeshNormalSubstitution
           
(package private)  int normalQuant
          Current normal component (U and V) quantization value.
(package private)  boolean normalQuantChanged
          Flag indicating normal quantization change.
private  Point3f p3f
           
(package private)  int positionQuant
          Current position component (X, Y, and Z) quantization value.
(package private)  boolean positionQuantChanged
          Flag indicating position quantization change.
(package private)  double positionRangeMaximum
          Maximum position range along the 3 axes.
(package private)  Point3i[] qcBounds
          Axes-aligned box enclosing all vertices in quantized coordinates.
(package private) static int REPLACE_MIDDLE
          This flag indicates that the next triangle in the strip is defined by replacing the middle vertex of the previous triangle in the strip.
(package private) static int REPLACE_OLDEST
          This flag indicates that the next triangle in the strip is defined by replacing the oldest vertex of the previous triangle in the strip.
(package private) static int RESTART
          This flag indicates that a vertex starts a new triangle or line strip.
(package private)  double scale
          Scale for normalizing positions to the unit cube.
private  java.util.Collection stream
           
(package private)  int streamType
          Type of this stream, either CompressedGeometryData.Header.POINT_BUFFER, CompressedGeometryData.Header.LINE_BUFFER, or CompressedGeometryData.Header.TRIANGLE_BUFFER
(package private)  boolean vertexColor3
          Boolean indicating RGB colors are bundled with the vertices.
(package private)  boolean vertexColor4
          Boolean indicating RGBA colors are bundled with the vertices.
(package private)  boolean vertexColors
          Boolean indicating colors are bundled with the vertices.
(package private)  int vertexComponents
          A mask indicating which components are present in each vertex, as defined by GeometryArray.
(package private)  int vertexCount
          The number of vertices created for this stream, excluding mesh buffer references.
(package private)  boolean vertexNormals
          Boolean indicating normals are bundled with the vertices.
(package private)  boolean vertexTexture2
          Boolean indicating that 2D texture coordinates are used.
(package private)  boolean vertexTexture3
          Boolean indicating that 3D texture coordinates are used.
(package private)  boolean vertexTexture4
          Boolean indicating that 4D texture coordinates are used.
(package private)  boolean vertexTextures
          Boolean indicating texture coordinates are present.
 
Constructor Summary
private CompressionStream()
           
  CompressionStream(GeometryInfo[] geometry)
          Creates a CompressionStream from an array of GeometryInfo objects.
(package private) CompressionStream(int streamType, int vertexComponents)
          Creates a new CompressionStream for the specified geometry type and vertex format.
  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
(package private)  void addColor(Color3f c3f)
          Copy the given color to the end of this stream and use it as a global state change that applies to all subsequent vertices.
(package private)  void addColor(Color4f c4f)
          Copy the given color to the end of this stream and use it as a global state change that applies to all subsequent vertices.
(package private)  void addColorQuantization(int value)
          Add a new color quantization value to the end of this stream that will apply to all subsequent colors.
(package private)  void addGeometryArray(GeometryArray ga)
          Convert a GeometryArray to compression stream elements and add them to this stream.
(package private)  void addMeshReference(int stripFlag, int meshIndex)
          Add a mesh buffer reference to this stream.
(package private)  void addNormal(Vector3f n)
          Copy the given normal to the end of this stream and use it as a global state change that applies to all subsequent vertices.
(package private)  void addNormalQuantization(int value)
          Add a new normal quantization value to the end of this stream that will apply to all subsequent normals.
(package private)  void addPositionQuantization(int value)
          Add a new position quantization value to the end of this stream that will apply to all subsequent vertex positions.
(package private)  void addVertex(Point3f pos, Color3f color, int stripFlag)
          Copy vertex data and add it to the end of this stream.
(package private)  void addVertex(Point3f pos, Color3f color, int stripFlag, int meshFlag)
          Copy vertex data and add it to the end of this stream.
(package private)  void addVertex(Point3f pos, Color4f color, int stripFlag)
          Copy vertex data and add it to the end of this stream.
(package private)  void addVertex(Point3f pos, Color4f color, int stripFlag, int meshFlag)
          Copy vertex data and add it to the end of this stream.
(package private)  void addVertex(Point3f pos, int stripFlag)
          Copy vertex data and add it to the end of this stream.
(package private)  void addVertex(Point3f pos, int stripFlag, int meshFlag)
          Copy vertex data and add it to the end of this stream.
(package private)  void addVertex(Point3f pos, Vector3f norm, Color3f color, int stripFlag)
          Copy vertex data and add it to the end of this stream.
(package private)  void addVertex(Point3f pos, Vector3f norm, Color3f color, int stripFlag, int meshFlag)
          Copy vertex data and add it to the end of this stream.
(package private)  void addVertex(Point3f pos, Vector3f norm, Color4f color, int stripFlag)
          Copy vertex data and add it to the end of this stream.
(package private)  void addVertex(Point3f pos, Vector3f norm, Color4f color, int stripFlag, int meshFlag)
          Copy vertex data and add it to the end of this stream.
(package private)  void addVertex(Point3f pos, Vector3f norm, int stripFlag)
          Copy vertex data and add it to the end of this stream.
(package private)  void addVertex(Point3f pos, Vector3f norm, int stripFlag, int meshFlag)
          Copy vertex data and add it to the end of this stream.
(package private)  void addVertex(Point3f pos, Vector3f norm, java.lang.Object color, int stripFlag, int meshFlag)
          Copy vertex data and add it to the end of this stream.
(package private)  int getByteCount()
          Retrieve the total size of the uncompressed geometric data in bytes, excluding mesh buffer references.
private  void getIndexArrays(GeometryArray ga, CompressionStream.IndexArrays ia)
          Retrieves index array references for the specified IndexedGeometryArray.
(package private)  int getMeshReferenceCount()
          Retrieve the number of mesh buffer references created for this stream.
 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.
private  int getStreamType(GeometryArray ga)
           
private  int getVertexComponents(int vertexFormat)
           
(package private)  int getVertexCount()
          Retrieve the the number of vertices created for this stream, excluding mesh buffer references.
private  void getVertexIndices(int v, CompressionStream.IndexArrays ia, CompressionStream.VertexIndices vi)
          Retrieves vertex indices for a specific vertex in an IndexedGeometryArray.
(package private)  void outputCommands(HuffmanTable huffmanTable, CommandStream outputBuffer)
          Iterates across all compression stream elements and builds the compressed geometry command stream output.
(package private)  void print()
          Print the stream to standard output.
private  void processIndexedVertexCopy(CompressionStream.VertexCopy vc, CompressionStream.VertexIndices vi, int stripFlag)
           
private  void processVertexCopy(CompressionStream.VertexCopy vc, int stripFlag)
           
(package private)  void quantize(HuffmanTable huffmanTable)
          Iterates across all compression stream elements and applies quantization parameters, encoding consecutive vertices as delta values whenever possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

private static final boolean debug
See Also:
Constant Field Values

benchmark

private static final boolean benchmark
See Also:
Constant Field Values

noMeshNormalSubstitution

private static final boolean noMeshNormalSubstitution
See Also:
Constant Field Values

RESTART

static final int RESTART
This flag indicates that a vertex starts a new triangle or line strip.

See Also:
Constant Field Values

REPLACE_MIDDLE

static final int REPLACE_MIDDLE
This flag indicates that the next triangle in the strip is defined by replacing the middle vertex of the previous triangle in the strip. Equivalent to REPLACE_OLDEST for line strips.

See Also:
Constant Field Values

REPLACE_OLDEST

static final int REPLACE_OLDEST
This flag indicates that the next triangle in the strip is defined by replacing the oldest vertex of the previous triangle in the strip. Equivalent to REPLACE_MIDDLE for line strips.

See Also:
Constant Field Values

MESH_PUSH

static final int MESH_PUSH
This flag indicates that a vertex is to be pushed into the mesh buffer.

See Also:
Constant Field Values

NO_MESH_PUSH

static final int NO_MESH_PUSH
This flag indicates that a vertex does not use the mesh buffer.

See Also:
Constant Field Values

ByteToFloatScale

static final float ByteToFloatScale
Byte to float scale factor for scaling byte color components.

See Also:
Constant Field Values

streamType

int streamType
Type of this stream, either CompressedGeometryData.Header.POINT_BUFFER, CompressedGeometryData.Header.LINE_BUFFER, or CompressedGeometryData.Header.TRIANGLE_BUFFER


vertexComponents

int vertexComponents
A mask indicating which components are present in each vertex, as defined by GeometryArray.


vertexColors

boolean vertexColors
Boolean indicating colors are bundled with the vertices.


vertexColor3

boolean vertexColor3
Boolean indicating RGB colors are bundled with the vertices.


vertexColor4

boolean vertexColor4
Boolean indicating RGBA colors are bundled with the vertices.


vertexNormals

boolean vertexNormals
Boolean indicating normals are bundled with the vertices.


vertexTextures

boolean vertexTextures
Boolean indicating texture coordinates are present.


vertexTexture2

boolean vertexTexture2
Boolean indicating that 2D texture coordinates are used. Currently only used to skip over textures in interleaved data.


vertexTexture3

boolean vertexTexture3
Boolean indicating that 3D texture coordinates are used. Currently only used to skip over textures in interleaved data.


vertexTexture4

boolean vertexTexture4
Boolean indicating that 4D texture coordinates are used. Currently only used to skip over textures in interleaved data.


mcBounds

Point3d[] mcBounds
Axes-aligned box enclosing all vertices in model coordinates.


ncBounds

Point3d[] ncBounds
Axes-aligned box enclosing all vertices in normalized coordinates.


qcBounds

Point3i[] qcBounds
Axes-aligned box enclosing all vertices in quantized coordinates.


center

double[] center
Center for normalizing positions to the unit cube.


positionRangeMaximum

double positionRangeMaximum
Maximum position range along the 3 axes.


scale

double scale
Scale for normalizing positions to the unit cube.


positionQuant

int positionQuant
Current position component (X, Y, and Z) quantization value. This can range from 1 to 16 bits and has a default of 16.

At 1 bit of quantization it is not possible to express positive absolute or delta positions.


colorQuant

int colorQuant
Current color component (R, G, B, A) quantization value. This can range from 2 to 16 bits and has a default of 9.

A color component is represented with a signed fixed-point value in order to be able express negative deltas; the default of 9 bits corresponds to the 8-bit color component range of the graphics hardware commonly available. Colors must be non-negative, so the lower limit of quantization is 2 bits.


normalQuant

int normalQuant
Current normal component (U and V) quantization value. This can range from 0 to 6 bits and has a default of 6.

At 0 bits of quantization normals are represented only as 6 bit sextant/octant pairs and 14 specially encoded normals (the 6 axis normals and the 8 octant midpoint normals); since U and V can only be 0 at the minimum quantization, the totally number of unique normals is 12 + 14 = 26.


positionQuantChanged

boolean positionQuantChanged
Flag indicating position quantization change.


colorQuantChanged

boolean colorQuantChanged
Flag indicating color quantization change.


normalQuantChanged

boolean normalQuantChanged
Flag indicating normal quantization change.


lastPosition

int[] lastPosition
Last quantized position.


lastColor

int[] lastColor
Last quantized color.


lastSextant

int lastSextant
Last quantized normal's sextant.


lastOctant

int lastOctant
Last quantized normal's octant.


lastU

int lastU
Last quantized normal's U encoding parameter.


lastV

int lastV
Last quantized normal's V encoding parameter.


lastSpecialNormal

boolean lastSpecialNormal
Flag indicating last normal used a special encoding.


firstPosition

boolean firstPosition
Flag indicating the first position in this stream.


firstColor

boolean firstColor
Flag indicating the first color in this stream.


firstNormal

boolean firstNormal
Flag indicating the first normal in this stream.


byteCount

int byteCount
The total number of bytes used to create the uncompressed geometric elements in this stream, useful for performance analysis. This excludes mesh buffer references.


vertexCount

int vertexCount
The number of vertices created for this stream, excluding mesh buffer references.


meshReferenceCount

int meshReferenceCount
The number of mesh buffer references created for this stream.


meshBuffer

MeshBuffer meshBuffer
Mesh buffer mirror used for computing deltas during quantization pass and a limited meshing algorithm for unstripped data.


stream

private java.util.Collection stream

lastElementColor

private boolean lastElementColor

lastLastElementColor

private boolean lastLastElementColor

lastElementNormal

private boolean lastElementNormal

lastLastElementNormal

private boolean lastLastElementNormal

p3f

private Point3f p3f

c3f

private Color3f c3f

c4f

private Color4f c4f

n3f

private Vector3f n3f
Constructor Detail

CompressionStream

private CompressionStream()

CompressionStream

CompressionStream(int streamType,
                  int vertexComponents)
Creates a new CompressionStream for the specified geometry type and vertex format.

Parameters:
streamType - type of data in this stream, either CompressedGeometryData.Header.POINT_BUFFER, CompressedGeometryData.Header.LINE_BUFFER, or CompressedGeometryData.Header.TRIANGLE_BUFFER
vertexComponents - a mask indicating which components are present in each vertex, as defined by GeometryArray: COORDINATES, NORMALS, and COLOR_3 or COLOR_4.
See Also:
GeometryCompressor, GeometryArray

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

getVertexComponents

private int getVertexComponents(int vertexFormat)

getStreamType

private int getStreamType(GeometryArray ga)

quantize

void quantize(HuffmanTable huffmanTable)
Iterates across all compression stream elements and applies quantization parameters, encoding consecutive vertices as delta values whenever possible. Each geometric element is mapped to a HuffmanNode object containing its resulting bit length, right shift (trailing 0 count), and absolute or relative status.

Positions are normalized to span a unit cube via an offset and a uniform scale factor that maps the midpoint of the object extents along each dimension to the origin, and the longest dimension of the object to the open interval (-1.0 .. +1.0). The geometric endpoints along that dimension are both one quantum away from unity; for example, at a position quantization of 6 bits, an object would be normalized so that its most negative dimension is at (-1 + 1/64) and the most positive is at (1 - 1/64).

Normals are assumed to be of unit length. Color components are clamped to the [0..1) range, where the right endpoint is one quantum less than 1.0.

Parameters:
huffmanTable - Table which will map geometric compression stream elements to HuffmanNode objects describing each element's data representation. This table can then be processed with Huffman's algorithm to optimize the bit length of descriptor tags according to the number of geometric elements mapped to each tag.

outputCommands

void outputCommands(HuffmanTable huffmanTable,
                    CommandStream outputBuffer)
Iterates across all compression stream elements and builds the compressed geometry command stream output.

Parameters:
huffmanTable - Table which maps geometric elements in this stream to tags describing the encoding parameters (length, shift, and absolute/relative status) to be used for their representations in the compressed output. All tags must be 6 bits or less in length, and the sum of the number of bits in the tag plus the number of bits in the data it describes must be at least 6 bits in length.
outputBuffer - CommandStream to use for collecting the compressed bits.

getByteCount

int getByteCount()
Retrieve the total size of the uncompressed geometric data in bytes, excluding mesh buffer references.

Returns:
uncompressed byte count

getVertexCount

int getVertexCount()
Retrieve the the number of vertices created for this stream, excluding mesh buffer references.

Returns:
vertex count

getMeshReferenceCount

int getMeshReferenceCount()
Retrieve the number of mesh buffer references created for this stream.

Returns:
mesh buffer reference count

addVertex

void addVertex(Point3f pos,
               int stripFlag)
Copy vertex data and add it to the end of this stream.

Parameters:
pos - position data
stripFlag - vertex replacement flag, either RESTART, REPLACE_OLDEST, or REPLACE_MIDDLE

addVertex

void addVertex(Point3f pos,
               Vector3f norm,
               int stripFlag)
Copy vertex data and add it to the end of this stream.

Parameters:
pos - position data
norm - normal data
stripFlag - vertex replacement flag, either RESTART, REPLACE_OLDEST, or REPLACE_MIDDLE

addVertex

void addVertex(Point3f pos,
               Color3f color,
               int stripFlag)
Copy vertex data and add it to the end of this stream.

Parameters:
pos - position data
color - color data
stripFlag - vertex replacement flag, either RESTART, REPLACE_OLDEST, or REPLACE_MIDDLE

addVertex

void addVertex(Point3f pos,
               Color4f color,
               int stripFlag)
Copy vertex data and add it to the end of this stream.

Parameters:
pos - position data
color - color data
stripFlag - vertex replacement flag, either RESTART, REPLACE_OLDEST, or REPLACE_MIDDLE

addVertex

void addVertex(Point3f pos,
               Vector3f norm,
               Color3f color,
               int stripFlag)
Copy vertex data and add it to the end of this stream.

Parameters:
pos - position data
norm - normal data
color - color data
stripFlag - vertex replacement flag, either RESTART, REPLACE_OLDEST, or REPLACE_MIDDLE

addVertex

void addVertex(Point3f pos,
               Vector3f norm,
               Color4f color,
               int stripFlag)
Copy vertex data and add it to the end of this stream.

Parameters:
pos - position data
norm - normal data
color - color data
stripFlag - vertex replacement flag, either RESTART, REPLACE_OLDEST, or REPLACE_MIDDLE

addVertex

void addVertex(Point3f pos,
               int stripFlag,
               int meshFlag)
Copy vertex data and add it to the end of this stream.

Parameters:
pos - position data
stripFlag - vertex replacement flag, either RESTART, REPLACE_OLDEST, or REPLACE_MIDDLE
meshFlag - if MESH_PUSH the vertex is pushed into the mesh buffer

addVertex

void addVertex(Point3f pos,
               Vector3f norm,
               int stripFlag,
               int meshFlag)
Copy vertex data and add it to the end of this stream.

Parameters:
pos - position data
norm - normal data
stripFlag - vertex replacement flag, either RESTART, REPLACE_OLDEST, or REPLACE_MIDDLE
meshFlag - if MESH_PUSH the vertex is pushed into the mesh buffer

addVertex

void addVertex(Point3f pos,
               Color3f color,
               int stripFlag,
               int meshFlag)
Copy vertex data and add it to the end of this stream.

Parameters:
pos - position data
color - color data
stripFlag - vertex replacement flag, either RESTART, REPLACE_OLDEST, or REPLACE_MIDDLE
meshFlag - if MESH_PUSH the vertex is pushed into the mesh buffer

addVertex

void addVertex(Point3f pos,
               Color4f color,
               int stripFlag,
               int meshFlag)
Copy vertex data and add it to the end of this stream.

Parameters:
pos - position data
color - color data
stripFlag - vertex replacement flag, either RESTART, REPLACE_OLDEST, or REPLACE_MIDDLE
meshFlag - if MESH_PUSH the vertex is pushed into the mesh buffer

addVertex

void addVertex(Point3f pos,
               Vector3f norm,
               Color3f color,
               int stripFlag,
               int meshFlag)
Copy vertex data and add it to the end of this stream.

Parameters:
pos - position data
norm - normal data
color - color data
stripFlag - vertex replacement flag, either RESTART, REPLACE_OLDEST, or REPLACE_MIDDLE
meshFlag - if MESH_PUSH the vertex is pushed into the mesh buffer

addVertex

void addVertex(Point3f pos,
               Vector3f norm,
               Color4f color,
               int stripFlag,
               int meshFlag)
Copy vertex data and add it to the end of this stream.

Parameters:
pos - position data
norm - normal data
color - color data
stripFlag - vertex replacement flag, either RESTART, REPLACE_OLDEST, or REPLACE_MIDDLE
meshFlag - if MESH_PUSH the vertex is pushed into the mesh buffer

addVertex

void addVertex(Point3f pos,
               Vector3f norm,
               java.lang.Object color,
               int stripFlag,
               int meshFlag)
Copy vertex data and add it to the end of this stream.

Parameters:
pos - position data
norm - normal data
color - color data, either Color3f or Color4f, determined by current vertex format
stripFlag - vertex replacement flag, either RESTART, REPLACE_OLDEST, or REPLACE_MIDDLE
meshFlag - if MESH_PUSH the vertex is pushed into the mesh buffer

addMeshReference

void addMeshReference(int stripFlag,
                      int meshIndex)
Add a mesh buffer reference to this stream.

Parameters:
stripFlag - vertex replacement flag, either RESTART, REPLACE_OLDEST, or REPLACE_MIDDLE
meshIndex - index of vertex to retrieve from the mesh buffer

addColor

void addColor(Color3f c3f)
Copy the given color to the end of this stream and use it as a global state change that applies to all subsequent vertices.


addColor

void addColor(Color4f c4f)
Copy the given color to the end of this stream and use it as a global state change that applies to all subsequent vertices.


addNormal

void addNormal(Vector3f n)
Copy the given normal to the end of this stream and use it as a global state change that applies to all subsequent vertices.


addPositionQuantization

void addPositionQuantization(int value)
Add a new position quantization value to the end of this stream that will apply to all subsequent vertex positions.

Parameters:
value - number of bits to quantize each position's X, Y, and Z components, ranging from 1 to 16 with a default of 16

addColorQuantization

void addColorQuantization(int value)
Add a new color quantization value to the end of this stream that will apply to all subsequent colors.

Parameters:
value - number of bits to quantize each color's R, G, B, and alpha components, ranging from 2 to 16 with a default of 9

addNormalQuantization

void addNormalQuantization(int value)
Add a new normal quantization value to the end of this stream that will apply to all subsequent normals. This value specifies the number of bits for each normal's U and V components.

Parameters:
value - number of bits for quantizing U and V, ranging from 0 to 6 with a default of 6

getIndexArrays

private void getIndexArrays(GeometryArray ga,
                            CompressionStream.IndexArrays ia)
Retrieves index array references for the specified IndexedGeometryArray. Index arrays are copied starting from initialIndexIndex.


getVertexIndices

private void getVertexIndices(int v,
                              CompressionStream.IndexArrays ia,
                              CompressionStream.VertexIndices vi)
Retrieves vertex indices for a specific vertex in an IndexedGeometryArray.


processVertexCopy

private void processVertexCopy(CompressionStream.VertexCopy vc,
                               int stripFlag)

processIndexedVertexCopy

private void processIndexedVertexCopy(CompressionStream.VertexCopy vc,
                                      CompressionStream.VertexIndices vi,
                                      int stripFlag)

addGeometryArray

void addGeometryArray(GeometryArray ga)
Convert a GeometryArray to compression stream elements and add them to this stream.

Parameters:
ga - GeometryArray to convert
Throws:
java.lang.IllegalArgumentException - if GeometryArray has a dimensionality or vertex format inconsistent with the CompressionStream

print

void print()
Print the stream to standard output.


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


Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.