javax.media.j3d
Class CompressedGeometryRetained

java.lang.Object
  extended by javax.media.j3d.IndexedObject
      extended by javax.media.j3d.SceneGraphObjectRetained
          extended by javax.media.j3d.NodeComponentRetained
              extended by javax.media.j3d.GeometryRetained
                  extended by javax.media.j3d.CompressedGeometryRetained
All Implemented Interfaces:
java.lang.Cloneable

 class CompressedGeometryRetained
extends GeometryRetained

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
(package private)  int bufferContents
           
(package private)  int bufferType
           
private  boolean byReference
           
(package private)  byte[] compressedGeometry
           
private static boolean hardwareDecompression
           
private static int HEADER_BUFFER_DATA_OFFSET
           
private static int HEADER_BUFFER_TYPE_OFFSET
           
private static int HEADER_LENGTH
           
private static int HEADER_MAJOR_VERSION_OFFSET
           
private static int HEADER_MINOR_MINOR_VERSION_OFFSET
           
private static int HEADER_MINOR_VERSION_OFFSET
           
(package private)  int majorVersionNumber
           
(package private)  int minorMinorVersionNumber
           
(package private)  int minorVersionNumber
           
(package private)  int offset
           
private  byte[] originalCompressedGeometry
           
(package private)  int packedVersion
           
private  GeometryRetained pickGeometry
           
(package private)  int renderFlags
           
(package private)  int size
           
(package private) static byte TYPE_LINE
           
(package private) static byte TYPE_POINT
           
(package private) static byte TYPE_TRIANGLE
           
 
Fields inherited from class javax.media.j3d.GeometryRetained
boundsDirty, cachedChangedFrequent, centroid, COMPRESS_TYPE, computeGeoBounds, EPSILON, GEO_TYPE_COMPRESSED, GEO_TYPE_GEOMETRYARRAY, GEO_TYPE_INDEXED_LINE_SET, GEO_TYPE_INDEXED_LINE_STRIP_SET, GEO_TYPE_INDEXED_POINT_SET, GEO_TYPE_INDEXED_QUAD_SET, GEO_TYPE_INDEXED_TRI_FAN_SET, GEO_TYPE_INDEXED_TRI_SET, GEO_TYPE_INDEXED_TRI_STRIP_SET, GEO_TYPE_LINE_SET, GEO_TYPE_LINE_STRIP_SET, GEO_TYPE_NONE, GEO_TYPE_POINT_SET, GEO_TYPE_QUAD_SET, GEO_TYPE_RASTER, GEO_TYPE_TEXT3D, GEO_TYPE_TOTAL, GEO_TYPE_TRI_FAN_SET, GEO_TYPE_TRI_SET, GEO_TYPE_TRI_STRIP_SET, geoBounds, geomLock, geoType, isDirty, isEditable, LINE_TYPE, liveStateLock, mirrorGeometry, nativeId, noAlpha, POINT_TYPE, QUAD_TYPE, RASTER_TYPE, recompCentroid, TEXT3D_TYPE, TRIANGLE_TYPE, universeList, userLists
 
Fields inherited from class javax.media.j3d.NodeComponentRetained
changedFrequent, compChanged, duplicateOnCloneTree, mirror, refCnt, refCount, users
 
Fields inherited from class javax.media.j3d.SceneGraphObjectRetained
DONT_MERGE, inBackgroundGroup, inSetLive, MERGE, MERGE_DONE, mergeFlag, onUpdateList, source
 
Fields inherited from class javax.media.j3d.IndexedObject
listIdx
 
Constructor Summary
CompressedGeometryRetained()
          The package-scoped constructor.
 
Method Summary
(package private)  void computeBoundingBox()
          Compressed geometry is immutable so this method does nothing.
(package private)  void copy(byte[] buff)
          Copies compressed geometry data into the given array of bytes.
private  void createByCopy(byte[] geometry)
           
(package private)  void createCompressedGeometry(CompressedGeometryHeader hdr, byte[] geometry, boolean byReference)
          Creates the retained compressed geometry data.
private  boolean decompressByRef(Context ctx)
          Formerly native method that returns availability of a native by-reference rendering API for compressed geometry.
private  boolean decompressHW(Context ctx, int majorVersion, int minorVersion)
          Formerly native method that returns availability of hardware rendering (and acceleration) for compressed geometry of the given version.
