> From: [EMAIL PROTECTED]
> Date: Sun, 22 May 2005 03:12:44 +0000
>
> OK, I'll forget about using the CompressedGeometryFile entirely as you and
> Laurent Gilson suggested.
>
> He did say that there should be a way to assemble a CompressedGeometry file
> in the client applet though.

Yes, it's very simple.  Don't even bother to use obj2cg directly, it's
just an example of what you can do.

Take a look at ObjectFileCompressor in the same directory.  There's a
method compress(String) that returns a CompressedGeometry object after
compressing a .obj file.  Use that method after calling
setQuantization() to reasonable values (the defaults are a little too
lossy in my opinion).

Now you have a CompressedGeometry object.  Use the getByteCount() and
getCompressedGeometry() methods to get the compressed bits.  Use
getCompressedGeometryHeader() to get the the header information.  Write
them out into a file in whatever streamable format you like, and have
your client read it.

Your client can construct new CompressedGeometryHeader and
CompressedGeometry instances using the compressed bits and the header
information in the files it reads from the server.  Add the
CompressedGeometry to the scenegraph and it will decompress itself into
a renderable form the first time it is needed.  (If you had a Sun
Elite3D graphics accelerator it would have been left in the scene graph
in compressed form and decompressed by the graphics hardware for
rendering).  If you need direct access to the decompressed geometry,
call the decompress() method.

Remember that the compressed geometry is normalized to a range of -1.0
to +1.0 on the major axis (a uniform scale), so you'll need to re-scale
afterwards.  Also note that you can't compress geometry with texture
coordinates in the vertices, which is the major deficiency of the
format.

-- Mark Hood

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to