js: Add MeshoptTangents module for tangent generation#1051
Merged
Conversation
The module is structured exactly like the other modules and exposes a single function, generateTangents, along with a ready promise. The function has the same signature as the native function, except that the options are represented using a string array, similarly to simplifier.
The Flags type overlaps between simplifier and tangents module now; so we need to rename it. For consistency, the simplifier type has been renamed too - this might require minor adjustments for users of the TypeScript module.
This is a copy of the degenerate tangent test from C++; since it also tests tangent averaging implicitly it should suffice as a way to exercise the behavior, even though it's not fully comprehensive.
Add documentation for the new MeshoptTangents module. Also update simplify* types with the new type name.
Without this, errors or even typos in the .d.ts files aren't caught.
This will keep the changes to type signature compatible - we'll still end up with a root-level type Flags from meshoptimizer module. But it is now deprecated and we can maybe remove it in a future release.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The module is structured exactly like the other modules and exposes a
single function,
generateTangents, along with a ready promise. Thefunction has the same signature as the native function, except that the
options are represented using a string array, similarly to simplifier.
Since it uses a Flags type, this type now conflicts with the simplifier when
using the main module. So this change renames the simplifier type to
SimplifierFlagsfor consistency, and adds a newTangentsFlagstypefor the tangent options. For now, a deprecated alias
Flagsstill exists;it can be removed in a future release, which may result in minor
breakage for TypeScript users but it should be trivial to adjust and it
only affects typechecking.