Is there a way or algorithm to automatically determine how the vertex list should be related?
For example, let's say I have this (in 2D for simplicity):
*(0,0) *(2,0)
*(-1,-1) *(1,-1)
So, I add vertices in the order of (-1, -1), (0,0), (1, -1), (2,0) and then in the list of triangles I add indices 0,1,2 and 2,1 , 3, and this should generate a grid with two triangles.
However, as the number of vertices increases, the process of defining triangles becomes more tedious, unless, of course, I add vertices to the sorted order so that I can keep track of which triangle I am and just add an offset every time (which I donβt want do).
Where am I going with this, this (again in 2D for simplicity): I want to define an array, let's say:
[0, 0, 1, 0, 1, 0]
[0, 0, 0, 0, 0, 0]
[0, 1, 0, 1, 0, 0]
xy, - (1) (0). , [0,0] x = 0, y = 0 (), [2,1] () x = 1, y = 2. , .
? .
EDIT: , script, 2D.