AddTriangles error/fix
mentalarray wrote at 2012-04-08 04:32:
Hi
there seemed to be an error in the triangleIndices code for AddTriangles as i had points in all wrong places i have added code that fixes it below
//Not working (old code)
/*
int indexEnd = this.positions.Count;
for (int i = index0; i + 2 < indexEnd; i++)
{
this.triangleIndices.Add(i);
this.triangleIndices.Add(i + 1);
this.triangleIndices.Add(i + 2);
}
*/
//Working
for (int i = 0; i < this.positions.Count; i+=3)
{
this.triangleIndices.Add(i);
this.triangleIndices.Add(i + 1);
this.triangleIndices.Add(i + 2);
}
objo wrote at 2012-04-08 13:10:
thanks! I submitted a fix on the AddTriangles method. Notice that the triangle indices should be based on the index of the first point added (this will allow AddTriangles to be called multiple times). I also corrected some errors in the argument checks.
I found that this method is currently not in use in the library, but I will leave it there in case someone use it. Will add more unit tests/examples for the mesh builder later.
Mentalarray wrote at 2012-04-08 13:24:
Oh great objo yea i realised about the index afterwards as i was adding my object all in one go good point
great work on the whole library btw,,,
Customer support service by UserEcho