public LODInfo(ref Meta meta, ref RawDataMetaChunk[] rd)
{
BinaryReader BR = new BinaryReader(meta.MS);
BR.BaseStream.Position = 28;
int tempc = BR.ReadInt32();
int tempr = BR.ReadInt32() - meta.magic - meta.offset;
Piece = new LODPieceInfo[tempc];
for (int x = 0; x < tempc; x++)
{
Piece[x] = new LODPieceInfo();
BR.BaseStream.Position = tempr + (x * 16);
Piece[x].Name = meta.Map.Strings.Name[BR.ReadInt16()];
BR.BaseStream.Position = tempr + (x * 16) + 8;
int tempc2 = BR.ReadInt32();
int tempr2 = BR.ReadInt32() - meta.magic - meta.offset;
Piece[x].Permutation = new LODPieceInfo.LODPermutationInfo[tempc2];
for (int xx = 0; xx < tempc2; xx++)
{
BR.BaseStream.Position = tempr2 + (xx * 16);
Piece[x].Permutation[xx] = new LODPieceInfo.LODPermutationInfo();
Piece[x].Permutation[xx].name = meta.Map.Strings.Name[BR.ReadInt16()];
if (PermutationStrings.IndexOf(Piece[x].Permutation[xx].name) == -1)
{
PermutationStrings.Add(Piece[x].Permutation[xx].name);
}
BR.ReadInt16();
Piece[x].Permutation[xx].pieceNumber = new int[5];
for (int w = 0; w < 5; w++)
{
Piece[x].Permutation[xx].pieceNumber[w] = BR.ReadInt16();
rd[Piece[x].Permutation[xx].pieceNumber[w]].piecename = Piece[x].Name;
rd[Piece[x].Permutation[xx].pieceNumber[w]].permutation = Piece[x].Permutation[xx].name;
rd[Piece[x].Permutation[xx].pieceNumber[w]].lod = w;
}
}
}
}