MCPcopy Create free account
hub / github.com/BoomingTech/Piccolo / parseRawTriple

Function parseRawTriple

engine/3rdparty/tinyobjloader/tiny_obj_loader.h:1190–1220  ·  view source on GitHub ↗

Parse raw triples: i, i/j/k, i//k, i/j

Source from the content-addressed store, hash-verified

1188
1189// Parse raw triples: i, i/j/k, i//k, i/j
1190static vertex_index_t parseRawTriple(const char **token) {
1191 vertex_index_t vi(static_cast<int>(0)); // 0 is an invalid index in OBJ
1192
1193 vi.v_idx = atoi((*token));
1194 (*token) += strcspn((*token), "/ \t\r");
1195 if ((*token)[0] != '/') {
1196 return vi;
1197 }
1198 (*token)++;
1199
1200 // i//k
1201 if ((*token)[0] == '/') {
1202 (*token)++;
1203 vi.vn_idx = atoi((*token));
1204 (*token) += strcspn((*token), "/ \t\r");
1205 return vi;
1206 }
1207
1208 // i/j/k or i/j
1209 vi.vt_idx = atoi((*token));
1210 (*token) += strcspn((*token), "/ \t\r");
1211 if ((*token)[0] != '/') {
1212 return vi;
1213 }
1214
1215 // i/j/k
1216 (*token)++; // skip '/'
1217 vi.vn_idx = atoi((*token));
1218 (*token) += strcspn((*token), "/ \t\r");
1219 return vi;
1220}
1221
1222bool ParseTextureNameAndOption(std::string *texname, texture_option_t *texopt,
1223 const char *linebuf) {

Callers 1

LoadObjWithCallbackFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected