@equinor/videx-3d 1.1.1 → 3.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 (74) hide show
  1. package/README.md +120 -120
  2. package/dist/chunk-DKAquGKk.js +2820 -0
  3. package/dist/chunk-DsUZyEG_.js +16 -0
  4. package/dist/generators.js +512 -716
  5. package/dist/main.js +6909 -8947
  6. package/dist/sdk.js +2 -785
  7. package/dist/src/sdk/materials/shaderLib/oit.glsl +106 -0
  8. package/dist/types/components/Annotations/AutoUpdate.d.ts +1 -1
  9. package/dist/types/components/Annotations/index.d.ts +2 -2
  10. package/dist/types/components/Annotations/types.d.ts +3 -1
  11. package/dist/types/components/Annotations/update-annotations.d.ts +10 -0
  12. package/dist/types/components/EventEmitter/picking-helper.d.ts +23 -1
  13. package/dist/types/components/Ocean/Ocean.d.ts +333 -0
  14. package/dist/types/components/Ocean/index.d.ts +6 -0
  15. package/dist/types/components/Ocean/ocean-bed-material.d.ts +60 -0
  16. package/dist/types/components/Ocean/ocean-contact.d.ts +39 -0
  17. package/dist/types/components/Ocean/ocean-material.d.ts +145 -0
  18. package/dist/types/components/Ocean/ocean-sampler.d.ts +93 -0
  19. package/dist/types/components/Ocean/ocean-volume-material.d.ts +54 -0
  20. package/dist/types/components/Surfaces/Surface.d.ts +8 -1
  21. package/dist/types/components/Surfaces/SurfaceMaterial.d.ts +3 -0
  22. package/dist/types/components/Surfaces/surface-defs.d.ts +1 -0
  23. package/dist/types/components/Tanker/Tanker.d.ts +47 -0
  24. package/dist/types/components/Tanker/TankerSuperstructure.d.ts +23 -0
  25. package/dist/types/components/Tanker/tanker-geometry-builder.d.ts +21 -0
  26. package/dist/types/generators/surface-generator.d.ts +1 -1
  27. package/dist/types/layers/layers.d.ts +4 -0
  28. package/dist/types/main.d.ts +1 -0
  29. package/dist/types/rendering/OitMaterial.d.ts +59 -0
  30. package/dist/types/rendering/Pass.d.ts +16 -0
  31. package/dist/types/rendering/RenderingPipeline.d.ts +46 -0
  32. package/dist/types/rendering/debug/DebugBoxOutputPass.d.ts +22 -0
  33. package/dist/types/rendering/debug/DebugPatternPass.d.ts +30 -0
  34. package/dist/types/rendering/fullscreen-renderer.d.ts +1 -0
  35. package/dist/types/rendering/fxaa-resolver.d.ts +25 -0
  36. package/dist/types/rendering/gpu-timer.d.ts +46 -0
  37. package/dist/types/rendering/index.d.ts +8 -1
  38. package/dist/types/rendering/oit-material.d.ts +122 -0
  39. package/dist/types/{components/Annotations/annotations-renderer.d.ts → rendering/passes/AnnotationsPass.d.ts} +14 -4
  40. package/dist/types/rendering/passes/FXAAPass.d.ts +17 -0
  41. package/dist/types/rendering/passes/OITRenderPass.d.ts +429 -0
  42. package/dist/types/rendering/passes/OutputPass.d.ts +19 -0
  43. package/dist/types/rendering/passes/RenderPass.d.ts +10 -0
  44. package/dist/types/rendering/passes/index.d.ts +4 -0
  45. package/dist/types/rendering/rendering-state.d.ts +59 -0
  46. package/dist/types/rendering/smaa-resolver.d.ts +58 -0
  47. package/dist/types/rendering/taa-resolver.d.ts +161 -0
  48. package/dist/types/rendering/temporal-resolver.d.ts +152 -0
  49. package/dist/types/sdk/geometries/boundary-loops.d.ts +38 -0
  50. package/dist/types/sdk/geometries/geometry-attributes.d.ts +37 -0
  51. package/dist/types/sdk/geometries/grid-sampling.d.ts +50 -0
  52. package/dist/types/sdk/geometries/ocean-geometry.d.ts +288 -0
  53. package/dist/types/sdk/geometries/packing.d.ts +1 -1
  54. package/dist/types/sdk/geometries/tessellation.d.ts +25 -0
  55. package/dist/types/sdk/index.d.ts +5 -0
  56. package/dist/types/sdk/utils/elevation-map.d.ts +23 -0
  57. package/dist/types/sdk/utils/trigonometry.d.ts +4 -1
  58. package/dist/types/sdk/utils/vector-operations.d.ts +7 -0
  59. package/package.json +9 -10
  60. package/dist/chunk-BlPg4RjP.js +0 -689
  61. package/dist/chunk-CnY6Tmof.js +0 -358
  62. package/dist/chunk-DuRASjkF.js +0 -17
  63. package/dist/chunk-iY0wQ9Z6.js +0 -887
  64. package/dist/types/rendering/render-passes.d.ts +0 -16
  65. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/color-conversion.glsl +0 -0
  66. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/colors.glsl +0 -0
  67. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/glyphs.glsl +0 -0
  68. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/random.glsl +0 -0
  69. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/remap.glsl +0 -0
  70. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/render-number.glsl +0 -0
  71. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/render-text.glsl +0 -0
  72. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/rotation.glsl +0 -0
  73. /package/dist/{shaderLib → src/sdk/materials/shaderLib}/sdf-functions.glsl +0 -0
  74. /package/dist/textures/{normal_map.jpg → public/normal_map.jpg} +0 -0
