Esempio n. 1
0
        void Build()
        {
            var vertexList = new List <VertexPositionColor>();
            var indexList  = new List <int>();

            int index = 0;

            foreach (var shape in shapes)
            {
                vertexList.AddRange(shape.Vertices);
                int[] indexArray = shape.Indices;
                for (int i = 0; i < indexArray.Length; i++)
                {
                    indexArray[i] += index;
                }
                indexList.AddRange(indexArray);
                index += shape.Vertices.Length;
            }

            model = GeometricPrimitive <VertexPositionNormalTexture> .New(device, "ShapeMesh", vertexList.ToArray(), indexList.ToArray(), modelOperations : ModelOperations);
        }