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

java.lang.Object
  extended by com.sun.j3d.utils.geometry.compression.GeometryDecompressor
      extended by com.sun.j3d.utils.geometry.compression.GeometryDecompressorShape3D

 class GeometryDecompressorShape3D
extends GeometryDecompressor

This class implements a Shape3D backend for the abstract GeometryDecompressor.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.sun.j3d.utils.geometry.compression.GeometryDecompressor
GeometryDecompressor.HuffmanTableEntry, GeometryDecompressor.MeshBufferEntry
 
Field Summary
private static boolean benchmark
           
private  int bufferDataType
           
private  Color4f curColor
           
private  Vector3f curNormal
           
private  int dataPresent
           
private static boolean debug
           
private  long endTime
           
private static int FRONTFACE_CCW
           
private  int origVertexCount
           
private static boolean printInfo
           
private  java.util.ArrayList shapes
           
private  long startTime
           
private static boolean statistics
           
private  int stripCount
           
private static int TRI_SET
           
private static int TRI_STRIP_AND_FAN_SET
           
private static int TRI_STRIP_AND_TRI_SET
           
private static int TRI_STRIP_SET
           
private  int triangleCount
           
private  int triOutputType
           
private static int TYPE_LINE
           
private static int TYPE_POINT
           
private static int TYPE_TRIANGLE
           
private  int vertexCount
           
private  GeneralizedVertexList vlist
           
 
Fields inherited from class com.sun.j3d.utils.geometry.compression.GeometryDecompressor
majorVersionNumber, minorMinorVersionNumber, minorVersionNumber
 
Constructor Summary
GeometryDecompressorShape3D()
           
 
Method Summary
private  void addShape3D()
          Create a Shape3D object of the desired type from the current vertex list.
private  void beginPrint()
           
private  Shape3D[] decompress(CompressedGeometryRetained cgr, int triOutputType)
          Decompress the data contained in a CompressedGeometryRetained and return an array of Shape3D objects using the specified triangle output type.
private  void endPrint()
           
(package private)  void outputColor(Color4f color)
          Create a Shape3D using the current color for both the ambient and diffuse material colors, then start a new vertex list for the new color.
(package private)  void outputNormal(Vector3f normal)
          Set the current normal that will be copied to each succeeding vertex output by the decompressor.
(package private)  void outputVertex(Point3f position, Vector3f normal, Color4f color, int vertexReplaceCode)
          Add a new decompressed vertex to the current list.
(package private)  void outputVertexFormat(boolean bundlingNorm, boolean bundlingColor, boolean doingAlpha)
          Initialize the vertex output list based on the vertex format provided by the SetState decompression command.
private  void printBench()
           
private  void printStats()
           
(package private)  Shape3D[] toStripAndFanArrays(CompressedGeometryRetained cgr)
          Decompress the given compressed geometry.
(package private)  Shape3D[] toStripAndTriangleArrays(CompressedGeometryRetained cgr)
          Decompress the given compressed geometry.
(package private)  Shape3D[] toTriangleArrays(CompressedGeometryRetained cgr)
          Decompress the given compressed geometry.
(package private)  Shape3D[] toTriangleStripArrays(CompressedGeometryRetained cgr)
          Decompress the given compressed geometry.
 
Methods inherited from class com.sun.j3d.utils.geometry.compression.GeometryDecompressor
checkVersion, decompress
 
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

statistics

private static final boolean statistics
See Also:
Constant Field Values

printInfo

private static final boolean printInfo
See Also:
Constant Field Values

bufferDataType

private int bufferDataType

dataPresent

private int dataPresent

vlist

private GeneralizedVertexList vlist

shapes

private java.util.ArrayList shapes

curColor

private Color4f curColor

curNormal

private Vector3f curNormal

origVertexCount

private int origVertexCount

stripCount

private int stripCount

vertexCount

private int vertexCount

triangleCount

private int triangleCount

startTime

private long startTime

endTime

private long endTime

triOutputType

private int triOutputType

TRI_SET

private static final int TRI_SET
See Also:
Constant Field Values

TRI_STRIP_SET

private static final int TRI_STRIP_SET
See Also:
Constant Field Values

TRI_STRIP_AND_FAN_SET

private static final int TRI_STRIP_AND_FAN_SET
See Also:
Constant Field Values

TRI_STRIP_AND_TRI_SET

private static final int TRI_STRIP_AND_TRI_SET
See Also:
Constant Field Values

TYPE_POINT

private static final int TYPE_POINT
See Also:
Constant Field Values

