MCPcopy Create free account
hub / github.com/assimp/assimp / LoadLWO3Clip

Method LoadLWO3Clip

code/AssetLib/LWO/LWOLoader.cpp:1166–1234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1164}
1165
1166void LWOImporter::LoadLWO3Clip(unsigned int length) {
1167 AI_LWO_VALIDATE_CHUNK_LENGTH(length, CLIP, 12);
1168
1169 mClips.emplace_back();
1170 LWO::Clip &clip = mClips.back();
1171
1172 // first - get the index of the clip
1173 clip.idx = GetU4();
1174
1175 IFF::ChunkHeader head = IFF::LoadChunk(mFileBuffer);
1176 switch (head.type) {
1177 case AI_LWO_STIL:
1178 AI_LWO_VALIDATE_CHUNK_LENGTH(head.length, STIL, 1);
1179
1180 // "Normal" texture
1181 GetS0(clip.path, head.length);
1182 clip.type = Clip::STILL;
1183 break;
1184
1185 case AI_LWO_ISEQ:
1186 AI_LWO_VALIDATE_CHUNK_LENGTH(head.length, ISEQ, 16);
1187 // Image sequence. We'll later take the first.
1188 {
1189 uint8_t digits = GetU1();
1190 mFileBuffer++;
1191 int16_t offset = GetU2();
1192 mFileBuffer += 4;
1193 int16_t start = GetU2();
1194 mFileBuffer += 4;
1195
1196 std::string s;
1197 std::ostringstream ss;
1198 GetS0(s, head.length);
1199
1200 head.length -= (uint16_t)s.length() + 1;
1201 ss << s;
1202 ss << std::setw(digits) << offset + start;
1203 GetS0(s, head.length);
1204 ss << s;
1205 clip.path = ss.str();
1206 clip.type = Clip::SEQ;
1207 }
1208 break;
1209
1210 case AI_LWO_STCC:
1211 ASSIMP_LOG_WARN("LWO3: Color shifted images are not supported");
1212 break;
1213
1214 case AI_LWO_ANIM:
1215 ASSIMP_LOG_WARN("LWO3: Animated textures are not supported");
1216 break;
1217
1218 case AI_LWO_XREF:
1219 AI_LWO_VALIDATE_CHUNK_LENGTH(head.length, XREF, 4);
1220
1221 // Just a cross-reference to another CLIp
1222 clip.type = Clip::REF;
1223 clip.clipRef = GetU4();

Callers

nothing calls this directly

Calls 3

LoadChunkFunction · 0.85
emplace_backMethod · 0.80
strMethod · 0.80

Tested by

no test coverage detected