@eturnity/eturnity_3d 6.34.0 → 6.34.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/.editorconfig +5 -0
- package/package.json +8 -4
- package/src/App.vue +16 -16
- package/src/assets/theme.js +4 -4
- package/src/components/ThreeCanvasViewer.vue +56 -43
- package/src/config.js +139 -65
- package/src/helper/MapView.js +214 -241
- package/src/helper/UpdateRoofModuleFieldRelations.js +17 -23
- package/src/helper/UpdateRoofObstacleRelations.js +48 -41
- package/src/helper/cameraMixin.js +97 -93
- package/src/helper/customProvider.js +28 -28
- package/src/helper/materialMixin.js +86 -70
- package/src/helper/materials.js +64 -49
- package/src/helper/render/background.js +2 -5
- package/src/helper/render/base.js +43 -40
- package/src/helper/render/clear.js +96 -84
- package/src/helper/render/edge.js +59 -65
- package/src/helper/render/geometryHandler.js +166 -128
- package/src/helper/render/imageOverlay.js +157 -106
- package/src/helper/render/index.js +21 -3
- package/src/helper/render/loader.js +34 -34
- package/src/helper/render/mapProjection.js +88 -74
- package/src/helper/render/margin.js +46 -50
- package/src/helper/render/moduleField.js +26 -24
- package/src/helper/render/node.js +43 -43
- package/src/helper/render/obstacle.js +50 -48
- package/src/helper/render/panel.js +85 -79
- package/src/helper/render/projectionMaterial.js +58 -50
- package/src/helper/render/roof.js +136 -133
- package/src/helper/render/texture.js +17 -17
- package/src/helper/render/tile.js +291 -0
- package/src/helper/renderMixin.js +30 -37
- package/src/helper/threeMixin.js +40 -101
- package/src/main.js +22 -18
- package/src/store/AddMargin.js +87 -83
- package/src/store/hydrateData.js +40 -30
- package/src/store/nodesEdgesCreation.js +177 -160
- package/src/store/three-d-module.js +41 -27
- package/src/utils/cancellablePromise.js +23 -0
- package/.eslintrc.json +0 -18
- package/src/helper/geo-three.module.js +0 -1903
|
@@ -15,7 +15,7 @@ export function getTriangleVerticesFromOutline(
|
|
|
15
15
|
polygonOutline,
|
|
16
16
|
holesOutlines = []
|
|
17
17
|
) {
|
|
18
|
-
if(polygonOutline.length==0){
|
|
18
|
+
if (polygonOutline.length == 0) {
|
|
19
19
|
return new Float32Array([])
|
|
20
20
|
}
|
|
21
21
|
var dataVertices = polygonOutline
|
|
@@ -24,25 +24,26 @@ export function getTriangleVerticesFromOutline(
|
|
|
24
24
|
})
|
|
25
25
|
.flat()
|
|
26
26
|
let holesStartingIndexes = []
|
|
27
|
-
let holesVertices=[]
|
|
27
|
+
let holesVertices = []
|
|
28
28
|
//we group building and wall vertices and give the starting index of each obstacles.
|
|
29
29
|
if (holesOutlines.length > 0) {
|
|
30
|
-
const HoleIndexOffset =
|
|
30
|
+
const HoleIndexOffset = dataVertices.length / 3 + 1
|
|
31
31
|
holesStartingIndexes.push(HoleIndexOffset)
|
|
32
|
-
let lastIndex=HoleIndexOffset
|
|
33
|
-
for(let k=0;k<holesOutlines.length-1;k++){
|
|
34
|
-
let newIndex=lastIndex+
|
|
32
|
+
let lastIndex = HoleIndexOffset
|
|
33
|
+
for (let k = 0; k < holesOutlines.length - 1; k++) {
|
|
34
|
+
let newIndex = lastIndex + holesOutlines[k].length
|
|
35
35
|
holesStartingIndexes.push(newIndex)
|
|
36
|
-
lastIndex=newIndex
|
|
36
|
+
lastIndex = newIndex
|
|
37
37
|
}
|
|
38
|
-
holesStartingIndexes=[...new Set(holesStartingIndexes)]
|
|
38
|
+
holesStartingIndexes = [...new Set(holesStartingIndexes)]
|
|
39
39
|
holesVertices = holesOutlines
|
|
40
40
|
.map((holeOutline) => {
|
|
41
41
|
return holeOutline.map((p) => {
|
|
42
42
|
return [p.x / 1000, p.y / 1000, p.z / 1000]
|
|
43
43
|
})
|
|
44
44
|
})
|
|
45
|
-
.flat()
|
|
45
|
+
.flat()
|
|
46
|
+
.flat()
|
|
46
47
|
}
|
|
47
48
|
let lastPoint = polygonOutline[polygonOutline.length - 1]
|
|
48
49
|
let lastVertex = [lastPoint.x / 1000, lastPoint.y / 1000, lastPoint.z / 1000]
|
|
@@ -50,9 +51,9 @@ export function getTriangleVerticesFromOutline(
|
|
|
50
51
|
dataVertices.push(...holesVertices)
|
|
51
52
|
|
|
52
53
|
var triangles = []
|
|
53
|
-
try{
|
|
54
|
-
triangles=earcut(dataVertices, holesStartingIndexes, 3)
|
|
55
|
-
}catch(err){
|
|
54
|
+
try {
|
|
55
|
+
triangles = earcut(dataVertices, holesStartingIndexes, 3)
|
|
56
|
+
} catch (err) {
|
|
56
57
|
console.error(err)
|
|
57
58
|
}
|
|
58
59
|
const triangleVertices = []
|
|
@@ -65,45 +66,61 @@ export function getTriangleVerticesFromOutline(
|
|
|
65
66
|
})
|
|
66
67
|
return triangleVertices
|
|
67
68
|
}
|
|
68
|
-
export function updateBufferRoofGeometry(
|
|
69
|
+
export function updateBufferRoofGeometry(
|
|
70
|
+
polygonOutline,
|
|
71
|
+
holesOutline = [],
|
|
72
|
+
geometry
|
|
73
|
+
) {
|
|
69
74
|
//Calcul of triangles using cutear algo
|
|
70
|
-
const triangleVertices = getTriangleVerticesFromOutline(
|
|
71
|
-
|
|
75
|
+
const triangleVertices = getTriangleVerticesFromOutline(
|
|
76
|
+
polygonOutline,
|
|
77
|
+
holesOutline
|
|
78
|
+
)
|
|
79
|
+
if (hasNaN(triangleVertices)) {
|
|
80
|
+
return null
|
|
81
|
+
}
|
|
72
82
|
const vertices = new Float32Array(triangleVertices)
|
|
73
83
|
// itemSize = 3 because there are 3 values (components) per vertex
|
|
74
|
-
if(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
84
|
+
if (
|
|
85
|
+
geometry.attributes.position &&
|
|
86
|
+
geometry.attributes.position.array.length >= vertices.length
|
|
87
|
+
) {
|
|
88
|
+
let positions = geometry.attributes.position.array
|
|
89
|
+
for (let k in vertices) {
|
|
90
|
+
positions[k] = vertices[k]
|
|
78
91
|
}
|
|
79
|
-
|
|
80
|
-
}else{
|
|
92
|
+
} else {
|
|
81
93
|
geometry.dispose()
|
|
82
|
-
geometry=null
|
|
83
|
-
geometry = new THREE.BufferGeometry()
|
|
84
|
-
geometry.setAttribute(
|
|
94
|
+
geometry = null
|
|
95
|
+
geometry = new THREE.BufferGeometry()
|
|
96
|
+
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
85
97
|
}
|
|
86
|
-
geometry.setDrawRange(
|
|
98
|
+
geometry.setDrawRange(0, vertices.length / 3)
|
|
87
99
|
geometry.computeVertexNormals()
|
|
88
|
-
geometry.attributes.position.needsUpdate = true
|
|
100
|
+
geometry.attributes.position.needsUpdate = true
|
|
89
101
|
return geometry
|
|
90
102
|
}
|
|
91
103
|
|
|
92
|
-
export function getBufferRoofGeometry(polygonOutline,holesOutline=[]) {
|
|
93
|
-
const geometry = new THREE.BufferGeometry()
|
|
104
|
+
export function getBufferRoofGeometry(polygonOutline, holesOutline = []) {
|
|
105
|
+
const geometry = new THREE.BufferGeometry()
|
|
94
106
|
//Calcul of triangles using cutear algo
|
|
95
|
-
const triangleVertices = getTriangleVerticesFromOutline(
|
|
96
|
-
|
|
107
|
+
const triangleVertices = getTriangleVerticesFromOutline(
|
|
108
|
+
polygonOutline,
|
|
109
|
+
holesOutline
|
|
110
|
+
)
|
|
111
|
+
if (hasNaN(triangleVertices)) {
|
|
112
|
+
return null
|
|
113
|
+
}
|
|
97
114
|
const vertices = new Float32Array(triangleVertices)
|
|
98
115
|
// itemSize = 3 because there are 3 values (components) per vertex
|
|
116
|
+
var uvs = new Float32Array([1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0])
|
|
99
117
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
118
|
+
geometry.setAttribute('uv', new THREE.BufferAttribute(uvs, 2))
|
|
100
119
|
geometry.computeVertexNormals()
|
|
101
120
|
return geometry
|
|
102
121
|
}
|
|
103
122
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
export function getWallVertices(polygon){
|
|
123
|
+
export function getWallVertices(polygon) {
|
|
107
124
|
const length = polygon.outline.length
|
|
108
125
|
const trianglesVertices = []
|
|
109
126
|
polygon.outline.forEach((p_up_0, index) => {
|
|
@@ -134,13 +151,18 @@ export function getWallVertices(polygon){
|
|
|
134
151
|
]
|
|
135
152
|
)
|
|
136
153
|
})
|
|
137
|
-
|
|
138
|
-
polygon.holes.forEach((hole)=>{
|
|
139
|
-
let obstacleWallOutline=
|
|
140
|
-
|
|
154
|
+
|
|
155
|
+
polygon.holes.forEach((hole) => {
|
|
156
|
+
let obstacleWallOutline =
|
|
157
|
+
intersectOutlines(hole.outline, polygon.outline)[0] || []
|
|
158
|
+
obstacleWallOutline = obstacleWallOutline.map((p) => {
|
|
141
159
|
return {
|
|
142
160
|
...p,
|
|
143
|
-
z:verticalProjectionOnPlane(
|
|
161
|
+
z: verticalProjectionOnPlane(
|
|
162
|
+
p,
|
|
163
|
+
polygon.normalVector,
|
|
164
|
+
polygon.flatOutline[0]
|
|
165
|
+
).z
|
|
144
166
|
}
|
|
145
167
|
})
|
|
146
168
|
const lengthHole = obstacleWallOutline.length
|
|
@@ -173,52 +195,59 @@ export function getWallVertices(polygon){
|
|
|
173
195
|
)
|
|
174
196
|
})
|
|
175
197
|
})
|
|
176
|
-
if(hasNaN(trianglesVertices)){
|
|
198
|
+
if (hasNaN(trianglesVertices)) {
|
|
199
|
+
return null
|
|
200
|
+
}
|
|
177
201
|
const vertices = new Float32Array(trianglesVertices)
|
|
178
202
|
return vertices
|
|
179
203
|
}
|
|
180
|
-
export function updateBufferWallGeometry(polygon,geometry) {
|
|
204
|
+
export function updateBufferWallGeometry(polygon, geometry) {
|
|
181
205
|
//geometry = new THREE.BufferGeometry()
|
|
182
206
|
//Calcul of triangles using cutear algo
|
|
183
|
-
const vertices=getWallVertices(polygon)
|
|
207
|
+
const vertices = getWallVertices(polygon)
|
|
184
208
|
// itemSize = 3 because there are 3 values (components) per vertex
|
|
185
|
-
|
|
186
|
-
if(
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
209
|
+
|
|
210
|
+
if (
|
|
211
|
+
geometry.attributes.position &&
|
|
212
|
+
geometry.attributes.position.array.length >= vertices.length
|
|
213
|
+
) {
|
|
214
|
+
let positions = geometry.attributes.position.array
|
|
215
|
+
for (let k in vertices) {
|
|
216
|
+
positions[k] = vertices[k]
|
|
190
217
|
}
|
|
191
|
-
geometry.setDrawRange(
|
|
192
|
-
}else{
|
|
218
|
+
geometry.setDrawRange(0, vertices.length / 3)
|
|
219
|
+
} else {
|
|
193
220
|
geometry.dispose()
|
|
194
|
-
geometry=null
|
|
195
|
-
geometry = new THREE.BufferGeometry()
|
|
196
|
-
geometry.setAttribute(
|
|
221
|
+
geometry = null
|
|
222
|
+
geometry = new THREE.BufferGeometry()
|
|
223
|
+
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
197
224
|
}
|
|
198
225
|
geometry.computeVertexNormals()
|
|
199
|
-
geometry.attributes.position.needsUpdate = true
|
|
226
|
+
geometry.attributes.position.needsUpdate = true
|
|
200
227
|
return geometry
|
|
201
228
|
}
|
|
202
229
|
|
|
203
230
|
export function getBufferWallGeometry(polygon) {
|
|
204
231
|
const geometry = new THREE.BufferGeometry()
|
|
205
232
|
//Calcul of triangles using cutear algo
|
|
206
|
-
const vertices=getWallVertices(polygon)
|
|
233
|
+
const vertices = getWallVertices(polygon)
|
|
207
234
|
// itemSize = 3 because there are 3 values (components) per vertex
|
|
208
235
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
209
236
|
geometry.computeVertexNormals()
|
|
210
|
-
|
|
237
|
+
|
|
211
238
|
return geometry
|
|
212
239
|
}
|
|
213
240
|
|
|
214
241
|
export function getBufferObstacleGeometry(obstaclePolygon, roofPolygon) {
|
|
215
|
-
let obstacleHeight
|
|
216
|
-
if(obstaclePolygon.isParallel){
|
|
242
|
+
let obstacleHeight
|
|
243
|
+
if (obstaclePolygon.isParallel) {
|
|
217
244
|
obstacleHeight = parseInt(obstaclePolygon.height || 0)
|
|
218
|
-
}else{
|
|
219
|
-
obstacleHeight = parseInt(
|
|
245
|
+
} else {
|
|
246
|
+
obstacleHeight = parseInt(
|
|
247
|
+
obstaclePolygon.heightReference + obstaclePolygon.height || 0
|
|
248
|
+
)
|
|
220
249
|
}
|
|
221
|
-
|
|
250
|
+
|
|
222
251
|
//get lowest verticalProjection
|
|
223
252
|
const normalVector = roofPolygon.normalVector
|
|
224
253
|
const passByPoint = roofPolygon.flatOutline[0]
|
|
@@ -232,8 +261,9 @@ export function getBufferObstacleGeometry(obstaclePolygon, roofPolygon) {
|
|
|
232
261
|
const topHeight = obstacleHeight
|
|
233
262
|
|
|
234
263
|
const geometry = new THREE.BufferGeometry()
|
|
235
|
-
const cropedHoleOutline=
|
|
236
|
-
|
|
264
|
+
const cropedHoleOutline =
|
|
265
|
+
intersectOutlines(obstaclePolygon.outline, roofPolygon.outline)[0] || []
|
|
266
|
+
|
|
237
267
|
//Calcul of triangles using cutear algo
|
|
238
268
|
const trianglesVertices = []
|
|
239
269
|
const obstacleOutlineTop = []
|
|
@@ -255,7 +285,9 @@ export function getBufferObstacleGeometry(obstaclePolygon, roofPolygon) {
|
|
|
255
285
|
})
|
|
256
286
|
trianglesVertices.push(...getTriangleVerticesFromOutline(obstacleOutlineTop))
|
|
257
287
|
|
|
258
|
-
if(hasNaN(trianglesVertices)){
|
|
288
|
+
if (hasNaN(trianglesVertices)) {
|
|
289
|
+
return null
|
|
290
|
+
}
|
|
259
291
|
const vertices = new Float32Array(trianglesVertices)
|
|
260
292
|
// itemSize = 3 because there are 3 values (components) per vertex
|
|
261
293
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
@@ -264,13 +296,15 @@ export function getBufferObstacleGeometry(obstaclePolygon, roofPolygon) {
|
|
|
264
296
|
}
|
|
265
297
|
|
|
266
298
|
export function getBufferObstacleSideGeometry(obstaclePolygon, roofPolygon) {
|
|
267
|
-
let obstacleHeight
|
|
268
|
-
if(obstaclePolygon.isParallel){
|
|
299
|
+
let obstacleHeight
|
|
300
|
+
if (obstaclePolygon.isParallel) {
|
|
269
301
|
obstacleHeight = parseInt(obstaclePolygon.height || 0)
|
|
270
|
-
}else{
|
|
271
|
-
obstacleHeight = parseInt(
|
|
302
|
+
} else {
|
|
303
|
+
obstacleHeight = parseInt(
|
|
304
|
+
obstaclePolygon.heightReference + obstaclePolygon.height || 0
|
|
305
|
+
)
|
|
272
306
|
}
|
|
273
|
-
|
|
307
|
+
|
|
274
308
|
const normalVector = roofPolygon.normalVector
|
|
275
309
|
const passByPoint = roofPolygon.flatOutline[0]
|
|
276
310
|
|
|
@@ -283,7 +317,8 @@ export function getBufferObstacleSideGeometry(obstaclePolygon, roofPolygon) {
|
|
|
283
317
|
const topHeight = obstacleHeight
|
|
284
318
|
|
|
285
319
|
const geometry = new THREE.BufferGeometry()
|
|
286
|
-
const cropedHoleOutline=
|
|
320
|
+
const cropedHoleOutline =
|
|
321
|
+
intersectOutlines(obstaclePolygon.outline, roofPolygon.outline)[0] || []
|
|
287
322
|
//Calcul of triangles using cutear algo
|
|
288
323
|
const obstacleLength = cropedHoleOutline.length
|
|
289
324
|
const trianglesVertices = []
|
|
@@ -334,7 +369,9 @@ export function getBufferObstacleSideGeometry(obstaclePolygon, roofPolygon) {
|
|
|
334
369
|
)
|
|
335
370
|
})
|
|
336
371
|
|
|
337
|
-
if(hasNaN(trianglesVertices)){
|
|
372
|
+
if (hasNaN(trianglesVertices)) {
|
|
373
|
+
return null
|
|
374
|
+
}
|
|
338
375
|
const vertices = new Float32Array(trianglesVertices)
|
|
339
376
|
// itemSize = 3 because there are 3 values (components) per vertex
|
|
340
377
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
@@ -360,7 +397,9 @@ export function getBufferModuleFieldGeometry(moduleFieldPolygon) {
|
|
|
360
397
|
trianglesVertices.push(
|
|
361
398
|
...getTriangleVerticesFromOutline(moduleFieldOutlineTop)
|
|
362
399
|
)
|
|
363
|
-
if(hasNaN(trianglesVertices)){
|
|
400
|
+
if (hasNaN(trianglesVertices)) {
|
|
401
|
+
return null
|
|
402
|
+
}
|
|
364
403
|
const vertices = new Float32Array(trianglesVertices)
|
|
365
404
|
var uvs = new Float32Array([
|
|
366
405
|
1, 1, 0, 1, 0, 0,
|
|
@@ -375,8 +414,8 @@ export function getBufferModuleFieldGeometry(moduleFieldPolygon) {
|
|
|
375
414
|
return geometry
|
|
376
415
|
}
|
|
377
416
|
|
|
378
|
-
export function getBufferImageOverlayGeometry(corners){
|
|
379
|
-
corners.forEach(p=>p.z=0)
|
|
417
|
+
export function getBufferImageOverlayGeometry(corners) {
|
|
418
|
+
corners.forEach((p) => (p.z = 0))
|
|
380
419
|
let normalVector = getNormalVectorFrom3Points(
|
|
381
420
|
corners[0],
|
|
382
421
|
corners[1],
|
|
@@ -390,7 +429,9 @@ export function getBufferImageOverlayGeometry(corners){
|
|
|
390
429
|
//Calcul of triangles using cutear algo
|
|
391
430
|
const trianglesVertices = []
|
|
392
431
|
trianglesVertices.push(...getTriangleVerticesFromOutline(corners))
|
|
393
|
-
if(hasNaN(trianglesVertices)){
|
|
432
|
+
if (hasNaN(trianglesVertices)) {
|
|
433
|
+
return null
|
|
434
|
+
}
|
|
394
435
|
const vertices = new Float32Array(trianglesVertices)
|
|
395
436
|
var A = corners[2]
|
|
396
437
|
var B = corners[3]
|
|
@@ -401,23 +442,15 @@ export function getBufferImageOverlayGeometry(corners){
|
|
|
401
442
|
let uvs
|
|
402
443
|
if (AB < AC) {
|
|
403
444
|
uvs = new Float32Array([
|
|
404
|
-
0, 1,
|
|
405
|
-
0, 0,
|
|
406
|
-
1, 0,
|
|
445
|
+
0, 1, 0, 0, 1, 0,
|
|
407
446
|
|
|
408
|
-
0, 1,
|
|
409
|
-
1, 0,
|
|
410
|
-
1, 1
|
|
447
|
+
0, 1, 1, 0, 1, 1
|
|
411
448
|
])
|
|
412
|
-
}else{
|
|
449
|
+
} else {
|
|
413
450
|
uvs = new Float32Array([
|
|
414
|
-
0, 0,
|
|
415
|
-
|
|
416
|
-
1, 1,
|
|
417
|
-
|
|
418
|
-
1, 0,
|
|
419
|
-
0, 1,
|
|
420
|
-
1, 1
|
|
451
|
+
0, 0, 1, 0, 1, 1,
|
|
452
|
+
|
|
453
|
+
1, 0, 0, 1, 1, 1
|
|
421
454
|
])
|
|
422
455
|
}
|
|
423
456
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
@@ -449,7 +482,9 @@ export function getBufferPanelGeometry(panelPolygon) {
|
|
|
449
482
|
})
|
|
450
483
|
trianglesVertices.push(...getTriangleVerticesFromOutline(panelOutlineTop))
|
|
451
484
|
|
|
452
|
-
if(hasNaN(trianglesVertices)){
|
|
485
|
+
if (hasNaN(trianglesVertices)) {
|
|
486
|
+
return null
|
|
487
|
+
}
|
|
453
488
|
const vertices = new Float32Array(trianglesVertices)
|
|
454
489
|
var A = panelPolygon.outline[2]
|
|
455
490
|
var B = panelPolygon.outline[3]
|
|
@@ -460,23 +495,15 @@ export function getBufferPanelGeometry(panelPolygon) {
|
|
|
460
495
|
let uvs
|
|
461
496
|
if (AB < AC) {
|
|
462
497
|
uvs = new Float32Array([
|
|
463
|
-
0, 1,
|
|
464
|
-
0, 0,
|
|
465
|
-
1, 0,
|
|
498
|
+
0, 1, 0, 0, 1, 0,
|
|
466
499
|
|
|
467
|
-
0, 1,
|
|
468
|
-
1, 0,
|
|
469
|
-
1, 1
|
|
500
|
+
0, 1, 1, 0, 1, 1
|
|
470
501
|
])
|
|
471
|
-
}else{
|
|
502
|
+
} else {
|
|
472
503
|
uvs = new Float32Array([
|
|
473
|
-
0, 0,
|
|
474
|
-
|
|
475
|
-
1, 1,
|
|
476
|
-
|
|
477
|
-
1, 0,
|
|
478
|
-
0, 1,
|
|
479
|
-
1, 1
|
|
504
|
+
0, 0, 1, 0, 1, 1,
|
|
505
|
+
|
|
506
|
+
1, 0, 0, 1, 1, 1
|
|
480
507
|
])
|
|
481
508
|
}
|
|
482
509
|
|
|
@@ -486,13 +513,13 @@ export function getBufferPanelGeometry(panelPolygon) {
|
|
|
486
513
|
geometry.computeVertexNormals()
|
|
487
514
|
return geometry
|
|
488
515
|
}
|
|
489
|
-
export function updateBufferPanelGeometry(panelPolygon,geometry){
|
|
490
|
-
geometry=updateBufferRoofGeometry(panelPolygon.outline,[],geometry)
|
|
516
|
+
export function updateBufferPanelGeometry(panelPolygon, geometry) {
|
|
517
|
+
geometry = updateBufferRoofGeometry(panelPolygon.outline, [], geometry)
|
|
491
518
|
return geometry
|
|
492
519
|
}
|
|
493
520
|
|
|
494
|
-
export function updateBufferPanelSideGeometry(panelPolygon,geometry){
|
|
495
|
-
geometry=updateBufferRoofGeometry(panelPolygon.outline,[],geometry)
|
|
521
|
+
export function updateBufferPanelSideGeometry(panelPolygon, geometry) {
|
|
522
|
+
geometry = updateBufferRoofGeometry(panelPolygon.outline, [], geometry)
|
|
496
523
|
return geometry
|
|
497
524
|
}
|
|
498
525
|
export function getBufferPanelSideGeometry(panelPolygon) {
|
|
@@ -544,8 +571,10 @@ export function getBufferPanelSideGeometry(panelPolygon) {
|
|
|
544
571
|
]
|
|
545
572
|
)
|
|
546
573
|
})
|
|
547
|
-
if(hasNaN(trianglesVertices)){
|
|
548
|
-
|
|
574
|
+
if (hasNaN(trianglesVertices)) {
|
|
575
|
+
return null
|
|
576
|
+
}
|
|
577
|
+
|
|
549
578
|
const vertices = new Float32Array(trianglesVertices)
|
|
550
579
|
|
|
551
580
|
// itemSize = 3 because there are 3 values (components) per vertex
|
|
@@ -554,43 +583,52 @@ export function getBufferPanelSideGeometry(panelPolygon) {
|
|
|
554
583
|
return geometry
|
|
555
584
|
}
|
|
556
585
|
|
|
557
|
-
export function getBufferRoofMarginGeometry(polygon,roofPolygon=null) {
|
|
586
|
+
export function getBufferRoofMarginGeometry(polygon, roofPolygon = null) {
|
|
558
587
|
const geometries = []
|
|
559
588
|
const length = polygon.margins.innerOutline.length
|
|
560
|
-
|
|
589
|
+
|
|
561
590
|
polygon.margins.innerOutline.forEach((K, index) => {
|
|
562
591
|
//check if distance ==0 then margin not displayed
|
|
563
592
|
let geometry
|
|
564
|
-
const distance=polygon.margins.isSameMargin
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
593
|
+
const distance = polygon.margins.isSameMargin
|
|
594
|
+
? polygon.margins.sameMargin
|
|
595
|
+
: polygon.margins.distances[index]
|
|
596
|
+
if (distance <= 0) {
|
|
597
|
+
geometry = null
|
|
598
|
+
} else {
|
|
568
599
|
const A = polygon.margins.outterOutline[index]
|
|
569
600
|
const B = polygon.margins.outterOutline[(index + 1) % length]
|
|
570
601
|
const J = polygon.margins.innerOutline[(index + 1) % length]
|
|
571
602
|
|
|
572
|
-
let marginOutline=[A,B,J,K]
|
|
573
|
-
if(roofPolygon){
|
|
574
|
-
marginOutline=
|
|
575
|
-
|
|
603
|
+
let marginOutline = [A, B, J, K]
|
|
604
|
+
if (roofPolygon) {
|
|
605
|
+
marginOutline =
|
|
606
|
+
intersectOutlines(marginOutline, roofPolygon.flatOutline)[0] || []
|
|
607
|
+
marginOutline = marginOutline.map((p) => {
|
|
576
608
|
return {
|
|
577
|
-
x:p.x,
|
|
578
|
-
y:p.y,
|
|
579
|
-
z:verticalProjectionOnPlane(
|
|
609
|
+
x: p.x,
|
|
610
|
+
y: p.y,
|
|
611
|
+
z: verticalProjectionOnPlane(
|
|
612
|
+
p,
|
|
613
|
+
roofPolygon.normalVector,
|
|
614
|
+
roofPolygon.flatOutline[0]
|
|
615
|
+
).z
|
|
580
616
|
}
|
|
581
617
|
})
|
|
582
618
|
}
|
|
583
|
-
marginOutline=marginOutline.map(p=>
|
|
619
|
+
marginOutline = marginOutline.map((p) => {
|
|
620
|
+
return { x: p.x, y: p.y, z: p.z + 10 }
|
|
621
|
+
})
|
|
584
622
|
geometry = new THREE.BufferGeometry()
|
|
585
623
|
|
|
586
624
|
const trianglesVertices = []
|
|
587
|
-
|
|
588
|
-
trianglesVertices.push(
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
625
|
+
|
|
626
|
+
trianglesVertices.push(...getTriangleVerticesFromOutline(marginOutline))
|
|
627
|
+
if (hasNaN(trianglesVertices)) {
|
|
628
|
+
return null
|
|
629
|
+
}
|
|
592
630
|
const vertices = new Float32Array(trianglesVertices)
|
|
593
|
-
|
|
631
|
+
|
|
594
632
|
geometry.setAttribute('position', new THREE.BufferAttribute(vertices, 3))
|
|
595
633
|
geometry.computeVertexNormals()
|
|
596
634
|
}
|