------------------------------------------------------------------------------------------------
| 53 | |
| 54 | // ------------------------------------------------------------------------------------------------ |
| 55 | void LWOImporter::LoadLWOBFile() { |
| 56 | LE_NCONST uint8_t* const end = mFileBuffer + fileSize; |
| 57 | bool running = true; |
| 58 | while (running) { |
| 59 | if (mFileBuffer + sizeof(IFF::ChunkHeader) > end) |
| 60 | break; |
| 61 | const IFF::ChunkHeader head = IFF::LoadChunk(mFileBuffer); |
| 62 | |
| 63 | if (mFileBuffer + head.length > end) { |
| 64 | throw DeadlyImportError("LWOB: Invalid chunk length"); |
| 65 | } |
| 66 | uint8_t* const next = mFileBuffer+head.length; |
| 67 | switch (head.type) { |
| 68 | // vertex list |
| 69 | case AI_LWO_PNTS: { |
| 70 | if (!mCurLayer->mTempPoints.empty()) |
| 71 | ASSIMP_LOG_WARN("LWO: PNTS chunk encountered twice"); |
| 72 | else |
| 73 | LoadLWOPoints(head.length); |
| 74 | } break; |
| 75 | case AI_LWO_POLS: { // face list |
| 76 | if (!mCurLayer->mFaces.empty()) |
| 77 | ASSIMP_LOG_WARN("LWO: POLS chunk encountered twice"); |
| 78 | else |
| 79 | LoadLWOBPolygons(head.length); |
| 80 | } break; |
| 81 | |
| 82 | case AI_LWO_SRFS: // list of tags |
| 83 | { |
| 84 | if (!mTags->empty()) |
| 85 | ASSIMP_LOG_WARN("LWO: SRFS chunk encountered twice"); |
| 86 | else |
| 87 | LoadLWOTags(head.length); |
| 88 | } break; |
| 89 | |
| 90 | case AI_LWO_SURF: // surface chunk |
| 91 | { |
| 92 | LoadLWOBSurface(head.length); |
| 93 | } break; |
| 94 | |
| 95 | default: |
| 96 | break; |
| 97 | } |
| 98 | mFileBuffer = next; |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | // ------------------------------------------------------------------------------------------------ |
| 103 | void LWOImporter::LoadLWOBPolygons(unsigned int length) { |
nothing calls this directly
no test coverage detected