Author Topic: Is there a means by which to count the polygons in a world?  (Read 2986 times)

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Is there a means by which to count the polygons in a world?
« 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.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Is there a means by which to count the polygons in a world?
« Reply #1 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();
    }

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Is there a means by which to count the polygons in a world?
« Reply #2 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.

Offline AGP

  • quad
  • ******
  • Posts: 1726
    • View Profile
Re: Is there a means by which to count the polygons in a world?
« Reply #3 on: September 07, 2009, 11:02:50 am »
OK, thanks a lot.