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

Method LoadLWO2Clip

code/AssetLib/LWO/LWOLoader.cpp:1096–1164  ·  view source on GitHub ↗

------------------------------------------------------------------------------------------------ Load LWO2 clip

Source from the content-addressed store, hash-verified

1094// ------------------------------------------------------------------------------------------------
1095// Load LWO2 clip
1096void LWOImporter::LoadLWO2Clip(unsigned int length) {
1097 AI_LWO_VALIDATE_CHUNK_LENGTH(length, CLIP, 10);
1098
1099 mClips.emplace_back();
1100 LWO::Clip &clip = mClips.back();
1101
1102 // first - get the index of the clip
1103 clip.idx = GetU4();
1104
1105 IFF::SubChunkHeader head = IFF::LoadSubChunk(mFileBuffer);
1106 switch (head.type) {
1107 case AI_LWO_STIL:
1108 AI_LWO_VALIDATE_CHUNK_LENGTH(head.length, STIL, 1);
1109
1110 // "Normal" texture
1111 GetS0(clip.path, head.length);
1112 clip.type = Clip::STILL;
1113 break;
1114
1115 case AI_LWO_ISEQ:
1116 AI_LWO_VALIDATE_CHUNK_LENGTH(head.length, ISEQ, 16);
1117 // Image sequence. We'll later take the first.
1118 {
1119 uint8_t digits = GetU1();
1120 mFileBuffer++;
1121 int16_t offset = GetU2();
1122 mFileBuffer += 4;
1123 int16_t start = GetU2();
1124 mFileBuffer += 4;
1125
1126 std::string s;
1127 std::ostringstream ss;
1128 GetS0(s, head.length);
1129
1130 head.length -= (uint16_t)s.length() + 1;
1131 ss << s;
1132 ss << std::setw(digits) << offset + start;
1133 GetS0(s, head.length);
1134 ss << s;
1135 clip.path = ss.str();
1136 clip.type = Clip::SEQ;
1137 }
1138 break;
1139
1140 case AI_LWO_STCC:
1141 ASSIMP_LOG_WARN("LWO2: Color shifted images are not supported");
1142 break;
1143
1144 case AI_LWO_ANIM:
1145 ASSIMP_LOG_WARN("LWO2: Animated textures are not supported");
1146 break;
1147
1148 case AI_LWO_XREF:
1149 AI_LWO_VALIDATE_CHUNK_LENGTH(head.length, XREF, 4);
1150
1151 // Just a cross-reference to another CLIp
1152 clip.type = Clip::REF;
1153 clip.clipRef = GetU4();

Callers

nothing calls this directly

Calls 3

LoadSubChunkFunction · 0.85
emplace_backMethod · 0.80
strMethod · 0.80

Tested by

no test coverage detected