Beispiel #1
0
        protected internal override VertexBuffer Read(ContentReader input, VertexBuffer existingInstance)
        {
            VertexDeclaration vertexDeclaration = input.ReadRawObject <VertexDeclaration>();
            int vertexCount = (int)input.ReadUInt32();

            byte[]       data         = input.ReadBytes(vertexCount * vertexDeclaration.VertexStride);
            VertexBuffer vertexBuffer = new VertexBuffer(input.GraphicsDevice, vertexDeclaration, vertexCount, BufferUsage.None);

            vertexBuffer.SetData <byte>(data);
            return(vertexBuffer);
        }
        protected internal override VertexBuffer Read(ContentReader input, VertexBuffer existingInstance)
        {
            var declaration = input.ReadRawObject <VertexDeclaration>();
            var vertexCount = (int)input.ReadUInt32();
            int dataSize    = vertexCount * declaration.VertexStride;

            byte[] data = input.ContentManager.GetScratchBuffer(dataSize);
            input.Read(data, 0, dataSize);

            var buffer = new VertexBuffer(input.GraphicsDevice, declaration, vertexCount, BufferUsage.None);

            buffer.SetData(data, 0, dataSize);
            return(buffer);
        }
Beispiel #3
0
 protected internal override T Read(ContentReader input, T existingInstance)
 {
     return(input.ReadRawObject <T>(elementReader));
 }