Is there a means by which to count the polygons in a world?

Started by AGP, September 07, 2009, 02:41:23 AM

Previous topic - Next topic

AGP

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.

AGP

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.

    private void stripKeyFrames() {
Mesh[] meshes = this.model.getAnimationSequence().getKeyFrames();
for (int i = 0; i < meshes.length; i++)
    meshes[i].strip();
    }

EgonOlsen

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.