MCPcopy Create free account
hub / github.com/blurrypiano/littleVulkanEngine / LoadObj

Function LoadObj

external/tinyobjloader/tiny_obj_loader.h:2293–2327  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2291}
2292
2293bool LoadObj(attrib_t *attrib, std::vector<shape_t> *shapes,
2294 std::vector<material_t> *materials, std::string *warn,
2295 std::string *err, const char *filename, const char *mtl_basedir,
2296 bool triangulate, bool default_vcols_fallback) {
2297 attrib->vertices.clear();
2298 attrib->normals.clear();
2299 attrib->texcoords.clear();
2300 attrib->colors.clear();
2301 shapes->clear();
2302
2303 std::stringstream errss;
2304
2305 std::ifstream ifs(filename);
2306 if (!ifs) {
2307 errss << "Cannot open file [" << filename << "]\n";
2308 if (err) {
2309 (*err) = errss.str();
2310 }
2311 return false;
2312 }
2313
2314 std::string baseDir = mtl_basedir ? mtl_basedir : "";
2315 if (!baseDir.empty()) {
2316#ifndef _WIN32
2317 const char dirsep = '/';
2318#else
2319 const char dirsep = '\\';
2320#endif
2321 if (baseDir[baseDir.length() - 1] != dirsep) baseDir += dirsep;
2322 }
2323 MaterialFileReader matFileReader(baseDir);
2324
2325 return LoadObj(attrib, shapes, materials, warn, err, &ifs, &matFileReader,
2326 triangulate, default_vcols_fallback);
2327}
2328
2329bool LoadObj(attrib_t *attrib, std::vector<shape_t> *shapes,
2330 std::vector<material_t> *materials, std::string *warn,

Callers 3

loadModelMethod · 0.85
ParseFromFileMethod · 0.85
ParseFromStringMethod · 0.85

Calls 12

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

Tested by

no test coverage detected