@eturnity/eturnity_3d 6.34.6 → 6.34.7
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 -2
- package/src/components/ThreeCanvasViewer.vue +14 -21
- package/src/helper/materialMixin.js +10 -7
- package/src/helper/render/base.js +14 -5
- package/src/helper/render/imageOverlay.js +4 -4
- package/src/helper/render/index.js +3 -3
- package/src/helper/render/loader.js +4 -4
- package/src/helper/render/mergedGeometry.js +108 -0
- package/src/helper/render/obstacle.js +38 -8
- package/src/helper/render/panel.js +82 -14
- package/src/helper/render/projectionMaterial.js +2 -28
- package/src/helper/render/roof.js +24 -24
- package/src/helper/render/texture.js +3 -0
- package/src/helper/render/tile.js +92 -63
- package/src/helper/render/tileProjection.js +3 -3
- package/src/helper/renderMixin.js +105 -43
- package/src/helper/threeMixin.js +15 -4
- package/src/helper/MapView.js +0 -221
- package/src/helper/materials.js +0 -77
- package/src/helper/render/mapProjection.js +0 -100
|
@@ -8,8 +8,13 @@ import {
|
|
|
8
8
|
intersectOutlines,
|
|
9
9
|
verticalProjectionOnPlane
|
|
10
10
|
} from '@eturnity/eturnity_maths'
|
|
11
|
-
|
|
11
|
+
import {debounce} from 'lodash'
|
|
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
|
|
@@ -70,24 +75,17 @@ export default {
|
|
|
70
75
|
return geometry
|
|
71
76
|
},
|
|
72
77
|
|
|
73
|
-
applyTextureOnRoofs(
|
|
78
|
+
applyTextureOnRoofs(){
|
|
79
|
+
const material=this.material.roof
|
|
74
80
|
this.reorderRoofMaterials()
|
|
75
|
-
this.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
})
|
|
81
|
+
if (this.mergedRoofMesh) {
|
|
82
|
+
this.applyTextureOnMesh(material, this.mergedRoofMesh)
|
|
83
|
+
this.render()
|
|
84
|
+
}
|
|
88
85
|
},
|
|
89
86
|
renderRoofs() {
|
|
90
87
|
this.clearRemovedOnes('roofMeshes')
|
|
88
|
+
let roofGeometries = []
|
|
91
89
|
this.roofs.forEach((roofPolygon) => {
|
|
92
90
|
let mesh
|
|
93
91
|
let geometry
|
|
@@ -98,19 +96,18 @@ export default {
|
|
|
98
96
|
) {
|
|
99
97
|
//update mesh
|
|
100
98
|
mesh = this.meshes.roofMeshes[roofPolygon.id]
|
|
99
|
+
mesh.userData.version = roofPolygon.version
|
|
101
100
|
geometry = mesh.geometry
|
|
102
101
|
geometry = this.updateRoofGeometry(geometry, roofPolygon)
|
|
103
|
-
//in order to be able to render multiple material on it (background and image overlay)
|
|
104
102
|
|
|
103
|
+
//in order to be able to render multiple material on it (background and image overlay)
|
|
105
104
|
mesh.geometry = geometry
|
|
106
|
-
this.applyTextureOnMesh(this.material.roof, mesh)
|
|
107
|
-
mesh.frustumCulled = false
|
|
108
105
|
mesh.updateMatrix()
|
|
109
106
|
}
|
|
107
|
+
|
|
110
108
|
if (!this.meshes.roofMeshes[roofPolygon.id]) {
|
|
111
109
|
//create
|
|
112
110
|
geometry = this.createRoofGeometry(roofPolygon)
|
|
113
|
-
|
|
114
111
|
if (geometry) {
|
|
115
112
|
mesh = new THREE.Mesh(geometry, this.material.roof)
|
|
116
113
|
mesh.userData.version = roofPolygon.version
|
|
@@ -118,19 +115,22 @@ export default {
|
|
|
118
115
|
mesh.userData.meshId = roofPolygon.id
|
|
119
116
|
mesh.userData.polygonId = roofPolygon.id
|
|
120
117
|
mesh.matrixAutoUpdate = false
|
|
121
|
-
this.scene.add(mesh)
|
|
122
|
-
this.applyTextureOnMesh(this.material.roof, mesh)
|
|
123
|
-
mesh.frustumCulled = false
|
|
124
118
|
this.meshes.roofMeshes[roofPolygon.id] = mesh
|
|
125
119
|
}
|
|
126
120
|
}
|
|
121
|
+
roofGeometries.push(this.meshes.roofMeshes[roofPolygon.id].geometry)
|
|
127
122
|
})
|
|
123
|
+
// Create the mesh using the merged geometry and shared material
|
|
124
|
+
this.mergedRoofMesh = this.updateOrCreateMergedMesh(
|
|
125
|
+
this.mergedRoofMesh,
|
|
126
|
+
roofGeometries,
|
|
127
|
+
this.material.roof
|
|
128
|
+
)
|
|
129
|
+
this.applyTextureOnMesh(this.material.roof, this.mergedRoofMesh)
|
|
128
130
|
},
|
|
129
131
|
renderFlatRoofs() {
|
|
130
|
-
//this.clearRemovedOnes('flatRoofMeshes')
|
|
131
132
|
this.clearByType('flatRoofMeshes')
|
|
132
133
|
this.roofs.forEach((roofPolygon) => {
|
|
133
|
-
//if(this.meshes.flatRoofMeshes[roofPolygon.id])
|
|
134
134
|
if (roofPolygon.maximumGap < maximumGapLimit) return
|
|
135
135
|
let geometry = getBufferRoofGeometry(roofPolygon.flatOutline)
|
|
136
136
|
if (geometry) {
|
|
@@ -7,10 +7,13 @@ export default {
|
|
|
7
7
|
for (let k = 0; k < materials.length; k++) {
|
|
8
8
|
geometry.addGroup(0, Infinity, k)
|
|
9
9
|
}
|
|
10
|
+
geometry.needsUpdate = true
|
|
10
11
|
mesh.material = materials
|
|
11
12
|
for (let m = 0; m < materials.length; m++) {
|
|
12
13
|
if (materials[m].project) {
|
|
13
14
|
materials[m].project(mesh)
|
|
15
|
+
materials[m].needsUpdate = true
|
|
16
|
+
mesh.needsUpdate = true
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
19
|
}
|
|
@@ -16,7 +16,11 @@ import { cancellablePromise } from '../../utils/cancellablePromise'
|
|
|
16
16
|
export default {
|
|
17
17
|
data() {
|
|
18
18
|
return {
|
|
19
|
-
|
|
19
|
+
googleBackgroundMap: null,
|
|
20
|
+
pendingTiles: [],
|
|
21
|
+
numberOfTilesRendered: 0,
|
|
22
|
+
numberOfTilesToRender: 0,
|
|
23
|
+
tileToRender: []
|
|
20
24
|
}
|
|
21
25
|
},
|
|
22
26
|
methods: {
|
|
@@ -35,8 +39,8 @@ export default {
|
|
|
35
39
|
this.renderProviderTiles()
|
|
36
40
|
}
|
|
37
41
|
},
|
|
38
|
-
removeUnusedTiles(
|
|
39
|
-
let tileToRenderIds = tileToRender.map(
|
|
42
|
+
removeUnusedTiles() {
|
|
43
|
+
let tileToRenderIds = this.tileToRender.map(
|
|
40
44
|
(tileParam) =>
|
|
41
45
|
'tile_' +
|
|
42
46
|
tileParam.xTile +
|
|
@@ -53,13 +57,11 @@ export default {
|
|
|
53
57
|
}
|
|
54
58
|
},
|
|
55
59
|
async renderProviderTiles() {
|
|
56
|
-
if (this.
|
|
57
|
-
this.
|
|
58
|
-
this.scene.remove(this.
|
|
59
|
-
this.clearThreeObjects(this.
|
|
60
|
+
if (this.googleBackgroundMap) {
|
|
61
|
+
this.googleBackgroundMap.clear()
|
|
62
|
+
this.scene.remove(this.googleBackgroundMap)
|
|
63
|
+
this.clearThreeObjects(this.googleBackgroundMap)
|
|
60
64
|
}
|
|
61
|
-
this.backgroundMap = new THREE.Group()
|
|
62
|
-
|
|
63
65
|
let zoomLvl = this.provider.maxZoom
|
|
64
66
|
|
|
65
67
|
const latitude = this.layoutSettings.layout_latitude
|
|
@@ -75,9 +77,9 @@ export default {
|
|
|
75
77
|
let perimeterAtLatitude =
|
|
76
78
|
earthRadius * Math.cos((latitude * Math.PI) / 180) * 2000 * Math.PI
|
|
77
79
|
|
|
78
|
-
let optimizedZoomLvl =
|
|
79
|
-
Math.
|
|
80
|
-
|
|
80
|
+
let optimizedZoomLvl = Math.round(
|
|
81
|
+
Math.log(perimeterAtLatitude / (xMax - xMin)) / Math.LN2
|
|
82
|
+
)
|
|
81
83
|
if (optimizedZoomLvl < zoomLvl) {
|
|
82
84
|
zoomLvl = optimizedZoomLvl
|
|
83
85
|
}
|
|
@@ -106,10 +108,15 @@ export default {
|
|
|
106
108
|
xTileMax = xTileMax + 1 - (xTileMax % 2)
|
|
107
109
|
yTileMin = yTileMin - (yTileMin % 2)
|
|
108
110
|
yTileMax = yTileMax + 1 - (yTileMax % 2)
|
|
109
|
-
|
|
111
|
+
this.tileToRender = []
|
|
110
112
|
for (let xTile = xTileMin; xTile <= xTileMax; xTile++) {
|
|
111
113
|
for (let yTile = yTileMin; yTile <= yTileMax; yTile++) {
|
|
112
|
-
tileToRender.push({
|
|
114
|
+
this.tileToRender.push({
|
|
115
|
+
xTile,
|
|
116
|
+
yTile,
|
|
117
|
+
zoomLvl,
|
|
118
|
+
isTileOnRoofBound: true
|
|
119
|
+
})
|
|
113
120
|
}
|
|
114
121
|
}
|
|
115
122
|
|
|
@@ -136,7 +143,7 @@ export default {
|
|
|
136
143
|
yTile - yTileMin <= yMinOdd ||
|
|
137
144
|
yTileMax - yTile <= yMaxEven
|
|
138
145
|
) {
|
|
139
|
-
tileToRender.push({
|
|
146
|
+
this.tileToRender.push({
|
|
140
147
|
xTile,
|
|
141
148
|
yTile,
|
|
142
149
|
zoomLvl,
|
|
@@ -146,12 +153,13 @@ export default {
|
|
|
146
153
|
}
|
|
147
154
|
}
|
|
148
155
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
let
|
|
153
|
-
|
|
154
|
-
|
|
156
|
+
this.numberOfTilesToRender = this.tileToRender.length
|
|
157
|
+
this.numberOfTilesRendered = 0
|
|
158
|
+
for (let k in this.tileToRender) {
|
|
159
|
+
let xTile = this.tileToRender[k].xTile
|
|
160
|
+
let yTile = this.tileToRender[k].yTile
|
|
161
|
+
zoomLvl = this.tileToRender[k].zoomLvl
|
|
162
|
+
let isTileOnRoofBound = this.tileToRender[k].isTileOnRoofBound
|
|
155
163
|
this.renderTile(xTile, yTile, zoomLvl, isTileOnRoofBound)
|
|
156
164
|
}
|
|
157
165
|
},
|
|
@@ -194,8 +202,6 @@ export default {
|
|
|
194
202
|
}
|
|
195
203
|
texture.generateMipmaps = false
|
|
196
204
|
texture.format = THREE.RGBAFormat
|
|
197
|
-
texture.magFilter = THREE.LinearFilter
|
|
198
|
-
texture.minFilter = THREE.LinearFilter
|
|
199
205
|
texture.needsUpdate = true
|
|
200
206
|
let corners = tileToCorners(x, y, zoomLvl, latitude, longitude)
|
|
201
207
|
corners = corners.map((c) => {
|
|
@@ -229,23 +235,33 @@ export default {
|
|
|
229
235
|
mesh.userData.type = 'tileMeshes'
|
|
230
236
|
mesh.userData.meshId = meshId
|
|
231
237
|
mesh.userData.mapLayer = this.provider.mapLayer
|
|
232
|
-
|
|
233
|
-
|
|
238
|
+
mesh.name = meshId
|
|
239
|
+
|
|
240
|
+
if (!this.scene.getObjectByName(meshId)) {
|
|
241
|
+
this.meshes.tileMeshes[meshId] = mesh
|
|
242
|
+
this.scene.add(this.meshes.tileMeshes[meshId])
|
|
243
|
+
}
|
|
234
244
|
}
|
|
235
245
|
}
|
|
236
|
-
//image.parentNode.removeChild(image);
|
|
237
246
|
this.removeTileFromPending(meshId, mapLayer)
|
|
247
|
+
this.numberOfTilesRendered++
|
|
248
|
+
if (this.numberOfTilesRendered == this.numberOfTilesToRender) {
|
|
249
|
+
this.removeUnusedTiles()
|
|
250
|
+
this.render()
|
|
251
|
+
}
|
|
238
252
|
})
|
|
239
253
|
},
|
|
240
254
|
async renderGoogleTiles() {
|
|
241
255
|
this.clearByType('tileMeshes')
|
|
242
|
-
if (this.
|
|
243
|
-
this.
|
|
244
|
-
this.scene.
|
|
245
|
-
|
|
256
|
+
if (!this.googleBackgroundMap) {
|
|
257
|
+
this.googleBackgroundMap = new THREE.Group()
|
|
258
|
+
this.scene.add(this.googleBackgroundMap)
|
|
259
|
+
}
|
|
260
|
+
this.googleBackgroundMap.visible = true
|
|
261
|
+
this.googleBackgroundMap.name = 'googleBackgroundMap'
|
|
262
|
+
if (!this.scene.getObjectByName('googleBackgroundMap')) {
|
|
263
|
+
this.scene.add(this.googleBackgroundMap)
|
|
246
264
|
}
|
|
247
|
-
this.backgroundMap = new THREE.Group()
|
|
248
|
-
|
|
249
265
|
let googleMapType = 'satellite'
|
|
250
266
|
switch (this.selectedMapLayer.key) {
|
|
251
267
|
case 'googleLayerRoadmap':
|
|
@@ -298,13 +314,12 @@ export default {
|
|
|
298
314
|
|
|
299
315
|
let planeGeometry = []
|
|
300
316
|
let planeMaterial = []
|
|
301
|
-
let texture = []
|
|
302
317
|
let zoomLevels = [
|
|
303
318
|
roofsBoundZoomLvl,
|
|
304
319
|
roofsBoundZoomLvl - 2,
|
|
305
320
|
roofsBoundZoomLvl - 4
|
|
306
321
|
]
|
|
307
|
-
|
|
322
|
+
this.numberOfTilesToRender = zoomLevels.length
|
|
308
323
|
for (
|
|
309
324
|
let indexGoogleBackground = 0;
|
|
310
325
|
indexGoogleBackground < zoomLevels.length;
|
|
@@ -336,39 +351,53 @@ export default {
|
|
|
336
351
|
let googleBackgroundUrl = `https://maps.googleapis.com/maps/api/staticmap?center=${
|
|
337
352
|
roofsBoundCenterLatLng.lat + ',' + roofsBoundCenterLatLng.lng
|
|
338
353
|
}&maptype=${googleMapType}&zoom=${zoomLevel}&size=${size}x${size}&key=${apiKey}`
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
)
|
|
342
|
-
texture[indexGoogleBackground].wrapS = 1 //THREE.RepeatWrapping
|
|
343
|
-
texture[indexGoogleBackground].wrapT = 1 //THREE.RepeatWrapping
|
|
344
|
-
// texture[indexGoogleBackground].offset.y += 0.1
|
|
354
|
+
this.loader.load(googleBackgroundUrl, (texture) => {
|
|
355
|
+
texture[indexGoogleBackground] = texture
|
|
345
356
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
357
|
+
if (indexGoogleBackground == 0) {
|
|
358
|
+
this.newGoogleTileMaterial(
|
|
359
|
+
texture[indexGoogleBackground],
|
|
360
|
+
sizeInMeter,
|
|
361
|
+
roofsBoundCenterMeter,
|
|
362
|
+
googleMapType
|
|
363
|
+
)
|
|
364
|
+
}
|
|
365
|
+
planeMaterial[indexGoogleBackground] = new THREE.MeshBasicMaterial({
|
|
366
|
+
map: texture[indexGoogleBackground],
|
|
367
|
+
side: THREE.DoubleSide
|
|
368
|
+
})
|
|
369
|
+
backgroundPlane[indexGoogleBackground] = new THREE.Mesh(
|
|
370
|
+
planeGeometry[indexGoogleBackground],
|
|
371
|
+
planeMaterial[indexGoogleBackground]
|
|
352
372
|
)
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
373
|
+
backgroundPlane[indexGoogleBackground].position.x =
|
|
374
|
+
roofsBoundCenterMeter.x
|
|
375
|
+
backgroundPlane[indexGoogleBackground].position.y =
|
|
376
|
+
roofsBoundCenterMeter.y
|
|
377
|
+
backgroundPlane[indexGoogleBackground].position.z =
|
|
378
|
+
-indexGoogleBackground / 2
|
|
379
|
+
backgroundPlane[indexGoogleBackground].visible = true
|
|
380
|
+
backgroundPlane[indexGoogleBackground].needsUpdate = true
|
|
381
|
+
backgroundPlane[indexGoogleBackground].userData.index =
|
|
382
|
+
indexGoogleBackground
|
|
383
|
+
const meshToRemove = this.googleBackgroundMap.children.find(
|
|
384
|
+
(mesh) => mesh.userData.index == indexGoogleBackground
|
|
385
|
+
)
|
|
386
|
+
if (meshToRemove) {
|
|
387
|
+
this.googleBackgroundMap.remove(meshToRemove)
|
|
388
|
+
}
|
|
389
|
+
this.googleBackgroundMap.add(backgroundPlane[indexGoogleBackground])
|
|
390
|
+
|
|
391
|
+
this.numberOfTilesRendered++
|
|
392
|
+
if (this.numberOfTilesRendered == this.numberOfTilesToRender) {
|
|
393
|
+
this.googleBackgroundMap.needsUpdate = true
|
|
394
|
+
this.googleBackgroundMap.visible = true
|
|
395
|
+
this.render()
|
|
396
|
+
}
|
|
357
397
|
})
|
|
358
|
-
backgroundPlane[indexGoogleBackground] = new THREE.Mesh(
|
|
359
|
-
planeGeometry[indexGoogleBackground],
|
|
360
|
-
planeMaterial[indexGoogleBackground]
|
|
361
|
-
)
|
|
362
|
-
backgroundPlane[indexGoogleBackground].position.x =
|
|
363
|
-
roofsBoundCenterMeter.x
|
|
364
|
-
backgroundPlane[indexGoogleBackground].position.y =
|
|
365
|
-
roofsBoundCenterMeter.y
|
|
366
|
-
backgroundPlane[indexGoogleBackground].position.z =
|
|
367
|
-
-indexGoogleBackground / 2
|
|
368
|
-
this.backgroundMap.add(backgroundPlane[indexGoogleBackground])
|
|
369
|
-
backgroundPlane[indexGoogleBackground].needsUpdate = true
|
|
370
398
|
}
|
|
371
|
-
|
|
399
|
+
|
|
400
|
+
this.render()
|
|
372
401
|
}
|
|
373
402
|
},
|
|
374
403
|
watch: {
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
methods: {
|
|
13
|
-
|
|
13
|
+
newGoogleTileMaterial(texture, sizeInMeter, center, mapLayer) {
|
|
14
14
|
if (!this.material.roof) {
|
|
15
15
|
this.material.roof = []
|
|
16
16
|
}
|
|
@@ -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()
|
|
@@ -10,24 +10,23 @@ export default {
|
|
|
10
10
|
lastTic: new Date().getTime() * 1e4,
|
|
11
11
|
//lastTic:(new Date()).getTime()
|
|
12
12
|
lastGeometryEventIdDone: -1,
|
|
13
|
-
backgroundImagesizeInMm: null
|
|
13
|
+
backgroundImagesizeInMm: null,
|
|
14
|
+
meshes : {
|
|
15
|
+
baseMeshes: {},
|
|
16
|
+
roofMeshes: {},
|
|
17
|
+
flatRoofMeshes: {},
|
|
18
|
+
obstacleMeshes: {},
|
|
19
|
+
panelsMeshes: {},
|
|
20
|
+
nodeMeshes: null,
|
|
21
|
+
edgeMeshes: {},
|
|
22
|
+
roofMarginMeshes: {},
|
|
23
|
+
moduleFieldsMeshes: {},
|
|
24
|
+
tileMeshes: {}
|
|
25
|
+
}
|
|
14
26
|
}
|
|
15
27
|
},
|
|
16
28
|
created() {
|
|
17
|
-
this.meshes = {
|
|
18
|
-
baseMeshes: {},
|
|
19
|
-
roofMeshes: {},
|
|
20
|
-
flatRoofMeshes: {},
|
|
21
|
-
obstacleMeshes: {},
|
|
22
|
-
panelsMeshes: {},
|
|
23
|
-
nodeMeshes: null,
|
|
24
|
-
edgeMeshes: {},
|
|
25
|
-
roofMarginMeshes: {},
|
|
26
|
-
moduleFieldsMeshes: {},
|
|
27
|
-
tileMeshes: {}
|
|
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
|
|
@@ -121,12 +120,73 @@ export default {
|
|
|
121
120
|
case 'removeNodes': //params.nodes
|
|
122
121
|
case 'removeEdges': //params.edges
|
|
123
122
|
case 'translate': //params.edges
|
|
124
|
-
case 'updateOutlineXY': //params.polygon,?index
|
|
125
123
|
methodList.push({
|
|
126
124
|
name: 'renderGeometry',
|
|
127
125
|
method: this.renderGeometry,
|
|
128
126
|
arg: []
|
|
129
127
|
})
|
|
128
|
+
methodList.push({
|
|
129
|
+
name: 'showPanels',
|
|
130
|
+
method: this.showPanels,
|
|
131
|
+
arg: []
|
|
132
|
+
})
|
|
133
|
+
break
|
|
134
|
+
case 'moveBuilding':
|
|
135
|
+
methodList.push({
|
|
136
|
+
name: 'renderRoofs',
|
|
137
|
+
method: this.renderRoofs,
|
|
138
|
+
arg: []
|
|
139
|
+
})
|
|
140
|
+
methodList.push({
|
|
141
|
+
name: 'renderEdges',
|
|
142
|
+
method: this.renderEdges,
|
|
143
|
+
arg: []
|
|
144
|
+
})
|
|
145
|
+
methodList.push({
|
|
146
|
+
name: 'renderBase',
|
|
147
|
+
method: this.renderBase,
|
|
148
|
+
arg: []
|
|
149
|
+
})
|
|
150
|
+
methodList.push({
|
|
151
|
+
name: 'renderObstacles',
|
|
152
|
+
method: this.renderObstacles,
|
|
153
|
+
arg: []
|
|
154
|
+
})
|
|
155
|
+
break
|
|
156
|
+
case 'updateOutlineXY': //params.polygon,?index
|
|
157
|
+
if (params.layer == 'roof') {
|
|
158
|
+
methodList.push({
|
|
159
|
+
name: 'renderRoofs',
|
|
160
|
+
method: this.renderRoofs,
|
|
161
|
+
arg: []
|
|
162
|
+
})
|
|
163
|
+
methodList.push({
|
|
164
|
+
name: 'renderEdges',
|
|
165
|
+
method: this.renderEdges,
|
|
166
|
+
arg: []
|
|
167
|
+
})
|
|
168
|
+
methodList.push({
|
|
169
|
+
name: 'renderBase',
|
|
170
|
+
method: this.renderBase,
|
|
171
|
+
arg: []
|
|
172
|
+
})
|
|
173
|
+
methodList.push({
|
|
174
|
+
name: 'renderObstacles',
|
|
175
|
+
method: this.renderObstacles,
|
|
176
|
+
arg: []
|
|
177
|
+
})
|
|
178
|
+
} else if (params.layer == 'obstacle') {
|
|
179
|
+
methodList.push({
|
|
180
|
+
name: 'renderRoofs',
|
|
181
|
+
method: this.renderRoofs,
|
|
182
|
+
arg: []
|
|
183
|
+
})
|
|
184
|
+
methodList.push({
|
|
185
|
+
name: 'renderObstacles',
|
|
186
|
+
method: this.renderObstacles,
|
|
187
|
+
arg: []
|
|
188
|
+
})
|
|
189
|
+
}
|
|
130
190
|
break
|
|
131
191
|
case 'removePanels': //params.panels
|
|
132
192
|
case 'removeModuleField': //params:moduleField
|
|
@@ -180,8 +240,23 @@ export default {
|
|
|
180
240
|
break
|
|
181
241
|
case 'roofInclineDirectionChange':
|
|
182
242
|
methodList.push({
|
|
183
|
-
name: '
|
|
184
|
-
method: this.
|
|
243
|
+
name: 'renderRoofs',
|
|
244
|
+
method: this.renderRoofs,
|
|
245
|
+
arg: []
|
|
246
|
+
})
|
|
247
|
+
methodList.push({
|
|
248
|
+
name: 'renderEdges',
|
|
249
|
+
method: this.renderEdges,
|
|
250
|
+
arg: []
|
|
251
|
+
})
|
|
252
|
+
methodList.push({
|
|
253
|
+
name: 'renderBase',
|
|
254
|
+
method: this.renderBase,
|
|
255
|
+
arg: []
|
|
256
|
+
})
|
|
257
|
+
methodList.push({
|
|
258
|
+
name: 'renderObstacles',
|
|
259
|
+
method: this.renderObstacles,
|
|
185
260
|
arg: []
|
|
186
261
|
})
|
|
187
262
|
break
|
|
@@ -198,38 +273,26 @@ export default {
|
|
|
198
273
|
method: this.debouncedRenderTiles,
|
|
199
274
|
arg: []
|
|
200
275
|
})
|
|
276
|
+
break
|
|
277
|
+
case 'hidePanels':
|
|
201
278
|
methodList.push({
|
|
202
|
-
name: '
|
|
203
|
-
method: this.
|
|
279
|
+
name: 'hidePanels',
|
|
280
|
+
method: this.hidePanels,
|
|
204
281
|
arg: []
|
|
205
282
|
})
|
|
283
|
+
break
|
|
284
|
+
case 'showPanels':
|
|
206
285
|
methodList.push({
|
|
207
|
-
name: '
|
|
208
|
-
method: this.
|
|
286
|
+
name: 'showPanels',
|
|
287
|
+
method: this.showPanels,
|
|
209
288
|
arg: []
|
|
210
289
|
})
|
|
211
290
|
break
|
|
212
|
-
// methodList.push({
|
|
213
|
-
// name: 'removeImageOverlay',
|
|
214
|
-
// method: this.removeImageOverlay,
|
|
215
|
-
// arg: []
|
|
216
|
-
// })
|
|
217
|
-
// methodList.push({
|
|
218
|
-
// name: 'applyTextureOnBackground',
|
|
219
|
-
// method: this.renderImageOverlayOnBackground,
|
|
220
|
-
// arg: []
|
|
221
|
-
// })
|
|
222
|
-
// methodList.push({
|
|
223
|
-
// name: 'applyTextureOnRoofs',
|
|
224
|
-
// method: this.applyTextureOnRoofs,
|
|
225
|
-
// arg: []
|
|
226
|
-
// })
|
|
227
|
-
// break
|
|
228
291
|
case 'removeImageOverlay':
|
|
229
292
|
case 'changeImageOverlay':
|
|
230
293
|
case 'updateImageOverlay':
|
|
231
294
|
methodList.push({
|
|
232
|
-
name: 'updateProjectionMaterials
|
|
295
|
+
name: 'updateProjectionMaterials',
|
|
233
296
|
method: this.updateProjectionMaterials,
|
|
234
297
|
arg: []
|
|
235
298
|
})
|
|
@@ -267,7 +330,6 @@ export default {
|
|
|
267
330
|
|
|
268
331
|
async initializeProjectionMaterial() {
|
|
269
332
|
await this.updateProjectionMaterials()
|
|
270
|
-
this.applyTextureOnRoofs()
|
|
271
333
|
},
|
|
272
334
|
|
|
273
335
|
getCanvasOffset() {
|
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)
|
|
@@ -81,6 +78,9 @@ export default {
|
|
|
81
78
|
this.renderer.domElement
|
|
82
79
|
)
|
|
83
80
|
this.orbitControl.maxPolarAngle = (Math.PI / 2) * (87 / 90)
|
|
81
|
+
this.orbitControl.addEventListener('change', () => {
|
|
82
|
+
this.orbitControlChange()
|
|
83
|
+
})
|
|
84
84
|
}
|
|
85
85
|
window.addEventListener('resize', this.onWindowResize, false)
|
|
86
86
|
|
|
@@ -88,6 +88,18 @@ export default {
|
|
|
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
|