www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: Colonel Thirty Two on October 14, 2011, 02:15:20 am

Title: Animation meshes have 8 more vertices than the main mesh
Post by: Colonel Thirty Two 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.
Title: Re: Animation meshes have 8 more vertices than the main mesh
Post by: EgonOlsen on October 14, 2011, 07:12:54 am
That's the bounding box. Call calcBoundingBox() on all and it should be fine.
Title: Re: Animation meshes have 8 more vertices than the main mesh
Post by: Colonel Thirty Two 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.