MCPcopy Create free account
hub / github.com/SaschaWillems/HowToVulkan / parseRawTriple

Function parseRawTriple

source/external/tinyobj/tiny_obj_loader.h:1253–1283  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1251
1252// Parse raw triples: i, i/j/k, i//k, i/j
1253static vertex_index_t parseRawTriple(const char **token) {
1254 vertex_index_t vi(static_cast<int>(0)); // 0 is an invalid index in OBJ
1255
1256 vi.v_idx = atoi((*token));
1257 (*token) += strcspn((*token), "/ \t\r");
1258 if ((*token)[0] != '/') {
1259 return vi;
1260 }
1261 (*token)++;
1262
1263 // i//k
1264 if ((*token)[0] == '/') {
1265 (*token)++;
1266 vi.vn_idx = atoi((*token));
1267 (*token) += strcspn((*token), "/ \t\r");
1268 return vi;
1269 }
1270
1271 // i/j/k or i/j
1272 vi.vt_idx = atoi((*token));
1273 (*token) += strcspn((*token), "/ \t\r");
1274 if ((*token)[0] != '/') {
1275 return vi;
1276 }
1277
1278 // i/j/k
1279 (*token)++; // skip '/'
1280 vi.vn_idx = atoi((*token));
1281 (*token) += strcspn((*token), "/ \t\r");
1282 return vi;
1283}
1284
1285bool ParseTextureNameAndOption(std::string *texname, texture_option_t *texopt,
1286 const char *linebuf) {

Callers 1

LoadObjWithCallbackFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected