Author Topic: Animation meshes have 8 more vertices than the main mesh  (Read 953 times)

Offline Colonel Thirty Two

  • byte
  • *
  • Posts: 2
    • View Profile
Animation meshes have 8 more vertices than the main mesh
« on: October 14, 2011, 02:15:20 am »
I'm making a command line tool to create serialized objects for jPCT-AE, and I am running into some problems with the animation meshes. They always have 8 more vertices than the mesh than the file I am using for the base. I've tried a variety of models, but the animation mesh is always 8 more.

Mesh code:
Code: [Select]
Object3D obj = objs[k];
obj.build();
Mesh m = obj.getMesh();
m.setSerializeMethod(Mesh.SERIALIZE_VERTICES_ONLY);
System.out.println("-   Keyframe "+k+" has "+m.getVertexCount()+" verticies ("+m.getUniqueVertexCount()+" unique).");
m.strip();
m.compress();
meshes[k] = m;

Model loading code: (happens with both obj and 3ds formats)
Code: [Select]
public static Object3D[] loadFile(String path) throws IOException
{
String ext = getExtension(path);
String folder = getFolder(path);
if(ext.equals("3ds"))
{
//System.out.println("Loading 3ds textures");
String[] textures = Loader.readTextureNames3DS(path);
for(String s : textures)
{
if(TextureManager.getInstance().containsTexture(s)) continue;
File f = new File(folder.concat(s).concat(".png"));
if(!f.exists()) { System.err.println("-!  Didn't find texture "+s+".png"); continue; }
Texture t = new Texture(new FileInputStream(f));
TextureManager.getInstance().addTexture(s, t);
}
System.out.println("Loading 3ds model: "+path);
return Loader.load3DS(path, 1f);
}
else if(ext.equals("obj"))
return Loader.loadOBJ(path, getNoExtension(path).concat(".mtl"), 1f);
else
throw new IllegalArgumentException("unknown model type: "+path);
}
Any help would be appreciated.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11913
    • View Profile
    • http://www.jpct.net
Re: Animation meshes have 8 more vertices than the main mesh
« Reply #1 on: October 14, 2011, 07:12:54 am »
That's the bounding box. Call calcBoundingBox() on all and it should be fine.

Offline Colonel Thirty Two

  • byte
  • *
  • Posts: 2
    • View Profile
Re: Animation meshes have 8 more vertices than the main mesh
« Reply #2 on: October 15, 2011, 01:21:00 am »
That's the bounding box. Call calcBoundingBox() on all and it should be fine.
Thanks, it worked.