-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add static glTF support #14557
Add static glTF support #14557
Conversation
32c0180
to
9ad41e4
Compare
9ad41e4
to
4ee428d
Compare
I have a branch based on this that also adds animation support now. You can just compile that branch to enjoy an animated gltf spider in Minetest. The only major thing left to be done is to actually run the tests there via catch2, which depends on #14565. |
I've tested @appgurueu's branch and it works fine! I think it deserves a proper PR, assuming this PR is stale. |
This PR is (like my branch, which is based on this) waiting on the Catch2 PR, so that we can get the unit tests to work. However, we don't know yet whether the other devs would like to review this as one big PR which adds supported for animated gltf, or first a slightly smaller PR to add support for static gltf, then a follow-up PR to add animation support. I personally would prefer one big PR because this lets me avoid rebase hell, but ultimately it's up to the reviewer to decide. |
This could already be reviewed in its current state. The work to get the unit tests to work with the build should not block any review efforts except that reviewers may have more trouble verifying that the tests work. We could also push a temporary patch so that the tests can be run separately from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As said, this has my approval as a co-author. There are still a few details in tiniergltf for me to sort out - nothing that negatively impacts loading of correct models, however - and the aforementioned To-Do of fixing the build to include unit tests. Still, this PR is ready to be reviewed.
One more question: since GLB avoids the need to handle base64 decoding and is more efficient, has supporting it been considered? |
Yes, it has been considered, and it should be quite an easy change (relative to animation for example), but I did not prioritize it for this PR because it works well as its own chunk of functionality that could be PRd separately. However, we could reconsider whether we want to initially support glTF or glb. |
eea01c3
to
9027098
Compare
10b4df4
to
572b311
Compare
742b0a3
to
b5c50d6
Compare
This also corrects the function name to be snake_case because it is not a method.
- Alignment issues - Use os::Byteswap::byteswap - Directly write into matrices
Fix -Wsign-compare warning Fix snow man test texture coordinates The current texture coordinates specified in the test did not use sufficient precision. It is unfortunately common for software to round away the last bit when displaying floats. This issue was previously masked by Irrlicht using a float comparison with tolerance for vectors, which was changed in 3452857 to an exact float comparison for unrelated reasons. Manual inspection of the buffer reveals that the values produced by the reader are correct. Clean up unit tests Move everything to sections of one big "gltf" test case Fix triangle with vertex stride test case Improve docs Add copy & move constructor from STL string to Irrlicht string Move test assets to devtest, add corresponding entities Test fixes (get rid of device creation, fix error case tests) Address minor TODOs in tiniergltf Add spider model Work around lack of SKIP Implement clang-tidy suggestions in tiniergltf Update devtest mod count, add mod.conf Use SKIP now that we can Add applicable tests from animated branch Fix sparse accessor handling in tiniergltf Fix invalid bufferview bounds test Rename (& minify) files to follow naming conventions Improve logging Add frog gltf test model rebased minuscule refactor trailing whitespace let primitives share textures 🐸 fix gltf nodes fix model[] element add model[] test more trailing whitespace Update doc/lua_api.md Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com> { remove obsolete file explain use of terms in enums don't unnecessarily zero-initialize begone, base64! Improve documentation
7ca15e0
to
ba54f56
Compare
5a407af
to
4c40642
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just took a small look, no full review.
A bit sad that glb is not yet supported.
Why was it again necessary and/or useful to create a new gltf lib? (Haven't found an answer in the discussions.)
7a9b58b
to
06f603a
Compare
I plan to add glb support in a subsequent PR. It is relatively easy to do. It doesn't have to be in this PR.
Because tinygltf was awful, especially for our purposes. The main reasons are:
|
Co-authored-by: Lars Mueller <appgurulars@gmx.de> Co-authored-by: jordan4ibanez <jordan4ibanez@users.noreply.github.com> Co-authored-by: sfan5 <sfan5@live.de> Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
This adds code for loading static glTF meshes to get a scaffold in place to keep the rest of the glTF feature PRs small and focused. But every time I have to rebase this it takes up hours of my time, so I would like to land this very soon so it can be over with. This has been reviewed by me and @appgurueu.
To do
Ready for Review
How to test
The code is covered pretty thoroughly by Catch2 tests, which can be run with
./minetest --run-unittests --test-module "gltf"
.Additionally the
gltf
devtest mod features some static glTF models that can be viewed in-game as nodes, entities, or in a formspec.