Game Development Community

Getting a List of Polygons

by Mike Kuklinski · in Torque Game Engine · 06/25/2005 (3:22 pm) · 10 replies

I am trying to get a list of ALL the polgyons of an object (IE, a list of all the triangles, primarily a list of 3 coordinates each).

So far, I have gotten so far as to figure out I should get the TSShape of the object, and parse through it's TSMeshes, parsing through the indices and vertex vectors in those, to try to create a triangle list.

Am I on the right path?

#1
06/25/2005 (3:32 pm)
I would just use buildPolyList and pass it the rendered detail level. As for verticies... I think a call to getAccelerator() should give you those. I'm pretty sure getAccelerator() doesn't check for a convex hull or anything. Should work.
#2
06/25/2005 (3:40 pm)
Where would you pass buildPolyList a detail level? Mind you I don't want the rendered detail level, I want simply all the triangles of the shape itself, as it was in the modeller.

buildPolyList (AbstractPolyList *polyList, const Box3F &box, const SphereF &sphere)

I must admit I am unsure about how this works at all.
#3
06/25/2005 (3:44 pm)
GetPolyList, my bad. TSShapeInstance.getPolyList(AbstractPolyList *polyList, S32 detailLevel).
#4
06/25/2005 (5:08 pm)
Any other ideas?
#5
06/26/2005 (12:10 am)
Use buildPolyList() with a Box3F that matches the bounding box or larger. Might be best to use a ConcretePolyList (one of the simplest of the polylists).
#6
06/26/2005 (12:54 am)
Will the vertices in the vertexList already be in triangle-list form? IE, every 3 is a triangle on the mesh?
#7
06/26/2005 (6:23 am)
IIRC ConcretePolyList is in n-sided polygons but that is trivial to convert into triangles.
#8
06/26/2005 (7:39 am)
Forgive my ignorance, but how do I determine what n is?
#9
06/26/2005 (7:57 am)
I just realized something -- in order to use buildPolyList or getPolyList, I would already need an object. Perhaps I did not specify this enough earlier, but I want to be able to get this list of triangles when I am creating the DATABLOCK, not the object, for speed purposes. I obviously can get a TSShape, any idea about past that?
#10
06/26/2005 (8:14 am)
For expansion, I am trying to make a list of triangles that are in the shape itself for the base LOD, which will, on datablock creation, be fed into ColDet, and the ColDet model will be saved as part of the datablock.

Unless, of course, I convert the TSShape to a TSShapeInstance, which has BuildPolyList..