star-stl

Load STereo Lithography (StL) file format
git clone git://git.meso-star.fr/star-stl.git
Log | Files | Refs | README | LICENSE

commit 1f5ae4bc004bc22b6c021536e6f28e44f97bbb63
parent d9d1b7e390d7997d53d652631ce505a3e96c3fad
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 23 Apr 2025 16:11:11 +0200

Fix StL binary writing

The number of triangles could be missing

Diffstat:
Msrc/sstl_writer.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/sstl_writer.c b/src/sstl_writer.c @@ -192,6 +192,7 @@ write_header_binary const struct sstl_writer_create_args* args) { uint8_t bytes[80] = {0}; + uint32_t ntris = 0; res_T res = RES_OK; ASSERT(writer && args); @@ -205,12 +206,13 @@ write_header_binary if(args->triangles_count < 0) { ASSERT(file_is_seekable(writer->fp)); writer->ntris_offset = ftell(writer->fp); - } else { - res = write_ntriangles(writer, (uint32_t)args->triangles_count); - if(res != RES_OK) goto error; + ntris = (uint32_t)args->triangles_count; } + res = write_ntriangles(writer, ntris); + if(res != RES_OK) goto error; + exit: return res; error: