public GroupModel(BinaryReader reader) { reader.BaseStream.Position += 2 * SizeCache <Vector3> .Size; // BBox var mogpFlags = reader.ReadInt32(); var groupWmoID = reader.ReadInt32(); if (reader.ReadInt32() == 0x54524556) // VERT { var chunkSize = reader.ReadInt32(); var count = reader.ReadInt32(); if (count == 0) { return; } _modelVertices = reader.Read <Vector3>(count); } if (reader.ReadInt32() == 0x4D495254) // TRIM { var chunkSize = reader.ReadInt32(); var count = reader.ReadInt32(); _modelIndices = reader.Read <uint>(count * 3); } if (reader.ReadInt32() == 0x4849424D) // MBIH { BIH.Skip(reader); } if (reader.ReadInt32() == 0x5551494C) // LIQU { var chunkSize = reader.ReadInt32(); if (chunkSize == 0) { return; } var tileX = reader.ReadInt32(); var tileY = reader.ReadInt32(); reader.BaseStream.Position += SizeCache <Vector3> .Size; reader.BaseStream.Position += 4; reader.BaseStream.Position += 4 * (tileX + 1) * (tileY + 1); reader.BaseStream.Position += tileX * tileY; } }
public BuildingsLoader(string directory, int mapID) { _directory = directory; _mapId = mapID; using (var reader = new BinaryReader(File.OpenRead(Path.Combine(directory, "vmaps", $"{mapID:D3}.vmtree")))) { reader.BaseStream.Position += 8; // Skip signature _isTiled = reader.ReadByte() == 1; if (reader.ReadInt32() == 0x45444F4E) // NODE { BIH.Skip(reader); } if (!_isTiled && reader.ReadInt32() == 0x4A424F47) // GOBJ { // load global model } } }