Author Topic: Md2 format conversion problems to the ser  (Read 1166 times)

Offline Simdanfeg

  • byte
  • *
  • Posts: 41
    • View Profile
Md2 format conversion problems to the ser
« 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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Md2 format conversion problems to the ser
« Reply #1 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().

Offline Simdanfeg

  • byte
  • *
  • Posts: 41
    • View Profile
Re: Md2 format conversion problems to the ser
« Reply #2 on: July 04, 2011, 10:11:58 am »
thank you , master ,i'll try tonight. ;D