add snap to worker and worker image processing
This commit is contained in:
parent
c26c0e398e
commit
2210b16530
6 changed files with 16457 additions and 3 deletions
16433
js/ext-pngjs.js
Normal file
16433
js/ext-pngjs.js
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -51,6 +51,11 @@ let gs_kiri_sla = exports;
|
|||
});
|
||||
}
|
||||
|
||||
let b64 = atob(currentSnap);
|
||||
let bin = Uint8Array.from(b64, c => c.charCodeAt(0));
|
||||
let img = new png.PNG().parse(bin);
|
||||
console.log({img})
|
||||
|
||||
SLICER.sliceWidget(widget, {
|
||||
height: process.slaSlice || 0.05
|
||||
}, function(slices) {
|
||||
|
|
|
|||
|
|
@ -81,14 +81,22 @@ KIRI.work = {
|
|||
});
|
||||
},
|
||||
|
||||
snap : function(data) {
|
||||
send("snap", data, function(reply) {
|
||||
// console.log({snap:reply})
|
||||
});
|
||||
},
|
||||
|
||||
slice : function(settings, widget, callback) {
|
||||
let vertices = widget.getGeoVertices().buffer.slice(0);
|
||||
let vertices = widget.getGeoVertices().buffer.slice(0),
|
||||
snapshot = KIRI.api.view.snapshot;
|
||||
slicing[widget.id] = callback;
|
||||
send("slice", {
|
||||
id: widget.id,
|
||||
settings: settings,
|
||||
vertices: vertices,
|
||||
position: widget.mesh.position
|
||||
position: widget.mesh.position,
|
||||
snapshot: snapshot
|
||||
}, function(reply) {
|
||||
if (reply.done || reply.error) delete slicing[widget.id];
|
||||
callback(reply);
|
||||
|
|
@ -98,7 +106,7 @@ KIRI.work = {
|
|||
printSetup : function(settings, callback) {
|
||||
send("printSetup", {settings:settings}, function(reply) {
|
||||
callback(reply);
|
||||
});
|
||||
}, undefined);
|
||||
},
|
||||
|
||||
printExport : function(settings, online, ondone) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ let ver = exports.VERSION,
|
|||
kiri = self.kiri,
|
||||
Widget = kiri.Widget,
|
||||
currentPrint,
|
||||
currentSnap,
|
||||
cache = {};
|
||||
|
||||
console.log(`kiri | init work | ${ver}`);
|
||||
|
|
@ -28,6 +29,11 @@ let dispatch = {
|
|||
send.done(vertices);
|
||||
},
|
||||
|
||||
snap: function(data, send) {
|
||||
currentSnap = data;
|
||||
send.done();
|
||||
},
|
||||
|
||||
slice: function(data, send) {
|
||||
let settings = data.settings,
|
||||
vertices = new Float32Array(data.vertices),
|
||||
|
|
|
|||
|
|
@ -715,6 +715,7 @@ self.kiri.copyright = exports.COPYRIGHT;
|
|||
if (viewMode == VIEWS.ARRANGE) {
|
||||
let snap = SPACE.screenshot();
|
||||
API.view.snapshot = snap.substring(snap.indexOf(",")+1);
|
||||
KIRI.work.snap(API.view.snapshot);
|
||||
}
|
||||
|
||||
clearPrint();
|
||||
|
|
|
|||
|
|
@ -875,6 +875,7 @@ let ver = require('../js/license.js'),
|
|||
],
|
||||
work : [
|
||||
"ext-three",
|
||||
"ext-pngjs",
|
||||
"license",
|
||||
"ext-clip2",
|
||||
"add-array",
|
||||
|
|
|
|||
Loading…
Reference in a new issue