@eturnity/eturnity_3d 8.46.2 → 9.7.0-EPDM-13987.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 +0 -2
- package/src/helper/cameraMixin.js +56 -7
- package/src/helper/render/edge.js +1 -1
- package/src/helper/render/geometryHandler.js +7 -1
- package/src/helper/render/mergedGeometry.js +16 -5
- package/src/helper/render/roof.js +7 -3
- package/src/helper/render/shadingMaterial/helper.js +1 -1
- package/src/helper/render/texture.js +1 -1
- package/src/helper/renderMixin.js +8 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eturnity/eturnity_3d",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "9.7.0-EPDM-13987.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": "
|
|
19
|
+
"@eturnity/eturnity_maths": "9.7.0-EPDM-13987.0",
|
|
20
20
|
"@originjs/vite-plugin-commonjs": "1.0.3",
|
|
21
21
|
"core-js": "3.30.2",
|
|
22
22
|
"cors": "2.8.5",
|
|
@@ -122,7 +122,6 @@ export default class ThreeDModelOverlay extends Overlay {
|
|
|
122
122
|
return
|
|
123
123
|
}
|
|
124
124
|
group = new this.Paper.Group()
|
|
125
|
-
|
|
126
125
|
group.addChild(this.renderImagePlaceHolder(paperJSComponent))
|
|
127
126
|
group.itemType = 'placeholderOverlays'
|
|
128
127
|
group.type = 'imageOverlays'
|
|
@@ -138,7 +137,6 @@ export default class ThreeDModelOverlay extends Overlay {
|
|
|
138
137
|
this.hasPlaceholderPath = true
|
|
139
138
|
return
|
|
140
139
|
}
|
|
141
|
-
|
|
142
140
|
if (this.hasPlaceholderPath) {
|
|
143
141
|
if (group) {
|
|
144
142
|
paperJSComponent.clearPath(group)
|
|
@@ -440,7 +440,10 @@ export default {
|
|
|
440
440
|
this.setTweenTo({ position, target })
|
|
441
441
|
}
|
|
442
442
|
},
|
|
443
|
-
|
|
443
|
+
setCameraGlobalPositionImmediately() {
|
|
444
|
+
this.setCameraGlobalPosition({ duration: 0 })
|
|
445
|
+
},
|
|
446
|
+
setCameraGlobalPosition({ duration = 1500 } = {}) {
|
|
444
447
|
if (this.camera.isOrthographicCamera) {
|
|
445
448
|
this.setOrthographicCameraGlobalPosition()
|
|
446
449
|
} else {
|
|
@@ -466,10 +469,41 @@ export default {
|
|
|
466
469
|
positionVector.z,
|
|
467
470
|
]
|
|
468
471
|
let target = [targetVector.x, targetVector.y, targetVector.z]
|
|
469
|
-
this.setTweenTo({ position, target, fov: newFov })
|
|
472
|
+
this.setTweenTo({ position, target, fov: newFov, duration })
|
|
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]
|
|
470
499
|
}
|
|
500
|
+
this.setTweenTo({
|
|
501
|
+
position,
|
|
502
|
+
target,
|
|
503
|
+
duration,
|
|
504
|
+
})
|
|
471
505
|
},
|
|
472
|
-
setCameraGlobalVerticalPosition() {
|
|
506
|
+
setCameraGlobalVerticalPosition(changeCameraTypeAsCallback = true) {
|
|
473
507
|
let position, target
|
|
474
508
|
let newFov = 10
|
|
475
509
|
if (this.roofs.length != 0) {
|
|
@@ -498,10 +532,12 @@ export default {
|
|
|
498
532
|
position,
|
|
499
533
|
target,
|
|
500
534
|
fov: newFov,
|
|
501
|
-
callback:
|
|
535
|
+
callback: changeCameraTypeAsCallback
|
|
536
|
+
? this.turnPerspectiveCameraToOrthogonal
|
|
537
|
+
: undefined,
|
|
502
538
|
})
|
|
503
539
|
},
|
|
504
|
-
setCameraOrthogonalTo(polygon) {
|
|
540
|
+
setCameraOrthogonalTo(polygon, { duration = 1000 } = {}) {
|
|
505
541
|
if (polygon) {
|
|
506
542
|
let polygonRef = polygon
|
|
507
543
|
const targetVector = polygonRef.meanPoint
|
|
@@ -519,7 +555,7 @@ export default {
|
|
|
519
555
|
positionVector.y / 1000 - 1,
|
|
520
556
|
positionVector.z / 1000,
|
|
521
557
|
]
|
|
522
|
-
this.setTweenTo({ position, target })
|
|
558
|
+
this.setTweenTo({ position, target, duration })
|
|
523
559
|
}
|
|
524
560
|
},
|
|
525
561
|
setCameraSideTo(polygon) {
|
|
@@ -553,11 +589,24 @@ export default {
|
|
|
553
589
|
position,
|
|
554
590
|
target,
|
|
555
591
|
fov = 50,
|
|
556
|
-
duration =
|
|
592
|
+
duration = 1500,
|
|
557
593
|
callback = () => {},
|
|
558
594
|
} = payload
|
|
559
595
|
TWEEN.removeAll()
|
|
560
596
|
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
|
+
}
|
|
561
610
|
const currentTweenVar = {
|
|
562
611
|
t: 0,
|
|
563
612
|
}
|
|
@@ -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
|
+
geometry.userData.version = 0
|
|
267
267
|
return geometry
|
|
268
268
|
}
|
|
269
269
|
|
|
@@ -321,6 +321,7 @@ 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
|
|
324
325
|
return geometry
|
|
325
326
|
}
|
|
326
327
|
|
|
@@ -405,6 +406,7 @@ export function getBufferObstacleSideGeometry(obstaclePolygon, roofPolygon) {
|
|
|
405
406
|
// itemSize = 3 because there are 3 values (components) per vertex
|
|
406
407
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
407
408
|
geometry.computeVertexNormals()
|
|
409
|
+
geometry.userData.version = 0
|
|
408
410
|
return geometry
|
|
409
411
|
}
|
|
410
412
|
|
|
@@ -440,6 +442,7 @@ export function getBufferModuleFieldGeometry(moduleFieldPolygon) {
|
|
|
440
442
|
geometry.setAttribute('uv', new THREE.BufferAttribute(uvs, 2))
|
|
441
443
|
|
|
442
444
|
geometry.computeVertexNormals()
|
|
445
|
+
geometry.userData.version = 0
|
|
443
446
|
return geometry
|
|
444
447
|
}
|
|
445
448
|
|
|
@@ -485,6 +488,7 @@ export function getBufferImageOverlayGeometry(corners) {
|
|
|
485
488
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
486
489
|
geometry.setAttribute('uv', new THREE.BufferAttribute(uvs, 2))
|
|
487
490
|
geometry.computeVertexNormals()
|
|
491
|
+
geometry.userData.version = 0
|
|
488
492
|
return geometry
|
|
489
493
|
}
|
|
490
494
|
export function getPanelOutlineWithHeightOffset(panelPolygon) {
|
|
@@ -544,6 +548,7 @@ export function getBufferPanelGeometry(panelPolygon) {
|
|
|
544
548
|
geometry.setAttribute('uv', new THREE.BufferAttribute(uvs, 2))
|
|
545
549
|
|
|
546
550
|
geometry.computeVertexNormals()
|
|
551
|
+
geometry.userData.version = 0
|
|
547
552
|
return geometry
|
|
548
553
|
}
|
|
549
554
|
export function updateBufferPanelGeometry(panelPolygon, geometry) {
|
|
@@ -636,6 +641,7 @@ export function getBufferPanelSideGeometry(panelPolygon) {
|
|
|
636
641
|
// itemSize = 3 because there are 3 values (components) per vertex
|
|
637
642
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
638
643
|
geometry.computeVertexNormals()
|
|
644
|
+
geometry.userData.version = 0
|
|
639
645
|
return geometry
|
|
640
646
|
}
|
|
641
647
|
|
|
@@ -6,9 +6,12 @@ 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
|
+
}
|
|
12
15
|
const positions = geometry.attributes.position.array
|
|
13
16
|
const normals = geometry.attributes.normal.array
|
|
14
17
|
mergedVertices.push(...positions.slice(0, 3 * geometry.drawRange.count))
|
|
@@ -66,6 +69,9 @@ export default {
|
|
|
66
69
|
const mergedUvs = []
|
|
67
70
|
|
|
68
71
|
geometries.forEach((geometry) => {
|
|
72
|
+
if (!geometry || !geometry.attributes?.position || !geometry.attributes?.normal) {
|
|
73
|
+
return
|
|
74
|
+
}
|
|
69
75
|
const positions = geometry.attributes.position.array
|
|
70
76
|
const normals = geometry.attributes.normal.array
|
|
71
77
|
|
|
@@ -96,11 +102,16 @@ export default {
|
|
|
96
102
|
},
|
|
97
103
|
|
|
98
104
|
updateOrCreateMergedMesh(mesh, geometries, material) {
|
|
99
|
-
if (!mesh) {
|
|
105
|
+
if (!mesh || !mesh.geometry) {
|
|
100
106
|
let mergedGeometry = this.createMergedGeometry(geometries)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
if (!mesh) {
|
|
108
|
+
mesh = new THREE.Mesh(mergedGeometry, material)
|
|
109
|
+
// Add the merged mesh to the scene
|
|
110
|
+
this.scene.add(mesh)
|
|
111
|
+
} else {
|
|
112
|
+
mesh.geometry = mergedGeometry
|
|
113
|
+
if (material) mesh.material = material
|
|
114
|
+
}
|
|
104
115
|
} else {
|
|
105
116
|
let mergedGeometry = this.updateMergedGeometry(
|
|
106
117
|
geometries,
|
|
@@ -99,8 +99,10 @@ 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
|
-
|
|
102
|
+
if (geometry) {
|
|
103
|
+
mesh.geometry = geometry
|
|
104
|
+
mesh.updateMatrix()
|
|
105
|
+
}
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
if (!this.meshes.roofMeshes[roofPolygon.id]) {
|
|
@@ -137,7 +139,9 @@ export default {
|
|
|
137
139
|
[],
|
|
138
140
|
mesh.geometry
|
|
139
141
|
)
|
|
140
|
-
|
|
142
|
+
if (geometry) {
|
|
143
|
+
mesh.geometry = geometry
|
|
144
|
+
}
|
|
141
145
|
mesh.userData.version = roofPolygon.version
|
|
142
146
|
}
|
|
143
147
|
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].item
|
|
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 && materials && materials.length > 0) {
|
|
4
|
+
if (mesh && mesh.geometry && 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,6 +155,14 @@ 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
|
+
|
|
158
166
|
case 'setCameraInitialPosition':
|
|
159
167
|
methodList.push({
|
|
160
168
|
name: 'setCameraInitialPosition',
|