@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,43 +1,46 @@
|
|
|
1
1
|
import * as THREE from 'three'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
getBufferWallGeometry,
|
|
4
|
+
updateBufferWallGeometry
|
|
5
|
+
} from './geometryHandler'
|
|
3
6
|
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
|
-
},
|
|
7
|
+
methods: {
|
|
8
|
+
renderBase() {
|
|
9
|
+
//rendering of walls
|
|
10
|
+
//this.clearByType('baseMeshes')
|
|
11
|
+
this.clearRemovedOnes('baseMeshes')
|
|
12
|
+
let geometry
|
|
13
|
+
let mesh
|
|
14
|
+
this.roofs.forEach((roofPolygon) => {
|
|
15
|
+
//everythime the essencials data are changed, version goes up. we compare polygon version and mesh version to know if we have to rerender
|
|
16
|
+
if (
|
|
17
|
+
this.meshes.baseMeshes[roofPolygon.id] &&
|
|
18
|
+
this.meshes.baseMeshes[roofPolygon.id].userData.version <
|
|
19
|
+
roofPolygon.version
|
|
20
|
+
) {
|
|
21
|
+
//this.clearMesh(this.meshes.baseMeshes[roofPolygon.id])
|
|
22
|
+
mesh = this.meshes.baseMeshes[roofPolygon.id]
|
|
23
|
+
geometry = mesh.geometry
|
|
24
|
+
geometry = updateBufferWallGeometry(roofPolygon, geometry)
|
|
25
|
+
mesh.geometry = geometry
|
|
26
|
+
mesh.updateMatrix()
|
|
27
|
+
}
|
|
28
|
+
if (!this.meshes.baseMeshes[roofPolygon.id]) {
|
|
29
|
+
//create
|
|
30
|
+
geometry = getBufferWallGeometry(roofPolygon)
|
|
31
|
+
mesh = new THREE.Mesh(geometry, this.material.wall)
|
|
32
|
+
mesh.userData.version = roofPolygon.version
|
|
33
|
+
mesh.userData.type = 'baseMeshes'
|
|
34
|
+
mesh.userData.meshId = roofPolygon.id
|
|
35
|
+
mesh.userData.polygonId = roofPolygon.id
|
|
36
|
+
mesh.matrixAutoUpdate = false
|
|
37
|
+
mesh.frustumCulled = false
|
|
38
|
+
//geometry.dispose()
|
|
39
|
+
//geometry=null
|
|
40
|
+
this.scene.add(mesh)
|
|
41
|
+
this.meshes.baseMeshes[roofPolygon.id] = mesh
|
|
42
|
+
}
|
|
43
|
+
})
|
|
42
44
|
}
|
|
43
|
-
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -1,93 +1,105 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
obj.material[prop].dispose()
|
|
20
|
-
})
|
|
21
|
-
if(obj.material.dispose) obj.material.dispose()
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
clearPanelsFromChangingRoofs(roofIds){
|
|
25
|
-
const roofs=this.polygons.filter(polygon=>roofIds.includes(polygon.id))
|
|
26
|
-
roofs.forEach(roof=>roof.moduleFields.forEach(mf=>mf.panels.forEach(panel=>{
|
|
27
|
-
let meshTop=this.meshes.panelsMeshes[panel.id+'_top']
|
|
28
|
-
let meshSide=this.meshes.panelsMeshes[panel.id+'_side']
|
|
29
|
-
if(meshTop || meshSide){
|
|
30
|
-
this.clearMesh(meshTop)
|
|
31
|
-
this.clearMesh(meshSide)
|
|
32
|
-
}
|
|
33
|
-
})
|
|
2
|
+
methods: {
|
|
3
|
+
clearThreeObjects(obj) {
|
|
4
|
+
while (obj.children.length > 0) {
|
|
5
|
+
this.clearThreeObjects(obj.children[0])
|
|
6
|
+
obj.remove(obj.children[0])
|
|
7
|
+
}
|
|
8
|
+
if (obj.geometry) obj.geometry.dispose()
|
|
9
|
+
if (obj.texture) obj.texture.dispose()
|
|
10
|
+
|
|
11
|
+
if (obj.material) {
|
|
12
|
+
//in case of map, bumpMap, normalMap, envMap ...
|
|
13
|
+
Object.keys(obj.material).forEach((prop) => {
|
|
14
|
+
if (!obj.material[prop]) return
|
|
15
|
+
if (
|
|
16
|
+
false &&
|
|
17
|
+
obj.material[prop] !== null &&
|
|
18
|
+
typeof obj.material[prop].dispose === 'function'
|
|
34
19
|
)
|
|
20
|
+
obj.material[prop].dispose()
|
|
21
|
+
})
|
|
22
|
+
if (obj.material.dispose) obj.material.dispose()
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
clearPanelsFromChangingRoofs(roofIds) {
|
|
26
|
+
const roofs = this.polygons.filter((polygon) =>
|
|
27
|
+
roofIds.includes(polygon.id)
|
|
28
|
+
)
|
|
29
|
+
roofs.forEach((roof) =>
|
|
30
|
+
roof.moduleFields.forEach((mf) =>
|
|
31
|
+
mf.panels.forEach((panel) => {
|
|
32
|
+
let meshTop = this.meshes.panelsMeshes[panel.id + '_top']
|
|
33
|
+
let meshSide = this.meshes.panelsMeshes[panel.id + '_side']
|
|
34
|
+
if (meshTop || meshSide) {
|
|
35
|
+
this.clearMesh(meshTop)
|
|
36
|
+
this.clearMesh(meshSide)
|
|
37
|
+
}
|
|
38
|
+
})
|
|
35
39
|
)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
)
|
|
41
|
+
},
|
|
42
|
+
clearMesh(mesh) {
|
|
43
|
+
if (!mesh) {
|
|
44
|
+
return
|
|
45
|
+
}
|
|
46
|
+
this.scene.remove(mesh)
|
|
47
|
+
if (mesh.geometry && mesh.geometry.dispose) {
|
|
48
|
+
mesh.geometry.dispose()
|
|
49
|
+
mesh.geometry = null
|
|
50
|
+
}
|
|
51
|
+
if (mesh.texture && mesh.texture.dispose) {
|
|
52
|
+
mesh.texture.dispose()
|
|
53
|
+
mesh.texture = null
|
|
54
|
+
}
|
|
55
|
+
if (mesh.material && mesh.material.dispose) {
|
|
56
|
+
mesh.material.dispose()
|
|
57
|
+
mesh.material = null
|
|
58
|
+
}
|
|
59
|
+
if (
|
|
60
|
+
mesh.userData.meshId &&
|
|
61
|
+
this.meshes[mesh.userData.type][mesh.userData.meshId]
|
|
62
|
+
) {
|
|
39
63
|
this.scene.remove(mesh)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
64
|
+
delete this.meshes[mesh.userData.type][mesh.userData.meshId]
|
|
65
|
+
} else {
|
|
66
|
+
this.meshes[mesh.userData.type] = null
|
|
67
|
+
}
|
|
68
|
+
mesh = null
|
|
69
|
+
},
|
|
70
|
+
clearEdgesRemovedOnes() {
|
|
71
|
+
Object.values(this.meshes['edgeMeshes']).forEach((mesh) => {
|
|
72
|
+
if (!this.edgeIds.includes(mesh.userData.edgeId)) {
|
|
73
|
+
this.clearMesh(mesh)
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
},
|
|
77
|
+
clearNodesRemovedOnes() {
|
|
78
|
+
Object.values(this.meshes['nodeMeshes']).forEach((mesh) => {
|
|
79
|
+
if (!this.nodeIds.includes(mesh.userData.nodeId)) {
|
|
80
|
+
this.clearMesh(mesh)
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
},
|
|
84
|
+
clearRemovedOnes(type) {
|
|
85
|
+
Object.values(this.meshes[type]).forEach((mesh) => {
|
|
86
|
+
if (!this.polygonIds.includes(mesh.userData.polygonId)) {
|
|
87
|
+
this.clearMesh(mesh)
|
|
43
88
|
}
|
|
89
|
+
})
|
|
90
|
+
},
|
|
91
|
+
clearByType(type) {
|
|
92
|
+
Object.values(this.meshes[type]).forEach((mesh) => {
|
|
93
|
+
mesh.geometry.dispose()
|
|
94
|
+
mesh.geometry = null
|
|
44
95
|
if (mesh.material && mesh.material.dispose) {
|
|
45
96
|
mesh.material.dispose()
|
|
46
|
-
mesh.material = null
|
|
47
97
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
} else {
|
|
54
|
-
this.meshes[mesh.userData.type] = null
|
|
55
|
-
}
|
|
56
|
-
mesh = null
|
|
57
|
-
},
|
|
58
|
-
clearEdgesRemovedOnes() {
|
|
59
|
-
Object.values(this.meshes['edgeMeshes']).forEach((mesh) => {
|
|
60
|
-
if (!this.edgeIds.includes(mesh.userData.edgeId)) {
|
|
61
|
-
this.clearMesh(mesh)
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
},
|
|
65
|
-
clearNodesRemovedOnes() {
|
|
66
|
-
Object.values(this.meshes['nodeMeshes']).forEach((mesh) => {
|
|
67
|
-
if (!this.nodeIds.includes(mesh.userData.nodeId)) {
|
|
68
|
-
this.clearMesh(mesh)
|
|
69
|
-
}
|
|
70
|
-
})
|
|
71
|
-
},
|
|
72
|
-
clearRemovedOnes(type) {
|
|
73
|
-
Object.values(this.meshes[type]).forEach((mesh) => {
|
|
74
|
-
if (!this.polygonIds.includes(mesh.userData.polygonId)) {
|
|
75
|
-
this.clearMesh(mesh)
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
},
|
|
79
|
-
clearByType(type) {
|
|
80
|
-
Object.values(this.meshes[type]).forEach((mesh) => {
|
|
81
|
-
mesh.geometry.dispose()
|
|
82
|
-
mesh.geometry = null
|
|
83
|
-
if (mesh.material && mesh.material.dispose) {
|
|
84
|
-
mesh.material.dispose()
|
|
85
|
-
}
|
|
86
|
-
mesh.material = null
|
|
87
|
-
this.scene.remove(mesh)
|
|
88
|
-
})
|
|
89
|
-
this.meshes[type] = {}
|
|
90
|
-
this.renderer.renderLists.dispose()
|
|
91
|
-
},
|
|
98
|
+
mesh.material = null
|
|
99
|
+
this.scene.remove(mesh)
|
|
100
|
+
})
|
|
101
|
+
this.meshes[type] = {}
|
|
102
|
+
this.renderer.renderLists.dispose()
|
|
92
103
|
}
|
|
93
|
-
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -1,71 +1,65 @@
|
|
|
1
1
|
import * as THREE from 'three'
|
|
2
2
|
export default {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const midPoint = point_0.clone().add(point_1).multiplyScalar(0.5)
|
|
17
|
-
var direction = new THREE.Vector3().subVectors(point_1, point_0)
|
|
18
|
-
let length = direction.length()
|
|
3
|
+
methods: {
|
|
4
|
+
setCylinderPosition(cylinder, edge) {
|
|
5
|
+
const point_0 = new THREE.Vector3(
|
|
6
|
+
edge.outline[0].x / 1000,
|
|
7
|
+
edge.outline[0].y / 1000,
|
|
8
|
+
edge.outline[0].z / 1000
|
|
9
|
+
)
|
|
10
|
+
const point_1 = new THREE.Vector3(
|
|
11
|
+
edge.outline[1].x / 1000,
|
|
12
|
+
edge.outline[1].y / 1000,
|
|
13
|
+
edge.outline[1].z / 1000
|
|
14
|
+
)
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
const midPoint = point_0.clone().add(point_1).multiplyScalar(0.5)
|
|
17
|
+
var direction = new THREE.Vector3().subVectors(point_1, point_0)
|
|
18
|
+
let length = direction.length()
|
|
22
19
|
|
|
20
|
+
//cylinder.rotation.set(arrow.rotation)
|
|
21
|
+
var axis = new THREE.Vector3(0, 1, 0)
|
|
22
|
+
cylinder.quaternion.setFromUnitVectors(
|
|
23
|
+
axis,
|
|
24
|
+
direction.clone().normalize()
|
|
25
|
+
)
|
|
26
|
+
//cylinder.position.set(new THREE.Vector3().addVectors( pointX, direction.multiplyScalar(0.5) ))
|
|
27
|
+
cylinder.position.copy(midPoint.clone())
|
|
28
|
+
let oldLength = cylinder.userData.cylinderLength
|
|
29
|
+
let newLength = length
|
|
30
|
+
if (!oldLength || oldLength != 0) {
|
|
31
|
+
cylinder.scale.set(1, newLength, 1)
|
|
32
|
+
cylinder.userData.cylinderLength = newLength
|
|
33
|
+
}
|
|
34
|
+
cylinder.updateMatrix()
|
|
35
|
+
return cylinder
|
|
36
|
+
},
|
|
37
|
+
renderEdges() {
|
|
38
|
+
this.clearEdgesRemovedOnes('edgeMeshes')
|
|
39
|
+
let cylinder
|
|
40
|
+
//this.clearByType('edgeMeshes')
|
|
41
|
+
// const material = new THREE.LineBasicMaterial( { color: beamColor,transparent:true,opacity:beamOpacity ,sizeAttenuation: true} );
|
|
42
|
+
// material.linewidth=5
|
|
43
|
+
const material = this.material.edge
|
|
44
|
+
this.edges
|
|
45
|
+
.filter((edge) => edge.layer == 'roof')
|
|
46
|
+
.forEach((edge) => {
|
|
47
|
+
cylinder = this.meshes.edgeMeshes[edge.id]
|
|
48
|
+
if (cylinder) {
|
|
49
|
+
//update
|
|
50
|
+
this.setCylinderPosition(cylinder, edge)
|
|
51
|
+
//change cylinder length
|
|
52
|
+
} else {
|
|
53
|
+
const geometry = new THREE.CylinderGeometry(0.1, 0.1, 1, 6)
|
|
54
|
+
cylinder = new THREE.Mesh(geometry, material)
|
|
55
|
+
cylinder = this.setCylinderPosition(cylinder, edge)
|
|
23
56
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
)
|
|
30
|
-
//cylinder.position.set(new THREE.Vector3().addVectors( pointX, direction.multiplyScalar(0.5) ))
|
|
31
|
-
cylinder.position.copy(midPoint.clone())
|
|
32
|
-
let oldLength = cylinder.userData.cylinderLength
|
|
33
|
-
let newLength = length
|
|
34
|
-
if (!oldLength || oldLength != 0) {
|
|
35
|
-
cylinder.scale.set(1, newLength, 1)
|
|
36
|
-
cylinder.userData.cylinderLength = newLength
|
|
37
|
-
}
|
|
38
|
-
cylinder.updateMatrix()
|
|
39
|
-
return cylinder
|
|
40
|
-
},
|
|
41
|
-
renderEdges() {
|
|
42
|
-
this.clearEdgesRemovedOnes('edgeMeshes')
|
|
43
|
-
let cylinder
|
|
44
|
-
//this.clearByType('edgeMeshes')
|
|
45
|
-
// const material = new THREE.LineBasicMaterial( { color: beamColor,transparent:true,opacity:beamOpacity ,sizeAttenuation: true} );
|
|
46
|
-
// material.linewidth=5
|
|
47
|
-
const material = this.material.edge
|
|
48
|
-
this.edges
|
|
49
|
-
.filter((edge) => edge.layer == 'roof')
|
|
50
|
-
.forEach((edge) => {
|
|
51
|
-
cylinder = this.meshes.edgeMeshes[edge.id]
|
|
52
|
-
if (cylinder) {
|
|
53
|
-
//update
|
|
54
|
-
this.setCylinderPosition(cylinder,edge)
|
|
55
|
-
//change cylinder length
|
|
56
|
-
} else {
|
|
57
|
-
|
|
58
|
-
const geometry = new THREE.CylinderGeometry(0.1, 0.1, 1, 6)
|
|
59
|
-
cylinder = new THREE.Mesh(geometry, material)
|
|
60
|
-
cylinder=this.setCylinderPosition(cylinder,edge)
|
|
61
|
-
|
|
62
|
-
cylinder.userData.edgeId = edge.id
|
|
63
|
-
|
|
64
|
-
this.meshes.edgeMeshes[edge.id] = cylinder
|
|
65
|
-
this.scene.add(cylinder)
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
})
|
|
69
|
-
},
|
|
57
|
+
cylinder.userData.edgeId = edge.id
|
|
58
|
+
|
|
59
|
+
this.meshes.edgeMeshes[edge.id] = cylinder
|
|
60
|
+
this.scene.add(cylinder)
|
|
61
|
+
}
|
|
62
|
+
})
|
|
70
63
|
}
|
|
71
|
-
}
|
|
64
|
+
}
|
|
65
|
+
}
|