/// <summary> /// Reads the vertex buffer for a section in a model. /// </summary> /// <param name="reader">The stream to read the vertex buffer from.</param> /// <param name="section">The model section that the vertex buffer belongs to.</param> /// <param name="buildInfo">Information about the cache file's target engine.</param> /// <param name="boundingBox">The bounding box for the model section.</param> /// <param name="processor"> /// The IModelProcessor to pass the read model data to, or null if the vertex buffer should be /// skipped over. /// </param> private static void ReadSectionVertices(IReader reader, IModelSection section, BoundingBox boundingBox, EngineDescription buildInfo, IModelProcessor processor) { VertexLayout layout = buildInfo.VertexLayouts.GetLayout(section.VertexFormat); foreach (IModelSubmesh submesh in section.Submeshes) { if (processor != null) processor.BeginSubmeshVertices(submesh); VertexBufferReader.ReadVertices(reader, layout, submesh.VertexBufferCount, boundingBox, processor); if (processor != null) processor.EndSubmeshVertices(submesh); } VertexBufferReader.SkipExtraElements(reader, section); }
/// <summary> /// Reads the vertex buffer for a section in a model. /// </summary> /// <param name="reader">The stream to read the vertex buffer from.</param> /// <param name="section">The model section that the vertex buffer belongs to.</param> /// <param name="buildInfo">Information about the cache file's target engine.</param> /// <param name="boundingBox">The bounding box for the model section.</param> /// <param name="processor"> /// The IModelProcessor to pass the read model data to, or null if the vertex buffer should be /// skipped over. /// </param> private static void ReadSectionVertices(IReader reader, IModelSection section, BoundingBox boundingBox, EngineDescription buildInfo, IModelProcessor processor) { VertexLayout layout = buildInfo.VertexLayouts.GetLayout(section.VertexFormat); foreach (IModelSubmesh submesh in section.Submeshes) { if (processor != null) { processor.BeginSubmeshVertices(submesh); } VertexBufferReader.ReadVertices(reader, layout, submesh.VertexBufferCount, boundingBox, processor); if (processor != null) { processor.EndSubmeshVertices(submesh); } } VertexBufferReader.SkipExtraElements(reader, section); }