@eturnity/eturnity_3d 6.48.4 → 6.48.5-EPDM-8599.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 -2
- package/src/helper/UpdateRoofObstacleRelations.js +17 -13
- package/src/helper/materialMixin.js +35 -2
- package/src/helper/render/clear.js +2 -1
- package/src/helper/render/mergedGeometry.js +2 -3
- package/src/helper/render/moduleField.js +9 -7
- package/src/helper/render/obstacle.js +3 -1
- package/src/helper/render/panel.js +3 -0
- package/src/helper/render/roof.js +5 -6
- package/src/helper/render/tile.js +4 -0
- package/src/helper/renderMixin.js +9 -1
- package/src/helper/threeMixin.js +13 -5
- package/src/store/nodesEdgesCreation.js +10 -5
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eturnity/eturnity_3d",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "6.48.
|
|
4
|
+
"version": "6.48.5-EPDM-8599.0",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vue-cli-service serve --skip-plugins @vue/cli-plugin-eslint",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"prettier": "prettier --write \"**/*.{js,vue}\""
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@eturnity/eturnity_maths": "6.48.
|
|
13
|
+
"@eturnity/eturnity_maths": "6.48.4-EPDM-8599.0",
|
|
14
14
|
"core-js": "^2.6.12",
|
|
15
15
|
"cors": "^2.8.5",
|
|
16
16
|
"earcut": "^2.2.4",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
verticalProjectionOnPlane,
|
|
3
|
-
calculateArea
|
|
3
|
+
calculateArea,
|
|
4
|
+
isInsidePolygon
|
|
4
5
|
} from '@eturnity/eturnity_maths'
|
|
5
6
|
import { intersectOutlines } from '@eturnity/eturnity_maths'
|
|
6
7
|
//this function just update the "roof" and "holes" properties of roofs and obstacles
|
|
@@ -41,19 +42,22 @@ export function UpdateRoofObstacleRelations(state, updateVersionEnable = true) {
|
|
|
41
42
|
})
|
|
42
43
|
|
|
43
44
|
let heightReference = 0
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
(p)
|
|
49
|
-
(p.z = verticalProjectionOnPlane(
|
|
50
|
-
p,
|
|
51
|
-
roof.normalVector,
|
|
52
|
-
roof.flatOutline[0]
|
|
53
|
-
).z)
|
|
45
|
+
//updateObstacle z values
|
|
46
|
+
if (obstacle.layer == 'obstacle') {
|
|
47
|
+
obstacle.outline.forEach((p) => {
|
|
48
|
+
let roof = roofsWithObstacle.find((roof) =>
|
|
49
|
+
isInsidePolygon(p, roof.outline)
|
|
54
50
|
)
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
if (roof) {
|
|
52
|
+
p.z = verticalProjectionOnPlane(
|
|
53
|
+
p,
|
|
54
|
+
roof.normalVector,
|
|
55
|
+
roof.flatOutline[0]
|
|
56
|
+
).z
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
for (let roof of roofsWithObstacle) {
|
|
57
61
|
heightReference = obstacle.outline.reduce((acc, cur) => {
|
|
58
62
|
acc = Math.max(
|
|
59
63
|
acc,
|
|
@@ -37,6 +37,7 @@ export default {
|
|
|
37
37
|
transparent: true,
|
|
38
38
|
opacity: beamOpacity
|
|
39
39
|
})
|
|
40
|
+
|
|
40
41
|
this.material.node = new THREE.PointsMaterial({
|
|
41
42
|
size: 0.05,
|
|
42
43
|
sizeAttenuation: true,
|
|
@@ -48,7 +49,7 @@ export default {
|
|
|
48
49
|
this.material.panel = {}
|
|
49
50
|
|
|
50
51
|
for (let k = 0; k < defaultTextureUrls.length; k++) {
|
|
51
|
-
|
|
52
|
+
let texture = this.loader.load(
|
|
52
53
|
defaultTextureUrls[k],
|
|
53
54
|
function (texture) {}
|
|
54
55
|
)
|
|
@@ -69,7 +70,39 @@ export default {
|
|
|
69
70
|
opacity: 0.5
|
|
70
71
|
})
|
|
71
72
|
|
|
72
|
-
this.material.
|
|
73
|
+
this.material.highlight = new THREE.MeshPhongMaterial({
|
|
74
|
+
color: 0xffffff,
|
|
75
|
+
specular: 0x009900,
|
|
76
|
+
shininess: 0,
|
|
77
|
+
flatShading: true,
|
|
78
|
+
side: THREE.DoubleSide,
|
|
79
|
+
transparent: true,
|
|
80
|
+
opacity: 0.4,
|
|
81
|
+
alphaTest: 0.3
|
|
82
|
+
})
|
|
83
|
+
this.material.selected = new THREE.MeshPhongMaterial({
|
|
84
|
+
color: 0x5050ff,
|
|
85
|
+
specular: 0x009900,
|
|
86
|
+
shininess: 0,
|
|
87
|
+
flatShading: true,
|
|
88
|
+
side: THREE.DoubleSide,
|
|
89
|
+
transparent: true,
|
|
90
|
+
opacity: 0.5,
|
|
91
|
+
alphaTest: 0.3
|
|
92
|
+
})
|
|
93
|
+
this.material.hidden = new THREE.MeshBasicMaterial({
|
|
94
|
+
color: 0xffffff,
|
|
95
|
+
transparent: true,
|
|
96
|
+
alphaTest: 1,
|
|
97
|
+
opacity: 0
|
|
98
|
+
})
|
|
99
|
+
this.material.moduleField = new THREE.MeshBasicMaterial({
|
|
100
|
+
color: 0xe0e0ff,
|
|
101
|
+
side: THREE.DoubleSide,
|
|
102
|
+
transparent: true,
|
|
103
|
+
opacity: 0.3
|
|
104
|
+
})
|
|
105
|
+
this.material.moduleFieldWithPanelOveride = new THREE.MeshPhongMaterial({
|
|
73
106
|
color: 0xfc9d03,
|
|
74
107
|
specular: 0x000000,
|
|
75
108
|
shininess: 0,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
methods: {
|
|
3
3
|
clearThreeObjects(obj) {
|
|
4
|
+
if(!obj){return}
|
|
4
5
|
while (obj.children.length > 0) {
|
|
5
6
|
this.clearThreeObjects(obj.children[0])
|
|
6
7
|
obj.remove(obj.children[0])
|
|
@@ -40,7 +41,7 @@ export default {
|
|
|
40
41
|
)
|
|
41
42
|
},
|
|
42
43
|
clearMesh(mesh) {
|
|
43
|
-
if (!mesh) {
|
|
44
|
+
if (!mesh || this.scene) {
|
|
44
45
|
return
|
|
45
46
|
}
|
|
46
47
|
this.scene.remove(mesh)
|
|
@@ -10,9 +10,8 @@ export default {
|
|
|
10
10
|
geometries.forEach((geometry) => {
|
|
11
11
|
const positions = geometry.attributes.position.array
|
|
12
12
|
const normals = geometry.attributes.normal.array
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
mergedNormals.push(...normals)
|
|
13
|
+
mergedVertices.push(...positions.slice(0, 3 * geometry.drawRange.count))
|
|
14
|
+
mergedNormals.push(...normals.slice(0, 3 * geometry.drawRange.count))
|
|
16
15
|
|
|
17
16
|
if (geometry.attributes.uv) {
|
|
18
17
|
const uvs = geometry.attributes.uv.array
|
|
@@ -4,17 +4,19 @@ export default {
|
|
|
4
4
|
methods: {
|
|
5
5
|
renderModuleFields() {
|
|
6
6
|
this.clearByType('moduleFieldsMeshes')
|
|
7
|
-
|
|
7
|
+
if (!this.areModuleFieldsVisible) {
|
|
8
|
+
return
|
|
9
|
+
}
|
|
8
10
|
this.moduleFields.forEach((moduleFieldPolygon) => {
|
|
9
|
-
if (
|
|
10
|
-
!moduleFieldPolygon.data.number_of_panels_override &&
|
|
11
|
-
!this.areModuleFieldsVisible
|
|
12
|
-
)
|
|
13
|
-
return
|
|
14
11
|
const geometry = getBufferModuleFieldGeometry(moduleFieldPolygon)
|
|
15
12
|
if (geometry) {
|
|
13
|
+
let material
|
|
14
|
+
if(moduleFieldPolygon.data.number_of_panels_override){
|
|
15
|
+
material=this.material.moduleFieldWithPanelOveride
|
|
16
|
+
}else{
|
|
17
|
+
material=this.material.moduleField
|
|
18
|
+
}
|
|
16
19
|
const mesh = new THREE.Mesh(geometry, this.material.moduleField)
|
|
17
|
-
geometry.dispose()
|
|
18
20
|
mesh.matrixAutoUpdate = false
|
|
19
21
|
mesh.userData.version = moduleFieldPolygon.version
|
|
20
22
|
mesh.userData.type = 'moduleFieldsMeshes'
|
|
@@ -35,7 +35,8 @@ export default {
|
|
|
35
35
|
roofPolygon
|
|
36
36
|
)
|
|
37
37
|
if (geometry && geometrySide) {
|
|
38
|
-
const mesh = new THREE.Mesh(geometry, this.material.
|
|
38
|
+
const mesh = new THREE.Mesh(geometry, this.material.hidden)
|
|
39
|
+
|
|
39
40
|
const meshSide = new THREE.Mesh(geometrySide, this.material.wall)
|
|
40
41
|
// this.applyTextureOnMesh(this.material.roof, mesh)
|
|
41
42
|
|
|
@@ -56,6 +57,7 @@ export default {
|
|
|
56
57
|
this.meshes.obstacleMeshes[
|
|
57
58
|
obstaclePolygon.id + '-' + roofPolygon.id + '_side'
|
|
58
59
|
] = meshSide
|
|
60
|
+
this.scene.add(mesh)
|
|
59
61
|
}
|
|
60
62
|
obstacleGeometries.push(
|
|
61
63
|
this.meshes.obstacleMeshes[
|
|
@@ -57,6 +57,9 @@ export default {
|
|
|
57
57
|
let panelSideGeometries = []
|
|
58
58
|
let panelTopGeometries = {}
|
|
59
59
|
this.panels.forEach((panelPolygon) => {
|
|
60
|
+
if (!panelPolygon.visible) {
|
|
61
|
+
return
|
|
62
|
+
}
|
|
60
63
|
//definition of the material
|
|
61
64
|
if (panelPolygon.moduleField.data.number_of_panels_override) {
|
|
62
65
|
return
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
intersectOutlines,
|
|
9
9
|
verticalProjectionOnPlane
|
|
10
10
|
} from '@eturnity/eturnity_maths'
|
|
11
|
-
import {debounce} from 'lodash'
|
|
11
|
+
import { debounce } from 'lodash'
|
|
12
12
|
export default {
|
|
13
13
|
data() {
|
|
14
14
|
return {
|
|
@@ -99,7 +99,6 @@ export default {
|
|
|
99
99
|
mesh.userData.version = roofPolygon.version
|
|
100
100
|
geometry = mesh.geometry
|
|
101
101
|
geometry = this.updateRoofGeometry(geometry, roofPolygon)
|
|
102
|
-
|
|
103
102
|
//in order to be able to render multiple material on it (background and image overlay)
|
|
104
103
|
mesh.geometry = geometry
|
|
105
104
|
mesh.updateMatrix()
|
|
@@ -109,13 +108,14 @@ export default {
|
|
|
109
108
|
//create
|
|
110
109
|
geometry = this.createRoofGeometry(roofPolygon)
|
|
111
110
|
if (geometry) {
|
|
112
|
-
|
|
111
|
+
//material not used here.
|
|
112
|
+
mesh = new THREE.Mesh(geometry, this.material.hidden)
|
|
113
113
|
mesh.userData.version = roofPolygon.version
|
|
114
114
|
mesh.userData.type = 'roofMeshes'
|
|
115
115
|
mesh.userData.meshId = roofPolygon.id
|
|
116
116
|
mesh.userData.polygonId = roofPolygon.id
|
|
117
|
-
mesh.matrixAutoUpdate = false
|
|
118
117
|
this.meshes.roofMeshes[roofPolygon.id] = mesh
|
|
118
|
+
this.scene.add(mesh)
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
roofGeometries.push(this.meshes.roofMeshes[roofPolygon.id].geometry)
|
|
@@ -126,6 +126,7 @@ export default {
|
|
|
126
126
|
roofGeometries,
|
|
127
127
|
this.material.roof
|
|
128
128
|
)
|
|
129
|
+
this.mergedRoofMesh.userData.type = 'mergedRoofMesh'
|
|
129
130
|
this.applyTextureOnMesh(this.material.roof, this.mergedRoofMesh)
|
|
130
131
|
},
|
|
131
132
|
renderFlatRoofs() {
|
|
@@ -136,8 +137,6 @@ export default {
|
|
|
136
137
|
if (geometry) {
|
|
137
138
|
const material = this.material.curvedRoof
|
|
138
139
|
const mesh = new THREE.Mesh(geometry, material)
|
|
139
|
-
geometry.dispose()
|
|
140
|
-
geometry = null
|
|
141
140
|
mesh.itemData = roofPolygon
|
|
142
141
|
mesh.frustumCulled = false
|
|
143
142
|
this.scene.add(mesh)
|
|
@@ -28,6 +28,9 @@ export default {
|
|
|
28
28
|
this.renderTiles()
|
|
29
29
|
}, 1000),
|
|
30
30
|
async renderTiles() {
|
|
31
|
+
if (!this.scene) {
|
|
32
|
+
return
|
|
33
|
+
}
|
|
31
34
|
if (
|
|
32
35
|
!this.selectedMapLayer ||
|
|
33
36
|
['googleLayerRoadmap', 'googleLayer', 'googleLayerTerrain'].includes(
|
|
@@ -62,6 +65,7 @@ export default {
|
|
|
62
65
|
this.scene.remove(this.googleBackgroundMap)
|
|
63
66
|
this.clearThreeObjects(this.googleBackgroundMap)
|
|
64
67
|
}
|
|
68
|
+
|
|
65
69
|
let zoomLvl = this.provider.maxZoom
|
|
66
70
|
|
|
67
71
|
const latitude = this.layoutSettings.layout_latitude
|
|
@@ -173,6 +173,11 @@ export default {
|
|
|
173
173
|
arg: []
|
|
174
174
|
})
|
|
175
175
|
} else if (params.layer == 'obstacle') {
|
|
176
|
+
methodList.push({
|
|
177
|
+
name: 'renderBase',
|
|
178
|
+
method: this.renderBase,
|
|
179
|
+
arg: []
|
|
180
|
+
})
|
|
176
181
|
methodList.push({
|
|
177
182
|
name: 'renderRoofs',
|
|
178
183
|
method: this.renderRoofs,
|
|
@@ -398,13 +403,16 @@ export default {
|
|
|
398
403
|
this.tweenCamera = null
|
|
399
404
|
}
|
|
400
405
|
this.clearThreeObjects(this.scene)
|
|
406
|
+
|
|
401
407
|
if (this.three_map) {
|
|
402
408
|
this.three_map.clear()
|
|
403
409
|
this.clearThreeObjects(this.three_map)
|
|
404
410
|
}
|
|
405
411
|
this.renderer.clear()
|
|
406
412
|
this.renderer.dispose()
|
|
407
|
-
this.orbitControl.dispose
|
|
413
|
+
if (this.orbitControl && this.orbitControl.dispose) {
|
|
414
|
+
this.orbitControl.dispose()
|
|
415
|
+
}
|
|
408
416
|
|
|
409
417
|
this.renderer = null
|
|
410
418
|
this.scene = null
|
package/src/helper/threeMixin.js
CHANGED
|
@@ -22,7 +22,10 @@ export default {
|
|
|
22
22
|
|
|
23
23
|
if (this.selectedMapLayer === null) {
|
|
24
24
|
for (var i in this.layers) {
|
|
25
|
-
if (
|
|
25
|
+
if (
|
|
26
|
+
this.globalProjectProperties &&
|
|
27
|
+
this.layers[i].key === this.globalProjectProperties.map_type
|
|
28
|
+
) {
|
|
26
29
|
this.setSelectedMapLayer(this.layers[i])
|
|
27
30
|
}
|
|
28
31
|
}
|
|
@@ -131,21 +134,26 @@ export default {
|
|
|
131
134
|
this.resizeCanvasToDisplaySize()
|
|
132
135
|
},
|
|
133
136
|
resizeCanvasToDisplaySize() {
|
|
137
|
+
console.log("resizeCanvasToDisplaySize")
|
|
134
138
|
const canvas = this.renderer.domElement
|
|
135
139
|
// look up the size the canvas is being displayed
|
|
136
140
|
const width = canvas.clientWidth
|
|
137
141
|
const height = canvas.clientHeight
|
|
138
|
-
|
|
139
142
|
// adjust displayBuffer size to match
|
|
140
143
|
if (canvas.width !== width || canvas.height !== height) {
|
|
141
144
|
// you must pass false here or three.js sadly fights the browser
|
|
145
|
+
|
|
142
146
|
this.renderer.setSize(width, height, false)
|
|
143
147
|
this.renderer.setViewport(0, 0, width, height)
|
|
144
|
-
|
|
148
|
+
if (this.composer) {
|
|
149
|
+
//this.composer.setSize(width, height, false)
|
|
150
|
+
this.composer.setPixelRatio(Math.min(window.devicePixelRatio, 2))
|
|
151
|
+
if (this.composer.setViewport) {
|
|
152
|
+
this.composer.setViewport(0, 0, width, height)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
145
155
|
this.camera.aspect = width / height
|
|
146
156
|
this.camera.updateProjectionMatrix()
|
|
147
|
-
|
|
148
|
-
// update any render target sizes here
|
|
149
157
|
}
|
|
150
158
|
}
|
|
151
159
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Point, Line } from '@eturnity/eturnity_maths'
|
|
2
2
|
import { mmTolerance } from '../config'
|
|
3
3
|
import {
|
|
4
|
-
|
|
4
|
+
isAlmostSamePoint3D,
|
|
5
5
|
isAlmostSameSegment2D,
|
|
6
|
-
|
|
6
|
+
isAlmostSameSegment3D,
|
|
7
7
|
isAlmostSamePoint2D
|
|
8
8
|
} from '@eturnity/eturnity_maths'
|
|
9
9
|
|
|
@@ -83,7 +83,9 @@ export function generateNodes3D(polygons) {
|
|
|
83
83
|
const outline = polygon.outline
|
|
84
84
|
outline.forEach((point, i) => {
|
|
85
85
|
//check if nodes2D already exist
|
|
86
|
-
let node3D = nodes3D.find((node) =>
|
|
86
|
+
let node3D = nodes3D.find((node) =>
|
|
87
|
+
isAlmostSamePoint3D(node, point, mmTolerance)
|
|
88
|
+
)
|
|
87
89
|
if (!node3D) {
|
|
88
90
|
node3D = new Point(point.x, point.y, point.z, polygon.layer)
|
|
89
91
|
node3D.belongsTo = []
|
|
@@ -178,8 +180,11 @@ export function generateEdges3D(polygons) {
|
|
|
178
180
|
//check if edge2D already exist
|
|
179
181
|
const nextPoint = outline[(i + 1) % outline.length]
|
|
180
182
|
let edge3D = edges3D.find((edge) => {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
isAlmostSameSegment3D(
|
|
184
|
+
[point, nextPoint],
|
|
185
|
+
edge.outline,
|
|
186
|
+
mmTolerance
|
|
187
|
+
) && edge.layer == polygon.layer
|
|
183
188
|
})
|
|
184
189
|
if (!edge3D) {
|
|
185
190
|
//create an edge at this position
|