#How to generate a mesh with more than one Quad? Pls help
1 messages · Page 1 of 1 (latest)
Just generate vertices at different positions
Triangle are the indices from the vertex array
Every 3 vertices/indices form a triangle with triangle topology
I do not want one big quad but rather grid
can you explain this in more detail, pls?😀
if you want a grid, you can use the first half of Brackey's terrain generation tutorial
A triangle is formed by 3 continuous values in the index buffer, that's literally it 
Index points to the position of the element in the vertex buffer
I still do not get it, for example, what number will be on top right quad?
(triangular numbers)
it could be anything
you set the positions of the vertices, and just write the index of that vertex in the triangles array to create a triangle
literally work like an array
Sound different to all of the tutorials
This is a code that assigns value to triangular array, and I do not understand the '+ worldSize' and verts
But the code is working
It will be 11 if the zWorldSize is 10, for example
_zWorldSize is basically the amount of vertex of the world horizontally/vertically, so adding it effectively point to the vertex that lie in the next row/column of the grid
Ok, but what if z = 4 and x = 5?
to go on the next row it is not correct to assign zWorldSize + 1
It would be 5, but there is the value of 7
doesn't look like x = 5 to me according to the pic
also shouldn't you add the _xWorldSize instead of the _zWorldSize?
ok, 6 😀
But, is this picture is the order of assigning triangular values?
personally i go for the order of Top-Left, Top-Right, Bottom-Right, Bottom-Right, Bottom-Left, Top-Left
but well you can use whatever order you want
but you have to follow the winding direction if you want the triangle be displayed/culled correctly
So this picture is the answer?
maybe