fast_obj
fast_obj copied to clipboard
fast_obj_test (test.cpp) fails verification on trivial object.
I happened to notice that fast_obj disagrees with tiny_obj_loader (TOL) on the following object:
o ObjectNameHere
v 1.0 1.0 -1.0
v 1.0 0.0 -1.0
v 1.0 1.0 0.0
f 1 2 3
I created this test case after I originally tried the test against pirate.obj and it failed, and then again with a default cube exported from Blender 4.2
$ ./build/fast_obj_test test/dummy.obj
Reading with fast_obj
Took 0.00 secs
Reading with tiny_obj_loader
Took 0.00 secs
Comparing...
CHECK FAILED : shp.name == grp_name
Done
By adding some debug code I saw that grp.name is not set when iterating over groups in compare_mesh(), whereas shp.name is set to "ObjectNameHere".
I could make it pass by applying the following diff, but it's probably not the correct solution.
diff --git a/fast_obj.h b/fast_obj.h
index 7967756..f2ececd 100644
--- a/fast_obj.h
+++ b/fast_obj.h
@@ -829,6 +829,7 @@ const char* parse_object(fastObjData* data, const char* ptr)
flush_object(data);
data->object.name = string_copy(s, e);
+ data->group.name = string_copy(s, e);
return ptr;
}
For all I know this is a bug in TOL. I tried updating it to the latest version (a4e519b) to see if that changed anything, but it did not.