javax.media.j3d
Class GeometryDecompressor

java.lang.Object
  extended by javax.media.j3d.GeometryDecompressor
Direct Known Subclasses:
GeometryDecompressorRetained, GeometryDecompressorShape3D

abstract class GeometryDecompressor
extends java.lang.Object

This abstract class provides the base methods needed to create a geometry decompressor. Subclasses must implement a backend to handle the output, consisting of a generalized triangle strip, line strip, or point array, along with possible global color and normal changes.


Nested Class Summary
(package private) static class GeometryDecompressor.HuffmanTableEntry
          Decompression table entry.
(package private) static class GeometryDecompressor.MeshBufferEntry
          Mesh buffer entry containing position, normal, and color.
 
Field Summary
private static boolean benchmark
           
private  int bitBuffer
           
private  int bitBufferCount
           
private static int[] BMASK
           
private  boolean bundlingColor
           
private  boolean bundlingNorm
           
private  short curA
           
private  short curB
           
private  Color4f curColor
           
private  short curG
           
private  Vector3f curNorm
           
private  int curOct
           
private  Point3f curPos
           
private  short curR
           
private  int currentHeader
           
private  int curSex
           
private  int curU
           
private  int curV
           
private  short curX
           
private  short curY
           
private  short curZ
           
private static boolean debug
           
private  boolean doingAlpha
           
private static int GC_EOS
           
private static int GC_MESH_B_R
           
private static int GC_PASS_THROUGH
           
private static int GC_SET_COLOR
           
private static int GC_SET_NORM
           
private static int GC_SET_STATE
           
private static int GC_SET_TABLE
           
private static int GC_SKIP_8
           
private static int GC_V_NO_OP
           
private static int GC_VERTEX
           
private  byte[] gcData
           
private  int gcIndex
           
private static double[][][] gcNormals
           
private  GeometryDecompressor.HuffmanTableEntry[][] gctables
           
(package private) static int majorVersionNumber
          Compressed geometry format version supported.
private  GeometryDecompressor.MeshBufferEntry[] meshBuffer
           
private  int meshIndex
           
private  int meshState
           
(package private) static int minorMinorVersionNumber
           
(package private) static int minorVersionNumber
           
private  int nextHeader
           
private static double NORMAL_MAX_Y_ANG
           
private static boolean printNormalTable
           
private  int repCode
           
private  long startTime
           
private static int USE_MESH_COLOR
           
private static int USE_MESH_NORMAL
           
private  int vertexCount
           
 
Constructor Summary
GeometryDecompressor()
           
 
Method Summary
private  void benchmarkPrint(int length)
           
private  void benchmarkStart(int length)
           
(package private)  boolean checkVersion(int majorVersionNumber, int minorVersionNumber)
          Check version numbers and return true if compatible.
(package private)  void decompress(int start, int length, byte[] data)
          Decompress data and invoke abstract output methods.
private  int getBits(int bitCount, java.lang.String d)
           
private  void indexNormal(int sex, int oct, int u, int v, Vector3f n)
           
(package private) abstract  void outputColor(Color4f color)
          This method captures the global color output of the decompressor.
(package private) abstract  void outputNormal(Vector3f normal)
          This method captures the global normal output of the decompressor.
(package private) abstract  void outputVertex(Point3f position, Vector3f normal, Color4f color, int vertexReplaceCode)
          This method captures the vertex output of the decompressor.
(package private) abstract  void outputVertexFormat(boolean bundlingNorm, boolean bundlingColor, boolean doingAlpha)
          This method is called when a SetState command is encountered in the decompression stream.
private  void processDecompression()
           
private  int processDecompressionOpcode(int mbp)
           
private  void processEos()
           
private  void processMeshBR()
           
private  void processPassThrough()
           
private  void processSetColor(int mbp)
           
private  void processSetNormal(int mbp)
           
private  void processSetState()
           
private  void processSetTable()
           
private  void processSkip8()
           
private  int processVertex()
           
private  void processVNoop()
           
 
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

majorVersionNumber

static final int majorVersionNumber
Compressed geometry format version supported.

See Also:
Constant Field Values

minorVersionNumber

static final int minorVersionNumber
See Also:
Constant Field Values

minorMinorVersionNumber

static final int minorMinorVersionNumber
See Also:
Constant Field Values

GC_VERTEX

private static final int GC_VERTEX
See Also:
Constant Field Values

GC_SET_NORM

private static final int GC_SET_NORM
See Also:
Constant Field Values

GC_SET_COLOR

private static final int GC_SET_COLOR
See Also:
Constant Field Values

GC_MESH_B_R

