diff --git a/jspm.config.js b/jspm.config.js index 41cb0ac..26662fe 100644 --- a/jspm.config.js +++ b/jspm.config.js @@ -18,7 +18,8 @@ SystemJS.config({ "zlib": "github:jspm/nodelibs-zlib@0.2.0-alpha", "https": "github:jspm/nodelibs-https@0.2.0-alpha", "react-dom": "npm:react-dom@15.3.2", - "babel-plugin-transform-react-jsx": "npm:babel-plugin-transform-react-jsx@6.8.0" + "babel-plugin-transform-react-jsx": "npm:babel-plugin-transform-react-jsx@6.8.0", + "three.js/loaders/STLLoader": "github:mrdoob/three.js@r83/examples/js/loaders/STLLoader.js" }, "packages": { "npm:babel-runtime@5.8.38": { @@ -146,7 +147,7 @@ SystemJS.config({ }, map: { "babel": "npm:babel-core@5.8.38", - "three.js/loaders/STLLoader": "github:mrdoob/three.js@r75/examples/js/loaders/STLLoader.js", + "three.js/loaders/STLLoader": "github:mrdoob/three.js@r75/examples/js/loaders/STLLoader.js" } }); @@ -157,6 +158,7 @@ SystemJS.config({ "github:*/*.json" ], map: { + "three.js": "github:mrdoob/three.js@r83", "assert": "github:jspm/nodelibs-assert@0.2.0-alpha", "buffer": "github:jspm/nodelibs-buffer@0.2.0-alpha", "child_process": "github:jspm/nodelibs-child_process@0.2.0-alpha", @@ -173,7 +175,6 @@ SystemJS.config({ "process": "github:jspm/nodelibs-process@0.2.0-alpha", "stream": "github:jspm/nodelibs-stream@0.2.0-alpha", "string_decoder": "github:jspm/nodelibs-string_decoder@0.2.0-alpha", - "three.js": "github:mrdoob/three.js@r75", "tty": "github:jspm/nodelibs-tty@0.2.0-alpha", "url": "github:jspm/nodelibs-url@0.2.0-alpha", "util": "github:jspm/nodelibs-util@0.2.0-alpha", diff --git a/package.json b/package.json index 6ede08c..00bf428 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "dependencies": { "Doodle3D/clipper-js": "github:Doodle3D/clipper-js@master", "json": "github:systemjs/plugin-json@^0.1.2", - "three.js": "github:mrdoob/three.js@r75", + "three.js": "github:mrdoob/three.js@r83", "worker": "github:casperlamboo/plugin-worker@master" }, "devDependencies": { @@ -43,7 +43,7 @@ "vm": "github:jspm/nodelibs-vm@^0.2.0-alpha" }, "overrides": { - "github:mrdoob/three.js@r75": { + "github:mrdoob/three.js@r83": { "format": "global" }, "npm:babel-runtime@5.8.38": { diff --git a/src/GCode.js b/src/GCode.js index 66e26ef..8c3abd7 100644 --- a/src/GCode.js +++ b/src/GCode.js @@ -1,4 +1,4 @@ -import THREE from 'three.js'; +import 'three.js'; const G_COMMAND = 'G'; const M_COMMAND = 'M'; diff --git a/src/Slicer.js b/src/Slicer.js index baa6fc5..9a1fa3a 100644 --- a/src/Slicer.js +++ b/src/Slicer.js @@ -1,4 +1,4 @@ -import THREE from 'three.js'; +import 'three.js'; import slice from './sliceActions/slice.js'; import SlicerWorker from './slicerWorker.js!worker'; @@ -11,20 +11,20 @@ export default class { return this; } setGeometry(geometry, matrix) { - if (geometry instanceof THREE.BufferGeometry) { - geometry = new THREE.Geometry().fromBufferGeometry(geometry); - } else if (geometry instanceof THREE.Geometry) { - geometry = geometry.clone(); - } else { - throw 'Geometry is not an instance of BufferGeometry or Geometry'; - } + if (geometry.type === 'BufferGeometry') { + geometry = new THREE.Geometry().fromBufferGeometry(geometry); + } else if (geometry.type === 'Geometry') { + geometry = geometry.clone(); + } else { + throw new Error('Geometry is not an instance of BufferGeometry or Geometry'); + } - if (matrix instanceof THREE.Matrix4) { - geometry.applyMatrix(matrix); - } + if (matrix) { + geometry.applyMatrix(matrix); + } geometry.mergeVertices(); - geometry.computeFaceNormals(); + geometry.computeFaceNormals(); this.geometry = geometry; diff --git a/src/sliceActions/addBrim.js b/src/sliceActions/addBrim.js index efc40d6..bea204c 100644 --- a/src/sliceActions/addBrim.js +++ b/src/sliceActions/addBrim.js @@ -1,4 +1,4 @@ -import THREE from 'three.js'; +import 'three.js'; import { PRECISION } from '../constants.js'; const offsetOptions = { diff --git a/src/sliceActions/calculateLayersIntersections.js b/src/sliceActions/calculateLayersIntersections.js index 45f15fb..fd6e18a 100644 --- a/src/sliceActions/calculateLayersIntersections.js +++ b/src/sliceActions/calculateLayersIntersections.js @@ -1,4 +1,4 @@ -import THREE from 'three.js'; +import 'three.js'; export default function calculateLayersIntersections(lines, settings) { console.log('calculating layer intersections'); diff --git a/src/sliceActions/createLines.js b/src/sliceActions/createLines.js index 6b43817..e835797 100644 --- a/src/sliceActions/createLines.js +++ b/src/sliceActions/createLines.js @@ -1,4 +1,4 @@ -import THREE from 'three.js'; +import 'three.js'; function addLine(geometry, lineLookup, lines, a, b) { const index = lines.length; diff --git a/src/sliceActions/intersectionsToShapes.js b/src/sliceActions/intersectionsToShapes.js index 8bada93..624d0d6 100644 --- a/src/sliceActions/intersectionsToShapes.js +++ b/src/sliceActions/intersectionsToShapes.js @@ -1,4 +1,4 @@ -import THREE from 'three.js'; +import 'three.js'; import Shape from 'Doodle3D/clipper-js'; export default function intersectionsToShapes(layerIntersectionIndexes, layerIntersectionPoints, lines, settings) { diff --git a/src/sliceActions/optimizePaths.js b/src/sliceActions/optimizePaths.js index 1c72aae..b160fce 100644 --- a/src/sliceActions/optimizePaths.js +++ b/src/sliceActions/optimizePaths.js @@ -1,4 +1,4 @@ -import THREE from 'three.js'; +import 'three.js'; import Shape from 'Doodle3D/clipper-js'; export default function optimizePaths(slices, settings) { diff --git a/src/sliceActions/removePrecision.js b/src/sliceActions/removePrecision.js index d1841e9..66d8743 100644 --- a/src/sliceActions/removePrecision.js +++ b/src/sliceActions/removePrecision.js @@ -1,4 +1,4 @@ -import THREE from 'three.js'; +import 'three.js'; import { PRECISION } from '../constants.js'; export default function removePrecision(slices) { diff --git a/src/slicerWorker.js b/src/slicerWorker.js index ff0cd13..de7e3b0 100644 --- a/src/slicerWorker.js +++ b/src/slicerWorker.js @@ -1,6 +1,6 @@ import Settings from './Settings.js'; import slice from './sliceActions/slice.js'; -import THREE from 'three.js'; +import 'three.js'; const loader = new THREE.JSONLoader();