javax.media.j3d
Class GeometryDecompressorRetained

java.lang.Object
  extended by javax.media.j3d.GeometryDecompressor
      extended by javax.media.j3d.GeometryDecompressorRetained

 class GeometryDecompressorRetained
extends GeometryDecompressor

This class implements a retained geometry backend for the abstract GeometryDecompressor.


Nested Class Summary
 
Nested classes/interfaces inherited from class javax.media.j3d.GeometryDecompressor
GeometryDecompressor.HuffmanTableEntry, GeometryDecompressor.MeshBufferEntry
 
Field Summary
private static boolean benchmark
           
private  boolean boundsOnly
           
private  int bufferDataType
           
private static float bytesPerVertexFudge
           
private  Color4f curColor
           
private  Vector3f curNormal
           
private  int dataPresent
           
private static boolean debug
           
private  long endTime
           
private static int FRONTFACE_CCW
           
private  Point3d lbounds
           
private  boolean positionsOnly
           
private static boolean printInfo
           
private  int size
           
private  long startTime
           
private static boolean statistics
           
private static int TYPE_LINE
           
private static int TYPE_POINT
           
private static int TYPE_TRIANGLE
           
private  Point3d ubounds
           
private  GeneralizedVertexList vlist
           
 
Fields inherited from class javax.media.j3d.GeometryDecompressor
majorVersionNumber, minorMinorVersionNumber, minorVersionNumber
 
Constructor Summary
GeometryDecompressorRetained()
           
 
Method Summary
private  void beginPrint()
           
(package private)  GeometryRetained decompress(CompressedGeometryRetained cgr)
          Decompress the geometry data in a CompressedGeometryRetained.
private  void endPrint()
           
(package private)  void getBoundingBox(BoundingBox bb)
          Get the bounds of the decompressed geometry.
(package private)  void outputColor(Color4f color)
          Any global colors output by the decompressor are stored as per-vertex color in the retained data used internally by the renderer.
(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)
          Process a decompressed vertex.
(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)  void setDecompressBoundsOnly(boolean boundsOnly)
          If the given argument is true, sets the decompressor to output only the bounding box of the decompressed geometry.
(package private)  void setDecompressPositionsOnly(boolean positionsOnly)
          If the given argument is true, sets the decompressor to output only the decompressed positions, their connections, and the bounding box.
 
Methods inherited from class javax.media.j3d.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

size

private int size

curColor

private Color4f curColor

curNormal

private Vector3f curNormal

vlist

private GeneralizedVertexList vlist

lbounds

private Point3d lbounds

ubounds

private Point3d ubounds

boundsOnly

private boolean boundsOnly

positionsOnly

private boolean positionsOnly

bytesPerVertexFudge

private static final float bytesPerVertexFudge
See Also:
Constant Field Values

startTime

private long startTime

endTime

private long endTime

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

GeometryDecompressorRetained

GeometryDecompressorRetained()
Method Detail

setDecompressBoundsOnly

void setDecompressBoundsOnly(boolean boundsOnly)
If the given argument is true, sets the decompressor to output only the bounding box of the decompressed geometry.

Parameters:
boundsOnly - set to true if the decompressor should output only the geometric bounding box.

setDecompressPositionsOnly

void setDecompressPositionsOnly(boolean positionsOnly)
If the given argument is true, sets the decompressor to output only the decompressed positions, their connections, and the bounding box.

Parameters:
positionsOnly - set to true if the decompressor should output only position, connection, and bounding box data.

decompress

GeometryRetained decompress(CompressedGeometryRetained cgr)
Decompress the geometry data in a CompressedGeometryRetained. The GeometryArray output is intended to be cached as retained data for efficient rendering. Global color and normal changes output by the decompressor are stored as redundant per-vertex data so that a single GeometryArray can be used. Since only one GeometryArray is created, if the bundling attributes change while building the vertex list then the decompression is aborted. There should be only one SetState bundling attribute command per CompressedGeometry.

Parameters:
cgr - CompressedGeometryRetained containing compressed geometry
Returns:
GeometryArrayRetained containing the results of the decompression, or null if only the bounds are computed.

getBoundingBox

void getBoundingBox(BoundingBox bb)
Get the bounds of the decompressed geometry.

Parameters:
bb - BoundingBox to receive bounds

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)
Process a decompressed vertex.

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)
Any global colors output by the decompressor are stored as per-vertex color in the retained data used internally by the renderer. This is done for performance and simplicity reasons, at the expense of replicating colors. The next method sets the current color that will be copied to each succeeding vertex. 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 always needed since in Java 3D a normal is always associated with a vertex. This 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.

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.