The clear color is set to bright blue and it shows:
It also misses a few triangles on some levels. Now it might only be a few, but it's definitely noticeable:
Anyway I figure the cracks are caused by rounding errors. Anyone have any idea how to fix them? Here's the function to find a point on a line from the Z axis:
public static Vertex HorizontalPlaneIntersection( Line LineReference, int Z ) { Vertex A = LineReference.StartVertex; Vertex B = LineReference.EndVertex; int DX = B.X - A.X; int DZ = B.Z - A.Z; if( Math.Abs( DZ ) == 0 ) { return null; } if( A.Z == Z ) { return A; } if( B.Z == Z ) { return B; } if( A.Z < B.Z ) { if( ( Z < A.Z ) || ( Z > B.Z ) ) { return null; } } else if( ( Z < B.Z ) || ( Z > A.Z ) ) { return null; } if( Math.Abs( DX ) == 0 ) { return new Vertex( A.X, Z ); } float Slope = (float)DZ / (float)DX; float Beta = (float)A.Z - ( Slope * (float)A.X ); float NewX = ( (float)Z - Beta ) / Slope; return new Vertex( (int)NewX, Z ); }
The function returns the new point or null if the plane doesn't pass through the line. I tried using doubles, but that was even worse. Points(or vertices) are just 2D points, X and Z.
Edit: The reward is of course, a giant rate++.