Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STL Loader #119

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open

Conversation

Floppy
Copy link
Contributor

@Floppy Floppy commented Feb 19, 2024

This PR adds a loader for STLs, currently ASCII encoding only. Binary support will be following shortly, either in this PR or a followup.

STL is a pretty simple format, so there's not a lot in the way of tests, but I've tried to cover what edge cases I can think of. STLs are always triangles, so there's no quad support like the OBJ loader has.

Part of #116

@danini-the-panini danini-the-panini self-assigned this Feb 19, 2024
@danini-the-panini danini-the-panini added this to the 0.5.0 milestone Feb 19, 2024
@Floppy
Copy link
Contributor Author

Floppy commented Feb 19, 2024

Binary support added in now as well.

@Floppy Floppy marked this pull request as draft February 19, 2024 15:19
@Floppy
Copy link
Contributor Author

Floppy commented Feb 19, 2024

Converted to draft for a little while, I've got an error in the example code or model. Just working that out now.

@Floppy
Copy link
Contributor Author

Floppy commented Feb 19, 2024

Looks like it's reading files with EOL conversion somewhere, rather than just as straight binary. Just trying to find out where that's happening.

@Floppy Floppy marked this pull request as ready for review February 19, 2024 17:59
@Floppy
Copy link
Contributor Author

Floppy commented Feb 19, 2024

OK, all good now. Tests pass including an EOL conversion test, and the example runs too.

Screenshot 2024-02-19 at 18 00 33

If you're happy with it, merge away :)

@Floppy
Copy link
Contributor Author

Floppy commented Feb 28, 2024

Woohoo, green!

@Floppy
Copy link
Contributor Author

Floppy commented Apr 10, 2024

I've optimised the loader so it combines vertices on the fly during load - this should be more CPU and memory efficient when loading (which I'm doing a lot).

Incidentally, this loader code is now active in the latest release of Manyfold (https://manyfold.app), where I'm using it for checking for mesh holes. It's using my fork, in advance of this making it into an official Mittsu release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants