/// <summary> /// Reads the index buffer for a section in a model. /// </summary> /// <param name="reader">The stream to read the index buffer from.</param> /// <param name="section">The model section that the index buffer belongs to.</param> /// <param name="buildInfo">Information about the cache file's target engine.</param> /// <param name="processor">The IModelProcessor to pass the read model data to, or null if the index buffer should be skipped over.</param> private static void ReadSectionIndices(IReader reader, IModelSection section, int baseIndex, BuildInformation buildInfo, IModelProcessor processor) { foreach (IModelSubmesh submesh in section.Submeshes) { if (processor != null) { ushort[] indices = IndexBufferReader.ReadIndexBuffer(reader, submesh.IndexBufferCount); processor.ProcessSubmeshIndices(submesh, indices, baseIndex); } else { IndexBufferReader.SkipIndexBuffer(reader, submesh.IndexBufferCount); } } reader.SeekTo((reader.Position + 3) & ~3); // Align 4 }
/// <summary> /// Reads the index buffer for a section in a model. /// </summary> /// <param name="reader">The stream to read the index buffer from.</param> /// <param name="section">The model section that the index buffer belongs to.</param> /// <param name="buildInfo">Information about the cache file's target engine.</param> /// <param name="processor"> /// The IModelProcessor to pass the read model data to, or null if the index buffer should be /// skipped over. /// </param> private static void ReadSectionIndices(IReader reader, IModelSection section, int baseIndex, EngineDescription buildInfo, IModelProcessor processor) { foreach (IModelSubmesh submesh in section.Submeshes) { if (processor != null) { ushort[] indices = IndexBufferReader.ReadIndexBuffer(reader, submesh.IndexBufferCount); processor.ProcessSubmeshIndices(submesh, indices, baseIndex); } else { IndexBufferReader.SkipIndexBuffer(reader, submesh.IndexBufferCount); } } reader.SeekTo((reader.Position + 3) & ~3); // Align 4 }