1
0
mirror of https://github.com/kristov/ldraw2stl.git synced 2025-05-15 14:20:11 -07:00

4 Commits

Author SHA1 Message Date
ceade
28b5718628 Hopefully this fixes bugs with triangle winding
Before this commit it appeared that STL viewers could handle the output. However,
rendering the models in OpenGL revealed that the surface normals were all messed up. I
believe most STL viewers just don't care about surface normals, because I suppose they
don't really matter for 3d slicing.

The problem ended up being really a complex issue around the winding order of triangles in
sub-parts, and how this is affected by the "inversion" state. The winding order of
triangles in ldraw is a complex combination of BFC meta commands and transformation
matricies that "mirror" sub-parts. I tried to leave extensive comments in the code rather
than go into it in the commit message.

Also added a json output for rendering as OpenGL buffers. This is to help me debug issues
with the surface normals.

While working on this I also realized that the output of parsing a sub-part can be cached,
as long at the "invert" flag is part of the cache key. This could make a huge difference
in performance, because for example a "stud" gets generated many many times, and in this
version of the code that results in a lot of repeated processing.
2025-03-21 23:40:36 +01:00
ceade
9a0073a0c5 Hopefully better support for Windows users
I was concatenating paths together using the unix slash `/`. This change used
`File::Spec::catpath` instead, however I haven't been able to test it on Windows, and
there may be other path issues. Also note: without debugging on the user doesn't see when
files are not found (eg: due to path issues), so it silently creates an empty STL file.
2025-03-19 23:41:12 +01:00
Chris Eade
e3f34ac87b Add --debug flag for adding debug messages
Trying to track down a normals problem with studs on 3020.dat model.
2020-04-30 14:22:59 +02:00
ceade
b76f67e092 Initial commit 2017-08-19 18:30:12 +02:00