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, {
|
SLICER.sliceWidget(widget, {
|
||||||
height: process.slaSlice || 0.05
|
height: process.slaSlice || 0.05
|
||||||
}, function(slices) {
|
}, 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) {
|
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;
|
slicing[widget.id] = callback;
|
||||||
send("slice", {
|
send("slice", {
|
||||||
id: widget.id,
|
id: widget.id,
|
||||||
settings: settings,
|
settings: settings,
|
||||||
vertices: vertices,
|
vertices: vertices,
|
||||||
position: widget.mesh.position
|
position: widget.mesh.position,
|
||||||
|
snapshot: snapshot
|
||||||
}, function(reply) {
|
}, function(reply) {
|
||||||
if (reply.done || reply.error) delete slicing[widget.id];
|
if (reply.done || reply.error) delete slicing[widget.id];
|
||||||
callback(reply);
|
callback(reply);
|
||||||
|
|
@ -98,7 +106,7 @@ KIRI.work = {
|
||||||
printSetup : function(settings, callback) {
|
printSetup : function(settings, callback) {
|
||||||
send("printSetup", {settings:settings}, function(reply) {
|
send("printSetup", {settings:settings}, function(reply) {
|
||||||
callback(reply);
|
callback(reply);
|
||||||
});
|
}, undefined);
|
||||||
},
|
},
|
||||||
|
|
||||||
printExport : function(settings, online, ondone) {
|
printExport : function(settings, online, ondone) {
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ let ver = exports.VERSION,
|
||||||
kiri = self.kiri,
|
kiri = self.kiri,
|
||||||
Widget = kiri.Widget,
|
Widget = kiri.Widget,
|
||||||
currentPrint,
|
currentPrint,
|
||||||
|
currentSnap,
|
||||||
cache = {};
|
cache = {};
|
||||||
|
|
||||||
console.log(`kiri | init work | ${ver}`);
|
console.log(`kiri | init work | ${ver}`);
|
||||||
|
|
@ -28,6 +29,11 @@ let dispatch = {
|
||||||
send.done(vertices);
|
send.done(vertices);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
snap: function(data, send) {
|
||||||
|
currentSnap = data;
|
||||||
|
send.done();
|
||||||
|
},
|
||||||
|
|
||||||
slice: function(data, send) {
|
slice: function(data, send) {
|
||||||
let settings = data.settings,
|
let settings = data.settings,
|
||||||
vertices = new Float32Array(data.vertices),
|
vertices = new Float32Array(data.vertices),
|
||||||
|
|
|
||||||
|
|
@ -715,6 +715,7 @@ self.kiri.copyright = exports.COPYRIGHT;
|
||||||
if (viewMode == VIEWS.ARRANGE) {
|
if (viewMode == VIEWS.ARRANGE) {
|
||||||
let snap = SPACE.screenshot();
|
let snap = SPACE.screenshot();
|
||||||
API.view.snapshot = snap.substring(snap.indexOf(",")+1);
|
API.view.snapshot = snap.substring(snap.indexOf(",")+1);
|
||||||
|
KIRI.work.snap(API.view.snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
clearPrint();
|
clearPrint();
|
||||||
|
|
|
||||||
|
|
@ -875,6 +875,7 @@ let ver = require('../js/license.js'),
|
||||||
],
|
],
|
||||||
work : [
|
work : [
|
||||||
"ext-three",
|
"ext-three",
|
||||||
|
"ext-pngjs",
|
||||||
"license",
|
"license",
|
||||||
"ext-clip2",
|
"ext-clip2",
|
||||||
"add-array",
|
"add-array",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue