add new assembly preference for enabling wasm testing

This commit is contained in:
Stewart Allen 2021-07-07 21:09:34 -04:00
commit 841df7b5a9
16 changed files with 178 additions and 100 deletions

View file

@ -287,6 +287,12 @@ KIRI.work = {
output(reply);
}
});
},
wasm: function(enable) {
send("wasm", {enable}, reply => {
// console.log({wasm_worker_said: reply});
});
}
};

View file

@ -692,6 +692,7 @@
animesh: "200",
healMesh: false,
threaded: false,
assembly: false,
ortho: false,
devel: false
},

View file

@ -142,6 +142,9 @@
let control = settings().controller;
let isDark = control.dark;
let doAlert = UI.ortho.checked !== control.ortho;
if (control.assembly != UI.assembly.checked) {
KIRI.client.wasm(UI.assembly.checked);
}
control.decals = UI.decals.checked;
control.danger = UI.danger.checked;
control.showOrigin = UI.showOrigin.checked;
@ -158,6 +161,7 @@
control.decimate = UI.decimate.checked;
control.healMesh = UI.healMesh.checked;
control.threaded = UI.threaded.checked;
control.assembly = UI.assembly.checked;
control.ortho = UI.ortho.checked;
control.devel = UI.devel.checked;
SPACE.view.setZoom(control.reverseZoom, control.zoomSpeed);
@ -1647,6 +1651,7 @@
decimate: UC.newBoolean(LANG.pt_deci_s, booleanSave, {title: LANG.pt_deci_l}),
healMesh: UC.newBoolean(LANG.pt_heal_s, booleanSave, {title: LANG.pt_heal_l}),
threaded: UC.newBoolean(LANG.pt_thrd_s, booleanSave, {title: LANG.pt_thrd_l, modes:FDM_SLA}),
assembly: UC.newBoolean(LANG.pt_assy_s, booleanSave, {title: LANG.pt_assy_l, modes:FDM_SLA}),
prefadd: UC.checkpoint($('prefs-add')),
@ -2439,6 +2444,7 @@
UI.decimate.checked = control.decimate;
UI.healMesh.checked = control.healMesh;
UI.threaded.checked = control.threaded;
UI.assembly.checked = control.assembly;
UI.ortho.checked = control.ortho;
UI.devel.checked = control.devel;
lineTypeSave();
@ -2471,6 +2477,9 @@
// update everything dependent on the platform size
platform.update_size();
// load wasm if indicated
KIRI.client.wasm(control.assembly);
};
UI.sync();

View file

@ -102,6 +102,14 @@ const funcs = {
reply({ seq, output: CODEC.encode(output) });
},
wasm: data => {
if (data.enable) {
geo.enable();
} else {
geo.disable();
}
},
bad: (data, seq) => {
reply({ seq, error: "invalid command" });
}

View file

@ -847,7 +847,10 @@
// merge collinear lines
for (let point of points) {
if (point.group.length != 2) continue;
// only merge when point connects to exactly one other point
if (point.group.length != 2) {
continue;
}
let l1 = point.group[0],
l2 = point.group[1];
if (l1.isCollinear(l2)) {

View file

@ -173,6 +173,15 @@ KIRI.minions = {
};
minion.postMessage(qrec.work, qrec.direct);
}
},
wasm: function(enable) {
for (let minion of minions) {
minion.postMessage({
cmd: "wasm",
enable
});
}
}
};
@ -727,6 +736,16 @@ KIRI.worker = {
}).then(output => {
send.done(output);
});
},
wasm: function(data, send) {
if (data.enable) {
geo.enable();
} else {
geo.disable();
}
minwork.wasm(data.enable);
send.done({ wasm: data });
}
};