smoother animation

This commit is contained in:
Stewart Allen 2020-04-15 09:51:21 -04:00
commit b9f2df0c4b
7 changed files with 44 additions and 39 deletions

View file

@ -486,7 +486,7 @@ let gs_kiri_conf = exports;
// current device name by mode
filter:{
FDM: "Any.Generic.Marlin",
SLA: "Any.Generic.SLA",
SLA: "Anycubic.Photon",
CAM: "Any.Generic.Grbl",
LASER: "Any.Generic.Laser"
},

View file

@ -67,7 +67,7 @@ let gs_kiri_sla = exports;
// slice.tops.forEach(top => { top.solids = [] });
}, "slice");
forSlices(slices, 0.2, 0.4, (slice) => {
slice.doDiff(0.00001, 0.005);
slice.doDiff(0.00001, 0.005, true);
}, "delta");
forSlices(slices, 0.4, 0.5, (slice) => {
slice.projectFlats(process.slaSolids || 5);

View file

@ -773,11 +773,19 @@ let gs_kiri_slice = exports;
* Used to calculate bridges, flats and then solid projections.
* 'expand' is used for top offsets in SLA mode
*/
PRO.doDiff = function(minArea, expand) {
if (!this.down) return;
PRO.doDiff = function(minArea, expand, fakedown) {
let down = this.down;
if (!down) {
if (fakedown) {
down = newSlice(-1);
} else {
return;
}
}
let top = this,
bottom = this.down;
bottom = down;
top.bridges = null;
bottom.flats = null;

View file

@ -1489,24 +1489,23 @@ self.kiri.copyright = exports.COPYRIGHT;
}
function restoreSettings(save) {
let newset = ls2o('ws-settings');
let newset = ls2o('ws-settings') || settings;
if (newset) {
settings = CONF.normalize(newset);
// override camera from settings
if (settings.controller.view) {
SDB.removeItem('ws-camera');
}
// merge custom filters from localstorage into settings
localFilters.forEach(function(fname) {
let fkey = "gcode-filter-"+fname, ov = ls2o(fkey);
if (ov) settings.devices[fname] = ov;
SDB.removeItem(fkey)
});
SDB.removeItem(localFilterKey);
// save updated settings
if (save) API.conf.save();
settings = CONF.normalize(newset);
// override camera from settings
if (settings.controller.view) {
SDB.removeItem('ws-camera');
}
// merge custom filters from localstorage into settings
localFilters.forEach(function(fname) {
let fkey = "gcode-filter-"+fname, ov = ls2o(fkey);
if (ov) settings.devices[fname] = ov;
SDB.removeItem(fkey)
});
SDB.removeItem(localFilterKey);
// save updated settings
if (save) API.conf.save();
return newset;
}

View file

@ -425,12 +425,13 @@ var MOTO = window.moto = window.moto || {};
DOC.activeElement.blur();
event.preventDefault();
let selection = null,
trackTo = alignedTracking ? trackPlane : platform;
trackTo = alignedTracking ? trackPlane : platform,
isVis = trackTo.visible;
if (mouseDownSelect) selection = mouseDownSelect();
if (selection && selection.length > 0) {
trackTo.visible = true;
let int = intersect(selection.slice().append(trackTo), false);
trackTo.visible = false;
trackTo.visible = isVis;
if (int.length > 0) {
let trackInt, selectInt;
for (let i=0; i<int.length; i++) {
@ -518,9 +519,10 @@ var MOTO = window.moto = window.moto || {};
} else if (mouseDragPoint && mouseDrag && mouseDrag()) {
event.preventDefault();
let trackTo = alignedTracking ? trackPlane : platform;
let vis = trackTo.visible;
trackTo.visible = true;
int = intersect([trackTo], false);
trackTo.visible = false;
trackTo.visible = vis;
if (int.length > 0 && int[0].object === trackTo) {
let delta = mouseDragPoint.clone().sub(int[0].point);
let offset = mouseDragStart.clone().sub(int[0].point);
@ -673,7 +675,6 @@ var MOTO = window.moto = window.moto || {};
if (trackcam) {
trackcam.position.copy(camera.position);
}
renderer.render(SCENE, camera);
if (moved && platformOnMove) {
clearTimeout(platformMoveTimer);
platformMoveTimer = setTimeout(platformOnMove, 500);
@ -701,10 +702,10 @@ var MOTO = window.moto = window.moto || {};
platform.visible = showPlatform;
trackPlane = new THREE.Mesh(
new THREE.PlaneBufferGeometry(2000, 2000, 1, 1),
new THREE.MeshBasicMaterial( { color: 0x777777, opacity: 0.3, transparent: false, side:THREE.DoubleSide } )
new THREE.PlaneBufferGeometry(100000, 100000, 1, 1),
new THREE.MeshBasicMaterial( { color: 0x777777, opacity: 0, transparent: true, side:THREE.DoubleSide } )
);
trackPlane.visible = false;
trackPlane.visible = true;
trackPlane.rotation.x = PI2;
let sky = new THREE.Mesh(
@ -734,6 +735,13 @@ var MOTO = window.moto = window.moto || {};
'keypress', keyHandler
]);
function animate() {
requestAnimationFrame(animate);
renderer.render(SCENE, camera);
}
animate();
initialized = true;
}
};

View file

@ -5,6 +5,7 @@
* `F` implement an in-app bug reporting system
* `F` extend mesh object to store raw + annotations (rot,scale,pos)
* share raw data w/ dups, encode/decode
* `F` gcode color to speed visualization bar
* `P` bail on decimation if it's proving ineffective
* `P` improve decimation speed by avoiding in/out of Point?
* `P` server-side processing (determine protocol and storage)

View file

@ -1,11 +0,0 @@
{
"pre":[],
"post":[],
"cmd":{},
"settings":{
"bed_width": 115,
"bed_depth": 65,
"max_height": 155,
"origin_center": true
}
}