@equinor/videx-3d 3.0.0 → 3.2.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/{chunk-DKAquGKk.js → chunk-r8Ybij6M.js} +331 -316
- package/dist/generators.js +147 -147
- package/dist/main.js +1950 -1685
- package/dist/sdk.js +2 -2
- package/dist/src/sdk/materials/shaderLib/procedural-normal.glsl +274 -0
- package/dist/types/components/Distance/Bounds.d.ts +37 -0
- package/dist/types/components/Distance/Distance.d.ts +22 -11
- package/dist/types/components/Distance/index.d.ts +1 -0
- package/dist/types/components/Wellbores/Casings/CasingMaterial.d.ts +229 -1
- package/dist/types/components/Wellbores/Casings/CasingSection.d.ts +6 -1
- package/dist/types/components/Wellbores/Casings/Casings.d.ts +45 -4
- package/dist/types/components/Wellbores/Casings/casings-defs.d.ts +44 -0
- package/dist/types/components/Wellbores/Casings/index.d.ts +2 -1
- package/dist/types/sdk/utils/vector-operations.d.ts +25 -0
- package/package.json +4 -10
|
@@ -3,9 +3,9 @@ import { wrap as te } from "comlink";
|
|
|
3
3
|
import ne from "p-limit";
|
|
4
4
|
import { CurveInterpolator as P, EPS as F } from "curve-interpolator";
|
|
5
5
|
import { lerp as I } from "three/src/math/MathUtils.js";
|
|
6
|
-
import
|
|
6
|
+
import re from "proj4";
|
|
7
7
|
//#region src/sdk/data/DataLoader.ts
|
|
8
|
-
var
|
|
8
|
+
var L = 10, ie = 25, ae = class {
|
|
9
9
|
store;
|
|
10
10
|
config;
|
|
11
11
|
cached = /* @__PURE__ */ new Map();
|
|
@@ -13,7 +13,7 @@ var R = 10, re = 25, ie = class {
|
|
|
13
13
|
_batchqueue = /* @__PURE__ */ new Map();
|
|
14
14
|
_flushScheduled = null;
|
|
15
15
|
constructor(e, t = {}) {
|
|
16
|
-
this.store = e, this.config = { ...t }, this.config.batched && (this.config.batchSize === void 0 && (this.config.batchSize =
|
|
16
|
+
this.store = e, this.config = { ...t }, this.config.batched && (this.config.batchSize === void 0 && (this.config.batchSize = L), this.config.batchMaxDelay === void 0 && (this.config.batchMaxDelay = ie)), this._flushScheduled = null;
|
|
17
17
|
}
|
|
18
18
|
async init(...e) {
|
|
19
19
|
if (this.config.init) try {
|
|
@@ -94,7 +94,7 @@ var R = 10, re = 25, ie = class {
|
|
|
94
94
|
clear() {
|
|
95
95
|
this.cached.clear();
|
|
96
96
|
}
|
|
97
|
-
},
|
|
97
|
+
}, oe = class {
|
|
98
98
|
store = null;
|
|
99
99
|
config;
|
|
100
100
|
generators = /* @__PURE__ */ new Map();
|
|
@@ -129,13 +129,13 @@ var R = 10, re = 25, ie = class {
|
|
|
129
129
|
};
|
|
130
130
|
//#endregion
|
|
131
131
|
//#region src/sdk/data/helpers/formations-helpers.ts
|
|
132
|
-
async function
|
|
132
|
+
async function se(e, t, n, r) {
|
|
133
133
|
let i = await n.get("formations", e) || [];
|
|
134
134
|
r = r === void 0 ? -Infinity : r;
|
|
135
135
|
let a = i.filter((e) => e.stratColumnId === t && e.exit.mdMsl > r);
|
|
136
136
|
return a.sort((e, t) => e.entry.mdMsl - t.entry.mdMsl || e.level - t.level), a.length && a[0].entry.mdMsl < r && (a[0].entry.mdMsl = r), a;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function ce(e, t, n) {
|
|
139
139
|
return {
|
|
140
140
|
mdMslFrom: t,
|
|
141
141
|
mdMslTo: n,
|
|
@@ -145,7 +145,7 @@ function se(e, t, n) {
|
|
|
145
145
|
properties: { ...e.properties || {} }
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function le(e) {
|
|
149
149
|
if (!e.length) return [];
|
|
150
150
|
let t = [], n = [...e].sort((e, t) => {
|
|
151
151
|
let n = t.level - e.level || e.entry.mdMsl - t.entry.mdMsl;
|
|
@@ -161,15 +161,15 @@ function ce(e) {
|
|
|
161
161
|
let n = t[e];
|
|
162
162
|
if (i < n.mdMslFrom) {
|
|
163
163
|
let e = Math.min(r.exit.mdMsl, n.mdMslFrom);
|
|
164
|
-
a.push(
|
|
164
|
+
a.push(ce(r, i, e));
|
|
165
165
|
}
|
|
166
166
|
i = Math.max(i, n.mdMslTo);
|
|
167
167
|
}
|
|
168
|
-
i < r.exit.mdMsl && a.push(
|
|
168
|
+
i < r.exit.mdMsl && a.push(ce(r, i, r.exit.mdMsl)), t = a.sort((e, t) => e.mdMslFrom - t.mdMslFrom);
|
|
169
169
|
}
|
|
170
170
|
return t;
|
|
171
171
|
}
|
|
172
|
-
function
|
|
172
|
+
function ue(e) {
|
|
173
173
|
let t = [], n = [...e].sort((e, t) => e.entry.mdMsl - t.entry.mdMsl || t.level - e.level), r = null, i = -Infinity;
|
|
174
174
|
for (let e = 0; e < n.length; e++) {
|
|
175
175
|
let a = n[e];
|
|
@@ -200,7 +200,7 @@ function le(e) {
|
|
|
200
200
|
}
|
|
201
201
|
//#endregion
|
|
202
202
|
//#region src/sdk/data/helpers/well-helpers.ts
|
|
203
|
-
function
|
|
203
|
+
function de(e, t, n) {
|
|
204
204
|
let r = /* @__PURE__ */ new Map(), i = {};
|
|
205
205
|
t.sort((e, t) => e.id === n ? -1 : t.id === n ? 1 : e.drilled && t.drilled ? t.drilled.getTime() - e.drilled.getTime() : e.name.localeCompare(t.name));
|
|
206
206
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -227,7 +227,7 @@ function ue(e, t, n) {
|
|
|
227
227
|
}
|
|
228
228
|
//#endregion
|
|
229
229
|
//#region src/sdk/geometries/boundary-loops.ts
|
|
230
|
-
function
|
|
230
|
+
function fe(e) {
|
|
231
231
|
let t = e.getIndex(), n = e.getAttribute("position");
|
|
232
232
|
if (!t || !n) return [];
|
|
233
233
|
let r = t.array, i = n.count, a = (e, t) => e < t ? e * i + t : t * i + e, o = [
|
|
@@ -271,7 +271,7 @@ function de(e) {
|
|
|
271
271
|
}
|
|
272
272
|
return d;
|
|
273
273
|
}
|
|
274
|
-
function
|
|
274
|
+
function pe(e, t, n) {
|
|
275
275
|
let r = e.getAttribute("position");
|
|
276
276
|
if (r) {
|
|
277
277
|
for (let e of t) {
|
|
@@ -297,10 +297,10 @@ function fe(e, t, n) {
|
|
|
297
297
|
r.needsUpdate = !0;
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function me(e, t, n) {
|
|
301
301
|
let r = e.getAttribute("position");
|
|
302
302
|
if (!r) return;
|
|
303
|
-
let i =
|
|
303
|
+
let i = fe(e), a = /* @__PURE__ */ new Set();
|
|
304
304
|
for (let e of i) for (let i of e) {
|
|
305
305
|
if (a.has(i)) continue;
|
|
306
306
|
a.add(i);
|
|
@@ -317,19 +317,19 @@ function pe(e, t, n) {
|
|
|
317
317
|
}
|
|
318
318
|
//#endregion
|
|
319
319
|
//#region src/sdk/utils/numbers.ts
|
|
320
|
-
function
|
|
320
|
+
function R(e, t = 0, n = 1) {
|
|
321
321
|
return e < t ? t : e > n ? n : e;
|
|
322
322
|
}
|
|
323
|
-
function me(e, t, n) {
|
|
324
|
-
return n = z(n, 0, 1), (1 - n) * e + n * t;
|
|
325
|
-
}
|
|
326
323
|
function he(e, t, n) {
|
|
324
|
+
return n = R(n, 0, 1), (1 - n) * e + n * t;
|
|
325
|
+
}
|
|
326
|
+
function ge(e, t, n) {
|
|
327
327
|
return (e - t) / (n - t);
|
|
328
328
|
}
|
|
329
|
-
function
|
|
330
|
-
return
|
|
329
|
+
function _e(e, t, n, r, i) {
|
|
330
|
+
return he(r, i, ge(e, t, n));
|
|
331
331
|
}
|
|
332
|
-
var
|
|
332
|
+
var ve = (e) => {
|
|
333
333
|
if (e < 0) return [
|
|
334
334
|
0,
|
|
335
335
|
0,
|
|
@@ -342,10 +342,10 @@ var _e = (e) => {
|
|
|
342
342
|
r,
|
|
343
343
|
Math.floor(t) - n * 65536 - r * 256
|
|
344
344
|
];
|
|
345
|
-
},
|
|
346
|
-
function
|
|
347
|
-
for (; t < -Math.PI;) t +=
|
|
348
|
-
for (; t > Math.PI;) t -=
|
|
345
|
+
}, z = Math.PI, ye = 2 * Math.PI, be = Math.PI / 2, xe = Math.PI / 4, Se = Math.PI / 8;
|
|
346
|
+
function Ce(e, t, n) {
|
|
347
|
+
for (; t < -Math.PI;) t += ye;
|
|
348
|
+
for (; t > Math.PI;) t -= ye;
|
|
349
349
|
let r = Math.atan2(e[1], e[0]), i = Math.tan(t), a;
|
|
350
350
|
a = t > -r && t <= r ? 1 : t > r && t <= Math.PI - r ? 2 : t > Math.PI - r || t <= -(Math.PI - r) ? 3 : 4;
|
|
351
351
|
let o = n || [0, 0];
|
|
@@ -369,27 +369,27 @@ function Se(e, t, n) {
|
|
|
369
369
|
}
|
|
370
370
|
//#endregion
|
|
371
371
|
//#region src/sdk/utils/vector-operations.ts
|
|
372
|
-
function
|
|
372
|
+
function we(e) {
|
|
373
373
|
return e[0] = -e[0], e[1] = -e[1], e[2] = -e[2], e;
|
|
374
374
|
}
|
|
375
|
-
function
|
|
375
|
+
function Te(e, t) {
|
|
376
376
|
return [
|
|
377
377
|
e[t],
|
|
378
378
|
e[t + 1],
|
|
379
379
|
e[t + 2]
|
|
380
380
|
];
|
|
381
381
|
}
|
|
382
|
-
function
|
|
382
|
+
function Ee(e, t, n) {
|
|
383
383
|
e[t] = n[0], e[t + 1] = n[1], e[t + 2] = n[2];
|
|
384
384
|
}
|
|
385
|
-
function
|
|
385
|
+
function De(e, t) {
|
|
386
386
|
return [
|
|
387
387
|
e[0] + t[0],
|
|
388
388
|
e[1] + t[1],
|
|
389
389
|
e[2] + t[2]
|
|
390
390
|
];
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function B(e, t) {
|
|
393
393
|
return [
|
|
394
394
|
e[0] - t[0],
|
|
395
395
|
e[1] - t[1],
|
|
@@ -399,21 +399,21 @@ function De(e, t) {
|
|
|
399
399
|
function Oe(e, t) {
|
|
400
400
|
return e[0] *= t, e[1] *= t, e[2] *= t, e;
|
|
401
401
|
}
|
|
402
|
-
function
|
|
402
|
+
function V(e) {
|
|
403
403
|
let t = e[0] ** 2 + e[1] ** 2 + e[2] ** 2;
|
|
404
404
|
return t > 0 ? Math.sqrt(t) : 0;
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function H(e, t) {
|
|
407
407
|
return [
|
|
408
408
|
e[1] * t[2] - e[2] * t[1],
|
|
409
409
|
e[2] * t[0] - e[0] * t[2],
|
|
410
410
|
e[0] * t[1] - e[1] * t[0]
|
|
411
411
|
];
|
|
412
412
|
}
|
|
413
|
-
function
|
|
413
|
+
function ke(e, t) {
|
|
414
414
|
return e[0] * t[0] + e[1] * t[1] + e[2] * t[2];
|
|
415
415
|
}
|
|
416
|
-
function
|
|
416
|
+
function U(e) {
|
|
417
417
|
let t = Math.sqrt(e[0] * e[0] + e[1] * e[1] + e[2] * e[2]);
|
|
418
418
|
return t ? (e[0] /= t, e[1] /= t, e[2] /= t, e) : [
|
|
419
419
|
0,
|
|
@@ -421,7 +421,7 @@ function H(e) {
|
|
|
421
421
|
0
|
|
422
422
|
];
|
|
423
423
|
}
|
|
424
|
-
function
|
|
424
|
+
function Ae(e, t, n = .5) {
|
|
425
425
|
let r = 1 - n;
|
|
426
426
|
return [
|
|
427
427
|
e[0] * r + t[0] * n,
|
|
@@ -429,20 +429,20 @@ function je(e, t, n = .5) {
|
|
|
429
429
|
e[2] * r + t[2] * n
|
|
430
430
|
];
|
|
431
431
|
}
|
|
432
|
-
function
|
|
432
|
+
function je(e) {
|
|
433
433
|
return [
|
|
434
434
|
e[0],
|
|
435
435
|
e[1],
|
|
436
436
|
e[2]
|
|
437
437
|
];
|
|
438
438
|
}
|
|
439
|
-
function
|
|
439
|
+
function Me(e, t) {
|
|
440
440
|
let n = Math.sqrt((e[0] ** 2 + e[1] ** 2 + e[2] ** 2) * (t[0] ** 2 + t[1] ** 2 + t[2] ** 2));
|
|
441
|
-
if (n === 0) return
|
|
442
|
-
let r =
|
|
443
|
-
return Math.acos(
|
|
441
|
+
if (n === 0) return be;
|
|
442
|
+
let r = ke(e, t) / n;
|
|
443
|
+
return Math.acos(R(r, -1, 1));
|
|
444
444
|
}
|
|
445
|
-
function
|
|
445
|
+
function Ne(e, t = [
|
|
446
446
|
0,
|
|
447
447
|
1,
|
|
448
448
|
0
|
|
@@ -454,13 +454,28 @@ function Pe(e, t = [
|
|
|
454
454
|
(f * d - i * u) * o + (p * d + i * l) * s + (a * d * d + r) * c
|
|
455
455
|
];
|
|
456
456
|
}
|
|
457
|
+
function Pe(e, t) {
|
|
458
|
+
return U(B(t, e));
|
|
459
|
+
}
|
|
457
460
|
function Fe(e, t) {
|
|
458
|
-
|
|
461
|
+
if (t.sphere) {
|
|
462
|
+
let n = V(B(e, t.sphere.center)) - t.sphere.radius;
|
|
463
|
+
return n > 0 ? n : 0;
|
|
464
|
+
}
|
|
465
|
+
if (t.box) {
|
|
466
|
+
let [n, r] = t.box;
|
|
467
|
+
return V([
|
|
468
|
+
e[0] < n[0] ? n[0] - e[0] : Math.max(0, e[0] - r[0]),
|
|
469
|
+
e[1] < n[1] ? n[1] - e[1] : Math.max(0, e[1] - r[1]),
|
|
470
|
+
e[2] < n[2] ? n[2] - e[2] : Math.max(0, e[2] - r[2])
|
|
471
|
+
]);
|
|
472
|
+
}
|
|
473
|
+
return t.position ? V(B(e, t.position)) : Infinity;
|
|
459
474
|
}
|
|
460
475
|
function Ie(e, t) {
|
|
461
|
-
return
|
|
476
|
+
return V(B(t, e));
|
|
462
477
|
}
|
|
463
|
-
function
|
|
478
|
+
function W(e, t) {
|
|
464
479
|
return e === void 0 ? [t, t] : typeof e == "number" ? [e, e] : e;
|
|
465
480
|
}
|
|
466
481
|
function Le(e, t) {
|
|
@@ -499,12 +514,12 @@ function Ke(e, t, n = .5) {
|
|
|
499
514
|
function qe(e, t) {
|
|
500
515
|
return ze(Ve(t, e));
|
|
501
516
|
}
|
|
502
|
-
function
|
|
517
|
+
function Je(e, t) {
|
|
503
518
|
return Ge(Ve(t, e));
|
|
504
519
|
}
|
|
505
520
|
//#endregion
|
|
506
521
|
//#region src/sdk/geometries/curve/curve-3d.ts
|
|
507
|
-
function
|
|
522
|
+
function Ye(e, t = !1) {
|
|
508
523
|
let n = new P(e, {
|
|
509
524
|
alpha: 1,
|
|
510
525
|
tension: 0,
|
|
@@ -536,7 +551,7 @@ function Je(e, t = !1) {
|
|
|
536
551
|
closed: t
|
|
537
552
|
};
|
|
538
553
|
}
|
|
539
|
-
function
|
|
554
|
+
function Xe(e, t) {
|
|
540
555
|
let n = t.length, r = Array(n);
|
|
541
556
|
if (!r.length) return [];
|
|
542
557
|
t.forEach((t, n) => {
|
|
@@ -570,31 +585,31 @@ function Ye(e, t) {
|
|
|
570
585
|
0,
|
|
571
586
|
1
|
|
572
587
|
]);
|
|
573
|
-
let c = H(
|
|
574
|
-
r[0].normal =
|
|
588
|
+
let c = U(H(r[0].tangent, i));
|
|
589
|
+
r[0].normal = H(r[0].tangent, c), r[0].binormal = H(r[0].tangent, r[0].normal);
|
|
575
590
|
for (let e = 1; e < t.length; e++) {
|
|
576
|
-
if (c =
|
|
577
|
-
|
|
578
|
-
let t = Math.acos(
|
|
579
|
-
r[e].normal =
|
|
591
|
+
if (c = H(r[e - 1].tangent, r[e].tangent), r[e].normal = je(r[e - 1].normal), V(c) > F) {
|
|
592
|
+
U(c);
|
|
593
|
+
let t = Math.acos(R(ke(r[e - 1].tangent, r[e].tangent), -1, 1));
|
|
594
|
+
r[e].normal = Ne(r[e - 1].normal, c, t);
|
|
580
595
|
}
|
|
581
|
-
r[e].binormal =
|
|
596
|
+
r[e].binormal = H(r[e].tangent, r[e].normal);
|
|
582
597
|
}
|
|
583
598
|
return r;
|
|
584
599
|
}
|
|
585
|
-
function
|
|
600
|
+
function Ze(e, t = 0, n = 1, r = .1, i = 0) {
|
|
586
601
|
let a = [], o = e.length, s = Math.ceil(r * o), c = 1 / s, l = 1 / (o * .01);
|
|
587
602
|
i && (i *= .1), a.push(t);
|
|
588
603
|
let u = i ? e.getTangentAt(t) : null, d = Math.floor(t * s), f = t;
|
|
589
604
|
for (let r = d; r <= s; r++) {
|
|
590
605
|
let o = r * c, s = o - f, d = i ? e.getTangentAt(o) : null;
|
|
591
|
-
o > t && o < n && (s >= l || !i || Math.abs(
|
|
606
|
+
o > t && o < n && (s >= l || !i || Math.abs(ke(u, d)) < 1 - i) && (a.push(o), u = d, f = o);
|
|
592
607
|
}
|
|
593
608
|
return a.push(n), a;
|
|
594
609
|
}
|
|
595
610
|
//#endregion
|
|
596
611
|
//#region src/sdk/geometries/geometry.ts
|
|
597
|
-
function
|
|
612
|
+
function Qe(e, t) {
|
|
598
613
|
switch (t) {
|
|
599
614
|
case "Uint8Array": return new Uint8Array(e);
|
|
600
615
|
case "Uint16Array": return new Uint16Array(e);
|
|
@@ -607,7 +622,7 @@ function Ze(e, t) {
|
|
|
607
622
|
default: throw Error("Unsupported typed array!");
|
|
608
623
|
}
|
|
609
624
|
}
|
|
610
|
-
function
|
|
625
|
+
function $e(e, t = !1) {
|
|
611
626
|
if (!e.length) return null;
|
|
612
627
|
if (e.length === 1) return {
|
|
613
628
|
geometry: e[0],
|
|
@@ -658,15 +673,15 @@ function Qe(e, t = !1) {
|
|
|
658
673
|
groups: r
|
|
659
674
|
};
|
|
660
675
|
}
|
|
661
|
-
function
|
|
662
|
-
let i =
|
|
676
|
+
function et(e, r = !1) {
|
|
677
|
+
let i = $e(e, r);
|
|
663
678
|
if (!i) return null;
|
|
664
679
|
let { geometry: a, groups: o } = i, s = new n();
|
|
665
680
|
o && o.forEach((e) => {
|
|
666
681
|
s.addGroup(e[0], e[1], e[2]);
|
|
667
682
|
}), s.setAttribute("position", new t(Float32Array.from(a.positions), 3));
|
|
668
683
|
for (let e in a.attributes) {
|
|
669
|
-
let n = a.attributes[e], r =
|
|
684
|
+
let n = a.attributes[e], r = Qe(n.array, n.type);
|
|
670
685
|
s.setAttribute(e, new t(r, n.itemSize));
|
|
671
686
|
}
|
|
672
687
|
let c = a.indices.length < 65535 ? Uint16Array.from(a.indices) : Uint32Array.from(a.indices);
|
|
@@ -674,7 +689,7 @@ function $e(e, r = !1) {
|
|
|
674
689
|
}
|
|
675
690
|
//#endregion
|
|
676
691
|
//#region src/sdk/geometries/curve/tube-geometry.ts
|
|
677
|
-
function
|
|
692
|
+
function tt(e) {
|
|
678
693
|
let t = {
|
|
679
694
|
vertexCount: 0,
|
|
680
695
|
indexCount: 0,
|
|
@@ -716,30 +731,30 @@ function et(e) {
|
|
|
716
731
|
type: "Float32Array"
|
|
717
732
|
}), t;
|
|
718
733
|
}
|
|
719
|
-
function
|
|
734
|
+
function nt(e, t, n) {
|
|
720
735
|
if (t[0] === n[0]) return n[1];
|
|
721
|
-
let r = n[0] - t[0], i =
|
|
736
|
+
let r = n[0] - t[0], i = R((e - t[0]) / r, 0, 1);
|
|
722
737
|
return I(t[1], n[1], i);
|
|
723
738
|
}
|
|
724
|
-
function
|
|
739
|
+
function rt(e, t, n, r, i, a, o, s) {
|
|
725
740
|
let c = [];
|
|
726
741
|
if (t === "none" || a.length === 0) c.push([n, i], [r, i]);
|
|
727
742
|
else {
|
|
728
743
|
let e = [0, i], o = [1, i], s = a.findIndex((e) => e[0] > n);
|
|
729
744
|
s === -1 ? e = a[a.length - 1] : (s > 0 && (e = a[s - 1]), o = a[s]);
|
|
730
|
-
let l = t === "linear" ?
|
|
745
|
+
let l = t === "linear" ? nt(n, e, o) : e[1];
|
|
731
746
|
c.push([n, l]);
|
|
732
747
|
for (let e = s; e >= 0 && e < a.length; e++) {
|
|
733
748
|
let n = a[e];
|
|
734
749
|
if (n[0] < r) c.push(n);
|
|
735
750
|
else {
|
|
736
|
-
t === "linear" ? c.push([r,
|
|
751
|
+
t === "linear" ? c.push([r, nt(r, c[c.length - 1], n)]) : c.push([r, c[c.length - 1][1]]);
|
|
737
752
|
break;
|
|
738
753
|
}
|
|
739
754
|
}
|
|
740
|
-
c[c.length - 1][0] < r && (t === "linear" ? c.push([r,
|
|
755
|
+
c[c.length - 1][0] < r && (t === "linear" ? c.push([r, nt(r, c[c.length - 1], [1, i])]) : c.push([r, c[c.length - 1][1]]));
|
|
741
756
|
}
|
|
742
|
-
let l = [], u =
|
|
757
|
+
let l = [], u = Ze(e, n, r, o, s), d = 0, f = u[d];
|
|
743
758
|
for (let n = 0; n < c.length - 1; n++) {
|
|
744
759
|
let r = n + 1, [i, a] = c[n], [o, s] = c[r], p = (o - i) * e.length, m = s - a, h = Math.atan2(m, p);
|
|
745
760
|
for (l.push([
|
|
@@ -748,7 +763,7 @@ function nt(e, t, n, r, i, a, o, s) {
|
|
|
748
763
|
t === "linear" ? h : 0
|
|
749
764
|
]); f <= i && d < u.length - 1;) f = u[++d];
|
|
750
765
|
for (; f < o && d < u.length;) {
|
|
751
|
-
let e = t === "linear" ?
|
|
766
|
+
let e = t === "linear" ? nt(f, c[n], c[r]) : a;
|
|
752
767
|
l.push([
|
|
753
768
|
f,
|
|
754
769
|
e,
|
|
@@ -762,7 +777,7 @@ function nt(e, t, n, r, i, a, o, s) {
|
|
|
762
777
|
t === "linear" ? h : 0
|
|
763
778
|
]);
|
|
764
779
|
else if (t === "stepped") {
|
|
765
|
-
let e = h < 0 ? -
|
|
780
|
+
let e = h < 0 ? -z / 2 : z / 2;
|
|
766
781
|
l.push([
|
|
767
782
|
o,
|
|
768
783
|
a,
|
|
@@ -784,17 +799,17 @@ function nt(e, t, n, r, i, a, o, s) {
|
|
|
784
799
|
h
|
|
785
800
|
]);
|
|
786
801
|
}
|
|
787
|
-
let p =
|
|
802
|
+
let p = Xe(e, l.map((e) => e[0]));
|
|
788
803
|
return l.map((e, t) => ({
|
|
789
804
|
radius: e[1],
|
|
790
805
|
theta: e[2],
|
|
791
806
|
...p[t]
|
|
792
807
|
}));
|
|
793
808
|
}
|
|
794
|
-
function
|
|
795
|
-
let s =
|
|
809
|
+
function it(e, t, n, r, i, a, o = !0) {
|
|
810
|
+
let s = tt(a), c = (e) => {
|
|
796
811
|
for (let n = 0; n <= t; n++) {
|
|
797
|
-
let a = n / t *
|
|
812
|
+
let a = n / t * z * 2, o = Math.sin(a), c = -Math.cos(a), l = U([
|
|
798
813
|
c * e.normal[0] + o * e.binormal[0],
|
|
799
814
|
c * e.normal[1] + o * e.binormal[1],
|
|
800
815
|
c * e.normal[2] + o * e.binormal[2]
|
|
@@ -804,8 +819,8 @@ function rt(e, t, n, r, i, a, o = !0) {
|
|
|
804
819
|
e.position[2] + e.radius * l[2]
|
|
805
820
|
];
|
|
806
821
|
if (s.positions.push(...u), s.vertexCount++, s.attributes.normal) {
|
|
807
|
-
let t =
|
|
808
|
-
Number.isFinite(e.theta) && (t =
|
|
822
|
+
let t = je(l);
|
|
823
|
+
Number.isFinite(e.theta) && (t = Ne(l, U(H(e.tangent, l)), e.theta)), s.attributes.normal.array.push(...t);
|
|
809
824
|
}
|
|
810
825
|
s.attributes.curveLength && s.attributes.curveLength.array.push(e.curvePosition * r), s.attributes.curveRelativeLength && s.attributes.curveRelativeLength.array.push((e.curvePosition - i) * r), s.attributes.curveNormal && s.attributes.curveNormal.array.push(...e.normal), s.attributes.curveTangent && s.attributes.curveTangent.array.push(...e.tangent), s.attributes.curveBinormal && s.attributes.curveBinormal.array.push(...e.binormal), s.attributes.centerPoint && s.attributes.centerPoint.array.push(...e.position);
|
|
811
826
|
}
|
|
@@ -818,15 +833,15 @@ function rt(e, t, n, r, i, a, o = !0) {
|
|
|
818
833
|
}
|
|
819
834
|
return o || s.indices.reverse(), s;
|
|
820
835
|
}
|
|
821
|
-
function
|
|
822
|
-
let o =
|
|
836
|
+
function at(e, t, n = !0, r, i, a) {
|
|
837
|
+
let o = tt(a), s = n ? [
|
|
823
838
|
-e.tangent[0],
|
|
824
839
|
-e.tangent[1],
|
|
825
840
|
-e.tangent[2]
|
|
826
841
|
] : e.tangent;
|
|
827
842
|
o.positions.push(...e.position), o.vertexCount++, o.attributes.normal && o.attributes.normal.array.push(...s), o.attributes.uv && o.attributes.uv.array.push(.5, .5);
|
|
828
843
|
for (let r = 0; r <= t; r++) {
|
|
829
|
-
let i = r / t *
|
|
844
|
+
let i = r / t * z * 2, a = Math.sin(i), c = -Math.cos(i), l = U([
|
|
830
845
|
c * e.normal[0] + a * e.binormal[0],
|
|
831
846
|
c * e.normal[1] + a * e.binormal[1],
|
|
832
847
|
c * e.normal[2] + a * e.binormal[2]
|
|
@@ -844,14 +859,14 @@ function it(e, t, n = !0, r, i, a) {
|
|
|
844
859
|
}
|
|
845
860
|
return o;
|
|
846
861
|
}
|
|
847
|
-
function
|
|
848
|
-
let s =
|
|
862
|
+
function ot(e, t, n, r = !0, i, a, o) {
|
|
863
|
+
let s = tt(o), c = r ? [
|
|
849
864
|
-e.tangent[0],
|
|
850
865
|
-e.tangent[1],
|
|
851
866
|
-e.tangent[2]
|
|
852
867
|
] : [...e.tangent], l = t.radius / e.radius;
|
|
853
868
|
for (let i = 0; i <= n; i++) {
|
|
854
|
-
let a = i / n *
|
|
869
|
+
let a = i / n * z * 2, o = Math.sin(a), u = -Math.cos(a), d = U([
|
|
855
870
|
u * e.normal[0] + o * e.binormal[0],
|
|
856
871
|
u * e.normal[1] + o * e.binormal[1],
|
|
857
872
|
u * e.normal[2] + o * e.binormal[2]
|
|
@@ -869,29 +884,29 @@ function at(e, t, n, r = !0, i, a, o) {
|
|
|
869
884
|
}
|
|
870
885
|
return s;
|
|
871
886
|
}
|
|
872
|
-
function
|
|
873
|
-
let n =
|
|
887
|
+
function st(e, t = {}) {
|
|
888
|
+
let n = R(t.from || 0, 0, 1), r = R(t.to || 1);
|
|
874
889
|
if (r < n) throw Error("Value of \"from\" must be less than the value of \"to\"!");
|
|
875
890
|
let i = [], a = t.radius || 1, o = t.radiusModifier?.steps || [], s = t.radialSegments || 8, c = t.startCap || !1, l = t.endCap || !1, u = e.closed, d = e.length;
|
|
876
891
|
o.sort((e, t) => e[0] - t[0]);
|
|
877
|
-
let f = t.segmentsPerMeter || .1, p = t.radiusModifier?.type || "none", m =
|
|
878
|
-
i.push(
|
|
892
|
+
let f = t.segmentsPerMeter || .1, p = t.radiusModifier?.type || "none", m = R(t.simplificationThreshold || 0, 0, 1), h = rt(e, p, n, r, a, o, f, m);
|
|
893
|
+
i.push(it(h, s, u, d, n, t, !0));
|
|
879
894
|
let g = null, _ = t.innerRadius || 0, v = t.thickness || 0;
|
|
880
895
|
return (_ > 0 || v > 0) && (g = v ? h.map((e) => ({
|
|
881
896
|
...e,
|
|
882
897
|
radius: e.radius - v,
|
|
883
|
-
theta: e.theta -
|
|
884
|
-
})) :
|
|
898
|
+
theta: e.theta - z
|
|
899
|
+
})) : rt(e, "none", n, r, _, [], f, m).map((e) => ({
|
|
885
900
|
...e,
|
|
886
|
-
theta: e.theta -
|
|
887
|
-
})), i.push(
|
|
901
|
+
theta: e.theta - z
|
|
902
|
+
})), i.push(it(g, s, u, d, n, t, !1))), c && (!u || n > 0 || r < 1) && (g ? i.push(ot(h[0], g[0], s, !0, d, n, t)) : i.push(at(h[0], s, !0, d, n, t))), l && (!u || n > 0 || r < 1) && (g ? i.push(ot(h[h.length - 1], g[g.length - 1], s, !1, d, n, t)) : i.push(at(h[h.length - 1], s, !1, d, n, t))), i;
|
|
888
903
|
}
|
|
889
|
-
function
|
|
890
|
-
return
|
|
904
|
+
function ct(e, t = {}) {
|
|
905
|
+
return et(st(e, t), t.addGroups);
|
|
891
906
|
}
|
|
892
907
|
//#endregion
|
|
893
908
|
//#region src/sdk/geometries/delatin.ts
|
|
894
|
-
var
|
|
909
|
+
var lt = -1e3, ut = class {
|
|
895
910
|
data;
|
|
896
911
|
width;
|
|
897
912
|
height;
|
|
@@ -935,7 +950,7 @@ var ct = -1e3, lt = class {
|
|
|
935
950
|
}
|
|
936
951
|
heightAt(e, t) {
|
|
937
952
|
let n = this.data[this.width * t + e];
|
|
938
|
-
return n === this.nullValue ?
|
|
953
|
+
return n === this.nullValue ? lt : n;
|
|
939
954
|
}
|
|
940
955
|
_findCandidate(e, t, n, r, i, a, o) {
|
|
941
956
|
let s = Math.min(e, n, i), c = Math.min(t, r, a), l = Math.max(e, n, i), u = Math.max(t, r, a), d = G(n, r, i, a, s, c), f = G(i, a, e, t, s, c), p = G(e, t, n, r, s, c), m = r - t, h = e - n, g = a - r, _ = n - i, v = t - a, y = i - e, b = G(e, t, n, r, i, a), x = this.heightAt(e, t) / b, S = this.heightAt(n, r) / b, C = this.heightAt(i, a) / b, w = 0, T = 0, E = 0, D = 0;
|
|
@@ -967,7 +982,7 @@ var ct = -1e3, lt = class {
|
|
|
967
982
|
}
|
|
968
983
|
_addPoint(e, t) {
|
|
969
984
|
let n = this.coords.length >> 1;
|
|
970
|
-
return this.coords.push(e, t), this.heightAt(e, t) ===
|
|
985
|
+
return this.coords.push(e, t), this.heightAt(e, t) === lt && this._invalidPoints.add(n), n;
|
|
971
986
|
}
|
|
972
987
|
_addTriangle(e, t, n, r, i, a, o = this.triangles.length) {
|
|
973
988
|
let s = o / 3;
|
|
@@ -985,7 +1000,7 @@ var ct = -1e3, lt = class {
|
|
|
985
1000
|
let t = this._halfedges[e];
|
|
986
1001
|
if (t < 0) return;
|
|
987
1002
|
let n = e - e % 3, r = t - t % 3, i = n + (e + 1) % 3, a = n + (e + 2) % 3, o = r + (t + 2) % 3, s = r + (t + 1) % 3, c = this.triangles[a], l = this.triangles[e], u = this.triangles[i], d = this.triangles[o], f = this.coords;
|
|
988
|
-
if (!
|
|
1003
|
+
if (!dt(f[2 * c], f[2 * c + 1], f[2 * l], f[2 * l + 1], f[2 * u], f[2 * u + 1], f[2 * d], f[2 * d + 1])) return;
|
|
989
1004
|
let p = this._halfedges[i], m = this._halfedges[a], h = this._halfedges[o], g = this._halfedges[s];
|
|
990
1005
|
this._queueRemove(n / 3), this._queueRemove(r / 3);
|
|
991
1006
|
let _ = this._addTriangle(c, d, u, -1, h, p, n), v = this._addTriangle(d, c, l, _, m, g, r);
|
|
@@ -1058,13 +1073,13 @@ var ct = -1e3, lt = class {
|
|
|
1058
1073
|
function G(e, t, n, r, i, a) {
|
|
1059
1074
|
return (n - i) * (t - a) - (r - a) * (e - i);
|
|
1060
1075
|
}
|
|
1061
|
-
function
|
|
1076
|
+
function dt(e, t, n, r, i, a, o, s) {
|
|
1062
1077
|
let c = e - o, l = t - s, u = n - o, d = r - s, f = i - o, p = a - s, m = c * c + l * l, h = u * u + d * d, g = f * f + p * p;
|
|
1063
1078
|
return c * (d * g - h * p) - l * (u * g - h * f) + m * (u * p - d * f) < 0;
|
|
1064
1079
|
}
|
|
1065
1080
|
//#endregion
|
|
1066
1081
|
//#region src/sdk/utils/trajectory.ts
|
|
1067
|
-
function
|
|
1082
|
+
function ft(e, t) {
|
|
1068
1083
|
if (!t || t.length < 8) return null;
|
|
1069
1084
|
let [n, , r] = t, i = Array(t.length / 4);
|
|
1070
1085
|
for (let e = 0, a = 0; e < i.length; e++, a += 4) i[e] = [
|
|
@@ -1072,11 +1087,11 @@ function dt(e, t) {
|
|
|
1072
1087
|
-t[a + 1],
|
|
1073
1088
|
r - t[a + 2]
|
|
1074
1089
|
];
|
|
1075
|
-
let a =
|
|
1090
|
+
let a = Ye(i, !1);
|
|
1076
1091
|
if (!a) return null;
|
|
1077
1092
|
let o = t[3], s = t[t.length - 1], c = s - o, l = (e, t = !1) => {
|
|
1078
1093
|
let n = (e - o) / c;
|
|
1079
|
-
return t && (n =
|
|
1094
|
+
return t && (n = R(n, 0, 1)), n < 0 || n > 1 ? null : n;
|
|
1080
1095
|
};
|
|
1081
1096
|
return {
|
|
1082
1097
|
id: e,
|
|
@@ -1097,7 +1112,7 @@ function dt(e, t) {
|
|
|
1097
1112
|
}
|
|
1098
1113
|
};
|
|
1099
1114
|
}
|
|
1100
|
-
function
|
|
1115
|
+
function pt(e, t = (e) => e, n = 1e-7) {
|
|
1101
1116
|
if (e.length <= 2) return e;
|
|
1102
1117
|
let r = t(e[0]), i = [0, 0], a = [e[0]];
|
|
1103
1118
|
for (let o = 1; o < e.length - 1; o++) {
|
|
@@ -1106,7 +1121,7 @@ function ft(e, t = (e) => e, n = 1e-7) {
|
|
|
1106
1121
|
}
|
|
1107
1122
|
return a.push(e[e.length - 1]), a;
|
|
1108
1123
|
}
|
|
1109
|
-
function
|
|
1124
|
+
function mt(e, t, n = 1e3, r = 2e3, i = 0) {
|
|
1110
1125
|
if (!e || e.length < 1) return null;
|
|
1111
1126
|
let a = [], o = 0, s = [e[0][0], e[0][2]], c = e[0][1], l = c, u = 1;
|
|
1112
1127
|
a.push(s);
|
|
@@ -1114,7 +1129,7 @@ function pt(e, t, n = 1e3, r = 2e3, i = 0) {
|
|
|
1114
1129
|
for (; u < e.length;) {
|
|
1115
1130
|
let n = [e[u][0], e[u][2]];
|
|
1116
1131
|
e[u][1] > c && (c = e[u][1]), e[u][1] < l && (l = e[u][1]);
|
|
1117
|
-
let r =
|
|
1132
|
+
let r = Je(d, n);
|
|
1118
1133
|
if (r < t) u === e.length - 1 && a.length > 1 && (o += r, a.push(n)), u++;
|
|
1119
1134
|
else if (o += t, r > t) {
|
|
1120
1135
|
let e = qe(d, n), r = [d[0] + e[0] * t, d[1] + e[1] * t];
|
|
@@ -1130,14 +1145,14 @@ function pt(e, t, n = 1e3, r = 2e3, i = 0) {
|
|
|
1130
1145
|
f > 1 && (l = qe(a[a.length - 2], a[a.length - 1]));
|
|
1131
1146
|
let e = a[a.length - 1], n = Math.floor(c / t), r = [l[0] * t, l[1] * t], i = [e[0] + l[0] * c, e[1] + l[1] * c], o = e;
|
|
1132
1147
|
for (let e = 0; e < n; e++) o = Be(o, r), a.push(o);
|
|
1133
|
-
|
|
1148
|
+
Je(o, i) && a.push(i);
|
|
1134
1149
|
}
|
|
1135
1150
|
if (e) {
|
|
1136
1151
|
let n;
|
|
1137
1152
|
n = f > 1 ? qe(a[1], a[0]) : [-Math.cos(i), -Math.sin(i)], (o < 100 || Math.abs(He(l, n)) > .95) && (n = [-l[0], -l[1]]);
|
|
1138
1153
|
let r = Math.floor(e / t), c = [n[0] * t, n[1] * t], u = [s[0] + n[0] * e, s[1] + n[1] * e], d = s;
|
|
1139
1154
|
for (let e = 0; e < r; e++) d = Be(d, c), a.unshift(d);
|
|
1140
|
-
|
|
1155
|
+
Je(d, u) && a.unshift(u);
|
|
1141
1156
|
}
|
|
1142
1157
|
}
|
|
1143
1158
|
return {
|
|
@@ -1149,9 +1164,9 @@ function pt(e, t, n = 1e3, r = 2e3, i = 0) {
|
|
|
1149
1164
|
}
|
|
1150
1165
|
//#endregion
|
|
1151
1166
|
//#region src/sdk/geometries/fence.ts
|
|
1152
|
-
function
|
|
1153
|
-
let a =
|
|
1154
|
-
for (let e = 0; e < a.length; e++) s === null ? o[e] = 0 : o[e] = o[s] +
|
|
1167
|
+
function ht(e, r, i) {
|
|
1168
|
+
let a = pt(e), o = Array(a.length), s = null;
|
|
1169
|
+
for (let e = 0; e < a.length; e++) s === null ? o[e] = 0 : o[e] = o[s] + Je(a[s], a[e]), s = e;
|
|
1155
1170
|
let c = o[o.length - 1], l = new n(), u = new Float32Array(a.length * 2 * 3), d = new Uint32Array((a.length - 1) * 6), f = new Float32Array(a.length * 2 * 2);
|
|
1156
1171
|
for (let e = 0; e < a.length; e++) {
|
|
1157
1172
|
let t = e * 6;
|
|
@@ -1177,7 +1192,7 @@ function q(e, t, n = [0, 0]) {
|
|
|
1177
1192
|
let r = t * Math.PI / 180, [i, a] = n, o = i !== 0 || a !== 0;
|
|
1178
1193
|
o && e.translate(-i, 0, -a), e.rotateY(r), o && e.translate(i, 0, a), e.computeBoundingBox(), e.computeBoundingSphere();
|
|
1179
1194
|
}
|
|
1180
|
-
function
|
|
1195
|
+
function gt(e) {
|
|
1181
1196
|
let n = e.getAttribute("position"), r = Infinity, i = Infinity, a = -Infinity, o = -Infinity;
|
|
1182
1197
|
for (let e = 0; e < n.count; e++) {
|
|
1183
1198
|
let t = n.getX(e), s = n.getZ(e);
|
|
@@ -1187,7 +1202,7 @@ function ht(e) {
|
|
|
1187
1202
|
for (let e = 0; e < n.count; e++) l[e * 2] = (n.getX(e) - r) / s, l[e * 2 + 1] = (n.getZ(e) - i) / c;
|
|
1188
1203
|
e.setAttribute("uv", new t(l, 2));
|
|
1189
1204
|
}
|
|
1190
|
-
function
|
|
1205
|
+
function _t(e) {
|
|
1191
1206
|
e.computeVertexNormals();
|
|
1192
1207
|
let t = e.getAttribute("normal"), n = 0;
|
|
1193
1208
|
for (let e = 0; e < t.count; e++) n += t.getY(e);
|
|
@@ -1207,7 +1222,7 @@ function J(e) {
|
|
|
1207
1222
|
}
|
|
1208
1223
|
//#endregion
|
|
1209
1224
|
//#region src/sdk/geometries/grid-sampling.ts
|
|
1210
|
-
function
|
|
1225
|
+
function vt(e, t, n, r) {
|
|
1211
1226
|
let i = new Uint8Array(t * n), a = [], o = (t) => {
|
|
1212
1227
|
!i[t] && r(e[t]) && (i[t] = 1, a.push(t));
|
|
1213
1228
|
};
|
|
@@ -1219,7 +1234,7 @@ function gt(e, t, n, r) {
|
|
|
1219
1234
|
}
|
|
1220
1235
|
return i;
|
|
1221
1236
|
}
|
|
1222
|
-
function
|
|
1237
|
+
function yt(e, t, n, r, i, a, o) {
|
|
1223
1238
|
let s = Math.min(Math.max(r, 0), t - 1), c = Math.min(Math.max(i, 0), n - 1), l = Math.floor(s), u = Math.floor(c), d = Math.min(l + 1, t - 1), f = Math.min(u + 1, n - 1), p = s - l, m = c - u, h = 0, g = 0, _ = (n, r, i) => {
|
|
1224
1239
|
let o = e[r * t + n];
|
|
1225
1240
|
a(o) || (h += o * i, g += i);
|
|
@@ -1241,7 +1256,7 @@ function _t(e, t, n, r, i, a, o) {
|
|
|
1241
1256
|
}
|
|
1242
1257
|
return o;
|
|
1243
1258
|
}
|
|
1244
|
-
function
|
|
1259
|
+
function bt(e, t, n, r, i, a = 0, o = 0) {
|
|
1245
1260
|
let s = (e, t) => i(e, t) && i(e + 1, t) && i(e, t + 1) && i(e + 1, t + 1), c = (e - 1) * n || 1, l = (t - 1) * r || 1, u = [], d = [], f = [], p = [], m = new Int32Array(e * t).fill(-1), h = (t, i) => {
|
|
1246
1261
|
let s = i * e + t, p = m[s];
|
|
1247
1262
|
return p === -1 && (p = u.length / 3, m[s] = p, u.push(a + t * n, 0, o + i * r), d.push(0, 1, 0), f.push(t * n / c, i * r / l)), p;
|
|
@@ -1255,10 +1270,10 @@ function vt(e, t, n, r, i, a = 0, o = 0) {
|
|
|
1255
1270
|
}
|
|
1256
1271
|
//#endregion
|
|
1257
1272
|
//#region src/sdk/geometries/tessellation.ts
|
|
1258
|
-
function
|
|
1259
|
-
for (let n = 0; n < t; n++)
|
|
1273
|
+
function xt(e, t) {
|
|
1274
|
+
for (let n = 0; n < t; n++) St(e);
|
|
1260
1275
|
}
|
|
1261
|
-
function
|
|
1276
|
+
function St(e) {
|
|
1262
1277
|
let n = e.getIndex(), r = e.getAttribute("position");
|
|
1263
1278
|
if (!n) return;
|
|
1264
1279
|
let i = n.array, a = [];
|
|
@@ -1278,10 +1293,10 @@ function bt(e) {
|
|
|
1278
1293
|
let u = l <= 65536 ? Uint16Array.from(o) : Uint32Array.from(o);
|
|
1279
1294
|
e.setIndex(new t(u, 1)), e.deleteAttribute("normal"), e.deleteAttribute("uv");
|
|
1280
1295
|
}
|
|
1281
|
-
function
|
|
1282
|
-
for (let n = 0; n < t; n++)
|
|
1296
|
+
function Ct(e, t) {
|
|
1297
|
+
for (let n = 0; n < t; n++) wt(e);
|
|
1283
1298
|
}
|
|
1284
|
-
function
|
|
1299
|
+
function wt(e) {
|
|
1285
1300
|
let n = e.getIndex(), r = e.getAttribute("position");
|
|
1286
1301
|
if (!n) return;
|
|
1287
1302
|
let i = n.array, a = [];
|
|
@@ -1338,10 +1353,10 @@ function St(e) {
|
|
|
1338
1353
|
}
|
|
1339
1354
|
//#endregion
|
|
1340
1355
|
//#region src/sdk/geometries/triangulate-grid-delaunay.ts
|
|
1341
|
-
function
|
|
1356
|
+
function Tt(e, t, n = 1, r = 1, i = -1, a = 5) {
|
|
1342
1357
|
let o = t, s = e.length / o;
|
|
1343
1358
|
console.time("delatin");
|
|
1344
|
-
let c = new
|
|
1359
|
+
let c = new ut(e, o, i);
|
|
1345
1360
|
c.run(a), c.removeInvalidTriangles(), console.timeEnd("delatin");
|
|
1346
1361
|
let l = new Float32Array(c.coords.length * 1.5), u = new Float32Array(c.coords.length);
|
|
1347
1362
|
for (let e = 0, t = 0; e < c.coords.length; e += 2) u[e] = c.coords[e] / (o - 1), u[e + 1] = 1 - c.coords[e + 1] / (s - 1), t = e * 1.5, l[t] = c.coords[e] * n, l[t + 1] = c.heightAt(c.coords[e], c.coords[e + 1]), l[t + 2] = c.coords[e + 1] * r;
|
|
@@ -1354,14 +1369,14 @@ function Ct(e, t, n = 1, r = 1, i = -1, a = 5) {
|
|
|
1354
1369
|
}
|
|
1355
1370
|
//#endregion
|
|
1356
1371
|
//#region src/sdk/geometries/ocean-geometry.ts
|
|
1357
|
-
function
|
|
1372
|
+
function Et(e, t, n, r, i, a, o) {
|
|
1358
1373
|
return (s, c) => {
|
|
1359
1374
|
let l = (s - e) / n, u = (c - t) / r, d = .5;
|
|
1360
1375
|
return d += .25 * Math.sin((l * 6 + o) * Math.PI) * Math.cos(u * 5 * Math.PI), d += .15 * Math.sin((l * 13 - o) * Math.PI + 1.7) * Math.cos(u * 11 * Math.PI - .6), d += .1 * Math.sin(l * 23 * Math.PI + .3) * Math.cos(u * 19 * Math.PI + 2.1), i + (Math.min(Math.max(d, 0), 1) * 2 - 1) * a;
|
|
1361
1376
|
};
|
|
1362
1377
|
}
|
|
1363
|
-
function
|
|
1364
|
-
let [t, n] =
|
|
1378
|
+
function Dt(e = {}) {
|
|
1379
|
+
let [t, n] = W(e.size, 1e5), [r, i] = W(e.surfaceSegments, 0), [a, o] = e.origin ?? [0, 0], s = e.rotation ?? 0, c = Math.max(1, Math.floor(r)), l = Math.max(1, Math.floor(i)), u = [], d = [], f = [], p = [];
|
|
1365
1380
|
for (let e = 0; e <= l; e++) for (let r = 0; r <= c; r++) u.push(a - t / 2 + r / c * t, 0, o - n / 2 + e / l * n), d.push(0, 1, 0), f.push(r / c, e / l);
|
|
1366
1381
|
for (let e = 0; e < l; e++) for (let t = 0; t < c; t++) {
|
|
1367
1382
|
let n = e * (c + 1) + t, r = n + 1, i = n + (c + 1), a = i + 1;
|
|
@@ -1370,15 +1385,15 @@ function Tt(e = {}) {
|
|
|
1370
1385
|
let m = K(u, d, f, p);
|
|
1371
1386
|
return q(m, s, [a, o]), m;
|
|
1372
1387
|
}
|
|
1373
|
-
function
|
|
1374
|
-
let [t, n] =
|
|
1388
|
+
function Ot(e = {}) {
|
|
1389
|
+
let [t, n] = W(e.size, 1e5), [r, i] = W(e.bedSegments, 32), [a, o] = e.origin ?? [0, 0], s = e.rotation ?? 0, c = e.waterDepth ?? 150, l = e.depthVariation ?? 50, u = e.seed ?? 0, d = Math.max(1, Math.floor(r)), f = Math.max(1, Math.floor(i)), p = t / 2, m = n / 2, h = a - p, g = o - m, _ = h + t, v = g + n, y = Et(h, g, t, n, c, l, u), b = Math.min(t, n) / 1e3, x = (e, t) => {
|
|
1375
1390
|
let n = (y(e + b, t) - y(e - b, t)) / (2 * b), r = (y(e, t + b) - y(e, t - b)) / (2 * b), i = 1 / Math.hypot(n, 1, r);
|
|
1376
1391
|
return [
|
|
1377
1392
|
n * i,
|
|
1378
1393
|
i,
|
|
1379
1394
|
r * i
|
|
1380
1395
|
];
|
|
1381
|
-
}, S =
|
|
1396
|
+
}, S = Dt({
|
|
1382
1397
|
size: e.size,
|
|
1383
1398
|
surfaceSegments: e.surfaceSegments,
|
|
1384
1399
|
origin: e.origin
|
|
@@ -1419,8 +1434,8 @@ function Et(e = {}) {
|
|
|
1419
1434
|
bed: ee
|
|
1420
1435
|
};
|
|
1421
1436
|
}
|
|
1422
|
-
function
|
|
1423
|
-
let [t, n] =
|
|
1437
|
+
function kt(e = {}) {
|
|
1438
|
+
let [t, n] = W(e.size, 1e5), [r, i] = e.origin ?? [0, 0], a = e.rotation ?? 0, o = e.waterDepth ?? 150, s = e.depthVariation ?? 50, c = e.seed ?? 0, l = Math.max(3, Math.floor(e.perimeterSegments ?? 96)), u = e.radialSegments && e.radialSegments > 0 ? Math.floor(e.radialSegments) : Math.max(1, Math.ceil(l / (2 * Math.PI))), d = Math.max(t / 2, 1e-6), f = Math.max(n / 2, 1e-6), p = d * 2, m = f * 2, h = r - d, g = i - f, _ = Et(h, g, p, m, o, s, c), v = Math.min(d, f) / 1e3, y = (e, t) => {
|
|
1424
1439
|
let n = (_(e + v, t) - _(e - v, t)) / (2 * v), r = (_(e, t + v) - _(e, t - v)) / (2 * v), i = 1 / Math.hypot(n, 1, r);
|
|
1425
1440
|
return [
|
|
1426
1441
|
n * i,
|
|
@@ -1461,26 +1476,26 @@ function Dt(e = {}) {
|
|
|
1461
1476
|
let t = e % l / l * Math.PI * 2;
|
|
1462
1477
|
C.push([r + d * Math.cos(t), i + f * Math.sin(t)]);
|
|
1463
1478
|
}
|
|
1464
|
-
let w =
|
|
1479
|
+
let w = Ut([C], _);
|
|
1465
1480
|
return q(x, a, [r, i]), q(w, a, [r, i]), q(S, a, [r, i]), {
|
|
1466
1481
|
surface: x,
|
|
1467
1482
|
body: w,
|
|
1468
1483
|
bed: S
|
|
1469
1484
|
};
|
|
1470
1485
|
}
|
|
1471
|
-
function
|
|
1472
|
-
let { nx: a, ny: o, xinc: s, yinc: c } = r, l = i.nullValue ?? -1, u = i.referenceDepth, [d, f] =
|
|
1486
|
+
function At(e, r, i = {}) {
|
|
1487
|
+
let { nx: a, ny: o, xinc: s, yinc: c } = r, l = i.nullValue ?? -1, u = i.referenceDepth, [d, f] = W(i.surfaceSegments, 0), p = i.maxError ?? 5, m = Math.max(0, Math.floor(i.rimSmoothing ?? 0)), h = (e) => e === l || e < 0, g = (e) => u === void 0 ? e : u - e, _ = Infinity, v = -Infinity;
|
|
1473
1488
|
for (let t = 0; t < e.length; t++) {
|
|
1474
1489
|
let n = e[t];
|
|
1475
1490
|
h(n) || (n < _ && (_ = n), n > v && (v = n));
|
|
1476
1491
|
}
|
|
1477
1492
|
Number.isFinite(v) || (v = 0), Number.isFinite(_) || (_ = 0);
|
|
1478
|
-
let y = i.fillDepth ?? (u === void 0 ? v : _), b =
|
|
1493
|
+
let y = i.fillDepth ?? (u === void 0 ? v : _), b = vt(e, a, o, h), x = Float32Array.from(e, (e, t) => b[t] ? l : h(e) ? y : e), S = (a - 1) * s, C = (o - 1) * c, w = r.rot * (Math.PI / 180), T = Tt(x, a, s, c, l, p), E = T.positions;
|
|
1479
1494
|
for (let e = 1; e < E.length; e += 3) E[e] = -g(E[e]);
|
|
1480
1495
|
let D = Math.max(d, f), O = new n();
|
|
1481
1496
|
O.setAttribute("position", new t(E, 3)), O.setAttribute("uv", new t(T.uvs, 2)), O.setIndex(new t(T.indices, 1));
|
|
1482
|
-
let k =
|
|
1483
|
-
m > 0 &&
|
|
1497
|
+
let k = fe(O);
|
|
1498
|
+
m > 0 && pe(O, k, m), _t(O);
|
|
1484
1499
|
let A = O.getAttribute("position"), j = k.map((e) => {
|
|
1485
1500
|
let t = e.map((e) => [
|
|
1486
1501
|
A.getX(e),
|
|
@@ -1491,10 +1506,10 @@ function Ot(e, r, i = {}) {
|
|
|
1491
1506
|
}), M = null;
|
|
1492
1507
|
if (D > 0) {
|
|
1493
1508
|
let e = Math.max(1, Math.floor(d || f)), t = Math.max(1, Math.floor(f || d));
|
|
1494
|
-
M =
|
|
1509
|
+
M = zt(Bt(k.map((e) => e.map((e) => [A.getX(e), -A.getZ(e)]))), e, t, 0, 0, S, C);
|
|
1495
1510
|
}
|
|
1496
|
-
M ||=
|
|
1497
|
-
let N =
|
|
1511
|
+
M ||= Vt(O);
|
|
1512
|
+
let N = Ht(j);
|
|
1498
1513
|
for (let e of [
|
|
1499
1514
|
M,
|
|
1500
1515
|
N,
|
|
@@ -1506,9 +1521,9 @@ function Ot(e, r, i = {}) {
|
|
|
1506
1521
|
bed: O
|
|
1507
1522
|
};
|
|
1508
1523
|
}
|
|
1509
|
-
function
|
|
1510
|
-
let n = t.waterDepth ?? 150, r = t.depthVariation ?? 50, i = t.seed ?? 0, [a, o] =
|
|
1511
|
-
|
|
1524
|
+
function jt(e, t = {}) {
|
|
1525
|
+
let n = t.waterDepth ?? 150, r = t.depthVariation ?? 50, i = t.seed ?? 0, [a, o] = W(t.surfaceSegments, 0), [s, c] = W(t.bedSegments, 48), [l, u] = e.min, [d, f] = e.max, p = l, m = Math.max(d - l, 1e-6), h = Et(p, -f, m, Math.max(f - u, 1e-6), n, r, i), g = e.toShapes(), _ = e.coordinates, v = Nt(g, Mt(Math.max(Math.max(0, Math.floor(a)), Math.max(0, Math.floor(o))))), y = Nt(g, Mt(Math.max(Math.max(0, Math.floor(s)), Math.max(0, Math.floor(c)))));
|
|
1526
|
+
Wt(y, h), _t(y);
|
|
1512
1527
|
let b = [];
|
|
1513
1528
|
for (let e of _) for (let t of e) {
|
|
1514
1529
|
let e = t.map(([e, t]) => [e, -t]);
|
|
@@ -1516,18 +1531,18 @@ function kt(e, t = {}) {
|
|
|
1516
1531
|
}
|
|
1517
1532
|
return {
|
|
1518
1533
|
surface: v,
|
|
1519
|
-
body:
|
|
1534
|
+
body: Ut(b, h),
|
|
1520
1535
|
bed: y
|
|
1521
1536
|
};
|
|
1522
1537
|
}
|
|
1523
|
-
function
|
|
1538
|
+
function Mt(e) {
|
|
1524
1539
|
return e <= 0 ? 0 : Math.min(Math.max(Math.round(Math.log2(e / 12)), 0), 5);
|
|
1525
1540
|
}
|
|
1526
|
-
function
|
|
1541
|
+
function Nt(e, t = 0) {
|
|
1527
1542
|
let n = new w(e);
|
|
1528
|
-
return n.rotateX(-Math.PI / 2), t > 0 &&
|
|
1543
|
+
return n.rotateX(-Math.PI / 2), t > 0 && Ct(n, t), gt(n), _t(n), n;
|
|
1529
1544
|
}
|
|
1530
|
-
function
|
|
1545
|
+
function Pt(e, t, n) {
|
|
1531
1546
|
let r = !1;
|
|
1532
1547
|
for (let i = 0, a = n.length - 1; i < n.length; a = i++) {
|
|
1533
1548
|
let o = n[i][0], s = n[i][1], c = n[a][0], l = n[a][1];
|
|
@@ -1535,11 +1550,11 @@ function Mt(e, t, n) {
|
|
|
1535
1550
|
}
|
|
1536
1551
|
return r;
|
|
1537
1552
|
}
|
|
1538
|
-
function
|
|
1553
|
+
function Ft(e, t, n) {
|
|
1539
1554
|
for (let r of n) {
|
|
1540
|
-
if (!
|
|
1555
|
+
if (!Pt(e, t, r[0])) continue;
|
|
1541
1556
|
let n = !1;
|
|
1542
|
-
for (let i = 1; i < r.length; i++) if (
|
|
1557
|
+
for (let i = 1; i < r.length; i++) if (Pt(e, t, r[i])) {
|
|
1543
1558
|
n = !0;
|
|
1544
1559
|
break;
|
|
1545
1560
|
}
|
|
@@ -1547,17 +1562,17 @@ function Nt(e, t, n) {
|
|
|
1547
1562
|
}
|
|
1548
1563
|
return !1;
|
|
1549
1564
|
}
|
|
1550
|
-
function
|
|
1565
|
+
function It(e) {
|
|
1551
1566
|
let t = 0;
|
|
1552
1567
|
for (let n = 0, r = e.length - 1; n < e.length; r = n++) t += e[r][0] * e[n][1] - e[n][0] * e[r][1];
|
|
1553
1568
|
return t / 2;
|
|
1554
1569
|
}
|
|
1555
|
-
function
|
|
1570
|
+
function Lt(e) {
|
|
1556
1571
|
let t = 0, n = 0;
|
|
1557
1572
|
for (let [r, i] of e) t += r, n += i;
|
|
1558
1573
|
return [t / e.length, n / e.length];
|
|
1559
1574
|
}
|
|
1560
|
-
function
|
|
1575
|
+
function Rt(e) {
|
|
1561
1576
|
let r = [], i = [], a = /* @__PURE__ */ new Map(), o = (e, t) => `${Math.round(e * 1e3)}_${Math.round(t * 1e3)}`;
|
|
1562
1577
|
for (let t of e) {
|
|
1563
1578
|
let e = t.getAttribute("position"), n = t.getIndex(), s = [];
|
|
@@ -1573,21 +1588,21 @@ function It(e) {
|
|
|
1573
1588
|
let c = r.length / 3;
|
|
1574
1589
|
return s.setIndex(new t(c <= 65536 ? Uint16Array.from(i) : Uint32Array.from(i), 1)), s;
|
|
1575
1590
|
}
|
|
1576
|
-
function
|
|
1577
|
-
let s = a / t, c = o / n, l = t + 1, u = n + 1, d = s / 2, f = c / 2, p =
|
|
1591
|
+
function zt(e, t, n, r, i, a, o) {
|
|
1592
|
+
let s = a / t, c = o / n, l = t + 1, u = n + 1, d = s / 2, f = c / 2, p = bt(l, u, s, c, (t, n) => {
|
|
1578
1593
|
let a = r + t * s, o = i + n * c;
|
|
1579
|
-
return
|
|
1594
|
+
return Ft(a, -o, e) && Ft(a - d, -(o - f), e) && Ft(a + d, -(o - f), e) && Ft(a - d, -(o + f), e) && Ft(a + d, -(o + f), e);
|
|
1580
1595
|
}, r, i), h = p.getIndex();
|
|
1581
1596
|
if (!h || h.count === 0) return null;
|
|
1582
|
-
let g = p.getAttribute("position"), _ =
|
|
1597
|
+
let g = p.getAttribute("position"), _ = fe(p).map((e) => e.map((e) => [g.getX(e), -g.getZ(e)]));
|
|
1583
1598
|
if (_.length === 0) return null;
|
|
1584
|
-
let v = _.map(
|
|
1599
|
+
let v = _.map(It), y = 0;
|
|
1585
1600
|
for (let e = 1; e < v.length; e++) Math.abs(v[e]) > Math.abs(v[y]) && (y = e);
|
|
1586
1601
|
let b = Math.sign(v[y]) || 1, x = (e) => e.map(([e, t]) => new j(e, t)), S = [], T = [];
|
|
1587
1602
|
for (let t of e) {
|
|
1588
1603
|
S.push({
|
|
1589
1604
|
ring: t[0],
|
|
1590
|
-
area: Math.abs(
|
|
1605
|
+
area: Math.abs(It(t[0]))
|
|
1591
1606
|
});
|
|
1592
1607
|
for (let e = 1; e < t.length; e++) T.push(t[e]);
|
|
1593
1608
|
}
|
|
@@ -1598,18 +1613,18 @@ function Lt(e, t, n, r, i, a, o) {
|
|
|
1598
1613
|
let E = S.map((e) => new C(x(e.ring)));
|
|
1599
1614
|
for (let e of T) {
|
|
1600
1615
|
let [t, n] = e[0], r = -1, i = Infinity;
|
|
1601
|
-
for (let e = 0; e < S.length; e++) S[e].area < i &&
|
|
1616
|
+
for (let e = 0; e < S.length; e++) S[e].area < i && Pt(t, n, S[e].ring) && (r = e, i = S[e].area);
|
|
1602
1617
|
r >= 0 && E[r].holes.push(new m(x(e)));
|
|
1603
1618
|
}
|
|
1604
1619
|
let D = new w(E);
|
|
1605
1620
|
D.rotateX(-Math.PI / 2);
|
|
1606
|
-
let O =
|
|
1607
|
-
return
|
|
1621
|
+
let O = Rt([p, D]);
|
|
1622
|
+
return gt(O), _t(O), O;
|
|
1608
1623
|
}
|
|
1609
|
-
function
|
|
1610
|
-
let t = e.filter((e) => e.length >= 3), n = t.map(
|
|
1624
|
+
function Bt(e) {
|
|
1625
|
+
let t = e.filter((e) => e.length >= 3), n = t.map(It), r = t.map(Lt), i = (e) => {
|
|
1611
1626
|
let i = -1, a = Infinity;
|
|
1612
|
-
for (let o = 0; o < t.length; o++) o === e || Math.abs(n[o]) <= Math.abs(n[e]) ||
|
|
1627
|
+
for (let o = 0; o < t.length; o++) o === e || Math.abs(n[o]) <= Math.abs(n[e]) || Pt(r[e][0], r[e][1], t[o]) && Math.abs(n[o]) < a && (a = Math.abs(n[o]), i = o);
|
|
1613
1628
|
return i;
|
|
1614
1629
|
}, a = t.map((e, t) => i(t)), o = [], s = /* @__PURE__ */ new Map();
|
|
1615
1630
|
return t.forEach((e, t) => {
|
|
@@ -1621,7 +1636,7 @@ function Rt(e) {
|
|
|
1621
1636
|
}
|
|
1622
1637
|
}), o;
|
|
1623
1638
|
}
|
|
1624
|
-
function
|
|
1639
|
+
function Vt(e) {
|
|
1625
1640
|
let r = e.getAttribute("position"), i = new Float32Array(r.count * 3), a = new Float32Array(r.count * 3);
|
|
1626
1641
|
for (let e = 0; e < r.count; e++) i[e * 3] = r.getX(e), i[e * 3 + 2] = r.getZ(e), a[e * 3 + 1] = 1;
|
|
1627
1642
|
let o = new n();
|
|
@@ -1631,7 +1646,7 @@ function zt(e) {
|
|
|
1631
1646
|
let c = e.getIndex();
|
|
1632
1647
|
return c && o.setIndex(new t(Uint32Array.from(c.array), 1)), o.computeBoundingBox(), o.computeBoundingSphere(), o;
|
|
1633
1648
|
}
|
|
1634
|
-
function
|
|
1649
|
+
function Ht(e) {
|
|
1635
1650
|
let t = [], n = [], r = [], i = [];
|
|
1636
1651
|
for (let a of e) {
|
|
1637
1652
|
if (a.length < 2) continue;
|
|
@@ -1649,7 +1664,7 @@ function Bt(e) {
|
|
|
1649
1664
|
}
|
|
1650
1665
|
return K(t, n, r, i);
|
|
1651
1666
|
}
|
|
1652
|
-
function
|
|
1667
|
+
function Ut(e, t) {
|
|
1653
1668
|
let n = [], r = [], i = [], a = [];
|
|
1654
1669
|
for (let o of e) {
|
|
1655
1670
|
if (o.length < 2) continue;
|
|
@@ -1667,14 +1682,14 @@ function Vt(e, t) {
|
|
|
1667
1682
|
}
|
|
1668
1683
|
return K(n, r, i, a);
|
|
1669
1684
|
}
|
|
1670
|
-
function
|
|
1685
|
+
function Wt(e, t) {
|
|
1671
1686
|
let n = e.getAttribute("position");
|
|
1672
1687
|
for (let e = 0; e < n.count; e++) n.setY(e, -t(n.getX(e), n.getZ(e)));
|
|
1673
1688
|
n.needsUpdate = !0;
|
|
1674
1689
|
}
|
|
1675
1690
|
//#endregion
|
|
1676
1691
|
//#region src/sdk/geometries/packing.ts
|
|
1677
|
-
function
|
|
1692
|
+
function Gt(e) {
|
|
1678
1693
|
if (e.constructor === Uint8Array) return "Uint8Array";
|
|
1679
1694
|
if (e.constructor === Uint16Array) return "Uint16Array";
|
|
1680
1695
|
if (e.constructor === Uint32Array) return "Uint32Array";
|
|
@@ -1685,7 +1700,7 @@ function Ut(e) {
|
|
|
1685
1700
|
if (e.constructor === Float64Array) return "Float64Array";
|
|
1686
1701
|
throw Error("Unsupported typed array!");
|
|
1687
1702
|
}
|
|
1688
|
-
function
|
|
1703
|
+
function J(e, t) {
|
|
1689
1704
|
switch (t) {
|
|
1690
1705
|
case "Uint8Array": return new Uint8Array(e);
|
|
1691
1706
|
case "Uint16Array": return new Uint16Array(e);
|
|
@@ -1698,14 +1713,14 @@ function Wt(e, t) {
|
|
|
1698
1713
|
default: throw Error("Unsupported typed array!");
|
|
1699
1714
|
}
|
|
1700
1715
|
}
|
|
1701
|
-
function
|
|
1716
|
+
function Kt(e, t = 1) {
|
|
1702
1717
|
return {
|
|
1703
1718
|
buffer: e.buffer,
|
|
1704
|
-
attributeType:
|
|
1719
|
+
attributeType: Gt(e),
|
|
1705
1720
|
itemSize: t
|
|
1706
1721
|
};
|
|
1707
1722
|
}
|
|
1708
|
-
function
|
|
1723
|
+
function qt(e) {
|
|
1709
1724
|
let t = [], n = {
|
|
1710
1725
|
drawRange: e.drawRange || {
|
|
1711
1726
|
start: 0,
|
|
@@ -1714,13 +1729,13 @@ function Kt(e) {
|
|
|
1714
1729
|
groups: e.groups || [],
|
|
1715
1730
|
attributes: {},
|
|
1716
1731
|
index: e.index,
|
|
1717
|
-
indexType: e.index ?
|
|
1732
|
+
indexType: e.index ? Gt(e.index) : void 0,
|
|
1718
1733
|
userData: e.userData ? structuredClone(e.userData) : void 0
|
|
1719
1734
|
};
|
|
1720
|
-
for (let r in e.attributes) n.attributes[r] =
|
|
1735
|
+
for (let r in e.attributes) n.attributes[r] = Kt(e.attributes[r].array, e.attributes[r].itemSize), t.push(n.attributes[r].buffer);
|
|
1721
1736
|
return [n, t];
|
|
1722
1737
|
}
|
|
1723
|
-
function
|
|
1738
|
+
function Jt(e) {
|
|
1724
1739
|
let t = [], n = {
|
|
1725
1740
|
drawRange: e.drawRange,
|
|
1726
1741
|
groups: e.groups,
|
|
@@ -1728,21 +1743,21 @@ function qt(e) {
|
|
|
1728
1743
|
index: void 0,
|
|
1729
1744
|
indexType: void 0
|
|
1730
1745
|
}, r = e.getIndex();
|
|
1731
|
-
r && (n.index = r.array.buffer, n.indexType =
|
|
1746
|
+
r && (n.index = r.array.buffer, n.indexType = Gt(r.array));
|
|
1732
1747
|
for (let r in e.attributes) {
|
|
1733
1748
|
let i = e.getAttribute(r);
|
|
1734
1749
|
n.attributes[r] = {
|
|
1735
1750
|
buffer: i.array.buffer,
|
|
1736
|
-
attributeType:
|
|
1751
|
+
attributeType: Gt(i.array),
|
|
1737
1752
|
itemSize: i.itemSize
|
|
1738
1753
|
}, t.push(n.attributes[r].buffer);
|
|
1739
1754
|
}
|
|
1740
1755
|
return e.userData && (n.userData = structuredClone(e.userData)), [n, t];
|
|
1741
1756
|
}
|
|
1742
|
-
function
|
|
1757
|
+
function Yt(e) {
|
|
1743
1758
|
let t = {}, n = [];
|
|
1744
1759
|
for (let r in e) {
|
|
1745
|
-
let i = e[r], a =
|
|
1760
|
+
let i = e[r], a = Jt(i);
|
|
1746
1761
|
t[r] = a[0], a[1].length && n.push(...a[1]);
|
|
1747
1762
|
}
|
|
1748
1763
|
return {
|
|
@@ -1750,28 +1765,28 @@ function Jt(e) {
|
|
|
1750
1765
|
transferrables: n
|
|
1751
1766
|
};
|
|
1752
1767
|
}
|
|
1753
|
-
function
|
|
1768
|
+
function Xt(e) {
|
|
1754
1769
|
let r = new n();
|
|
1755
1770
|
if (e.index) {
|
|
1756
|
-
let n = new t(
|
|
1771
|
+
let n = new t(J(e.index, e.indexType || "Uint32Array"), 1);
|
|
1757
1772
|
r.setIndex(n);
|
|
1758
1773
|
}
|
|
1759
1774
|
for (let n in e.attributes) {
|
|
1760
|
-
let i = new t(
|
|
1775
|
+
let i = new t(J(e.attributes[n].buffer, e.attributes[n].attributeType), e.attributes[n].itemSize);
|
|
1761
1776
|
r.setAttribute(n, i);
|
|
1762
1777
|
}
|
|
1763
1778
|
return r.drawRange = e.drawRange, r.groups = e.groups, e.userData && (r.userData = e.userData), r;
|
|
1764
1779
|
}
|
|
1765
|
-
function
|
|
1780
|
+
function Zt(e) {
|
|
1766
1781
|
let r = {};
|
|
1767
1782
|
for (let i in e) {
|
|
1768
1783
|
let a = new n();
|
|
1769
1784
|
if (e[i].index) {
|
|
1770
|
-
let n = new t(
|
|
1785
|
+
let n = new t(J(e[i].index, e[i].indexType || "Uint32Array"), 1);
|
|
1771
1786
|
a.setIndex(n);
|
|
1772
1787
|
}
|
|
1773
1788
|
for (let n in e[i].attributes) {
|
|
1774
|
-
let r = new t(
|
|
1789
|
+
let r = new t(J(e[i].attributes[n].buffer, e[i].attributes[n].attributeType), e[i].attributes[n].itemSize);
|
|
1775
1790
|
a.setAttribute(n, r);
|
|
1776
1791
|
}
|
|
1777
1792
|
a.drawRange = e[i].drawRange, a.groups = e[i].groups, r[i] = a;
|
|
@@ -1780,7 +1795,7 @@ function Xt(e) {
|
|
|
1780
1795
|
}
|
|
1781
1796
|
//#endregion
|
|
1782
1797
|
//#region src/sdk/geometries/planar-geometry.ts
|
|
1783
|
-
var
|
|
1798
|
+
var Qt = class {
|
|
1784
1799
|
type;
|
|
1785
1800
|
coordinates;
|
|
1786
1801
|
_min = null;
|
|
@@ -1791,13 +1806,13 @@ var Zt = class {
|
|
|
1791
1806
|
this.type = e, this.coordinates = t, n && (this._offset[0] = n[0], this._offset[1] = n[1]);
|
|
1792
1807
|
}
|
|
1793
1808
|
static fromPointCoordinates(e, t) {
|
|
1794
|
-
return new
|
|
1809
|
+
return new $t(t ? e.map(t) : e);
|
|
1795
1810
|
}
|
|
1796
1811
|
static fromLineCoordinates(e, t) {
|
|
1797
|
-
return new
|
|
1812
|
+
return new en(t ? e.map((e) => e.map(t)) : e);
|
|
1798
1813
|
}
|
|
1799
1814
|
static fromPolygonCoordinates(e, t) {
|
|
1800
|
-
return new
|
|
1815
|
+
return new tn(t ? e.map((e) => e.map((e) => e.map(t))) : e);
|
|
1801
1816
|
}
|
|
1802
1817
|
_calculateBounds() {
|
|
1803
1818
|
let e = [Infinity, Infinity], t = [-Infinity, -Infinity];
|
|
@@ -1837,7 +1852,7 @@ var Zt = class {
|
|
|
1837
1852
|
this.centralize();
|
|
1838
1853
|
let n = this.getBounds();
|
|
1839
1854
|
this.forEachCoordinate((r) => {
|
|
1840
|
-
r[0] =
|
|
1855
|
+
r[0] = R((r[0] - n.min[0]) / n.size[0]) * e[0] + t[0], r[1] = R((r[1] - n.min[1]) / n.size[1]) * e[1] + t[1];
|
|
1841
1856
|
});
|
|
1842
1857
|
}
|
|
1843
1858
|
transform(e) {
|
|
@@ -1866,7 +1881,7 @@ var Zt = class {
|
|
|
1866
1881
|
size: this.size
|
|
1867
1882
|
};
|
|
1868
1883
|
}
|
|
1869
|
-
},
|
|
1884
|
+
}, $t = class e extends Qt {
|
|
1870
1885
|
constructor(e, t) {
|
|
1871
1886
|
super("point2d", e, t);
|
|
1872
1887
|
}
|
|
@@ -1879,7 +1894,7 @@ var Zt = class {
|
|
|
1879
1894
|
clone() {
|
|
1880
1895
|
return new e(structuredClone(this.coordinates), this.offset);
|
|
1881
1896
|
}
|
|
1882
|
-
},
|
|
1897
|
+
}, en = class e extends Qt {
|
|
1883
1898
|
constructor(e, t) {
|
|
1884
1899
|
super("line2d", e, t);
|
|
1885
1900
|
}
|
|
@@ -1892,7 +1907,7 @@ var Zt = class {
|
|
|
1892
1907
|
clone() {
|
|
1893
1908
|
return new e(structuredClone(this.coordinates), this.offset);
|
|
1894
1909
|
}
|
|
1895
|
-
},
|
|
1910
|
+
}, tn = class e extends Qt {
|
|
1896
1911
|
constructor(e, t) {
|
|
1897
1912
|
super("polygon2d", e, t);
|
|
1898
1913
|
}
|
|
@@ -1924,10 +1939,10 @@ var Zt = class {
|
|
|
1924
1939
|
};
|
|
1925
1940
|
//#endregion
|
|
1926
1941
|
//#region src/sdk/geometries/triangulate-grid.ts
|
|
1927
|
-
function
|
|
1942
|
+
function nn(e, t, n = 1, r = 1, i = (e) => e) {
|
|
1928
1943
|
console.time("triangulate");
|
|
1929
1944
|
let a = [], o = [], s = [], c = [], l = e.length / t, u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E, D, O, k, A, j, M, N, ee = 0, te = 0, ne = 0, P = Array(t).fill(null), F = Array(t).fill(null), I = Array(t - 1).fill(null);
|
|
1930
|
-
function
|
|
1945
|
+
function re(e, i, o) {
|
|
1931
1946
|
return a.push({
|
|
1932
1947
|
x: e * n,
|
|
1933
1948
|
y: o,
|
|
@@ -1935,7 +1950,7 @@ function tn(e, t, n = 1, r = 1, i = (e) => e) {
|
|
|
1935
1950
|
edge: null
|
|
1936
1951
|
}), s.push(e / (t - 1), 1 - i / (l - 1)), ee++;
|
|
1937
1952
|
}
|
|
1938
|
-
function
|
|
1953
|
+
function L(e, t, n) {
|
|
1939
1954
|
O = {
|
|
1940
1955
|
index: te++,
|
|
1941
1956
|
tail: e,
|
|
@@ -1962,7 +1977,7 @@ function tn(e, t, n = 1, r = 1, i = (e) => e) {
|
|
|
1962
1977
|
for (T = 1; T < l - 1; T++) {
|
|
1963
1978
|
N = !1;
|
|
1964
1979
|
let n = P;
|
|
1965
|
-
for (P = F, F = n.fill(null), j = null, D = T - 1, ne += t, w = 1; w < t - 1; w++) E = w - 1, y = ne + w, v = y - 1, _ = y - t, g = _ - 1, b = i(e[g]), x = i(e[_]), S = i(e[v]), C = i(e[y]), M = b !== null && x !== null && S !== null && C !== null ? 1 : b !== null && x !== null && S !== null ? 2 : b !== null && x !== null && C !== null ? 3 : b !== null && S !== null && C !== null ? 4 : x !== null && S !== null && C !== null ? 5 : 0, f = null, p = null, M === 0 ? (I[E] = null, j = null) : (N ? (u = P[E], f = F[E]) : (M !== 5 && (P[E] === null ? (u =
|
|
1980
|
+
for (P = F, F = n.fill(null), j = null, D = T - 1, ne += t, w = 1; w < t - 1; w++) E = w - 1, y = ne + w, v = y - 1, _ = y - t, g = _ - 1, b = i(e[g]), x = i(e[_]), S = i(e[v]), C = i(e[y]), M = b !== null && x !== null && S !== null && C !== null ? 1 : b !== null && x !== null && S !== null ? 2 : b !== null && x !== null && C !== null ? 3 : b !== null && S !== null && C !== null ? 4 : x !== null && S !== null && C !== null ? 5 : 0, f = null, p = null, M === 0 ? (I[E] = null, j = null) : (N ? (u = P[E], f = F[E]) : (M !== 5 && (P[E] === null ? (u = re(E, D, b), P[E] = u) : u = P[E]), M !== 3 && (f = re(E, T, S)), F[E] = f), M !== 4 && (P[w] === null ? (d = re(w, D, x), P[w] = d) : d = P[w]), M !== 2 && (p = re(w, T, C)), M === 1 ? (m = Math.abs(a[u].y - a[p].y), h = Math.abs(a[d].y - a[f].y), m < h ? (L(u, f, p), j !== null && (o[o.length - 3].twin = j, j.twin = o[o.length - 3]), L(p, d, u), I[E] !== null && (o[o.length - 2].twin = I[E], I[E].twin = o[o.length - 2]), o[o.length - 4].twin = o[o.length - 1], o[o.length - 1].twin = o[o.length - 4], I[E] = o[o.length - 5], j = o[o.length - 3]) : (L(u, f, d), I[E] !== null && (o[o.length - 1].twin = I[E], I[E].twin = o[o.length - 1]), j !== null && (o[o.length - 3].twin = j, j.twin = o[o.length - 3]), L(d, f, p), o[o.length - 5].twin = o[o.length - 3], o[o.length - 3].twin = o[o.length - 5], I[E] = o[o.length - 2], j = o[o.length - 1])) : M === 2 ? (L(u, f, d), I[E] !== null && (o[o.length - 1].twin = I[E], I[E].twin = o[o.length - 1]), j !== null && (o[o.length - 3].twin = j, j.twin = o[o.length - 3]), I[E] = null, j = null) : M === 5 ? (L(d, f, p), I[E] = o[o.length - 2], j = o[o.length - 1]) : M === 3 ? (L(d, u, p), I[E] !== null && (o[o.length - 3].twin = I[E], I[E].twin = o[o.length - 3]), I[E] = null, j = o[o.length - 1]) : (L(u, f, p), j !== null && (o[o.length - 3].twin = j, j.twin = o[o.length - 3]), I[E] = o[o.length - 2], j = null)), F[w] = p, N = !!M;
|
|
1966
1981
|
}
|
|
1967
1982
|
return console.timeEnd("triangulate"), console.log(c.length / 3), {
|
|
1968
1983
|
vertices: a,
|
|
@@ -1973,24 +1988,24 @@ function tn(e, t, n = 1, r = 1, i = (e) => e) {
|
|
|
1973
1988
|
}
|
|
1974
1989
|
//#endregion
|
|
1975
1990
|
//#region src/events/camera-events.ts
|
|
1976
|
-
var
|
|
1991
|
+
var rn = "camera-set-position", an = "camera-focus-point", on = class extends CustomEvent {
|
|
1977
1992
|
constructor(e) {
|
|
1978
|
-
super(
|
|
1993
|
+
super(rn, { detail: e });
|
|
1979
1994
|
}
|
|
1980
|
-
},
|
|
1995
|
+
}, sn = class extends CustomEvent {
|
|
1981
1996
|
constructor(e) {
|
|
1982
|
-
super(
|
|
1997
|
+
super(an, { detail: e });
|
|
1983
1998
|
}
|
|
1984
|
-
}, Y = new M(), X = new M(), Z = new M(),
|
|
1985
|
-
async function
|
|
1999
|
+
}, Y = new M(), X = new M(), Z = new M(), cn = new M(), ln = new M();
|
|
2000
|
+
async function un(e, t, n) {
|
|
1986
2001
|
n.normalizeRotations();
|
|
1987
2002
|
let r = Math.min(n.distance, t);
|
|
1988
2003
|
return Y.set(...e), n.getPosition(X), Z.subVectors(Y, X), t = Math.min(Z.length() * 1.5, r), Z.normalize(), X.copy(Y).addScaledVector(Z, -r), n.setLookAt(X.x, X.y, X.z, Y.x, Y.y, Y.z, !0);
|
|
1989
2004
|
}
|
|
1990
|
-
function
|
|
1991
|
-
t.normalizeRotations(),
|
|
2005
|
+
function dn(e, t) {
|
|
2006
|
+
t.normalizeRotations(), cn.set(...e), t.getTarget(Y), ln.subVectors(Y, cn), t.getPosition(X), X.sub(ln), t.setPosition(X.x, X.y, X.z), t.setTarget(cn.x, cn.y, cn.z);
|
|
1992
2007
|
}
|
|
1993
|
-
var
|
|
2008
|
+
var fn = class {
|
|
1994
2009
|
controls = null;
|
|
1995
2010
|
removeEventlisteners = null;
|
|
1996
2011
|
constructor() {
|
|
@@ -1998,17 +2013,17 @@ var dn = class {
|
|
|
1998
2013
|
}
|
|
1999
2014
|
addEventListeners() {
|
|
2000
2015
|
let e = (e) => {
|
|
2001
|
-
this.controls &&
|
|
2016
|
+
this.controls && dn(e.detail, this.controls);
|
|
2002
2017
|
}, t = (e) => {
|
|
2003
2018
|
if (this.controls) {
|
|
2004
2019
|
let t = e.detail.callback;
|
|
2005
|
-
|
|
2020
|
+
un(e.detail.point, e.detail.distance || 200, this.controls).then(() => {
|
|
2006
2021
|
t && t();
|
|
2007
2022
|
});
|
|
2008
2023
|
}
|
|
2009
2024
|
};
|
|
2010
|
-
addEventListener(
|
|
2011
|
-
removeEventListener(
|
|
2025
|
+
addEventListener(rn, e), addEventListener(an, t), this.removeEventlisteners = () => {
|
|
2026
|
+
removeEventListener(rn, e), removeEventListener(an, t);
|
|
2012
2027
|
};
|
|
2013
2028
|
}
|
|
2014
2029
|
async setTarget(e) {
|
|
@@ -2021,11 +2036,7 @@ var dn = class {
|
|
|
2021
2036
|
dispose() {
|
|
2022
2037
|
this.controls = null, this.removeEventlisteners && this.removeEventlisteners();
|
|
2023
2038
|
}
|
|
2024
|
-
},
|
|
2025
|
-
constructor(e) {
|
|
2026
|
-
super(fn, { detail: e });
|
|
2027
|
-
}
|
|
2028
|
-
}, gn = class extends CustomEvent {
|
|
2039
|
+
}, pn = "wellbore-selected", mn = "wellbore-added", hn = "wellbore-removed", gn = class extends CustomEvent {
|
|
2029
2040
|
constructor(e) {
|
|
2030
2041
|
super(pn, { detail: e });
|
|
2031
2042
|
}
|
|
@@ -2033,10 +2044,14 @@ var dn = class {
|
|
|
2033
2044
|
constructor(e) {
|
|
2034
2045
|
super(mn, { detail: e });
|
|
2035
2046
|
}
|
|
2036
|
-
}, vn =
|
|
2047
|
+
}, vn = class extends CustomEvent {
|
|
2048
|
+
constructor(e) {
|
|
2049
|
+
super(hn, { detail: e });
|
|
2050
|
+
}
|
|
2051
|
+
}, yn = new M(), bn = class {
|
|
2037
2052
|
map = /* @__PURE__ */ new Map();
|
|
2038
2053
|
constructor() {
|
|
2039
|
-
this.onWellboreAdded = this.onWellboreAdded.bind(this), this.onWellboreRemoved = this.onWellboreRemoved.bind(this), addEventListener(
|
|
2054
|
+
this.onWellboreAdded = this.onWellboreAdded.bind(this), this.onWellboreRemoved = this.onWellboreRemoved.bind(this), addEventListener(mn, this.onWellboreAdded), addEventListener(hn, this.onWellboreRemoved);
|
|
2040
2055
|
}
|
|
2041
2056
|
onWellboreAdded(e) {
|
|
2042
2057
|
this.map.set(e.detail.id, {
|
|
@@ -2049,21 +2064,21 @@ var dn = class {
|
|
|
2049
2064
|
}
|
|
2050
2065
|
getInfo(e) {
|
|
2051
2066
|
let t = this.map.get(e);
|
|
2052
|
-
if (t) return t.object.getWorldPosition(
|
|
2067
|
+
if (t) return t.object.getWorldPosition(yn), {
|
|
2053
2068
|
...t,
|
|
2054
|
-
position:
|
|
2069
|
+
position: yn.toArray()
|
|
2055
2070
|
};
|
|
2056
2071
|
}
|
|
2057
2072
|
dispose() {
|
|
2058
|
-
removeEventListener(
|
|
2073
|
+
removeEventListener(mn, this.onWellboreAdded), removeEventListener(hn, this.onWellboreRemoved);
|
|
2059
2074
|
}
|
|
2060
|
-
},
|
|
2075
|
+
}, xn = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs", Sn = class {
|
|
2061
2076
|
utmDef;
|
|
2062
2077
|
originWgs84;
|
|
2063
2078
|
originUtm;
|
|
2064
2079
|
_projection;
|
|
2065
2080
|
constructor(e, t, n = "lnglat") {
|
|
2066
|
-
this.utmDef = e, this._projection =
|
|
2081
|
+
this.utmDef = e, this._projection = re(xn, e), n === "lnglat" ? (this.originWgs84 = t, this.originUtm = this.wgs84ToUtm(t)) : (this.originWgs84 = this.utmToWgs84(t), this.originUtm = t);
|
|
2067
2082
|
}
|
|
2068
2083
|
utmToWgs84(e) {
|
|
2069
2084
|
return this._projection.inverse(e);
|
|
@@ -2098,11 +2113,11 @@ var dn = class {
|
|
|
2098
2113
|
};
|
|
2099
2114
|
}
|
|
2100
2115
|
};
|
|
2101
|
-
function
|
|
2116
|
+
function Cn(e) {
|
|
2102
2117
|
let [, t, n] = (/* @__PURE__ */ new RegExp(/^([0-9]{2})([N|S]?)$/)).exec(e) || [];
|
|
2103
2118
|
return `+proj=utm +zone=${t}${n === "S" ? " +south" : ""} +ellps=intl +towgs84=-87,-98,-121,0,0,0,0 +units=m +no_defs`;
|
|
2104
2119
|
}
|
|
2105
|
-
function
|
|
2120
|
+
function wn([e, t]) {
|
|
2106
2121
|
if (t > 55 && t < 64 && e > 2 && e < 6) return "32N";
|
|
2107
2122
|
if (t > 71 && e >= 6 && e < 9) return "31N";
|
|
2108
2123
|
if (t > 71 && (e >= 9 && e < 12 || e >= 18 && e < 21)) return "33N";
|
|
@@ -2115,25 +2130,25 @@ function Cn([e, t]) {
|
|
|
2115
2130
|
}
|
|
2116
2131
|
//#endregion
|
|
2117
2132
|
//#region src/sdk/utils/colors.ts
|
|
2118
|
-
var
|
|
2119
|
-
function
|
|
2133
|
+
var Tn = (e) => `#${e.toString(16).padStart(6, "0")}`;
|
|
2134
|
+
function En() {
|
|
2120
2135
|
let e = "#";
|
|
2121
2136
|
for (let t = 0; t < 6; t++) e += "123456789ABCDEF"[Math.floor(Math.random() * 16)];
|
|
2122
2137
|
return e;
|
|
2123
2138
|
}
|
|
2124
2139
|
//#endregion
|
|
2125
2140
|
//#region src/sdk/utils/conversions.ts
|
|
2126
|
-
function
|
|
2141
|
+
function Dn(e) {
|
|
2127
2142
|
return e / 3.28084;
|
|
2128
2143
|
}
|
|
2129
|
-
function
|
|
2144
|
+
function On(e) {
|
|
2130
2145
|
return Math.PI / 180 * e;
|
|
2131
2146
|
}
|
|
2132
|
-
var
|
|
2147
|
+
var kn = (e, t = 1, n = 1) => [e[0] / t * 2 - 1, -(e[1] / n) * 2 + 1], An = (e, t = 1, n = 1) => [(e[0] + 1) / 2 * t, (1 - e[1]) / 2 * n], jn = "#include <common>\n\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = vec4(position, 1.0);\n}", Mn = "#include <common>\n#include <packing>\n\nvarying vec2 vUv;\nuniform sampler2D depthTexture;\nuniform float cameraFar;\nuniform float cameraNear;\n\nfloat linearizeDepth(in float depth) {\n float a = cameraFar / (cameraFar - cameraNear);\n float b = cameraFar * cameraNear / (cameraNear - cameraFar);\n\n return a + b / depth;\n}\n\nfloat linearizeLogDepth(in float depth) {\n float z = exp2(depth * log2(cameraFar + 1.0)) - 1.0;\n return linearizeDepth(z);\n}\n\nvoid main() {\n float depth = texture(depthTexture, vUv).r;\n float viewZ;\n #if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) || defined( USE_LOGDEPTHBUF ) \n viewZ = linearizeLogDepth(depth);\n #else\n viewZ = depth;\n #endif\n\n gl_FragColor = packDepthToRGBA(viewZ);\n}", Nn = class extends S {
|
|
2133
2148
|
constructor() {
|
|
2134
2149
|
super({
|
|
2135
|
-
vertexShader:
|
|
2136
|
-
fragmentShader:
|
|
2150
|
+
vertexShader: jn,
|
|
2151
|
+
fragmentShader: Mn,
|
|
2137
2152
|
uniforms: {
|
|
2138
2153
|
cameraNear: { value: 0 },
|
|
2139
2154
|
cameraFar: { value: 1 },
|
|
@@ -2145,20 +2160,20 @@ var On = (e, t = 1, n = 1) => [e[0] / t * 2 - 1, -(e[1] / n) * 2 + 1], kn = (e,
|
|
|
2145
2160
|
depthTest: !1
|
|
2146
2161
|
});
|
|
2147
2162
|
}
|
|
2148
|
-
},
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2163
|
+
}, Pn = 255 / 256, Fn = new Float32Array([
|
|
2164
|
+
Pn,
|
|
2165
|
+
Pn / 256,
|
|
2166
|
+
Pn / 256 ** 2,
|
|
2167
|
+
Pn / 256 ** 3
|
|
2153
2168
|
]);
|
|
2154
|
-
function
|
|
2155
|
-
return e / 255 *
|
|
2169
|
+
function In(e, t, n, r) {
|
|
2170
|
+
return e / 255 * Fn[0] + t / 255 * Fn[1] + n / 255 * Fn[2] + r / 255 * Fn[3];
|
|
2156
2171
|
}
|
|
2157
2172
|
//#endregion
|
|
2158
2173
|
//#region src/sdk/utils/depth-reader.ts
|
|
2159
|
-
var
|
|
2160
|
-
|
|
2161
|
-
async function
|
|
2174
|
+
var Ln = new p(-1, 1, 1, -1, 0, 1), Rn = new Nn(), zn = new b(), Bn = new c(new h(2, 2), Rn), Q = null, $ = null;
|
|
2175
|
+
zn.add(Bn);
|
|
2176
|
+
async function Vn(e, t, n, r) {
|
|
2162
2177
|
if (!e) return null;
|
|
2163
2178
|
try {
|
|
2164
2179
|
let { width: i, height: a } = e;
|
|
@@ -2167,12 +2182,12 @@ async function Bn(e, t, n, r) {
|
|
|
2167
2182
|
format: g,
|
|
2168
2183
|
depthBuffer: !1,
|
|
2169
2184
|
stencilBuffer: !1
|
|
2170
|
-
})),
|
|
2185
|
+
})), Rn.uniforms.depthTexture.value = e, Rn.uniforms.cameraNear.value = n.near, Rn.uniforms.cameraFar.value = n.far, Rn.uniforms.cameraWasPerspective.value = n.isPerspectiveCamera, t.setRenderTarget(Q), t.clear(), t.render(zn, Ln), t.setRenderTarget(null), await t.readRenderTargetPixelsAsync(Q, 0, 0, i, a, $), r !== void 0 && Number.isFinite(r)) return In($[r], $[r + 1], $[r + 2], $[r + 3]) * 2 - 1;
|
|
2171
2186
|
{
|
|
2172
2187
|
let e = Array($.length / 4);
|
|
2173
2188
|
for (let t = 0; t < e.length; t++) {
|
|
2174
2189
|
let n = t * 4;
|
|
2175
|
-
e[t] =
|
|
2190
|
+
e[t] = In($[n], $[n + 1], $[n + 2], $[n + 3]) * 2 - 1;
|
|
2176
2191
|
}
|
|
2177
2192
|
return e;
|
|
2178
2193
|
}
|
|
@@ -2182,10 +2197,10 @@ async function Bn(e, t, n, r) {
|
|
|
2182
2197
|
}
|
|
2183
2198
|
//#endregion
|
|
2184
2199
|
//#region src/sdk/utils/elevation-map.ts
|
|
2185
|
-
function
|
|
2186
|
-
return H(
|
|
2200
|
+
function Hn(e, t, n) {
|
|
2201
|
+
return U(H(B(e, t), B(e, n)));
|
|
2187
2202
|
}
|
|
2188
|
-
function
|
|
2203
|
+
function Un(e, t, n, r, i = 0, a = -1) {
|
|
2189
2204
|
let o = e.length / t, s = t - 1, c = o - 1, l = new Uint8Array(s * c * 4), u = 0, d = (n, r) => e[r * t + n];
|
|
2190
2205
|
for (let e = 0; e < c; e++) {
|
|
2191
2206
|
let t = e + 1, o = e + .5;
|
|
@@ -2212,7 +2227,7 @@ function Hn(e, t, n, r, i = 0, a = -1) {
|
|
|
2212
2227
|
f * n,
|
|
2213
2228
|
o * r,
|
|
2214
2229
|
g
|
|
2215
|
-
], S =
|
|
2230
|
+
], S = Hn(x, _, y), C = Hn(x, y, b), w = Hn(x, b, v), T = Hn(x, v, _), E = Ne(U([
|
|
2216
2231
|
S[0] + C[0] + w[0] + T[0],
|
|
2217
2232
|
S[2] + C[2] + w[2] + T[2],
|
|
2218
2233
|
S[1] + C[1] + w[1] + T[1]
|
|
@@ -2228,15 +2243,15 @@ function Hn(e, t, n, r, i = 0, a = -1) {
|
|
|
2228
2243
|
}
|
|
2229
2244
|
return l;
|
|
2230
2245
|
}
|
|
2231
|
-
function
|
|
2246
|
+
function Wn(e, t, n) {
|
|
2232
2247
|
let r = new i(e, t, n);
|
|
2233
2248
|
return r.minFilter = o, r.magFilter = o, r.flipY = !0, r.anisotropy = 4, r.needsUpdate = !0, r;
|
|
2234
2249
|
}
|
|
2235
|
-
function
|
|
2250
|
+
function Gn(e, t, n) {
|
|
2236
2251
|
let r = new i(e, t, n, v, a);
|
|
2237
2252
|
return r.minFilter = o, r.magFilter = o, r.needsUpdate = !0, r.flipY = !0, r;
|
|
2238
2253
|
}
|
|
2239
|
-
function
|
|
2254
|
+
function Kn(e, t, n, r, i) {
|
|
2240
2255
|
let a = new Uint8Array(t * n * 2), o = (r, i) => {
|
|
2241
2256
|
let a = r < 0 ? 0 : r >= n ? n - 1 : r, o = i < 0 ? 0 : i >= t ? t - 1 : i;
|
|
2242
2257
|
return e[a * t + o];
|
|
@@ -2262,23 +2277,23 @@ function Gn(e, t, n, r, i) {
|
|
|
2262
2277
|
i
|
|
2263
2278
|
];
|
|
2264
2279
|
if (e >= 0 && t >= 0) {
|
|
2265
|
-
let e =
|
|
2280
|
+
let e = H(m, p);
|
|
2266
2281
|
u += e[0], d += e[1], f += e[2];
|
|
2267
2282
|
}
|
|
2268
2283
|
if (t >= 0 && c >= 0) {
|
|
2269
|
-
let e =
|
|
2284
|
+
let e = H(g, m);
|
|
2270
2285
|
u += e[0], d += e[1], f += e[2];
|
|
2271
2286
|
}
|
|
2272
2287
|
if (a >= 0 && c >= 0) {
|
|
2273
|
-
let e =
|
|
2288
|
+
let e = H(h, g);
|
|
2274
2289
|
u += e[0], d += e[1], f += e[2];
|
|
2275
2290
|
}
|
|
2276
2291
|
if (c >= 0 && e >= 0) {
|
|
2277
|
-
let e =
|
|
2292
|
+
let e = H(p, h);
|
|
2278
2293
|
u += e[0], d += e[1], f += e[2];
|
|
2279
2294
|
}
|
|
2280
2295
|
}
|
|
2281
|
-
let p =
|
|
2296
|
+
let p = U([
|
|
2282
2297
|
u,
|
|
2283
2298
|
d,
|
|
2284
2299
|
f
|
|
@@ -2287,13 +2302,13 @@ function Gn(e, t, n, r, i) {
|
|
|
2287
2302
|
}
|
|
2288
2303
|
return a;
|
|
2289
2304
|
}
|
|
2290
|
-
function
|
|
2305
|
+
function qn(e, t, n) {
|
|
2291
2306
|
let r = new i(e, t, n, _, k);
|
|
2292
2307
|
return r.minFilter = o, r.magFilter = o, r.flipY = !0, r.needsUpdate = !0, r;
|
|
2293
2308
|
}
|
|
2294
2309
|
//#endregion
|
|
2295
2310
|
//#region src/sdk/utils/glyphs.ts
|
|
2296
|
-
function
|
|
2311
|
+
function Jn(e) {
|
|
2297
2312
|
let t = new Map(e.chars.map((e, t) => [e.id, {
|
|
2298
2313
|
index: t,
|
|
2299
2314
|
spacing: e.xadvance
|
|
@@ -2346,7 +2361,7 @@ function qn(e) {
|
|
|
2346
2361
|
}
|
|
2347
2362
|
//#endregion
|
|
2348
2363
|
//#region src/sdk/utils/irapbin-parser.ts
|
|
2349
|
-
async function
|
|
2364
|
+
async function Yn(e, t = -1, n = null) {
|
|
2350
2365
|
let r = await e.arrayBuffer(), i = new DataView(r), a = {
|
|
2351
2366
|
ny: i.getInt32(8, !1),
|
|
2352
2367
|
xori: i.getFloat32(12, !1),
|
|
@@ -2370,15 +2385,15 @@ async function Jn(e, t = -1, n = null) {
|
|
|
2370
2385
|
}
|
|
2371
2386
|
//#endregion
|
|
2372
2387
|
//#region src/sdk/utils/num-array.ts
|
|
2373
|
-
function
|
|
2388
|
+
function Xn(e) {
|
|
2374
2389
|
return e.map((e) => -e);
|
|
2375
2390
|
}
|
|
2376
|
-
function
|
|
2391
|
+
function Zn(e, t) {
|
|
2377
2392
|
return e.map((e) => e * t);
|
|
2378
2393
|
}
|
|
2379
2394
|
//#endregion
|
|
2380
2395
|
//#region src/sdk/utils/scene.ts
|
|
2381
|
-
function
|
|
2396
|
+
function Qn(e, t, n) {
|
|
2382
2397
|
let r = (n) => {
|
|
2383
2398
|
if (n.userData[e] && n.userData[e] === t) return n;
|
|
2384
2399
|
if (n.children && n.children.length) for (let e = 0; e < n.children.length; e++) {
|
|
@@ -2391,7 +2406,7 @@ function Zn(e, t, n) {
|
|
|
2391
2406
|
}
|
|
2392
2407
|
//#endregion
|
|
2393
2408
|
//#region src/sdk/utils/segments.ts
|
|
2394
|
-
function
|
|
2409
|
+
function $n(e, t, n) {
|
|
2395
2410
|
if (e.length === 0) return [];
|
|
2396
2411
|
e.sort((e, n) => t(e) - t(n));
|
|
2397
2412
|
let r = [], i = {
|
|
@@ -2406,18 +2421,18 @@ function Qn(e, t, n) {
|
|
|
2406
2421
|
}
|
|
2407
2422
|
//#endregion
|
|
2408
2423
|
//#region src/sdk/utils/strings.ts
|
|
2409
|
-
function
|
|
2424
|
+
function er(e) {
|
|
2410
2425
|
let t = 0, n, r;
|
|
2411
2426
|
if (!e || e.length === 0) return t;
|
|
2412
2427
|
for (n = 0; n < e.length; n++) r = e.charCodeAt(n), t = (t << 5) - t + r, t |= 0;
|
|
2413
2428
|
return t;
|
|
2414
2429
|
}
|
|
2415
|
-
function
|
|
2430
|
+
function tr(e) {
|
|
2416
2431
|
return e.replace(/(^|\s)\S/g, (e) => e.toUpperCase());
|
|
2417
2432
|
}
|
|
2418
2433
|
//#endregion
|
|
2419
2434
|
//#region src/sdk/utils/typed-2d-array.ts
|
|
2420
|
-
var
|
|
2435
|
+
var nr = class e {
|
|
2421
2436
|
data;
|
|
2422
2437
|
columns;
|
|
2423
2438
|
rows;
|
|
@@ -2616,7 +2631,7 @@ var tr = class e {
|
|
|
2616
2631
|
};
|
|
2617
2632
|
//#endregion
|
|
2618
2633
|
//#region src/sdk/utils/typed-array.ts
|
|
2619
|
-
function
|
|
2634
|
+
function rr(e) {
|
|
2620
2635
|
let t = new Float32Array(e.length * 3);
|
|
2621
2636
|
for (let n = 0; n < e.length; n++) {
|
|
2622
2637
|
let r = n * 3;
|
|
@@ -2626,23 +2641,23 @@ function nr(e) {
|
|
|
2626
2641
|
}
|
|
2627
2642
|
//#endregion
|
|
2628
2643
|
//#region src/sdk/materials/shaderLib/oit.glsl
|
|
2629
|
-
var
|
|
2644
|
+
var ir = "#ifdef USE_OIT\n\nuniform float oitDepthFar; \nuniform vec2 oitScreenSize; \nuniform sampler2D oitMinDepthTexture; \nuniform int oitSkipFront; \nuniform float oitOcclusionThreshold; \n\nvec4 oitProcess(vec4 color) {\n #ifdef OIT_OCCLUSION_PASS\n \n \n \n \n \n if(color.a < oitOcclusionThreshold)\n discard;\n return color;\n #endif\n\n \n \n float linZ = abs(vViewPosition.z) / oitDepthFar;\n\n #ifdef OIT_DEPTH_PASS\n\n \n return vec4(linZ, 0.0, 0.0, 1.0);\n\n #else\n\n \n \n \n vec2 uv = gl_FragCoord.xy / oitScreenSize;\n float minZ = texture2D(oitMinDepthTexture, uv).r;\n \n \n \n \n \n \n float tol = minZ * 1e-3 + 1e-6;\n bool isFront = (linZ - minZ) <= tol;\n\n #ifdef OIT_FRONT_PASS\n\n \n if(!isFront)\n discard;\n return color;\n\n #else\n\n \n \n if(isFront && oitSkipFront == 0)\n discard;\n\n float alpha = color.a;\n\n \n \n \n \n \n float b = -log(1.0 - clamp(alpha, 0.0, 0.9999));\n return vec4(color.rgb * b, b);\n\n #endif \n #endif \n}\n\n#endif", ar = [
|
|
2630
2645
|
"color",
|
|
2631
2646
|
"emissive",
|
|
2632
2647
|
"emissiveIntensity",
|
|
2633
2648
|
"metalness",
|
|
2634
2649
|
"roughness"
|
|
2635
2650
|
];
|
|
2636
|
-
function
|
|
2651
|
+
function or(e) {
|
|
2637
2652
|
return !!e && typeof e.getOitVariants == "function" && typeof e.getOitUniforms == "function";
|
|
2638
2653
|
}
|
|
2639
|
-
function
|
|
2654
|
+
function sr(e) {
|
|
2640
2655
|
return e.isShaderMaterial === !0;
|
|
2641
2656
|
}
|
|
2642
|
-
function
|
|
2657
|
+
function cr(e) {
|
|
2643
2658
|
return typeof e == "object" && !!e && typeof e.copy == "function";
|
|
2644
2659
|
}
|
|
2645
|
-
function
|
|
2660
|
+
function lr() {
|
|
2646
2661
|
return {
|
|
2647
2662
|
oitDepthFar: new E(1),
|
|
2648
2663
|
oitScreenSize: new E(new j(1, 1)),
|
|
@@ -2651,13 +2666,13 @@ function cr() {
|
|
|
2651
2666
|
oitOcclusionThreshold: new E(1)
|
|
2652
2667
|
};
|
|
2653
2668
|
}
|
|
2654
|
-
var
|
|
2669
|
+
var ur = {
|
|
2655
2670
|
depthMin: "OIT_DEPTH_PASS",
|
|
2656
2671
|
accum: null,
|
|
2657
2672
|
front: "OIT_FRONT_PASS",
|
|
2658
2673
|
occlusion: "OIT_OCCLUSION_PASS"
|
|
2659
2674
|
};
|
|
2660
|
-
function
|
|
2675
|
+
function dr(t, n, i) {
|
|
2661
2676
|
switch (t.transparent = !0, t.depthTest = !0, t.depthWrite = !1, t.blending = r, t.toneMapped = !1, i !== void 0 && (t.side = i), n) {
|
|
2662
2677
|
case "depthMin":
|
|
2663
2678
|
t.blendEquation = l, t.blendSrc = d, t.blendDst = d, t.blendEquationAlpha = l, t.blendSrcAlpha = d, t.blendDstAlpha = d;
|
|
@@ -2673,7 +2688,7 @@ function ur(t, n, i) {
|
|
|
2673
2688
|
break;
|
|
2674
2689
|
}
|
|
2675
2690
|
}
|
|
2676
|
-
function
|
|
2691
|
+
function fr(e) {
|
|
2677
2692
|
let t = e;
|
|
2678
2693
|
return [
|
|
2679
2694
|
JSON.stringify(t.defines ?? {}),
|
|
@@ -2683,16 +2698,16 @@ function dr(e) {
|
|
|
2683
2698
|
+!!e.vertexColors
|
|
2684
2699
|
].join("|");
|
|
2685
2700
|
}
|
|
2686
|
-
function
|
|
2701
|
+
function pr(e, t, n) {
|
|
2687
2702
|
let r = t, i = e, a = {
|
|
2688
2703
|
...r.defines ?? {},
|
|
2689
2704
|
USE_OIT: ""
|
|
2690
|
-
}, o =
|
|
2705
|
+
}, o = ur[n];
|
|
2691
2706
|
o && (a[o] = ""), i.defines = a, "wireframe" in r && (i.wireframe = r.wireframe), "flatShading" in r && (i.flatShading = r.flatShading), r.uniformsGroups && (i.uniformsGroups = r.uniformsGroups), e.vertexColors = t.vertexColors, e.needsUpdate = !0;
|
|
2692
2707
|
}
|
|
2693
|
-
function
|
|
2708
|
+
function mr(e, t, n) {
|
|
2694
2709
|
let r;
|
|
2695
|
-
if (
|
|
2710
|
+
if (sr(e)) {
|
|
2696
2711
|
let t = new S();
|
|
2697
2712
|
t.copy(e), t.uniforms = e.uniforms, r = t;
|
|
2698
2713
|
} else r = e.clone();
|
|
@@ -2700,37 +2715,37 @@ function pr(e, t, n) {
|
|
|
2700
2715
|
let t = e, i = r;
|
|
2701
2716
|
for (let e of n.shareUniforms) i[e] = t[e];
|
|
2702
2717
|
}
|
|
2703
|
-
return r.onBeforeCompile = e.onBeforeCompile, r.customProgramCacheKey = e.customProgramCacheKey,
|
|
2718
|
+
return r.onBeforeCompile = e.onBeforeCompile, r.customProgramCacheKey = e.customProgramCacheKey, dr(r, t, n?.side), pr(r, e, t), r;
|
|
2704
2719
|
}
|
|
2705
|
-
var
|
|
2720
|
+
var hr = [
|
|
2706
2721
|
"depthMin",
|
|
2707
2722
|
"accum",
|
|
2708
2723
|
"front",
|
|
2709
2724
|
"occlusion"
|
|
2710
2725
|
];
|
|
2711
|
-
function
|
|
2712
|
-
let r = e, i = null, a = "", o = !
|
|
2726
|
+
function gr(e, t, n) {
|
|
2727
|
+
let r = e, i = null, a = "", o = !sr(e), c = e, l = o && n?.syncProperties ? n.syncProperties.filter((e) => e !== "opacity" && e in c) : [];
|
|
2713
2728
|
r.getOitUniforms = () => t, r.getOitVariants = () => {
|
|
2714
2729
|
if (!i) i = {
|
|
2715
|
-
depthMin:
|
|
2716
|
-
accum:
|
|
2717
|
-
front:
|
|
2718
|
-
occlusion:
|
|
2719
|
-
}, a =
|
|
2730
|
+
depthMin: mr(e, "depthMin", n),
|
|
2731
|
+
accum: mr(e, "accum", n),
|
|
2732
|
+
front: mr(e, "front", n),
|
|
2733
|
+
occlusion: mr(e, "occlusion", n)
|
|
2734
|
+
}, a = fr(e);
|
|
2720
2735
|
else {
|
|
2721
|
-
let t =
|
|
2736
|
+
let t = fr(e);
|
|
2722
2737
|
if (t !== a) {
|
|
2723
2738
|
a = t;
|
|
2724
|
-
for (let t of
|
|
2739
|
+
for (let t of hr) pr(i[t], e, t);
|
|
2725
2740
|
}
|
|
2726
2741
|
}
|
|
2727
|
-
if (o) for (let t of
|
|
2742
|
+
if (o) for (let t of hr) {
|
|
2728
2743
|
let n = i[t];
|
|
2729
2744
|
if (n.opacity = e.opacity, l.length) {
|
|
2730
2745
|
let e = n;
|
|
2731
2746
|
for (let t of l) {
|
|
2732
2747
|
let n = c[t], r = e[t];
|
|
2733
|
-
|
|
2748
|
+
cr(r) && cr(n) && r.constructor === n.constructor ? r.copy(n) : e[t] = n;
|
|
2734
2749
|
}
|
|
2735
2750
|
}
|
|
2736
2751
|
}
|
|
@@ -2739,15 +2754,15 @@ function hr(e, t, n) {
|
|
|
2739
2754
|
let u = e.dispose.bind(e);
|
|
2740
2755
|
return e.dispose = () => {
|
|
2741
2756
|
if (i) {
|
|
2742
|
-
for (let e of
|
|
2757
|
+
for (let e of hr) s.prototype.dispose.call(i[e]);
|
|
2743
2758
|
i = null;
|
|
2744
2759
|
}
|
|
2745
2760
|
u();
|
|
2746
2761
|
}, r;
|
|
2747
2762
|
}
|
|
2748
|
-
function
|
|
2749
|
-
let n =
|
|
2750
|
-
return r.oitDepthFar ??= n.oitDepthFar, r.oitScreenSize ??= n.oitScreenSize, r.oitMinDepthTexture ??= n.oitMinDepthTexture, r.oitSkipFront ??= n.oitSkipFront, r.oitOcclusionThreshold ??= n.oitOcclusionThreshold,
|
|
2763
|
+
function _r(e, t) {
|
|
2764
|
+
let n = lr(), r = e.uniforms;
|
|
2765
|
+
return r.oitDepthFar ??= n.oitDepthFar, r.oitScreenSize ??= n.oitScreenSize, r.oitMinDepthTexture ??= n.oitMinDepthTexture, r.oitSkipFront ??= n.oitSkipFront, r.oitOcclusionThreshold ??= n.oitOcclusionThreshold, gr(e, {
|
|
2751
2766
|
oitDepthFar: r.oitDepthFar,
|
|
2752
2767
|
oitScreenSize: r.oitScreenSize,
|
|
2753
2768
|
oitMinDepthTexture: r.oitMinDepthTexture,
|
|
@@ -2755,12 +2770,12 @@ function gr(e, t) {
|
|
|
2755
2770
|
oitOcclusionThreshold: r.oitOcclusionThreshold
|
|
2756
2771
|
}, t);
|
|
2757
2772
|
}
|
|
2758
|
-
var
|
|
2759
|
-
function
|
|
2773
|
+
var vr = /\bvoid\s+main\s*\(\s*\)\s*\{/;
|
|
2774
|
+
function yr(e) {
|
|
2760
2775
|
return /\bvViewPosition\b/.test(e);
|
|
2761
2776
|
}
|
|
2762
|
-
function
|
|
2763
|
-
let t =
|
|
2777
|
+
function br(e) {
|
|
2778
|
+
let t = vr.exec(e);
|
|
2764
2779
|
if (!t) return null;
|
|
2765
2780
|
let n = t.index + t[0].length, r = 1;
|
|
2766
2781
|
for (let t = n; t < e.length; t++) {
|
|
@@ -2773,14 +2788,14 @@ function yr(e) {
|
|
|
2773
2788
|
}
|
|
2774
2789
|
return null;
|
|
2775
2790
|
}
|
|
2776
|
-
function
|
|
2777
|
-
let r =
|
|
2791
|
+
function xr(e, t, n) {
|
|
2792
|
+
let r = vr.exec(e);
|
|
2778
2793
|
if (!r) return e;
|
|
2779
|
-
let i = e.slice(0, r.index) + t + e.slice(r.index), a =
|
|
2794
|
+
let i = e.slice(0, r.index) + t + e.slice(r.index), a = br(i);
|
|
2780
2795
|
return a ? i.slice(0, a.close) + n + i.slice(a.close) : i;
|
|
2781
2796
|
}
|
|
2782
|
-
function
|
|
2783
|
-
let n =
|
|
2797
|
+
function Sr(e, t) {
|
|
2798
|
+
let n = lr(), r = sr(e) ? e : null;
|
|
2784
2799
|
if (r) {
|
|
2785
2800
|
let e = r.uniforms;
|
|
2786
2801
|
e.oitDepthFar ??= n.oitDepthFar, e.oitScreenSize ??= n.oitScreenSize, e.oitMinDepthTexture ??= n.oitMinDepthTexture, e.oitSkipFront ??= n.oitSkipFront, e.oitOcclusionThreshold ??= n.oitOcclusionThreshold;
|
|
@@ -2788,23 +2803,23 @@ function xr(e, t) {
|
|
|
2788
2803
|
let i = e.onBeforeCompile;
|
|
2789
2804
|
return e.onBeforeCompile = function(e, t) {
|
|
2790
2805
|
i?.call(this, e, t), e.uniforms.oitDepthFar = n.oitDepthFar, e.uniforms.oitScreenSize = n.oitScreenSize, e.uniforms.oitMinDepthTexture = n.oitMinDepthTexture, e.uniforms.oitSkipFront = n.oitSkipFront, e.uniforms.oitOcclusionThreshold = n.oitOcclusionThreshold;
|
|
2791
|
-
let r = !
|
|
2792
|
-
e.fragmentShader =
|
|
2793
|
-
}, e.needsUpdate = !0,
|
|
2806
|
+
let r = !yr(e.fragmentShader), a = (r ? "#ifdef USE_OIT\nvarying vec3 vViewPosition;\n#endif\n" : "") + "#ifdef USE_OIT\n" + ir + "\n#endif\n";
|
|
2807
|
+
e.fragmentShader = xr(e.fragmentShader, a, "\n#ifdef USE_OIT\n gl_FragColor = oitProcess(gl_FragColor);\n#endif\n"), r && (e.vertexShader = xr(e.vertexShader, "#ifdef USE_OIT\nvarying vec3 vViewPosition;\n#endif\n", "\n#ifdef USE_OIT\n vViewPosition = -(modelViewMatrix * vec4(position, 1.0)).xyz;\n#endif\n"));
|
|
2808
|
+
}, e.needsUpdate = !0, gr(e, n, t);
|
|
2794
2809
|
}
|
|
2795
2810
|
//#endregion
|
|
2796
2811
|
//#region src/sdk/materials/shaders/trajectory/fragment.glsl
|
|
2797
|
-
var
|
|
2812
|
+
var Cr = "#define TRAJECTORY_MATERIAL\n\nuniform vec3 diffuse;\nuniform float opacity;\n\n#ifndef FLAT_SHADED\nvarying vec3 vNormal;\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvec3 hue2rgb(in float H) {\n float R = abs(H * 6. - 3.) - 1.;\n float G = 2. - abs(H * 6. - 2.);\n float B = 2. - abs(H * 6. - 4.);\n return saturate(vec3(R, G, B));\n}\n\nvec3 hsl2rgb(in vec3 HSL) {\n vec3 RGB = hue2rgb(HSL.x);\n float C = (1. - abs(2. * HSL.z - 1.)) * HSL.y;\n return (RGB - 0.5) * C + HSL.z;\n}\n\nvec3 rgb2hsv(in vec3 RGB) {\n \n vec4 P = (RGB.g < RGB.b) ? vec4(RGB.bg, -1.0, 2.0 / 3.0) : vec4(RGB.gb, 0.0, -1.0 / 3.0);\n vec4 Q = (RGB.r < P.x) ? vec4(P.xyw, RGB.r) : vec4(RGB.r, P.yzx);\n float C = Q.x - min(Q.w, Q.y);\n float H = abs((Q.w - Q.y) / (6. * C + EPSILON) + Q.z);\n return vec3(H, C, Q.x);\n}\n\nvec3 rgb2hsl(in vec3 RGB) {\n vec3 HCV = rgb2hsv(RGB);\n float L = HCV.z - HCV.y * 0.5;\n float S = HCV.y / (1. - abs(L * 2. - 1.) + EPSILON);\n return vec3(HCV.x, S, L);\n}\n\nvec3 hsv2rgb(in vec3 HSV) {\n vec3 RGB = hue2rgb(HSV.x);\n return ((RGB - 1.) * HSV.y + 1.) * HSV.z;\n}\n\n#ifdef USE_OIT\n#ifdef USE_OIT\n\nuniform float oitDepthFar; \nuniform vec2 oitScreenSize; \nuniform sampler2D oitMinDepthTexture; \nuniform int oitSkipFront; \nuniform float oitOcclusionThreshold; \n\nvec4 oitProcess(vec4 color) {\n #ifdef OIT_OCCLUSION_PASS\n \n \n \n \n \n if(color.a < oitOcclusionThreshold)\n discard;\n return color;\n #endif\n\n \n \n float linZ = abs(vViewPosition.z) / oitDepthFar;\n\n #ifdef OIT_DEPTH_PASS\n\n \n return vec4(linZ, 0.0, 0.0, 1.0);\n\n #else\n\n \n \n \n vec2 uv = gl_FragCoord.xy / oitScreenSize;\n float minZ = texture2D(oitMinDepthTexture, uv).r;\n \n \n \n \n \n \n float tol = minZ * 1e-3 + 1e-6;\n bool isFront = (linZ - minZ) <= tol;\n\n #ifdef OIT_FRONT_PASS\n\n \n if(!isFront)\n discard;\n return color;\n\n #else\n\n \n \n if(isFront && oitSkipFront == 0)\n discard;\n\n float alpha = color.a;\n\n \n \n \n \n \n float b = -log(1.0 - clamp(alpha, 0.0, 0.9999));\n return vec4(color.rgb * b, b);\n\n #endif \n #endif \n}\n\n#endif\n#endif\n\nvoid main() {\n #include <clipping_planes_fragment>\n\n vec3 color = diffuse.rgb;\n\n vec4 diffuseColor = vec4(color.rgb, opacity);\n\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <normal_fragment_begin>\n\n #ifdef DEPTH_SHADE\n float ndv = clamp(dot(normalize(vNormal), normalize(vViewPosition)), 0.0, 1.0);\n \n \n \n \n \n \n \n float ndvAA = max(ndv, fwidth(ndv));\n float depthFactor = pow(ndvAA, 0.8);\n float darkenFactor = clamp(vViewPosition.z / 5000.0, 0.1, 0.8);\n vec3 hsv = rgb2hsv(diffuseColor.rgb);\n hsv.z = hsv.z * darkenFactor;\n vec3 mixColor = hsv2rgb(hsv);\n diffuseColor.rgb = mix(mixColor, diffuseColor.rgb, depthFactor);\n #else\n float alphaFactor = clamp(vViewPosition.z / 100000.0, 0.0, 0.9);\n\n diffuseColor.a = 1.0 - alphaFactor;\n #endif\n\n gl_FragColor = diffuseColor.rgba;\n\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n\n #ifdef OPAQUE\n\n gl_FragColor.a = 1.0;\n\n #endif\n\n #ifdef USE_OIT\n gl_FragColor = oitProcess(gl_FragColor);\n #endif\n}", wr = "#define TRAJECTORY_MATERIAL\n\nvarying vec3 vViewPosition;\n\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_fragment>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n #include <uv_vertex>\n #include <color_vertex>\n #include <batching_vertex>\n #include <beginnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n\n #include <begin_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n\n vViewPosition = - mvPosition.xyz;\n\n #include <worldpos_vertex>\n #include <fog_vertex>\n}", Tr = class extends S {
|
|
2798
2813
|
isTubeMaterial = !0;
|
|
2799
2814
|
constructor(e) {
|
|
2800
2815
|
super({
|
|
2801
|
-
vertexShader:
|
|
2802
|
-
fragmentShader:
|
|
2816
|
+
vertexShader: wr,
|
|
2817
|
+
fragmentShader: Cr,
|
|
2803
2818
|
uniforms: O.clone(x.basic.uniforms),
|
|
2804
2819
|
defines: { DEPTH_SHADE: !0 },
|
|
2805
2820
|
clipping: !0,
|
|
2806
2821
|
fog: !0
|
|
2807
|
-
}), e && this.setValues(e),
|
|
2822
|
+
}), e && this.setValues(e), _r(this);
|
|
2808
2823
|
}
|
|
2809
2824
|
get color() {
|
|
2810
2825
|
return this.uniforms.diffuse.value;
|
|
@@ -2812,9 +2827,9 @@ var Sr = "#define TRAJECTORY_MATERIAL\n\nuniform vec3 diffuse;\nuniform float op
|
|
|
2812
2827
|
set color(e) {
|
|
2813
2828
|
this.uniforms.diffuse.value.set(e);
|
|
2814
2829
|
}
|
|
2815
|
-
},
|
|
2830
|
+
}, Er = new S({
|
|
2816
2831
|
vertexShader: "varying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n\n}",
|
|
2817
2832
|
fragmentShader: "varying vec2 vUv;\n\nvoid main() {\n \n gl_FragColor = vec4(vUv, 1.0, 1.0);\n\n}"
|
|
2818
2833
|
});
|
|
2819
2834
|
//#endregion
|
|
2820
|
-
export {
|
|
2835
|
+
export { Gt as $, we as $t, En as A, Xe as At, hn as B, Pe as Bt, Vn as C, de as Cn, ft as Ct, An as D, oe as Dn, ct as Dt, Dn as E, le as En, st as Et, bn as F, Me as Ft, an as G, ke as Gt, fn as H, Je as Ht, _n as I, W as It, Qt as J, Ge as Jt, rn as K, Le as Kt, vn as L, je as Lt, Cn as M, Ye as Mt, wn as N, Be as Nt, kn as O, ae as On, $e as Ot, xn as P, De as Pt, J as Q, Ue as Qt, gn as R, H as Rt, Hn as S, me as Sn, mt as St, On as T, se as Tn, ut as Tt, sn as U, Ie as Ut, pn as V, Fe as Vt, on as W, He as Wt, $t as X, Ke as Xt, en as Y, V as Yt, tn as Z, Ae as Zt, Kn as _, he as _n, gt as _t, or as a, Re as an, Xt as at, qn as b, fe as bn, q as bt, nr as c, B as cn, At as ct, $n as d, xe as dn, Tt as dt, ze as en, Kt as et, Qn as f, Se as fn, Ct as ft, Jn as g, ge as gn, yt as gt, Yn as h, R as hn, vt as ht, _r as i, Oe as in, Zt as it, Sn as j, Ze as jt, Tn as k, et as kt, er as l, z as ln, kt as lt, Xn as m, Ce as mn, bt as mt, Tr as n, Ne as nn, Jt as nt, Sr as o, Ee as on, Ot as ot, Zn as p, ye as pn, xt as pt, nn as q, Te as qt, ar as r, We as rn, qt as rt, rr as s, Ve as sn, jt as st, Er as t, U as tn, Yt as tt, tr as u, be as un, Dt as ut, Gn as v, _e as vn, _t as vt, Nn as w, ue as wn, pt as wt, Un as x, pe as xn, ht as xt, Wn as y, ve as yn, K as yt, mn as z, qe as zt };
|