Is there some order in which the polygons are exported in the egg made by the chicken exporter blender? I am having a hard time figuring it out.
In 3DSMax, the triangles seem to be ordered in the egg in the following way: (in the case of a plane with subdivisions)
triangle 1: bottom left triangle
triangle 2: next triangle which makes a face with triangle 1
triangle n: last triangle in the row, where row is the (number of subdivisions in the plane)/2
Then I can read the next row and so on till all the triangles are done.
This helps me to make a grid out of the face subdivisions since I know the pattern of how the triangles are ordered.
I would like to know a similar pattern in blender’s exported egg format.
The order is the order that Blender stores them in. This is quite arbitrary, and probably related to which version of Blender your using and the order in which you model the geometry.
However, if your writing algorithms that depend on this order your doing it wrong - the egg file format does not require any specific ordering, therefore any tool you write to process it should not assume any specific ordering.
So, to make a grid out of the faces of a plane, how would I go about that without knowing the order of the faces?
The only way I can think of is to calculate the positions using (leastX, leastY) and (maxX, maxY) and storing the faces (vertex positions or even midpoint of the face) using “n” divisions, where n is the (total subdivisions in the plane)/2
Then searching for faces in the egg file which match these values.
Any other suggestions would be helpful.
“grid out of the faces of a plane” ?
Simple load every thing and compute neighbor of each triangle. Then you get your connectivity data structure and can answer those questions.
How would you computer the neighbor of each triangle?
I thought about it and all I could come up with is:
Compare each line of your existing triangle, which is not a diagonal, to the line of the next triangle (which does not make a face with your current triangle).
Then based on the position of the line of the face (left, top, right, down), you determine which side the next face is at?
Is this what you meant?