star-3dstl

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

commit 91ebd2ed889217dcf97280a4d5f66e541c2b7f47
parent f145d816b32485ddf5e6861d1c2e27d8eb0dd66c
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed,  3 Feb 2016 17:26:42 +0100

Revert the STL vertex ordering

The STL and Star-3D front face vertex ordering are not the same. Switch
the vertex order in order to ensure that the front and back faces are
not inverted.

Diffstat:
Msrc/s3dstl.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/s3dstl.c b/src/s3dstl.c @@ -65,9 +65,12 @@ get_indices(const unsigned itri, unsigned ids[3], void* ctx) const unsigned* indices; ASSERT(ctx && ids && itri < desc->triangles_count); indices = desc->indices + itri*3; - ids[0] = indices[0]; + /* Note that in the Star-STL loader, front faces are CCW ordered while in to + * the Star-3D library front faces are CW ordered. Flip the vertex index in + * order to ensure that the 3D and the STL front faces are the same */ + ids[0] = indices[2]; ids[1] = indices[1]; - ids[2] = indices[2]; + ids[2] = indices[0]; } static void