Isosurface.ManifoldDC.MDC3D.MDC3D C# (CSharp) Method

MDC3D() public method

public MDC3D ( GraphicsDevice device, int resolution, int size ) : System
device GraphicsDevice
resolution int
size int
return System
        public MDC3D(GraphicsDevice device, int resolution, int size)
            : base(device, resolution, size, true, !FlatShading, 2097152)
        {
            for (int i = 0; i < 256; i++)
            {
                bool[] found = new bool[16];
                for (int k = 0; k < 16; k++)
                {
                    if (Utilities.TransformedEdgesTable[i, k] < 0)
                        continue;
                    if (found[Utilities.TransformedEdgesTable[i, k]])
                    {
                    }
                    found[Utilities.TransformedEdgesTable[i, k]] = true;
                }
            }

            EnforceManifold = true;
            OctreeNode.EnforceManifold = EnforceManifold;
            CustomWireframe = FlatShading;
            SpecialShader = true;
            SupportsDeferred = false;

            VerticesDN = new List<VertexPositionColorNormalNormal>();
            VertexBuffer = new DynamicVertexBuffer(device, VertexPositionColorNormalNormal.VertexDeclaration, 735468, BufferUsage.None);

            WireframeBuffer = new VertexBuffer(device, VertexPositionColor.VertexDeclaration, 524288, BufferUsage.None);
            WireframeIndexBuffer = new IndexBuffer(device, IndexElementSize.ThirtyTwoBits, 1048576, BufferUsage.None);

            /*int[,] associated =
            {
                { 0, 0 },
                { 1, 4 },
                { 2, 5 },
                { 3, 1 },
                { 4, 2 },
                { 5, 6 },
                { 6, 7 },
                { 7, 3 }
            };
            int[] edges = { 0, 10, 1, 8, 2, 11, 3, 9, 4, 6, 7, 5 };
            int[,] new_table = new int[256, 16];
            int[] new_vtable = new int[256];
            string s = "";
            System.IO.StreamWriter sw = System.IO.File.CreateText("C:\\table.txt");
            for (int i = 0; i < 256; i++)
            {
                int old_code = i;
                int new_code = 0;
                for (int k = 0; k < 8; k++)
                {
                    if ((old_code & (1 << k)) != 0)
                        new_code |= 1 << associated[k, 1];
                }
                for (int k = 0; k < 16; k++)
                {
                    new_table[new_code, k] = (Utilities.EdgesTable[i, k] >= 0 ? edges[Utilities.EdgesTable[i, k]] : Utilities.EdgesTable[i, k]);
                }
            }

            for (int i = 0; i < 256; i++)
            {
                s = "{ ";
                for (int k = 0; k < 16; k++)
                {
                    s += new_table[i, k].ToString();
                    if (k < 15)
                        s += ", ";
                }
                if (i < 255)
                    s += " },";
                else
                    s += " }";
                sw.WriteLine(s);
            }

            sw.Close();

            for (int i = 0; i < 256; i++)
            {
                int old_code = i;
                int new_code = 0;
                for (int k = 0; k < 8; k++)
                {
                    if ((old_code & (1 << k)) != 0)
                        new_code |= 1 << associated[k, 1];
                }
                new_vtable[new_code] = Utilities.VerticesNumberTable[i];
            }

            sw = System.IO.File.CreateText("C:\\table2.txt");
            s = "{\r\n";
            for (int i = 0; i < 256; i++)
            {
                s += new_vtable[i].ToString();
                if (i == 255)
                    s += "}";
                else if (i % 16 == 15)
                    s += ",\r\n";
                else
                    s += ", ";
            }
            sw.WriteLine(s);
            sw.Close();*/
        }