Skip to content

Commit

Permalink
fixed missing default params in JS bindings (elalish#843)
Browse files Browse the repository at this point in the history
  • Loading branch information
elalish committed Jun 13, 2024
1 parent b5c1751 commit edd149e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bindings/wasm/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@ EMSCRIPTEN_BINDINGS(whatever) {
.function("_Split", &man_js::Split)
.function("_SplitByPlane", &man_js::SplitByPlane)
.function("_TrimByPlane", &Manifold::TrimByPlane)
.function("slice", &Manifold::Slice)
.function("_Slice", &Manifold::Slice)
.function("project", &Manifold::Project)
.function("hull", select_overload<Manifold() const>(&Manifold::Hull))
.function("_GetMeshJS", &js::GetMeshJS)
.function("refine", &Manifold::Refine)
.function("refineToLength", &Manifold::RefineToLength)
.function("smoothByNormals", &Manifold::SmoothByNormals)
.function("smoothOut", &Manifold::SmoothOut)
.function("_SmoothOut", &Manifold::SmoothOut)
.function("_Warp", &man_js::Warp)
.function("_SetProperties", &man_js::SetProperties)
.function("transform", &man_js::Transform)
Expand All @@ -168,7 +168,7 @@ EMSCRIPTEN_BINDINGS(whatever) {
.function("getProperties", &Manifold::GetProperties)
.function("minGap", &Manifold::MinGap)
.function("calculateCurvature", &Manifold::CalculateCurvature)
.function("calculateNormals", &Manifold::CalculateNormals)
.function("_CalculateNormals", &Manifold::CalculateNormals)
.function("originalID", &Manifold::OriginalID)
.function("asOriginal", &Manifold::AsOriginal);

Expand Down
14 changes: 14 additions & 0 deletions bindings/wasm/bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ Module.setup = function() {

// Manifold methods

Module.Manifold.prototype.smoothOut = function(
minSharpAngle = 60, minSmoothness = 0) {
return this._SmoothOut(minSharpAngle, minSmoothness);
};

Module.Manifold.prototype.warp = function(func) {
const wasmFuncPtr = addFunction(function(vec3Ptr) {
const x = getValue(vec3Ptr, 'float');
Expand All @@ -217,6 +222,11 @@ Module.setup = function() {
return out;
};

Module.Manifold.prototype.calculateNormals = function(
normalIdx, minSharpAngle = 60) {
return this._CalculateNormals(normalIdx, minSharpAngle);
};

Module.Manifold.prototype.setProperties = function(numProp, func) {
const oldNumProp = this.numProp();
const wasmFuncPtr = addFunction(function(newPtr, vec3Ptr, oldPtr) {
Expand Down Expand Up @@ -272,6 +282,10 @@ Module.setup = function() {
return this._TrimByPlane(vararg2vec3([normal]), offset);
};

Module.Manifold.prototype.slice = function(height = 0.) {
return this._Slice(height);
};

Module.Manifold.prototype.split = function(manifold) {
const vec = this._Split(manifold);
const result = fromVec(vec);
Expand Down

0 comments on commit edd149e

Please sign in to comment.