@equinor/videx-3d 1.1.0 → 2.0.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.
Files changed (47) hide show
  1. package/README.md +120 -120
  2. package/dist/chunk-61X6qE5N.js +981 -0
  3. package/dist/chunk-ChG5d4HC.js +675 -0
  4. package/dist/{chunk-BolRQZt9.js → chunk-M-Pcc_Yg.js} +22 -20
  5. package/dist/generators.js +271 -260
  6. package/dist/main.js +5185 -3434
  7. package/dist/sdk.js +492 -316
  8. package/dist/shaderLib/oit.glsl +106 -0
  9. package/dist/types/components/Annotations/AutoUpdate.d.ts +1 -1
  10. package/dist/types/components/Annotations/index.d.ts +2 -2
  11. package/dist/types/components/Annotations/types.d.ts +3 -1
  12. package/dist/types/components/Annotations/update-annotations.d.ts +10 -0
  13. package/dist/types/components/EventEmitter/EventEmitterContext.d.ts +2 -1
  14. package/dist/types/components/EventEmitter/index.d.ts +1 -0
  15. package/dist/types/components/EventEmitter/picking-helper.d.ts +25 -0
  16. package/dist/types/components/EventEmitter/picking-material.d.ts +8 -5
  17. package/dist/types/components/Surfaces/Surface.d.ts +8 -1
  18. package/dist/types/components/Surfaces/SurfaceMaterial.d.ts +3 -0
  19. package/dist/types/components/Surfaces/surface-defs.d.ts +1 -0
  20. package/dist/types/components/Wellbores/Casings/CasingEmitterMaterial.d.ts +16 -0
  21. package/dist/types/components/Wellbores/Casings/CasingSection.d.ts +3 -2
  22. package/dist/types/components/Wellbores/Casings/Casings.d.ts +3 -2
  23. package/dist/types/generators/surface-generator.d.ts +1 -1
  24. package/dist/types/layers/layers.d.ts +4 -0
  25. package/dist/types/rendering/OitMaterial.d.ts +59 -0
  26. package/dist/types/rendering/Pass.d.ts +7 -0
  27. package/dist/types/rendering/RenderingPipeline.d.ts +37 -0
  28. package/dist/types/rendering/fullscreen-renderer.d.ts +1 -0
  29. package/dist/types/rendering/gpu-timer.d.ts +46 -0
  30. package/dist/types/rendering/index.d.ts +7 -1
  31. package/dist/types/rendering/oit-material.d.ts +122 -0
  32. package/dist/types/{components/Annotations/annotations-renderer.d.ts → rendering/passes/AnnotationsPass.d.ts} +13 -4
  33. package/dist/types/rendering/passes/FXAAPass.d.ts +12 -0
  34. package/dist/types/rendering/passes/OITRenderPass.d.ts +282 -0
  35. package/dist/types/rendering/passes/OutputPass.d.ts +10 -0
  36. package/dist/types/rendering/passes/RenderPass.d.ts +8 -0
  37. package/dist/types/rendering/passes/SMAAPass.d.ts +40 -0
  38. package/dist/types/rendering/passes/TAAPass.d.ts +94 -0
  39. package/dist/types/rendering/passes/index.d.ts +6 -0
  40. package/dist/types/rendering/rendering-state.d.ts +59 -0
  41. package/dist/types/sdk/index.d.ts +2 -0
  42. package/dist/types/sdk/utils/elevation-map.d.ts +23 -0
  43. package/dist/types/sdk/utils/trigonometry.d.ts +4 -1
  44. package/package.json +1 -1
  45. package/dist/chunk-CnY6Tmof.js +0 -358
  46. package/dist/chunk-iY0wQ9Z6.js +0 -887
  47. package/dist/types/rendering/render-passes.d.ts +0 -16
