Mobile Java-3D

Hello!

I’m trying to build my own loader for the Mobile 3D spec. JSR-184, to be able to see the structure of each .m3g file.
But I haven’t been able to get the compressed files to serialize correctly. These are compressed using zlib with 32k buffer (?), and I’ve got no clue how to implement this.
Can someone give me a quick example how to use the Inflator with a 32k buffer ? (pleeease :slight_smile:

Thanks //musse-

Once you’ve extracted a section from the m3g file (lets say it’s stored in a byte array called compressedByteArray) then you might invoke Inflater like this:

Inflater decompresser = new Inflater();
decompresser.setInput(compressedByteArray);
byte[] decompressedByteArray = new byte[32768];
decompresser.inflate(decompressedByteArray);
decompresser.end();

And hey presto, decompressedByteArray now contains the unpacked section. (Also remember there can be multiple sections in an m3g file)

Furthermore, you might like to checkout the M3GToolkit thread as they’ve produced an open-source toolkit which might have all the information you need.

Well, I finaly found the problem… I had the wrong spec!!! >:( the coding I had done worked, the only problem was that I serialized the code in the wrong order…
A tip for all developing for JSR-184, don’t use the PDF spec, use the html spec…