progressive transfer of prepare data. zerocodec helps in this scenario
This commit is contained in:
parent
4da43685f4
commit
45b8ac8c2d
7 changed files with 33 additions and 22 deletions
|
|
@ -163,7 +163,7 @@ KIRI.work = {
|
|||
prepare : function(settings, update, done) {
|
||||
send("prepare", { settings }, function(reply) {
|
||||
if (reply.progress) {
|
||||
update(reply.progress, reply.message);
|
||||
update(reply.progress, reply.message, reply.layer);
|
||||
}
|
||||
if (reply.done) {
|
||||
done(reply.output, reply.maxSpeed);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
const BASE = self.base, KIRI = self.kiri, handlers = {};
|
||||
const freeMem = true;
|
||||
const zeroOut = false;
|
||||
const zeroOut = true;
|
||||
|
||||
const codec = KIRI.codec = {
|
||||
encode: encode,
|
||||
|
|
|
|||
|
|
@ -855,9 +855,13 @@
|
|||
segNumber = 0,
|
||||
startTime,
|
||||
lastMsg,
|
||||
now = Date.now();
|
||||
now = Date.now(),
|
||||
output = [];
|
||||
|
||||
KIRI.client.prepare(settings, function(progress, message) {
|
||||
KIRI.client.prepare(settings, function(progress, message, layer) {
|
||||
if (layer) {
|
||||
output.push(KIRI.codec.decode(layer));
|
||||
}
|
||||
if (message !== lastMsg) {
|
||||
let mark = Date.now();
|
||||
if (lastMsg) {
|
||||
|
|
@ -867,7 +871,7 @@
|
|||
startTime = mark;
|
||||
}
|
||||
API.show.progress(progress, message);
|
||||
}, function (output, maxSpeed) {
|
||||
}, function (oldout, maxSpeed) {
|
||||
if (lastMsg) {
|
||||
segtimes[`${segNumber++}_${lastMsg}`] = Date.now() - startTime;
|
||||
}
|
||||
|
|
@ -875,8 +879,8 @@
|
|||
API.show.progress(0);
|
||||
if (!isCam) setOpacity(0);
|
||||
|
||||
output = KIRI.codec.decode(output);
|
||||
if (feature.preview && output) {
|
||||
// output = KIRI.codec.decode(output);
|
||||
if (feature.preview && output.length) {
|
||||
startTime = Date.now();
|
||||
STACKS.clear();
|
||||
const stack = STACKS.create('print', SPACE.platform.world)
|
||||
|
|
|
|||
|
|
@ -120,8 +120,13 @@ KIRI.worker = {
|
|||
return console.log({invalid_print_driver: mode, driver});
|
||||
}
|
||||
|
||||
const layers = driver.prepare(widgets, settings, (progress, message) => {
|
||||
send.data({ progress, message });
|
||||
const layers = driver.prepare(widgets, settings, (progress, message, layer) => {
|
||||
const state = { zeros: [] };
|
||||
const emit = { progress, message };
|
||||
if (layer) {
|
||||
emit.layer = KIRI.codec.encode(layer, state)
|
||||
}
|
||||
send.data(emit);
|
||||
});
|
||||
|
||||
const print = current.print || {};
|
||||
|
|
@ -132,7 +137,7 @@ KIRI.worker = {
|
|||
|
||||
send.done({
|
||||
done: true,
|
||||
output: KIRI.codec.encode(layers, state),
|
||||
// output: KIRI.codec.encode(layers, state),
|
||||
maxSpeed
|
||||
}, state.zeros);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue