migrate fdm, sla, laser to new core slicer
This commit is contained in:
parent
2430ab2a07
commit
a438275e9a
11 changed files with 357 additions and 1081 deletions
|
|
@ -17,9 +17,29 @@
|
|||
registerDecoder: registerDecoder,
|
||||
allocFloat32Array: allocFloat32Array,
|
||||
encodePointArray,
|
||||
decodePointArray
|
||||
decodePointArray,
|
||||
toCodable
|
||||
};
|
||||
|
||||
function toCodable(object) {
|
||||
let o = {};
|
||||
for (let [key, val] of Object.entries(object)) {
|
||||
switch (typeof val) {
|
||||
case 'function':
|
||||
break;
|
||||
case 'object':
|
||||
if (Array.isArray(val)) {
|
||||
val = val.map(v => toCodable(v));
|
||||
} else {
|
||||
val = toCodable(val);
|
||||
}
|
||||
default:
|
||||
o[key] = val;
|
||||
}
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
function allocFloat32Array(arg) {
|
||||
if (arg.byteLength) {
|
||||
// already a float array
|
||||
|
|
|
|||
Loading…
Reference in a new issue