triangle3df, getTriangles

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
Joe Red
Posts: 9
Joined: Tue Oct 31, 2006 11:10 am

triangle3df, getTriangles

Post by Joe Red »

Well, I have two questions:

The first: I want to get all the polys of a scene node, and I would like to use Triangle selector for this. Here comes the first question: there is a very smart function, getTriangles. If I understand the command well (wich has not too big chance), it will write all teh triangle datas of my scene node to a triangle3df array. Here comes what I don't understand:

triangles,: Array where the resulting triangles will be written to.
arraySize,: Size of the target array.
outTriangleCount,: Amount of triangles which have been written into the array.
transform,: Pointer to matrix for transforming the triangles before. they are returned. Useful for example to scale all triangles down into an ellipsoid space. If this pointer is null, no transformation will be done.


(It was from the help)

the first is easy: I should create an array to store the triangle datas in like this:

triangle3df TriangleDatas[];

the second, the array size is a bit more complicated: How would the irrlicht want this? In bytes, bits, or te cells of the array? Please helP!

the next is easy, like the first one

and the final is easy too.


Here comes the second question: What the hell is the triangle3df? The tutorial writes, that it's a type to store triangle data. But I couldn't find out, that how can I get the vertex datas of the poly from this.


Please Help!!!!

Joe
Xharock
Posts: 71
Joined: Wed May 10, 2006 3:50 pm

Post by Xharock »

For arraySize you could just do:

sizeof(TriangleDatas)

But this would only work if you gave TriangleDatas a size i.e.

triangle3df TriangleDatas[99];

As for triangle3df I guess it's a vector and you should be able to access the data you want like you would any other data structure:

triangle3df.X
triangle3df.Y
.. etc.

That might not be exact but it should be similar.
Joe Red
Posts: 9
Joined: Tue Oct 31, 2006 11:10 am

Post by Joe Red »

It can't be teh similar, because a triangle must have 9 datas: the first vertex's X,Y,Z coords, the second's, and the third's. Does anyone have an idea? Or should I move the topic to the advanced help?
Post Reply