Example #1
0
 /// <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();
 }
Example #2
0
 /// <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 VertexStream 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 new VertexStream(baseStream);
 }