Esempio n. 1
0
        public static void VerifyContracts <TVertex>(IMeshData32 <TVertex> mesh)
            where TVertex : struct
        {
            VerifyCommonContracts(mesh);

            Contracts.Requires.That(mesh.Indices32 != null);
            Contracts.Requires.That(mesh.IndicesCount.IsIn(Range.New(0, mesh.Indices32.Length)));

            var range = Range.FromLength(mesh.VerticesCount);

            Contracts.Requires.That(mesh.Indices32.Take(mesh.IndicesCount).All(index => index.IsIn(range)));
        }
Esempio n. 2
0
        /// <inheritdoc />
        public Mesh Create(IMeshData32 <TVertex> meshData)
        {
            Contracts.Requires.That(meshData != null);
            MeshData.VerifyContracts(meshData);

            var indexBuffer = new IndexBufferBinding(
                Buffer.Index.New(this.GraphicsDevice, meshData.Indices32, GraphicsResourceUsage.Immutable),
                is32Bit: true,
                count: meshData.IndicesCount);

            return(this.CreateMesh(indexBuffer, meshData));
        }