Пример #1
0
        internal ModelMesh(string name, PrimitiveType primitiveType, Buffer vertexBuffer, VertexInputLayout layout, Buffer indexBuffer) : this(name)
        {
            VertexBufferBinding vertexBufferBinding = new VertexBufferBinding {
                Buffer = vertexBuffer, Layout = layout
            };
            VertexBuffers.Add(vertexBufferBinding);

            ModelMeshPart meshPart = new ModelMeshPart()
            {
                Name         = Name,
                VertexBuffer = new ModelBufferRange <VertexBufferBinding> {
                    Count = vertexBuffer.ElementCount, Resource = vertexBufferBinding,
                    Start = 0
                },
                ParentMesh    = this,
                PrimitiveType = primitiveType,
            };
            if (indexBuffer != null)
            {
                IndexBuffers.Add(indexBuffer);
                meshPart.IndexBuffer = new ModelBufferRange <Buffer>
                {
                    Count    = indexBuffer.ElementCount,
                    Resource = indexBuffer,
                    Start    = 0
                };
                meshPart.IsIndex32Bit = indexBuffer.ElementSize == 4;
                DrawFunction          = DrawIndexed;
            }
            else
            {
                DrawFunction = DrawUnindexed;
            }

            MeshParts.Add(meshPart);
        }
Пример #2
0
 internal ModelMesh() : this("Undefined")
 {
     DrawFunction = DrawIndexed;
 }