@eturnity/eturnity_3d 7.2.3 → 7.2.4-EPDM-7379.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/components/ThreeCanvasViewer.vue +4 -12
- package/src/config.js +3 -3
- package/src/helper/UpdateRoofModuleFieldRelations.js +1 -1
- package/src/helper/cameraMixin.js +274 -17
- package/src/helper/materialMixin.js +29 -7
- package/src/helper/render/circle.png +0 -0
- package/src/helper/render/clear.js +7 -15
- package/src/helper/render/edge.js +52 -20
- package/src/helper/render/imageOverlay.js +1 -1
- package/src/helper/render/margin.js +56 -37
- package/src/helper/render/mergedGeometry.js +4 -3
- package/src/helper/render/moduleField.js +9 -5
- package/src/helper/render/node.js +12 -2
- package/src/helper/render/panel.js +64 -34
- package/src/helper/render/roof.js +28 -10
- package/src/helper/render/tile.js +1 -1
- package/src/helper/renderMixin.js +64 -7
- package/src/helper/threeMixin.js +13 -12
- package/src/store/hydrateData.js +23 -0
- package/src/store/nodesEdgesCreation.js +10 -9
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eturnity/eturnity_3d",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "7.2.
|
|
4
|
+
"version": "7.2.4-EPDM-7379.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": "7.2.3",
|
|
13
|
+
"@eturnity/eturnity_maths": "7.2.3-qa-7.6.0",
|
|
14
14
|
"core-js": "^2.6.12",
|
|
15
15
|
"cors": "^2.8.5",
|
|
16
16
|
"earcut": "^2.2.4",
|
|
@@ -25,15 +25,6 @@ export default {
|
|
|
25
25
|
data() {
|
|
26
26
|
return {
|
|
27
27
|
scene: new THREE.Scene(),
|
|
28
|
-
camera: new THREE.PerspectiveCamera(50, 300 / 300, 0.1, 100000),
|
|
29
|
-
orthographicCamera: new THREE.OrthographicCamera(
|
|
30
|
-
10 / -2,
|
|
31
|
-
10 / 2,
|
|
32
|
-
10 / 2,
|
|
33
|
-
10 / -2,
|
|
34
|
-
1,
|
|
35
|
-
1000
|
|
36
|
-
),
|
|
37
28
|
layers: null,
|
|
38
29
|
provider: null,
|
|
39
30
|
cameraProjection: null,
|
|
@@ -61,13 +52,14 @@ export default {
|
|
|
61
52
|
},
|
|
62
53
|
screenshotable: false,
|
|
63
54
|
areModuleFieldsVisible: false,
|
|
55
|
+
areUserDeactivatedPanelsVisible: false,
|
|
56
|
+
animationFrameId: null,
|
|
64
57
|
intervalId: null,
|
|
65
|
-
requestAnimationFrameId: null,
|
|
66
58
|
}
|
|
67
59
|
},
|
|
68
60
|
beforeDestroy() {
|
|
69
61
|
clearInterval(this.intervalId)
|
|
70
|
-
cancelAnimationFrame(this.
|
|
62
|
+
cancelAnimationFrame(this.animationFrameId)
|
|
71
63
|
},
|
|
72
64
|
mixins: [renderMixin, threeMixin, materialMixin],
|
|
73
65
|
async mounted() {
|
|
@@ -288,7 +280,7 @@ export default {
|
|
|
288
280
|
},
|
|
289
281
|
animate() {
|
|
290
282
|
this.render()
|
|
291
|
-
this.
|
|
283
|
+
this.animationFrameId = requestAnimationFrame(this.animate)
|
|
292
284
|
},
|
|
293
285
|
render() {
|
|
294
286
|
this.renderer.clear()
|
package/src/config.js
CHANGED
|
@@ -4,7 +4,7 @@ export const snapToPointTolerance = 15
|
|
|
4
4
|
export const snapToIntersectionPointTolerance = 15
|
|
5
5
|
export const snapToLineTolerance = 10
|
|
6
6
|
export const distanceToCloseNode = 70
|
|
7
|
-
export const mmTolerance =
|
|
7
|
+
export const mmTolerance = 1
|
|
8
8
|
export const earthRadius = 6371008
|
|
9
9
|
|
|
10
10
|
export const layerColors = {
|
|
@@ -139,8 +139,8 @@ export const maxMargin = 2500
|
|
|
139
139
|
export const node3DRadius = 0.05
|
|
140
140
|
export const beamColor = '#ffffff'
|
|
141
141
|
export const node3DColor = 'white'
|
|
142
|
-
export const beamOpacity = 0.
|
|
143
|
-
export const node3dOpacity = 0.
|
|
142
|
+
export const beamOpacity = 0.1
|
|
143
|
+
export const node3dOpacity = 0.1
|
|
144
144
|
export const dimMarginColor = '#ff000020'
|
|
145
145
|
export const defaultTextureUrl = require('./assets/images/panels/reneSola_Virtus_2_JC320S_24_Bbw.png')
|
|
146
146
|
const textureImageDomain = 'https://public-data.eturnity.io/'
|
|
@@ -33,7 +33,7 @@ export function UpdateRoofModuleFieldRelations(state) {
|
|
|
33
33
|
//check if everypoint is in the same roof and if they are not too far from the flat surface.(at least above)
|
|
34
34
|
let roofPolygonCandidates = roofPolygons.filter((roof) => {
|
|
35
35
|
const intersection = intersectOutlines(moduleField.outline, roof.outline)
|
|
36
|
-
|
|
36
|
+
if (intersection.length == 0) return false
|
|
37
37
|
const intersectionArea = calculateArea(intersection[0])
|
|
38
38
|
return intersectionArea > 100 && moduleField.area <= roof.area
|
|
39
39
|
})
|
|
@@ -1,12 +1,135 @@
|
|
|
1
1
|
import TWEEN from 'tween'
|
|
2
|
+
import * as THREE from 'three'
|
|
3
|
+
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
|
|
2
4
|
import {
|
|
3
5
|
addVector,
|
|
6
|
+
getDistanceBetweenPoints,
|
|
4
7
|
multiplyVector,
|
|
5
8
|
substractVector
|
|
6
9
|
} from '@eturnity/eturnity_maths'
|
|
7
10
|
|
|
8
11
|
export default {
|
|
12
|
+
data() {
|
|
13
|
+
return {
|
|
14
|
+
camera: null,
|
|
15
|
+
perspectiveCamera: new THREE.PerspectiveCamera(50, 300 / 300, 1, 50000),
|
|
16
|
+
orthographicCamera: new THREE.OrthographicCamera(10, 10, 10, 10, 1, 1000)
|
|
17
|
+
}
|
|
18
|
+
},
|
|
9
19
|
methods: {
|
|
20
|
+
turnPerspectiveCameraToOrthogonal() {
|
|
21
|
+
const cameraPosition = new THREE.Vector3(
|
|
22
|
+
this.camera.position.x,
|
|
23
|
+
this.camera.position.y,
|
|
24
|
+
this.camera.position.z
|
|
25
|
+
)
|
|
26
|
+
var halfHeightDistance =
|
|
27
|
+
(this.camera.position.z * this.camera.fov * Math.PI) / 180
|
|
28
|
+
|
|
29
|
+
// Create an orthographic camera aligned to look down
|
|
30
|
+
this.orthographicCamera.left =
|
|
31
|
+
(-this.camera.aspect * halfHeightDistance) / 2
|
|
32
|
+
this.orthographicCamera.right =
|
|
33
|
+
(this.camera.aspect * halfHeightDistance) / 2
|
|
34
|
+
this.orthographicCamera.top = halfHeightDistance / 2
|
|
35
|
+
this.orthographicCamera.bottom = -halfHeightDistance / 2
|
|
36
|
+
this.orthographicCamera.near = 1
|
|
37
|
+
this.orthographicCamera.far = 1000
|
|
38
|
+
this.orthographicCamera.up = new THREE.Vector3(0, 1, 0)
|
|
39
|
+
this.orthographicCamera.position.set(
|
|
40
|
+
cameraPosition.x,
|
|
41
|
+
cameraPosition.y,
|
|
42
|
+
100
|
|
43
|
+
)
|
|
44
|
+
this.camera = this.orthographicCamera
|
|
45
|
+
this.camera.position.set(
|
|
46
|
+
cameraPosition.x,
|
|
47
|
+
cameraPosition.y,
|
|
48
|
+
cameraPosition.z
|
|
49
|
+
)
|
|
50
|
+
this.camera.position.set(
|
|
51
|
+
cameraPosition.x,
|
|
52
|
+
cameraPosition.y,
|
|
53
|
+
cameraPosition.z
|
|
54
|
+
)
|
|
55
|
+
this.camera.updateProjectionMatrix()
|
|
56
|
+
this.renderer.camera = this.camera
|
|
57
|
+
this.composer.renderCamera = this.camera
|
|
58
|
+
|
|
59
|
+
this.renderPass.camera = this.camera
|
|
60
|
+
this.overlayRenderPass.camera = this.camera
|
|
61
|
+
this.outlinePassHighlight.renderCamera = this.camera
|
|
62
|
+
this.outlinePassSelected.renderCamera = this.camera
|
|
63
|
+
|
|
64
|
+
this.orbitControl.screenSpacePanning = true
|
|
65
|
+
this.orbitControl.object = this.camera
|
|
66
|
+
this.orbitControl.target.set(cameraPosition.x, cameraPosition.y, 0)
|
|
67
|
+
this.orbitControl.mouseButtons = {
|
|
68
|
+
LEFT: THREE.MOUSE.PAN,
|
|
69
|
+
MIDDLE: THREE.MOUSE.DOLLY,
|
|
70
|
+
RIGHT: THREE.MOUSE.ROTATE
|
|
71
|
+
}
|
|
72
|
+
this.orbitControl.enableRotate = false
|
|
73
|
+
this.orbitControl.addEventListener('change', () => {
|
|
74
|
+
this.orbitControlChange()
|
|
75
|
+
})
|
|
76
|
+
this.orbitControl.update()
|
|
77
|
+
this.camera.position.set(
|
|
78
|
+
cameraPosition.x,
|
|
79
|
+
cameraPosition.y,
|
|
80
|
+
cameraPosition.z
|
|
81
|
+
)
|
|
82
|
+
this.camera.lookAt(
|
|
83
|
+
new THREE.Vector3(cameraPosition.x, cameraPosition.y, 0)
|
|
84
|
+
) // Set look at coordinate like this
|
|
85
|
+
this.camera.updateProjectionMatrix()
|
|
86
|
+
this.nodesVisible = true
|
|
87
|
+
this.renderNodes()
|
|
88
|
+
this.composer.render()
|
|
89
|
+
},
|
|
90
|
+
turnOrthogonalCameraToPerspective() {
|
|
91
|
+
this.camera = this.perspectiveCamera
|
|
92
|
+
let altitude =
|
|
93
|
+
(this.orthographicCamera.right - this.orthographicCamera.left) /
|
|
94
|
+
((this.perspectiveCamera.fov * Math.PI) / 180) /
|
|
95
|
+
this.perspectiveCamera.aspect
|
|
96
|
+
|
|
97
|
+
this.camera.position.set(
|
|
98
|
+
this.orthographicCamera.position.x,
|
|
99
|
+
this.orthographicCamera.position.y,
|
|
100
|
+
altitude
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
this.camera.up = new THREE.Vector3(0, 0, 1)
|
|
104
|
+
this.camera.updateProjectionMatrix()
|
|
105
|
+
|
|
106
|
+
this.renderer.camera = this.camera
|
|
107
|
+
this.composer.renderer.camera = this.camera
|
|
108
|
+
this.composer.renderCamera = this.camera
|
|
109
|
+
this.renderPass.camera = this.camera
|
|
110
|
+
this.overlayRenderPass.camera = this.camera
|
|
111
|
+
this.outlinePassHighlight.camera = this.camera
|
|
112
|
+
this.outlinePassHighlight.renderCamera = this.camera
|
|
113
|
+
this.outlinePassSelected.camera = this.camera
|
|
114
|
+
this.outlinePassSelected.renderCamera = this.camera
|
|
115
|
+
this.orbitControl.camera = this.camera
|
|
116
|
+
this.orbitControl.object = this.camera
|
|
117
|
+
this.orbitControl.target.set(
|
|
118
|
+
this.camera.position.x,
|
|
119
|
+
this.camera.position.y,
|
|
120
|
+
0
|
|
121
|
+
)
|
|
122
|
+
this.orbitControl.screenSpacePanning = false
|
|
123
|
+
this.orbitControl.enableRotate = true
|
|
124
|
+
this.orbitControl.mouseButtons = {
|
|
125
|
+
LEFT: THREE.MOUSE.ROTATE,
|
|
126
|
+
MIDDLE: THREE.MOUSE.DOLLY,
|
|
127
|
+
RIGHT: THREE.MOUSE.PAN
|
|
128
|
+
}
|
|
129
|
+
this.orbitControl.update()
|
|
130
|
+
|
|
131
|
+
this.composer.render()
|
|
132
|
+
},
|
|
10
133
|
zoomIn3D() {
|
|
11
134
|
let target = this.orbitControl.target
|
|
12
135
|
let curentPosition = this.camera.position
|
|
@@ -39,6 +162,7 @@ export default {
|
|
|
39
162
|
},
|
|
40
163
|
setCameraGlobalPosition() {
|
|
41
164
|
if (this.roofs.length == 0) return
|
|
165
|
+
let newFov = 50
|
|
42
166
|
let bounds = this.roofsBounds
|
|
43
167
|
let targetVector = {
|
|
44
168
|
x: (bounds.xMax + bounds.xMin) / 2000,
|
|
@@ -50,7 +174,7 @@ export default {
|
|
|
50
174
|
(bounds.yMax - bounds.yMin) / 2000
|
|
51
175
|
)
|
|
52
176
|
let distance =
|
|
53
|
-
5 + objectRadius_m / Math.sin(((
|
|
177
|
+
5 + objectRadius_m / Math.sin(((newFov / 2) * Math.PI) / 180)
|
|
54
178
|
let cameraMoveVector = { x: 0, y: 0, z: distance }
|
|
55
179
|
const positionVector = addVector(targetVector, cameraMoveVector)
|
|
56
180
|
const position = [
|
|
@@ -59,8 +183,39 @@ export default {
|
|
|
59
183
|
positionVector.z
|
|
60
184
|
]
|
|
61
185
|
let target = [targetVector.x, targetVector.y, targetVector.z]
|
|
186
|
+
this.setTweenTo(position, target, newFov)
|
|
187
|
+
},
|
|
188
|
+
setCameraGlobalVerticalPosition() {
|
|
189
|
+
let position, target
|
|
190
|
+
let newFov = 10
|
|
191
|
+
if (this.roofs.length != 0) {
|
|
192
|
+
let bounds = this.roofsBounds
|
|
193
|
+
let targetVector = {
|
|
194
|
+
x: (bounds.xMax + bounds.xMin) / 2000,
|
|
195
|
+
y: (bounds.yMax + bounds.yMin) / 2000,
|
|
196
|
+
z: 0
|
|
197
|
+
}
|
|
198
|
+
let objectRadius_m = Math.max(
|
|
199
|
+
(bounds.xMax - bounds.xMin) / 2000,
|
|
200
|
+
(bounds.yMax - bounds.yMin) / 2000
|
|
201
|
+
)
|
|
62
202
|
|
|
63
|
-
|
|
203
|
+
let distance =
|
|
204
|
+
2 * (objectRadius_m / Math.sin(((newFov / 2) * Math.PI) / 180))
|
|
205
|
+
let cameraMoveVector = { x: 0, y: 0, z: distance }
|
|
206
|
+
const positionVector = addVector(targetVector, cameraMoveVector)
|
|
207
|
+
position = [positionVector.x, positionVector.y, positionVector.z]
|
|
208
|
+
target = [targetVector.x, targetVector.y, targetVector.z]
|
|
209
|
+
} else {
|
|
210
|
+
position = [0, 0, 300]
|
|
211
|
+
target = [0, 0, 0]
|
|
212
|
+
}
|
|
213
|
+
this.setTweenTo(
|
|
214
|
+
position,
|
|
215
|
+
target,
|
|
216
|
+
newFov,
|
|
217
|
+
this.turnPerspectiveCameraToOrthogonal
|
|
218
|
+
)
|
|
64
219
|
},
|
|
65
220
|
setCameraOrthogonalTo(polygon) {
|
|
66
221
|
if (polygon) {
|
|
@@ -109,23 +264,125 @@ export default {
|
|
|
109
264
|
this.setTweenTo(position, target)
|
|
110
265
|
}
|
|
111
266
|
},
|
|
112
|
-
setTweenTo(position, target,
|
|
267
|
+
setTweenTo(position, target, fov = 50, onCompleteCallback = () => {}) {
|
|
113
268
|
TWEEN.removeAll()
|
|
114
|
-
if (this.orbitControl) {
|
|
115
|
-
this.tweenOrbit = new TWEEN.Tween(this.orbitControl.target)
|
|
116
|
-
.to({ x: target[0], y: target[1], z: target[2] }, speed)
|
|
117
|
-
.easing(TWEEN.Easing.Sinusoidal.Out)
|
|
118
|
-
.start()
|
|
119
|
-
}
|
|
120
269
|
if (this.camera) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
270
|
+
const currentTweenVar = {
|
|
271
|
+
t: 0
|
|
272
|
+
}
|
|
273
|
+
const initialTarget = {
|
|
274
|
+
x: this.orbitControl.target.x,
|
|
275
|
+
y: this.orbitControl.target.y,
|
|
276
|
+
z: this.orbitControl.target.z
|
|
277
|
+
}
|
|
278
|
+
const initialFov = this.camera.fov
|
|
279
|
+
const initialCameraPosition = {
|
|
280
|
+
x: this.camera.position.x,
|
|
281
|
+
y: this.camera.position.y,
|
|
282
|
+
z: this.camera.position.z
|
|
283
|
+
}
|
|
284
|
+
const finalCameraPosition = {
|
|
285
|
+
x: position[0],
|
|
286
|
+
y: position[1],
|
|
287
|
+
z: position[2]
|
|
288
|
+
}
|
|
289
|
+
if (position[0] == target[0] && position[1] == target[1]) {
|
|
290
|
+
const distance2D = getDistanceBetweenPoints(
|
|
291
|
+
finalCameraPosition,
|
|
292
|
+
initialCameraPosition
|
|
293
|
+
)
|
|
294
|
+
//angle from south
|
|
295
|
+
const angle2D = Math.atan2(
|
|
296
|
+
initialCameraPosition.y - finalCameraPosition.y,
|
|
297
|
+
initialCameraPosition.x - finalCameraPosition.x
|
|
298
|
+
)
|
|
299
|
+
this.tweenCamera = new TWEEN.Tween(currentTweenVar)
|
|
300
|
+
.to({ t: 1 }, 2000)
|
|
301
|
+
.easing(TWEEN.Easing.Sinusoidal.Out)
|
|
302
|
+
.onUpdate(() => {
|
|
303
|
+
const t = currentTweenVar.t
|
|
304
|
+
this.camera.fov = initialFov + Math.sqrt(t) * (fov - initialFov)
|
|
305
|
+
|
|
306
|
+
const newDistance = distance2D * (1 - t)
|
|
307
|
+
const newAngle = (angle2D + Math.PI / 2) * (1 - t) - Math.PI / 2
|
|
308
|
+
const newAltitude =
|
|
309
|
+
finalCameraPosition.z +
|
|
310
|
+
(1 - t) * (initialCameraPosition.z - finalCameraPosition.z)
|
|
311
|
+
const nextPosition = {
|
|
312
|
+
x: finalCameraPosition.x + newDistance * Math.cos(newAngle),
|
|
313
|
+
y: finalCameraPosition.y + newDistance * Math.sin(newAngle),
|
|
314
|
+
z: newAltitude
|
|
315
|
+
}
|
|
316
|
+
this.camera.position.set(
|
|
317
|
+
nextPosition.x,
|
|
318
|
+
nextPosition.y,
|
|
319
|
+
nextPosition.z
|
|
320
|
+
)
|
|
321
|
+
this.camera.up = new THREE.Vector3(
|
|
322
|
+
0,
|
|
323
|
+
Math.sin((t * Math.PI) / 2),
|
|
324
|
+
Math.cos((t * Math.PI) / 2)
|
|
325
|
+
)
|
|
326
|
+
|
|
327
|
+
this.camera.updateProjectionMatrix()
|
|
328
|
+
const nextTarget = {
|
|
329
|
+
x: initialTarget.x + t * (target[0] - initialTarget.x),
|
|
330
|
+
y: initialTarget.y + t * (target[1] - initialTarget.y),
|
|
331
|
+
z: initialTarget.z + t * (target[2] - initialTarget.z)
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
this.orbitControl.target.set(
|
|
335
|
+
nextTarget.x,
|
|
336
|
+
nextTarget.y,
|
|
337
|
+
nextTarget.z
|
|
338
|
+
)
|
|
339
|
+
if (this.orbitControl && this.orbitControl.update)
|
|
340
|
+
this.orbitControl.update()
|
|
341
|
+
})
|
|
342
|
+
.onComplete(() => {
|
|
343
|
+
onCompleteCallback()
|
|
344
|
+
})
|
|
345
|
+
} else {
|
|
346
|
+
this.camera.up = { x: 0, y: 0, z: 1 }
|
|
347
|
+
this.tweenCamera = new TWEEN.Tween(currentTweenVar)
|
|
348
|
+
.to({ t: 1 }, 2000)
|
|
349
|
+
.easing(TWEEN.Easing.Sinusoidal.Out)
|
|
350
|
+
.onUpdate(() => {
|
|
351
|
+
const t = currentTweenVar.t
|
|
352
|
+
this.camera.fov = initialFov + t * t * (fov - initialFov)
|
|
353
|
+
this.camera.updateProjectionMatrix()
|
|
354
|
+
|
|
355
|
+
const nextPosition = {
|
|
356
|
+
x:
|
|
357
|
+
finalCameraPosition.x +
|
|
358
|
+
(1 - t) * (initialCameraPosition.x - finalCameraPosition.x),
|
|
359
|
+
y:
|
|
360
|
+
finalCameraPosition.y +
|
|
361
|
+
(1 - t) * (initialCameraPosition.y - finalCameraPosition.y),
|
|
362
|
+
z:
|
|
363
|
+
finalCameraPosition.z +
|
|
364
|
+
(1 - t) * (initialCameraPosition.z - finalCameraPosition.z)
|
|
365
|
+
}
|
|
366
|
+
this.camera.position.set(
|
|
367
|
+
nextPosition.x,
|
|
368
|
+
nextPosition.y,
|
|
369
|
+
nextPosition.z
|
|
370
|
+
)
|
|
371
|
+
const nextTarget = {
|
|
372
|
+
x: initialTarget.x + t * (target[0] - initialTarget.x),
|
|
373
|
+
y: initialTarget.y + t * (target[1] - initialTarget.y),
|
|
374
|
+
z: initialTarget.z + t * (target[2] - initialTarget.z)
|
|
375
|
+
}
|
|
376
|
+
this.orbitControl.target.set(
|
|
377
|
+
nextTarget.x,
|
|
378
|
+
nextTarget.y,
|
|
379
|
+
nextTarget.z
|
|
380
|
+
)
|
|
381
|
+
if (this.orbitControl && this.orbitControl.update)
|
|
382
|
+
this.orbitControl.update()
|
|
383
|
+
})
|
|
384
|
+
}
|
|
385
|
+
this.tweenCamera.start()
|
|
129
386
|
}
|
|
130
387
|
}
|
|
131
388
|
},
|
|
@@ -32,18 +32,32 @@ export default {
|
|
|
32
32
|
side: THREE.DoubleSide
|
|
33
33
|
})
|
|
34
34
|
|
|
35
|
-
this.material.edge = new THREE.
|
|
35
|
+
this.material.edge = new THREE.MeshBasicMaterial({
|
|
36
36
|
color: beamColor,
|
|
37
37
|
transparent: true,
|
|
38
38
|
opacity: beamOpacity
|
|
39
39
|
})
|
|
40
|
+
//Creating dot alpha texture for nodes
|
|
41
|
+
const canvas = document.createElement('canvas'),
|
|
42
|
+
ctx = canvas.getContext('2d');
|
|
43
|
+
canvas.width = 64
|
|
44
|
+
canvas.height = 64
|
|
45
|
+
ctx.fillStyle = 'black'
|
|
46
|
+
ctx.fillRect(0, 0, 64, 64)
|
|
47
|
+
ctx.strokeStyle = 'white'
|
|
48
|
+
ctx.beginPath()
|
|
49
|
+
ctx.lineWidth = 10
|
|
50
|
+
ctx.arc(32, 32, 16, 0, Math.PI * 2)
|
|
51
|
+
ctx.stroke()
|
|
52
|
+
const texture = new THREE.CanvasTexture(canvas)
|
|
40
53
|
|
|
41
54
|
this.material.node = new THREE.PointsMaterial({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
alphaMap: texture,
|
|
56
|
+
size: 25,
|
|
57
|
+
sizeAttenuation: false,
|
|
58
|
+
transparent: true,
|
|
59
|
+
color: "0xffffff",
|
|
60
|
+
opacity: 1,
|
|
47
61
|
})
|
|
48
62
|
|
|
49
63
|
this.material.panel = {}
|
|
@@ -58,6 +72,13 @@ export default {
|
|
|
58
72
|
side: THREE.DoubleSide
|
|
59
73
|
})
|
|
60
74
|
}
|
|
75
|
+
this.material.panel['userDeactivatedPanel'] = new THREE.MeshBasicMaterial({
|
|
76
|
+
color: 0xffffff,
|
|
77
|
+
transparent: true,
|
|
78
|
+
alphaTest: 0,
|
|
79
|
+
opacity: 0.2,
|
|
80
|
+
side: THREE.DoubleSide
|
|
81
|
+
})
|
|
61
82
|
this.material.roof = [this.material.wall]
|
|
62
83
|
|
|
63
84
|
this.material.flatRoof = new THREE.MeshPhongMaterial({
|
|
@@ -94,7 +115,8 @@ export default {
|
|
|
94
115
|
color: 0xffffff,
|
|
95
116
|
transparent: true,
|
|
96
117
|
alphaTest: 1,
|
|
97
|
-
opacity: 0
|
|
118
|
+
opacity: 0.2,
|
|
119
|
+
side: THREE.DoubleSide
|
|
98
120
|
})
|
|
99
121
|
this.material.moduleField = new THREE.MeshBasicMaterial({
|
|
100
122
|
color: 0xe0e0ff,
|
|
Binary file
|
|
@@ -35,19 +35,18 @@ export default {
|
|
|
35
35
|
let meshTop = this.meshes.panelsMeshes[panel.id + '_top']
|
|
36
36
|
let meshSide = this.meshes.panelsMeshes[panel.id + '_side']
|
|
37
37
|
if (meshTop || meshSide) {
|
|
38
|
-
this.
|
|
39
|
-
this.
|
|
38
|
+
this.clearMeshFromScene(meshTop, this.scene)
|
|
39
|
+
this.clearMeshFromScene(meshSide, this.scene)
|
|
40
40
|
}
|
|
41
41
|
})
|
|
42
42
|
)
|
|
43
43
|
)
|
|
44
44
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (!mesh || !this.scene) {
|
|
45
|
+
clearMeshFromScene(mesh, scene) {
|
|
46
|
+
if (!mesh || !scene) {
|
|
48
47
|
return
|
|
49
48
|
}
|
|
50
|
-
|
|
49
|
+
scene.remove(mesh)
|
|
51
50
|
if (mesh.geometry && mesh.geometry.dispose) {
|
|
52
51
|
mesh.geometry.dispose()
|
|
53
52
|
mesh.geometry = null
|
|
@@ -73,21 +72,14 @@ export default {
|
|
|
73
72
|
clearEdgesRemovedOnes() {
|
|
74
73
|
Object.values(this.meshes['edgeMeshes']).forEach((mesh) => {
|
|
75
74
|
if (!this.edgeIds.includes(mesh.userData.edgeId)) {
|
|
76
|
-
this.
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
},
|
|
80
|
-
clearNodesRemovedOnes() {
|
|
81
|
-
Object.values(this.meshes['nodeMeshes']).forEach((mesh) => {
|
|
82
|
-
if (!this.nodeIds.includes(mesh.userData.nodeId)) {
|
|
83
|
-
this.clearMesh(mesh)
|
|
75
|
+
this.clearMeshFromScene(mesh, this.scene)
|
|
84
76
|
}
|
|
85
77
|
})
|
|
86
78
|
},
|
|
87
79
|
clearRemovedOnes(type) {
|
|
88
80
|
Object.values(this.meshes[type]).forEach((mesh) => {
|
|
89
81
|
if (!this.polygonIds.includes(mesh.userData.polygonId)) {
|
|
90
|
-
this.
|
|
82
|
+
this.clearMeshFromScene(mesh, this.scene)
|
|
91
83
|
}
|
|
92
84
|
})
|
|
93
85
|
},
|
|
@@ -36,30 +36,62 @@ export default {
|
|
|
36
36
|
},
|
|
37
37
|
renderEdges() {
|
|
38
38
|
this.clearEdgesRemovedOnes('edgeMeshes')
|
|
39
|
+
if(this.renderLineEdges){
|
|
40
|
+
this.renderLineEdges()
|
|
41
|
+
}
|
|
39
42
|
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
43
|
const material = this.material.edge
|
|
44
|
-
this.edges
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
cylinder =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
this.edges.forEach((edge) => {
|
|
45
|
+
cylinder = this.meshes.edgeMeshes[edge.id]
|
|
46
|
+
if (cylinder) {
|
|
47
|
+
cylinder.visible = false
|
|
48
|
+
}
|
|
49
|
+
if (['obstacle', 'construction'].includes(edge.layer)) return
|
|
50
|
+
if (
|
|
51
|
+
['selectRoof'].includes(this.selectedTool) &&
|
|
52
|
+
edge.layer != 'roof'
|
|
53
|
+
) {
|
|
54
|
+
return
|
|
55
|
+
}
|
|
56
|
+
if (
|
|
57
|
+
['selectModuleField'].includes(this.selectedTool) &&
|
|
58
|
+
(edge.layer != 'moduleField' ||
|
|
59
|
+
!this.selectedModuleField ||
|
|
60
|
+
!edge.belongsTo
|
|
61
|
+
.map((i) => i.polygonId)
|
|
62
|
+
.includes(this.selectedModuleField.id))
|
|
63
|
+
) {
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
cylinder = this.meshes.edgeMeshes[edge.id]
|
|
67
|
+
if (cylinder) {
|
|
68
|
+
//update
|
|
69
|
+
cylinder.visible = true
|
|
70
|
+
this.setCylinderPosition(cylinder, edge)
|
|
71
|
+
//change cylinder length
|
|
72
|
+
} else {
|
|
73
|
+
const edgeRadius = this.edgeRadius || 0.1
|
|
74
|
+
const geometry = new THREE.CylinderGeometry(
|
|
75
|
+
edgeRadius,
|
|
76
|
+
edgeRadius,
|
|
77
|
+
1,
|
|
78
|
+
6
|
|
79
|
+
)
|
|
80
|
+
if (this.edgeOpacity != undefined) {
|
|
81
|
+
material.opacity = this.edgeOpacity
|
|
82
|
+
}
|
|
83
|
+
cylinder = new THREE.Mesh(geometry, material.clone())
|
|
84
|
+
cylinder = this.setCylinderPosition(cylinder, edge)
|
|
56
85
|
|
|
57
|
-
|
|
86
|
+
cylinder.userData.meshId = edge.id
|
|
87
|
+
cylinder.userData.edgeId = edge.id
|
|
88
|
+
cylinder.userData.type = 'edgeMeshes'
|
|
89
|
+
cylinder.userData.layer = edge.layer
|
|
58
90
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
91
|
+
this.meshes.edgeMeshes[edge.id] = cylinder
|
|
92
|
+
this.scene.add(cylinder)
|
|
93
|
+
}
|
|
94
|
+
})
|
|
63
95
|
}
|
|
64
96
|
}
|
|
65
97
|
}
|
|
@@ -34,7 +34,7 @@ export default {
|
|
|
34
34
|
methods: {
|
|
35
35
|
renderImageOverlayOnBackground() {
|
|
36
36
|
if (!this.imageOverlay || !this.imageOverlayMaterial) {
|
|
37
|
-
this.
|
|
37
|
+
this.clearMeshFromScene(this.meshes.backgroundMesh, this.scene)
|
|
38
38
|
this.meshes.backgroundMesh = null
|
|
39
39
|
return
|
|
40
40
|
}
|