From c9b1bccf971713a8066c8078854f38a948675ee8 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Mon, 20 Aug 2018 15:10:37 +0900 Subject: [PATCH] Fix mis-counting of faces when triangulation is enabled. --- experimental/tinyobj_loader_opt.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/experimental/tinyobj_loader_opt.h b/experimental/tinyobj_loader_opt.h index 003803c..86c1b6c 100644 --- a/experimental/tinyobj_loader_opt.h +++ b/experimental/tinyobj_loader_opt.h @@ -1685,7 +1685,8 @@ bool parseObj(attrib_t *attrib, std::vector *shapes, } } if (commands[t][i].type == COMMAND_F) { - face_count++; + // Consider generation of multiple faces per `f` line by triangulation + face_count += commands[t][i].f_num_verts.size(); } } }