package/dist/sdk.js CHANGED
@@ -1,785 +1,2 @@
1
- import { wrap as Y } from "comlink";
2
- import R from "p-limit";
3
- import { d as K } from "./chunk-iY0wQ9Z6.js";
4
- import { x as xt, D as bt, P as vt, b as Mt, a as Ct, c as Et, T as Bt, y as At, z as zt, A as Ft, B as It, p as St, E as Lt, F as Vt, G as Tt, H as Pt, I as Dt, J as Gt, K as qt, L as jt, M as kt, e as Nt, N as Ot, o as Qt, O as Ut, Q as Wt, R as Ht, i as Zt, S as $t, U as Jt, V as Kt, X as Xt, g as Yt, Y as Rt, Z as te, _ as ee, $ as se, h as ie, m as ne, a0 as re, a1 as ae, a2 as oe, n as le, a3 as he, f as ce, a4 as fe, a5 as ue, a6 as de, a7 as ge, a8 as me, a9 as pe, aa as ye, ab as _e, ac as we, ad as xe, ae as be, af as ve, ag as Me, s as Ce, ah as Ee, ai as Be, aj as Ae, u as ze, ak as Fe } from "./chunk-iY0wQ9Z6.js";
5
- import { C as Se, T as Le, c as Ve, b as Te, a as Pe, d as De, e as Ge, g as qe, f as je, t as ke, h as Ne, w as Oe } from "./chunk-CnY6Tmof.js";
6
- import { D as Ue, c as We, a as He, b as Ze, d as $e, m as Je, t as Ke, e as Xe, f as Ye } from "./chunk-BlPg4RjP.js";
7
- import { Vector2 as N, Shape as tt, Path as et } from "three";
8
- const st = 10, it = 25;
9
- class lt {
10
- store;
11
- config;
12
- cached = /* @__PURE__ */ new Map();
13
- _activeLoaders = {};
14
- _batchqueue = /* @__PURE__ */ new Map();
15
- _flushScheduled = null;
16
- constructor(t, e = {}) {
17
- this.store = t, this.config = { ...e }, this.config.batched && (this.config.batchSize === void 0 && (this.config.batchSize = st), this.config.batchMaxDelay === void 0 && (this.config.batchMaxDelay = it)), this._flushScheduled = null;
18
- }
19
- async init(...t) {
20
- if (this.config.init)
21
- try {
22
- const e = await this.config.init(...t);
23
- if (Array.isArray(e))
24
- return this.cached = new Map(e), !0;
25
- } catch (e) {
26
- console.warn("Init failed", e);
27
- }
28
- return this.clear(), !1;
29
- }
30
- async all() {
31
- if (this.config.preloaded) {
32
- if (this.config.transform) {
33
- const t = this.config.transform;
34
- return Array.from(this.cached.values()).map((e) => t(e));
35
- }
36
- return Array.from(this.cached.values());
37
- } else
38
- console.warn('Data Loader: "all" called on non-preloaded dataset!');
39
- return [];
40
- }
41
- async _enqueueRequest(t) {
42
- if (this._batchqueue.has(t))
43
- return this._batchqueue.get(t).promise;
44
- let e = null;
45
- const s = new Promise((r) => {
46
- e = r;
47
- }), i = {
48
- key: t,
49
- promise: s,
50
- _resolve: e
51
- };
52
- return this._batchqueue.set(t, i), this._flushScheduled || (this._flushScheduled = setTimeout(() => {
53
- this._processBatchQueue();
54
- }, this.config.batchMaxDelay)), s;
55
- }
56
- async _processBatch(t) {
57
- const e = t.map((s) => s.key);
58
- if (!this.config.batchLoad) return null;
59
- this.config.batchLoad(e).then((s) => {
60
- Array.isArray(s) && s.forEach(([i, r]) => {
61
- this.set(i, r);
62
- });
63
- }).catch((s) => {
64
- console.warn("Batch load failed", s);
65
- }).finally(() => {
66
- t.forEach((s) => {
67
- const i = this.cached.get(s.key) || null;
68
- s._resolve(i);
69
- });
70
- });
71
- }
72
- async _processBatchQueue() {
73
- let t = [];
74
- for (const e of this._batchqueue.values())
75
- t.push(e), this._batchqueue.delete(e.key), (t.length >= this.config.batchSize || this._batchqueue.size === 0) && (this._processBatch(t), t = []);
76
- this._batchqueue.size ? this._flushScheduled = setTimeout(() => this._processBatchQueue(), 1) : this._flushScheduled = null;
77
- }
78
- async get(t, e) {
79
- if (this.cached.has(t))
80
- return this.config.transform ? this.config.transform(this.cached.get(t)) : this.cached.get(t);
81
- if (this.config.preloaded) return null;
82
- if (!this.config.batched && this.config.load) {
83
- if (this.config.noCache)
84
- return this.config.load(t, e);
85
- let s = this._activeLoaders[t];
86
- if (!s) {
87
- if (e)
88
- throw Error(
89
- "DataLoader: A load function with additional args may not be cached. Set noCache to true in config."
90
- );
91
- s = this.config.load(t).then((i) => {
92
- i && this.cached.set(t, i);
93
- }).catch((i) => {
94
- console.warn("Load failed", i);
95
- }).finally(() => {
96
- delete this._activeLoaders[t];
97
- }), this._activeLoaders[t] = s;
98
- }
99
- return await s, this.config.transform ? this.config.transform(this.cached.get(t)) : this.cached.get(t);
100
- }
101
- return this.config.batched && this.config.batchLoad ? this._enqueueRequest(t) : null;
102
- }
103
- set(t, e) {
104
- this.cached.set(t, e);
105
- }
106
- clear() {
107
- this.cached.clear();
108
- }
109
- }
110
- class ht {
111
- store = null;
112
- config;
113
- generators = /* @__PURE__ */ new Map();
114
- constructor(t = {}, e) {
115
- this.config = { concurrentStoreCalls: 0, ...t }, e && this.setStore(e);
116
- }
117
- add(t, e) {
118
- this.generators.set(t, e);
119
- }
120
- setStore(t) {
121
- if (t && this.config.concurrentStoreCalls) {
122
- const e = R(this.config.concurrentStoreCalls), s = {
123
- get: (i, r, n) => e(() => t.get(i, r, n)),
124
- all: (i) => e(() => t.all(i)),
125
- query: (i, r) => e(() => t.query(i, r))
126
- };
127
- this.store = s;
128
- } else
129
- this.store = t;
130
- }
131
- async connectRemoteStore(t) {
132
- const e = Y(t);
133
- this.setStore(e);
134
- }
135
- async invoke(t, ...e) {
136
- if (!this.store) throw Error("No available store!");
137
- if (!this.generators.has(t))
138
- throw Error(`Generator with key '${t}' not found!`);
139
- return this.generators.get(t).bind(this.store)(...e);
140
- }
141
- }
142
- class W {
143
- type;
144
- coordinates;
145
- _min = null;
146
- _max = null;
147
- _size = null;
148
- _offset = [0, 0];
149
- constructor(t, e, s) {
150
- this.type = t, this.coordinates = e, s && (this._offset[0] = s[0], this._offset[1] = s[1]);
151
- }
152
- static fromPointCoordinates(t, e) {
153
- const s = e ? t.map(e) : t;
154
- return new H(s);
155
- }
156
- static fromLineCoordinates(t, e) {
157
- const s = e ? t.map((i) => i.map(e)) : t;
158
- return new Z(s);
159
- }
160
- static fromPolygonCoordinates(t, e) {
161
- const s = e ? t.map((i) => i.map((r) => r.map(e))) : t;
162
- return new $(s);
163
- }
164
- _calculateBounds() {
165
- const t = [1 / 0, 1 / 0], e = [-1 / 0, -1 / 0], s = (i) => {
166
- i[0] < t[0] && (t[0] = i[0]), i[0] > e[0] && (e[0] = i[0]), i[1] < t[1] && (t[1] = i[1]), i[1] > e[1] && (e[1] = i[1]);
167
- };
168
- this.forEachCoordinate(s), this._min = t, this._max = e, this._size = [e[0] - t[0], e[1] - t[1]];
169
- }
170
- get min() {
171
- return this._min || this._calculateBounds(), [...this._min];
172
- }
173
- get max() {
174
- return this._max || this._calculateBounds(), [...this._max];
175
- }
176
- get center() {
177
- return (!this._min || !this._max || !this._size) && this._calculateBounds(), [
178
- this.min[0] + this.size[0] / 2,
179
- this.min[1] + this.size[1] / 2
180
- ];
181
- }
182
- get size() {
183
- return this._size || this._calculateBounds(), [...this._size];
184
- }
185
- get offset() {
186
- return [...this._offset];
187
- }
188
- setOffset(t) {
189
- this.forEachCoordinate((e) => {
190
- e[0] -= t[0], e[1] -= t[1];
191
- }), this._min && (this._min[0] -= t[0], this._min[1] -= t[1]), this._max && (this._max[0] -= t[0], this._max[1] -= t[1]), this._offset[0] += t[0], this._offset[1] += t[1];
192
- }
193
- removeOffset() {
194
- (this._offset[0] !== 0 || this._offset[1] !== 0) && (this.forEachCoordinate((t) => {
195
- t[0] += this._offset[0], t[1] += this._offset[1];
196
- }), this._min = null, this._max = null, this._size = null, this._offset = [0, 0]);
197
- }
198
- centralize() {
199
- this.setOffset(this.center);
200
- }
201
- normalize(t = [1, 1], e = [0, 0]) {
202
- this.centralize();
203
- const s = this.getBounds();
204
- this.forEachCoordinate((i) => {
205
- i[0] = K((i[0] - s.min[0]) / s.size[0]) * t[0] + e[0], i[1] = K((i[1] - s.min[1]) / s.size[1]) * t[1] + e[1];
206
- });
207
- }
208
- transform(t) {
209
- (this._offset[0] !== 0 || this._offset[1] !== 0) && this.removeOffset(), this.forEachCoordinate((e) => {
210
- const s = t(e);
211
- e[0] = s[0], e[1] = s[1];
212
- }), this._min = null, this._max = null, this._size = null;
213
- }
214
- toObject() {
215
- return {
216
- type: this.type.toString(),
217
- coordinates: structuredClone(this.coordinates),
218
- offset: this.offset
219
- };
220
- }
221
- getPointsFlattened() {
222
- const t = [];
223
- return this.forEachCoordinate((e) => {
224
- t.push(new N(e[0], e[1]));
225
- }), t;
226
- }
227
- getBounds() {
228
- return {
229
- min: this.min,
230
- max: this.max,
231
- size: this.size
232
- };
233
- }
234
- }
235
- class H extends W {
236
- constructor(t, e) {
237
- super("point2d", t, e);
238
- }
239
- forEachCoordinate(t) {
240
- this.coordinates.forEach((s) => t(s));
241
- }
242
- getPoints() {
243
- return this.coordinates.map((e) => [new N(e[0], e[1])]);
244
- }
245
- clone() {
246
- return new H(
247
- structuredClone(this.coordinates),
248
- this.offset
249
- );
250
- }
251
- }
252
- class Z extends W {
253
- constructor(t, e) {
254
- super("line2d", t, e);
255
- }
256
- forEachCoordinate(t) {
257
- this.coordinates.forEach((s) => s.forEach((i) => t(i)));
258
- }
259
- getPoints() {
260
- return this.coordinates.map((e) => e.map((s) => new N(s[0], s[1])));
261
- }
262
- clone() {
263
- return new Z(
264
- structuredClone(this.coordinates),
265
- this.offset
266
- );
267
- }
268
- }
269
- class $ extends W {
270
- constructor(t, e) {
271
- super("polygon2d", t, e);
272
- }
273
- forEachCoordinate(t) {
274
- this.coordinates.forEach((s) => s.forEach((i) => i.forEach((r) => t(r))));
275
- }
276
- getPoints() {
277
- return this.coordinates.map(
278
- (e) => e.reduce(
279
- (s, i) => s.concat(i.map((r) => new N(r[0], r[1]))),
280
- []
281
- )
282
- );
283
- }
284
- clone() {
285
- return new $(
286
- structuredClone(this.coordinates),
287
- this._offset
288
- );
289
- }
290
- toShapes() {
291
- const t = [], e = (i, r) => {
292
- i.moveTo(r[0][0], r[0][1]);
293
- for (let n = 1; n < r.length; n++)
294
- i.lineTo(r[n][0], r[n][1]);
295
- i.closePath();
296
- };
297
- return this.coordinates.forEach((i) => {
298
- const r = new tt(), n = i[0];
299
- e(r, n);
300
- for (let a = 1; a < i.length; a++) {
301
- const c = new et();
302
- e(c, i[a]), r.holes.push(c);
303
- }
304
- t.push(r);
305
- }), t;
306
- }
307
- }
308
- function ct(u, t, e = 1, s = 1, i = (r) => r) {
309
- console.time("triangulate");
310
- const r = [], n = [], a = [], c = [], h = u.length / t;
311
- let o, l, d, g, b, y, _, v, C, A, x, z, M, E, B, G, f, O, V, T, P, m, w, Q, X = 0, U = 0, J = 0, I = new Array(t).fill(null), q = new Array(t).fill(null);
312
- const p = new Array(t - 1).fill(null);
313
- function j(F, L, D) {
314
- return r.push({ x: F * e, y: D, z: L * s, edge: null }), a.push(F / (t - 1), 1 - L / (h - 1)), X++;
315
- }
316
- function S(F, L, D) {
317
- V = {
318
- index: U++,
319
- tail: F,
320
- head: L,
321
- twin: null,
322
- prev: null,
323
- next: null
324
- }, T = {
325
- index: U++,
326
- tail: L,
327
- head: D,
328
- twin: null,
329
- prev: null,
330
- next: null
331
- }, P = {
332
- index: U++,
333
- tail: D,
334
- head: F,
335
- twin: null,
336
- prev: null,
337
- next: null
338
- }, V.next = T, T.next = P, P.next = V, V.prev = P, T.prev = V, P.prev = T, r[F].edge || (r[F].edge = V), r[L].edge || (r[L].edge = T), r[D].edge || (r[D].edge = P), n.push(V, T, P), c.push(F, L, D);
339
- }
340
- for (G = 1; G < h - 1; G++) {
341
- Q = !1;
342
- const F = I;
343
- for (I = q, q = F.fill(null), m = null, O = G - 1, J += t, B = 1; B < t - 1; B++)
344
- f = B - 1, A = J + B, C = A - 1, v = A - t, _ = v - 1, x = i(u[_]), z = i(u[v]), M = i(u[C]), E = i(u[A]), x !== null && z !== null && M !== null && E !== null ? w = 1 : x !== null && z !== null && M !== null ? w = 2 : x !== null && z !== null && E !== null ? w = 3 : x !== null && M !== null && E !== null ? w = 4 : z !== null && M !== null && E !== null ? w = 5 : w = 0, d = null, g = null, w !== 0 ? (Q ? (o = I[f], d = q[f]) : (w !== 5 && (I[f] === null ? (o = j(f, O, x), I[f] = o) : o = I[f]), w !== 3 && (d = j(f, G, M)), q[f] = d), w !== 4 && (I[B] === null ? (l = j(B, O, z), I[B] = l) : l = I[B]), w !== 2 && (g = j(B, G, E)), w === 1 ? (b = Math.abs(r[o].y - r[g].y), y = Math.abs(r[l].y - r[d].y), b < y ? (S(o, d, g), m !== null && (n[n.length - 3].twin = m, m.twin = n[n.length - 3]), S(g, l, o), p[f] !== null && (n[n.length - 2].twin = p[f], p[f].twin = n[n.length - 2]), n[n.length - 4].twin = n[n.length - 1], n[n.length - 1].twin = n[n.length - 4], p[f] = n[n.length - 5], m = n[n.length - 3]) : (S(o, d, l), p[f] !== null && (n[n.length - 1].twin = p[f], p[f].twin = n[n.length - 1]), m !== null && (n[n.length - 3].twin = m, m.twin = n[n.length - 3]), S(l, d, g), n[n.length - 5].twin = n[n.length - 3], n[n.length - 3].twin = n[n.length - 5], p[f] = n[n.length - 2], m = n[n.length - 1])) : w === 2 ? (S(o, d, l), p[f] !== null && (n[n.length - 1].twin = p[f], p[f].twin = n[n.length - 1]), m !== null && (n[n.length - 3].twin = m, m.twin = n[n.length - 3]), p[f] = null, m = null) : w === 5 ? (S(l, d, g), p[f] = n[n.length - 2], m = n[n.length - 1]) : w === 3 ? (S(l, o, g), p[f] !== null && (n[n.length - 3].twin = p[f], p[f].twin = n[n.length - 3]), p[f] = null, m = n[n.length - 1]) : (S(o, d, g), m !== null && (n[n.length - 3].twin = m, m.twin = n[n.length - 3]), p[f] = n[n.length - 2], m = null)) : (p[f] = null, m = null), q[B] = g, Q = !!w;
345
- }
346
- return console.timeEnd("triangulate"), console.log(c.length / 3), { vertices: r, indices: c, uvs: a, edges: n };
347
- }
348
- const ft = (u) => `#${u.toString(16).padStart(6, "0")}`;
349
- function ut() {
350
- const u = "123456789ABCDEF";
351
- let t = "#";
352
- for (let e = 0; e < 6; e++)
353
- t += u[Math.floor(Math.random() * 16)];
354
- return t;
355
- }
356
- async function dt(u, t = -1, e = null) {
357
- const s = await u.arrayBuffer(), i = new DataView(s), r = {
358
- ny: i.getInt32(8, !1),
359
- xori: i.getFloat32(12, !1),
360
- xmax: i.getFloat32(16, !1),
361
- yori: i.getFloat32(20, !1),
362
- ymax: i.getFloat32(24, !1),
363
- xinc: i.getFloat32(28, !1),
364
- yinc: i.getFloat32(32, !1),
365
- nx: i.getInt32(44, !1),
366
- rot: i.getFloat32(48, !1)
367
- }, n = 1e30, a = 1e-30, c = new Float32Array(r.nx * r.ny);
368
- let h, o, l, d, g, b = 0, y = 100;
369
- for (; y < i.byteLength; ) {
370
- o = i.getInt32(y), y += 4;
371
- for (let _ = 0; _ < o; _ += 4)
372
- h = i.getFloat32(y + _, !1), l = b % r.nx, d = r.ny - Math.floor(b / r.nx), g = (d - 1) * r.nx + l, c[g] = h < a || h > n ? t : e ? e - h : h, b++;
373
- y += o + 4;
374
- }
375
- return { header: r, data: c };
376
- }
377
- function gt(u) {
378
- return u.map((t) => -t);
379
- }
380
- function mt(u, t) {
381
- return u.map((e) => e * t);
382
- }
383
- function pt(u, t, e) {
384
- const s = (i) => {
385
- if (i.userData[u] && i.userData[u] === t)
386
- return i;
387
- if (i.children && i.children.length)
388
- for (let r = 0; r < i.children.length; r++) {
389
- const n = s(i.children[r]);
390
- if (n)
391
- return n;
392
- }
393
- return null;
394
- };
395
- return s(e);
396
- }
397
- class k {
398
- data;
399
- columns;
400
- rows;
401
- stride;
402
- _rowLength;
403
- _lerpFn = [];
404
- arrayConstructor;
405
- constructor(t, e, s = 1) {
406
- this.data = t, this.columns = e, this.stride = s, this._rowLength = e * s, this.rows = this.data.length / this._rowLength, this.arrayConstructor = (i) => new this.data.constructor(
407
- i
408
- );
409
- }
410
- static readWriteBlock(t, e, s, i, r, n, a, c, h, o, l = null) {
411
- if (!(t instanceof k && n instanceof k))
412
- throw Error("Source and target must be of type Typed2dArray");
413
- if (a < 0 || a + h > n.columns || c < 0 || c + o > n.rows)
414
- throw Error("Invalid target block dimensions!");
415
- if (e < 0 || e + i > t.columns || s < 0 || s + r > t.rows)
416
- throw Error("Invalid source block dimensions!");
417
- const d = Math.max(1, h - 1), g = Math.max(1, o - 1), b = Math.max(1, i - 1), y = Math.max(1, r - 1);
418
- for (let _ = 0; _ < o; _++) {
419
- const v = n.index(0, _ + c), C = _ / g * y + s;
420
- for (let A = 0; A < h; A++) {
421
- const x = v + (A + a) * n.stride, z = A / d * b + e;
422
- let M = t.valueAt(z, C);
423
- if (l && (M = l(M)), n.stride === 1)
424
- n.data[x] = M;
425
- else if (Array.isArray(M))
426
- for (let E = 0; E < M.length; E++)
427
- n.data[x + E] = M[E];
428
- }
429
- }
430
- return this;
431
- }
432
- // built-in interpolation methods
433
- static logInterp(t, e, s, i, r, n) {
434
- const a = (e * e - t * t) * r + t * t, c = (i * i - s * s) * r + s * s;
435
- return Math.sqrt((c - a) * n + a);
436
- }
437
- static linearInterp(t, e, s, i, r, n) {
438
- const a = (e - t) * r + t;
439
- return ((i - s) * r + s - a) * n + a;
440
- }
441
- static nearestInterp(t, e, s, i, r, n) {
442
- const a = r <= 0.5 ? t : e, c = r <= 0.5 ? s : i;
443
- return n <= 0.5 ? a : c;
444
- }
445
- // // create a new Typed2DArray instance using an existing data array
446
- // static from<ArrayType>(source: ArrayType, columns: number, stride = 1, copyData = false) {
447
- // const data = source instanceof Typed2DArray ? source.data : source;
448
- // const array = new Typed2DArray(data.constructor, columns, data.length / (columns * stride), stride, false);
449
- // array.data = copyData ? new array.type(data) : data;
450
- // if (source instanceof Typed2DArray) {
451
- // array.setInterpolator(...source._lerpFn);
452
- // }
453
- // return array;
454
- // }
455
- // alias for columns
456
- get width() {
457
- return this.columns;
458
- }
459
- // alias for rows
460
- get height() {
461
- return this.rows;
462
- }
463
- // get the array index to the first component from the provided column and row indices
464
- index(t, e) {
465
- if (t < 0 || e < 0 || t >= this.columns || e >= this.rows)
466
- throw Error("Index out of bounds!");
467
- return e * this._rowLength + t * this.stride;
468
- }
469
- // get the column and row at the beginning of the item according to stride from an index into the data array
470
- positionOf(t) {
471
- if (t < 0 || t > this.data.length) return;
472
- const e = t % this.stride, s = Math.floor((t - e) / this._rowLength), i = Math.floor((t - s * this._rowLength) / this.stride);
473
- return { row: s, col: i };
474
- }
475
- // allow you to set a custom interpolation function per component, which are used when interpolating values
476
- setInterpolator(...t) {
477
- return this._lerpFn = t, this;
478
- }
479
- // get the configured interpolation function for the given component index
480
- getInterpolator(t) {
481
- return this._lerpFn.length > 0 ? this._lerpFn[Math.min(t, this._lerpFn.length - 1)] : k.linearInterp;
482
- }
483
- // convenience function for reading an entire column
484
- col(t, e) {
485
- return this.readBlock(
486
- Math.floor(t),
487
- 0,
488
- 1,
489
- this.rows,
490
- void 0,
491
- void 0,
492
- e
493
- );
494
- }
495
- // convenience function for reading an entire row
496
- row(t, e) {
497
- const s = this.index(0, Math.floor(t));
498
- if (e) {
499
- for (let i = 0; i < this._rowLength; i++)
500
- e[i] = this.data[s + i];
501
- return e;
502
- }
503
- return this.data.subarray(s, s + this._rowLength);
504
- }
505
- // set a single value into the provided column and row
506
- setValue(t, e, ...s) {
507
- const i = this.index(t, e);
508
- for (let r = 0; r < Math.min(s.length, this.stride); r++)
509
- this.data[i + r] = s[r];
510
- return this;
511
- }
512
- // read all the values within the provided block dimension
513
- readBlock(t, e, s, i, r, n, a) {
514
- if (t < 0 || t + s > this.columns || e < 0 || e + i > this.rows)
515
- throw Error("Invalid block dimensions!");
516
- r = Number.isFinite(r) ? r : s, n = Number.isFinite(n) ? n : i, a = a || this.arrayConstructor(r * n * this.stride);
517
- const c = Math.max(1, r - 1), h = Math.max(1, n - 1), o = Math.max(1, s - 1), l = Math.max(1, i - 1);
518
- let d = 0;
519
- for (let g = 0; g < n; g++) {
520
- const b = g / h * l + e;
521
- for (let y = 0; y < r; y++) {
522
- const _ = y / c * o + t, v = this.valueAt(_, b);
523
- if (this.stride === 1)
524
- a[d++] = v;
525
- else if (Array.isArray(v))
526
- for (let C = 0; C < v.length; C++)
527
- a[d++] = v[C];
528
- }
529
- }
530
- return a;
531
- }
532
- // upscale grid using the current interpolation method
533
- upscale(t, e) {
534
- if (t < this.columns || e < this.rows)
535
- throw Error(
536
- "New column and row size must be equal or bigger than the current sizes!"
537
- );
538
- const s = this.readBlock(
539
- 0,
540
- 0,
541
- this.columns,
542
- this.rows,
543
- t,
544
- e
545
- );
546
- return this.columns = t, this.rows = e, this._rowLength = t * this.stride, this.data = s, this;
547
- }
548
- // write values into a given block dimension
549
- writeBlock(t, e, s, i, r) {
550
- if (r.length !== s * i * this.stride)
551
- throw Error("Incorrect number of values");
552
- if (t < 0 || t + s > this.columns || e < 0 || e + i > this.rows)
553
- throw Error("Invalid block dimensions!");
554
- let n = 0;
555
- for (let a = e; a < e + i; a++) {
556
- const c = this.index(t, a);
557
- for (let h = 0; h < s; h++) {
558
- const o = c + h * this.stride;
559
- for (let l = 0; l < this.stride; l++)
560
- this.data[o + l] = r[n++];
561
- }
562
- }
563
- return this;
564
- }
565
- // fills the block with a single value
566
- fillBlock(t, e, s, i, r) {
567
- if (t < 0 || t + s > this.columns || e < 0 || e + i > this.rows)
568
- throw Error("Invalid block dimensions!");
569
- let n = (a, c, h) => {
570
- this.data[h] = r;
571
- };
572
- typeof r == "function" ? n = (a, c, h) => {
573
- const o = r(a, c, h);
574
- if (Array.isArray(o) && o.length && o.length > 0)
575
- for (let l = 0; l < Math.min(o.length, this.stride); l++)
576
- this.data[h + l] = o[l];
577
- else
578
- this.data[h] = o;
579
- } : this.stride > 1 && Array.isArray(r) && (n = (a, c, h) => {
580
- for (let o = 0; o < Math.min(r.length, this.stride); o++)
581
- this.data[h + o] = r[o];
582
- });
583
- for (let a = e; a < e + i; a++) {
584
- const c = this.index(t, a);
585
- for (let h = 0; h < s; h++) {
586
- const o = c + h * this.stride;
587
- n(h, a, o);
588
- }
589
- }
590
- return this;
591
- }
592
- // get the value corresponding to the specified index according to stride
593
- valueOf(t, e) {
594
- const { stride: s, data: i } = this;
595
- if (s > 1) {
596
- t = t % s, e = e || this.arrayConstructor(s);
597
- for (let r = 0; r < s; r++)
598
- e[r] = i[t + r];
599
- return e;
600
- }
601
- return i[t];
602
- }
603
- // get the calue at the requested column and row, which may be given as fractions, which in case
604
- // bilinear filtering will be applied to interpolate values (for each component) in between columns and rows
605
- valueAt(t, e, s) {
606
- const { columns: i, rows: r, stride: n, data: a } = this, c = t % 1, h = e % 1;
607
- if (c > 0 || h > 0) {
608
- const l = (t < 0 ? 0 : t >= i ? i - 1 : t) | 0, d = (e < 0 ? 0 : e >= r ? r - 1 : e) | 0, g = l === i - 1 ? l : l + 1, b = d === r - 1 ? d : d + 1;
609
- let y = this.index(l, d), _ = this.index(g, d), v = this.index(l, b), C = this.index(g, b);
610
- if (n > 1) {
611
- s = s || this.arrayConstructor(n);
612
- for (let x = 0; x < n; x++) {
613
- const z = this.getInterpolator(x);
614
- s[x] = z(a[y++], a[_++], a[v++], a[C++], c, h);
615
- }
616
- return s;
617
- }
618
- return this.getInterpolator(0)(a[y], a[_], a[v], a[C], c, h);
619
- }
620
- const o = this.index(t, e);
621
- if (n > 1) {
622
- s = s || this.arrayConstructor(n);
623
- for (let l = 0; l < n; l++)
624
- s[l] = a[o + l];
625
- return s;
626
- }
627
- return a[o];
628
- }
629
- // swap all values from one row with all values from another row
630
- swapRows(t, e, s) {
631
- s = s || this.arrayConstructor(this._rowLength), this.row(t, s);
632
- const i = this.index(0, t), r = this.index(0, e);
633
- for (let n = 0; n < this._rowLength; n++)
634
- this.data[i + n] = this.data[r + n], this.data[r + n] = s[n];
635
- return this;
636
- }
637
- // invert all rows (top-bottom to bottom-top)
638
- invertRows() {
639
- const t = Math.floor(this.rows / 2), e = this.arrayConstructor(this._rowLength);
640
- for (let s = this.rows - 1, i = 0; s > t; s--, i++)
641
- this.swapRows(s, i, e);
642
- return this;
643
- }
644
- copyInto(t, e = 0, s = 0, i = this.columns - e, r = this.rows - s) {
645
- if (t.length !== i * r * this.stride)
646
- throw Error("Target is not of the correct size!");
647
- let n = 0;
648
- for (let a = s; a < s + r; a++) {
649
- const c = this.index(0, a);
650
- for (let h = e; h < e + i; h++) {
651
- const o = c + h * this.stride;
652
- for (let l = 0; l < this.stride; l++)
653
- t[n++] = this.data[o + l];
654
- }
655
- }
656
- return this;
657
- }
658
- // return a multi-dimensional javascript array of the data (main purpose for debugging)
659
- toJsArray() {
660
- const t = new Array(this.rows);
661
- for (let e = 0; e < this.rows; e++) {
662
- const s = this.index(0, e);
663
- t[e] = new Array(this.columns);
664
- for (let i = 0; i < this.columns; i++)
665
- if (this.stride > 1) {
666
- t[e][i] = new Array(this.stride);
667
- for (let r = 0; r < this.stride; r++)
668
- t[e][i][r] = this.data[s + i * this.stride + r];
669
- } else
670
- t[e][i] = this.data[s + i * this.stride];
671
- }
672
- return t;
673
- }
674
- }
675
- function yt(u) {
676
- const t = new Float32Array(u.length * 3);
677
- for (let e = 0; e < u.length; e++) {
678
- const s = e * 3;
679
- t[s + 0] = u[e][0], t[s + 1] = u[e][1], t[s + 2] = u[e][2];
680
- }
681
- return t;
682
- }
683
- export {
684
- Se as CRS,
685
- xt as CameraManager,
686
- lt as DataLoader,
687
- Ue as Delatin,
688
- bt as DepthReadMaterial,
689
- ht as GeneratorRegistry,
690
- vt as PI,
691
- Mt as PI2,
692
- Ct as PI4,
693
- Et as PI8,
694
- W as PlanarGeometry,
695
- Z as PlanarLineGeometry,
696
- H as PlanarPointGeometry,
697
- $ as PlanarPolygonGeometry,
698
- Bt as TAU,
699
- Le as TubeMaterial,
700
- k as Typed2DArray,
701
- At as WellboreManager,
702
- zt as addVec2,
703
- Ft as addVec3,
704
- It as angleVec3,
705
- St as calculateFrenetFrames,
706
- We as calculateHashValue,
707
- Ve as calculateWellSegments,
708
- K as clamp,
709
- Lt as copyVec3,
710
- Te as createConfig,
711
- Pe as createElevationTexture,
712
- He as createFenceGeometry,
713
- De as createNormalTexture,
714
- Ze as createTubeGeometries,
715
- $e as createTubeGeometry,
716
- Vt as crossVec3,
717
- Tt as degreesToRadians,
718
- Pt as directionVec2,
719
- Dt as directionVec3,
720
- Gt as distanceVec2,
721
- qt as distanceVec3,
722
- jt as dotVec2,
723
- kt as dotVec3,
724
- Nt as edgeOfRectangle,
725
- Ge as elevationMapNormalsToRGBA,
726
- Ot as feetToMeters,
727
- Qt as getCurvePositions,
728
- Ut as getFormationMarkers,
729
- pt as getObjectByCustomProperty,
730
- Wt as getProjectedTrajectory,
731
- qe as getProjectionDefFromUtmZone,
732
- Ht as getSplineCurve,
733
- Zt as getTrajectory,
734
- $t as getTypedArrayFromBuffer,
735
- Jt as getTypedArrayType,
736
- je as getUtmZoneFromLatLng,
737
- Kt as getVec2,
738
- Xt as getVec3,
739
- Yt as getWellboreFormations,
740
- ft as idToHexColor,
741
- Rt as inverseLerp,
742
- te as lengthVec2,
743
- ee as lengthVec3,
744
- se as lerp,
745
- ie as mergeFormationIntervals,
746
- Je as mergeGeometries,
747
- ne as mixVec2,
748
- re as mixVec3,
749
- mt as multiply,
750
- gt as negate,
751
- ae as negateVec2,
752
- oe as negateVec3,
753
- le as normalizeVec2,
754
- he as normalizeVec3,
755
- ce as normalizedDeviceToScreen,
756
- fe as packAttribute,
757
- ue as packBufferGeometries,
758
- de as packBufferGeometry,
759
- ge as packBufferGeometryLike,
760
- dt as parseIrapbin,
761
- ut as randomColor,
762
- me as readDepth,
763
- pe as remap,
764
- ye as rotateVec3,
765
- _e as scaleVec2,
766
- we as scaleVec3,
767
- xe as screenToNormalizedDevice,
768
- be as setVec2,
769
- ve as setVec3,
770
- Me as simplifyCurve2D,
771
- Ce as subVec2,
772
- Ee as subVec3,
773
- Ke as titleCase,
774
- Xe as toBufferGeometry,
775
- yt as toFloat32Array,
776
- Be as toRGB,
777
- ke as toSegments,
778
- Ne as triangleNormal,
779
- ct as triangulateGrid,
780
- Ye as triangulateGridDelaunay,
781
- Ae as unpackBufferGeometries,
782
- ze as unpackBufferGeometry,
783
- Fe as uvMaterial,
784
- Oe as wgs84Def
785
- };
1
+ import { $ as e, $t as t, A as n, At as r, Bt as i, C as a, Cn as o, Ct as s, D as c, Dn as l, Dt as u, E as d, En as f, Et as p, F as m, Ft as h, Gt as g, H as _, Ht as v, It as y, J as b, Jt as x, Kt as S, Lt as C, M as w, Mt as T, N as E, Nt as D, O, Ot as k, P as A, Pt as j, Q as M, Qt as N, Rt as P, S as F, Sn as I, St as L, T as R, Tn as z, Tt as B, Ut as V, Vt as H, Wt as U, X as W, Xt as G, Y as K, Yt as q, Z as J, Zt as Y, _ as X, _n as Z, _t as Q, an as $, at as ee, b as te, bn as ne, bt as re, c as ie, cn as ae, ct as oe, d as se, dn as ce, dt as le, en as ue, et as de, f as fe, fn as pe, ft as me, g as he, gn as ge, gt as _e, h as ve, hn as ye, ht as be, in as xe, it as Se, j as Ce, jt as we, k as Te, kt as Ee, l as De, ln as Oe, lt as ke, m as Ae, mn as je, mt as Me, n as Ne, nn as Pe, nt as Fe, on as Ie, ot as Le, p as Re, pn as ze, pt as Be, q as Ve, qt as He, rn as Ue, rt as We, s as Ge, sn as Ke, st as qe, t as Je, tn as Ye, tt as Xe, u as Ze, un as Qe, ut as $e, v as et, vn as tt, vt as nt, w as rt, wn as it, wt as at, x as ot, xn as st, xt as ct, y as lt, yn as ut, yt as dt, zt as ft } from "./chunk-DKAquGKk.js";
2
+ export { Ce as CRS, _ as CameraManager, l as DataLoader, B as Delatin, rt as DepthReadMaterial, f as GeneratorRegistry, ae as PI, Oe as PI2, Qe as PI4, ce as PI8, b as PlanarGeometry, K as PlanarLineGeometry, W as PlanarPointGeometry, J as PlanarPolygonGeometry, pe as TAU, Ne as TubeMaterial, ie as Typed2DArray, m as WellboreManager, D as addVec2, j as addVec3, h as angleVec3, y as asVec2, Me as buildMaskedGridPlane, r as calculateFrenetFrames, De as calculateHashValue, I as calculateWellSegments, je as clamp, Q as computePlanarXZUv, X as computeSurfaceNormalsRG, nt as computeUpwardNormals, C as copyVec3, he as createConfig, et as createElevationTexture, ct as createFenceGeometry, dt as createIndexedGeometry, lt as createNormalTexture, Le as createOceanBox, qe as createOceanBoxFromPolygon, oe as createOceanBoxFromSurface, ke as createOceanEllipseBox, $e as createOceanPlane, te as createPackedNormalTexture, p as createTubeGeometries, u as createTubeGeometry, P as crossVec3, R as degreesToRadians, ft as directionVec2, i as directionVec3, H as distanceVec2, v as distanceVec3, V as dotVec2, U as dotVec3, ze as edgeOfRectangle, ot as elevationMapNormalsToRGBA, ut as extractBoundaryLoops, d as feetToMeters, be as floodFillExternalHoles, we as getCurvePositions, o as getFormationMarkers, fe as getObjectByCustomProperty, L as getProjectedTrajectory, w as getProjectionDefFromUtmZone, T as getSplineCurve, s as getTrajectory, M as getTypedArrayFromBuffer, e as getTypedArrayType, E as getUtmZoneFromLatLng, g as getVec2, S as getVec3, it as getWellboreFormations, Te as idToHexColor, ye as inverseLerp, He as lengthVec2, x as lengthVec3, ge as lerp, z as mergeFormationIntervals, k as mergeGeometries, q as mixVec2, G as mixVec3, Re as multiply, Ae as negate, Y as negateVec2, N as negateVec3, t as normalizeVec2, ue as normalizeVec3, c as normalizedDeviceToScreen, de as packAttribute, Xe as packBufferGeometries, Fe as packBufferGeometry, We as packBufferGeometryLike, ve as parseIrapbin, n as randomColor, a as readDepth, me as refineInteriorEdges, Z as remap, re as rotateGeometryY, Ye as rotateVec3, _e as sampleValidGrid, Pe as scaleVec2, Ue as scaleVec3, O as screenToNormalizedDevice, xe as setVec2, $ as setVec3, at as simplifyCurve2D, ne as smoothBoundaryLoops, st as snapBoundaryToOutline, Ie as subVec2, Ke as subVec3, Be as subdivideGeometry, Ze as titleCase, Ee as toBufferGeometry, Ge as toFloat32Array, tt as toRGB, se as toSegments, F as triangleNormal, Ve as triangulateGrid, le as triangulateGridDelaunay, Se as unpackBufferGeometries, ee as unpackBufferGeometry, Je as uvMaterial, A as wgs84Def };