@eturnity/eturnity_3d 8.22.0 → 8.31.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/package.json +1 -1
- package/src/components/ThreeCanvasViewer.vue +70 -62
- package/src/helper/cameraMixin.js +51 -34
- package/src/helper/render/base.js +6 -0
- package/src/helper/render/building.js +23 -0
- package/src/helper/render/edge.js +11 -0
- package/src/helper/render/imageOverlay.js +10 -0
- package/src/helper/render/index.js +6 -1
- package/src/helper/render/loader.js +44 -33
- package/src/helper/render/marker.js +71 -0
- package/src/helper/render/mergedGeometry.js +2 -1
- package/src/helper/render/moduleField.js +6 -0
- package/src/helper/render/obstacle.js +13 -4
- package/src/helper/render/overlay.js +19 -2
- package/src/helper/render/panel.js +135 -181
- package/src/helper/render/roof.js +10 -0
- package/src/helper/render/scene.js +79 -0
- package/src/helper/render/texture.js +1 -0
- package/src/helper/render/tile.js +22 -10
- package/src/helper/renderMixin.js +71 -10
- package/src/helper/threeMixin.js +5 -2
- package/src/store/three-d-module.js +36 -16
- package/src/utils/layers.js +52 -0
- package/src/utils/leaflet-config.service.js +1 -1
package/package.json
CHANGED
|
@@ -32,14 +32,56 @@
|
|
|
32
32
|
intervalEventId: null,
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
computed: {
|
|
36
|
+
...mapState({
|
|
37
|
+
geometryData: (state) => state.threeDModule.geometryData,
|
|
38
|
+
uuid: (state) => state.threeDModule.uuid,
|
|
39
|
+
view_mode: (state) => state.threeDModule.view_mode,
|
|
40
|
+
useCustomCamera: (state) => state.threeDModule.useCustomCamera,
|
|
41
|
+
cameraPerspectiveSettings: (state) =>
|
|
42
|
+
state.threeDModule.cameraPerspectiveSettings,
|
|
43
|
+
isInteractive: (state) => state.threeDModule.isInteractive,
|
|
44
|
+
isBuildingVisible: (state) => state.threeDModule.isBuildingVisible,
|
|
45
|
+
imageOverlay: (state) => state.threeDModule.imageOverlay,
|
|
46
|
+
}),
|
|
47
|
+
...mapGetters({
|
|
48
|
+
polygons: 'getPolygons',
|
|
49
|
+
edges: 'getEdges3D',
|
|
50
|
+
nodes: 'getNodes3D',
|
|
51
|
+
mapConfig: 'getMapConfig',
|
|
52
|
+
roofsBounds: 'getRoofsBounds',
|
|
53
|
+
layoutSettings: 'getLayoutSettings',
|
|
54
|
+
roofs: 'getRoofs',
|
|
55
|
+
obstacles: 'getObstacles',
|
|
56
|
+
moduleFields: 'getModuleFields',
|
|
57
|
+
panels: 'getPanels',
|
|
58
|
+
userDeactivatedPanels: 'getUserDeactivatedPanels',
|
|
59
|
+
}),
|
|
60
|
+
},
|
|
61
|
+
watch: {
|
|
62
|
+
isReady: {
|
|
63
|
+
handler() {
|
|
64
|
+
if (this.screenshotable) {
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
const overlayReady =
|
|
68
|
+
OverlayLayer.getItems().length == 0 || this.isReady.overlay
|
|
69
|
+
if (
|
|
70
|
+
this.isReady.texturesToLoad == this.isReady.texturesLoaded &&
|
|
71
|
+
this.isReady.geometry &&
|
|
72
|
+
overlayReady
|
|
73
|
+
) {
|
|
74
|
+
var event = new CustomEvent('screenshotable')
|
|
75
|
+
document.dispatchEvent(event)
|
|
76
|
+
this.intervalEventId = setInterval(() => {
|
|
77
|
+
document.dispatchEvent(event)
|
|
78
|
+
}, 500)
|
|
79
|
+
// dispatch the custom event
|
|
80
|
+
this.screenshotable = true
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
deep: true,
|
|
84
|
+
},
|
|
43
85
|
},
|
|
44
86
|
async mounted() {
|
|
45
87
|
await this.hydrateData(this.geometryData)
|
|
@@ -76,7 +118,10 @@
|
|
|
76
118
|
const polygon = this.polygons.find((p) => p.id == this.uuid)
|
|
77
119
|
this.setCamera(polygon, this.view_mode)
|
|
78
120
|
}
|
|
79
|
-
this.isReady
|
|
121
|
+
this.isReady = {
|
|
122
|
+
...this.isReady,
|
|
123
|
+
geometry: true,
|
|
124
|
+
}
|
|
80
125
|
this.intervalId = setInterval(() => this.render(), 500)
|
|
81
126
|
OverlayLayer.addEventListener(
|
|
82
127
|
'overlay-is-ready',
|
|
@@ -84,31 +129,14 @@
|
|
|
84
129
|
)
|
|
85
130
|
this.render()
|
|
86
131
|
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
isInteractive: (state) => state.threeDModule.isInteractive,
|
|
96
|
-
isBuildingVisible: (state) => state.threeDModule.isBuildingVisible,
|
|
97
|
-
imageOverlay: (state) => state.threeDModule.imageOverlay,
|
|
98
|
-
}),
|
|
99
|
-
...mapGetters({
|
|
100
|
-
polygons: 'getPolygons',
|
|
101
|
-
edges: 'getEdges3D',
|
|
102
|
-
nodes: 'getNodes3D',
|
|
103
|
-
mapConfig: 'getMapConfig',
|
|
104
|
-
roofsBounds: 'getRoofsBounds',
|
|
105
|
-
layoutSettings: 'getLayoutSettings',
|
|
106
|
-
roofs: 'getRoofs',
|
|
107
|
-
obstacles: 'getObstacles',
|
|
108
|
-
moduleFields: 'getModuleFields',
|
|
109
|
-
panels: 'getPanels',
|
|
110
|
-
userDeactivatedPanels: 'getUserDeactivatedPanels',
|
|
111
|
-
}),
|
|
132
|
+
beforeUnmount() {
|
|
133
|
+
clearInterval(this.intervalId)
|
|
134
|
+
clearInterval(this.intervalEventId)
|
|
135
|
+
cancelAnimationFrame(this.animationFrameId)
|
|
136
|
+
OverlayLayer.removeEventListener(
|
|
137
|
+
'overlay-is-ready',
|
|
138
|
+
this.updateOverlayRendering
|
|
139
|
+
)
|
|
112
140
|
},
|
|
113
141
|
methods: {
|
|
114
142
|
...mapActions({
|
|
@@ -162,8 +190,10 @@
|
|
|
162
190
|
const target = [0, 0, 0]
|
|
163
191
|
this.orthographicCamera.position.set(...position)
|
|
164
192
|
this.orthographicCamera.lookAt(...target)
|
|
165
|
-
this.isReady
|
|
166
|
-
|
|
193
|
+
this.isReady = {
|
|
194
|
+
...this.isReady,
|
|
195
|
+
camera: true,
|
|
196
|
+
}
|
|
167
197
|
let { xMin, xMax, yMin, yMax } = this.orthographicBounds(
|
|
168
198
|
roofsBounds,
|
|
169
199
|
margin
|
|
@@ -263,7 +293,10 @@
|
|
|
263
293
|
this.camera.lookAt(...target)
|
|
264
294
|
this.camera.updateProjectionMatrix()
|
|
265
295
|
|
|
266
|
-
this.isReady
|
|
296
|
+
this.isReady = {
|
|
297
|
+
...this.isReady,
|
|
298
|
+
camera: true,
|
|
299
|
+
}
|
|
267
300
|
}
|
|
268
301
|
},
|
|
269
302
|
orthographicBounds(bounds, margin) {
|
|
@@ -309,31 +342,6 @@
|
|
|
309
342
|
}
|
|
310
343
|
},
|
|
311
344
|
},
|
|
312
|
-
watch: {
|
|
313
|
-
isReady: {
|
|
314
|
-
handler() {
|
|
315
|
-
if (this.screenshotable) {
|
|
316
|
-
return
|
|
317
|
-
}
|
|
318
|
-
const overlayReady =
|
|
319
|
-
OverlayLayer.getItems().length == 0 || this.isReady.overlay
|
|
320
|
-
if (
|
|
321
|
-
this.isReady.texturesToLoad == this.isReady.texturesLoaded &&
|
|
322
|
-
this.isReady.geometry &&
|
|
323
|
-
overlayReady
|
|
324
|
-
) {
|
|
325
|
-
var event = new CustomEvent('screenshotable')
|
|
326
|
-
document.dispatchEvent(event)
|
|
327
|
-
this.intervalEventId = setInterval(() => {
|
|
328
|
-
document.dispatchEvent(event)
|
|
329
|
-
}, 500)
|
|
330
|
-
// dispatch the custom event
|
|
331
|
-
this.screenshotable = true
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
deep: true,
|
|
335
|
-
},
|
|
336
|
-
},
|
|
337
345
|
}
|
|
338
346
|
</script>
|
|
339
347
|
|
|
@@ -13,24 +13,18 @@ export default {
|
|
|
13
13
|
data() {
|
|
14
14
|
return {
|
|
15
15
|
animationFrameId: null,
|
|
16
|
+
perspectiveCamera: new THREE.PerspectiveCamera(80, 300 / 300, 1, 50000),
|
|
17
|
+
orthographicCamera: new THREE.OrthographicCamera(
|
|
18
|
+
-50,
|
|
19
|
+
50,
|
|
20
|
+
50,
|
|
21
|
+
-50,
|
|
22
|
+
1,
|
|
23
|
+
1000
|
|
24
|
+
),
|
|
16
25
|
}
|
|
17
26
|
},
|
|
18
|
-
created() {
|
|
19
|
-
this.perspectiveCamera = new THREE.PerspectiveCamera(
|
|
20
|
-
80,
|
|
21
|
-
300 / 300,
|
|
22
|
-
1,
|
|
23
|
-
50000
|
|
24
|
-
)
|
|
25
|
-
this.orthographicCamera = new THREE.OrthographicCamera(
|
|
26
|
-
-50,
|
|
27
|
-
50,
|
|
28
|
-
50,
|
|
29
|
-
-50,
|
|
30
|
-
1,
|
|
31
|
-
1000
|
|
32
|
-
)
|
|
33
|
-
},
|
|
27
|
+
created() {},
|
|
34
28
|
methods: {
|
|
35
29
|
initialiseCameras(isPerspectiveCamera) {
|
|
36
30
|
if (isPerspectiveCamera) {
|
|
@@ -53,6 +47,11 @@ export default {
|
|
|
53
47
|
this.cameraProjection.up.set(0, 0, 1)
|
|
54
48
|
this.scene.add(this.camera)
|
|
55
49
|
},
|
|
50
|
+
setCameraZoomOffset(zoomOffset) {
|
|
51
|
+
this.camera.zoom = zoomOffset
|
|
52
|
+
this.camera.updateProjectionMatrix()
|
|
53
|
+
this.render()
|
|
54
|
+
},
|
|
56
55
|
setCameraAspectRatio() {
|
|
57
56
|
const canvasRatio =
|
|
58
57
|
this.DOMElement.clientWidth / this.DOMElement.clientHeight
|
|
@@ -74,9 +73,12 @@ export default {
|
|
|
74
73
|
this.camera.updateProjectionMatrix()
|
|
75
74
|
},
|
|
76
75
|
turnPerspectiveCameraToOrthogonal() {
|
|
76
|
+
if (this.orthographicCamera.id == this.camera.id) {
|
|
77
|
+
return
|
|
78
|
+
}
|
|
77
79
|
const cameraPosition = new THREE.Vector3(
|
|
78
|
-
this.
|
|
79
|
-
this.
|
|
80
|
+
this.orbitControl.target.x,
|
|
81
|
+
this.orbitControl.target.y,
|
|
80
82
|
this.camera.position.z
|
|
81
83
|
)
|
|
82
84
|
var halfHeightDistance =
|
|
@@ -105,12 +107,13 @@ export default {
|
|
|
105
107
|
)
|
|
106
108
|
this.camera.updateProjectionMatrix()
|
|
107
109
|
this.renderer.camera = this.camera
|
|
108
|
-
this.composer
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
110
|
+
if (this.composer) {
|
|
111
|
+
this.composer.renderCamera = this.camera
|
|
112
|
+
this.renderPass.camera = this.camera
|
|
113
|
+
this.overlayRenderPass.camera = this.camera
|
|
114
|
+
this.outlinePassHighlight.renderCamera = this.camera
|
|
115
|
+
this.outlinePassSelected.renderCamera = this.camera
|
|
116
|
+
}
|
|
114
117
|
this.orbitControl.screenSpacePanning = true
|
|
115
118
|
this.orbitControl.object = this.camera
|
|
116
119
|
this.orbitControl.target.set(cameraPosition.x, cameraPosition.y, 0)
|
|
@@ -132,9 +135,14 @@ export default {
|
|
|
132
135
|
this.camera.updateProjectionMatrix()
|
|
133
136
|
this.nodesVisible = true
|
|
134
137
|
this.renderNodes()
|
|
135
|
-
this.composer
|
|
138
|
+
if (this.composer) {
|
|
139
|
+
this.composer.render()
|
|
140
|
+
}
|
|
136
141
|
},
|
|
137
142
|
turnOrthogonalCameraToPerspective() {
|
|
143
|
+
if (this.perspectiveCamera.id == this.camera.id) {
|
|
144
|
+
return
|
|
145
|
+
}
|
|
138
146
|
this.camera = this.perspectiveCamera
|
|
139
147
|
let altitude =
|
|
140
148
|
(this.orthographicCamera.right - this.orthographicCamera.left) /
|
|
@@ -151,14 +159,16 @@ export default {
|
|
|
151
159
|
this.camera.updateProjectionMatrix()
|
|
152
160
|
|
|
153
161
|
this.renderer.camera = this.camera
|
|
154
|
-
this.composer
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
+
if (this.composer) {
|
|
163
|
+
this.composer.renderer.camera = this.camera
|
|
164
|
+
this.composer.renderCamera = this.camera
|
|
165
|
+
this.renderPass.camera = this.camera
|
|
166
|
+
this.overlayRenderPass.camera = this.camera
|
|
167
|
+
this.outlinePassHighlight.camera = this.camera
|
|
168
|
+
this.outlinePassHighlight.renderCamera = this.camera
|
|
169
|
+
this.outlinePassSelected.camera = this.camera
|
|
170
|
+
this.outlinePassSelected.renderCamera = this.camera
|
|
171
|
+
}
|
|
162
172
|
this.orbitControl.camera = this.camera
|
|
163
173
|
this.orbitControl.object = this.camera
|
|
164
174
|
this.orbitControl.target.set(
|
|
@@ -166,6 +176,11 @@ export default {
|
|
|
166
176
|
this.camera.position.y,
|
|
167
177
|
0
|
|
168
178
|
)
|
|
179
|
+
this.camera.position.set(
|
|
180
|
+
this.orthographicCamera.position.x,
|
|
181
|
+
this.orthographicCamera.position.y - 20,
|
|
182
|
+
altitude
|
|
183
|
+
)
|
|
169
184
|
this.orbitControl.screenSpacePanning = false
|
|
170
185
|
this.orbitControl.enableRotate = true
|
|
171
186
|
this.orbitControl.mouseButtons = {
|
|
@@ -175,7 +190,9 @@ export default {
|
|
|
175
190
|
}
|
|
176
191
|
this.orbitControl.update()
|
|
177
192
|
|
|
178
|
-
this.composer
|
|
193
|
+
if (this.composer) {
|
|
194
|
+
this.composer.render()
|
|
195
|
+
}
|
|
179
196
|
},
|
|
180
197
|
zoomIn3D() {
|
|
181
198
|
if (this.camera.isOrthographicCamera) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as THREE from 'three'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
created() {},
|
|
5
|
+
methods: {
|
|
6
|
+
showBuildings() {
|
|
7
|
+
this.showRoofs()
|
|
8
|
+
this.showBases()
|
|
9
|
+
this.showObstacles()
|
|
10
|
+
this.showModuleFields()
|
|
11
|
+
this.showEdges()
|
|
12
|
+
this.render()
|
|
13
|
+
},
|
|
14
|
+
hideBuildings() {
|
|
15
|
+
this.hideRoofs()
|
|
16
|
+
this.hideBases()
|
|
17
|
+
this.hideObstacles()
|
|
18
|
+
this.hideModuleFields()
|
|
19
|
+
this.hideEdges()
|
|
20
|
+
this.render()
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
}
|
|
@@ -36,6 +36,7 @@ export default {
|
|
|
36
36
|
return cylinder
|
|
37
37
|
},
|
|
38
38
|
renderEdges() {
|
|
39
|
+
if (this.selectedTool == 'screenshot') return
|
|
39
40
|
this.clearEdgesRemovedOnes('edgeMeshes')
|
|
40
41
|
if (this.renderLineEdges) {
|
|
41
42
|
this.renderLineEdges()
|
|
@@ -96,5 +97,15 @@ export default {
|
|
|
96
97
|
}
|
|
97
98
|
})
|
|
98
99
|
},
|
|
100
|
+
hideEdges() {
|
|
101
|
+
Object.values(this.meshes.edgeMeshes).forEach((mesh) => {
|
|
102
|
+
mesh.visible = false
|
|
103
|
+
})
|
|
104
|
+
},
|
|
105
|
+
showEdges() {
|
|
106
|
+
Object.values(this.meshes.edgeMeshes).forEach((mesh) => {
|
|
107
|
+
mesh.visible = true
|
|
108
|
+
})
|
|
109
|
+
},
|
|
99
110
|
},
|
|
100
111
|
}
|
|
@@ -54,6 +54,16 @@ export default {
|
|
|
54
54
|
this.meshes.backgroundMesh.visible = true
|
|
55
55
|
return
|
|
56
56
|
},
|
|
57
|
+
hideImageOverlays() {
|
|
58
|
+
OverlayLayer.dispatchActionToAllItems('setOpacity', 0)
|
|
59
|
+
this.updateProjectionMaterials()
|
|
60
|
+
this.renderImageOverlayOnBackground()
|
|
61
|
+
},
|
|
62
|
+
showImageOverlays() {
|
|
63
|
+
OverlayLayer.dispatchActionToAllItems('setOpacity', 1)
|
|
64
|
+
this.updateProjectionMaterials()
|
|
65
|
+
this.renderImageOverlayOnBackground()
|
|
66
|
+
},
|
|
57
67
|
async getOverlaysMaterials() {
|
|
58
68
|
let overlayMaterialsPromises = []
|
|
59
69
|
OverlayLayer.getReadyItems()
|
|
@@ -15,7 +15,9 @@ import projectionMaterial from './projectionMaterial'
|
|
|
15
15
|
import tile from './tile'
|
|
16
16
|
import tileProjection from './tileProjection'
|
|
17
17
|
import mergedGeometry from './mergedGeometry'
|
|
18
|
-
|
|
18
|
+
import building from './building'
|
|
19
|
+
import marker from './marker'
|
|
20
|
+
import scene from './scene'
|
|
19
21
|
export default {
|
|
20
22
|
mixins: [
|
|
21
23
|
margin,
|
|
@@ -35,5 +37,8 @@ export default {
|
|
|
35
37
|
tile,
|
|
36
38
|
tileProjection,
|
|
37
39
|
mergedGeometry,
|
|
40
|
+
building,
|
|
41
|
+
marker,
|
|
42
|
+
scene,
|
|
38
43
|
],
|
|
39
44
|
}
|
|
@@ -2,14 +2,51 @@ import * as THREE from 'three'
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
methods: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
loadTextureAsync(url) {
|
|
6
|
+
return new Promise((resolve) => {
|
|
7
|
+
this.loader.load(url, (texture) => {
|
|
8
|
+
resolve(texture)
|
|
9
|
+
})
|
|
10
|
+
})
|
|
11
|
+
},
|
|
12
|
+
async loadNewPanelTextures() {
|
|
13
|
+
let newTexturesLoaded = false
|
|
14
|
+
const loadTexturesPromises = Object.values(this.pvDataMemo).map(
|
|
15
|
+
async (component) => {
|
|
16
|
+
const pvId = component.id
|
|
17
|
+
if (!this.material.panel[pvId]) {
|
|
18
|
+
if (!component.texture_img_url) {
|
|
19
|
+
this.material.panel[pvId] = this.material.panel.default
|
|
20
|
+
} else {
|
|
21
|
+
newTexturesLoaded = true
|
|
22
|
+
// No need for await, texture automatically rendered on load
|
|
23
|
+
const texture = this.loader.load(component.texture_img_url)
|
|
24
|
+
this.material.panel[pvId] = new THREE.MeshPhongMaterial({
|
|
25
|
+
map: texture,
|
|
26
|
+
side: THREE.FrontSide,
|
|
27
|
+
transparent: false,
|
|
28
|
+
shadowSide: THREE.DoubleSide,
|
|
29
|
+
flatShading: true,
|
|
30
|
+
})
|
|
31
|
+
texture.encoding = THREE.sRGBEncoding
|
|
32
|
+
texture.colorSpace = THREE.SRGBColorSpace
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
await Promise.all(loadTexturesPromises)
|
|
39
|
+
return newTexturesLoaded
|
|
40
|
+
},
|
|
41
|
+
async loadPanelsTexture() {
|
|
42
|
+
const promiseArray = this.moduleFields.map(async (mf) => {
|
|
43
|
+
const pvId = mf.data.component_id_pv_module
|
|
8
44
|
if (!this.material.panel[pvId]) {
|
|
9
|
-
if (!
|
|
10
|
-
this.material.panel[pvId] =
|
|
45
|
+
if (!mf.data.texture_img_url) {
|
|
46
|
+
this.material.panel[pvId] =
|
|
47
|
+
this.material.panel[`default_${this.moduleTextureVersionId}`]
|
|
11
48
|
} else {
|
|
12
|
-
const texture = this.
|
|
49
|
+
const texture = await this.loadTextureAsync(mf.data.texture_img_url)
|
|
13
50
|
texture.encoding = THREE.sRGBEncoding
|
|
14
51
|
texture.colorSpace = THREE.SRGBColorSpace
|
|
15
52
|
this.material.panel[pvId] = new THREE.MeshPhongMaterial({
|
|
@@ -22,33 +59,7 @@ export default {
|
|
|
22
59
|
}
|
|
23
60
|
}
|
|
24
61
|
})
|
|
25
|
-
|
|
26
|
-
async loadPanelsTexture() {
|
|
27
|
-
for (let k = 0; k < this.moduleFields.length; k++) {
|
|
28
|
-
let mf = this.moduleFields[k]
|
|
29
|
-
const pvId = mf.data.component_id_pv_module
|
|
30
|
-
if (!this.material.panel[pvId]) {
|
|
31
|
-
if (!mf.data.texture_img_url) {
|
|
32
|
-
this.material.panel[pvId] =
|
|
33
|
-
this.material.panel[`default_${this.moduleTextureVersionId}`]
|
|
34
|
-
} else {
|
|
35
|
-
await new Promise((resolve) => {
|
|
36
|
-
this.loader.load(mf.data.texture_img_url, (texture) => {
|
|
37
|
-
texture.encoding = THREE.sRGBEncoding
|
|
38
|
-
texture.colorSpace = THREE.SRGBColorSpace
|
|
39
|
-
this.material.panel[pvId] = new THREE.MeshPhongMaterial({
|
|
40
|
-
map: texture,
|
|
41
|
-
side: THREE.FrontSide,
|
|
42
|
-
transparent: false,
|
|
43
|
-
shadowSide: THREE.DoubleSide,
|
|
44
|
-
flatShading: true,
|
|
45
|
-
})
|
|
46
|
-
resolve(texture)
|
|
47
|
-
})
|
|
48
|
-
})
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
62
|
+
await Promise.all(promiseArray)
|
|
52
63
|
},
|
|
53
64
|
},
|
|
54
65
|
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import * as THREE from 'three'
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
created() {},
|
|
5
|
+
methods: {
|
|
6
|
+
renderMarker() {
|
|
7
|
+
if (this.selectedTool != 'screenshot') {
|
|
8
|
+
return
|
|
9
|
+
}
|
|
10
|
+
if (this.meshes.markerMesh) {
|
|
11
|
+
return
|
|
12
|
+
}
|
|
13
|
+
//const lod = new THREE.LOD()
|
|
14
|
+
const sphereGeometry = new THREE.SphereGeometry(1, 32, 32) // Initial radius of 5
|
|
15
|
+
const coneGeometry = new THREE.ConeGeometry(0.98, 2, 32)
|
|
16
|
+
|
|
17
|
+
const opacity = 1
|
|
18
|
+
const material = new THREE.MeshPhongMaterial({
|
|
19
|
+
color: 0xff0000, // red color
|
|
20
|
+
transparent: true,
|
|
21
|
+
opacity,
|
|
22
|
+
})
|
|
23
|
+
let roofCenter = {
|
|
24
|
+
x: 0,
|
|
25
|
+
y: 0,
|
|
26
|
+
z: 0,
|
|
27
|
+
}
|
|
28
|
+
if (this.roofs.length > 0) {
|
|
29
|
+
roofCenter = {
|
|
30
|
+
x: (this.roofsBounds.xMin + this.roofsBounds.xMax) / 2000,
|
|
31
|
+
y: (this.roofsBounds.yMin + this.roofsBounds.yMax) / 2000,
|
|
32
|
+
z: this.roofsBounds.zMax / 2000,
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const sphereMesh = new THREE.Mesh(sphereGeometry, material)
|
|
36
|
+
const coneMesh = new THREE.Mesh(coneGeometry, material)
|
|
37
|
+
coneMesh.rotateX(-Math.PI / 2)
|
|
38
|
+
coneMesh.position.set(0, 0, -1.2)
|
|
39
|
+
const markerMesh = new THREE.Group()
|
|
40
|
+
markerMesh.add(coneMesh)
|
|
41
|
+
|
|
42
|
+
markerMesh.add(sphereMesh)
|
|
43
|
+
markerMesh.userData = { id: 'marker' }
|
|
44
|
+
markerMesh.position.set(roofCenter.x, roofCenter.y, roofCenter.z + 10)
|
|
45
|
+
markerMesh.scale.set(3, 3, 3)
|
|
46
|
+
// for (let i = 1; i < 10; i++) {
|
|
47
|
+
// const mesh = markerMesh.clone()
|
|
48
|
+
// mesh.scale.set(i * 3, i * 3, i * 3)
|
|
49
|
+
// mesh.position.set(0, 0, 12 * i)
|
|
50
|
+
// lod.addLevel(mesh, (i - 1) * 100)
|
|
51
|
+
// }
|
|
52
|
+
// const lastMesh = markerMesh.clone()
|
|
53
|
+
// lastMesh.scale.set(150, 150, 150)
|
|
54
|
+
// lastMesh.position.set(0, 0, 600)
|
|
55
|
+
// lod.addLevel(lastMesh, 1000)
|
|
56
|
+
// this.scene.add(lod)
|
|
57
|
+
this.scene.add(markerMesh)
|
|
58
|
+
this.meshes.markerMesh = markerMesh
|
|
59
|
+
},
|
|
60
|
+
showMarker() {
|
|
61
|
+
if (this.meshes.markerMesh) {
|
|
62
|
+
this.meshes.markerMesh.visible = true
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
hideMarker() {
|
|
66
|
+
if (this.meshes.markerMesh) {
|
|
67
|
+
this.meshes.markerMesh.visible = false
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}
|
|
@@ -95,7 +95,7 @@ export default {
|
|
|
95
95
|
return mergedGeometry
|
|
96
96
|
},
|
|
97
97
|
|
|
98
|
-
updateOrCreateMergedMesh(mesh, geometries, material
|
|
98
|
+
updateOrCreateMergedMesh(mesh, geometries, material) {
|
|
99
99
|
if (!mesh) {
|
|
100
100
|
let mergedGeometry = this.createMergedGeometry(geometries)
|
|
101
101
|
mesh = new THREE.Mesh(mergedGeometry, material)
|
|
@@ -107,6 +107,7 @@ export default {
|
|
|
107
107
|
mesh.geometry
|
|
108
108
|
)
|
|
109
109
|
mesh.geometry = mergedGeometry
|
|
110
|
+
if (material) mesh.material = material
|
|
110
111
|
}
|
|
111
112
|
mesh.frustumCulled = false
|
|
112
113
|
return mesh
|
|
@@ -102,5 +102,11 @@ export default {
|
|
|
102
102
|
this.areModuleFieldsVisible && this.panelOpacity === 1)
|
|
103
103
|
)
|
|
104
104
|
},
|
|
105
|
+
hideModuleFields() {
|
|
106
|
+
this.updateModuleFieldsVisibility(false)
|
|
107
|
+
},
|
|
108
|
+
showModuleFields() {
|
|
109
|
+
this.updateModuleFieldsVisibility(true)
|
|
110
|
+
},
|
|
105
111
|
},
|
|
106
112
|
}
|
|
@@ -73,21 +73,30 @@ export default {
|
|
|
73
73
|
// Create the mesh using the merged geometry and shared material
|
|
74
74
|
this.mergedObstacleMesh = this.updateOrCreateMergedMesh(
|
|
75
75
|
this.mergedObstacleMesh,
|
|
76
|
-
obstacleGeometries
|
|
77
|
-
this.material.selectedRoof
|
|
76
|
+
obstacleGeometries
|
|
78
77
|
)
|
|
78
|
+
this.applyTextureOnObstacles(this.material.roof)
|
|
79
|
+
|
|
79
80
|
this.mergedObstacleSideMesh = this.updateOrCreateMergedMesh(
|
|
80
81
|
this.mergedObstacleSideMesh,
|
|
81
82
|
obstacleSideGeometries,
|
|
82
83
|
this.material.wall
|
|
83
84
|
)
|
|
84
85
|
this.mergedObstacleSideMesh.renderOrder = 10
|
|
85
|
-
|
|
86
|
+
|
|
87
|
+
// shadow
|
|
86
88
|
this.mergedObstacleSideMesh.receiveShadow = true
|
|
87
89
|
this.mergedObstacleSideMesh.castShadow = true
|
|
88
90
|
this.mergedObstacleMesh.receiveShadow = true
|
|
89
91
|
this.mergedObstacleMesh.castShadow = true
|
|
90
|
-
|
|
92
|
+
},
|
|
93
|
+
hideObstacles() {
|
|
94
|
+
this.mergedObstacleSideMesh.visible = false
|
|
95
|
+
this.mergedObstacleMesh.visible = false
|
|
96
|
+
},
|
|
97
|
+
showObstacles() {
|
|
98
|
+
this.mergedObstacleSideMesh.visible = true
|
|
99
|
+
this.mergedObstacleMesh.visible = true
|
|
91
100
|
},
|
|
92
101
|
},
|
|
93
102
|
}
|
|
@@ -83,12 +83,29 @@ export default {
|
|
|
83
83
|
})
|
|
84
84
|
},
|
|
85
85
|
updateOverlayRendering() {
|
|
86
|
+
this.renderOverlays()
|
|
87
|
+
this.updateProjectionMaterials()
|
|
88
|
+
this.render()
|
|
86
89
|
if (this.isReady) {
|
|
87
|
-
this.isReady
|
|
90
|
+
this.isReady = {
|
|
91
|
+
...this.isReady,
|
|
92
|
+
overlay: true,
|
|
93
|
+
}
|
|
88
94
|
}
|
|
95
|
+
},
|
|
96
|
+
hideOverlays() {
|
|
97
|
+
OverlayLayer.getItems().forEach((overlay) => {
|
|
98
|
+
overlay.setOpacity = 0
|
|
99
|
+
})
|
|
100
|
+
this.updateProjectionMaterials()
|
|
89
101
|
this.renderOverlays()
|
|
102
|
+
},
|
|
103
|
+
showOverlays() {
|
|
104
|
+
OverlayLayer.getItems().forEach((overlay) => {
|
|
105
|
+
overlay.setOpacity = 1
|
|
106
|
+
})
|
|
90
107
|
this.updateProjectionMaterials()
|
|
91
|
-
this.
|
|
108
|
+
this.renderOverlays()
|
|
92
109
|
},
|
|
93
110
|
},
|
|
94
111
|
}
|