@eturnity/eturnity_3d 9.7.0-EPDM-13987.0 → 9.7.0-dev-25.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/Overlay/ThreeDModelOverlay.js +2 -0
- package/src/helper/cameraMixin.js +7 -56
- package/src/helper/render/edge.js +1 -1
- package/src/helper/render/geometryHandler.js +20 -27
- package/src/helper/render/mergedGeometry.js +5 -16
- package/src/helper/render/roof.js +3 -7
- package/src/helper/render/shadingMaterial/helper.js +1 -1
- package/src/helper/render/texture.js +1 -1
- package/src/helper/renderMixin.js +0 -8
- 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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eturnity/eturnity_3d",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "9.7.0-
|
|
4
|
+
"version": "9.7.0-dev-25.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
7
7
|
"src"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"merge-remote-master": "node scripts/merge-remote-master.js"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@eturnity/eturnity_maths": "9.7.0
|
|
19
|
+
"@eturnity/eturnity_maths": "9.7.0",
|
|
20
20
|
"@originjs/vite-plugin-commonjs": "1.0.3",
|
|
21
21
|
"core-js": "3.30.2",
|
|
22
22
|
"cors": "2.8.5",
|
|
@@ -122,6 +122,7 @@ export default class ThreeDModelOverlay extends Overlay {
|
|
|
122
122
|
return
|
|
123
123
|
}
|
|
124
124
|
group = new this.Paper.Group()
|
|
125
|
+
|
|
125
126
|
group.addChild(this.renderImagePlaceHolder(paperJSComponent))
|
|
126
127
|
group.itemType = 'placeholderOverlays'
|
|
127
128
|
group.type = 'imageOverlays'
|
|
@@ -137,6 +138,7 @@ export default class ThreeDModelOverlay extends Overlay {
|
|
|
137
138
|
this.hasPlaceholderPath = true
|
|
138
139
|
return
|
|
139
140
|
}
|
|
141
|
+
|
|
140
142
|
if (this.hasPlaceholderPath) {
|
|
141
143
|
if (group) {
|
|
142
144
|
paperJSComponent.clearPath(group)
|
|
@@ -440,10 +440,7 @@ export default {
|
|
|
440
440
|
this.setTweenTo({ position, target })
|
|
441
441
|
}
|
|
442
442
|
},
|
|
443
|
-
|
|
444
|
-
this.setCameraGlobalPosition({ duration: 0 })
|
|
445
|
-
},
|
|
446
|
-
setCameraGlobalPosition({ duration = 1500 } = {}) {
|
|
443
|
+
setCameraGlobalPosition() {
|
|
447
444
|
if (this.camera.isOrthographicCamera) {
|
|
448
445
|
this.setOrthographicCameraGlobalPosition()
|
|
449
446
|
} else {
|
|
@@ -469,41 +466,10 @@ export default {
|
|
|
469
466
|
positionVector.z,
|
|
470
467
|
]
|
|
471
468
|
let target = [targetVector.x, targetVector.y, targetVector.z]
|
|
472
|
-
this.setTweenTo({ position, target, fov: newFov
|
|
473
|
-
}
|
|
474
|
-
},
|
|
475
|
-
setCameraGlobalAlmostVerticalPosition({ duration = 1000 } = {}) {
|
|
476
|
-
let position, target
|
|
477
|
-
if (this.roofs.length != 0) {
|
|
478
|
-
let bounds = this.roofsBounds
|
|
479
|
-
let targetVector = {
|
|
480
|
-
x: (bounds.xMax + bounds.xMin) / 2000,
|
|
481
|
-
y: (bounds.yMax + bounds.yMin) / 2000,
|
|
482
|
-
z: 0,
|
|
483
|
-
}
|
|
484
|
-
let objectRadius_m = Math.max(
|
|
485
|
-
(bounds.xMax - bounds.xMin) / 2000,
|
|
486
|
-
(bounds.yMax - bounds.yMin) / 2000
|
|
487
|
-
)
|
|
488
|
-
|
|
489
|
-
let distance =
|
|
490
|
-
2 *
|
|
491
|
-
(objectRadius_m / Math.sin(((this.camera.fov / 2) * Math.PI) / 180))
|
|
492
|
-
let cameraMoveVector = { x: 0, y: 0, z: distance }
|
|
493
|
-
const positionVector = addVector(targetVector, cameraMoveVector)
|
|
494
|
-
position = [positionVector.x, positionVector.y - 1, positionVector.z]
|
|
495
|
-
target = [targetVector.x, targetVector.y, targetVector.z]
|
|
496
|
-
} else {
|
|
497
|
-
position = [0, -1, 300]
|
|
498
|
-
target = [0, 0, 0]
|
|
469
|
+
this.setTweenTo({ position, target, fov: newFov })
|
|
499
470
|
}
|
|
500
|
-
this.setTweenTo({
|
|
501
|
-
position,
|
|
502
|
-
target,
|
|
503
|
-
duration,
|
|
504
|
-
})
|
|
505
471
|
},
|
|
506
|
-
setCameraGlobalVerticalPosition(
|
|
472
|
+
setCameraGlobalVerticalPosition() {
|
|
507
473
|
let position, target
|
|
508
474
|
let newFov = 10
|
|
509
475
|
if (this.roofs.length != 0) {
|
|
@@ -532,12 +498,10 @@ export default {
|
|
|
532
498
|
position,
|
|
533
499
|
target,
|
|
534
500
|
fov: newFov,
|
|
535
|
-
callback:
|
|
536
|
-
? this.turnPerspectiveCameraToOrthogonal
|
|
537
|
-
: undefined,
|
|
501
|
+
callback: this.turnPerspectiveCameraToOrthogonal,
|
|
538
502
|
})
|
|
539
503
|
},
|
|
540
|
-
setCameraOrthogonalTo(polygon
|
|
504
|
+
setCameraOrthogonalTo(polygon) {
|
|
541
505
|
if (polygon) {
|
|
542
506
|
let polygonRef = polygon
|
|
543
507
|
const targetVector = polygonRef.meanPoint
|
|
@@ -555,7 +519,7 @@ export default {
|
|
|
555
519
|
positionVector.y / 1000 - 1,
|
|
556
520
|
positionVector.z / 1000,
|
|
557
521
|
]
|
|
558
|
-
this.setTweenTo({ position, target
|
|
522
|
+
this.setTweenTo({ position, target })
|
|
559
523
|
}
|
|
560
524
|
},
|
|
561
525
|
setCameraSideTo(polygon) {
|
|
@@ -589,24 +553,11 @@ export default {
|
|
|
589
553
|
position,
|
|
590
554
|
target,
|
|
591
555
|
fov = 50,
|
|
592
|
-
duration =
|
|
556
|
+
duration = 2000,
|
|
593
557
|
callback = () => {},
|
|
594
558
|
} = payload
|
|
595
559
|
TWEEN.removeAll()
|
|
596
560
|
if (this.camera) {
|
|
597
|
-
if (duration == 0) {
|
|
598
|
-
this.camera.fov = fov
|
|
599
|
-
this.camera.position.set(position[0], position[1], position[2])
|
|
600
|
-
|
|
601
|
-
this.camera.updateProjectionMatrix()
|
|
602
|
-
|
|
603
|
-
this.orbitControl.target.set(target[0], target[1], target[2])
|
|
604
|
-
if (this.orbitControl && this.orbitControl.update) {
|
|
605
|
-
this.orbitControl.update()
|
|
606
|
-
}
|
|
607
|
-
callback()
|
|
608
|
-
return
|
|
609
|
-
}
|
|
610
561
|
const currentTweenVar = {
|
|
611
562
|
t: 0,
|
|
612
563
|
}
|
|
@@ -263,7 +263,7 @@ export function getBufferWallGeometry(polygon) {
|
|
|
263
263
|
// itemSize = 3 because there are 3 values (components) per vertex
|
|
264
264
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
265
265
|
geometry.computeVertexNormals()
|
|
266
|
-
|
|
266
|
+
|
|
267
267
|
return geometry
|
|
268
268
|
}
|
|
269
269
|
|
|
@@ -321,7 +321,6 @@ export function getBufferObstacleGeometry(obstaclePolygon, roofPolygon) {
|
|
|
321
321
|
// itemSize = 3 because there are 3 values (components) per vertex
|
|
322
322
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
323
323
|
geometry.computeVertexNormals()
|
|
324
|
-
geometry.userData.version = 0
|
|
325
324
|
return geometry
|
|
326
325
|
}
|
|
327
326
|
|
|
@@ -406,7 +405,6 @@ export function getBufferObstacleSideGeometry(obstaclePolygon, roofPolygon) {
|
|
|
406
405
|
// itemSize = 3 because there are 3 values (components) per vertex
|
|
407
406
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
408
407
|
geometry.computeVertexNormals()
|
|
409
|
-
geometry.userData.version = 0
|
|
410
408
|
return geometry
|
|
411
409
|
}
|
|
412
410
|
|
|
@@ -442,7 +440,6 @@ export function getBufferModuleFieldGeometry(moduleFieldPolygon) {
|
|
|
442
440
|
geometry.setAttribute('uv', new THREE.BufferAttribute(uvs, 2))
|
|
443
441
|
|
|
444
442
|
geometry.computeVertexNormals()
|
|
445
|
-
geometry.userData.version = 0
|
|
446
443
|
return geometry
|
|
447
444
|
}
|
|
448
445
|
|
|
@@ -488,7 +485,6 @@ export function getBufferImageOverlayGeometry(corners) {
|
|
|
488
485
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
489
486
|
geometry.setAttribute('uv', new THREE.BufferAttribute(uvs, 2))
|
|
490
487
|
geometry.computeVertexNormals()
|
|
491
|
-
geometry.userData.version = 0
|
|
492
488
|
return geometry
|
|
493
489
|
}
|
|
494
490
|
export function getPanelOutlineWithHeightOffset(panelPolygon) {
|
|
@@ -523,40 +519,38 @@ export function getBufferPanelGeometry(panelPolygon) {
|
|
|
523
519
|
return null
|
|
524
520
|
}
|
|
525
521
|
const vertices = new Float32Array(trianglesVertices)
|
|
526
|
-
|
|
527
|
-
var B = panelPolygon.outline[3]
|
|
528
|
-
var C = panelPolygon.outline[1]
|
|
529
|
-
var D = panelPolygon.outline[0]
|
|
530
|
-
const AB = getDistanceBetweenPoints(A, B)
|
|
531
|
-
const AC = getDistanceBetweenPoints(A, C)
|
|
532
|
-
let uvs
|
|
533
|
-
if (AB < AC) {
|
|
534
|
-
uvs = new Float32Array([
|
|
535
|
-
0, 1, 0, 0, 1, 0,
|
|
536
|
-
|
|
537
|
-
0, 1, 1, 0, 1, 1,
|
|
538
|
-
])
|
|
539
|
-
} else {
|
|
540
|
-
uvs = new Float32Array([
|
|
541
|
-
0, 0, 1, 0, 1, 1,
|
|
542
|
-
|
|
543
|
-
1, 0, 0, 1, 1, 1,
|
|
544
|
-
])
|
|
545
|
-
}
|
|
522
|
+
const uvs = getPanelUVsFromOutline(panelPolygon.outline)
|
|
546
523
|
|
|
547
524
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
548
525
|
geometry.setAttribute('uv', new THREE.BufferAttribute(uvs, 2))
|
|
549
526
|
|
|
550
527
|
geometry.computeVertexNormals()
|
|
551
|
-
geometry.userData.version = 0
|
|
552
528
|
return geometry
|
|
553
529
|
}
|
|
554
530
|
export function updateBufferPanelGeometry(panelPolygon, geometry) {
|
|
555
531
|
const panelOutlineTop = getPanelOutlineWithHeightOffset(panelPolygon)
|
|
556
532
|
geometry = updateBufferRoofGeometry(panelOutlineTop, [], geometry)
|
|
533
|
+
if (geometry && panelPolygon.outline && panelPolygon.outline.length >= 4) {
|
|
534
|
+
const uvs = getPanelUVsFromOutline(panelPolygon.outline)
|
|
535
|
+
geometry.setAttribute('uv', new THREE.BufferAttribute(uvs, 2))
|
|
536
|
+
geometry.attributes.uv.needsUpdate = true
|
|
537
|
+
}
|
|
557
538
|
return geometry
|
|
558
539
|
}
|
|
559
540
|
|
|
541
|
+
export function getPanelUVsFromOutline(outline) {
|
|
542
|
+
const A = outline[3]
|
|
543
|
+
const B = outline[2]
|
|
544
|
+
const C = outline[0]
|
|
545
|
+
const AB = getDistanceBetweenPoints(A, B)
|
|
546
|
+
const AC = getDistanceBetweenPoints(A, C)
|
|
547
|
+
const uvs =
|
|
548
|
+
AB < AC
|
|
549
|
+
? new Float32Array([0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1])
|
|
550
|
+
: new Float32Array([1, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0])
|
|
551
|
+
return uvs
|
|
552
|
+
}
|
|
553
|
+
|
|
560
554
|
export function getTriangleVerticesForSidePanels(outlineBottom, outlineUp) {
|
|
561
555
|
const triangleVertices = []
|
|
562
556
|
const length = outlineBottom.length
|
|
@@ -641,7 +635,6 @@ export function getBufferPanelSideGeometry(panelPolygon) {
|
|
|
641
635
|
// itemSize = 3 because there are 3 values (components) per vertex
|
|
642
636
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
643
637
|
geometry.computeVertexNormals()
|
|
644
|
-
geometry.userData.version = 0
|
|
645
638
|
return geometry
|
|
646
639
|
}
|
|
647
640
|
|
|
@@ -6,12 +6,9 @@ export default {
|
|
|
6
6
|
const mergedVertices = []
|
|
7
7
|
const mergedNormals = []
|
|
8
8
|
const mergedUvs = []
|
|
9
|
-
const geometryVersion = mergedGeometry
|
|
9
|
+
const geometryVersion = mergedGeometry.userData.version || 0
|
|
10
10
|
let geometryChanged = false
|
|
11
11
|
geometries.forEach((geometry) => {
|
|
12
|
-
if (!geometry || !geometry.attributes?.position || !geometry.attributes?.normal) {
|
|
13
|
-
return
|
|
14
|
-
}
|
|
15
12
|
const positions = geometry.attributes.position.array
|
|
16
13
|
const normals = geometry.attributes.normal.array
|
|
17
14
|
mergedVertices.push(...positions.slice(0, 3 * geometry.drawRange.count))
|
|
@@ -69,9 +66,6 @@ export default {
|
|
|
69
66
|
const mergedUvs = []
|
|
70
67
|
|
|
71
68
|
geometries.forEach((geometry) => {
|
|
72
|
-
if (!geometry || !geometry.attributes?.position || !geometry.attributes?.normal) {
|
|
73
|
-
return
|
|
74
|
-
}
|
|
75
69
|
const positions = geometry.attributes.position.array
|
|
76
70
|
const normals = geometry.attributes.normal.array
|
|
77
71
|
|
|
@@ -102,16 +96,11 @@ export default {
|
|
|
102
96
|
},
|
|
103
97
|
|
|
104
98
|
updateOrCreateMergedMesh(mesh, geometries, material) {
|
|
105
|
-
if (!mesh
|
|
99
|
+
if (!mesh) {
|
|
106
100
|
let mergedGeometry = this.createMergedGeometry(geometries)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
this.scene.add(mesh)
|
|
111
|
-
} else {
|
|
112
|
-
mesh.geometry = mergedGeometry
|
|
113
|
-
if (material) mesh.material = material
|
|
114
|
-
}
|
|
101
|
+
mesh = new THREE.Mesh(mergedGeometry, material)
|
|
102
|
+
// Add the merged mesh to the scene
|
|
103
|
+
this.scene.add(mesh)
|
|
115
104
|
} else {
|
|
116
105
|
let mergedGeometry = this.updateMergedGeometry(
|
|
117
106
|
geometries,
|
|
@@ -99,10 +99,8 @@ export default {
|
|
|
99
99
|
geometry = mesh.geometry
|
|
100
100
|
geometry = this.updateRoofGeometry(geometry, roofPolygon)
|
|
101
101
|
//in order to be able to render multiple material on it (background and image overlay)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
mesh.updateMatrix()
|
|
105
|
-
}
|
|
102
|
+
mesh.geometry = geometry
|
|
103
|
+
mesh.updateMatrix()
|
|
106
104
|
}
|
|
107
105
|
|
|
108
106
|
if (!this.meshes.roofMeshes[roofPolygon.id]) {
|
|
@@ -139,9 +137,7 @@ export default {
|
|
|
139
137
|
[],
|
|
140
138
|
mesh.geometry
|
|
141
139
|
)
|
|
142
|
-
|
|
143
|
-
mesh.geometry = geometry
|
|
144
|
-
}
|
|
140
|
+
mesh.geometry = geometry
|
|
145
141
|
mesh.userData.version = roofPolygon.version
|
|
146
142
|
}
|
|
147
143
|
mesh.visible = roofPolygon.maximumGap > maximumGapLimit
|
|
@@ -10,7 +10,7 @@ export function getEdgesForHorizonForShader(plane, edges) {
|
|
|
10
10
|
let obstacleEdgesForHorizon = edges
|
|
11
11
|
.filter((e) => e.layer == 'obstacle')
|
|
12
12
|
.map((e) => {
|
|
13
|
-
const obstaclePolygon = e.belongsTo[0].
|
|
13
|
+
const obstaclePolygon = e.belongsTo[0].polygon
|
|
14
14
|
let obstacleHeight
|
|
15
15
|
if (obstaclePolygon.isParallel) {
|
|
16
16
|
obstacleHeight = parseInt(obstaclePolygon.height || 0)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
methods: {
|
|
3
3
|
applyTextureOnMesh(materials, mesh) {
|
|
4
|
-
if (mesh &&
|
|
4
|
+
if (mesh && materials && materials.length > 0) {
|
|
5
5
|
const materialsVersionsOnMesh = mesh.userData.materialsVersions
|
|
6
6
|
if (materialsVersionsOnMesh) {
|
|
7
7
|
const materialUuids = materials.map((m) => m.uuid)
|
|
@@ -155,14 +155,6 @@ export default {
|
|
|
155
155
|
arg: [],
|
|
156
156
|
})
|
|
157
157
|
break
|
|
158
|
-
case 'setCameraGlobalPositionImmediately':
|
|
159
|
-
methodList.push({
|
|
160
|
-
name: 'setCameraGlobalPositionImmediately',
|
|
161
|
-
method: this.setCameraGlobalPositionImmediately,
|
|
162
|
-
arg: [],
|
|
163
|
-
})
|
|
164
|
-
break
|
|
165
|
-
|
|
166
158
|
case 'setCameraInitialPosition':
|
|
167
159
|
methodList.push({
|
|
168
160
|
name: 'setCameraInitialPosition',
|
|
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>
|