Пример #1
0
        private void DrawShape(BasicEffect e, BSP bsp, Matrix transform, Color color)
        {
            List <VertexPositionColor> vertices = new List <VertexPositionColor>();
            List <int> indices = new List <int>();

            bsp.ToTriangleList <VertexPositionColor, int>(
                v => new VertexPositionColor(v.Position, v is ColorVertex ? ((ColorVertex)v).Color : Color.White),
                v =>
            {
                vertices.Add(v);
                return(vertices.Count - 1);
            },
                (a, b, c) =>
            {
                indices.Add(a);
                indices.Add(b);
                indices.Add(c);
            }
                );

            DrawShape <VertexPositionColor>(effect, vertices.ToArray(), indices.ToArray(), transform);
        }