private ImmutableArray <StripGroup> LoadStripGroups(BinaryReader reader, int count) { StripGroup[] stripGroups = new StripGroup[count]; for (int i = 0; i < count; ++i) { long offset = reader.BaseStream.Position; int vertexCount = reader.ReadInt32(); long vertexOffset = offset + reader.ReadInt32(); int indexCount = reader.ReadInt32(); long indexOffset = offset + reader.ReadInt32(); int stripCount = reader.ReadInt32(); long stripOffset = offset + reader.ReadInt32(); StripGroupFlags flags = (StripGroupFlags)reader.ReadByte(); long save = reader.BaseStream.Position; reader.BaseStream.Position = vertexOffset; ImmutableArray <Vertex> vertices = LoadVertices(reader, vertexCount); reader.BaseStream.Position = indexOffset; ImmutableArray <int> indices = LoadIndices(reader, indexCount); reader.BaseStream.Position = stripOffset; ImmutableArray <Strip> strips = LoadStrips(reader, stripCount); reader.BaseStream.Position = save; stripGroups[i] = new StripGroup(vertices, indices, flags, strips); } return(new ImmutableArray <StripGroup>(stripGroups)); }
private ImmutableArray<StripGroup> LoadStripGroups(BinaryReader reader, int count) { StripGroup[] stripGroups = new StripGroup[count]; for (int i = 0; i < count; ++i) { long offset = reader.BaseStream.Position; int vertexCount = reader.ReadInt32(); long vertexOffset = offset + reader.ReadInt32(); int indexCount = reader.ReadInt32(); long indexOffset = offset + reader.ReadInt32(); int stripCount = reader.ReadInt32(); long stripOffset = offset + reader.ReadInt32(); StripGroupFlags flags = (StripGroupFlags)reader.ReadByte(); long save = reader.BaseStream.Position; reader.BaseStream.Position = vertexOffset; ImmutableArray<Vertex> vertices = LoadVertices(reader, vertexCount); reader.BaseStream.Position = indexOffset; ImmutableArray<int> indices = LoadIndices(reader, indexCount); reader.BaseStream.Position = stripOffset; ImmutableArray<Strip> strips = LoadStrips(reader, stripCount); reader.BaseStream.Position = save; stripGroups[i] = new StripGroup(vertices, indices, flags, strips); } return new ImmutableArray<StripGroup>(stripGroups); }