private static final int GC_MESH_B_R
See Also:
Constant Field Values

GC_SET_STATE

private static final int GC_SET_STATE
See Also:
Constant Field Values

GC_SET_TABLE

private static final int GC_SET_TABLE
See Also:
Constant Field Values

GC_PASS_THROUGH

private static final int GC_PASS_THROUGH
See Also:
Constant Field Values

GC_EOS

private static final int GC_EOS
See Also:
Constant Field Values

GC_V_NO_OP

private static final int GC_V_NO_OP
See Also:
Constant Field Values

GC_SKIP_8

private static final int GC_SKIP_8
See Also:
Constant Field Values

gctables

private GeometryDecompressor.HuffmanTableEntry[][] gctables

meshBuffer

private GeometryDecompressor.MeshBufferEntry[] meshBuffer

meshIndex

private int meshIndex

meshState

private int meshState

USE_MESH_NORMAL

private static final int USE_MESH_NORMAL
See Also:
Constant Field Values

USE_MESH_COLOR

private static final int USE_MESH_COLOR
See Also:
Constant Field Values

curX

private short curX

curY

private short curY

curZ

private short curZ

curR

private short curR

curG

private short curG

curB

private short curB

curA

private short curA

curSex

private int curSex

curOct

private int curOct

curU

private int curU

curV

private int curV

curPos

private Point3f curPos

curNorm

private Vector3f curNorm

curColor

private Color4f curColor

repCode

private int repCode

bundlingNorm

private boolean bundlingNorm

bundlingColor

private boolean bundlingColor

doingAlpha

private boolean doingAlpha

currentHeader

private int currentHeader

nextHeader

private int nextHeader

bitBuffer

private int bitBuffer

bitBufferCount

private int bitBufferCount

startTime

private long startTime

vertexCount

private int vertexCount

BMASK

private static final int[] BMASK

gcData

private byte[] gcData

gcIndex

private int gcIndex

gcNormals

private static final double[][][] gcNormals

NORMAL_MAX_Y_ANG

private static final double NORMAL_MAX_Y_ANG
See Also:
Constant Field Values

printNormalTable

private static final boolean printNormalTable
See Also:
Constant Field Values
Constructor Detail

GeometryDecompressor

GeometryDecompressor()
Method Detail

outputVertexFormat

abstract void outputVertexFormat(boolean bundlingNorm,
                                 boolean bundlingColor,
                                 boolean doingAlpha)
This method is called when a SetState command is encountered in the decompression stream.

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

abstract void outputVertex(Point3f position,
                           Vector3f normal,
                           Color4f color,
                           int vertexReplaceCode)
This method captures the vertex output of the decompressor. The normal or color references may be null if the corresponding data is not bundled with the vertices in the compressed geometry buffer. Alpha values may be included in the color.

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

abstract void outputColor(Color4f color)
This method captures the global color output of the decompressor. It is only invoked if colors are not bundled with the vertex data. The global color applies to all succeeding vertices until the next time the method is invoked.

Parameters:
color - The current global color.

outputNormal

abstract void outputNormal(Vector3f normal)
This method captures the global normal output of the decompressor. It is only invoked if normals are not bundled with the vertex data. The global normal applies to all succeeding vertices until the next time the method is invoked.

Parameters:
normal - The current global normal.

checkVersion

boolean checkVersion(int majorVersionNumber,
                     int minorVersionNumber)
Check version numbers and return true if compatible.


decompress

void decompress(int start,
                int length,
                byte[] data)
Decompress data and invoke abstract output methods.

Parameters:
start - byte offset to start of compressed geometry in data array
length - size of compressed geometry in bytes
data - array containing compressed geometry buffer of the specified length at the given offset from the start of the array
Throws:
java.lang.ArrayIndexOutOfBoundsException - if start+length > data size

getBits

private int getBits(int bitCount,
                    java.lang.String d)

processDecompression

private void processDecompression()

processDecompressionOpcode

private int processDecompressionOpcode(int mbp)

processSetState

private void processSetState()

processSetTable

private void processSetTable()

processVertex

private int processVertex()

processSetNormal

private void processSetNormal(int mbp)

indexNormal

private void indexNormal(int sex,
                         int oct,
                         int u,
                         int v,
                         Vector3f n)

processSetColor

private void processSetColor(int mbp)

processMeshBR

private void processMeshBR()

processEos

private void processEos()

processVNoop

private void processVNoop()

processPassThrough

private void processPassThrough()

processSkip8

private void processSkip8()

benchmarkStart

private void benchmarkStart(int length)

benchmarkPrint

private void benchmarkPrint(int length)


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