From 54af3650e733a956902f99e03563f17f7f402b78 Mon Sep 17 00:00:00 2001 From: "work.vayavodzin" Date: Thu, 25 Mar 2021 11:51:55 +0300 Subject: [PATCH] Bump three js from 0.94 to 0.125.1 --- package.json | 9 ++---- src/catalog/factories/area-factory-3d.js | 19 ------------- .../viewer3d/grids/grid-horizontal-streak.js | 7 +++-- .../viewer3d/grids/grid-vertical-streak.js | 7 +++-- .../viewer3d/viewer3d-first-person.js | 28 ++++++++++--------- src/utils/threeCSG.es6.js | 2 +- yarn.lock | 2 +- 7 files changed, 27 insertions(+), 47 deletions(-) diff --git a/package.json b/package.json index 81bebbb6..e234d7dd 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "module": "es/index.js", "jsnext:main": "es/index.js", "scripts": { - "start": "webpack-dev-server --inline --config demo/webpack.config.js --port 9000 --mode development", + "start": "webpack-dev-server --inline --config demo/webpack.config.js --port 9001 --mode development", "build-demo": "webpack --config demo/webpack.config.js --mode production", "build-commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib", "build-es": "cross-env BABEL_ENV=es babel src --copy-files --out-dir es", @@ -99,14 +99,9 @@ "react-dom": "16.8.5", "rimraf": "2.6.3", "style-loader": "0.23.1", - "three": "0.94.0", + "three": "0.125.1", "webpack": "4.29.6", "webpack-cli": "3.3.0", "webpack-dev-server": "3.7.1" - }, - "peerDependencies": { - "react": "16.x", - "react-dom": "16.x", - "three": "0.94.x" } } diff --git a/src/catalog/factories/area-factory-3d.js b/src/catalog/factories/area-factory-3d.js index 797e1c0d..0a8075de 100644 --- a/src/catalog/factories/area-factory-3d.js +++ b/src/catalog/factories/area-factory-3d.js @@ -49,25 +49,6 @@ const applyTexture = (material, texture, length, height) => { const assignUVs = (geometry) => { geometry.computeBoundingBox(); - let {min, max} = geometry.boundingBox; - - let offset = new Vector2(0 - min.x, 0 - min.y); - let range = new Vector2(max.x - min.x, max.y - min.y); - - geometry.faceVertexUvs[0] = geometry.faces.map((face) => { - - let v1 = geometry.vertices[face.a]; - let v2 = geometry.vertices[face.b]; - let v3 = geometry.vertices[face.c]; - - return [ - new Vector2((v1.x + offset.x) / range.x, (v1.y + offset.y) / range.y), - new Vector2((v2.x + offset.x) / range.x, (v2.y + offset.y) / range.y), - new Vector2((v3.x + offset.x) / range.x, (v3.y + offset.y) / range.y) - ]; - - }); - geometry.uvsNeedUpdate = true; }; diff --git a/src/components/viewer3d/grids/grid-horizontal-streak.js b/src/components/viewer3d/grids/grid-horizontal-streak.js index 762cc150..3832ccd9 100644 --- a/src/components/viewer3d/grids/grid-horizontal-streak.js +++ b/src/components/viewer3d/grids/grid-horizontal-streak.js @@ -12,9 +12,10 @@ export default function (width, height, grid, font) { for (let i = 0; i <= height; i += step) { - let geometry = new Three.Geometry(); - geometry.vertices.push(new Three.Vector3(0, 0, -i)); - geometry.vertices.push(new Three.Vector3(width, 0, -i)); + let vertices = []; + vertices.push(new Three.Vector3(0, 0, -i)); + vertices.push(new Three.Vector3(width, 0, -i)); + let geometry = new Three.BufferGeometry().setFromPoints( vertices ); let color = colors.get(counter % colors.size); let material = new Three.LineBasicMaterial({ color }); diff --git a/src/components/viewer3d/grids/grid-vertical-streak.js b/src/components/viewer3d/grids/grid-vertical-streak.js index 517c026e..67d9238f 100644 --- a/src/components/viewer3d/grids/grid-vertical-streak.js +++ b/src/components/viewer3d/grids/grid-vertical-streak.js @@ -13,9 +13,10 @@ export default function (width, height, grid, font) { for (let i = 0; i <= width; i += step) { - let geometry = new Three.Geometry(); - geometry.vertices.push(new Three.Vector3(i, 0, 0)); - geometry.vertices.push(new Three.Vector3(i, 0, -height)); + let vertices = []; + vertices.push(new Three.Vector3(i, 0, 0)); + vertices.push(new Three.Vector3(i, 0, -height)); + let geometry = new Three.BufferGeometry().setFromPoints( vertices ); let color = colors.get(counter % colors.size); let material = new Three.LineBasicMaterial({ color }); diff --git a/src/components/viewer3d/viewer3d-first-person.js b/src/components/viewer3d/viewer3d-first-person.js index fd8c83a8..949ece68 100755 --- a/src/components/viewer3d/viewer3d-first-person.js +++ b/src/components/viewer3d/viewer3d-first-person.js @@ -135,27 +135,29 @@ export default class Viewer3DFirstPerson extends React.Component { pointer.name = 'pointer'; let pointerMaterial = new Three.MeshBasicMaterial({depthTest: false, depthWrite: false, color: SharedStyle.COLORS.black}); - let pointerGeometry1 = new Three.Geometry(); - pointerGeometry1.vertices.push(new Three.Vector3(-10, 0, 0)); - pointerGeometry1.vertices.push(new Three.Vector3(10, 0, 0)); - + let vertices = []; + vertices.push(new Three.Vector3(-10, 0, 0)); + vertices.push(new Three.Vector3(10, 0, 0)); + let pointerGeometry1 = new Three.BufferGeometry().setFromPoints( vertices ); let linePointer1 = new Three.Line(pointerGeometry1, pointerMaterial); linePointer1.position.z -= 100; - let pointerGeometry2 = new Three.Geometry(); - pointerGeometry2.vertices.push(new Three.Vector3(0, 10, 0)); - pointerGeometry2.vertices.push(new Three.Vector3(0, -10, 0)); + let vertices2 = []; + vertices2.push(new Three.Vector3(0, 10, 0)); + vertices2.push(new Three.Vector3(0, -10, 0)); + let pointerGeometry2 = new Three.BufferGeometry().setFromPoints( vertices2 ); let linePointer2 = new Three.Line(pointerGeometry2, pointerMaterial); linePointer2.renderDepth = 1e20; linePointer2.position.z -= 100; - let pointerGeometry3 = new Three.Geometry(); - pointerGeometry3.vertices.push(new Three.Vector3(-1, 1, 0)); - pointerGeometry3.vertices.push(new Three.Vector3(1, 1, 0)); - pointerGeometry3.vertices.push(new Three.Vector3(1, -1, 0)); - pointerGeometry3.vertices.push(new Three.Vector3(-1, -1, 0)); - pointerGeometry3.vertices.push(new Three.Vector3(-1, 1, 0)); + let vertices3 = []; + vertices3.push(new Three.Vector3(-1, 1, 0)); + vertices3.push(new Three.Vector3(1, 1, 0)); + vertices3.push(new Three.Vector3(1, -1, 0)); + vertices3.push(new Three.Vector3(-1, -1, 0)); + vertices3.push(new Three.Vector3(-1, 1, 0)); + let pointerGeometry3 = new Three.BufferGeometry().setFromPoints( vertices3 ); let linePointer3 = new Three.Line(pointerGeometry3, pointerMaterial); linePointer3.position.z -= 100; diff --git a/src/utils/threeCSG.es6.js b/src/utils/threeCSG.es6.js index d6bf54ff..fc9e137f 100644 --- a/src/utils/threeCSG.es6.js +++ b/src/utils/threeCSG.es6.js @@ -143,7 +143,7 @@ export default class ThreeBSP { toGeometry() { var i, j, matrix = new THREE.Matrix4().getInverse(this.matrix), - geometry = new THREE.Geometry(), + geometry = new THREE.BufferGeometry(), polygons = this.tree.allPolygons(), polygon_count = polygons.length, polygon, polygon_vertice_count, diff --git a/yarn.lock b/yarn.lock index 3741bba1..54de96a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1,4 +1,4 @@ -# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1