@eturnity/eturnity_3d 9.13.0-google3dTile.2 → 9.16.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 +1 -2
- package/src/Overlay/OverlayFactory.js +0 -3
- package/src/Overlay/ThreeDModelOverlay.js +3 -19
- package/src/helper/cameraMixin.js +0 -17
- package/src/helper/render/edge.js +0 -2
- package/src/helper/render/obstacle.js +15 -3
- package/src/helper/render/projectionMaterial.js +48 -13
- package/src/helper/render/roof.js +17 -4
- package/src/helper/render/tile.js +2 -0
- 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 +0 -43
- package/dist/assets/vue.svg +0 -1
- package/dist/main.es.js +0 -43662
- package/dist/main.umd.js +0 -3542
- package/dist/style.css +0 -1
- package/dist/vite.svg +0 -1
- package/src/Overlay/Google3DTilesOverlay.js +0 -574
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eturnity/eturnity_3d",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "9.
|
|
4
|
+
"version": "9.16.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"src"
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@eturnity/eturnity_maths": "9.13.0",
|
|
20
20
|
"@originjs/vite-plugin-commonjs": "1.0.3",
|
|
21
|
-
"3d-tiles-renderer": "^0.4.22",
|
|
22
21
|
"core-js": "3.30.2",
|
|
23
22
|
"cors": "2.8.5",
|
|
24
23
|
"earcut": "2.2.4",
|
|
@@ -2,7 +2,6 @@ import Overlay from './Overlay'
|
|
|
2
2
|
import GLBOverlay from './GLBOverlay'
|
|
3
3
|
import ImageOverlay from './ImageOverlay'
|
|
4
4
|
import YearlySunShadingOverlay from './YearlySunShadingOverlay'
|
|
5
|
-
import Google3DTilesOverlay from './Google3DTilesOverlay'
|
|
6
5
|
|
|
7
6
|
const OverlayFactory = {
|
|
8
7
|
createOverlay(serializedOverlay, emit, origin = { lat: null, lng: null }) {
|
|
@@ -13,8 +12,6 @@ const OverlayFactory = {
|
|
|
13
12
|
overlayInstance = new ImageOverlay(serializedOverlay, emit)
|
|
14
13
|
} else if (serializedOverlay.type == 'yearly_sun_shading') {
|
|
15
14
|
overlayInstance = new YearlySunShadingOverlay(serializedOverlay, emit)
|
|
16
|
-
} else if (serializedOverlay.type == 'google_3d_tiles') {
|
|
17
|
-
overlayInstance = new Google3DTilesOverlay(serializedOverlay, emit, origin)
|
|
18
15
|
} else {
|
|
19
16
|
overlayInstance = new Overlay(serializedOverlay, emit)
|
|
20
17
|
}
|
|
@@ -350,24 +350,8 @@ export default class ThreeDModelOverlay extends Overlay {
|
|
|
350
350
|
resolve(imageUrl)
|
|
351
351
|
})
|
|
352
352
|
}
|
|
353
|
-
/** Override in subclasses to use a different mesh (e.g. tiles wrapper) or null when not yet ready */
|
|
354
|
-
getOverlayMeshForRaycast() {
|
|
355
|
-
return this.overlayMesh
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/** Override in subclasses to raycast into child meshes (e.g. for Group-based overlays like 3D Tiles) */
|
|
359
|
-
getRaycastRecursive() {
|
|
360
|
-
return false
|
|
361
|
-
}
|
|
362
|
-
|
|
363
353
|
getProjectedPlanesOnOverlay(polygons) {
|
|
364
|
-
const mesh = this.getOverlayMeshForRaycast()
|
|
365
|
-
if (!mesh) {
|
|
366
|
-
return polygons.map(() => null)
|
|
367
|
-
}
|
|
368
|
-
mesh.updateMatrixWorld(true)
|
|
369
354
|
const RayCaster = new THREE.Raycaster()
|
|
370
|
-
const recursive = this.getRaycastRecursive()
|
|
371
355
|
const cloudsPoints = polygons.map((polygon) => {
|
|
372
356
|
const outline = polygon.outline
|
|
373
357
|
const holeOutlines = polygon.holes.map((h) => h.outline)
|
|
@@ -384,8 +368,8 @@ export default class ThreeDModelOverlay extends Overlay {
|
|
|
384
368
|
let { xMin, xMax, yMin, yMax } = outlineBounds
|
|
385
369
|
const cloudPoints = []
|
|
386
370
|
let stepNum = 8
|
|
387
|
-
for (let i = 1; i < stepNum
|
|
388
|
-
for (let j = 1; j < stepNum
|
|
371
|
+
for (let i = 1; i < stepNum; i++) {
|
|
372
|
+
for (let j = 1; j < stepNum; j++) {
|
|
389
373
|
const testPoint = {
|
|
390
374
|
x: xMin + (i * (xMax - xMin)) / stepNum,
|
|
391
375
|
y: yMin + (j * (yMax - yMin)) / stepNum,
|
|
@@ -400,7 +384,7 @@ export default class ThreeDModelOverlay extends Overlay {
|
|
|
400
384
|
new THREE.Vector3(testPoint.x / 1000, testPoint.y / 1000, 100),
|
|
401
385
|
new THREE.Vector3(0, 0, -1)
|
|
402
386
|
)
|
|
403
|
-
let intersects = RayCaster.intersectObject(
|
|
387
|
+
let intersects = RayCaster.intersectObject(this.overlayMesh)
|
|
404
388
|
if (intersects.length > 0) {
|
|
405
389
|
cloudPoints.push(intersects[0].point)
|
|
406
390
|
}
|
|
@@ -744,23 +744,6 @@ export default {
|
|
|
744
744
|
waitingBall.scale.set(scale, scale, scale)
|
|
745
745
|
this.render()
|
|
746
746
|
}
|
|
747
|
-
// Per-frame updates for overlays (e.g. Google 3D Tiles)
|
|
748
|
-
const overlayMeshes = this.meshes?.overlayMeshes
|
|
749
|
-
let overlayUpdated = false
|
|
750
|
-
if (overlayMeshes) {
|
|
751
|
-
Object.values(overlayMeshes).forEach((mesh) => {
|
|
752
|
-
if (
|
|
753
|
-
mesh?.userData?.update &&
|
|
754
|
-
typeof mesh.userData.update === 'function'
|
|
755
|
-
) {
|
|
756
|
-
mesh.userData.update()
|
|
757
|
-
overlayUpdated = true
|
|
758
|
-
}
|
|
759
|
-
})
|
|
760
|
-
}
|
|
761
|
-
if (overlayUpdated) {
|
|
762
|
-
this.render()
|
|
763
|
-
}
|
|
764
747
|
this.animationFrameId = requestAnimationFrame(this.animate)
|
|
765
748
|
},
|
|
766
749
|
},
|
|
@@ -88,8 +88,6 @@ export default {
|
|
|
88
88
|
cylinder.userData.edgeId = edge.id
|
|
89
89
|
cylinder.userData.type = 'edgeMeshes'
|
|
90
90
|
cylinder.userData.layer = edge.layer
|
|
91
|
-
cylinder.frustumCulled = false
|
|
92
|
-
|
|
93
91
|
cylinder.frustumCulled = false
|
|
94
92
|
cylinder.renderOrder = 15
|
|
95
93
|
this.meshes.edgeMeshes[edge.id] = cylinder
|
|
@@ -9,10 +9,22 @@ export default {
|
|
|
9
9
|
this.mergedObstacleSideMesh = null
|
|
10
10
|
},
|
|
11
11
|
methods: {
|
|
12
|
-
applyTextureOnObstacles(
|
|
12
|
+
applyTextureOnObstacles() {
|
|
13
13
|
this.reorderRoofMaterials()
|
|
14
14
|
if (this.mergedObstacleMesh) {
|
|
15
|
-
|
|
15
|
+
const geometry = this.mergedObstacleMesh.geometry
|
|
16
|
+
geometry.computeBoundingBox()
|
|
17
|
+
const bounds = {
|
|
18
|
+
xMin: geometry.boundingBox.min.x,
|
|
19
|
+
xMax: geometry.boundingBox.max.x,
|
|
20
|
+
yMin: geometry.boundingBox.min.y,
|
|
21
|
+
yMax: geometry.boundingBox.max.y,
|
|
22
|
+
}
|
|
23
|
+
const materials = this.getMaterialsFromBounds(
|
|
24
|
+
bounds,
|
|
25
|
+
this.material.roof
|
|
26
|
+
)
|
|
27
|
+
this.applyTextureOnMesh(materials, this.mergedObstacleMesh)
|
|
16
28
|
}
|
|
17
29
|
},
|
|
18
30
|
renderObstacles() {
|
|
@@ -75,7 +87,7 @@ export default {
|
|
|
75
87
|
this.mergedObstacleMesh,
|
|
76
88
|
obstacleGeometries
|
|
77
89
|
)
|
|
78
|
-
this.applyTextureOnObstacles(
|
|
90
|
+
this.applyTextureOnObstacles()
|
|
79
91
|
|
|
80
92
|
this.mergedObstacleSideMesh = this.updateOrCreateMergedMesh(
|
|
81
93
|
this.mergedObstacleSideMesh,
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
import * as THREE from 'three'
|
|
2
|
-
function cloneMaterialArrayAndAddEmission(material, color) {
|
|
3
|
-
let newMaterial = material.clone()
|
|
4
|
-
newMaterial.camera = material.camera
|
|
5
|
-
newMaterial.emissiveEnabled = true
|
|
6
|
-
newMaterial.emissive.set(color)
|
|
7
|
-
return newMaterial
|
|
8
|
-
}
|
|
9
1
|
export default {
|
|
10
2
|
methods: {
|
|
11
3
|
reorderRoofMaterials() {
|
|
@@ -16,14 +8,9 @@ export default {
|
|
|
16
8
|
})
|
|
17
9
|
},
|
|
18
10
|
async updateProjectionMaterials() {
|
|
19
|
-
//this.setImageOverlayCameraPosition()
|
|
20
11
|
this.overlayMaterials = (await this.getOverlaysMaterials()).filter(
|
|
21
12
|
(m) => !!m
|
|
22
13
|
)
|
|
23
|
-
// this.material.selectedWarningRoof = this.material.roof.map((material) =>
|
|
24
|
-
// cloneMaterialArrayAndAddEmission(material, 0x808080)
|
|
25
|
-
// )
|
|
26
|
-
//add or remove imageOverlayMaterial
|
|
27
14
|
this.material.roof = this.material.roof.filter(
|
|
28
15
|
(material) => material.userData.type != 'overlayMaterial'
|
|
29
16
|
)
|
|
@@ -32,5 +19,53 @@ export default {
|
|
|
32
19
|
this.applyTextureOnRoofs()
|
|
33
20
|
this.applyTextureOnObstacles()
|
|
34
21
|
},
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} bounds in meters { xMin, xMax, yMin, yMax }
|
|
25
|
+
* @param {Array} materials array of materials
|
|
26
|
+
* @returns {Array} array of all non-tile and relevant tile materials
|
|
27
|
+
*/
|
|
28
|
+
getMaterialsFromBounds(bounds, materials = []) {
|
|
29
|
+
if (!materials?.length) return materials
|
|
30
|
+
const nonTile = []
|
|
31
|
+
const tileMats = []
|
|
32
|
+
for (const m of materials) {
|
|
33
|
+
if (m?.userData?.type === 'tileProjectionMaterial') {
|
|
34
|
+
tileMats.push(m)
|
|
35
|
+
} else {
|
|
36
|
+
nonTile.push(m)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (tileMats.length === 0) return materials
|
|
40
|
+
const relevantTiles = bounds
|
|
41
|
+
? tileMats.filter((m) => this.materialOverlapsBounds(m, bounds))
|
|
42
|
+
: tileMats
|
|
43
|
+
const combined = [...nonTile, ...relevantTiles]
|
|
44
|
+
combined.sort((a, b) => (a.priority || 0) - (b.priority || 0))
|
|
45
|
+
return combined
|
|
46
|
+
},
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @param {Object} material
|
|
50
|
+
* @param {Object} bounds in meters { xMin, xMax, yMin, yMax }
|
|
51
|
+
* @returns {boolean} true if material overlaps bounds
|
|
52
|
+
*/
|
|
53
|
+
materialOverlapsBounds(material, bounds) {
|
|
54
|
+
if (!bounds || !material?.camera) return true
|
|
55
|
+
const cam = material.camera
|
|
56
|
+
if (!cam.isOrthographicCamera) return true
|
|
57
|
+
const left = cam.left
|
|
58
|
+
const right = cam.right
|
|
59
|
+
const bottom = cam.bottom
|
|
60
|
+
const top = cam.top
|
|
61
|
+
const tileMinX = Math.min(left, right)
|
|
62
|
+
const tileMaxX = Math.max(left, right)
|
|
63
|
+
const tileMinY = Math.min(bottom, top)
|
|
64
|
+
const tileMaxY = Math.max(bottom, top)
|
|
65
|
+
const { xMin, xMax, yMin, yMax } = bounds
|
|
66
|
+
const separated =
|
|
67
|
+
xMax < tileMinX || xMin > tileMaxX || yMax < tileMinY || yMin > tileMaxY
|
|
68
|
+
return !separated
|
|
69
|
+
},
|
|
35
70
|
},
|
|
36
71
|
}
|
|
@@ -68,14 +68,27 @@ export default {
|
|
|
68
68
|
|
|
69
69
|
return geometry
|
|
70
70
|
},
|
|
71
|
-
|
|
71
|
+
getMaterialsForRoof(roofPolygon) {
|
|
72
|
+
const bounds = roofPolygon.getBounds()
|
|
73
|
+
// convert bounds to meters
|
|
74
|
+
const boundsMeters = {
|
|
75
|
+
xMin: bounds.xMin / 1000,
|
|
76
|
+
xMax: bounds.xMax / 1000,
|
|
77
|
+
yMin: bounds.yMin / 1000,
|
|
78
|
+
yMax: bounds.yMax / 1000,
|
|
79
|
+
}
|
|
80
|
+
const materials = this.getMaterialsFromBounds(
|
|
81
|
+
boundsMeters,
|
|
82
|
+
this.material.roof
|
|
83
|
+
)
|
|
84
|
+
return materials
|
|
85
|
+
},
|
|
72
86
|
applyTextureOnRoofs() {
|
|
73
87
|
this.reorderRoofMaterials()
|
|
74
|
-
const material = this.material.roof
|
|
75
88
|
this.roofs.forEach((roof) => {
|
|
76
89
|
const roofMesh = this.meshes.roofMeshes[roof.id]
|
|
77
90
|
if (roofMesh) {
|
|
78
|
-
this.applyTextureOnMesh(
|
|
91
|
+
this.applyTextureOnMesh(this.getMaterialsForRoof(roof), roofMesh)
|
|
79
92
|
}
|
|
80
93
|
})
|
|
81
94
|
this.render()
|
|
@@ -84,7 +97,7 @@ export default {
|
|
|
84
97
|
this.clearRemovedOnes('roofMeshes')
|
|
85
98
|
this.roofs.forEach((roofPolygon) => {
|
|
86
99
|
const material = roofPolygon.isFlat
|
|
87
|
-
? this.
|
|
100
|
+
? this.getMaterialsForRoof(roofPolygon)
|
|
88
101
|
: this.material.warningRoof
|
|
89
102
|
let mesh
|
|
90
103
|
let geometry
|
|
@@ -289,6 +289,7 @@ export default {
|
|
|
289
289
|
material = mesh.material
|
|
290
290
|
geometry = updateBufferRoofGeometry(corners, [], geometry)
|
|
291
291
|
mesh.geometry = geometry
|
|
292
|
+
if (geometry) geometry.computeBoundingSphere()
|
|
292
293
|
material.map = texture
|
|
293
294
|
material.needsUpdate = true
|
|
294
295
|
mesh.userData.mapLayer = this.provider.mapLayer
|
|
@@ -310,6 +311,7 @@ export default {
|
|
|
310
311
|
material.needsUpdate = true
|
|
311
312
|
geometry = getBufferRoofGeometry(corners)
|
|
312
313
|
if (geometry) {
|
|
314
|
+
geometry.computeBoundingSphere()
|
|
313
315
|
mesh = new THREE.Mesh(geometry, material)
|
|
314
316
|
mesh.userData.type = 'tileMeshes'
|
|
315
317
|
mesh.userData.meshId = meshId
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/assets/theme.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const theme = {
|
|
2
|
-
colors: {
|
|
3
|
-
primary: '#282387',
|
|
4
|
-
secondary: '#818181',
|
|
5
|
-
tertiary: '#d5d5d5',
|
|
6
|
-
black: '#263238',
|
|
7
|
-
yellow: '#fdb813',
|
|
8
|
-
darkGray: '#818181',
|
|
9
|
-
mediumGray: '#d5d5d5',
|
|
10
|
-
lightGray: '#f2f2f2',
|
|
11
|
-
white: '#fff',
|
|
12
|
-
blue: '#48a2d0',
|
|
13
|
-
red: '#FF5656',
|
|
14
|
-
blue1: '#e4efff',
|
|
15
|
-
blue2: '#F6FAFF',
|
|
16
|
-
grey1: '#666',
|
|
17
|
-
grey2: '#c4c4c4',
|
|
18
|
-
grey3: '#b2b9c5',
|
|
19
|
-
grey4: '#dee2eb',
|
|
20
|
-
grey5: '#fafafa',
|
|
21
|
-
grey6: '#555d61',
|
|
22
|
-
turquoise: '#20A4CA',
|
|
23
|
-
green: '#99db0c',
|
|
24
|
-
purple: '#505ca6',
|
|
25
|
-
disabled: '#dfe1e1',
|
|
26
|
-
transparentWhite1: '#ffffff32',
|
|
27
|
-
transparentBlack1: '#263238e6',
|
|
28
|
-
transparentBlue1: '#20a4cae6',
|
|
29
|
-
blueElectric: '#66dffa',
|
|
30
|
-
eturnityGrey: '#263238'
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
screen: {
|
|
34
|
-
mobileSmall: '345px',
|
|
35
|
-
mobile: '425px',
|
|
36
|
-
mobileLarge: '530px',
|
|
37
|
-
tablet: '768px',
|
|
38
|
-
tabletLarge: '950px'
|
|
39
|
-
},
|
|
40
|
-
borderRadius: '4px'
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default theme
|
package/dist/assets/vue.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
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="37.07" height="36" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 198"><path fill="#41B883" d="M204.8 0H256L128 220.8L0 0h97.92L128 51.2L157.44 0h47.36Z"></path><path fill="#41B883" d="m0 0l128 220.8L256 0h-51.2L128 132.48L50.56 0H0Z"></path><path fill="#35495E" d="M50.56 0L128 133.12L204.8 0h-47.36L128 51.2L97.92 0H50.56Z"></path></svg>
|