Separate error message into warning and error. Breaks API, so bump to version 1.3.0
This commit is contained in:
@@ -129,6 +129,7 @@ int main(int argc, char **argv) {
|
||||
cb.object_cb = object_cb;
|
||||
|
||||
MyMesh mesh;
|
||||
std::string warn;
|
||||
std::string err;
|
||||
std::string filename = "../../models/cornell_box.obj";
|
||||
if (argc > 1) {
|
||||
@@ -143,7 +144,11 @@ int main(int argc, char **argv) {
|
||||
|
||||
tinyobj::MaterialFileReader mtlReader("../../models/");
|
||||
|
||||
bool ret = tinyobj::LoadObjWithCallback(ifs, cb, &mesh, &mtlReader, &err);
|
||||
bool ret = tinyobj::LoadObjWithCallback(ifs, cb, &mesh, &mtlReader, &warn, &err);
|
||||
|
||||
if (!warn.empty()) {
|
||||
std::cout << "WARN: " << warn << std::endl;
|
||||
}
|
||||
|
||||
if (!err.empty()) {
|
||||
std::cerr << err << std::endl;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
//
|
||||
// Stiches multiple .obj files into one .obj.
|
||||
//
|
||||
|
||||
#define TINYOBJLOADER_IMPLEMENTATION
|
||||
#include "../../tiny_obj_loader.h"
|
||||
#include "obj_writer.h"
|
||||
|
||||
#include "../../tiny_obj_loader.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include <cstdlib>
|
||||
@@ -134,8 +133,9 @@ int main(int argc, char **argv)
|
||||
for (int i = 0; i < num_objfiles; i++) {
|
||||
std::cout << "Loading " << argv[i+1] << " ... " << std::flush;
|
||||
|
||||
std::string warn;
|
||||
std::string err;
|
||||
bool ret = tinyobj::LoadObj(&attributes[i], &shapes[i], &materials[i], &err, argv[i+1]);
|
||||
bool ret = tinyobj::LoadObj(&attributes[i], &shapes[i], &materials[i], &warn, &err, argv[i+1]);
|
||||
if (!err.empty()) {
|
||||
std::cerr << err << std::endl;
|
||||
}
|
||||
|
||||
@@ -308,9 +308,13 @@ static bool LoadObjAndConvert(float bmin[3], float bmax[3],
|
||||
base_dir += "/";
|
||||
#endif
|
||||
|
||||
std::string warn;
|
||||
std::string err;
|
||||
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, filename,
|
||||
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &warn, &err, filename,
|
||||
base_dir.c_str());
|
||||
if (!warn.empty()) {
|
||||
std::cout << "WARN: " << warn << std::endl;
|
||||
}
|
||||
if (!err.empty()) {
|
||||
std::cerr << err << std::endl;
|
||||
}
|
||||
|
||||
@@ -9,8 +9,9 @@ bool Voxelize(const char* filename, float voxelsizex, float voxelsizey, float vo
|
||||
tinyobj::attrib_t attrib;
|
||||
std::vector<tinyobj::shape_t> shapes;
|
||||
std::vector<tinyobj::material_t> materials;
|
||||
std::string warn;
|
||||
std::string err;
|
||||
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, filename);
|
||||
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &warn, &err, filename);
|
||||
|
||||
if (!err.empty()) {
|
||||
printf("err: %s\n", err.c_str());
|
||||
|
||||
Reference in New Issue
Block a user