-
Notifications
You must be signed in to change notification settings - Fork 75
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
Wasm #146
Wasm #146
Conversation
minimal bindings that are doing something useful
wasm build and small three.js test
It's great that there is a three.js demo (?). I think you can add the generated files to |
ok, noted, but how would I integrate it into the build? e g how to run this long ass emcc command during/after make? |
You can modify this and test it in GitHub Action: manifold/.github/workflows/manifold.yml Lines 70 to 101 in aa5badd
|
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.
This is a great demo, thank you! Let's see if we can get this building in the CI. I wonder what the easiest way to test it end-to-end would be?
a -= b; | ||
} | ||
|
||
EMSCRIPTEN_BINDINGS(whatever) { |
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.
Love it; does this name even show up anywhere in the actual WASM blob?
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.
it is not in manifold.js at least; emscripten docs say this:
a label to mark a group of related bindings (for example EMSCRIPTEN_BINDINGS(physics), EMSCRIPTEN_BINDINGS(components), etc.)
return manifold; | ||
} | ||
catch(const std::runtime_error& e) { | ||
puts(e.what()); |
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.
This is interesting, and gets at some of the discussion around removing or changing exception handling: #141. Is there no way for C++ exceptions to automatically throw JS exceptions with WASM?
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.
@elalish it does throw all the way to js but the message you get is just some random number (maybe a pointer to exception object somewhere in wasm memory, Idk) - so, with puts(e.what()) you can at least see what was actually wrong on c++ side
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.
@elalish you can see what I mean by uncommenting new Module.Manifold(....) line in js instead - and passing the original geometry (without calling simplify(...) on it)
return geometry; | ||
} | ||
|
||
// most of three.js geometries arent manifolds, so... |
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.
👍
<script> | ||
var Module = { | ||
onRuntimeInitialized: function() { | ||
// we have manifold module, let's do some three.js |
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.
💯
The CI isn't running because this is a draft PR. Feel free to mark it as ready for review so we can play with the automated builds. Don't worry, I'm not going to merge it in it's current state :) |
@elalish yea I just posted this to get some early feedback, I will do another one maybe this weekend or so |
This is not a real pull request but rather a simple test for #73