@@ -1,887 +0,0 @@
1
- import { EPS as at, CurveInterpolator as it } from "curve-interpolator";
2
- import { BufferGeometry as X, BufferAttribute as U, Vector3 as v, ShaderMaterial as Y, OrthographicCamera as ct, Scene as lt, PlaneGeometry as ut, Mesh as dt, WebGLRenderTarget as ft, RGBAFormat as mt, UnsignedByteType as gt } from "three";
3
- async function Wt(t, e, r, n) {
4
- const o = await r.get("formations", t) || [];
5
- n = n === void 0 ? -1 / 0 : n;
6
- const s = o.filter(
7
- (a) => a.stratColumnId === e && a.exit.mdMsl > n
8
- );
9
- return s.sort(
10
- (a, i) => a.entry.mdMsl - i.entry.mdMsl || a.level - i.level
11
- ), s.length && s[0].entry.mdMsl < n && (s[0].entry.mdMsl = n), s;
12
- }
13
- function O(t, e, r) {
14
- return {
15
- mdMslFrom: e,
16
- mdMslTo: r,
17
- name: t.name,
18
- level: t.level,
19
- color: t.color,
20
- properties: { ...t.properties || {} }
21
- };
22
- }
23
- function St(t) {
24
- if (!t.length) return [];
25
- let e = [];
26
- const r = [...t].sort((n, o) => {
27
- const s = o.level - n.level || n.entry.mdMsl - o.entry.mdMsl;
28
- if (s === 0 && (n.properties?.updated || o.properties?.updated)) {
29
- const a = n.properties?.updated ? new Date(n.properties?.updated) : null, i = o.properties?.updated ? new Date(o.properties?.updated) : null;
30
- return a === null ? 1 : i === null ? -1 : i.getTime() - a.getTime();
31
- }
32
- return s;
33
- });
34
- for (let n = 0; n < r.length; n++) {
35
- const o = r[n];
36
- let s = o.entry.mdMsl;
37
- const a = [...e];
38
- for (let i = 0; i < e.length && s < o.exit.mdMsl; i++) {
39
- const c = e[i];
40
- if (s < c.mdMslFrom) {
41
- const l = Math.min(o.exit.mdMsl, c.mdMslFrom);
42
- a.push(O(o, s, l));
43
- }
44
- s = Math.max(s, c.mdMslTo);
45
- }
46
- s < o.exit.mdMsl && a.push(
47
- O(o, s, o.exit.mdMsl)
48
- ), e = a.sort((i, c) => i.mdMslFrom - c.mdMslFrom);
49
- }
50
- return e;
51
- }
52
- function zt(t) {
53
- const e = [], r = [...t].sort(
54
- (s, a) => s.entry.mdMsl - a.entry.mdMsl || a.level - s.level
55
- );
56
- let n = null, o = -1 / 0;
57
- for (let s = 0; s < r.length; s++) {
58
- const a = r[s];
59
- a.entry.mdMsl > o && (o = a.entry.mdMsl, n && n.exit.mdMsl < o && e.push({
60
- color: n.color,
61
- name: n.name,
62
- type: "base",
63
- mdMsl: n.exit.mdMsl,
64
- tvdMsl: n.exit.tvdMsl,
65
- level: n.level
66
- }), e.push({
67
- color: a.color,
68
- name: a.name,
69
- type: "top",
70
- mdMsl: o,
71
- tvdMsl: a.entry.tvdMsl,
72
- level: a.level
73
- }), n = a);
74
- }
75
- return n && e.push({
76
- color: n.color,
77
- name: n.name,
78
- type: "base",
79
- mdMsl: n.exit.mdMsl,
80
- tvdMsl: n.exit.tvdMsl,
81
- level: n.level
82
- }), e;
83
- }
84
- function B(t, e = 0, r = 1) {
85
- return t < e ? e : t > r ? r : t;
86
- }
87
- function ht(t, e, r) {
88
- return r = B(r, 0, 1), (1 - r) * t + r * e;
89
- }
90
- function pt(t, e, r) {
91
- return (t - e) / (r - e);
92
- }
93
- function Nt(t, e, r, n, o) {
94
- const s = pt(t, e, r);
95
- return ht(n, o, s);
96
- }
97
- const jt = (t) => {
98
- if (t < 0) return [0, 0, 0];
99
- if (t > 16777.215) throw Error("Value out of range!");
100
- const e = Math.round(t * 1e3), r = Math.floor(e / 65536), n = Math.floor(e / 256) - r * 256, o = Math.floor(e) - r * 65536 - n * 256;
101
- return [r, n, o];
102
- }, _t = Math.PI, H = 2 * Math.PI, yt = Math.PI / 2, Gt = Math.PI / 4, qt = Math.PI / 8;
103
- function Zt(t, e) {
104
- for (; e < -Math.PI; )
105
- e += H;
106
- for (; e > Math.PI; )
107
- e -= H;
108
- const r = Math.atan2(t[1], t[0]), n = Math.tan(e);
109
- let o;
110
- e > -r && e <= r ? o = 1 : e > r && e <= Math.PI - r ? o = 2 : e > Math.PI - r || e <= -(Math.PI - r) ? o = 3 : o = 4;
111
- const s = [0, 0];
112
- let a = 1, i = 1;
113
- switch (o) {
114
- case 1:
115
- i = -1;
116
- break;
117
- case 2:
118
- i = -1;
119
- break;
120
- case 3:
121
- a = -1;
122
- break;
123
- case 4:
124
- a = -1;
125
- break;
126
- }
127
- return o === 1 || o === 3 ? (s[0] += a * (t[0] / 2), s[1] += i * (t[0] / 2) * n) : (s[0] += a * (t[1] / (2 * n)), s[1] += i * (t[1] / 2)), s;
128
- }
129
- function Ot(t) {
130
- return t[0] = -t[0], t[1] = -t[1], t[2] = -t[2], t;
131
- }
132
- function Ht(t, e) {
133
- return [t[e], t[e + 1], t[e + 2]];
134
- }
135
- function $t(t, e, r) {
136
- t[e] = r[0], t[e + 1] = r[1], t[e + 2] = r[2];
137
- }
138
- function Qt(t, e) {
139
- return [t[0] + e[0], t[1] + e[1], t[2] + e[2]];
140
- }
141
- function tt(t, e) {
142
- return [t[0] - e[0], t[1] - e[1], t[2] - e[2]];
143
- }
144
- function Jt(t, e) {
145
- return t[0] = t[0] * e, t[1] = t[1] * e, t[2] = t[2] * e, t;
146
- }
147
- function et(t) {
148
- const e = t[0] ** 2 + t[1] ** 2 + t[2] ** 2;
149
- return e > 0 ? Math.sqrt(e) : 0;
150
- }
151
- function E(t, e) {
152
- return [
153
- t[1] * e[2] - t[2] * e[1],
154
- t[2] * e[0] - t[0] * e[2],
155
- t[0] * e[1] - t[1] * e[0]
156
- ];
157
- }
158
- function q(t, e) {
159
- return t[0] * e[0] + t[1] * e[1] + t[2] * e[2];
160
- }
161
- function z(t) {
162
- const e = Math.sqrt(t[0] * t[0] + t[1] * t[1] + t[2] * t[2]);
163
- return e ? (t[0] = t[0] / e, t[1] = t[1] / e, t[2] = t[2] / e, t) : [0, 0, 0];
164
- }
165
- function Kt(t, e, r = 0.5) {
166
- const n = 1 - r;
167
- return [
168
- t[0] * n + e[0] * r,
169
- t[1] * n + e[1] * r,
170
- t[2] * n + e[2] * r
171
- ];
172
- }
173
- function Mt(t) {
174
- return [t[0], t[1], t[2]];
175
- }
176
- function Xt(t, e) {
177
- const r = Math.sqrt(
178
- (t[0] ** 2 + t[1] ** 2 + t[2] ** 2) * (e[0] ** 2 + e[1] ** 2 + e[2] ** 2)
179
- );
180
- if (r === 0) return yt;
181
- const n = q(t, e) / r;
182
- return Math.acos(B(n, -1, 1));
183
- }
184
- function At(t, e = [0, 1, 0], r = 0) {
185
- const n = Math.cos(r), o = Math.sin(r), s = 1 - n, a = t[0], i = t[1], c = t[2], l = e[0], d = e[1], f = e[2], m = s * l, u = s * d;
186
- return [
187
- (m * l + n) * a + (m * d - o * f) * i + (m * f + o * d) * c,
188
- (m * d + o * f) * a + (u * d + n) * i + (u * f - o * l) * c,
189
- (m * f - o * d) * a + (u * f + o * l) * i + (s * f * f + n) * c
190
- ];
191
- }
192
- function Yt(t, e) {
193
- return z(tt(e, t));
194
- }
195
- function te(t, e) {
196
- return et(tt(e, t));
197
- }
198
- function ee(t, e) {
199
- return [t[e], t[e + 1]];
200
- }
201
- function ne(t, e, r) {
202
- t[e] = r[0], t[e + 1] = r[1];
203
- }
204
- function nt(t) {
205
- const e = Math.sqrt(t[0] * t[0] + t[1] * t[1]);
206
- return e ? (t[0] = t[0] / e, t[1] = t[1] / e, t) : [0, 0];
207
- }
208
- function $(t, e) {
209
- return [t[0] + e[0], t[1] + e[1]];
210
- }
211
- function Z(t, e) {
212
- return [t[0] - e[0], t[1] - e[1]];
213
- }
214
- function rt(t, e) {
215
- return t[0] * e[0] + t[1] * e[1];
216
- }
217
- function re(t) {
218
- return t[0] = -t[0], t[1] = -t[1], t;
219
- }
220
- function se(t, e) {
221
- return t[0] = t[0] * e, t[1] = t[1] * e, t;
222
- }
223
- function bt(t) {
224
- const e = t[0] ** 2 + t[1] ** 2;
225
- return e > 0 ? Math.sqrt(e) : 0;
226
- }
227
- function oe(t, e, r = 0.5) {
228
- const n = 1 - r;
229
- return [t[0] * n + e[0] * r, t[1] * n + e[1] * r];
230
- }
231
- function W(t, e) {
232
- return nt(Z(e, t));
233
- }
234
- function S(t, e) {
235
- return bt(Z(e, t));
236
- }
237
- function wt(t, e = !1) {
238
- const r = {
239
- alpha: 1,
240
- tension: 0,
241
- closed: e
242
- }, n = new it(t, r);
243
- return {
244
- getPointAt: (s) => n.getPointAt(s),
245
- getPoints: (s, a = 0, i = 1) => n.getPoints(s, null, a, i),
246
- getTangentAt: (s) => n.getTangentAt(s),
247
- getNormalAt: (s) => n.getNormalAt(s),
248
- getBoundingBox: (s = 0, a = 1) => {
249
- const i = n.getBoundingBox(s, a);
250
- return {
251
- min: i.min,
252
- max: i.max
253
- };
254
- },
255
- nearest: (s) => {
256
- const a = n.getNearestPosition(s);
257
- return {
258
- position: a.u,
259
- point: a.point,
260
- distance: a.distance
261
- };
262
- },
263
- get length() {
264
- return n.length;
265
- },
266
- closed: e
267
- };
268
- }
269
- function ae(t, e) {
270
- const r = e.length, n = new Array(r);
271
- if (!n.length) return [];
272
- e.forEach((l, d) => {
273
- n[d] = {
274
- curvePosition: l,
275
- position: t.getPointAt(l),
276
- tangent: t.getTangentAt(l),
277
- normal: [0, 0, 0],
278
- binormal: [0, 0, 0]
279
- };
280
- });
281
- let o = [0, 1, 0], s = Math.abs(n[0].tangent[1]);
282
- const a = Math.abs(n[0].tangent[0]), i = Math.abs(n[0].tangent[2]);
283
- a <= s && (s = a, o = [1, 0, 0]), i <= s && (o = [0, 0, 1]);
284
- let c = z(E(n[0].tangent, o));
285
- n[0].normal = E(n[0].tangent, c), n[0].binormal = E(n[0].tangent, n[0].normal);
286
- for (let l = 1; l < e.length; l++) {
287
- if (c = E(n[l - 1].tangent, n[l].tangent), n[l].normal = Mt(n[l - 1].normal), et(c) > at) {
288
- z(c);
289
- const d = Math.acos(
290
- B(q(n[l - 1].tangent, n[l].tangent), -1, 1)
291
- );
292
- n[l].normal = At(n[l - 1].normal, c, d);
293
- }
294
- n[l].binormal = E(n[l].tangent, n[l].normal);
295
- }
296
- return n;
297
- }
298
- function ie(t, e = 0, r = 1, n = 0.1, o = 0) {
299
- const s = [], a = t.length, i = Math.ceil(n * a), c = 1 / i, l = 1 / (a * 0.01);
300
- o && (o *= 0.1), s.push(e);
301
- let d = o ? t.getTangentAt(e) : null;
302
- const f = Math.floor(e * i);
303
- let m = e;
304
- for (let u = f; u <= i; u++) {
305
- const h = u * c, y = h - m, g = o ? t.getTangentAt(h) : null;
306
- h > e && h < r && (y >= l || !o || Math.abs(q(d, g)) < 1 - o) && (s.push(h), d = g, m = h);
307
- }
308
- return s.push(r), s;
309
- }
310
- function ce(t, e) {
311
- if (!e || e.length < 8) return null;
312
- const [r, , n] = e, o = new Array(e.length / 4);
313
- for (let f = 0, m = 0; f < o.length; f++, m += 4)
314
- o[f] = [
315
- e[m] - r,
316
- -e[m + 1],
317
- n - e[m + 2]
318
- ];
319
- const s = wt(o, !1);
320
- if (!s) return null;
321
- const a = e[3], i = e[e.length - 1], c = i - a, l = (f, m = !1) => {
322
- let u = (f - a) / c;
323
- return m && (u = B(u, 0, 1)), u < 0 || u > 1 ? null : u;
324
- };
325
- return {
326
- id: t,
327
- curve: s,
328
- get measuredLength() {
329
- return c;
330
- },
331
- get measuredTop() {
332
- return a;
333
- },
334
- get measuredBottom() {
335
- return i;
336
- },
337
- getPositionAtDepth: l,
338
- getPointAtDepth: (f, m = !1) => {
339
- const u = l(f, m);
340
- return u !== null ? s.getPointAt(u) : null;
341
- }
342
- };
343
- }
344
- function le(t, e = (n) => n, r = 1e-7) {
345
- if (t.length <= 2) return t;
346
- let n = e(t[0]), o = [0, 0];
347
- const s = [t[0]];
348
- for (let a = 1; a < t.length - 1; a++) {
349
- const i = e(t[a]), c = nt(Z(i, n));
350
- Math.abs(rt(o, c)) < 1 - r && (s.push(t[a]), o = c, n = i);
351
- }
352
- return s.push(t[t.length - 1]), s;
353
- }
354
- function ue(t, e, r = 1e3, n = 2e3, o = 0) {
355
- if (!t || t.length < 1) return null;
356
- const s = [];
357
- let a = 0;
358
- const i = [t[0][0], t[0][2]];
359
- let c = t[0][1], l = c, d = 1;
360
- s.push(i);
361
- let f = s[s.length - 1];
362
- for (; d < t.length; ) {
363
- const u = [t[d][0], t[d][2]];
364
- t[d][1] > c && (c = t[d][1]), t[d][1] < l && (l = t[d][1]);
365
- const h = S(f, u);
366
- if (h < e)
367
- d === t.length - 1 && s.length > 1 && (a += h, s.push(u)), d++;
368
- else if (a += e, h > e) {
369
- const y = W(f, u), g = [
370
- f[0] + y[0] * e,
371
- f[1] + y[1] * e
372
- ];
373
- s.push(g), f = g;
374
- } else
375
- s.push(u), f = u, d++;
376
- }
377
- const m = s.length;
378
- if (r || a < n) {
379
- let u = 0, h = r;
380
- a + r / 2 < n && (u = (n - a) / 2, h = u);
381
- let y = [
382
- Math.cos(o),
383
- Math.sin(o)
384
- ];
385
- if (h) {
386
- m > 1 && (y = W(
387
- s[s.length - 2],
388
- s[s.length - 1]
389
- ));
390
- const g = s[s.length - 1], L = Math.floor(h / e), k = [
391
- y[0] * e,
392
- y[1] * e
393
- ], P = [
394
- g[0] + y[0] * h,
395
- g[1] + y[1] * h
396
- ];
397
- let b = g;
398
- for (let T = 0; T < L; T++)
399
- b = $(b, k), s.push(b);
400
- S(b, P) && s.push(P);
401
- }
402
- if (u) {
403
- let g;
404
- m > 1 ? g = W(s[1], s[0]) : g = [
405
- -Math.cos(o),
406
- -Math.sin(o)
407
- ], (a < 100 || Math.abs(rt(y, g)) > 0.95) && (g = [
408
- -y[0],
409
- -y[1]
410
- ]);
411
- const L = Math.floor(u / e), k = [
412
- g[0] * e,
413
- g[1] * e
414
- ], P = [
415
- i[0] + g[0] * u,
416
- i[1] + g[1] * u
417
- ];
418
- let b = i;
419
- for (let T = 0; T < L; T++)
420
- b = $(b, k), s.unshift(b);
421
- S(
422
- b,
423
- P
424
- ) && s.unshift(P);
425
- }
426
- }
427
- return {
428
- positions: s,
429
- top: c,
430
- bottom: l,
431
- length: a
432
- };
433
- }
434
- function D(t) {
435
- if (t.constructor === Uint8Array) return "Uint8Array";
436
- if (t.constructor === Uint16Array) return "Uint16Array";
437
- if (t.constructor === Uint32Array) return "Uint32Array";
438
- if (t.constructor === Int8Array) return "Int8Array";
439
- if (t.constructor === Int16Array) return "Int16Array";
440
- if (t.constructor === Int32Array) return "Int32Array";
441
- if (t.constructor === Float32Array) return "Float32Array";
442
- if (t.constructor === Float64Array) return "Float64Array";
443
- throw Error("Unsupported typed array!");
444
- }
445
- function C(t, e) {
446
- switch (e) {
447
- case "Uint8Array":
448
- return new Uint8Array(t);
449
- case "Uint16Array":
450
- return new Uint16Array(t);
451
- case "Uint32Array":
452
- return new Uint32Array(t);
453
- case "Int8Array":
454
- return new Int8Array(t);
455
- case "Int16Array":
456
- return new Int16Array(t);
457
- case "Int32Array":
458
- return new Int32Array(t);
459
- case "Float32Array":
460
- return new Float32Array(t);
461
- case "Float64Array":
462
- return new Float64Array(t);
463
- default:
464
- throw Error("Unsupported typed array!");
465
- }
466
- }
467
- function xt(t, e = 1) {
468
- return {
469
- buffer: t.buffer,
470
- attributeType: D(t),
471
- itemSize: e
472
- };
473
- }
474
- function de(t) {
475
- const e = [], r = {
476
- drawRange: t.drawRange || { start: 0, count: 1 / 0 },
477
- groups: t.groups || [],
478
- attributes: {},
479
- index: t.index,
480
- indexType: t.index ? D(t.index) : void 0,
481
- userData: t.userData ? structuredClone(t.userData) : void 0
482
- };
483
- for (const n in t.attributes)
484
- r.attributes[n] = xt(
485
- t.attributes[n].array,
486
- t.attributes[n].itemSize
487
- ), e.push(r.attributes[n].buffer);
488
- return [r, e];
489
- }
490
- function vt(t) {
491
- const e = [], r = {
492
- drawRange: t.drawRange,
493
- groups: t.groups,
494
- attributes: {},
495
- index: void 0,
496
- indexType: void 0
497
- }, n = t.getIndex();
498
- n && (r.index = n.array.buffer, r.indexType = D(n.array));
499
- for (const o in t.attributes) {
500
- const s = t.getAttribute(o);
501
- r.attributes[o] = {
502
- buffer: s.array.buffer,
503
- attributeType: D(s.array),
504
- itemSize: s.itemSize
505
- }, e.push(r.attributes[o].buffer);
506
- }
507
- return t.userData && (r.userData = structuredClone(t.userData)), [r, e];
508
- }
509
- function fe(t) {
510
- const e = {}, r = [];
511
- for (const n in t) {
512
- const o = t[n], s = vt(o);
513
- e[n] = s[0], s[1].length && r.push(...s[1]);
514
- }
515
- return { data: e, transferrables: r };
516
- }
517
- function me(t) {
518
- const e = new X();
519
- if (t.index) {
520
- const r = C(
521
- t.index,
522
- t.indexType || "Uint32Array"
523
- ), n = new U(r, 1);
524
- e.setIndex(n);
525
- }
526
- for (const r in t.attributes) {
527
- const n = new U(
528
- C(
529
- t.attributes[r].buffer,
530
- t.attributes[r].attributeType
531
- ),
532
- t.attributes[r].itemSize
533
- );
534
- e.setAttribute(r, n);
535
- }
536
- return e.drawRange = t.drawRange, e.groups = t.groups, t.userData && (e.userData = t.userData), e;
537
- }
538
- function ge(t) {
539
- const e = {};
540
- for (const r in t) {
541
- const n = new X();
542
- if (t[r].index) {
543
- const o = C(
544
- t[r].index,
545
- t[r].indexType || "Uint32Array"
546
- ), s = new U(o, 1);
547
- n.setIndex(s);
548
- }
549
- for (const o in t[r].attributes) {
550
- const s = new U(
551
- C(
552
- t[r].attributes[o].buffer,
553
- t[r].attributes[o].attributeType
554
- ),
555
- t[r].attributes[o].itemSize
556
- );
557
- n.setAttribute(o, s);
558
- }
559
- n.drawRange = t[r].drawRange, n.groups = t[r].groups, e[r] = n;
560
- }
561
- return e;
562
- }
563
- const N = "camera-set-position", j = "camera-focus-point";
564
- class he extends CustomEvent {
565
- constructor(e) {
566
- super(N, { detail: e });
567
- }
568
- }
569
- class pe extends CustomEvent {
570
- constructor(e) {
571
- super(j, { detail: e });
572
- }
573
- }
574
- const M = new v(), p = new v(), x = new v(), I = new v(), Q = new v();
575
- async function Pt(t, e, r) {
576
- r.normalizeRotations();
577
- const n = Math.min(r.distance, e);
578
- return M.set(...t), r.getPosition(p), x.subVectors(M, p), e = Math.min(x.length() * 1.5, n), x.normalize(), p.copy(M).addScaledVector(x, -n), r.setLookAt(
579
- p.x,
580
- p.y,
581
- p.z,
582
- M.x,
583
- M.y,
584
- M.z,
585
- !0
586
- );
587
- }
588
- function Tt(t, e) {
589
- e.normalizeRotations(), I.set(...t), e.getTarget(M), Q.subVectors(M, I), e.getPosition(p), p.sub(Q), e.setPosition(p.x, p.y, p.z), e.setTarget(I.x, I.y, I.z);
590
- }
591
- class ye {
592
- controls = null;
593
- removeEventlisteners = null;
594
- constructor() {
595
- this.setControls = this.setControls.bind(this);
596
- }
597
- addEventListeners() {
598
- const e = (n) => {
599
- this.controls && Tt(n.detail, this.controls);
600
- }, r = (n) => {
601
- if (this.controls) {
602
- const o = n.detail.callback;
603
- Pt(
604
- n.detail.point,
605
- n.detail.distance || 200,
606
- this.controls
607
- ).then(() => {
608
- o && o();
609
- });
610
- }
611
- };
612
- addEventListener(N, e), addEventListener(j, r), this.removeEventlisteners = () => {
613
- removeEventListener(N, e), removeEventListener(j, r);
614
- };
615
- }
616
- async setTarget(e) {
617
- const r = this.controls;
618
- return r ? (M.set(...e), r.getPosition(p), x.subVectors(M, p), x.normalize(), r.setLookAt(
619
- p.x,
620
- p.y,
621
- p.z,
622
- M.x,
623
- M.y,
624
- M.z,
625
- !0
626
- )) : null;
627
- }
628
- setControls(e) {
629
- this.controls = e, this.removeEventlisteners && this.removeEventlisteners(), this.addEventListeners();
630
- }
631
- dispose() {
632
- this.controls = null, this.removeEventlisteners && this.removeEventlisteners();
633
- }
634
- }
635
- const Et = "wellbore-selected", _ = "wellbore-added", G = "wellbore-removed";
636
- class Me extends CustomEvent {
637
- constructor(e) {
638
- super(Et, { detail: e });
639
- }
640
- }
641
- class Ae extends CustomEvent {
642
- constructor(e) {
643
- super(_, { detail: e });
644
- }
645
- }
646
- class be extends CustomEvent {
647
- constructor(e) {
648
- super(G, { detail: e });
649
- }
650
- }
651
- const J = new v();
652
- class we {
653
- map = /* @__PURE__ */ new Map();
654
- constructor() {
655
- this.onWellboreAdded = this.onWellboreAdded.bind(this), this.onWellboreRemoved = this.onWellboreRemoved.bind(this), addEventListener(_, this.onWellboreAdded), addEventListener(G, this.onWellboreRemoved);
656
- }
657
- onWellboreAdded(e) {
658
- this.map.set(e.detail.id, {
659
- wellboreId: e.detail.id,
660
- object: e.detail.object
661
- });
662
- }
663
- onWellboreRemoved(e) {
664
- this.map.delete(e.detail.id);
665
- }
666
- getInfo(e) {
667
- const r = this.map.get(e);
668
- if (r)
669
- return r.object.getWorldPosition(J), {
670
- ...r,
671
- position: J.toArray()
672
- };
673
- }
674
- dispose() {
675
- removeEventListener(_, this.onWellboreAdded), removeEventListener(G, this.onWellboreRemoved);
676
- }
677
- }
678
- function xe(t) {
679
- return t / 3.28084;
680
- }
681
- function ve(t) {
682
- return t * (Math.PI / 180);
683
- }
684
- const Pe = (t, e = 1, r = 1) => [t[0] / e * 2 - 1, -(t[1] / r) * 2 + 1], Te = (t, e = 1, r = 1) => [(t[0] + 1) / 2 * e, (1 - t[1]) / 2 * r];
685
- var It = `#include <common>
686
-
687
- varying vec2 vUv;
688
-
689
- void main() {
690
- vUv = uv;
691
- gl_Position = vec4(position, 1.0);
692
- }`, Ft = `#include <common>
693
- #include <packing>
694
-
695
- varying vec2 vUv;
696
- uniform sampler2D depthTexture;
697
- uniform float cameraFar;
698
- uniform float cameraNear;
699
-
700
- float linearizeDepth(in float depth) {
701
- float a = cameraFar / (cameraFar - cameraNear);
702
- float b = cameraFar * cameraNear / (cameraNear - cameraFar);
703
-
704
- return a + b / depth;
705
- }
706
-
707
- float linearizeLogDepth(in float depth) {
708
- float z = exp2(depth * log2(cameraFar + 1.0)) - 1.0;
709
- return linearizeDepth(z);
710
- }
711
-
712
- void main() {
713
- float depth = texture(depthTexture, vUv).r;
714
- float viewZ;
715
- #if defined( USE_LOGARITHMIC_DEPTH_BUFFER ) || defined( USE_LOGDEPTHBUF )
716
- viewZ = linearizeLogDepth(depth);
717
- #else
718
- viewZ = depth;
719
- #endif
720
-
721
- gl_FragColor = packDepthToRGBA(viewZ);
722
- }`;
723
- class Vt extends Y {
724
- constructor() {
725
- super({
726
- vertexShader: It,
727
- fragmentShader: Ft,
728
- uniforms: {
729
- cameraNear: { value: 0 },
730
- cameraFar: { value: 1 },
731
- depthTexture: { value: null },
732
- cameraWasPerspective: { value: null }
733
- },
734
- toneMapped: !1,
735
- depthWrite: !1,
736
- depthTest: !1
737
- });
738
- }
739
- }
740
- const V = 255 / 256, R = new Float32Array([
741
- V,
742
- V / 256,
743
- V / 256 ** 2,
744
- V / 256 ** 3
745
- ]);
746
- function K(t, e, r, n) {
747
- return t / 255 * R[0] + e / 255 * R[1] + r / 255 * R[2] + n / 255 * R[3];
748
- }
749
- const Rt = new ct(-1, 1, 1, -1, 0, 1), F = new Vt(), st = new lt(), Ut = new ut(2, 2), Dt = new dt(Ut, F);
750
- let w = null, A = null;
751
- st.add(Dt);
752
- async function Ee(t, e, r, n) {
753
- if (!t) return null;
754
- try {
755
- const { width: o, height: s } = t;
756
- if ((!w || !A || w.width !== o || w.height !== s) && (w?.dispose(), A = new Uint8Array(4 * o * s), w = new ft(o, s, {
757
- type: gt,
758
- format: mt,
759
- depthBuffer: !1,
760
- stencilBuffer: !1
761
- })), F.uniforms.depthTexture.value = t, F.uniforms.cameraNear.value = r.near, F.uniforms.cameraFar.value = r.far, F.uniforms.cameraWasPerspective.value = r.isPerspectiveCamera, e.setRenderTarget(w), e.clear(), e.render(st, Rt), e.setRenderTarget(null), await e.readRenderTargetPixelsAsync(
762
- w,
763
- 0,
764
- // x
765
- 0,
766
- // y
767
- o,
768
- s,
769
- A
770
- ), n !== void 0 && Number.isFinite(n))
771
- return K(
772
- A[n],
773
- A[n + 1],
774
- A[n + 2],
775
- A[n + 3]
776
- ) * 2 - 1;
777
- {
778
- const a = new Array(A.length / 4);
779
- for (let i = 0; i < a.length; i++) {
780
- const c = i * 4;
781
- a[i] = K(
782
- A[c],
783
- A[c + 1],
784
- A[c + 2],
785
- A[c + 3]
786
- ) * 2 - 1;
787
- }
788
- return a;
789
- }
790
- } catch (o) {
791
- return console.error(o), null;
792
- }
793
- }
794
- var Ct = `varying vec2 vUv;
795
-
796
- void main() {
797
- vUv = uv;
798
- gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
799
-
800
- }`, Bt = `varying vec2 vUv;
801
-
802
- void main() {
803
-
804
- gl_FragColor = vec4(vUv, 1.0, 1.0);
805
-
806
- }`;
807
- const Ie = new Y({
808
- vertexShader: Ct,
809
- fragmentShader: Bt
810
- });
811
- export {
812
- ht as $,
813
- Qt as A,
814
- Xt as B,
815
- pe as C,
816
- Vt as D,
817
- Mt as E,
818
- E as F,
819
- ve as G,
820
- W as H,
821
- Yt as I,
822
- S as J,
823
- te as K,
824
- rt as L,
825
- q as M,
826
- xe as N,
827
- zt as O,
828
- _t as P,
829
- ue as Q,
830
- wt as R,
831
- C as S,
832
- H as T,
833
- D as U,
834
- ee as V,
835
- Ae as W,
836
- Ht as X,
837
- pt as Y,
838
- bt as Z,
839
- et as _,
840
- Gt as a,
841
- Kt as a0,
842
- re as a1,
843
- Ot as a2,
844
- z as a3,
845
- xt as a4,
846
- fe as a5,
847
- vt as a6,
848
- de as a7,
849
- Ee as a8,
850
- Nt as a9,
851
- At as aa,
852
- se as ab,
853
- Jt as ac,
854
- Pe as ad,
855
- ne as ae,
856
- $t as af,
857
- le as ag,
858
- tt as ah,
859
- jt as ai,
860
- ge as aj,
861
- Ie as ak,
862
- yt as b,
863
- qt as c,
864
- B as d,
865
- Zt as e,
866
- Te as f,
867
- Wt as g,
868
- St as h,
869
- ce as i,
870
- be as j,
871
- N as k,
872
- j as l,
873
- oe as m,
874
- nt as n,
875
- ie as o,
876
- ae as p,
877
- he as q,
878
- Me as r,
879
- Z as s,
880
- G as t,
881
- me as u,
882
- Et as v,
883
- _ as w,
884
- ye as x,
885
- we as y,
886
- $ as z
887
- };