From d367fbe02194cab750d8192efb10f0e26e965508 Mon Sep 17 00:00:00 2001 From: casperlamboo Date: Wed, 14 Oct 2015 17:11:29 +0200 Subject: [PATCH] updated to three.js r72 --- .gitignore | 2 ++ config.js | 22 +++++++++++----------- example/app.js | 24 +++++++++++------------- package.json | 2 +- src/gcode.js | 2 +- src/settings.js | 2 +- src/slicer.js | 4 ++-- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index 9f2dcdf..c90492c 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ *.DS_Store jspm_packages/* + +bundle.js diff --git a/config.js b/config.js index 3c1311a..5dd6187 100644 --- a/config.js +++ b/config.js @@ -1,20 +1,21 @@ System.config({ - "baseURL": "/", - "defaultJSExtensions": true, - "transpiler": "babel", - "babelOptions": { + baseURL: "/", + defaultJSExtensions: true, + transpiler: "babel", + babelOptions: { "optional": [ "runtime" ] }, - "paths": { + paths: { "github:*": "jspm_packages/github/*", "npm:*": "jspm_packages/npm/*" - } -}); + }, + bundles: { + "bundle.js": [] + }, -System.config({ - "map": { + map: { "babel": "npm:babel-core@5.8.21", "babel-runtime": "npm:babel-runtime@5.8.20", "clipper-lib": "npm:clipper-lib@1.0.0", @@ -23,7 +24,7 @@ System.config({ "nodeca/js-yaml": "github:nodeca/js-yaml@3.3.1", "read-yaml": "npm:read-yaml@1.0.0", "systemjs/plugin-json": "github:systemjs/plugin-json@0.1.0", - "three.js": "github:mrdoob/three.js@master", + "three.js": "github:mrdoob/three.js@r72", "github:jspm/nodelibs-assert@0.1.0": { "assert": "npm:assert@1.3.0" }, @@ -92,4 +93,3 @@ System.config({ } } }); - diff --git a/example/app.js b/example/app.js index bc1eb1b..eaa4bfa 100644 --- a/example/app.js +++ b/example/app.js @@ -3,19 +3,17 @@ import PRINTER_SETTINGS from 'settings/printer_settings.json!'; import USER_SETTINGS from 'settings/user_settings.json!'; import * as SLICER from 'src/index'; -setTimeout(() => { - var settings = new SLICER.Settings(); - settings.updateConfig(PRINTER_SETTINGS["ultimaker2go"]); - settings.updateConfig(USER_SETTINGS); +var settings = new SLICER.Settings(); +settings.updateConfig(PRINTER_SETTINGS["ultimaker2go"]); +settings.updateConfig(USER_SETTINGS); - var geometry = new THREE.TorusGeometry(20, 10, 30, 30); +var geometry = new THREE.TorusGeometry(20, 10, 30, 30); - var slicer = new SLICER.Slicer(); - //var slicer = new SLICER.SlicerWorker(); +var slicer = new SLICER.Slicer(); +//var slicer = new SLICER.SlicerWorker(); - slicer.setGeometry(geometry.clone()); - slicer.onfinish = function (gCode) { - document.getElementById('gcode').innerHTML = gCode.replace(/(?:\r\n|\r|\n)/g, '
'); - }; - slicer.slice(settings); -}); \ No newline at end of file +slicer.setGeometry(geometry.clone()); +slicer.onfinish = function (gCode) { + document.getElementById('gcode').innerHTML = gCode.replace(/(?:\r\n|\r|\n)/g, '
'); +}; +slicer.slice(settings); diff --git a/package.json b/package.json index 5431ba5..1b705de 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "nodeca/js-yaml": "github:nodeca/js-yaml@^3.3.1", "read-yaml": "npm:read-yaml@^1.0.0", "systemjs/plugin-json": "github:systemjs/plugin-json@^0.1.0", - "three.js": "github:mrdoob/three.js@master" + "three.js": "github:mrdoob/three.js@r72" }, "devDependencies": { "babel": "npm:babel-core@^5.1.13", diff --git a/src/gcode.js b/src/gcode.js index f54b6dc..fb0320f 100644 --- a/src/gcode.js +++ b/src/gcode.js @@ -161,4 +161,4 @@ export default class { getGCode () { return this.settings.startCode() + this.gcode + this.settings.endCode(); } -} \ No newline at end of file +} diff --git a/src/settings.js b/src/settings.js index 98b2c63..a21971c 100644 --- a/src/settings.js +++ b/src/settings.js @@ -55,4 +55,4 @@ export default class { return gcode; } -} \ No newline at end of file +} diff --git a/src/slicer.js b/src/slicer.js index 968a620..356c40f 100644 --- a/src/slicer.js +++ b/src/slicer.js @@ -30,7 +30,7 @@ export default class { if (geometry.type === 'BufferGeometry') { geometry = new THREE.Geometry().fromBufferGeometry(geometry); } - else if (geometry.type === 'Geometry') { + else if (geometry.type.endsWith('Geometry')) { geometry = geometry.clone(); } else { @@ -138,7 +138,7 @@ export default class { var layerHeight = settings.config["layerHeight"]; var height = settings.config["dimensionsZ"]; - var numLayers = height / layerHeight; + var numLayers = Math.floor(height / layerHeight); var layerIntersectionIndexes = []; var layerIntersectionPoints = [];