Example #1
0
 public Mesh GenerateSurface()
 {
     ConstructTree();
     Shrink();
     ExtractTriangles();
     return(mb.GetMesh());
 }
Example #2
0
        }//extract triangles and put them into meshbuilder

        public Mesh GenerateSurface()
        {
            MeshBuilder_IntegerVertex builder = new MeshBuilder_IntegerVertex(bmp.width + 2, bmp.height + 2, bmp.depth + 2);// this class can build mesh from independent triangles

            for (int k = 0; k < bmp.depth - 1; k++)
            {
                for (int j = 0; j < bmp.height - 1; j++)
                {
                    for (int i = 0; i < bmp.width - 1; i++)
                    {
                        Cube cell   = new Cube(i, j, k);             //builde Cube for Cell at i j k
                        byte config = GetConfig(ref cell);           // get byte config for the cell
                        ExtractTriangles(ref cell, config, builder); // extract triangles from cell and push into
                    }
                }
            }
            return(builder.GetMesh());
        }