From 9b42315ef051745b94eeb31d4680f821779b50a2 Mon Sep 17 00:00:00 2001 From: sanine Date: Tue, 27 Sep 2022 20:36:05 -0500 Subject: fix off-by-1 bug in face indexing --- src/import/import.c | 11 +++++++++-- src/import/import_mesh.test.c | 17 +++++++++-------- src/main.c | 25 ++++++++++++++++++++++++- 3 files changed, 42 insertions(+), 11 deletions(-) diff --git a/src/import/import.c b/src/import/import.c index a093068..becb1fe 100644 --- a/src/import/import.c +++ b/src/import/import.c @@ -15,7 +15,10 @@ int import_file(lua_State *L) char *filename; hs_parse_args(L, hs_str(filename)); - const struct aiScene *scene = aiImportFile(filename, aiProcess_Triangulate | aiProcess_FlipUVs); + const struct aiScene *scene = aiImportFile( + filename, + aiProcess_Triangulate | aiProcess_FlipUVs + ); if (scene == NULL) hs_throw_error(L, "failed to load file '%s'", filename); @@ -53,7 +56,11 @@ static void push_face(lua_State *L, struct aiFace face) for (int i=0; i