internal void LoadIndexedData(EndianBinaryReader input, OrderedSet <GcmfVertex> vertexPool, HeaderSectionInfo headerSectionInfo) { if ((headerSectionInfo.SectionFlags & 0x01) != 0 && headerSectionInfo.Chunk1Size == 0) { throw new InvalidGmaFileException("GcmfMeshType2: Chunk1, but chunk1Size == 0?"); } if ((headerSectionInfo.SectionFlags & 0x01) == 0 && headerSectionInfo.Chunk1Size != 0) { throw new InvalidGmaFileException("GcmfMeshType2: No chunk1, but chunk1Size != 0?"); } if ((headerSectionInfo.SectionFlags & 0x01) != 0) { Obj1StripsCcw.LoadIndexed(input, headerSectionInfo.Chunk1Size, vertexPool, headerSectionInfo.VertexFlags); } if ((headerSectionInfo.SectionFlags & 0x02) != 0 && headerSectionInfo.Chunk2Size == 0) { throw new InvalidGmaFileException("GcmfMeshType2: Chunk2, but chunk2Size == 0?"); } else if ((headerSectionInfo.SectionFlags & 0x02) == 0 && headerSectionInfo.Chunk2Size != 0) { throw new InvalidGmaFileException("GcmfMeshType2: No chunk2, but chunk2Size != 0?"); } if ((headerSectionInfo.SectionFlags & 0x02) != 0) { Obj1StripsCw.LoadIndexed(input, headerSectionInfo.Chunk2Size, vertexPool, headerSectionInfo.VertexFlags); } if ((headerSectionInfo.SectionFlags & 0xFC) != 0) { throw new InvalidGmaFileException("GcmfMeshType2: Unknown present chunk flags at chunk10."); } }
internal void LoadNonIndexedData(EndianBinaryReader input, HeaderSectionInfo headerSectionInfo, bool is16Bit) { if ((headerSectionInfo.SectionFlags & 0x01) != 0 && headerSectionInfo.Chunk1Size == 0) { throw new InvalidGmaFileException("GcmfMeshType1: Chunk1, but chunk1Size == 0?"); } if ((headerSectionInfo.SectionFlags & 0x01) == 0 && headerSectionInfo.Chunk1Size != 0) { throw new InvalidGmaFileException("GcmfMeshType1: No chunk1, but chunk1Size != 0?"); } if ((headerSectionInfo.SectionFlags & 0x01) != 0) { Obj1StripsCcw.LoadNonIndexed(input, headerSectionInfo.Chunk1Size, headerSectionInfo.VertexFlags, is16Bit); } if ((headerSectionInfo.SectionFlags & 0x02) != 0 && headerSectionInfo.Chunk2Size == 0) { throw new InvalidGmaFileException("GcmfMeshType1: Chunk2, but chunk2Size == 0?"); } else if ((headerSectionInfo.SectionFlags & 0x02) == 0 && headerSectionInfo.Chunk2Size != 0) { throw new InvalidGmaFileException("GcmfMeshType1: No chunk2, but chunk2Size != 0?"); } if ((headerSectionInfo.SectionFlags & 0x02) != 0) { Obj1StripsCw.LoadNonIndexed(input, headerSectionInfo.Chunk2Size, headerSectionInfo.VertexFlags, is16Bit); } if ((headerSectionInfo.SectionFlags & 0xFF) == 0x0F) // Those are always used together { // Read extra header before two extra chunks input.Read(TransformMatrixSpecificIdxsObj2, 0, 8); int chunk3Size = input.ReadInt32(); int chunk4Size = input.ReadInt32(); if (input.ReadUInt32() != 0) { throw new InvalidGmaFileException("Expected GcmfMeshType1[ExtraHdr-0x10] == 0"); } if (input.ReadUInt32() != 0) { throw new InvalidGmaFileException("Expected GcmfMeshType1[ExtraHdr-0x14] == 0"); } if (input.ReadUInt32() != 0) { throw new InvalidGmaFileException("Expected GcmfMeshType1[ExtraHdr-0x18]== 0"); } if (input.ReadUInt32() != 0) { throw new InvalidGmaFileException("Expected GcmfMeshType1[ExtraHdr-0x1C] == 0"); } if (chunk3Size == 0) { throw new InvalidGmaFileException("GcmfMeshType1: Chunk3, but chunk3Size == 0?"); } if (chunk4Size == 0) { throw new InvalidGmaFileException("GcmfMeshType1: Chunk4, but chunk4Size == 0?"); } Obj2StripsCcw.LoadNonIndexed(input, chunk3Size, headerSectionInfo.VertexFlags, is16Bit); Obj2StripsCw.LoadNonIndexed(input, chunk4Size, headerSectionInfo.VertexFlags, is16Bit); } else if ((headerSectionInfo.SectionFlags & 0xFC) != 0) { throw new InvalidGmaFileException("GcmfMeshType1: Unknown present chunk flags at chunk10."); } }