www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: AGP on September 07, 2009, 02:41:23 am

Title: Is there a means by which to count the polygons in a world?
Post by: AGP on September 07, 2009, 02:41:23 am
By my count I shouldn't have passed my specified number, but jpct tells me I have. How could I get a count (without getting into the vertex controllers)? I've looked but couldn't find one such method. If none exists, perhaps just changing the error message to include current number of polygons would do.
Title: Re: Is there a means by which to count the polygons in a world?
Post by: AGP on September 07, 2009, 03:20:06 am
And a related question: will the following method break my MD2 models? Should I initialize i to 1 instead of 0? I tried it in my game and didn't see any problems, so I guess what I'm asking is whether there could be a problem I can't see with other models or whether if it renders at all (ie the original model still has its triangles) it works.

Code: [Select]
    private void stripKeyFrames() {
Mesh[] meshes = this.model.getAnimationSequence().getKeyFrames();
for (int i = 0; i < meshes.length; i++)
    meshes[i].strip();
    }
Title: Re: Is there a means by which to count the polygons in a world?
Post by: EgonOlsen on September 07, 2009, 07:12:11 am
There's no such method by default. You can easily write your own by iterating over all objects in the world, get the mesh from them and add up the results of Mesh.getTriangleCount().

About the strip()-call: It shouldn't matter for MD2 models anyway (well, maybe it does...i'm not sure), but you can't strip the mesh of the first frame, that's correct.
Title: Re: Is there a means by which to count the polygons in a world?
Post by: AGP on September 07, 2009, 11:02:50 am
OK, thanks a lot.