Md2 format conversion problems to the ser

Started by Simdanfeg, July 04, 2011, 09:09:05 AM

Previous topic - Next topic

Simdanfeg

 ::)     i'll try change the md2 format(228,764  bytes) to ser,but its size become too large(1,063,604  bytes) , e.g. i want to conversion snork.md2 to snork.ser,there is my code .


TextureManager.getInstance().addTexture("disco",
new Texture("res/disco.jpg"));
Object3D alien = Loader.loadMD2("res/snork.md2", 0.8f);
alien.setTexture("disco");
alien.compile(true);
alien.build();
alien.getAnimationSequence().remove(3);
alien.getAnimationSequence().remove(4);
alien.getAnimationSequence().remove(6);
alien.getAnimationSequence().remove(7);
new DeSerializer().serialize(alien, new FileOutputStream("snork.ser"),
true);



i wonder why it become too large after conversion format ;D

EgonOlsen

Because md2 is a compressed format that stores vertex information in bytes (lossy compression). Just zip the ser-file and load it via a ZipInputStream. It compresses pretty well. You might also consider to remove animation sequences from the file that you don't need. You can do this with Animation.remove().

Simdanfeg