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

java.lang.Object
  extended by com.sun.j3d.utils.geometry.compression.CompressionStreamElement
      extended by com.sun.j3d.utils.geometry.compression.CompressionStreamNormal

 class CompressionStreamNormal
extends CompressionStreamElement

This class represents a normal in a compression stream. It maintains both floating-point and quantized representations. This normal may be bundled with a vertex or exist separately as a global normal.


Field Summary
private static double[][][][] cgNormals
           
private static short[][] inverseSine
           
private static short MAX_SIN_14BIT
           
private static int MAX_UV_BITS
           
private static int MAX_UV_ENTRIES
           
private static double MAX_Y_ANG
           
private  float normalX
           
private  float normalY
           
private  float normalZ
           
(package private)  int octant
           
(package private)  int sextant
           
(package private)  boolean specialNormal
           
private  int specialOctant
           
private  int specialSextant
           
private  int u
           
(package private)  int uAbsolute
           
private static double UNITY_14
           
private  int v
           
(package private)  int vAbsolute
           
 
Fields inherited from class com.sun.j3d.utils.geometry.compression.CompressionStreamElement
absolute, length, lengthMask, quantizationMask, shift
 
Constructor Summary
CompressionStreamNormal(CompressionStream stream, Vector3f normal)
          Create a CompressionStreamNormal.
 
Method Summary
private static void computeInverseSineTables()
           
private static void computeNormals()
           
(package private)  void outputCommand(HuffmanTable table, CommandStream output)
          Output a setNormal command.
private  void outputNormal(HuffmanTable table, CommandStream output, int header, int headerLength)
           
(package private)  void outputSubcommand(HuffmanTable table, CommandStream output)
          Output a normal subcommand.
(package private)  void quantize(CompressionStream stream, HuffmanTable huffmanTable)
          Quantize the floating point normal to a 6-bit octant/sextant plus u,v components of [0..6] bits.
 java.lang.String toString()
           
 
Methods inherited from class com.sun.j3d.utils.geometry.compression.CompressionStreamElement
computeLengthShift, computeLengthShift, computeLengthShift
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

u

private int u

v

private int v

specialOctant

private int specialOctant

specialSextant

private int specialSextant

normalX

private float normalX

normalY

private float normalY

normalZ

private float normalZ

octant

int octant

sextant

int sextant

specialNormal

boolean specialNormal

uAbsolute

int uAbsolute

vAbsolute

int vAbsolute

MAX_UV_BITS

private static final int MAX_UV_BITS
See Also:
Constant Field Values

MAX_UV_ENTRIES

private static final int MAX_UV_ENTRIES
See Also:
Constant Field Values

cgNormals

private static final double[][][][] cgNormals

MAX_Y_ANG

private static final double MAX_Y_ANG
See Also:
Constant Field Values

UNITY_14

private static final double UNITY_14
See Also:
Constant Field Values

inverseSine

private static final short[][] inverseSine

MAX_SIN_14BIT

private static final short MAX_SIN_14BIT
See Also:
Constant Field Values
Constructor Detail

CompressionStreamNormal

CompressionStreamNormal(CompressionStream stream,
                        Vector3f normal)
Create a CompressionStreamNormal.

Parameters:
stream - CompressionStream associated with this element
normal - floating-point representation to be encoded
Method Detail

computeNormals

private static void computeNormals()

computeInverseSineTables

private static void computeInverseSineTables()

quantize

void quantize(CompressionStream stream,
              HuffmanTable huffmanTable)
Quantize the floating point normal to a 6-bit octant/sextant plus u,v components of [0..6] bits. Full resolution is 18 bits and the minimum is 6 bits.

Specified by:
quantize in class CompressionStreamElement
Parameters:
stream - CompressionStream associated with this element
table - HuffmanTable for collecting data about the quantized representation of this element

outputCommand

void outputCommand(HuffmanTable table,
                   CommandStream output)
Output a setNormal command.

Overrides:
outputCommand in class CompressionStreamElement
Parameters:
table - HuffmanTable mapping quantized representations to compressed encodings
output - CommandStream for collecting compressed output

outputSubcommand

void outputSubcommand(HuffmanTable table,
                      CommandStream output)
Output a normal subcommand.

Parameters:
table - HuffmanTable mapping quantized representations to compressed encodings
output - CommandStream for collecting compressed output

outputNormal

private void outputNormal(HuffmanTable table,
                          CommandStream output,
                          int header,
                          int headerLength)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


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