@eturnity/eturnity_3d 6.34.0 → 6.34.1
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/.editorconfig +5 -0
- package/package.json +8 -4
- package/src/App.vue +16 -16
- package/src/assets/theme.js +4 -4
- package/src/components/ThreeCanvasViewer.vue +56 -43
- package/src/config.js +139 -65
- package/src/helper/MapView.js +214 -241
- package/src/helper/UpdateRoofModuleFieldRelations.js +17 -23
- package/src/helper/UpdateRoofObstacleRelations.js +48 -41
- package/src/helper/cameraMixin.js +97 -93
- package/src/helper/customProvider.js +28 -28
- package/src/helper/materialMixin.js +86 -70
- package/src/helper/materials.js +64 -49
- package/src/helper/render/background.js +2 -5
- package/src/helper/render/base.js +43 -40
- package/src/helper/render/clear.js +96 -84
- package/src/helper/render/edge.js +59 -65
- package/src/helper/render/geometryHandler.js +166 -128
- package/src/helper/render/imageOverlay.js +157 -106
- package/src/helper/render/index.js +21 -3
- package/src/helper/render/loader.js +34 -34
- package/src/helper/render/mapProjection.js +88 -74
- package/src/helper/render/margin.js +46 -50
- package/src/helper/render/moduleField.js +26 -24
- package/src/helper/render/node.js +43 -43
- package/src/helper/render/obstacle.js +50 -48
- package/src/helper/render/panel.js +85 -79
- package/src/helper/render/projectionMaterial.js +58 -50
- package/src/helper/render/roof.js +136 -133
- package/src/helper/render/texture.js +17 -17
- package/src/helper/render/tile.js +291 -0
- package/src/helper/renderMixin.js +30 -37
- package/src/helper/threeMixin.js +40 -101
- package/src/main.js +22 -18
- package/src/store/AddMargin.js +87 -83
- package/src/store/hydrateData.js +40 -30
- package/src/store/nodesEdgesCreation.js +177 -160
- package/src/store/three-d-module.js +41 -27
- package/src/utils/cancellablePromise.js +23 -0
- package/.eslintrc.json +0 -18
- package/src/helper/geo-three.module.js +0 -1903
|
@@ -1,22 +1,43 @@
|
|
|
1
1
|
import * as THREE from 'three'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from '../../config'
|
|
5
|
-
import {
|
|
6
|
-
getBufferRoofMarginGeometry
|
|
7
|
-
} from './geometryHandler'
|
|
2
|
+
import { colorArrayBase } from '../../config'
|
|
3
|
+
import { getBufferRoofMarginGeometry } from './geometryHandler'
|
|
8
4
|
export default {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
methods: {
|
|
6
|
+
renderRoofsMargin() {
|
|
7
|
+
this.clearByType('roofMarginMeshes')
|
|
8
|
+
|
|
9
|
+
if (this.selectedTool == 'selectMargin') {
|
|
10
|
+
this.roofs.forEach((roofPolygon) => {
|
|
11
|
+
const geometries = getBufferRoofMarginGeometry(roofPolygon)
|
|
12
|
+
|
|
13
|
+
geometries.forEach((geometry, index) => {
|
|
14
|
+
if (geometry) {
|
|
15
|
+
const marginColor = roofPolygon.margins.isSameMargin
|
|
16
|
+
? colorArrayBase[0]
|
|
17
|
+
: colorArrayBase[index % colorArrayBase.length]
|
|
18
|
+
let material = new THREE.MeshPhongMaterial({
|
|
19
|
+
color: marginColor,
|
|
20
|
+
specular: 0x009900,
|
|
21
|
+
shininess: 0,
|
|
22
|
+
flatShading: true,
|
|
23
|
+
side: THREE.DoubleSide,
|
|
24
|
+
transparent: true,
|
|
25
|
+
opacity: 0.8
|
|
26
|
+
})
|
|
27
|
+
const mesh = new THREE.Mesh(geometry, material)
|
|
28
|
+
geometry.dispose()
|
|
29
|
+
this.scene.add(mesh)
|
|
30
|
+
this.meshes.roofMarginMeshes[roofPolygon.id + '_' + index] = mesh
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
roofPolygon.holes.forEach((obstaclePolygon) => {
|
|
34
|
+
const geometries = getBufferRoofMarginGeometry(
|
|
35
|
+
obstaclePolygon,
|
|
36
|
+
roofPolygon
|
|
37
|
+
)
|
|
17
38
|
geometries.forEach((geometry, index) => {
|
|
18
39
|
if (geometry) {
|
|
19
|
-
const marginColor =
|
|
40
|
+
const marginColor = obstaclePolygon.margins.isSameMargin
|
|
20
41
|
? colorArrayBase[0]
|
|
21
42
|
: colorArrayBase[index % colorArrayBase.length]
|
|
22
43
|
let material = new THREE.MeshPhongMaterial({
|
|
@@ -30,43 +51,18 @@ export default {
|
|
|
30
51
|
})
|
|
31
52
|
const mesh = new THREE.Mesh(geometry, material)
|
|
32
53
|
geometry.dispose()
|
|
54
|
+
geometry = null
|
|
55
|
+
material.dispose()
|
|
56
|
+
material = null
|
|
33
57
|
this.scene.add(mesh)
|
|
34
|
-
this.meshes.roofMarginMeshes[
|
|
58
|
+
this.meshes.roofMarginMeshes[
|
|
59
|
+
obstaclePolygon.id + '_' + roofPolygon.id + '_' + index
|
|
60
|
+
] = mesh
|
|
35
61
|
}
|
|
36
62
|
})
|
|
37
|
-
roofPolygon.holes.forEach((obstaclePolygon) => {
|
|
38
|
-
const geometries = getBufferRoofMarginGeometry(
|
|
39
|
-
obstaclePolygon,
|
|
40
|
-
roofPolygon
|
|
41
|
-
)
|
|
42
|
-
geometries.forEach((geometry, index) => {
|
|
43
|
-
if (geometry) {
|
|
44
|
-
const marginColor = obstaclePolygon.margins.isSameMargin
|
|
45
|
-
? colorArrayBase[0]
|
|
46
|
-
: colorArrayBase[index % colorArrayBase.length]
|
|
47
|
-
let material = new THREE.MeshPhongMaterial({
|
|
48
|
-
color: marginColor,
|
|
49
|
-
specular: 0x009900,
|
|
50
|
-
shininess: 0,
|
|
51
|
-
flatShading: true,
|
|
52
|
-
side: THREE.DoubleSide,
|
|
53
|
-
transparent: true,
|
|
54
|
-
opacity: 0.8
|
|
55
|
-
})
|
|
56
|
-
const mesh = new THREE.Mesh(geometry, material)
|
|
57
|
-
geometry.dispose()
|
|
58
|
-
geometry = null
|
|
59
|
-
material.dispose()
|
|
60
|
-
material = null
|
|
61
|
-
this.scene.add(mesh)
|
|
62
|
-
this.meshes.roofMarginMeshes[
|
|
63
|
-
obstaclePolygon.id + '_' + roofPolygon.id + '_' + index
|
|
64
|
-
] = mesh
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
})
|
|
68
63
|
})
|
|
69
|
-
}
|
|
70
|
-
}
|
|
64
|
+
})
|
|
65
|
+
}
|
|
71
66
|
}
|
|
72
|
-
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import * as THREE from 'three'
|
|
2
|
-
import {
|
|
3
|
-
getBufferModuleFieldGeometry,
|
|
4
|
-
} from './geometryHandler'
|
|
2
|
+
import { getBufferModuleFieldGeometry } from './geometryHandler'
|
|
5
3
|
export default {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
4
|
+
methods: {
|
|
5
|
+
renderModuleFields() {
|
|
6
|
+
this.clearByType('moduleFieldsMeshes')
|
|
7
|
+
|
|
8
|
+
this.moduleFields.forEach((moduleFieldPolygon) => {
|
|
9
|
+
if (
|
|
10
|
+
!moduleFieldPolygon.data.number_of_panels_override &&
|
|
11
|
+
!this.areModuleFieldsVisible
|
|
12
|
+
)
|
|
13
|
+
return
|
|
14
|
+
const geometry = getBufferModuleFieldGeometry(moduleFieldPolygon)
|
|
15
|
+
if (geometry) {
|
|
16
|
+
const mesh = new THREE.Mesh(geometry, this.material.moduleField)
|
|
17
|
+
geometry.dispose()
|
|
18
|
+
mesh.matrixAutoUpdate = false
|
|
19
|
+
mesh.userData.version = moduleFieldPolygon.version
|
|
20
|
+
mesh.userData.type = 'moduleFieldsMeshes'
|
|
21
|
+
mesh.userData.meshId = moduleFieldPolygon.id
|
|
22
|
+
mesh.userData.polygonId = moduleFieldPolygon.id
|
|
23
|
+
this.scene.add(mesh)
|
|
24
|
+
this.meshes.moduleFieldsMeshes[moduleFieldPolygon.id] = mesh
|
|
25
|
+
}
|
|
26
|
+
})
|
|
26
27
|
}
|
|
27
|
-
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
1
|
import * as THREE from 'three'
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
4
|
+
methods: {
|
|
5
|
+
renderNodes() {
|
|
6
|
+
let geometry
|
|
7
|
+
if (this.meshes.nodeMeshes) {
|
|
8
|
+
geometry = this.meshes.nodeMeshes.geometry
|
|
9
|
+
geometry.attributes.position.needsUpdate = true
|
|
10
|
+
} else {
|
|
11
|
+
geometry = new THREE.BufferGeometry()
|
|
12
|
+
}
|
|
13
|
+
// let geometry = new THREE.SphereGeometry(node3DRadius, 4, 4)
|
|
14
|
+
const vertices = []
|
|
15
|
+
this.nodes
|
|
16
|
+
.filter((node) => node.layer == 'roof')
|
|
17
|
+
.forEach((node) => {
|
|
18
|
+
vertices.push(node.x / 1000, node.y / 1000, node.z / 1000)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
if (
|
|
22
|
+
geometry.attributes.position &&
|
|
23
|
+
geometry.attributes.position.array.length <= vertices.length
|
|
24
|
+
) {
|
|
25
|
+
let positions = geometry.attributes.position.array
|
|
26
|
+
for (let k in vertices) {
|
|
27
|
+
positions[k] = vertices[k]
|
|
28
|
+
}
|
|
29
|
+
geometry.setDrawRange(0, vertices.length / 3)
|
|
30
|
+
} else {
|
|
31
|
+
geometry.setAttribute(
|
|
32
|
+
'position',
|
|
33
|
+
new THREE.Float32BufferAttribute(vertices, 3)
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
let material = this.material.node
|
|
37
|
+
const nodeMeshes = new THREE.Points(geometry, material)
|
|
38
|
+
nodeMeshes.userData.version = 0
|
|
39
|
+
nodeMeshes.userData.type = 'nodeMeshes'
|
|
40
|
+
nodeMeshes.userData.meshId = null
|
|
41
|
+
nodeMeshes.userData.polygonId = null
|
|
42
|
+
nodeMeshes.matrixAutoUpdate = false
|
|
43
|
+
this.meshes.nodeMeshes = nodeMeshes
|
|
44
|
+
this.scene.add(nodeMeshes)
|
|
46
45
|
}
|
|
47
|
-
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,55 +1,57 @@
|
|
|
1
1
|
import * as THREE from 'three'
|
|
2
2
|
import {
|
|
3
3
|
getBufferObstacleGeometry,
|
|
4
|
-
getBufferObstacleSideGeometry
|
|
4
|
+
getBufferObstacleSideGeometry
|
|
5
5
|
} from './geometryHandler'
|
|
6
6
|
export default {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.roofs.forEach((roofPolygon) => {
|
|
12
|
-
roofPolygon.holes
|
|
13
|
-
.filter((poly) => poly.layer == 'obstacle')
|
|
14
|
-
.forEach((obstaclePolygon) => {
|
|
15
|
-
const geometry = getBufferObstacleGeometry(
|
|
16
|
-
obstaclePolygon,
|
|
17
|
-
roofPolygon
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
const geometrySide = getBufferObstacleSideGeometry(
|
|
21
|
-
obstaclePolygon,
|
|
22
|
-
roofPolygon
|
|
23
|
-
)
|
|
24
|
-
if (geometry && geometrySide) {
|
|
25
|
-
const mesh = new THREE.Mesh(geometry, this.material.roof)
|
|
26
|
-
const meshSide = new THREE.Mesh(geometrySide, this.material.wall)
|
|
27
|
-
this.applyTextureOnMesh(this.material.roof,mesh)
|
|
7
|
+
methods: {
|
|
8
|
+
renderObstacles() {
|
|
9
|
+
this.clearByType('obstacleMeshes')
|
|
28
10
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
11
|
+
this.roofs.forEach((roofPolygon) => {
|
|
12
|
+
roofPolygon.holes
|
|
13
|
+
.filter((poly) => poly.layer == 'obstacle')
|
|
14
|
+
.forEach((obstaclePolygon) => {
|
|
15
|
+
const geometry = getBufferObstacleGeometry(
|
|
16
|
+
obstaclePolygon,
|
|
17
|
+
roofPolygon
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
const geometrySide = getBufferObstacleSideGeometry(
|
|
21
|
+
obstaclePolygon,
|
|
22
|
+
roofPolygon
|
|
23
|
+
)
|
|
24
|
+
if (geometry && geometrySide) {
|
|
25
|
+
const mesh = new THREE.Mesh(geometry, this.material.roof)
|
|
26
|
+
const meshSide = new THREE.Mesh(geometrySide, this.material.wall)
|
|
27
|
+
this.applyTextureOnMesh(this.material.roof, mesh)
|
|
28
|
+
|
|
29
|
+
mesh.userData.version = obstaclePolygon.version
|
|
30
|
+
mesh.userData.type = 'obstacleMeshes'
|
|
31
|
+
mesh.userData.meshId =
|
|
32
|
+
obstaclePolygon.id + '-' + roofPolygon.id + '_top'
|
|
33
|
+
mesh.userData.polygonId = obstaclePolygon.id
|
|
34
|
+
meshSide.userData.version = obstaclePolygon.version
|
|
35
|
+
meshSide.userData.type = 'obstacleMeshes'
|
|
36
|
+
meshSide.userData.meshId =
|
|
37
|
+
obstaclePolygon.id + '-' + roofPolygon.id + '_side'
|
|
38
|
+
meshSide.userData.polygonId = obstaclePolygon.id
|
|
39
|
+
|
|
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
|
+
this.meshes.obstacleMeshes[
|
|
47
|
+
obstaclePolygon.id + '-' + roofPolygon.id + '_top'
|
|
48
|
+
] = mesh
|
|
49
|
+
this.meshes.obstacleMeshes[
|
|
50
|
+
obstaclePolygon.id + '-' + roofPolygon.id + '_side'
|
|
51
|
+
] = meshSide
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
})
|
|
54
55
|
}
|
|
55
|
-
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -3,88 +3,94 @@ import {
|
|
|
3
3
|
getBufferPanelGeometry,
|
|
4
4
|
updateBufferPanelGeometry,
|
|
5
5
|
getBufferPanelSideGeometry,
|
|
6
|
-
updateBufferPanelSideGeometry
|
|
6
|
+
updateBufferPanelSideGeometry
|
|
7
7
|
} from './geometryHandler'
|
|
8
8
|
export default {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
9
|
+
methods: {
|
|
10
|
+
renderPanels() {
|
|
11
|
+
this.clearRemovedOnes('panelsMeshes')
|
|
12
|
+
Object.values(this.meshes.panelsMeshes).forEach((mesh) => {
|
|
13
|
+
//clear UserDeactivatedModules
|
|
14
|
+
if (
|
|
15
|
+
this.polygons.find(
|
|
16
|
+
(poly) =>
|
|
17
|
+
poly.id == mesh.userData.polygonId &&
|
|
18
|
+
poly.layer == 'user_deactivated_panel'
|
|
19
|
+
)
|
|
20
|
+
) {
|
|
21
|
+
this.clearMesh(mesh)
|
|
22
|
+
}
|
|
23
|
+
//clear panel on moduleField with overriden number of panel
|
|
24
|
+
let panel = this.polygons.find(
|
|
25
|
+
(poly) => mesh.userData.polygonId == poly.id
|
|
26
|
+
)
|
|
27
|
+
if (!panel || panel.moduleField.data.number_of_panels_override) {
|
|
28
|
+
this.clearMesh(mesh)
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
this.panels.forEach((panelPolygon) => {
|
|
33
|
+
//definition of the material
|
|
34
|
+
if (panelPolygon.moduleField.data.number_of_panels_override) return
|
|
35
|
+
let material =
|
|
36
|
+
this.material.panel['default_' + this.moduleTextureVersionId]
|
|
37
|
+
material.transparent = true
|
|
38
|
+
material.opacity = this.panelOpacity
|
|
39
|
+
if (panelPolygon.moduleField.pvData) {
|
|
40
|
+
let pvId = panelPolygon.moduleField.pvData.id
|
|
41
|
+
if (this.material.panel[pvId]) {
|
|
42
|
+
material = this.material.panel[pvId]
|
|
43
|
+
}
|
|
44
|
+
} else if (panelPolygon.moduleField.data) {
|
|
45
|
+
let pvId = panelPolygon.moduleField.data.component_id_pv_module
|
|
46
|
+
if (this.material.panel[pvId]) {
|
|
47
|
+
material = this.material.panel[pvId]
|
|
22
48
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (
|
|
52
|
+
!this.meshes.panelsMeshes[panelPolygon.id + '_top'] ||
|
|
53
|
+
!this.meshes.panelsMeshes[panelPolygon.id + '_side']
|
|
54
|
+
) {
|
|
55
|
+
const geometry = getBufferPanelGeometry(panelPolygon)
|
|
56
|
+
const geometrySide = getBufferPanelSideGeometry(panelPolygon)
|
|
57
|
+
|
|
58
|
+
if (geometry && geometrySide) {
|
|
59
|
+
const mesh = new THREE.Mesh(geometry, material)
|
|
60
|
+
const meshSide = new THREE.Mesh(geometrySide, this.material.wall)
|
|
61
|
+
mesh.userData.version = panelPolygon.version
|
|
62
|
+
mesh.userData.type = 'panelsMeshes'
|
|
63
|
+
mesh.userData.meshId = panelPolygon.id + '_top'
|
|
64
|
+
mesh.userData.polygonId = panelPolygon.id
|
|
65
|
+
meshSide.userData.version = panelPolygon.version
|
|
66
|
+
meshSide.userData.type = 'panelsMeshes'
|
|
67
|
+
meshSide.userData.meshId = panelPolygon.id + '_side'
|
|
68
|
+
meshSide.userData.polygonId = panelPolygon.id
|
|
69
|
+
geometry.dispose()
|
|
70
|
+
geometrySide.dispose()
|
|
71
|
+
this.scene.add(mesh)
|
|
72
|
+
this.scene.add(meshSide)
|
|
73
|
+
mesh.matrixAutoUpdate = false
|
|
74
|
+
meshSide.matrixAutoUpdate = false
|
|
75
|
+
this.meshes.panelsMeshes[panelPolygon.id + '_top'] = mesh
|
|
76
|
+
this.meshes.panelsMeshes[panelPolygon.id + '_side'] = meshSide
|
|
29
77
|
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
}else if(panelPolygon.moduleField.data){
|
|
44
|
-
let pvId = panelPolygon.moduleField.data.component_id_pv_module
|
|
45
|
-
if (this.material.panel[pvId]) {
|
|
46
|
-
material = this.material.panel[pvId]
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (
|
|
51
|
-
!this.meshes.panelsMeshes[panelPolygon.id + '_top'] ||
|
|
52
|
-
!this.meshes.panelsMeshes[panelPolygon.id + '_side']
|
|
53
|
-
) {
|
|
54
|
-
const geometry = getBufferPanelGeometry(panelPolygon)
|
|
55
|
-
const geometrySide = getBufferPanelSideGeometry(panelPolygon)
|
|
56
|
-
|
|
57
|
-
if (geometry && geometrySide) {
|
|
58
|
-
|
|
59
|
-
const mesh = new THREE.Mesh(geometry, material)
|
|
60
|
-
const meshSide = new THREE.Mesh(geometrySide, this.material.wall)
|
|
61
|
-
mesh.userData.version = panelPolygon.version
|
|
62
|
-
mesh.userData.type = 'panelsMeshes'
|
|
63
|
-
mesh.userData.meshId = panelPolygon.id + '_top'
|
|
64
|
-
mesh.userData.polygonId = panelPolygon.id
|
|
65
|
-
meshSide.userData.version = panelPolygon.version
|
|
66
|
-
meshSide.userData.type = 'panelsMeshes'
|
|
67
|
-
meshSide.userData.meshId = panelPolygon.id + '_side'
|
|
68
|
-
meshSide.userData.polygonId = panelPolygon.id
|
|
69
|
-
geometry.dispose()
|
|
70
|
-
geometrySide.dispose()
|
|
71
|
-
this.scene.add(mesh)
|
|
72
|
-
this.scene.add(meshSide)
|
|
73
|
-
mesh.matrixAutoUpdate = false
|
|
74
|
-
meshSide.matrixAutoUpdate = false
|
|
75
|
-
this.meshes.panelsMeshes[panelPolygon.id + '_top'] = mesh
|
|
76
|
-
this.meshes.panelsMeshes[panelPolygon.id + '_side'] = meshSide
|
|
77
|
-
}
|
|
78
|
-
}else{
|
|
79
|
-
const topMesh=this.meshes.panelsMeshes[panelPolygon.id + '_top']
|
|
80
|
-
const sideMesh=this.meshes.panelsMeshes[panelPolygon.id + '_side']
|
|
81
|
-
if(panelPolygon.version>topMesh.userData.version){
|
|
82
|
-
topMesh.geometry=updateBufferPanelGeometry(panelPolygon,topMesh.geometry)
|
|
83
|
-
sideMesh.geometry=updateBufferPanelSideGeometry(panelPolygon,sideMesh.geometry)
|
|
84
|
-
}
|
|
85
|
-
topMesh.material= material
|
|
78
|
+
} else {
|
|
79
|
+
const topMesh = this.meshes.panelsMeshes[panelPolygon.id + '_top']
|
|
80
|
+
const sideMesh = this.meshes.panelsMeshes[panelPolygon.id + '_side']
|
|
81
|
+
if (panelPolygon.version > topMesh.userData.version) {
|
|
82
|
+
topMesh.geometry = updateBufferPanelGeometry(
|
|
83
|
+
panelPolygon,
|
|
84
|
+
topMesh.geometry
|
|
85
|
+
)
|
|
86
|
+
sideMesh.geometry = updateBufferPanelSideGeometry(
|
|
87
|
+
panelPolygon,
|
|
88
|
+
sideMesh.geometry
|
|
89
|
+
)
|
|
86
90
|
}
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
topMesh.material = material
|
|
92
|
+
}
|
|
93
|
+
})
|
|
89
94
|
}
|
|
90
|
-
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -1,57 +1,65 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
methods: {
|
|
3
|
+
reorderRoofMaterials() {
|
|
4
|
+
this.material.roof.sort((a, b) => {
|
|
5
|
+
let aPrio = a.priority || 0
|
|
6
|
+
let bPrio = b.priority || 0
|
|
7
|
+
return aPrio - bPrio
|
|
8
|
+
})
|
|
9
|
+
},
|
|
10
|
+
async updateProjectionMaterials() {
|
|
11
|
+
this.setImageOverlayCameraPosition()
|
|
12
|
+
let materialPromises = [
|
|
13
|
+
this.getMapProjectionMaterial(),
|
|
14
|
+
this.getImageOverlayMaterial()
|
|
15
|
+
]
|
|
16
|
+
let materials = await Promise.all(materialPromises)
|
|
17
|
+
this.mapProjectionMaterial = materials[0]
|
|
18
|
+
this.imageOverlayMaterial = materials[1]
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
this.reorderRoofMaterials()
|
|
20
|
+
let index = this.material.roof.findIndex(
|
|
21
|
+
(material) => material.userData.type == 'mapProjectionMaterial'
|
|
22
|
+
)
|
|
23
|
+
if (this.mapProjectionMaterial) {
|
|
24
|
+
if (index >= 0) {
|
|
25
|
+
this.material.roof[index] = this.mapProjectionMaterial
|
|
26
|
+
this.material.roof = [...this.material.roof]
|
|
27
|
+
} else {
|
|
28
|
+
this.material.roof = [
|
|
29
|
+
...this.material.roof,
|
|
30
|
+
this.mapProjectionMaterial
|
|
31
|
+
]
|
|
32
|
+
this.reorderRoofMaterials()
|
|
34
33
|
}
|
|
34
|
+
} else if (index >= 0) {
|
|
35
|
+
this.material.roof[index].dispose()
|
|
36
|
+
this.material.roof.splice(index, 1)
|
|
37
|
+
this.material.roof = [...this.material.roof]
|
|
38
|
+
this.reorderRoofMaterials()
|
|
39
|
+
}
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
this.material.roof=[...this.material.roof]
|
|
41
|
+
index = this.material.roof.findIndex(
|
|
42
|
+
(material) => material.userData.type == 'imageOverlayMaterial'
|
|
43
|
+
)
|
|
44
|
+
if (this.imageOverlayMaterial) {
|
|
45
|
+
if (index >= 0) {
|
|
46
|
+
this.material.roof[index] = this.imageOverlayMaterial
|
|
47
|
+
this.material.roof = [...this.material.roof]
|
|
48
|
+
} else {
|
|
49
|
+
this.material.roof = [
|
|
50
|
+
...this.material.roof,
|
|
51
|
+
this.imageOverlayMaterial
|
|
52
|
+
]
|
|
49
53
|
this.reorderRoofMaterials()
|
|
50
54
|
}
|
|
51
|
-
|
|
52
|
-
this.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
55
|
+
} else if (index >= 0) {
|
|
56
|
+
this.material.roof[index].dispose()
|
|
57
|
+
this.material.roof.splice(index, 1)
|
|
58
|
+
this.material.roof = [...this.material.roof]
|
|
59
|
+
this.reorderRoofMaterials()
|
|
60
|
+
}
|
|
61
|
+
this.renderImageOverlayOnBackground()
|
|
62
|
+
this.applyTextureOnRoofs()
|
|
56
63
|
}
|
|
57
|
-
}
|
|
64
|
+
}
|
|
65
|
+
}
|