play with incremental rendering

This commit is contained in:
Stewart Allen 2021-03-04 14:47:24 -05:00
commit 962ac81865
2 changed files with 22 additions and 0 deletions

View file

@ -44,6 +44,16 @@
this.show(); this.show();
for (let i=0, s=this.slices, len=s.length; i<len; i++) { for (let i=0, s=this.slices, len=s.length; i<len; i++) {
s[i].visible = i >= newMin && i <= newMax; s[i].visible = i >= newMin && i <= newMax;
if (s[i].visible) this.lastVis = s[i];
}
}
setLastFraction(frac = 1) {
for (let mesh of this.lastVis.children) {
let geo = mesh.geometry;
let pos = geo.attributes.position;
let len = frac === 1 ? Infinity : Math.round(pos.count * frac);
geo.setDrawRange(0, len);
} }
} }

View file

@ -52,6 +52,10 @@
return stacks[name]; return stacks[name];
} }
function getStacks() {
return Object.entries(stacks);
}
function getLabels() { function getLabels() {
return Object.keys(DYN); return Object.keys(DYN);
} }
@ -139,16 +143,24 @@
max = newMax; max = newMax;
} }
function setFraction(frac) {
Object.values(stacks).forEach(stack => {
stack.obj.setLastFraction(frac);
});
}
KIRI.stacks = { KIRI.stacks = {
clear, clear,
create, create,
rotate, rotate,
remove, remove,
getStack, getStack,
getStacks,
getRange, getRange,
setRange, setRange,
getLabels, getLabels,
setVisible, setVisible,
setFraction,
setFreeMem setFreeMem
}; };