mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 19:43:48 +01:00
remove worker
This commit is contained in:
parent
8b9b1af612
commit
caf62e58d5
@ -1,55 +0,0 @@
|
||||
importScripts('../jspm_packages/system.js');
|
||||
importScripts('../config.js');
|
||||
|
||||
var Slicer, Settings, THREE;
|
||||
|
||||
function init () {
|
||||
var slicer = new Slicer();
|
||||
slicer.onProgress = function (progress) {
|
||||
self.postMessage({
|
||||
'cmd': 'PROGRESS',
|
||||
'progress': progress
|
||||
});
|
||||
};
|
||||
|
||||
self.addEventListener('message', function (event) {
|
||||
switch (event.data['cmd']) {
|
||||
case 'SET_MESH':
|
||||
var geometry = new THREE.Geometry().fromBufferGeometry(event.data['geometry']);
|
||||
var matrix = new THREE.Matrix4().fromArray(event.data['matrix']);
|
||||
|
||||
slicer.setGeometry(geometry, matrix);
|
||||
break;
|
||||
|
||||
case 'SLICE':
|
||||
var settings = new Settings().updateConfig(event.data['settings']);
|
||||
|
||||
var gcode = slicer.slice(settings);
|
||||
var blob = new Blob([gcode], {type: 'text/plain'});
|
||||
|
||||
self.postMessage({
|
||||
'cmd': 'GCODE',
|
||||
'gcode': blob
|
||||
});
|
||||
|
||||
//self.close();
|
||||
break;
|
||||
|
||||
case 'CLOSE':
|
||||
self.close();
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Promise.all([
|
||||
System.import('./slicer'),
|
||||
System.import('./settings'),
|
||||
System.import('three.js')
|
||||
]).then(function(modules) {
|
||||
Slicer = modules[0].default;
|
||||
Settings = modules[1].default;
|
||||
THREE = modules[2];
|
||||
|
||||
init();
|
||||
});
|
Loading…
Reference in New Issue
Block a user