@eturnity/eturnity_3d 6.34.4 → 6.34.6-EPDM-8077.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/src/components/ThreeCanvasViewer.vue +20 -15
- package/src/helper/materials.js +5 -0
- package/src/helper/render/base.js +14 -5
- package/src/helper/render/index.js +3 -1
- package/src/helper/render/loader.js +8 -4
- package/src/helper/render/mergedGeometry.js +99 -0
- package/src/helper/render/obstacle.js +38 -8
- package/src/helper/render/panel.js +63 -14
- package/src/helper/render/roof.js +19 -21
- package/src/helper/render/tile.js +26 -86
- package/src/helper/render/tileProjection.js +2 -2
- package/src/helper/renderMixin.js +9 -10
- package/src/helper/threeMixin.js +15 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eturnity/eturnity_3d",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "6.34.
|
|
4
|
+
"version": "6.34.6-EPDM-8077.0",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vue-cli-service serve --skip-plugins @vue/cli-plugin-eslint",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"geo-three": "^0.1.11",
|
|
20
20
|
"leaflet": "^1.8.0",
|
|
21
21
|
"leaflet.gridlayer.googlemutant": "^0.14.0",
|
|
22
|
+
"lodash": "4.17.21",
|
|
22
23
|
"svd-js": "^1.1.1",
|
|
23
24
|
"three": "^0.149.0",
|
|
24
25
|
"three-projected-material": "2.2.1",
|
|
@@ -10,7 +10,12 @@
|
|
|
10
10
|
<script>
|
|
11
11
|
import { mapActions, mapState, mapGetters, mapMutations } from 'vuex'
|
|
12
12
|
import * as THREE from 'three'
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
addVector,
|
|
15
|
+
multiplyVector,
|
|
16
|
+
updateComputedGeometryPolygon,
|
|
17
|
+
normalizeVector
|
|
18
|
+
} from '@eturnity/eturnity_maths'
|
|
14
19
|
|
|
15
20
|
import threeMixin from '../helper/threeMixin'
|
|
16
21
|
import materialMixin from '../helper/materialMixin'
|
|
@@ -72,7 +77,6 @@ export default {
|
|
|
72
77
|
this.renderGeometry()
|
|
73
78
|
this.onWindowResize()
|
|
74
79
|
this.updateProjectionMaterials()
|
|
75
|
-
this.animate()
|
|
76
80
|
this.$root.$on('on-roofSelected', (polygon) =>
|
|
77
81
|
this.setCameraOrthogonalTo(polygon)
|
|
78
82
|
)
|
|
@@ -81,6 +85,7 @@ export default {
|
|
|
81
85
|
const polygon = this.polygons.find((p) => p.id == this.uuid)
|
|
82
86
|
this.setCamera(polygon, this.view_mode)
|
|
83
87
|
this.isReady.geometry = true
|
|
88
|
+
this.render()
|
|
84
89
|
},
|
|
85
90
|
computed: {
|
|
86
91
|
...mapState({
|
|
@@ -153,9 +158,9 @@ export default {
|
|
|
153
158
|
geometry.boundingSphere.center.z
|
|
154
159
|
]
|
|
155
160
|
let objectRadius = geometry.boundingSphere.radius
|
|
156
|
-
|
|
161
|
+
|
|
157
162
|
distance =
|
|
158
|
-
|
|
163
|
+
5 + objectRadius / Math.sin(((this.camera.fov / 2) * Math.PI) / 180)
|
|
159
164
|
}
|
|
160
165
|
|
|
161
166
|
polygonRef = updateComputedGeometryPolygon(polygonRef)
|
|
@@ -197,12 +202,12 @@ export default {
|
|
|
197
202
|
//if flat roof=> go south
|
|
198
203
|
horizontalVector.y = 1
|
|
199
204
|
}
|
|
200
|
-
horizontalVector=normalizeVector(horizontalVector)
|
|
205
|
+
horizontalVector = normalizeVector(horizontalVector)
|
|
201
206
|
// let distanceCoefficient = 2
|
|
202
207
|
// if(flatRoof){
|
|
203
208
|
// distanceCoefficient = 1.5
|
|
204
209
|
// }
|
|
205
|
-
cameraMoveVector = multiplyVector(distance * 1000
|
|
210
|
+
cameraMoveVector = multiplyVector(distance * 1000, horizontalVector)
|
|
206
211
|
}
|
|
207
212
|
|
|
208
213
|
const positionVector = addVector(polygonRef.meanPoint, cameraMoveVector)
|
|
@@ -253,14 +258,14 @@ export default {
|
|
|
253
258
|
},
|
|
254
259
|
render() {
|
|
255
260
|
this.renderer.clear()
|
|
256
|
-
if (this.orbitControl) {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
}
|
|
261
|
+
// if (this.orbitControl) {
|
|
262
|
+
// this.orbitControl.target.set(
|
|
263
|
+
// this.orbitControl.target.x,
|
|
264
|
+
// this.orbitControl.target.y,
|
|
265
|
+
// 2
|
|
266
|
+
// )
|
|
267
|
+
// this.orbitControl.update()
|
|
268
|
+
// }
|
|
264
269
|
if (['top', 'global'].includes(this.view_mode)) {
|
|
265
270
|
this.renderer.render(this.scene, this.orthographicCamera)
|
|
266
271
|
} else {
|
|
@@ -296,7 +301,7 @@ export default {
|
|
|
296
301
|
height: 100%;
|
|
297
302
|
}
|
|
298
303
|
|
|
299
|
-
.canvas3DContainer>canvas {
|
|
304
|
+
.canvas3DContainer > canvas {
|
|
300
305
|
width: 100%;
|
|
301
306
|
height: 100%;
|
|
302
307
|
}
|
package/src/helper/materials.js
CHANGED
|
@@ -13,6 +13,11 @@ material.wall = new THREE.MeshLambertMaterial({
|
|
|
13
13
|
side: THREE.DoubleSide
|
|
14
14
|
})
|
|
15
15
|
|
|
16
|
+
material.panelSide = new THREE.MeshLambertMaterial({
|
|
17
|
+
color: 0xdddddd,
|
|
18
|
+
side: THREE.DoubleSide
|
|
19
|
+
})
|
|
20
|
+
|
|
16
21
|
// TODO get Canvas image from TwoD
|
|
17
22
|
material.obstacle = new THREE.MeshPhongMaterial({
|
|
18
23
|
color: 0xff0000,
|
|
@@ -5,12 +5,17 @@ import {
|
|
|
5
5
|
} from './geometryHandler'
|
|
6
6
|
export default {
|
|
7
7
|
methods: {
|
|
8
|
+
data(){
|
|
9
|
+
return {
|
|
10
|
+
mergedBaseMesh:null
|
|
11
|
+
}
|
|
12
|
+
},
|
|
8
13
|
renderBase() {
|
|
9
14
|
//rendering of walls
|
|
10
|
-
//this.clearByType('baseMeshes')
|
|
11
15
|
this.clearRemovedOnes('baseMeshes')
|
|
12
16
|
let geometry
|
|
13
17
|
let mesh
|
|
18
|
+
let baseGeometries=[]
|
|
14
19
|
this.roofs.forEach((roofPolygon) => {
|
|
15
20
|
//everythime the essencials data are changed, version goes up. we compare polygon version and mesh version to know if we have to rerender
|
|
16
21
|
if (
|
|
@@ -18,7 +23,6 @@ export default {
|
|
|
18
23
|
this.meshes.baseMeshes[roofPolygon.id].userData.version <
|
|
19
24
|
roofPolygon.version
|
|
20
25
|
) {
|
|
21
|
-
//this.clearMesh(this.meshes.baseMeshes[roofPolygon.id])
|
|
22
26
|
mesh = this.meshes.baseMeshes[roofPolygon.id]
|
|
23
27
|
geometry = mesh.geometry
|
|
24
28
|
geometry = updateBufferWallGeometry(roofPolygon, geometry)
|
|
@@ -35,12 +39,17 @@ export default {
|
|
|
35
39
|
mesh.userData.polygonId = roofPolygon.id
|
|
36
40
|
mesh.matrixAutoUpdate = false
|
|
37
41
|
mesh.frustumCulled = false
|
|
38
|
-
//geometry.dispose()
|
|
39
|
-
//geometry=null
|
|
40
|
-
this.scene.add(mesh)
|
|
41
42
|
this.meshes.baseMeshes[roofPolygon.id] = mesh
|
|
42
43
|
}
|
|
44
|
+
baseGeometries.push(this.meshes.baseMeshes[roofPolygon.id].geometry)
|
|
43
45
|
})
|
|
46
|
+
|
|
47
|
+
this.updateOrCreateMergedMesh(
|
|
48
|
+
this.mergedBaseMesh,
|
|
49
|
+
baseGeometries,
|
|
50
|
+
this.material.wall
|
|
51
|
+
)
|
|
52
|
+
|
|
44
53
|
}
|
|
45
54
|
}
|
|
46
55
|
}
|
|
@@ -15,6 +15,7 @@ import texture from './texture'
|
|
|
15
15
|
import projectionMaterial from './projectionMaterial'
|
|
16
16
|
import tile from './tile'
|
|
17
17
|
import tileProjection from './tileProjection'
|
|
18
|
+
import mergedGeometry from './mergedGeometry'
|
|
18
19
|
|
|
19
20
|
export default {
|
|
20
21
|
//mixins:[node,background,clear,edge,loader,margin,moduleField,obstacle,panel,roof,base]
|
|
@@ -35,6 +36,7 @@ export default {
|
|
|
35
36
|
mapProjection,
|
|
36
37
|
projectionMaterial,
|
|
37
38
|
tile,
|
|
38
|
-
tileProjection
|
|
39
|
+
tileProjection,
|
|
40
|
+
mergedGeometry
|
|
39
41
|
]
|
|
40
42
|
}
|
|
@@ -13,8 +13,10 @@ export default {
|
|
|
13
13
|
let texture = this.loader.load(component.texture_img_url)
|
|
14
14
|
this.material.panel[pvId] = new THREE.MeshBasicMaterial({
|
|
15
15
|
map: texture,
|
|
16
|
-
side: THREE.
|
|
17
|
-
transparent:
|
|
16
|
+
side: THREE.FrontSide,
|
|
17
|
+
transparent: false,
|
|
18
|
+
magFilter:THREE.NearestFilter,
|
|
19
|
+
minFilter:THREE.NearestFilter
|
|
18
20
|
})
|
|
19
21
|
}
|
|
20
22
|
}
|
|
@@ -31,8 +33,10 @@ export default {
|
|
|
31
33
|
let texture = await this.loader.load(mf.data.texture_img_url)
|
|
32
34
|
this.material.panel[pvId] = new THREE.MeshBasicMaterial({
|
|
33
35
|
map: texture,
|
|
34
|
-
side: THREE.
|
|
35
|
-
transparent:
|
|
36
|
+
side: THREE.FrontSide,
|
|
37
|
+
transparent: false,
|
|
38
|
+
magFilter:THREE.NearestFilter,
|
|
39
|
+
minFilter:THREE.NearestFilter
|
|
36
40
|
})
|
|
37
41
|
}
|
|
38
42
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import * as THREE from 'three'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
methods: {
|
|
5
|
+
updateMergedGeometry(geometries, mergedGeometry) {
|
|
6
|
+
const mergedVertices = []
|
|
7
|
+
const mergedNormals = []
|
|
8
|
+
const mergedUvs = []
|
|
9
|
+
|
|
10
|
+
geometries.forEach((geometry) => {
|
|
11
|
+
const positions = geometry.attributes.position.array
|
|
12
|
+
const normals = geometry.attributes.normal.array
|
|
13
|
+
|
|
14
|
+
mergedVertices.push(...positions)
|
|
15
|
+
mergedNormals.push(...normals)
|
|
16
|
+
|
|
17
|
+
if (geometry.attributes.uv) {
|
|
18
|
+
const uvs = geometry.attributes.uv.array
|
|
19
|
+
mergedUvs.push(...uvs)
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
//position
|
|
24
|
+
if (
|
|
25
|
+
mergedGeometry.attributes.position &&
|
|
26
|
+
mergedGeometry.attributes.uv &&
|
|
27
|
+
mergedGeometry.attributes.normal &&
|
|
28
|
+
mergedGeometry.attributes.position.array.length >=
|
|
29
|
+
mergedVertices.length &&
|
|
30
|
+
mergedGeometry.attributes.uv.array.length >= mergedUvs.length &&
|
|
31
|
+
mergedGeometry.attributes.normal.array.length >= mergedNormals.length
|
|
32
|
+
) {
|
|
33
|
+
mergedGeometry.attributes.position.array.set(mergedVertices)
|
|
34
|
+
mergedGeometry.attributes.uv.array.set(mergedUvs)
|
|
35
|
+
mergedGeometry.attributes.normal.array.set(mergedNormals)
|
|
36
|
+
|
|
37
|
+
mergedGeometry.setDrawRange(0, mergedVertices.length / 3)
|
|
38
|
+
mergedGeometry.setDrawRange(0, mergedUvs.length / 2)
|
|
39
|
+
mergedGeometry.setDrawRange(0, mergedNormals.length / 3)
|
|
40
|
+
} else {
|
|
41
|
+
mergedGeometry.dispose()
|
|
42
|
+
mergedGeometry = null
|
|
43
|
+
mergedGeometry = this.createMergedGeometry(geometries)
|
|
44
|
+
}
|
|
45
|
+
mergedGeometry.attributes.position.needsUpdate = true
|
|
46
|
+
mergedGeometry.attributes.normal.needsUpdate = true
|
|
47
|
+
mergedGeometry.needsUpdate = true
|
|
48
|
+
return mergedGeometry
|
|
49
|
+
},
|
|
50
|
+
createMergedGeometry(geometries) {
|
|
51
|
+
const mergedGeometry = new THREE.BufferGeometry()
|
|
52
|
+
const mergedVertices = []
|
|
53
|
+
const mergedNormals = []
|
|
54
|
+
const mergedUvs = []
|
|
55
|
+
|
|
56
|
+
geometries.forEach((geometry) => {
|
|
57
|
+
const positions = geometry.attributes.position.array
|
|
58
|
+
const normals = geometry.attributes.normal.array
|
|
59
|
+
|
|
60
|
+
mergedVertices.push(...positions)
|
|
61
|
+
mergedNormals.push(...normals)
|
|
62
|
+
|
|
63
|
+
if (geometry.attributes.uv) {
|
|
64
|
+
const uvs = geometry.attributes.uv.array
|
|
65
|
+
mergedUvs.push(...uvs)
|
|
66
|
+
mergedGeometry.setAttribute(
|
|
67
|
+
'uv',
|
|
68
|
+
new THREE.BufferAttribute(new Float32Array(mergedUvs), 2)
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
mergedGeometry.setAttribute(
|
|
74
|
+
'position',
|
|
75
|
+
new THREE.BufferAttribute(new Float32Array(mergedVertices), 3)
|
|
76
|
+
)
|
|
77
|
+
mergedGeometry.setAttribute(
|
|
78
|
+
'normal',
|
|
79
|
+
new THREE.BufferAttribute(new Float32Array(mergedNormals), 3)
|
|
80
|
+
)
|
|
81
|
+
mergedGeometry.computeVertexNormals()
|
|
82
|
+
return mergedGeometry
|
|
83
|
+
},
|
|
84
|
+
updateOrCreateMergedMesh(mesh, geometries, material) {
|
|
85
|
+
if (!mesh) {
|
|
86
|
+
let mergedGeometry = this.createMergedGeometry(geometries)
|
|
87
|
+
mesh = new THREE.Mesh(mergedGeometry, material)
|
|
88
|
+
// Add the merged mesh to the scene
|
|
89
|
+
this.scene.add(mesh)
|
|
90
|
+
} else {
|
|
91
|
+
let mergedGeometry = this.updateMergedGeometry(
|
|
92
|
+
geometries,
|
|
93
|
+
mesh.geometry
|
|
94
|
+
)
|
|
95
|
+
mesh.geometry = mergedGeometry
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -5,9 +5,22 @@ import {
|
|
|
5
5
|
} from './geometryHandler'
|
|
6
6
|
export default {
|
|
7
7
|
methods: {
|
|
8
|
+
data() {
|
|
9
|
+
return {
|
|
10
|
+
mergedObstacleMesh: null,
|
|
11
|
+
mergedObstacleSideMesh: null
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
applyTextureOnObstacles(material = this.material.roof) {
|
|
15
|
+
this.reorderRoofMaterials()
|
|
16
|
+
if (this.mergedObstacleMesh) {
|
|
17
|
+
this.applyTextureOnMesh(material, this.mergedObstacleMesh)
|
|
18
|
+
}
|
|
19
|
+
},
|
|
8
20
|
renderObstacles() {
|
|
9
21
|
this.clearByType('obstacleMeshes')
|
|
10
|
-
|
|
22
|
+
let obstacleGeometries = []
|
|
23
|
+
let obstacleSideGeometries = []
|
|
11
24
|
this.roofs.forEach((roofPolygon) => {
|
|
12
25
|
roofPolygon.holes
|
|
13
26
|
.filter((poly) => poly.layer == 'obstacle')
|
|
@@ -24,7 +37,7 @@ export default {
|
|
|
24
37
|
if (geometry && geometrySide) {
|
|
25
38
|
const mesh = new THREE.Mesh(geometry, this.material.roof)
|
|
26
39
|
const meshSide = new THREE.Mesh(geometrySide, this.material.wall)
|
|
27
|
-
this.applyTextureOnMesh(this.material.roof, mesh)
|
|
40
|
+
// this.applyTextureOnMesh(this.material.roof, mesh)
|
|
28
41
|
|
|
29
42
|
mesh.userData.version = obstaclePolygon.version
|
|
30
43
|
mesh.userData.type = 'obstacleMeshes'
|
|
@@ -37,12 +50,6 @@ export default {
|
|
|
37
50
|
obstaclePolygon.id + '-' + roofPolygon.id + '_side'
|
|
38
51
|
meshSide.userData.polygonId = obstaclePolygon.id
|
|
39
52
|
|
|
40
|
-
mesh.matrixAutoUpdate = false
|
|
41
|
-
meshSide.matrixAutoUpdate = false
|
|
42
|
-
mesh.frustumCulled = false
|
|
43
|
-
meshSide.frustumCulled = false
|
|
44
|
-
this.scene.add(mesh)
|
|
45
|
-
this.scene.add(meshSide)
|
|
46
53
|
this.meshes.obstacleMeshes[
|
|
47
54
|
obstaclePolygon.id + '-' + roofPolygon.id + '_top'
|
|
48
55
|
] = mesh
|
|
@@ -50,8 +57,31 @@ export default {
|
|
|
50
57
|
obstaclePolygon.id + '-' + roofPolygon.id + '_side'
|
|
51
58
|
] = meshSide
|
|
52
59
|
}
|
|
60
|
+
obstacleGeometries.push(
|
|
61
|
+
this.meshes.obstacleMeshes[
|
|
62
|
+
obstaclePolygon.id + '-' + roofPolygon.id + '_top'
|
|
63
|
+
].geometry
|
|
64
|
+
)
|
|
65
|
+
obstacleSideGeometries.push(
|
|
66
|
+
this.meshes.obstacleMeshes[
|
|
67
|
+
obstaclePolygon.id + '-' + roofPolygon.id + '_side'
|
|
68
|
+
].geometry
|
|
69
|
+
)
|
|
53
70
|
})
|
|
54
71
|
})
|
|
72
|
+
|
|
73
|
+
// Create the mesh using the merged geometry and shared material
|
|
74
|
+
this.updateOrCreateMergedMesh(
|
|
75
|
+
this.mergedObstacleMesh,
|
|
76
|
+
obstacleGeometries,
|
|
77
|
+
this.material.roof
|
|
78
|
+
)
|
|
79
|
+
this.updateOrCreateMergedMesh(
|
|
80
|
+
this.mergedObstacleSideMesh,
|
|
81
|
+
obstacleSideGeometries,
|
|
82
|
+
this.material.wall
|
|
83
|
+
)
|
|
84
|
+
this.applyTextureOnObstacles(this.material.roof)
|
|
55
85
|
}
|
|
56
86
|
}
|
|
57
87
|
}
|
|
@@ -6,6 +6,12 @@ import {
|
|
|
6
6
|
updateBufferPanelSideGeometry
|
|
7
7
|
} from './geometryHandler'
|
|
8
8
|
export default {
|
|
9
|
+
data() {
|
|
10
|
+
return {
|
|
11
|
+
mergedPanelSideMesh: null,
|
|
12
|
+
mergedPanelTopMeshes: {}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
9
15
|
methods: {
|
|
10
16
|
renderPanels() {
|
|
11
17
|
this.clearRemovedOnes('panelsMeshes')
|
|
@@ -29,22 +35,28 @@ export default {
|
|
|
29
35
|
}
|
|
30
36
|
})
|
|
31
37
|
|
|
38
|
+
let panelSideGeometries = []
|
|
39
|
+
let panelTopGeometries = {}
|
|
32
40
|
this.panels.forEach((panelPolygon) => {
|
|
33
41
|
//definition of the material
|
|
34
42
|
if (panelPolygon.moduleField.data.number_of_panels_override) return
|
|
35
|
-
let
|
|
36
|
-
|
|
43
|
+
let materialId = 'default_' + this.moduleTextureVersionId
|
|
44
|
+
let material = this.material.panel[materialId]
|
|
37
45
|
material.transparent = true
|
|
38
46
|
material.opacity = this.panelOpacity
|
|
39
47
|
if (panelPolygon.moduleField.pvData) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
material = this.material.panel[
|
|
48
|
+
if (this.material.panel[panelPolygon.moduleField.pvData.id]) {
|
|
49
|
+
materialId = panelPolygon.moduleField.pvData.id
|
|
50
|
+
material = this.material.panel[materialId]
|
|
43
51
|
}
|
|
44
52
|
} else if (panelPolygon.moduleField.data) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
if (
|
|
54
|
+
this.material.panel[
|
|
55
|
+
panelPolygon.moduleField.data.component_id_pv_module
|
|
56
|
+
]
|
|
57
|
+
) {
|
|
58
|
+
materialId = panelPolygon.moduleField.data.component_id_pv_module
|
|
59
|
+
material = this.material.panel[materialId]
|
|
48
60
|
}
|
|
49
61
|
}
|
|
50
62
|
|
|
@@ -54,10 +66,17 @@ export default {
|
|
|
54
66
|
) {
|
|
55
67
|
const geometry = getBufferPanelGeometry(panelPolygon)
|
|
56
68
|
const geometrySide = getBufferPanelSideGeometry(panelPolygon)
|
|
57
|
-
|
|
69
|
+
if (!panelTopGeometries[materialId]){
|
|
70
|
+
panelTopGeometries[materialId] = []
|
|
71
|
+
}
|
|
72
|
+
panelTopGeometries[materialId].push(geometry)
|
|
73
|
+
panelSideGeometries.push(geometrySide)
|
|
58
74
|
if (geometry && geometrySide) {
|
|
59
75
|
const mesh = new THREE.Mesh(geometry, material)
|
|
60
|
-
const meshSide = new THREE.Mesh(
|
|
76
|
+
const meshSide = new THREE.Mesh(
|
|
77
|
+
geometrySide,
|
|
78
|
+
this.material.panelSide
|
|
79
|
+
)
|
|
61
80
|
mesh.userData.version = panelPolygon.version
|
|
62
81
|
mesh.userData.type = 'panelsMeshes'
|
|
63
82
|
mesh.userData.meshId = panelPolygon.id + '_top'
|
|
@@ -68,8 +87,6 @@ export default {
|
|
|
68
87
|
meshSide.userData.polygonId = panelPolygon.id
|
|
69
88
|
geometry.dispose()
|
|
70
89
|
geometrySide.dispose()
|
|
71
|
-
this.scene.add(mesh)
|
|
72
|
-
this.scene.add(meshSide)
|
|
73
90
|
mesh.matrixAutoUpdate = false
|
|
74
91
|
meshSide.matrixAutoUpdate = false
|
|
75
92
|
this.meshes.panelsMeshes[panelPolygon.id + '_top'] = mesh
|
|
@@ -79,18 +96,50 @@ export default {
|
|
|
79
96
|
const topMesh = this.meshes.panelsMeshes[panelPolygon.id + '_top']
|
|
80
97
|
const sideMesh = this.meshes.panelsMeshes[panelPolygon.id + '_side']
|
|
81
98
|
if (panelPolygon.version > topMesh.userData.version) {
|
|
82
|
-
|
|
99
|
+
let topGeometry = updateBufferPanelGeometry(
|
|
83
100
|
panelPolygon,
|
|
84
101
|
topMesh.geometry
|
|
85
102
|
)
|
|
86
|
-
|
|
103
|
+
let sideGeometry = updateBufferPanelSideGeometry(
|
|
87
104
|
panelPolygon,
|
|
88
105
|
sideMesh.geometry
|
|
89
106
|
)
|
|
107
|
+
|
|
108
|
+
topMesh.geometry = topGeometry
|
|
109
|
+
sideMesh.geometry = sideGeometry
|
|
90
110
|
}
|
|
111
|
+
panelSideGeometries.push(sideMesh.geometry)
|
|
112
|
+
if (!panelTopGeometries[materialId]){
|
|
113
|
+
panelTopGeometries[materialId] = []
|
|
114
|
+
}
|
|
115
|
+
panelTopGeometries[materialId].push(topMesh.geometry)
|
|
91
116
|
topMesh.material = material
|
|
92
117
|
}
|
|
93
118
|
})
|
|
119
|
+
|
|
120
|
+
//removing unused mesh
|
|
121
|
+
const materialIds = Object.keys(panelTopGeometries)
|
|
122
|
+
const materialIdsToRemove = Object.keys(this.mergedPanelTopMeshes).filter(
|
|
123
|
+
(key) => !materialIds.includes(key)
|
|
124
|
+
)
|
|
125
|
+
for (let materialId of materialIdsToRemove) {
|
|
126
|
+
this.clearMesh(this.mergedPanelTopMeshes[materialId])
|
|
127
|
+
delete this.mergedPanelTopMeshes[materialId]
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
this.updateOrCreateMergedMesh(
|
|
131
|
+
this.mergedPanelSideMesh,
|
|
132
|
+
panelSideGeometries,
|
|
133
|
+
this.material.panelSide
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
for (let [key, geometries] of Object.entries(panelTopGeometries)) {
|
|
137
|
+
this.updateOrCreateMergedMesh(
|
|
138
|
+
this.mergedPanelTopMeshes[key],
|
|
139
|
+
geometries,
|
|
140
|
+
this.material.panel[key]
|
|
141
|
+
)
|
|
142
|
+
}
|
|
94
143
|
}
|
|
95
144
|
}
|
|
96
145
|
}
|
|
@@ -10,6 +10,11 @@ import {
|
|
|
10
10
|
} from '@eturnity/eturnity_maths'
|
|
11
11
|
|
|
12
12
|
export default {
|
|
13
|
+
data() {
|
|
14
|
+
return {
|
|
15
|
+
mergedRoofMesh: null
|
|
16
|
+
}
|
|
17
|
+
},
|
|
13
18
|
methods: {
|
|
14
19
|
updateRoofGeometry(geometry, roofPolygon) {
|
|
15
20
|
const roofOutline = roofPolygon.outline
|
|
@@ -72,22 +77,13 @@ export default {
|
|
|
72
77
|
|
|
73
78
|
applyTextureOnRoofs(material = this.material.roof) {
|
|
74
79
|
this.reorderRoofMaterials()
|
|
75
|
-
this.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
this.applyTextureOnMesh(material, mesh)
|
|
79
|
-
//obstacle on roof
|
|
80
|
-
roof.holes
|
|
81
|
-
.filter((p) => p.layer == 'obstacle')
|
|
82
|
-
.forEach((obstacle) => {
|
|
83
|
-
let meshObstacle =
|
|
84
|
-
this.meshes.obstacleMeshes[obstacle.id + '-' + roof.id + '_top']
|
|
85
|
-
this.applyTextureOnMesh(material, meshObstacle)
|
|
86
|
-
})
|
|
87
|
-
})
|
|
80
|
+
if (this.mergedRoofMesh) {
|
|
81
|
+
this.applyTextureOnMesh(material, this.mergedRoofMesh)
|
|
82
|
+
}
|
|
88
83
|
},
|
|
89
84
|
renderRoofs() {
|
|
90
85
|
this.clearRemovedOnes('roofMeshes')
|
|
86
|
+
let roofGeometries = []
|
|
91
87
|
this.roofs.forEach((roofPolygon) => {
|
|
92
88
|
let mesh
|
|
93
89
|
let geometry
|
|
@@ -100,17 +96,16 @@ export default {
|
|
|
100
96
|
mesh = this.meshes.roofMeshes[roofPolygon.id]
|
|
101
97
|
geometry = mesh.geometry
|
|
102
98
|
geometry = this.updateRoofGeometry(geometry, roofPolygon)
|
|
99
|
+
|
|
103
100
|
//in order to be able to render multiple material on it (background and image overlay)
|
|
104
101
|
|
|
105
102
|
mesh.geometry = geometry
|
|
106
|
-
this.applyTextureOnMesh(this.material.roof, mesh)
|
|
107
|
-
mesh.frustumCulled = false
|
|
108
103
|
mesh.updateMatrix()
|
|
109
104
|
}
|
|
105
|
+
|
|
110
106
|
if (!this.meshes.roofMeshes[roofPolygon.id]) {
|
|
111
107
|
//create
|
|
112
108
|
geometry = this.createRoofGeometry(roofPolygon)
|
|
113
|
-
|
|
114
109
|
if (geometry) {
|
|
115
110
|
mesh = new THREE.Mesh(geometry, this.material.roof)
|
|
116
111
|
mesh.userData.version = roofPolygon.version
|
|
@@ -118,19 +113,22 @@ export default {
|
|
|
118
113
|
mesh.userData.meshId = roofPolygon.id
|
|
119
114
|
mesh.userData.polygonId = roofPolygon.id
|
|
120
115
|
mesh.matrixAutoUpdate = false
|
|
121
|
-
this.scene.add(mesh)
|
|
122
|
-
this.applyTextureOnMesh(this.material.roof, mesh)
|
|
123
|
-
mesh.frustumCulled = false
|
|
124
116
|
this.meshes.roofMeshes[roofPolygon.id] = mesh
|
|
125
117
|
}
|
|
126
118
|
}
|
|
119
|
+
roofGeometries.push(this.meshes.roofMeshes[roofPolygon.id].geometry)
|
|
127
120
|
})
|
|
121
|
+
// Create the mesh using the merged geometry and shared material
|
|
122
|
+
this.updateOrCreateMergedMesh(
|
|
123
|
+
this.mergedRoofMesh,
|
|
124
|
+
roofGeometries,
|
|
125
|
+
this.material.roof
|
|
126
|
+
)
|
|
127
|
+
this.applyTextureOnMesh(this.material.roof, this.mergedRoofMesh)
|
|
128
128
|
},
|
|
129
129
|
renderFlatRoofs() {
|
|
130
|
-
//this.clearRemovedOnes('flatRoofMeshes')
|
|
131
130
|
this.clearByType('flatRoofMeshes')
|
|
132
131
|
this.roofs.forEach((roofPolygon) => {
|
|
133
|
-
//if(this.meshes.flatRoofMeshes[roofPolygon.id])
|
|
134
132
|
if (roofPolygon.maximumGap < maximumGapLimit) return
|
|
135
133
|
let geometry = getBufferRoofGeometry(roofPolygon.flatOutline)
|
|
136
134
|
if (geometry) {
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
tileToCorners
|
|
10
10
|
} from '@eturnity/eturnity_maths'
|
|
11
11
|
import { earthRadius } from '../../config'
|
|
12
|
+
import { debounce } from 'lodash'
|
|
12
13
|
|
|
13
14
|
import { cancellablePromise } from '../../utils/cancellablePromise'
|
|
14
15
|
|
|
@@ -19,6 +20,9 @@ export default {
|
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
22
|
methods: {
|
|
23
|
+
debouncedRenderTiles: debounce(function () {
|
|
24
|
+
this.renderTiles()
|
|
25
|
+
}, 1000),
|
|
22
26
|
async renderTiles() {
|
|
23
27
|
if (
|
|
24
28
|
!this.selectedMapLayer ||
|
|
@@ -72,8 +76,7 @@ export default {
|
|
|
72
76
|
earthRadius * Math.cos((latitude * Math.PI) / 180) * 2000 * Math.PI
|
|
73
77
|
|
|
74
78
|
let optimizedZoomLvl =
|
|
75
|
-
Math.round(Math.log(perimeterAtLatitude / (xMax - xMin)) / Math.LN2)
|
|
76
|
-
1
|
|
79
|
+
Math.round(Math.log(perimeterAtLatitude / (xMax - xMin)) / Math.LN2)
|
|
77
80
|
if (optimizedZoomLvl < zoomLvl) {
|
|
78
81
|
zoomLvl = optimizedZoomLvl
|
|
79
82
|
}
|
|
@@ -229,8 +232,8 @@ export default {
|
|
|
229
232
|
this.scene.add(mesh)
|
|
230
233
|
}
|
|
231
234
|
}
|
|
232
|
-
//image.parentNode.removeChild(image);
|
|
233
235
|
this.removeTileFromPending(meshId, mapLayer)
|
|
236
|
+
this.render()
|
|
234
237
|
})
|
|
235
238
|
},
|
|
236
239
|
async renderGoogleTiles() {
|
|
@@ -254,6 +257,7 @@ export default {
|
|
|
254
257
|
googleMapType = 'terrain'
|
|
255
258
|
break
|
|
256
259
|
}
|
|
260
|
+
let size = 640
|
|
257
261
|
let roofsBoundZoomLvl = 19
|
|
258
262
|
let { xMin, xMax, yMin, yMax } = this.roofsBounds
|
|
259
263
|
if (xMin == Infinity) {
|
|
@@ -261,14 +265,26 @@ export default {
|
|
|
261
265
|
yMin = 0
|
|
262
266
|
xMax = 0
|
|
263
267
|
yMax = 0
|
|
268
|
+
} else {
|
|
269
|
+
let roofBoundSizeInMeter = Math.max(xMax - xMin, yMax - yMin) / 1000
|
|
270
|
+
|
|
271
|
+
let exactZoomLvl = Math.log2(
|
|
272
|
+
(Math.cos((this.layoutSettings.layout_latitude * Math.PI) / 180) *
|
|
273
|
+
2 *
|
|
274
|
+
Math.PI *
|
|
275
|
+
earthRadius *
|
|
276
|
+
size) /
|
|
277
|
+
(256 * roofBoundSizeInMeter)
|
|
278
|
+
)
|
|
279
|
+
roofsBoundZoomLvl = Math.min(roofsBoundZoomLvl, parseInt(exactZoomLvl))
|
|
264
280
|
}
|
|
265
281
|
let roofsBoundCenterMeter = {
|
|
266
282
|
x: (xMax + xMin) / 2000,
|
|
267
283
|
y: (yMax + yMin) / 2000
|
|
268
284
|
}
|
|
269
285
|
let deltaLatLng = distanceToDeltaLatLng(
|
|
270
|
-
roofsBoundCenterMeter.x*1000,
|
|
271
|
-
roofsBoundCenterMeter.y*1000,
|
|
286
|
+
roofsBoundCenterMeter.x * 1000,
|
|
287
|
+
roofsBoundCenterMeter.y * 1000,
|
|
272
288
|
this.layoutSettings.layout_latitude
|
|
273
289
|
)
|
|
274
290
|
let roofsBoundCenterLatLng = {
|
|
@@ -278,7 +294,7 @@ export default {
|
|
|
278
294
|
|
|
279
295
|
let apiKey = process.env.VUE_APP_GOOGLE_MAP_API_KEY
|
|
280
296
|
let backgroundPlane = []
|
|
281
|
-
|
|
297
|
+
|
|
282
298
|
let planeGeometry = []
|
|
283
299
|
let planeMaterial = []
|
|
284
300
|
let texture = []
|
|
@@ -299,8 +315,8 @@ export default {
|
|
|
299
315
|
2 *
|
|
300
316
|
Math.PI *
|
|
301
317
|
earthRadius) /
|
|
302
|
-
( Math.pow(2, zoomLevel))
|
|
303
|
-
let sizeInMeter = groundResolution * size
|
|
318
|
+
(256 * Math.pow(2, zoomLevel))
|
|
319
|
+
let sizeInMeter = groundResolution * size
|
|
304
320
|
planeGeometry[indexGoogleBackground] = new THREE.PlaneGeometry(
|
|
305
321
|
sizeInMeter,
|
|
306
322
|
sizeInMeter * 0.9
|
|
@@ -324,7 +340,6 @@ export default {
|
|
|
324
340
|
)
|
|
325
341
|
texture[indexGoogleBackground].wrapS = 1 //THREE.RepeatWrapping
|
|
326
342
|
texture[indexGoogleBackground].wrapT = 1 //THREE.RepeatWrapping
|
|
327
|
-
// texture[indexGoogleBackground].offset.y += 0.1
|
|
328
343
|
|
|
329
344
|
if (indexGoogleBackground == 0) {
|
|
330
345
|
this.newGoogleTileMaterial(
|
|
@@ -349,85 +364,10 @@ export default {
|
|
|
349
364
|
backgroundPlane[indexGoogleBackground].position.z =
|
|
350
365
|
-indexGoogleBackground / 2
|
|
351
366
|
this.backgroundMap.add(backgroundPlane[indexGoogleBackground])
|
|
367
|
+
backgroundPlane[indexGoogleBackground].needsUpdate = true
|
|
352
368
|
}
|
|
353
369
|
this.scene.add(this.backgroundMap)
|
|
354
|
-
|
|
355
|
-
async renderGoogleTilesCenter() {
|
|
356
|
-
this.clearByType('tileMeshes')
|
|
357
|
-
if (this.backgroundMap) {
|
|
358
|
-
this.backgroundMap.clear()
|
|
359
|
-
this.scene.remove(this.backgroundMap)
|
|
360
|
-
this.clearThreeObjects(this.backgroundMap)
|
|
361
|
-
}
|
|
362
|
-
this.backgroundMap = new THREE.Group()
|
|
363
|
-
|
|
364
|
-
let googleMapType = 'satellite'
|
|
365
|
-
switch (this.selectedMapLayer.key) {
|
|
366
|
-
case 'googleLayerRoadmap':
|
|
367
|
-
googleMapType = 'roadmap'
|
|
368
|
-
break
|
|
369
|
-
case 'googleLayer':
|
|
370
|
-
googleMapType = 'satellite'
|
|
371
|
-
break
|
|
372
|
-
case 'googleLayerTerrain':
|
|
373
|
-
googleMapType = 'terrain'
|
|
374
|
-
break
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
let apiKey = process.env.VUE_APP_GOOGLE_MAP_API_KEY
|
|
378
|
-
let backgroundPlane = []
|
|
379
|
-
let size = 640
|
|
380
|
-
let planeGeometry = []
|
|
381
|
-
let planeMaterial = []
|
|
382
|
-
let texture = []
|
|
383
|
-
let zoomLevels = [19, 16]
|
|
384
|
-
|
|
385
|
-
for (
|
|
386
|
-
let indexGoogleBackground = 0;
|
|
387
|
-
indexGoogleBackground < zoomLevels.length;
|
|
388
|
-
indexGoogleBackground++
|
|
389
|
-
) {
|
|
390
|
-
let zoomLevel = zoomLevels[indexGoogleBackground]
|
|
391
|
-
let groundResolution =
|
|
392
|
-
(Math.cos((this.layoutSettings.layout_latitude * Math.PI) / 180) *
|
|
393
|
-
2 *
|
|
394
|
-
Math.PI *
|
|
395
|
-
earthRadius) /
|
|
396
|
-
(256 * Math.pow(2, zoomLevel))
|
|
397
|
-
let sizeInMeter = groundResolution * size
|
|
398
|
-
planeGeometry[indexGoogleBackground] = new THREE.PlaneGeometry(
|
|
399
|
-
sizeInMeter,
|
|
400
|
-
sizeInMeter
|
|
401
|
-
)
|
|
402
|
-
let googleBackgroundUrl = `https://maps.googleapis.com/maps/api/staticmap?center=${
|
|
403
|
-
this.layoutSettings.layout_latitude +
|
|
404
|
-
',' +
|
|
405
|
-
this.layoutSettings.layout_longitude
|
|
406
|
-
}&maptype=${googleMapType}&zoom=${zoomLevel}&size=${size}x${size}&key=${apiKey}`
|
|
407
|
-
|
|
408
|
-
texture[indexGoogleBackground] = await this.loader.load(
|
|
409
|
-
googleBackgroundUrl
|
|
410
|
-
)
|
|
411
|
-
if (indexGoogleBackground == 0) {
|
|
412
|
-
this.newGoogleTileMaterial(
|
|
413
|
-
texture[indexGoogleBackground],
|
|
414
|
-
sizeInMeter,
|
|
415
|
-
googleMapType
|
|
416
|
-
)
|
|
417
|
-
}
|
|
418
|
-
planeMaterial[indexGoogleBackground] = new THREE.MeshBasicMaterial({
|
|
419
|
-
map: texture[indexGoogleBackground],
|
|
420
|
-
side: THREE.DoubleSide
|
|
421
|
-
})
|
|
422
|
-
backgroundPlane[indexGoogleBackground] = new THREE.Mesh(
|
|
423
|
-
planeGeometry[indexGoogleBackground],
|
|
424
|
-
planeMaterial[indexGoogleBackground]
|
|
425
|
-
)
|
|
426
|
-
backgroundPlane[indexGoogleBackground].position.z =
|
|
427
|
-
-indexGoogleBackground / 2
|
|
428
|
-
this.backgroundMap.add(backgroundPlane[indexGoogleBackground])
|
|
429
|
-
}
|
|
430
|
-
this.scene.add(this.backgroundMap)
|
|
370
|
+
this.render()
|
|
431
371
|
}
|
|
432
372
|
},
|
|
433
373
|
watch: {
|
|
@@ -22,8 +22,6 @@ export default {
|
|
|
22
22
|
100,
|
|
23
23
|
10000
|
|
24
24
|
)
|
|
25
|
-
// cameraProjection.position.set(0, 0, 1)
|
|
26
|
-
// cameraProjection.up.set(0, 0, 1)
|
|
27
25
|
let tileProjectionMaterial = new ProjectedMaterial({
|
|
28
26
|
camera: cameraProjection,
|
|
29
27
|
texture: texture,
|
|
@@ -45,6 +43,7 @@ export default {
|
|
|
45
43
|
tileProjectionMaterial.userData.priority = 10
|
|
46
44
|
this.material.roof.push(tileProjectionMaterial)
|
|
47
45
|
this.applyTextureOnRoofs()
|
|
46
|
+
this.applyTextureOnObstacles()
|
|
48
47
|
},
|
|
49
48
|
async newTileMaterial(texture, x, y, zoom, mapLayer) {
|
|
50
49
|
if (!this.material.roof) {
|
|
@@ -75,6 +74,7 @@ export default {
|
|
|
75
74
|
this.setTileCameraPosition(cameraProjection, x, y, zoom)
|
|
76
75
|
this.material.roof.push(tileProjectionMaterial)
|
|
77
76
|
this.applyTextureOnRoofs()
|
|
77
|
+
this.applyTextureOnObstacles()
|
|
78
78
|
},
|
|
79
79
|
disposeTileMaterial(material) {
|
|
80
80
|
material.texture.dispose()
|
|
@@ -27,7 +27,6 @@ export default {
|
|
|
27
27
|
tileMeshes: {}
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
-
|
|
31
30
|
computed: {
|
|
32
31
|
...mapState({
|
|
33
32
|
moduleTextureVersionId: (state) =>
|
|
@@ -76,7 +75,6 @@ export default {
|
|
|
76
75
|
let methodList = []
|
|
77
76
|
if (this.fullRenderNeeded) {
|
|
78
77
|
methodList = this.renderingMethodsByEvent({ name: 'full' })
|
|
79
|
-
this.renderMethods(methodList)
|
|
80
78
|
} else {
|
|
81
79
|
for (let geometryEvent of this.geometryEventsToDo) {
|
|
82
80
|
for (let renderingMethod of this.renderingMethodsByEvent(
|
|
@@ -87,9 +85,10 @@ export default {
|
|
|
87
85
|
}
|
|
88
86
|
}
|
|
89
87
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
}
|
|
89
|
+
if (methodList.length) {
|
|
90
|
+
this.renderMethods(methodList)
|
|
91
|
+
this.render()
|
|
93
92
|
}
|
|
94
93
|
|
|
95
94
|
this.lastGeometryEventIdDone = this.lastGeometryEventId
|
|
@@ -193,6 +192,11 @@ export default {
|
|
|
193
192
|
})
|
|
194
193
|
break
|
|
195
194
|
case 'changeMapProjection':
|
|
195
|
+
methodList.push({
|
|
196
|
+
name: 'renderTiles',
|
|
197
|
+
method: this.debouncedRenderTiles,
|
|
198
|
+
arg: []
|
|
199
|
+
})
|
|
196
200
|
methodList.push({
|
|
197
201
|
name: 'changeMapProjection',
|
|
198
202
|
method: this.changeMapProjection,
|
|
@@ -203,11 +207,6 @@ export default {
|
|
|
203
207
|
method: this.applyTextureOnRoofs,
|
|
204
208
|
arg: []
|
|
205
209
|
})
|
|
206
|
-
methodList.push({
|
|
207
|
-
name: 'renderTiles',
|
|
208
|
-
method: this.renderTiles,
|
|
209
|
-
arg: []
|
|
210
|
-
})
|
|
211
210
|
break
|
|
212
211
|
// methodList.push({
|
|
213
212
|
// name: 'removeImageOverlay',
|
package/src/helper/threeMixin.js
CHANGED
|
@@ -14,7 +14,6 @@ export default {
|
|
|
14
14
|
// Add Sky
|
|
15
15
|
let sky = new Sky()
|
|
16
16
|
sky.scale.setScalar(450000)
|
|
17
|
-
// sky.rotateX( - Math.PI / 2 );
|
|
18
17
|
this.scene.add(sky)
|
|
19
18
|
this.clearThreeObjects(sky)
|
|
20
19
|
let sun = new THREE.Vector3()
|
|
@@ -36,7 +35,6 @@ export default {
|
|
|
36
35
|
sun = null
|
|
37
36
|
},
|
|
38
37
|
initialiseThree(isInteractive = true) {
|
|
39
|
-
//this.loader.crossOrigin = null
|
|
40
38
|
|
|
41
39
|
this.scene.background = new THREE.Color(0xb0b0b0)
|
|
42
40
|
|
|
@@ -68,7 +66,6 @@ export default {
|
|
|
68
66
|
this.scene.add(directionalLight)
|
|
69
67
|
this.scene.add(directionalLight2)
|
|
70
68
|
|
|
71
|
-
// this.renderer.setClearColor('#ffffff');
|
|
72
69
|
this.renderer.setPixelRatio(window.devicePixelRatio)
|
|
73
70
|
this.renderer.toneMappingExposure = 0.01
|
|
74
71
|
this.$refs.canvas3DContainer.appendChild(this.renderer.domElement)
|
|
@@ -82,12 +79,27 @@ export default {
|
|
|
82
79
|
)
|
|
83
80
|
this.orbitControl.maxPolarAngle = (Math.PI / 2) * (87 / 90)
|
|
84
81
|
}
|
|
82
|
+
this.orbitControl.addEventListener('change', () => {
|
|
83
|
+
this.orbitControlChange()
|
|
84
|
+
})
|
|
85
85
|
window.addEventListener('resize', this.onWindowResize, false)
|
|
86
86
|
|
|
87
87
|
ambientLight.dispose()
|
|
88
88
|
directionalLight.dispose()
|
|
89
89
|
directionalLight2.dispose()
|
|
90
90
|
},
|
|
91
|
+
orbitControlChange() {
|
|
92
|
+
if (this.orbitControl.target.z != 0) {
|
|
93
|
+
this.orbitControl.target.set(
|
|
94
|
+
this.orbitControl.target.x,
|
|
95
|
+
this.orbitControl.target.y,
|
|
96
|
+
0
|
|
97
|
+
)
|
|
98
|
+
this.orbitControl.update()
|
|
99
|
+
} else {
|
|
100
|
+
this.render()
|
|
101
|
+
}
|
|
102
|
+
},
|
|
91
103
|
onWindowResize() {
|
|
92
104
|
this.camera.aspect = window.innerWidth / window.innerHeight
|
|
93
105
|
this.camera.updateProjectionMatrix()
|
|
@@ -95,7 +107,6 @@ export default {
|
|
|
95
107
|
this.canvasHeight = this.$refs.canvas3DContainer.clientHeight
|
|
96
108
|
this.canvasWidth = this.$refs.canvas3DContainer.clientWidth
|
|
97
109
|
this.resizeCanvasToDisplaySize()
|
|
98
|
-
//this.renderer.setSize(window.innerWidth / 2, window.innerHeight / 2)
|
|
99
110
|
},
|
|
100
111
|
resizeCanvasToDisplaySize() {
|
|
101
112
|
const canvas = this.renderer.domElement
|