javax.media.j3d
Class CompressedGeometry

java.lang.Object
  |
  +--javax.media.j3d.SceneGraphObject
        |
        +--javax.media.j3d.NodeComponent
              |
              +--javax.media.j3d.Geometry
                    |
                    +--javax.media.j3d.CompressedGeometry

public class CompressedGeometry
extends Geometry

The compressed geometry object is used to store geometry in a compressed format. Using compressed geometry reduces the amount of memory needed by a Java 3D application and increases the speed objects can be sent over the network. Once geometry decompression hardware support becomes available, increased rendering performance will also result from the use of compressed geometry.


Field Summary
static int ALLOW_COUNT_READ
          Specifies that this CompressedGeometry object allows reading its byte count information.
static int ALLOW_GEOMETRY_READ
          Specifies that this CompressedGeometry object allows reading its geometry data component information.
static int ALLOW_HEADER_READ
          Specifies that this CompressedGeometry object allows reading its header information.
 
Fields inherited from class javax.media.j3d.Geometry
ALLOW_INTERSECT
 
Constructor Summary
CompressedGeometry(CompressedGeometryHeader hdr, byte[] geometry)
          Creates a new CompressedGeometry NodeComponent object.
 
Method Summary
 NodeComponent cloneNodeComponent()
          Creates a new CompressedGeometry object.
 Shape3D[] decompress()
          Decompresses the compressed geometry.
 void duplicateNodeComponent(NodeComponent originalNodeComponent)
          Copies the information found in originalNodeComponent to the current node.
 int getByteCount()
          Returns the size, in bytes, of the compressed geometry buffer.
 void getCompressedGeometry(byte[] compressedGeometry)
          Retrieves the compressed geometry associated with the CompressedGeometry NodeComponent object.
 void getCompressedGeometryHeader(CompressedGeometryHeader h)
          Copies the compressed geometry header from the CompressedGeometry NodeComponent into the passed in parameter.
 
Methods inherited from class javax.media.j3d.NodeComponent
getDuplicateOnCloneTree, setDuplicateOnCloneTree
 
Methods inherited from class javax.media.j3d.SceneGraphObject
clearCapability, duplicateSceneGraphObject, getCapability, getUserData, isCompiled, isLive, setCapability, setUserData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALLOW_COUNT_READ

public static final int ALLOW_COUNT_READ
Specifies that this CompressedGeometry object allows reading its byte count information.

ALLOW_HEADER_READ

public static final int ALLOW_HEADER_READ
Specifies that this CompressedGeometry object allows reading its header information.

ALLOW_GEOMETRY_READ

public static final int ALLOW_GEOMETRY_READ
Specifies that this CompressedGeometry object allows reading its geometry data component information.
Constructor Detail

CompressedGeometry

public CompressedGeometry(CompressedGeometryHeader hdr,
                          byte[] geometry)
Creates a new CompressedGeometry NodeComponent object.
Parameters:
hdr - the compressed geometry header. This is copied into the CompressedGeometry NodeComponent.
geometry - the compressed geometry. The geometry must conform to the format descibed in Appendix B of the Java 3D API Specification.
Throws:
java.lang.IllegalArgumentException - if a problem is detected with the header
See Also:
CompressedGeometryHeader
Method Detail

getByteCount

public final int getByteCount()
Returns the size, in bytes, of the compressed geometry buffer. The size of the compressed geometry header is not included.
Returns:
the size, in bytes, of the compressed geometry buffer.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

getCompressedGeometryHeader

public final void getCompressedGeometryHeader(CompressedGeometryHeader h)
Copies the compressed geometry header from the CompressedGeometry NodeComponent into the passed in parameter.
Parameters:
hdr - the CompressedGeometryHeader object into which to copy the CompressedGeometry NodeComponent's header.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
See Also:
CompressedGeometryHeader

getCompressedGeometry

public final void getCompressedGeometry(byte[] compressedGeometry)
Retrieves the compressed geometry associated with the CompressedGeometry NodeComponent object. Copies the compressed geometry from the CompressedGeometry node into the given array.
Parameters:
compressedGeometry - the array into which to copy the compressed geometry.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph
ArrayIndexOutOfBoundsException - if compressedGeometry byte array is not large enough to receive the compressed geometry

decompress

public final Shape3D[] decompress()
Decompresses the compressed geometry. Returns an array of Shape nodes containing the decompressed geometry objects.
Returns:
an array of Shape nodes containing the geometry decompressed from this CompressedGeometry NodeComponeent object.
Throws:
CapabilityNotSetException - if appropriate capability is not set and this object is part of live or compiled scene graph

cloneNodeComponent

public NodeComponent cloneNodeComponent()
Creates a new CompressedGeometry object. Called from a Leaf node's duplicateNode method.
Overrides:
cloneNodeComponent in class NodeComponent
Returns:
a duplicate of the CompressedGeometry object.
See Also:
Node.duplicateNode(javax.media.j3d.Node, boolean), Node.cloneTree(), NodeComponent.setDuplicateOnCloneTree(boolean)

duplicateNodeComponent

public void duplicateNodeComponent(NodeComponent originalNodeComponent)
Copies the information found in originalNodeComponent to the current node. This routine is called as part of the cloneNodeComponent operation.
Overrides:
duplicateNodeComponent in class NodeComponent
Parameters:
originalNodeComponent - the node to duplicate.
See Also:
Node.cloneTree(), Node.cloneNode(boolean), NodeComponent.duplicateNodeComponent(javax.media.j3d.NodeComponent), NodeComponent.setDuplicateOnCloneTree(boolean)