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

Function LoadObj

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

Source from the content-addressed store, hash-verified

2394}
2395
2396bool LoadObj(attrib_t *attrib, std::vector<shape_t> *shapes,
2397 std::vector<material_t> *materials, std::string *warn,
2398 std::string *err, const char *filename, const char *mtl_basedir,
2399 bool triangulate, bool default_vcols_fallback) {
2400 attrib->vertices.clear();
2401 attrib->normals.clear();
2402 attrib->texcoords.clear();
2403 attrib->colors.clear();
2404 shapes->clear();
2405
2406 std::stringstream errss;
2407
2408 std::ifstream ifs(filename);
2409 if (!ifs) {
2410 errss << "Cannot open file [" << filename << "]\n";
2411 if (err) {
2412 (*err) = errss.str();
2413 }
2414 return false;
2415 }
2416
2417 std::string baseDir = mtl_basedir ? mtl_basedir : "";
2418 if (!baseDir.empty()) {
2419#ifndef _WIN32
2420 const char dirsep = '/';
2421#else
2422 const char dirsep = '\\';
2423#endif
2424 if (baseDir[baseDir.length() - 1] != dirsep) baseDir += dirsep;
2425 }
2426 MaterialFileReader matFileReader(baseDir);
2427
2428 return LoadObj(attrib, shapes, materials, warn, err, &ifs, &matFileReader,
2429 triangulate, default_vcols_fallback);
2430}
2431
2432bool LoadObj(attrib_t *attrib, std::vector<shape_t> *shapes,
2433 std::vector<material_t> *materials, std::string *warn,

Callers 15

TestLoadObjFunction · 0.85
TestStreamLoadObjFunction · 0.85
ParseFromFileMethod · 0.85
ParseFromStringMethod · 0.85
TestLoadObjFunction · 0.85
TestStreamLoadObjFunction · 0.85
test_pbrFunction · 0.85

Calls 15

parseVertexWithColorFunction · 0.85
parseReal3Function · 0.85
parseReal2Function · 0.85
parseTripleFunction · 0.85
exportGroupsToShapeFunction · 0.85
SplitStringFunction · 0.85
shape_tClass · 0.85
parseTagTripleFunction · 0.85
parseRealFunction · 0.85
parseIntFunction · 0.70
parseStringFunction · 0.70
clearMethod · 0.45

Tested by 15

TestLoadObjFunction · 0.68
TestStreamLoadObjFunction · 0.68
TestLoadObjFunction · 0.68
TestStreamLoadObjFunction · 0.68
test_pbrFunction · 0.68