TYPE_LINE

private static final int TYPE_LINE
See Also:
Constant Field Values

TYPE_TRIANGLE

private static final int TYPE_TRIANGLE
See Also:
Constant Field Values

FRONTFACE_CCW

private static final int FRONTFACE_CCW
See Also:
Constant Field Values
Constructor Detail

GeometryDecompressorShape3D

GeometryDecompressorShape3D()
Method Detail

toTriangleArrays

Shape3D[] toTriangleArrays(CompressedGeometryRetained cgr)
Decompress the given compressed geometry.

Parameters:
cgr - CompressedGeometryRetained object with compressed geometry
Returns:
an array of Shape3D with TriangleArray geometry if compressed data contains triangles; otherwise, Shape3D array containing PointArray or LineStripArray geometry
See Also:
CompressedGeometry, GeometryDecompressor

toTriangleStripArrays

Shape3D[] toTriangleStripArrays(CompressedGeometryRetained cgr)
Decompress the given compressed geometry.

Parameters:
cgr - CompressedGeometryRetained object with compressed geometry
Returns:
an array of Shape3D with TriangleStripArray geometry if compressed data contains triangles; otherwise, Shape3D array containing PointArray or LineStripArray geometry
See Also:
CompressedGeometry, GeometryDecompressor

toStripAndFanArrays

Shape3D[] toStripAndFanArrays(CompressedGeometryRetained cgr)
Decompress the given compressed geometry.

Parameters:
cgr - CompressedGeometryRetained object with compressed geometry
Returns:
an array of Shape3D with TriangleStripArray and TriangleFanArray geometry if compressed data contains triangles; otherwise, Shape3D array containing PointArray or LineStripArray geometry
See Also:
CompressedGeometry, GeometryDecompressor

toStripAndTriangleArrays

Shape3D[] toStripAndTriangleArrays(CompressedGeometryRetained cgr)
Decompress the given compressed geometry.

Parameters:
cgr - CompressedGeometryRetained object with compressed geometry
Returns:
an array of Shape3D with TriangleStripArray and TriangleArray geometry if compressed data contains triangles; otherwise, Shape3D array containing PointArray or LineStripArray geometry
See Also:
CompressedGeometry, GeometryDecompressor

decompress

private Shape3D[] decompress(CompressedGeometryRetained cgr,
                             int triOutputType)
Decompress the data contained in a CompressedGeometryRetained and return an array of Shape3D objects using the specified triangle output type. The triangle output type is ignored if the compressed data contains points or lines.


outputVertexFormat

void outputVertexFormat(boolean bundlingNorm,
                        boolean bundlingColor,
                        boolean doingAlpha)
Initialize the vertex output list based on the vertex format provided by the SetState decompression command.

Specified by:
outputVertexFormat in class GeometryDecompressor
Parameters:
bundlingNorm - true indicates normals are bundled with vertices
bundlingColor - true indicates colors are bundled with vertices
doingAlpha - true indicates alpha values are bundled with vertices

outputVertex

void outputVertex(Point3f position,
                  Vector3f normal,
                  Color4f color,
                  int vertexReplaceCode)
Add a new decompressed vertex to the current list.

Specified by:
outputVertex in class GeometryDecompressor
Parameters:
position - The coordinates of the vertex.
normal - The normal bundled with the vertex. May be null.
color - The color bundled with the vertex. May be null. Alpha may be present.
vertexReplaceCode - Specifies the generalized strip flag that is bundled with each vertex.
See Also:
GeneralizedStripFlags, CompressedGeometryHeader

outputColor

void outputColor(Color4f color)
Create a Shape3D using the current color for both the ambient and diffuse material colors, then start a new vertex list for the new color. The outputColor() method is never called if colors are bundled with each vertex in the compressed buffer.

Specified by:
outputColor in class GeometryDecompressor
Parameters:
color - The current global color.

outputNormal

void outputNormal(Vector3f normal)
Set the current normal that will be copied to each succeeding vertex output by the decompressor. The per-vertex copy is needed since in Java 3D a normal is always associated with a vertex. This method is never called if normals are bundled with each vertex in the compressed buffer.

Specified by:
outputNormal in class GeometryDecompressor
Parameters:
normal - The current global normal.

addShape3D

private void addShape3D()
Create a Shape3D object of the desired type from the current vertex list. Apply the current color, if non-null, as a Material attribute.


beginPrint

private void beginPrint()

endPrint

private void endPrint()

printBench

private void printBench()

printStats

private void printStats()


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