www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Simdanfeg on July 04, 2011, 09:09:05 am

Title: Md2 format conversion problems to the ser
Post by: Simdanfeg on July 04, 2011, 09:09:05 am
 ::)     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 .

Code: [Select]
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
Title: Re: Md2 format conversion problems to the ser
Post by: EgonOlsen on July 04, 2011, 09:42:35 am
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().
Title: Re: Md2 format conversion problems to the ser
Post by: Simdanfeg on July 04, 2011, 10:11:58 am
thank you , master ,i'll try tonight. ;D