Skip to content

js: Add MeshoptTangents module for tangent generation#1051

Merged
zeux merged 6 commits into
masterfrom
js-tangents
May 3, 2026
Merged

js: Add MeshoptTangents module for tangent generation#1051
zeux merged 6 commits into
masterfrom
js-tangents

Conversation

@zeux
Copy link
Copy Markdown
Owner

@zeux zeux commented May 2, 2026

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.

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
SimplifierFlags for consistency, and adds a new TangentsFlags type
for the tangent options. For now, a deprecated alias Flags still 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.

zeux added 3 commits May 2, 2026 09:13
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.
zeux added 2 commits May 2, 2026 09:30
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.
@zeux zeux merged commit f116303 into master May 3, 2026
13 checks passed
@zeux zeux deleted the js-tangents branch May 3, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant