-
Notifications
You must be signed in to change notification settings - Fork 137
Add gl-matrix to editor #332
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
Conversation
bindings/wasm/manifold.d.ts
Outdated
type Matrix3x4 = [Vec3, Vec3, Vec3, Vec3]; | ||
type Vec2 = number[2]; 8000 td> | ||
type Vec3 = number[3]; | ||
type Mat4 = number[16]; |
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.
Oops, pretty sure this is wrong.
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.
Maybe we should do this: https://stackoverflow.com/a/59906630
It is interesting that typescript did not put this in their type definitions even though this should be a rather common usecase...
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.
And maybe we should explicitly say that the matrix is column-major? Otherwise users may be confused about this.
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.
I went back mostly to what we had before with tuple types. They seem to work the best and give pretty good type safety. The only drawback is I had to use vec2.fromValues(1, 1)
instead of [1, 2]
whenever I wanted to save the variable, but that doesn't seem too bad - and that's just because I can't cast it in our JS tests like users can in the editor.
Codecov ReportBase: 91.50% // Head: 91.50% // No change to project coverage 👍
Additional details and impacted files@@ Coverage Diff @@
## master #332 +/- ##
=======================================
Coverage 91.50% 91.50%
=======================================
Files 32 32
Lines 3730 3730
=======================================
Hits 3413 3413
Misses 317 317 Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
LGTM apart from the array issue.
* switch JS to Mat4 * added glMatrix to editor * added glMatrix types * type cleanup * fixed type names * updated examples * fixed types and examples
Fixes #238
Fixes #324
This does simplify some of the examples nicely, and it feels pretty easy to use.
Also, I switched manifold.js from using 3x4 to 4x4 matrices, since that seems to be what all the other libraries use (we're still only using the affine portion).