Ejemplo n.º 1
0
        protected virtual Buffer ReadIndexBuffer()
        {
            int indexCount  = Reader.ReadInt32();
            int sizeInBytes = Reader.ReadInt32();

            SerializeMemoryRegion(SharedMemoryPointer, sizeInBytes);
            return(Buffer.New(Device, new DataPointer(SharedMemoryPointer, sizeInBytes), sizeInBytes / indexCount, BufferFlags.IndexBuffer, ResourceUsage.Immutable));
        }
Ejemplo n.º 2
0
        protected virtual void ReadVertexBuffer(ref VertexBufferBinding vertexBufferBinding)
        {
            // Read the number of vertices
            int count = Reader.ReadInt32();

            // Read vertex elements
            int vertexElementCount = Reader.ReadInt32();
            var elements           = new VertexElement[vertexElementCount];

            for (int i = 0; i < vertexElementCount; i++)
            {
                elements[i].Serialize(this);
            }
            vertexBufferBinding.Layout = VertexInputLayout.New(0, elements);

            // Read Vertex Buffer
            int sizeInBytes = Reader.ReadInt32();

            SerializeMemoryRegion(SharedMemoryPointer, sizeInBytes);
            vertexBufferBinding.Buffer = Buffer.New(Device, new DataPointer(SharedMemoryPointer, sizeInBytes), sizeInBytes / count, BufferFlags.VertexBuffer, ResourceUsage.Immutable);
        }