/// <summary> /// Reads the Normal vectors for this group /// </summary> /// <param name="file"></param> /// <param name="group"></param> static void ReadMONR(BinaryReader file, WMOGroup group) { // Read the vector normals for (var i=0;i<group.VertexCount;i++) { group.Normals.Add(file.ReadWMOVector3()); } }
/// <summary> /// Reads the vertices for this wmo group /// </summary> /// <param name="file"></param> /// <param name="group"></param> /// <param name="size"></param> static void ReadMOVT(BinaryReader file, WMOGroup group, uint size) { group.VertexCount = size/(sizeof (float)*3); // let's hope it's padded to 12 bytes, not 16... for (uint i = 0; i < group.VertexCount; i++) { group.Vertices.Add(file.ReadWMOVector3()); } }
static void ReadMOGP(BinaryReader file, WMOGroup group) { group.Header.NameStart = file.ReadInt32(); if (group.Header.NameStart != -1) { group.Name = group.Root.GroupNames[group.Header.NameStart]; } group.Header.DescriptiveNameStart = file.ReadInt32(); if (group.Header.DescriptiveNameStart > 0) { group.DescriptiveName = group.Root.GroupNames[group.Header.DescriptiveNameStart]; } group.Header.Flags = (WMOGroupFlags)file.ReadUInt32(); group.Header.BoundingBox = new BoundingBox(file.ReadWMOVector3(), file.ReadWMOVector3()); group.Header.PortalStart = file.ReadUInt16(); group.Header.PortalCount = file.ReadUInt16(); group.Header.BatchesA = file.ReadUInt16(); group.Header.BatchesB = file.ReadUInt16(); group.Header.BatchesC = file.ReadUInt16(); group.Header.BatchesD = file.ReadUInt16(); group.Header.Fogs = file.ReadBytes(4); group.Header.LiquidType = file.ReadUInt32(); group.Header.WMOGroupId = file.ReadUInt32(); group.Header.MOGP_0x3C = file.ReadUInt32(); group.Header.MOGP_0x40 = file.ReadUInt32(); }
static void ReadMOGI(BinaryReader br, WMORoot wmo) { wmo.GroupInformation = new GroupInformation[wmo.Header.GroupCount]; for (int i = 0; i < wmo.GroupInformation.Length; i++) { var g = new GroupInformation { Flags = (WMOGroupFlags) br.ReadUInt32(), BoundingBox = new BoundingBox(br.ReadWMOVector3(), br.ReadWMOVector3()), NameIndex = br.ReadInt32() }; wmo.GroupInformation[i] = g; } }
/// <summary> /// Reads the header for the root file /// </summary> static void ReadMOHD(BinaryReader br, WMORoot wmo) { wmo.Header.TextureCount = br.ReadUInt32(); wmo.Header.GroupCount = br.ReadUInt32(); wmo.Header.PortalCount = br.ReadUInt32(); wmo.Header.LightCount = br.ReadUInt32(); wmo.Header.ModelCount = br.ReadUInt32(); wmo.Header.DoodadCount = br.ReadUInt32(); wmo.Header.DoodadSetCount = br.ReadUInt32(); wmo.Header.AmbientColor = br.ReadColor4(); wmo.Header.WMOId = br.ReadUInt32(); wmo.Header.BoundingBox = new BoundingBox(br.ReadWMOVector3(), br.ReadWMOVector3()); wmo.Header.Flags = (WMORootHeaderFlags)br.ReadUInt32(); wmo.Groups = new WMOGroup[wmo.Header.GroupCount]; }
static void ReadMODD(BinaryReader br, WMORoot wmo, uint size) { // Why oh why is wmo.Header.DoodadCount wrong sometimes // 40 is the size of DoodadDefinition wmo.DoodadDefinitions = new DoodadDefinition[size / 40]; for (var i = 0; i < wmo.DoodadDefinitions.Length; i++) { var dd = new DoodadDefinition { NameIndex = br.ReadInt32(), Position = br.ReadWMOVector3(), Rotation = br.ReadQuaternion(), Scale = br.ReadSingle(), Color = br.ReadColor4() }; if (dd.NameIndex != -1) { dd.FilePath = wmo.DoodadFiles[dd.NameIndex]; } wmo.DoodadDefinitions[i] = dd; } }