/// <summary> /// Opens a vertex stream on one of the mesh's vertex buffers. /// </summary> /// <param name="definition">The vertex buffer definition.</param> /// <param name="baseStream">The stream open on the mesh's resource data to use as a base stream.</param> /// <returns>The vertex stream if successful, or <c>null</c> otherwise.</returns> public IVertexStream OpenVertexStream(VertexBufferDefinition definition, Stream baseStream) { if (definition.Data.Address.Type != ResourceAddressType.Resource) return null; // Don't bother supporting non-resource addresses baseStream.Position = definition.Data.Address.Offset; return VertexStreamFactory.Create(_version, baseStream); }
/// <summary> /// Initializes a new instance of the <see cref="MeshReader"/> class. /// </summary> /// <param name="mesh">The mesh.</param> /// <param name="definition">The mesh's definition data.</param> public MeshReader(Mesh mesh, RenderGeometryResourceDefinition definition) { Mesh = mesh; Definition = definition; VertexStreams = new VertexBufferDefinition[StreamCount]; IndexBuffers = new IndexBufferDefinition[IndexBufferCount]; BindVertexStreams(); BindIndexBuffers(); }
/// <summary> /// Opens a vertex reader on one of the mesh's vertex buffers. /// </summary> /// <param name="definition">The vertex buffer definition.</param> /// <param name="baseStream">The stream open on the mesh's resource data to use as a base stream.</param> /// <returns>The vertex reader if successful, or <c>null</c> otherwise.</returns> public VertexReader OpenVertexReader(VertexBufferDefinition definition, Stream baseStream) { if (definition.Data.Address.Type != ResourceAddressType.Resource) { return(null); // Don't bother supporting non-resource addresses } baseStream.Position = definition.Data.Address.Offset; return(new VertexReader(new BinaryReader(baseStream))); }
/// <summary> /// Opens a vertex stream on one of the mesh's vertex buffers. /// </summary> /// <param name="definition">The vertex buffer definition.</param> /// <param name="baseStream">The stream open on the mesh's resource data to use as a base stream.</param> /// <returns>The vertex stream if successful, or <c>null</c> otherwise.</returns> public IVertexStream OpenVertexStream(VertexBufferDefinition definition, Stream baseStream) { if (definition.Data.Address.Type != ResourceAddressType.Resource) { return(null); // Don't bother supporting non-resource addresses } baseStream.Position = definition.Data.Address.Offset; return(VertexStreamFactory.Create(_version, baseStream)); }
/// <summary> /// Opens a vertex reader on one of the mesh's vertex buffers. /// </summary> /// <param name="definition">The vertex buffer definition.</param> /// <param name="baseStream">The stream open on the mesh's resource data to use as a base stream.</param> /// <returns>The vertex reader if successful, or <c>null</c> otherwise.</returns> public VertexReader OpenVertexReader(VertexBufferDefinition definition, Stream baseStream) { if (definition.Data.Address.Type != ResourceAddressType.Resource) return null; // Don't bother supporting non-resource addresses baseStream.Position = definition.Data.Address.Offset; return new VertexReader(new BinaryReader(baseStream)); }