diff --git a/examples/callback_api/main.cc b/examples/callback_api/main.cc index 97b8867..a7a7422 100644 --- a/examples/callback_api/main.cc +++ b/examples/callback_api/main.cc @@ -62,7 +62,7 @@ void index_cb(void *user_data, tinyobj::index_t *indices, int num_indices) { // index). // Also, the first index starts with 1, not 0. // See fixIndex() function in tiny_obj_loader.h for details. - // Also, -2147483648(0x80000000 = -INT_MAX) is set for the index value which + // Also, 0 is set for the index value which // does not exist in .obj MyMesh *mesh = reinterpret_cast(user_data); @@ -71,13 +71,13 @@ void index_cb(void *user_data, tinyobj::index_t *indices, int num_indices) { printf("idx[%ld] = %d, %d, %d\n", mesh->v_indices.size(), idx.vertex_index, idx.normal_index, idx.texcoord_index); - if (idx.vertex_index != 0x80000000) { + if (idx.vertex_index != 0) { mesh->v_indices.push_back(idx.vertex_index); } - if (idx.normal_index != 0x80000000) { + if (idx.normal_index != 0) { mesh->vn_indices.push_back(idx.normal_index); } - if (idx.texcoord_index != 0x80000000) { + if (idx.texcoord_index != 0) { mesh->vt_indices.push_back(idx.texcoord_index); } } @@ -143,7 +143,7 @@ int main(int argc, char **argv) { tinyobj::MaterialFileReader mtlReader("../../models/"); - bool ret = tinyobj::LoadObjWithCallback(&mesh, cb, &err, &ifs, &mtlReader); + bool ret = tinyobj::LoadObjWithCallback(ifs, cb, &mesh, &mtlReader, &err); if (!err.empty()) { std::cerr << err << std::endl; diff --git a/tiny_obj_loader.h b/tiny_obj_loader.h index 799d22a..a1f4645 100644 --- a/tiny_obj_loader.h +++ b/tiny_obj_loader.h @@ -156,8 +156,7 @@ typedef struct callback_t_ { // called per 'f' line. num_indices is the number of face indices(e.g. 3 for // triangle, 4 for quad) - // -2147483648(-INT_MAX) will be passed for undefined index in index_t - // members. + // 0 will be passed for undefined index in index_t members. void (*index_cb)(void *user_data, index_t *indices, int num_indices); // `name` material name, `material_id` = the array index of material_t[]. -1 // if