(package private)  void duplicate(CompressedGeometryRetained cgr)
          Copies all retained data for cloneNodeComponent() on the non-retained side.
(package private)  void execute(Canvas3D cv, RenderAtom ra, boolean isNonUniformScale, boolean updateAlpha, float alpha, int screen, boolean ignoreVertexColors)
          Method for calling native execute() method on behalf of the J3D renderer.
private  void execute(Context ctx, int version, int bufferType, int bufferContents, int renderFlags, int offset, int size, byte[] geometry)
          Formerly native method that does HW compressed geometry rendering
(package private)  int getBufferType()
          Return a buffer type that's compatible with CompressedGeometryHeader.
(package private)  int getClassType()
           
(package private)  GeometryRetained getGeometry(boolean forceDecompression, Canvas3D cv)
          Decompress this object into a GeometryArrayRetained if hardware decompression is not available.
(package private)  GeometryRetained getPickGeometry()
          This method always decompresses the geometry and retains the result in order to support geometry-based picking and collision detection.
(package private)  byte[] getReference()
          Returns a reference to the original compressed geometry byte array, which may have been copied even if by-reference semantics have been requested.
(package private)  int getVertexFormat()
          Return a vertex format mask that's compatible with GeometryArray objects.
(package private)  boolean intersect(Bounds targetBound)
           
(package private)  boolean intersect(PickShape pickShape, PickInfo pickInfo, int flags, Point3d iPnt, GeometryRetained geom, int geomIndex)
           
(package private)  boolean intersect(Point3d[] pnts)
           
(package private)  boolean intersect(Transform3D thisToOtherVworld, GeometryRetained g)
           
(package private)  boolean isByReference()
          Return true if the data access mode is by-reference.
(package private)  void update()
          Update this object.
 
Methods inherited from class javax.media.j3d.GeometryRetained
addUser, canBeInDisplayList, computeCentroid, decrComputeGeoBounds, doSetLive, incrComputeGeoBounds, intersect, intersect, isEquivalenceClass, removeUser, setLive, storeInterestData, updateObject
 
Methods inherited from class javax.media.j3d.NodeComponentRetained
addAMirrorUser, addUser, clearLive, clone, copyMirrorUsers, createMirrorObject, decRefCnt, getDuplicateOnCloneTree, getInImmCtx, incRefCnt, initMirrorObject, notifyUsers, removeAMirrorUser, removeMirrorUsers, removeUser, set, setDuplicateOnCloneTree, setFrequencyChangeMask, setInImmCtx, updateMirrorObject
 
Methods inherited from class javax.media.j3d.SceneGraphObjectRetained
clearLive, clearLive, compile, doSetLive, doSetLive, getSource, getVirtualUniverse, handleFrequencyChange, isInSetLive, isStatic, markAsLive, merge, mergeTransform, setCompiled, setLive, setLive, setSource, traverse
 
Methods inherited from class javax.media.j3d.IndexedObject
getIdxUsed, incIdxUsed
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HEADER_LENGTH

private static final int HEADER_LENGTH
See Also:
Constant Field Values

HEADER_MAJOR_VERSION_OFFSET

private static final int HEADER_MAJOR_VERSION_OFFSET
See Also:
Constant Field Values

HEADER_MINOR_VERSION_OFFSET

private static final int HEADER_MINOR_VERSION_OFFSET
See Also:
Constant Field Values

HEADER_MINOR_MINOR_VERSION_OFFSET

private static final int HEADER_MINOR_MINOR_VERSION_OFFSET
See Also:
Constant Field Values

HEADER_BUFFER_TYPE_OFFSET

private static final int HEADER_BUFFER_TYPE_OFFSET
See Also:
Constant Field Values

HEADER_BUFFER_DATA_OFFSET

private static final int HEADER_BUFFER_DATA_OFFSET
See Also:
Constant Field Values

TYPE_POINT

static final byte TYPE_POINT
See Also:
Constant Field Values

TYPE_LINE

static final byte TYPE_LINE
See Also:
Constant Field Values

TYPE_TRIANGLE

static final byte TYPE_TRIANGLE
See Also:
Constant Field Values

majorVersionNumber

int majorVersionNumber

minorVersionNumber

int minorVersionNumber

minorMinorVersionNumber

int minorMinorVersionNumber

packedVersion

int packedVersion

bufferType

int bufferType

bufferContents

int bufferContents

renderFlags

int renderFlags

offset

int offset

size

int size

compressedGeometry

