/// <summary> /// Binds each vertex buffer in the mesh to a stream. /// </summary> private void BindVertexStreams() { // The game actually loads buffers from specific indices, but it's // dependent upon what type of mesh is being loaded. Instead, we // can just scan the entire array and bind everything as an // approximation. foreach (var bufferIndex in Mesh.VertexBufferIndices.Where(i => i < Definition.VertexBuffers.Count)) { // Use the buffer format to determine the stream index var buffer = Definition.VertexBuffers[bufferIndex].Definition; if (!VertexBufferStreams.TryGetValue(buffer.Format, out int streamIndex)) { continue; } VertexStreams[streamIndex] = buffer; } }
/// <summary> /// Binds each vertex buffer in the mesh to a stream. /// </summary> private void BindVertexStreams() { // The game actually loads buffers from specific indices, but it's // dependent upon what type of mesh is being loaded. Instead, we // can just scan the entire array and bind everything as an // approximation. foreach (var buffer in Mesh.ResourceVertexBuffers) { if (buffer != null) { if (!VertexBufferStreams.TryGetValue(buffer.Format, out int streamIndex)) { continue; } VertexStreams[streamIndex] = buffer; } } }