star-3daw

Create star-3d geometries from OBJ files
git clone git://git.meso-star.fr/star-3daw.git
Log | Files | Refs | README | LICENSE

commit 6631bcbdeefc3c52e828c21e63017b518f6aaf17
parent 6d0ce13bcc2499028944df75e486d8513d1289a0
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Tue,  4 Aug 2015 14:49:17 +0200

Early discard of empty "obj" file

If a loaded file does not contain any data, the loading process is
stopped after the loading of the obj data. Consequently no empty s3d
shape is created.

Diffstat:
Msrc/s3daw.c | 8++++++++
1 file changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/s3daw.c b/src/s3daw.c @@ -320,6 +320,14 @@ shapes_create(struct s3daw* s3daw, const char* filename) AW(obj_desc_get(s3daw->loader_obj, &obj_desc)); shapes_clear(&s3daw->shapes); + if(obj_desc.faces_count == 0) { + if(s3daw->verbose) { + logger_print(s3daw->logger, LOG_WARNING, + "Empty file content `%s'. It is discarded.\n", filename); + } + goto exit; + } + if(!obj_desc.usemtls_count) { /* No material grouping => triangle soup */ str_clear(&s3daw->mtl.name); s3daw->mtl.face_id = 0;