byte[] compressedGeometry

byReference

private boolean byReference

originalCompressedGeometry

private byte[] originalCompressedGeometry

hardwareDecompression

private static boolean hardwareDecompression

pickGeometry

private GeometryRetained pickGeometry
Constructor Detail

CompressedGeometryRetained

CompressedGeometryRetained()
The package-scoped constructor.

Method Detail

decompressByRef

private boolean decompressByRef(Context ctx)
Formerly native method that returns availability of a native by-reference rendering API for compressed geometry.


decompressHW

private boolean decompressHW(Context ctx,
                             int majorVersion,
                             int minorVersion)
Formerly native method that returns availability of hardware rendering (and acceleration) for compressed geometry of the given version.


execute

private void execute(Context ctx,
                     int version,
                     int bufferType,
                     int bufferContents,
                     int renderFlags,
                     int offset,
                     int size,
                     byte[] geometry)
Formerly native method that does HW compressed geometry rendering


execute

void execute(Canvas3D cv,
             RenderAtom ra,
             boolean isNonUniformScale,
             boolean updateAlpha,
             float alpha,
             int screen,
             boolean ignoreVertexColors)
Method for calling native execute() method on behalf of the J3D renderer.

Specified by:
execute in class GeometryRetained

computeBoundingBox

void computeBoundingBox()
Compressed geometry is immutable so this method does nothing.

Specified by:
computeBoundingBox in class GeometryRetained

update

void update()
Update this object. Compressed geometry is immutable so there's nothing to do.

Specified by:
update in class GeometryRetained

isByReference

boolean isByReference()
Return true if the data access mode is by-reference.


createByCopy

private void createByCopy(byte[] geometry)

createCompressedGeometry

void createCompressedGeometry(CompressedGeometryHeader hdr,
                              byte[] geometry,
                              boolean byReference)
Creates the retained compressed geometry data. Data from the header is always copied; the compressed geometry is copied as well if the data access mode is not by-reference.

Parameters:
hdr - the compressed geometry header
geometry - the compressed geometry
byReference - if true then by-reference semantics requested

getGeometry

GeometryRetained getGeometry(boolean forceDecompression,
                             Canvas3D cv)
Decompress this object into a GeometryArrayRetained if hardware decompression is not available. Once decompressed the resulting geometry replaces the geometry reference in the associated RenderAtom as well as the mirror geometry reference in this object.


getPickGeometry

GeometryRetained getPickGeometry()
This method always decompresses the geometry and retains the result in order to support geometry-based picking and collision detection. The returned GeometryRetained object will contain only positions and connections.


intersect

boolean intersect(PickShape pickShape,
                  PickInfo pickInfo,
                  int flags,
                  Point3d iPnt,
                  GeometryRetained geom,
                  int geomIndex)
Specified by:
intersect in class GeometryRetained

intersect

boolean intersect(Bounds targetBound)
Specified by:
intersect in class GeometryRetained

intersect

boolean intersect(Transform3D thisToOtherVworld,
                  GeometryRetained g)
Specified by:
intersect in class GeometryRetained

intersect

boolean intersect(Point3d[] pnts)
Specified by:
intersect in class GeometryRetained

getVertexFormat

int getVertexFormat()
Return a vertex format mask that's compatible with GeometryArray objects.

Overrides:
getVertexFormat in class GeometryRetained
Returns:
format of vertices in the GeometryRetained as specified by GeometryArray, if appropriate to this instance.

getBufferType

int getBufferType()
Return a buffer type that's compatible with CompressedGeometryHeader.


copy

void copy(byte[] buff)
Copies compressed geometry data into the given array of bytes. The internal header information is not copied.

Parameters:
buff - array of bytes into which to copy compressed geometry

getReference

byte[] getReference()
Returns a reference to the original compressed geometry byte array, which may have been copied even if by-reference semantics have been requested. It will be null if byCopy is in effect.

Returns:
reference to array of bytes containing the compressed geometry.

duplicate

void duplicate(CompressedGeometryRetained cgr)
Copies all retained data for cloneNodeComponent() on the non-retained side. This is unlike GeometryArray subclasses which just call the public API constructors and then duplicateNodeComponent() to invoke the GeometryArray implementation of duplicateAttributes(), since the CompressedGeometry class directly subclasses Geometry and calling the public constructors would cause a lot of redundant data copying.


getClassType

int getClassType()
Specified by:
getClassType in class GeometryRetained


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