count mesh triangles

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Flo
Posts: 11
Joined: Mon Dec 01, 2003 2:03 pm
Location: Germany

count mesh triangles

Post by Flo »

how do i easily find out (during irrlicht runtime) how many triangles a specific mesh has?
Boogle
Posts: 162
Joined: Fri Nov 21, 2003 3:16 pm
Location: Toronto, Canada

Post by Boogle »

You could get a TriangleSelector for the mesh (smgr->createTriangleSelector(mesh,node)), then call selector->getTriangleCount(). Or you could read the source code of CTriangleSelector to see how it generates the triangle list, and copy that method to get your count.
Flo
Posts: 11
Joined: Mon Dec 01, 2003 2:03 pm
Location: Germany

Post by Flo »

momentary i make a meshbuffer and get the triangle count with getIndexCount(); ... but i don't know if this is right o.o

but now, i'll try your variant :)


----
edit: another prob:
i've got the indices pointer with getIndices();, but how do i get the indices themselves so i can do something like that o.o?

Code: Select all

for(i=0;i<indexcount;i++){
	triangle[i].indices[0] = >insert index i*3 here<;
	triangle[i].indices[1] = >insert index i*3+1 here<;
	triangle[i].indices[2] = >insert index i*3+2 here<;
}
madinitaly
Posts: 92
Joined: Sat Nov 29, 2003 8:30 pm
Contact:

Post by madinitaly »

Code: Select all

u16* Indices = myMesh->getMeshBuffer (0)->getIndices ();
Triangle count is actually indices size / 3.
Flo
Posts: 11
Joined: Mon Dec 01, 2003 2:03 pm
Location: Germany

Post by Flo »

ok, thx :)

but i'm still stuck on the other problem :?
Post Reply