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

Function TestLoadObj

engine/3rdparty/tinyobjloader/loader_example.cc:280–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280static bool TestLoadObj(const char* filename, const char* basepath = NULL,
281 bool triangulate = true) {
282 std::cout << "Loading " << filename << std::endl;
283
284 tinyobj::attrib_t attrib;
285 std::vector<tinyobj::shape_t> shapes;
286 std::vector<tinyobj::material_t> materials;
287
288 timerutil t;
289 t.start();
290 std::string warn;
291 std::string err;
292 bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &warn, &err, filename,
293 basepath, triangulate);
294 t.end();
295 printf("Parsing time: %lu [msecs]\n", t.msec());
296
297 if (!warn.empty()) {
298 std::cout << "WARN: " << warn << std::endl;
299 }
300
301 if (!err.empty()) {
302 std::cerr << "ERR: " << err << std::endl;
303 }
304
305 if (!ret) {
306 printf("Failed to load/parse .obj.\n");
307 return false;
308 }
309
310 PrintInfo(attrib, shapes, materials);
311
312 return true;
313}
314
315static bool TestStreamLoadObj() {
316 std::cout << "Stream Loading " << std::endl;

Callers 1

mainFunction · 0.70

Calls 7

LoadObjFunction · 0.85
printfFunction · 0.85
PrintInfoFunction · 0.70
startMethod · 0.45
endMethod · 0.45
msecMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected