示例#1
0
        public Mesh(List <Triangle <T> > triangles)
        {
            DataVertex <T>[] Points  = new DataVertex <T> [triangles.Count * 3];
            int[]            Indices = new int[triangles.Count * 3];

            for (int i = 0; i < triangles.Count; i++)
            {
                Points[i * 3 + 0] = triangles[i].A;
                Points[i * 3 + 1] = triangles[i].B;
                Points[i * 3 + 2] = triangles[i].C;

                Indices[i * 3]     = i * 3;
                Indices[i * 3 + 1] = i * 3 + 1;
                Indices[i * 3 + 2] = i * 3 + 2;
            }

            SetTriangles(Points, Indices);
        }