@eturnity/eturnity_3d 8.37.0 → 8.40.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/dist/assets/images/panels/longiSolarLR4_60HPH_350M.png +0 -0
- package/dist/assets/images/panels/longiSolarLR4_60HPH_370M.png +0 -0
- package/dist/assets/images/panels/reneSola_Virtus_2_JC320S_24_Bbw copy.png +0 -0
- package/dist/assets/images/panels/reneSola_Virtus_2_JC320S_24_Bbw.png +0 -0
- package/dist/assets/images/panels/uv.png +0 -0
- package/dist/assets/panels/longiSolarLR4_60HPH_350M.png +0 -0
- package/dist/assets/panels/longiSolarLR4_60HPH_370M.png +0 -0
- package/dist/assets/panels/reneSola_Virtus_2_JC320S_24_Bbw.png +0 -0
- package/dist/assets/panels/uv.png +0 -0
- package/dist/assets/theme.js +43 -0
- package/dist/assets/vue.svg +1 -0
- package/dist/main.es.js +43662 -0
- package/dist/main.umd.js +3542 -0
- package/dist/style.css +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +1 -1
- package/src/helper/cameraMixin.js +47 -19
- package/src/helper/render/CustomLOD.js +65 -0
- package/src/helper/render/marker.js +14 -17
- package/src/helper/render/scene.js +1 -1
- package/src/helper/render/tile.js +18 -11
- package/src/helper/renderMixin.js +3 -0
- package/src/helper/threeMixin.js +13 -9
package/dist/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.canvas3DContainer{height:100%;width:100%}.canvas3DContainer>canvas{height:100%;width:100%}
|
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/package.json
CHANGED
|
@@ -73,22 +73,32 @@ export default {
|
|
|
73
73
|
setCameraAspectRatio() {
|
|
74
74
|
const canvasRatio = this.getCanvasRatio()
|
|
75
75
|
if (this.camera.isOrthographicCamera) {
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
const currentAspect = Math.abs(
|
|
77
|
+
(this.camera.right - this.camera.left) /
|
|
78
|
+
(this.camera.top - this.camera.bottom)
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
// Calculate current half-width and half-height
|
|
82
|
+
const halfWidth = (this.camera.right - this.camera.left) / 2
|
|
83
|
+
const halfHeight = (this.camera.top - this.camera.bottom) / 2
|
|
84
|
+
|
|
85
|
+
// Adjust dimensions to match new aspect ratio
|
|
86
|
+
let newHalfWidth, newHalfHeight
|
|
79
87
|
if (canvasRatio > currentAspect) {
|
|
80
|
-
//
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
this.camera.left = centerX - newWidth / 2
|
|
84
|
-
this.camera.right = centerX + newWidth / 2
|
|
88
|
+
// Canvas is wider, adjust width
|
|
89
|
+
newHalfHeight = halfHeight
|
|
90
|
+
newHalfWidth = halfHeight * canvasRatio
|
|
85
91
|
} else {
|
|
86
|
-
//
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this.camera.top = centerY + newHeight / 2
|
|
90
|
-
this.camera.bottom = centerY - newHeight / 2
|
|
92
|
+
// Canvas is taller, adjust height
|
|
93
|
+
newHalfWidth = halfWidth
|
|
94
|
+
newHalfHeight = halfWidth / canvasRatio
|
|
91
95
|
}
|
|
96
|
+
|
|
97
|
+
// Set new boundaries (left+right=0, top+bottom=0)
|
|
98
|
+
this.camera.left = -newHalfWidth
|
|
99
|
+
this.camera.right = newHalfWidth
|
|
100
|
+
this.camera.top = newHalfHeight
|
|
101
|
+
this.camera.bottom = -newHalfHeight
|
|
92
102
|
} else {
|
|
93
103
|
this.camera.aspect = canvasRatio
|
|
94
104
|
}
|
|
@@ -160,6 +170,7 @@ export default {
|
|
|
160
170
|
if (this.composer) {
|
|
161
171
|
this.composer.render()
|
|
162
172
|
}
|
|
173
|
+
this.onWindowResize()
|
|
163
174
|
},
|
|
164
175
|
turnOrthogonalCameraToPerspective() {
|
|
165
176
|
if (this.perspectiveCamera.id == this.camera.id) {
|
|
@@ -215,6 +226,7 @@ export default {
|
|
|
215
226
|
if (this.composer) {
|
|
216
227
|
this.composer.render()
|
|
217
228
|
}
|
|
229
|
+
this.onWindowResize()
|
|
218
230
|
},
|
|
219
231
|
zoomIn3D() {
|
|
220
232
|
if (this.camera.isOrthographicCamera) {
|
|
@@ -318,7 +330,9 @@ export default {
|
|
|
318
330
|
this.camera.far = 10000
|
|
319
331
|
this.camera.zoom = zoom
|
|
320
332
|
|
|
321
|
-
|
|
333
|
+
const cameraAltitude =
|
|
334
|
+
(top - bottom) / Math.sin(((50 / 2) * Math.PI) / 180) / zoom
|
|
335
|
+
this.camera.position.set(x, y, cameraAltitude * zoom)
|
|
322
336
|
this.camera.lookAt(x, y, 0)
|
|
323
337
|
this.setCameraAspectRatio()
|
|
324
338
|
this.camera.updateProjectionMatrix()
|
|
@@ -341,20 +355,34 @@ export default {
|
|
|
341
355
|
setOrthographicCameraGlobalPosition(
|
|
342
356
|
cameraOffset = { x_m: 0, y_m: 0, z_m: 0 }
|
|
343
357
|
) {
|
|
358
|
+
const cameraRatio =
|
|
359
|
+
(this.camera.right - this.camera.left) /
|
|
360
|
+
(this.camera.top - this.camera.bottom)
|
|
361
|
+
|
|
344
362
|
const halfWidth = (this.roofsBounds.xMax - this.roofsBounds.xMin) / 2000
|
|
345
363
|
const halfHeight = (this.roofsBounds.yMax - this.roofsBounds.yMin) / 2000
|
|
346
364
|
|
|
347
|
-
let left =
|
|
348
|
-
let right =
|
|
365
|
+
let left = halfWidth - marginAroundBuildingForCameraViewInMeter
|
|
366
|
+
let right = -left
|
|
349
367
|
let top = halfHeight + marginAroundBuildingForCameraViewInMeter
|
|
350
|
-
let bottom = -
|
|
368
|
+
let bottom = -top
|
|
369
|
+
let width = right - left
|
|
370
|
+
let height = top - bottom
|
|
371
|
+
if (cameraRatio < width / height) {
|
|
372
|
+
top = width / cameraRatio / 2
|
|
373
|
+
bottom = -width / cameraRatio / 2
|
|
374
|
+
} else {
|
|
375
|
+
left = -(height * cameraRatio) / 2
|
|
376
|
+
right = (height * cameraRatio) / 2
|
|
377
|
+
}
|
|
351
378
|
|
|
352
379
|
const zoom = 1
|
|
380
|
+
|
|
353
381
|
const x =
|
|
354
|
-
(this.roofsBounds.
|
|
382
|
+
(this.roofsBounds.xMax + this.roofsBounds.xMin) / 2000 +
|
|
355
383
|
cameraOffset.x_m
|
|
356
384
|
const y =
|
|
357
|
-
(this.roofsBounds.
|
|
385
|
+
(this.roofsBounds.yMax + this.roofsBounds.yMin) / 2000 +
|
|
358
386
|
cameraOffset.y_m
|
|
359
387
|
|
|
360
388
|
this.setOrthographicCameraPositionFromCameraParameters({
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as THREE from 'three'
|
|
2
|
+
|
|
3
|
+
// Helper vectors for distance calculations
|
|
4
|
+
const _v1 = new THREE.Vector3()
|
|
5
|
+
const _v2 = new THREE.Vector3()
|
|
6
|
+
|
|
7
|
+
export class CustomLOD extends THREE.LOD {
|
|
8
|
+
constructor() {
|
|
9
|
+
super()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
update(camera) {
|
|
13
|
+
// Check if camera is orthographic
|
|
14
|
+
if (camera.isOrthographicCamera) {
|
|
15
|
+
// Custom implementation for orthographic cameras
|
|
16
|
+
const levels = this.levels
|
|
17
|
+
|
|
18
|
+
if (levels.length > 1) {
|
|
19
|
+
_v1.setFromMatrixPosition(camera.matrixWorld)
|
|
20
|
+
_v2.setFromMatrixPosition(this.matrixWorld)
|
|
21
|
+
|
|
22
|
+
// For orthographic cameras, use distance along the camera's vertical axis
|
|
23
|
+
const cameraDirection = new THREE.Vector3()
|
|
24
|
+
camera.getWorldDirection(cameraDirection)
|
|
25
|
+
|
|
26
|
+
// Calculate the vector from camera to object
|
|
27
|
+
const toObject = _v2.clone().sub(_v1)
|
|
28
|
+
|
|
29
|
+
// Get distance along camera's view direction
|
|
30
|
+
const distance = Math.abs(toObject.dot(cameraDirection)) / camera.zoom
|
|
31
|
+
|
|
32
|
+
levels[0].object.visible = true
|
|
33
|
+
|
|
34
|
+
let i, l
|
|
35
|
+
|
|
36
|
+
for (i = 1, l = levels.length; i < l; i++) {
|
|
37
|
+
let levelDistance = levels[i].distance
|
|
38
|
+
|
|
39
|
+
if (levels[i].object.visible) {
|
|
40
|
+
levelDistance -= levelDistance * levels[i].hysteresis
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (distance >= levelDistance) {
|
|
44
|
+
levels[i - 1].object.visible = false
|
|
45
|
+
levels[i].object.visible = true
|
|
46
|
+
} else {
|
|
47
|
+
break
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
this._currentLevel = i - 1
|
|
52
|
+
|
|
53
|
+
for (; i < l; i++) {
|
|
54
|
+
levels[i].object.visible = false
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
// Use the original THREE.LOD update method for perspective cameras
|
|
59
|
+
super.update(camera)
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Also export as default for convenience
|
|
65
|
+
export default CustomLOD
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as THREE from 'three'
|
|
2
|
-
|
|
2
|
+
import { CustomLOD } from './CustomLOD'
|
|
3
3
|
export default {
|
|
4
4
|
created() {},
|
|
5
5
|
methods: {
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
if (this.meshes.markerMesh) {
|
|
11
11
|
return
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
const lod = new CustomLOD()
|
|
14
14
|
const sphereGeometry = new THREE.SphereGeometry(1, 32, 32) // Initial radius of 5
|
|
15
15
|
const coneGeometry = new THREE.ConeGeometry(0.98, 2, 32)
|
|
16
16
|
|
|
@@ -41,21 +41,18 @@ export default {
|
|
|
41
41
|
|
|
42
42
|
markerMesh.add(sphereMesh)
|
|
43
43
|
markerMesh.userData = { id: 'marker' }
|
|
44
|
-
markerMesh.position.set(
|
|
45
|
-
markerMesh.scale.set(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// this.scene.add(lod)
|
|
57
|
-
this.scene.add(markerMesh)
|
|
58
|
-
this.meshes.markerMesh = markerMesh
|
|
44
|
+
markerMesh.position.set(0, 0, 0)
|
|
45
|
+
markerMesh.scale.set(1, 1, 1)
|
|
46
|
+
for (let i = 1; i < 50; i++) {
|
|
47
|
+
const mesh = markerMesh.clone()
|
|
48
|
+
mesh.scale.set(2 * i, 2 * i, 2 * i)
|
|
49
|
+
mesh.position.set(0, 0, 5 * i)
|
|
50
|
+
lod.addLevel(mesh, (i - 1) * 200)
|
|
51
|
+
}
|
|
52
|
+
lod.position.set(roofCenter.x, roofCenter.y, 2 * roofCenter.z)
|
|
53
|
+
lod.updateMatrix()
|
|
54
|
+
this.scene.add(lod)
|
|
55
|
+
this.meshes.markerMesh = lod
|
|
59
56
|
},
|
|
60
57
|
showMarker() {
|
|
61
58
|
if (!this.meshes.markerMesh) {
|
|
@@ -20,7 +20,7 @@ export default {
|
|
|
20
20
|
params.is_marker_visible || params.is_marker_visible == undefined
|
|
21
21
|
? this.showMarker()
|
|
22
22
|
: this.hideMarker()
|
|
23
|
-
params.view_mode == '3d'
|
|
23
|
+
params.view_mode == '3d'
|
|
24
24
|
? this.turnOrthogonalCameraToPerspective()
|
|
25
25
|
: this.turnPerspectiveCameraToOrthogonal()
|
|
26
26
|
if (params.map_layer != undefined) {
|
|
@@ -70,7 +70,6 @@ export default {
|
|
|
70
70
|
const latitude = this.layoutSettings.layout_latitude
|
|
71
71
|
const longitude = this.layoutSettings.layout_longitude
|
|
72
72
|
let { xMin, xMax, yMin, yMax } = this.roofsBounds
|
|
73
|
-
|
|
74
73
|
if (xMin == Infinity) {
|
|
75
74
|
xMin = 0
|
|
76
75
|
yMin = 0
|
|
@@ -107,10 +106,10 @@ export default {
|
|
|
107
106
|
longitude + lngMax,
|
|
108
107
|
zoomLvl
|
|
109
108
|
)
|
|
110
|
-
xTileMin = xTileMin - (xTileMin % 2)
|
|
111
|
-
xTileMax = xTileMax + 1 - (xTileMax % 2)
|
|
112
|
-
yTileMin = yTileMin - (yTileMin % 2)
|
|
113
|
-
yTileMax = yTileMax + 1 - (yTileMax % 2)
|
|
109
|
+
xTileMin = xTileMin - (xTileMin % 2) - 2
|
|
110
|
+
xTileMax = xTileMax + 1 - (xTileMax % 2) + 2
|
|
111
|
+
yTileMin = yTileMin - (yTileMin % 2) - 2
|
|
112
|
+
yTileMax = yTileMax + 1 - (yTileMax % 2) + 2
|
|
114
113
|
this.tileToRender = []
|
|
115
114
|
for (let xTile = xTileMin; xTile <= xTileMax; xTile++) {
|
|
116
115
|
for (let yTile = yTileMin; yTile <= yTileMax; yTile++) {
|
|
@@ -132,7 +131,7 @@ export default {
|
|
|
132
131
|
})
|
|
133
132
|
}
|
|
134
133
|
}
|
|
135
|
-
while (zoomLvl >
|
|
134
|
+
while (zoomLvl > 16) {
|
|
136
135
|
xTileMin = xTileMin / 2 - 1
|
|
137
136
|
xTileMax = (xTileMax + 1) / 2
|
|
138
137
|
yTileMin = yTileMin / 2 - 1
|
|
@@ -333,7 +332,11 @@ export default {
|
|
|
333
332
|
resolve()
|
|
334
333
|
})
|
|
335
334
|
.catch((err) => {
|
|
336
|
-
|
|
335
|
+
this.isReady = {
|
|
336
|
+
...this.isReady,
|
|
337
|
+
texturesToLoad: this.isReady.texturesToLoad - 1,
|
|
338
|
+
}
|
|
339
|
+
reject(err)
|
|
337
340
|
})
|
|
338
341
|
})
|
|
339
342
|
return promise
|
|
@@ -444,6 +447,10 @@ export default {
|
|
|
444
447
|
texturesToLoad: this.isReady.texturesToLoad + 1,
|
|
445
448
|
}
|
|
446
449
|
this.loader.load(googleBackgroundUrl, (texture) => {
|
|
450
|
+
this.isReady = {
|
|
451
|
+
...this.isReady,
|
|
452
|
+
texturesLoaded: this.isReady.texturesLoaded + 1,
|
|
453
|
+
}
|
|
447
454
|
texture.encoding = THREE.sRGBEncoding
|
|
448
455
|
texture.colorSpace = THREE.SRGBColorSpace
|
|
449
456
|
planeTexture[indexGoogleBackground] = texture
|
|
@@ -494,10 +501,6 @@ export default {
|
|
|
494
501
|
this.googleBackgroundMap.castShadow = false
|
|
495
502
|
this.render()
|
|
496
503
|
}
|
|
497
|
-
this.isReady = {
|
|
498
|
-
...this.isReady,
|
|
499
|
-
texturesLoaded: this.isReady.texturesLoaded + 1,
|
|
500
|
-
}
|
|
501
504
|
})
|
|
502
505
|
}
|
|
503
506
|
|
|
@@ -509,6 +512,10 @@ export default {
|
|
|
509
512
|
this.pendingTiles = this.pendingTiles.filter((t) => {
|
|
510
513
|
if (t.mapLayer != newMapLayer.key) {
|
|
511
514
|
t.imagePromise.cancel()
|
|
515
|
+
this.isReady = {
|
|
516
|
+
...this.isReady,
|
|
517
|
+
texturesToLoad: this.isReady.texturesToLoad - 1,
|
|
518
|
+
}
|
|
512
519
|
return false
|
|
513
520
|
}
|
|
514
521
|
return true
|
|
@@ -115,6 +115,9 @@ export default {
|
|
|
115
115
|
if (methodList.length) {
|
|
116
116
|
this.renderMethods(methodList)
|
|
117
117
|
this.render()
|
|
118
|
+
if (this.handleOrbitControlChange) {
|
|
119
|
+
this.handleOrbitControlChange()
|
|
120
|
+
}
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
this.lastGeometryEventIdDone = this.lastGeometryEventId
|
package/src/helper/threeMixin.js
CHANGED
|
@@ -262,15 +262,19 @@ export default {
|
|
|
262
262
|
this.render()
|
|
263
263
|
},
|
|
264
264
|
onWindowResize() {
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
const clientHeight = this.DOMElement.clientHeight
|
|
266
|
+
const clientWidth = this.DOMElement.clientWidth
|
|
267
|
+
if (clientHeight && clientWidth) {
|
|
268
|
+
if (this.orbitControl) {
|
|
269
|
+
this.orbitControl.update()
|
|
270
|
+
}
|
|
271
|
+
this.canvasOffset = this.getCanvasOffset()
|
|
272
|
+
this.canvasHeight = clientHeight
|
|
273
|
+
this.canvasWidth = clientWidth
|
|
274
|
+
this.resizeRenderer()
|
|
275
|
+
this.setCameraAspectRatio()
|
|
276
|
+
this.render()
|
|
267
277
|
}
|
|
268
|
-
this.canvasOffset = this.getCanvasOffset()
|
|
269
|
-
this.canvasHeight = this.DOMElement.clientHeight
|
|
270
|
-
this.canvasWidth = this.DOMElement.clientWidth
|
|
271
|
-
this.resizeRenderer()
|
|
272
|
-
this.setCameraAspectRatio()
|
|
273
|
-
this.render()
|
|
274
278
|
},
|
|
275
279
|
onCanvasResize() {
|
|
276
280
|
const canvas = this.renderer.domElement
|
|
@@ -280,7 +284,7 @@ export default {
|
|
|
280
284
|
this.resizeRenderer()
|
|
281
285
|
|
|
282
286
|
if (this.composer) {
|
|
283
|
-
this.composer.setPixelRatio(
|
|
287
|
+
this.composer.setPixelRatio(window.devicePixelRatio)
|
|
284
288
|
if (this.composer.setViewport) {
|
|
285
289
|
this.composer.setViewport(0, 0, width, height)
|
|
286
290
|
}
|