Creating a Mesh

Blitz3D Forums/Blitz3D Beginners Area/Creating a Mesh

Eric(Posted 2004) [#1]
I am having the hardest time, figuring out how to connect all the vertices of a mesh.

I need to make sure they are clockwise to show the texture, that I know. But how do I iterate through all the verts that I create ...to make the triangles. I've looked throught the code archive and most of the information is more than I need or can understand.

Can someone walk me though the process.

Thanks and Best Regards,
Eric


WolRon(Posted 2004) [#2]
Why not assign each vertice a variable so that you can reference it later to assign your triangles. You can easily do this with an array. Something like this:
Dim V(64)
form = CreateMesh()
Surf = CreateSurface(form) 
v(0) = AddVertex(Surf, 0, 0, 0, .5, .5)
For iter = 0 To 31
	x# = Cos(iter * 11.25)
	z# = Sin(iter * 11.25)
	v(iter + 1) = AddVertex(Surf, x, 0, z, (x+1)/2, (-z+1)/2)
Next
For iter = 1 To 31
	AddTriangle(Surf, v(0), v(iter + 1), v(iter))
	AddTriangle(Surf, v(0), v(iter + 32), v(iter + 33))
Next