@@ -18,7 +18,7 @@ We will use the [tinyobjloader](https://github.com/syoyo/tinyobjloader) library
1818to load vertices and faces from an OBJ file. It's fast and it's easy to
1919integrate because it's a single file library like stb_image. Go to the
2020repository linked above and download the ` tiny_obj_loader.h ` file to a folder in
21- your library directory.
21+ your library directory. Make sure to use the version of the file from the ` master ` branch because the latest official release is outdated.
2222
2323** Visual Studio**
2424
@@ -139,10 +139,10 @@ void loadModel() {
139139 tinyobj::attrib_t attrib;
140140 std::vector<tinyobj::shape_t> shapes;
141141 std::vector<tinyobj::material_t> materials;
142- std::string err;
142+ std::string warn, err;
143143
144- if (!tinyobj::LoadObj(&attrib, &shapes, &materials, &err, MODEL_PATH.c_str())) {
145- throw std::runtime_error(err);
144+ if (!tinyobj::LoadObj(&attrib, &shapes, &materials, &warn, & err, MODEL_PATH.c_str())) {
145+ throw std::runtime_error(warn + err);
146146 }
147147}
148148```
@@ -159,7 +159,7 @@ faces. Each face consists of an array of vertices, and each vertex contains the
159159indices of the position, normal and texture coordinate attributes. OBJ models
160160can also define a material and texture per face, but we will be ignoring those.
161161
162- The ` err ` string contains errors and warnings that occurred while loading the
162+ The ` err ` string contains errors and the ` warn ` string contains warnings that occurred while loading the
163163file, like a missing material definition. Loading only really failed if the
164164` LoadObj ` function returns ` false ` . As mentioned above, faces in OBJ files can
165165actually contain an arbitrary number of vertices, whereas our application can
0 commit comments