@loaders.gl/i3s 4.3.0-alpha.7 → 4.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arcgis-webscene-loader.d.ts.map +1 -1
- package/dist/arcgis-webscene-loader.js +1 -1
- package/dist/dist.dev.js +443 -177
- package/dist/dist.min.js +1 -1
- package/dist/i3s-attribute-loader.d.ts.map +1 -1
- package/dist/i3s-attribute-loader.js +1 -1
- package/dist/i3s-building-scene-layer-loader.d.ts.map +1 -1
- package/dist/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s-content-loader.d.ts.map +1 -1
- package/dist/i3s-content-loader.js +1 -1
- package/dist/i3s-content-worker-node.js +53 -53
- package/dist/i3s-content-worker-node.js.map +4 -4
- package/dist/i3s-content-worker.js +362 -359
- package/dist/i3s-loader.d.ts.map +1 -1
- package/dist/i3s-loader.js +1 -1
- package/dist/i3s-node-page-loader.d.ts.map +1 -1
- package/dist/i3s-node-page-loader.js +1 -1
- package/dist/i3s-slpk-loader.d.ts.map +1 -1
- package/dist/i3s-slpk-loader.js +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/helpers/i3s-nodepages-tiles.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/index.ts +1 -0
|
@@ -41,85 +41,37 @@
|
|
|
41
41
|
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
42
42
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
43
43
|
|
|
44
|
-
// ../../node_modules/@
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
|
|
51
|
-
}, _typeof(obj);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPrimitive.js
|
|
55
|
-
function _toPrimitive(input, hint) {
|
|
56
|
-
if (_typeof(input) !== "object" || input === null)
|
|
57
|
-
return input;
|
|
58
|
-
var prim = input[Symbol.toPrimitive];
|
|
59
|
-
if (prim !== void 0) {
|
|
60
|
-
var res = prim.call(input, hint || "default");
|
|
61
|
-
if (_typeof(res) !== "object")
|
|
62
|
-
return res;
|
|
63
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
64
|
-
}
|
|
65
|
-
return (hint === "string" ? String : Number)(input);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// ../../node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
|
|
69
|
-
function _toPropertyKey(arg) {
|
|
70
|
-
var key = _toPrimitive(arg, "string");
|
|
71
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// ../../node_modules/@babel/runtime/helpers/esm/defineProperty.js
|
|
75
|
-
function _defineProperty(obj, key, value) {
|
|
76
|
-
key = _toPropertyKey(key);
|
|
77
|
-
if (key in obj) {
|
|
78
|
-
Object.defineProperty(obj, key, {
|
|
79
|
-
value,
|
|
80
|
-
enumerable: true,
|
|
81
|
-
configurable: true,
|
|
82
|
-
writable: true
|
|
83
|
-
});
|
|
84
|
-
} else {
|
|
85
|
-
obj[key] = value;
|
|
86
|
-
}
|
|
87
|
-
return obj;
|
|
88
|
-
}
|
|
44
|
+
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/globals.js
|
|
45
|
+
var window_2 = globalThis;
|
|
46
|
+
var document_2 = globalThis.document || {};
|
|
47
|
+
var process_ = globalThis.process || {};
|
|
48
|
+
var console_ = globalThis.console;
|
|
49
|
+
var navigator_ = globalThis.navigator || {};
|
|
89
50
|
|
|
90
51
|
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-electron.js
|
|
91
52
|
function isElectron(mockUserAgent) {
|
|
92
|
-
if (typeof window !== "undefined" &&
|
|
53
|
+
if (typeof window !== "undefined" && window.process?.type === "renderer") {
|
|
93
54
|
return true;
|
|
94
55
|
}
|
|
95
|
-
if (typeof process !== "undefined" &&
|
|
56
|
+
if (typeof process !== "undefined" && Boolean(process.versions?.["electron"])) {
|
|
96
57
|
return true;
|
|
97
58
|
}
|
|
98
|
-
const realUserAgent = typeof navigator
|
|
59
|
+
const realUserAgent = typeof navigator !== "undefined" && navigator.userAgent;
|
|
99
60
|
const userAgent = mockUserAgent || realUserAgent;
|
|
100
|
-
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
|
-
return false;
|
|
61
|
+
return Boolean(userAgent && userAgent.indexOf("Electron") >= 0);
|
|
104
62
|
}
|
|
105
63
|
|
|
106
64
|
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/lib/is-browser.js
|
|
107
65
|
function isBrowser2() {
|
|
108
|
-
const isNode =
|
|
66
|
+
const isNode = (
|
|
67
|
+
// @ts-expect-error
|
|
68
|
+
typeof process === "object" && String(process) === "[object process]" && !process?.browser
|
|
69
|
+
);
|
|
109
70
|
return !isNode || isElectron();
|
|
110
71
|
}
|
|
111
72
|
|
|
112
|
-
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/
|
|
113
|
-
var
|
|
114
|
-
var window_2 = globalThis.window || globalThis.self || globalThis.global;
|
|
115
|
-
var document_2 = globalThis.document || {};
|
|
116
|
-
var process_ = globalThis.process || {};
|
|
117
|
-
var console_ = globalThis.console;
|
|
118
|
-
var navigator_ = globalThis.navigator || {};
|
|
119
|
-
|
|
120
|
-
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/utils/globals.js
|
|
121
|
-
var VERSION = true ? "4.3.0-alpha.6" : "untranspiled source";
|
|
122
|
-
var isBrowser3 = isBrowser2();
|
|
73
|
+
// ../../node_modules/@probe.gl/log/node_modules/@probe.gl/env/dist/index.js
|
|
74
|
+
var VERSION = true ? "4.0.7" : "untranspiled source";
|
|
123
75
|
|
|
124
76
|
// ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
125
77
|
function getStorage(type) {
|
|
@@ -134,11 +86,7 @@
|
|
|
134
86
|
}
|
|
135
87
|
}
|
|
136
88
|
var LocalStorage = class {
|
|
137
|
-
constructor(id, defaultConfig) {
|
|
138
|
-
let type = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "sessionStorage";
|
|
139
|
-
_defineProperty(this, "storage", void 0);
|
|
140
|
-
_defineProperty(this, "id", void 0);
|
|
141
|
-
_defineProperty(this, "config", void 0);
|
|
89
|
+
constructor(id, defaultConfig, type = "sessionStorage") {
|
|
142
90
|
this.storage = getStorage(type);
|
|
143
91
|
this.id = id;
|
|
144
92
|
this.config = defaultConfig;
|
|
@@ -154,6 +102,7 @@
|
|
|
154
102
|
this.storage.setItem(this.id, serialized);
|
|
155
103
|
}
|
|
156
104
|
}
|
|
105
|
+
// Get config from persistent store, if available
|
|
157
106
|
_loadConfiguration() {
|
|
158
107
|
let configuration = {};
|
|
159
108
|
if (this.storage) {
|
|
@@ -169,31 +118,19 @@
|
|
|
169
118
|
function formatTime(ms) {
|
|
170
119
|
let formatted;
|
|
171
120
|
if (ms < 10) {
|
|
172
|
-
formatted =
|
|
121
|
+
formatted = `${ms.toFixed(2)}ms`;
|
|
173
122
|
} else if (ms < 100) {
|
|
174
|
-
formatted =
|
|
123
|
+
formatted = `${ms.toFixed(1)}ms`;
|
|
175
124
|
} else if (ms < 1e3) {
|
|
176
|
-
formatted =
|
|
125
|
+
formatted = `${ms.toFixed(0)}ms`;
|
|
177
126
|
} else {
|
|
178
|
-
formatted =
|
|
127
|
+
formatted = `${(ms / 1e3).toFixed(2)}s`;
|
|
179
128
|
}
|
|
180
129
|
return formatted;
|
|
181
130
|
}
|
|
182
|
-
function leftPad(string) {
|
|
183
|
-
let length2 = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 8;
|
|
131
|
+
function leftPad(string, length2 = 8) {
|
|
184
132
|
const padLength = Math.max(length2 - string.length, 0);
|
|
185
|
-
return "
|
|
186
|
-
}
|
|
187
|
-
function formatImage(image, message, scale3) {
|
|
188
|
-
let maxWidth = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 600;
|
|
189
|
-
const imageUrl = image.src.replace(/\(/g, "%28").replace(/\)/g, "%29");
|
|
190
|
-
if (image.width > maxWidth) {
|
|
191
|
-
scale3 = Math.min(scale3, maxWidth / image.width);
|
|
192
|
-
}
|
|
193
|
-
const width = image.width * scale3;
|
|
194
|
-
const height = image.height * scale3;
|
|
195
|
-
const style = ["font-size:1px;", "padding:".concat(Math.floor(height / 2), "px ").concat(Math.floor(width / 2), "px;"), "line-height:".concat(height, "px;"), "background:url(".concat(imageUrl, ");"), "background-size:".concat(width, "px ").concat(height, "px;"), "color:transparent;"].join("");
|
|
196
|
-
return ["".concat(message, " %c+"), style];
|
|
133
|
+
return `${" ".repeat(padLength)}${string}`;
|
|
197
134
|
}
|
|
198
135
|
|
|
199
136
|
// ../../node_modules/@probe.gl/log/dist/utils/color.js
|
|
@@ -228,19 +165,18 @@
|
|
|
228
165
|
if (!isBrowser2 && typeof string === "string") {
|
|
229
166
|
if (color) {
|
|
230
167
|
const colorCode = getColor(color);
|
|
231
|
-
string =
|
|
168
|
+
string = `\x1B[${colorCode}m${string}\x1B[39m`;
|
|
232
169
|
}
|
|
233
170
|
if (background) {
|
|
234
171
|
const colorCode = getColor(background);
|
|
235
|
-
string =
|
|
172
|
+
string = `\x1B[${colorCode + BACKGROUND_INCREMENT}m${string}\x1B[49m`;
|
|
236
173
|
}
|
|
237
174
|
}
|
|
238
175
|
return string;
|
|
239
176
|
}
|
|
240
177
|
|
|
241
178
|
// ../../node_modules/@probe.gl/log/dist/utils/autobind.js
|
|
242
|
-
function autobind(obj) {
|
|
243
|
-
let predefined = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ["constructor"];
|
|
179
|
+
function autobind(obj, predefined = ["constructor"]) {
|
|
244
180
|
const proto = Object.getPrototypeOf(obj);
|
|
245
181
|
const propNames = Object.getOwnPropertyNames(proto);
|
|
246
182
|
const object = obj;
|
|
@@ -265,11 +201,9 @@
|
|
|
265
201
|
function getHiResTimestamp() {
|
|
266
202
|
let timestamp;
|
|
267
203
|
if (isBrowser2() && window_2.performance) {
|
|
268
|
-
|
|
269
|
-
timestamp = window_2 === null || window_2 === void 0 ? void 0 : (_window$performance = window_2.performance) === null || _window$performance === void 0 ? void 0 : (_window$performance$n = _window$performance.now) === null || _window$performance$n === void 0 ? void 0 : _window$performance$n.call(_window$performance);
|
|
204
|
+
timestamp = window_2?.performance?.now?.();
|
|
270
205
|
} else if ("hrtime" in process_) {
|
|
271
|
-
|
|
272
|
-
const timeParts = process_ === null || process_ === void 0 ? void 0 : (_process$hrtime = process_.hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(process_);
|
|
206
|
+
const timeParts = process_?.hrtime?.();
|
|
273
207
|
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
274
208
|
} else {
|
|
275
209
|
timestamp = Date.now();
|
|
@@ -292,27 +226,18 @@
|
|
|
292
226
|
function noop() {
|
|
293
227
|
}
|
|
294
228
|
var cache = {};
|
|
295
|
-
var ONCE = {
|
|
296
|
-
once: true
|
|
297
|
-
};
|
|
229
|
+
var ONCE = { once: true };
|
|
298
230
|
var Log = class {
|
|
299
|
-
constructor() {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
_defineProperty(this, "id", void 0);
|
|
306
|
-
_defineProperty(this, "VERSION", VERSION);
|
|
307
|
-
_defineProperty(this, "_startTs", getHiResTimestamp());
|
|
308
|
-
_defineProperty(this, "_deltaTs", getHiResTimestamp());
|
|
309
|
-
_defineProperty(this, "_storage", void 0);
|
|
310
|
-
_defineProperty(this, "userData", {});
|
|
311
|
-
_defineProperty(this, "LOG_THROTTLE_TIMEOUT", 0);
|
|
231
|
+
constructor({ id } = { id: "" }) {
|
|
232
|
+
this.VERSION = VERSION;
|
|
233
|
+
this._startTs = getHiResTimestamp();
|
|
234
|
+
this._deltaTs = getHiResTimestamp();
|
|
235
|
+
this.userData = {};
|
|
236
|
+
this.LOG_THROTTLE_TIMEOUT = 0;
|
|
312
237
|
this.id = id;
|
|
313
238
|
this.userData = {};
|
|
314
|
-
this._storage = new LocalStorage(
|
|
315
|
-
this.timeStamp(
|
|
239
|
+
this._storage = new LocalStorage(`__probe-${this.id}__`, DEFAULT_LOG_CONFIGURATION);
|
|
240
|
+
this.timeStamp(`${this.id} started`);
|
|
316
241
|
autobind(this);
|
|
317
242
|
Object.seal(this);
|
|
318
243
|
}
|
|
@@ -328,42 +253,44 @@
|
|
|
328
253
|
getLevel() {
|
|
329
254
|
return this._storage.config.level;
|
|
330
255
|
}
|
|
256
|
+
/** @return milliseconds, with fractions */
|
|
331
257
|
getTotal() {
|
|
332
258
|
return Number((getHiResTimestamp() - this._startTs).toPrecision(10));
|
|
333
259
|
}
|
|
260
|
+
/** @return milliseconds, with fractions */
|
|
334
261
|
getDelta() {
|
|
335
262
|
return Number((getHiResTimestamp() - this._deltaTs).toPrecision(10));
|
|
336
263
|
}
|
|
264
|
+
/** @deprecated use logLevel */
|
|
337
265
|
set priority(newPriority) {
|
|
338
266
|
this.level = newPriority;
|
|
339
267
|
}
|
|
268
|
+
/** @deprecated use logLevel */
|
|
340
269
|
get priority() {
|
|
341
270
|
return this.level;
|
|
342
271
|
}
|
|
272
|
+
/** @deprecated use logLevel */
|
|
343
273
|
getPriority() {
|
|
344
274
|
return this.level;
|
|
345
275
|
}
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
this._storage.setConfiguration({
|
|
349
|
-
enabled
|
|
350
|
-
});
|
|
276
|
+
// Configure
|
|
277
|
+
enable(enabled = true) {
|
|
278
|
+
this._storage.setConfiguration({ enabled });
|
|
351
279
|
return this;
|
|
352
280
|
}
|
|
353
281
|
setLevel(level) {
|
|
354
|
-
this._storage.setConfiguration({
|
|
355
|
-
level
|
|
356
|
-
});
|
|
282
|
+
this._storage.setConfiguration({ level });
|
|
357
283
|
return this;
|
|
358
284
|
}
|
|
285
|
+
/** return the current status of the setting */
|
|
359
286
|
get(setting) {
|
|
360
287
|
return this._storage.config[setting];
|
|
361
288
|
}
|
|
289
|
+
// update the status of the setting
|
|
362
290
|
set(setting, value) {
|
|
363
|
-
this._storage.setConfiguration({
|
|
364
|
-
[setting]: value
|
|
365
|
-
});
|
|
291
|
+
this._storage.setConfiguration({ [setting]: value });
|
|
366
292
|
}
|
|
293
|
+
/** Logs the current settings as a table */
|
|
367
294
|
settings() {
|
|
368
295
|
if (console.table) {
|
|
369
296
|
console.table(this._storage.config);
|
|
@@ -371,8 +298,11 @@
|
|
|
371
298
|
console.log(this._storage.config);
|
|
372
299
|
}
|
|
373
300
|
}
|
|
301
|
+
// Unconditional logging
|
|
374
302
|
assert(condition, message) {
|
|
375
|
-
|
|
303
|
+
if (!condition) {
|
|
304
|
+
throw new Error(message || "Assertion failed");
|
|
305
|
+
}
|
|
376
306
|
}
|
|
377
307
|
warn(message) {
|
|
378
308
|
return this._getLogFunction(0, message, originalConsole.warn, arguments, ONCE);
|
|
@@ -380,11 +310,13 @@
|
|
|
380
310
|
error(message) {
|
|
381
311
|
return this._getLogFunction(0, message, originalConsole.error, arguments);
|
|
382
312
|
}
|
|
313
|
+
/** Print a deprecation warning */
|
|
383
314
|
deprecated(oldUsage, newUsage) {
|
|
384
|
-
return this.warn(
|
|
315
|
+
return this.warn(`\`${oldUsage}\` is deprecated and will be removed in a later version. Use \`${newUsage}\` instead`);
|
|
385
316
|
}
|
|
317
|
+
/** Print a removal warning */
|
|
386
318
|
removed(oldUsage, newUsage) {
|
|
387
|
-
return this.error(
|
|
319
|
+
return this.error(`\`${oldUsage}\` has been removed. Use \`${newUsage}\` instead`);
|
|
388
320
|
}
|
|
389
321
|
probe(logLevel, message) {
|
|
390
322
|
return this._getLogFunction(logLevel, message, originalConsole.log, arguments, {
|
|
@@ -401,6 +333,7 @@
|
|
|
401
333
|
once(logLevel, message) {
|
|
402
334
|
return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
|
|
403
335
|
}
|
|
336
|
+
/** Logs an object as a table */
|
|
404
337
|
table(logLevel, table, columns) {
|
|
405
338
|
if (table) {
|
|
406
339
|
return this._getLogFunction(logLevel, table, console.table || noop, columns && [columns], {
|
|
@@ -409,27 +342,6 @@
|
|
|
409
342
|
}
|
|
410
343
|
return noop;
|
|
411
344
|
}
|
|
412
|
-
image(_ref) {
|
|
413
|
-
let {
|
|
414
|
-
logLevel,
|
|
415
|
-
priority,
|
|
416
|
-
image,
|
|
417
|
-
message = "",
|
|
418
|
-
scale: scale3 = 1
|
|
419
|
-
} = _ref;
|
|
420
|
-
if (!this._shouldLog(logLevel || priority)) {
|
|
421
|
-
return noop;
|
|
422
|
-
}
|
|
423
|
-
return isBrowser2() ? logImageInBrowser({
|
|
424
|
-
image,
|
|
425
|
-
message,
|
|
426
|
-
scale: scale3
|
|
427
|
-
}) : logImageInNode({
|
|
428
|
-
image,
|
|
429
|
-
message,
|
|
430
|
-
scale: scale3
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
345
|
time(logLevel, message) {
|
|
434
346
|
return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
|
|
435
347
|
}
|
|
@@ -439,30 +351,19 @@
|
|
|
439
351
|
timeStamp(logLevel, message) {
|
|
440
352
|
return this._getLogFunction(logLevel, message, console.timeStamp || noop);
|
|
441
353
|
}
|
|
442
|
-
group(logLevel, message) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
};
|
|
446
|
-
const options = normalizeArguments({
|
|
447
|
-
logLevel,
|
|
448
|
-
message,
|
|
449
|
-
opts
|
|
450
|
-
});
|
|
451
|
-
const {
|
|
452
|
-
collapsed
|
|
453
|
-
} = opts;
|
|
354
|
+
group(logLevel, message, opts = { collapsed: false }) {
|
|
355
|
+
const options = normalizeArguments({ logLevel, message, opts });
|
|
356
|
+
const { collapsed } = opts;
|
|
454
357
|
options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
|
|
455
358
|
return this._getLogFunction(options);
|
|
456
359
|
}
|
|
457
|
-
groupCollapsed(logLevel, message) {
|
|
458
|
-
|
|
459
|
-
return this.group(logLevel, message, Object.assign({}, opts, {
|
|
460
|
-
collapsed: true
|
|
461
|
-
}));
|
|
360
|
+
groupCollapsed(logLevel, message, opts = {}) {
|
|
361
|
+
return this.group(logLevel, message, Object.assign({}, opts, { collapsed: true }));
|
|
462
362
|
}
|
|
463
363
|
groupEnd(logLevel) {
|
|
464
364
|
return this._getLogFunction(logLevel, "", console.groupEnd || noop);
|
|
465
365
|
}
|
|
366
|
+
// EXPERIMENTAL
|
|
466
367
|
withGroup(logLevel, message, func) {
|
|
467
368
|
this.group(logLevel, message)();
|
|
468
369
|
try {
|
|
@@ -476,17 +377,14 @@
|
|
|
476
377
|
console.trace();
|
|
477
378
|
}
|
|
478
379
|
}
|
|
380
|
+
// PRIVATE METHODS
|
|
381
|
+
/** Deduces log level from a variety of arguments */
|
|
479
382
|
_shouldLog(logLevel) {
|
|
480
383
|
return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
|
|
481
384
|
}
|
|
482
385
|
_getLogFunction(logLevel, message, method, args, opts) {
|
|
483
386
|
if (this._shouldLog(logLevel)) {
|
|
484
|
-
opts = normalizeArguments({
|
|
485
|
-
logLevel,
|
|
486
|
-
message,
|
|
487
|
-
args,
|
|
488
|
-
opts
|
|
489
|
-
});
|
|
387
|
+
opts = normalizeArguments({ logLevel, message, args, opts });
|
|
490
388
|
method = method || opts.method;
|
|
491
389
|
assert2(method);
|
|
492
390
|
opts.total = this.getTotal();
|
|
@@ -506,7 +404,7 @@
|
|
|
506
404
|
return noop;
|
|
507
405
|
}
|
|
508
406
|
};
|
|
509
|
-
|
|
407
|
+
Log.VERSION = VERSION;
|
|
510
408
|
function normalizeLogLevel(logLevel) {
|
|
511
409
|
if (!logLevel) {
|
|
512
410
|
return 0;
|
|
@@ -526,10 +424,7 @@
|
|
|
526
424
|
return resolvedLevel;
|
|
527
425
|
}
|
|
528
426
|
function normalizeArguments(opts) {
|
|
529
|
-
const {
|
|
530
|
-
logLevel,
|
|
531
|
-
message
|
|
532
|
-
} = opts;
|
|
427
|
+
const { logLevel, message } = opts;
|
|
533
428
|
opts.logLevel = normalizeLogLevel(logLevel);
|
|
534
429
|
const args = opts.args ? Array.from(opts.args) : [];
|
|
535
430
|
while (args.length && args.shift() !== message) {
|
|
@@ -552,55 +447,16 @@
|
|
|
552
447
|
}
|
|
553
448
|
const messageType = typeof opts.message;
|
|
554
449
|
assert2(messageType === "string" || messageType === "object");
|
|
555
|
-
return Object.assign(opts, {
|
|
556
|
-
args
|
|
557
|
-
}, opts.opts);
|
|
450
|
+
return Object.assign(opts, { args }, opts.opts);
|
|
558
451
|
}
|
|
559
452
|
function decorateMessage(id, message, opts) {
|
|
560
453
|
if (typeof message === "string") {
|
|
561
454
|
const time = opts.time ? leftPad(formatTime(opts.total)) : "";
|
|
562
|
-
message = opts.time ?
|
|
455
|
+
message = opts.time ? `${id}: ${time} ${message}` : `${id}: ${message}`;
|
|
563
456
|
message = addColor(message, opts.color, opts.background);
|
|
564
457
|
}
|
|
565
458
|
return message;
|
|
566
459
|
}
|
|
567
|
-
function logImageInNode(_ref2) {
|
|
568
|
-
let {
|
|
569
|
-
image,
|
|
570
|
-
message = "",
|
|
571
|
-
scale: scale3 = 1
|
|
572
|
-
} = _ref2;
|
|
573
|
-
console.warn("removed");
|
|
574
|
-
return noop;
|
|
575
|
-
}
|
|
576
|
-
function logImageInBrowser(_ref3) {
|
|
577
|
-
let {
|
|
578
|
-
image,
|
|
579
|
-
message = "",
|
|
580
|
-
scale: scale3 = 1
|
|
581
|
-
} = _ref3;
|
|
582
|
-
if (typeof image === "string") {
|
|
583
|
-
const img = new Image();
|
|
584
|
-
img.onload = () => {
|
|
585
|
-
const args = formatImage(img, message, scale3);
|
|
586
|
-
console.log(...args);
|
|
587
|
-
};
|
|
588
|
-
img.src = image;
|
|
589
|
-
return noop;
|
|
590
|
-
}
|
|
591
|
-
const element = image.nodeName || "";
|
|
592
|
-
if (element.toLowerCase() === "img") {
|
|
593
|
-
console.log(...formatImage(image, message, scale3));
|
|
594
|
-
return noop;
|
|
595
|
-
}
|
|
596
|
-
if (element.toLowerCase() === "canvas") {
|
|
597
|
-
const img = new Image();
|
|
598
|
-
img.onload = () => console.log(...formatImage(img, message, scale3));
|
|
599
|
-
img.src = image.toDataURL();
|
|
600
|
-
return noop;
|
|
601
|
-
}
|
|
602
|
-
return noop;
|
|
603
|
-
}
|
|
604
460
|
function getTableHeader(table) {
|
|
605
461
|
for (const key in table) {
|
|
606
462
|
for (const title in table[key]) {
|
|
@@ -610,13 +466,14 @@
|
|
|
610
466
|
return "empty";
|
|
611
467
|
}
|
|
612
468
|
|
|
469
|
+
// ../../node_modules/@probe.gl/log/dist/init.js
|
|
470
|
+
globalThis.probe = {};
|
|
471
|
+
|
|
613
472
|
// ../../node_modules/@probe.gl/log/dist/index.js
|
|
614
|
-
var dist_default = new Log({
|
|
615
|
-
id: "@probe.gl/log"
|
|
616
|
-
});
|
|
473
|
+
var dist_default = new Log({ id: "@probe.gl/log" });
|
|
617
474
|
|
|
618
475
|
// ../loader-utils/src/lib/log-utils/log.ts
|
|
619
|
-
var VERSION2 = true ? "4.3.0-alpha.
|
|
476
|
+
var VERSION2 = true ? "4.3.0-alpha.8" : "latest";
|
|
620
477
|
var version = VERSION2[0] >= "0" && VERSION2[0] <= "9" ? `v${VERSION2}` : "";
|
|
621
478
|
function createLog() {
|
|
622
479
|
const log2 = new Log({ id: "loaders.gl" });
|
|
@@ -674,7 +531,7 @@
|
|
|
674
531
|
);
|
|
675
532
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
676
533
|
} else {
|
|
677
|
-
globalThis._loadersgl_.version = "4.3.0-alpha.
|
|
534
|
+
globalThis._loadersgl_.version = "4.3.0-alpha.8";
|
|
678
535
|
}
|
|
679
536
|
}
|
|
680
537
|
return globalThis._loadersgl_.version;
|
|
@@ -695,11 +552,11 @@
|
|
|
695
552
|
global: typeof global !== "undefined" && global,
|
|
696
553
|
document: typeof document !== "undefined" && document
|
|
697
554
|
};
|
|
698
|
-
var
|
|
555
|
+
var self_2 = globals2.self || globals2.window || globals2.global || {};
|
|
699
556
|
var window_3 = globals2.window || globals2.self || globals2.global || {};
|
|
700
557
|
var global_3 = globals2.global || globals2.self || globals2.window || {};
|
|
701
558
|
var document_3 = globals2.document || {};
|
|
702
|
-
var
|
|
559
|
+
var isBrowser3 = (
|
|
703
560
|
// @ts-ignore process.browser
|
|
704
561
|
typeof process !== "object" || String(process) !== "[object process]" || process.browser
|
|
705
562
|
);
|
|
@@ -851,7 +708,7 @@
|
|
|
851
708
|
_loadableURL = "";
|
|
852
709
|
/** Checks if workers are supported on this platform */
|
|
853
710
|
static isSupported() {
|
|
854
|
-
return typeof Worker !== "undefined" &&
|
|
711
|
+
return typeof Worker !== "undefined" && isBrowser3 || typeof NodeWorker !== "undefined" && !isBrowser3;
|
|
855
712
|
}
|
|
856
713
|
constructor(props) {
|
|
857
714
|
const { name, source, url } = props;
|
|
@@ -861,7 +718,7 @@
|
|
|
861
718
|
this.url = url;
|
|
862
719
|
this.onMessage = NOOP;
|
|
863
720
|
this.onError = (error) => console.log(error);
|
|
864
|
-
this.worker =
|
|
721
|
+
this.worker = isBrowser3 ? this._createBrowserWorker() : this._createNodeWorker();
|
|
865
722
|
}
|
|
866
723
|
/**
|
|
867
724
|
* Terminate this worker thread
|
|
@@ -1057,7 +914,7 @@
|
|
|
1057
914
|
const shouldDestroyWorker = (
|
|
1058
915
|
// Workers on Node.js prevent the process from exiting.
|
|
1059
916
|
// Until we figure out how to close them before exit, we always destroy them
|
|
1060
|
-
!
|
|
917
|
+
!isBrowser3 || // If the pool is destroyed, there is no reason to keep the worker around
|
|
1061
918
|
this.isDestroyed || // If the app has disabled worker reuse, any completed workers should be destroyed
|
|
1062
919
|
!this.reuseWorkers || // If concurrency has been lowered, this worker might be surplus to requirements
|
|
1063
920
|
this.count > this._getMaxConcurrency()
|
|
@@ -1257,13 +1114,13 @@
|
|
|
1257
1114
|
// ../worker-utils/src/lib/worker-api/get-worker-url.ts
|
|
1258
1115
|
function getWorkerURL(worker, options = {}) {
|
|
1259
1116
|
const workerOptions = options[worker.id] || {};
|
|
1260
|
-
const workerFile =
|
|
1117
|
+
const workerFile = isBrowser3 ? `${worker.id}-worker.js` : `${worker.id}-worker-node.js`;
|
|
1261
1118
|
let url = workerOptions.workerUrl;
|
|
1262
1119
|
if (!url && worker.id === "compression") {
|
|
1263
1120
|
url = options.workerUrl;
|
|
1264
1121
|
}
|
|
1265
1122
|
if (options._workerType === "test") {
|
|
1266
|
-
if (
|
|
1123
|
+
if (isBrowser3) {
|
|
1267
1124
|
url = `modules/${worker.module}/dist/${workerFile}`;
|
|
1268
1125
|
} else {
|
|
1269
1126
|
url = `modules/${worker.module}/src/workers/${worker.id}-worker-node.ts`;
|
|
@@ -1310,7 +1167,7 @@
|
|
|
1310
1167
|
if (modules[libraryName]) {
|
|
1311
1168
|
return modules[libraryName];
|
|
1312
1169
|
}
|
|
1313
|
-
if (!
|
|
1170
|
+
if (!isBrowser3) {
|
|
1314
1171
|
return `modules/${moduleName}/dist/libs/${libraryName}`;
|
|
1315
1172
|
}
|
|
1316
1173
|
if (options.CDN) {
|
|
@@ -1326,7 +1183,7 @@
|
|
|
1326
1183
|
if (libraryUrl.endsWith("wasm")) {
|
|
1327
1184
|
return await loadAsArrayBuffer(libraryUrl);
|
|
1328
1185
|
}
|
|
1329
|
-
if (!
|
|
1186
|
+
if (!isBrowser3) {
|
|
1330
1187
|
try {
|
|
1331
1188
|
const { requireFromFile } = globalThis.loaders || {};
|
|
1332
1189
|
return await requireFromFile?.(libraryUrl);
|
|
@@ -1342,7 +1199,7 @@
|
|
|
1342
1199
|
return loadLibraryFromString(scriptSource, libraryUrl);
|
|
1343
1200
|
}
|
|
1344
1201
|
function loadLibraryFromString(scriptSource, id) {
|
|
1345
|
-
if (!
|
|
1202
|
+
if (!isBrowser3) {
|
|
1346
1203
|
const { requireFromString } = globalThis.loaders || {};
|
|
1347
1204
|
return requireFromString?.(scriptSource, id);
|
|
1348
1205
|
}
|
|
@@ -1362,7 +1219,7 @@
|
|
|
1362
1219
|
}
|
|
1363
1220
|
async function loadAsArrayBuffer(url) {
|
|
1364
1221
|
const { readFileAsArrayBuffer } = globalThis.loaders || {};
|
|
1365
|
-
if (
|
|
1222
|
+
if (isBrowser3 || !readFileAsArrayBuffer || url.startsWith("http")) {
|
|
1366
1223
|
const response = await fetch(url);
|
|
1367
1224
|
return await response.arrayBuffer();
|
|
1368
1225
|
}
|
|
@@ -1370,7 +1227,7 @@
|
|
|
1370
1227
|
}
|
|
1371
1228
|
async function loadAsText(url) {
|
|
1372
1229
|
const { readFileAsText } = globalThis.loaders || {};
|
|
1373
|
-
if (
|
|
1230
|
+
if (isBrowser3 || !readFileAsText || url.startsWith("http")) {
|
|
1374
1231
|
const response = await fetch(url);
|
|
1375
1232
|
return await response.text();
|
|
1376
1233
|
}
|
|
@@ -1463,7 +1320,7 @@
|
|
|
1463
1320
|
if (!WorkerFarm.isSupported()) {
|
|
1464
1321
|
return false;
|
|
1465
1322
|
}
|
|
1466
|
-
if (!
|
|
1323
|
+
if (!isBrowser3 && !options?._nodeWorkers) {
|
|
1467
1324
|
return false;
|
|
1468
1325
|
}
|
|
1469
1326
|
return loader.worker && options?.worker;
|
|
@@ -2747,17 +2604,11 @@
|
|
|
2747
2604
|
printRowMajor: true,
|
|
2748
2605
|
_cartographicRadians: false
|
|
2749
2606
|
};
|
|
2750
|
-
globalThis.mathgl = globalThis.mathgl || {
|
|
2751
|
-
config: {
|
|
2752
|
-
...DEFAULT_CONFIG
|
|
2753
|
-
}
|
|
2754
|
-
};
|
|
2607
|
+
globalThis.mathgl = globalThis.mathgl || { config: { ...DEFAULT_CONFIG } };
|
|
2755
2608
|
var config = globalThis.mathgl.config;
|
|
2756
|
-
function formatValue(value, {
|
|
2757
|
-
precision = config.precision
|
|
2758
|
-
} = {}) {
|
|
2609
|
+
function formatValue(value, { precision = config.precision } = {}) {
|
|
2759
2610
|
value = round(value);
|
|
2760
|
-
return
|
|
2611
|
+
return `${parseFloat(value.toPrecision(precision))}`;
|
|
2761
2612
|
}
|
|
2762
2613
|
function isArray(value) {
|
|
2763
2614
|
return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
@@ -2828,28 +2679,12 @@
|
|
|
2828
2679
|
}
|
|
2829
2680
|
|
|
2830
2681
|
// ../../node_modules/@math.gl/core/dist/classes/base/math-array.js
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
ExtendableBuiltin.prototype = Object.create(cls.prototype, {
|
|
2838
|
-
constructor: {
|
|
2839
|
-
value: cls,
|
|
2840
|
-
enumerable: false,
|
|
2841
|
-
writable: true,
|
|
2842
|
-
configurable: true
|
|
2843
|
-
}
|
|
2844
|
-
});
|
|
2845
|
-
if (Object.setPrototypeOf) {
|
|
2846
|
-
Object.setPrototypeOf(ExtendableBuiltin, cls);
|
|
2847
|
-
} else {
|
|
2848
|
-
ExtendableBuiltin.__proto__ = cls;
|
|
2849
|
-
}
|
|
2850
|
-
return ExtendableBuiltin;
|
|
2851
|
-
}
|
|
2852
|
-
var MathArray = class extends _extendableBuiltin(Array) {
|
|
2682
|
+
var MathArray = class extends Array {
|
|
2683
|
+
// Common methods
|
|
2684
|
+
/**
|
|
2685
|
+
* Clone the current object
|
|
2686
|
+
* @returns a new copy of this object
|
|
2687
|
+
*/
|
|
2853
2688
|
clone() {
|
|
2854
2689
|
return new this.constructor().copy(this);
|
|
2855
2690
|
}
|
|
@@ -2869,7 +2704,10 @@
|
|
|
2869
2704
|
return targetObject;
|
|
2870
2705
|
}
|
|
2871
2706
|
from(arrayOrObject) {
|
|
2872
|
-
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) :
|
|
2707
|
+
return Array.isArray(arrayOrObject) ? this.copy(arrayOrObject) : (
|
|
2708
|
+
// @ts-ignore
|
|
2709
|
+
this.fromObject(arrayOrObject)
|
|
2710
|
+
);
|
|
2873
2711
|
}
|
|
2874
2712
|
to(arrayOrObject) {
|
|
2875
2713
|
if (arrayOrObject === this) {
|
|
@@ -2880,18 +2718,20 @@
|
|
|
2880
2718
|
toTarget(target) {
|
|
2881
2719
|
return target ? this.to(target) : this;
|
|
2882
2720
|
}
|
|
2721
|
+
/** @deprecated */
|
|
2883
2722
|
toFloat32Array() {
|
|
2884
2723
|
return new Float32Array(this);
|
|
2885
2724
|
}
|
|
2886
2725
|
toString() {
|
|
2887
2726
|
return this.formatString(config);
|
|
2888
2727
|
}
|
|
2728
|
+
/** Formats string according to options */
|
|
2889
2729
|
formatString(opts) {
|
|
2890
2730
|
let string = "";
|
|
2891
2731
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
2892
2732
|
string += (i > 0 ? ", " : "") + formatValue(this[i], opts);
|
|
2893
2733
|
}
|
|
2894
|
-
return
|
|
2734
|
+
return `${opts.printTypes ? this.constructor.name : ""}[${string}]`;
|
|
2895
2735
|
}
|
|
2896
2736
|
equals(array) {
|
|
2897
2737
|
if (!array || this.length !== array.length) {
|
|
@@ -2915,6 +2755,8 @@
|
|
|
2915
2755
|
}
|
|
2916
2756
|
return true;
|
|
2917
2757
|
}
|
|
2758
|
+
// Modifiers
|
|
2759
|
+
/** Negates all values in this object */
|
|
2918
2760
|
negate() {
|
|
2919
2761
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
2920
2762
|
this[i] = -this[i];
|
|
@@ -2932,12 +2774,14 @@
|
|
|
2932
2774
|
}
|
|
2933
2775
|
return this.check();
|
|
2934
2776
|
}
|
|
2777
|
+
/** Minimal */
|
|
2935
2778
|
min(vector) {
|
|
2936
2779
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
2937
2780
|
this[i] = Math.min(vector[i], this[i]);
|
|
2938
2781
|
}
|
|
2939
2782
|
return this.check();
|
|
2940
2783
|
}
|
|
2784
|
+
/** Maximal */
|
|
2941
2785
|
max(vector) {
|
|
2942
2786
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
2943
2787
|
this[i] = Math.max(vector[i], this[i]);
|
|
@@ -2978,18 +2822,25 @@
|
|
|
2978
2822
|
}
|
|
2979
2823
|
return this.check();
|
|
2980
2824
|
}
|
|
2825
|
+
/**
|
|
2826
|
+
* Multiplies all elements by `scale`
|
|
2827
|
+
* Note: `Matrix4.multiplyByScalar` only scales its 3x3 "minor"
|
|
2828
|
+
*/
|
|
2981
2829
|
multiplyByScalar(scalar) {
|
|
2982
2830
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
2983
2831
|
this[i] *= scalar;
|
|
2984
2832
|
}
|
|
2985
2833
|
return this.check();
|
|
2986
2834
|
}
|
|
2835
|
+
// Debug checks
|
|
2836
|
+
/** Throws an error if array length is incorrect or contains illegal values */
|
|
2987
2837
|
check() {
|
|
2988
2838
|
if (config.debug && !this.validate()) {
|
|
2989
|
-
throw new Error(
|
|
2839
|
+
throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);
|
|
2990
2840
|
}
|
|
2991
2841
|
return this;
|
|
2992
2842
|
}
|
|
2843
|
+
/** Returns false if the array length is incorrect or contains illegal values */
|
|
2993
2844
|
validate() {
|
|
2994
2845
|
let valid = this.length === this.ELEMENTS;
|
|
2995
2846
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
@@ -2997,39 +2848,48 @@
|
|
|
2997
2848
|
}
|
|
2998
2849
|
return valid;
|
|
2999
2850
|
}
|
|
2851
|
+
// three.js compatibility
|
|
2852
|
+
/** @deprecated */
|
|
3000
2853
|
sub(a) {
|
|
3001
2854
|
return this.subtract(a);
|
|
3002
2855
|
}
|
|
2856
|
+
/** @deprecated */
|
|
3003
2857
|
setScalar(a) {
|
|
3004
2858
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
3005
2859
|
this[i] = a;
|
|
3006
2860
|
}
|
|
3007
2861
|
return this.check();
|
|
3008
2862
|
}
|
|
2863
|
+
/** @deprecated */
|
|
3009
2864
|
addScalar(a) {
|
|
3010
2865
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
3011
2866
|
this[i] += a;
|
|
3012
2867
|
}
|
|
3013
2868
|
return this.check();
|
|
3014
2869
|
}
|
|
2870
|
+
/** @deprecated */
|
|
3015
2871
|
subScalar(a) {
|
|
3016
2872
|
return this.addScalar(-a);
|
|
3017
2873
|
}
|
|
2874
|
+
/** @deprecated */
|
|
3018
2875
|
multiplyScalar(scalar) {
|
|
3019
2876
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
3020
2877
|
this[i] *= scalar;
|
|
3021
2878
|
}
|
|
3022
2879
|
return this.check();
|
|
3023
2880
|
}
|
|
2881
|
+
/** @deprecated */
|
|
3024
2882
|
divideScalar(a) {
|
|
3025
2883
|
return this.multiplyByScalar(1 / a);
|
|
3026
2884
|
}
|
|
2885
|
+
/** @deprecated */
|
|
3027
2886
|
clampScalar(min2, max2) {
|
|
3028
2887
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
3029
2888
|
this[i] = Math.min(Math.max(this[i], min2), max2);
|
|
3030
2889
|
}
|
|
3031
2890
|
return this.check();
|
|
3032
2891
|
}
|
|
2892
|
+
/** @deprecated */
|
|
3033
2893
|
get elements() {
|
|
3034
2894
|
return this;
|
|
3035
2895
|
}
|
|
@@ -3049,13 +2909,13 @@
|
|
|
3049
2909
|
}
|
|
3050
2910
|
function checkNumber(value) {
|
|
3051
2911
|
if (!Number.isFinite(value)) {
|
|
3052
|
-
throw new Error(
|
|
2912
|
+
throw new Error(`Invalid number ${JSON.stringify(value)}`);
|
|
3053
2913
|
}
|
|
3054
2914
|
return value;
|
|
3055
2915
|
}
|
|
3056
2916
|
function checkVector(v, length2, callerName = "") {
|
|
3057
2917
|
if (config.debug && !validateVector(v, length2)) {
|
|
3058
|
-
throw new Error(
|
|
2918
|
+
throw new Error(`math.gl: ${callerName} some fields set to invalid numbers'`);
|
|
3059
2919
|
}
|
|
3060
2920
|
return v;
|
|
3061
2921
|
}
|
|
@@ -3063,12 +2923,13 @@
|
|
|
3063
2923
|
// ../../node_modules/@math.gl/core/dist/lib/assert.js
|
|
3064
2924
|
function assert4(condition, message) {
|
|
3065
2925
|
if (!condition) {
|
|
3066
|
-
throw new Error(
|
|
2926
|
+
throw new Error(`math.gl assertion ${message}`);
|
|
3067
2927
|
}
|
|
3068
2928
|
}
|
|
3069
2929
|
|
|
3070
2930
|
// ../../node_modules/@math.gl/core/dist/classes/base/vector.js
|
|
3071
2931
|
var Vector = class extends MathArray {
|
|
2932
|
+
// ACCESSORS
|
|
3072
2933
|
get x() {
|
|
3073
2934
|
return this[0];
|
|
3074
2935
|
}
|
|
@@ -3081,12 +2942,24 @@
|
|
|
3081
2942
|
set y(value) {
|
|
3082
2943
|
this[1] = checkNumber(value);
|
|
3083
2944
|
}
|
|
2945
|
+
/**
|
|
2946
|
+
* Returns the length of the vector from the origin to the point described by this vector
|
|
2947
|
+
*
|
|
2948
|
+
* @note `length` is a reserved word for Arrays, so `v.length()` will return number of elements
|
|
2949
|
+
* Instead we provide `len` and `magnitude`
|
|
2950
|
+
*/
|
|
3084
2951
|
len() {
|
|
3085
2952
|
return Math.sqrt(this.lengthSquared());
|
|
3086
2953
|
}
|
|
2954
|
+
/**
|
|
2955
|
+
* Returns the length of the vector from the origin to the point described by this vector
|
|
2956
|
+
*/
|
|
3087
2957
|
magnitude() {
|
|
3088
2958
|
return this.len();
|
|
3089
2959
|
}
|
|
2960
|
+
/**
|
|
2961
|
+
* Returns the squared length of the vector from the origin to the point described by this vector
|
|
2962
|
+
*/
|
|
3090
2963
|
lengthSquared() {
|
|
3091
2964
|
let length2 = 0;
|
|
3092
2965
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
@@ -3094,6 +2967,9 @@
|
|
|
3094
2967
|
}
|
|
3095
2968
|
return length2;
|
|
3096
2969
|
}
|
|
2970
|
+
/**
|
|
2971
|
+
* Returns the squared length of the vector from the origin to the point described by this vector
|
|
2972
|
+
*/
|
|
3097
2973
|
magnitudeSquared() {
|
|
3098
2974
|
return this.lengthSquared();
|
|
3099
2975
|
}
|
|
@@ -3115,6 +2991,7 @@
|
|
|
3115
2991
|
}
|
|
3116
2992
|
return checkNumber(product);
|
|
3117
2993
|
}
|
|
2994
|
+
// MODIFIERS
|
|
3118
2995
|
normalize() {
|
|
3119
2996
|
const length2 = this.magnitude();
|
|
3120
2997
|
if (length2 !== 0) {
|
|
@@ -3140,6 +3017,7 @@
|
|
|
3140
3017
|
}
|
|
3141
3018
|
return this.check();
|
|
3142
3019
|
}
|
|
3020
|
+
// THREE.js compatibility
|
|
3143
3021
|
lengthSq() {
|
|
3144
3022
|
return this.lengthSquared();
|
|
3145
3023
|
}
|
|
@@ -3631,7 +3509,7 @@
|
|
|
3631
3509
|
return out;
|
|
3632
3510
|
}
|
|
3633
3511
|
function str(a) {
|
|
3634
|
-
return
|
|
3512
|
+
return `vec3(${a[0]}, ${a[1]}, ${a[2]})`;
|
|
3635
3513
|
}
|
|
3636
3514
|
function exactEquals(a, b) {
|
|
3637
3515
|
return a[0] === b[0] && a[1] === b[1] && a[2] === b[2];
|
|
@@ -3692,6 +3570,12 @@
|
|
|
3692
3570
|
}
|
|
3693
3571
|
return ZERO;
|
|
3694
3572
|
}
|
|
3573
|
+
/**
|
|
3574
|
+
* @class
|
|
3575
|
+
* @param x
|
|
3576
|
+
* @param y
|
|
3577
|
+
* @param z
|
|
3578
|
+
*/
|
|
3695
3579
|
constructor(x = 0, y = 0, z = 0) {
|
|
3696
3580
|
super(-0, -0, -0);
|
|
3697
3581
|
if (arguments.length === 1 && isArray(x)) {
|
|
@@ -3736,6 +3620,7 @@
|
|
|
3736
3620
|
object.z = this[2];
|
|
3737
3621
|
return object;
|
|
3738
3622
|
}
|
|
3623
|
+
// Getters/setters
|
|
3739
3624
|
get ELEMENTS() {
|
|
3740
3625
|
return 3;
|
|
3741
3626
|
}
|
|
@@ -3745,41 +3630,38 @@
|
|
|
3745
3630
|
set z(value) {
|
|
3746
3631
|
this[2] = checkNumber(value);
|
|
3747
3632
|
}
|
|
3633
|
+
// ACCESSORS
|
|
3748
3634
|
angle(vector) {
|
|
3749
3635
|
return angle(this, vector);
|
|
3750
3636
|
}
|
|
3637
|
+
// MODIFIERS
|
|
3751
3638
|
cross(vector) {
|
|
3752
3639
|
cross(this, this, vector);
|
|
3753
3640
|
return this.check();
|
|
3754
3641
|
}
|
|
3755
|
-
rotateX({
|
|
3756
|
-
radians: radians2,
|
|
3757
|
-
origin = ORIGIN
|
|
3758
|
-
}) {
|
|
3642
|
+
rotateX({ radians: radians2, origin = ORIGIN }) {
|
|
3759
3643
|
rotateX(this, this, origin, radians2);
|
|
3760
3644
|
return this.check();
|
|
3761
3645
|
}
|
|
3762
|
-
rotateY({
|
|
3763
|
-
radians: radians2,
|
|
3764
|
-
origin = ORIGIN
|
|
3765
|
-
}) {
|
|
3646
|
+
rotateY({ radians: radians2, origin = ORIGIN }) {
|
|
3766
3647
|
rotateY(this, this, origin, radians2);
|
|
3767
3648
|
return this.check();
|
|
3768
3649
|
}
|
|
3769
|
-
rotateZ({
|
|
3770
|
-
radians: radians2,
|
|
3771
|
-
origin = ORIGIN
|
|
3772
|
-
}) {
|
|
3650
|
+
rotateZ({ radians: radians2, origin = ORIGIN }) {
|
|
3773
3651
|
rotateZ(this, this, origin, radians2);
|
|
3774
3652
|
return this.check();
|
|
3775
3653
|
}
|
|
3654
|
+
// Transforms
|
|
3655
|
+
// transforms as point (4th component is implicitly 1)
|
|
3776
3656
|
transform(matrix4) {
|
|
3777
3657
|
return this.transformAsPoint(matrix4);
|
|
3778
3658
|
}
|
|
3659
|
+
// transforms as point (4th component is implicitly 1)
|
|
3779
3660
|
transformAsPoint(matrix4) {
|
|
3780
3661
|
transformMat42(this, this, matrix4);
|
|
3781
3662
|
return this.check();
|
|
3782
3663
|
}
|
|
3664
|
+
// transforms as vector (4th component is implicitly 0, ignores translation. slightly faster)
|
|
3783
3665
|
transformAsVector(matrix4) {
|
|
3784
3666
|
vec3_transformMat4AsVector(this, this, matrix4);
|
|
3785
3667
|
return this.check();
|
|
@@ -3800,19 +3682,29 @@
|
|
|
3800
3682
|
|
|
3801
3683
|
// ../../node_modules/@math.gl/core/dist/classes/base/matrix.js
|
|
3802
3684
|
var Matrix = class extends MathArray {
|
|
3685
|
+
// fromObject(object) {
|
|
3686
|
+
// const array = object.elements;
|
|
3687
|
+
// return this.fromRowMajor(array);
|
|
3688
|
+
// }
|
|
3689
|
+
// toObject(object) {
|
|
3690
|
+
// const array = object.elements;
|
|
3691
|
+
// this.toRowMajor(array);
|
|
3692
|
+
// return object;
|
|
3693
|
+
// }
|
|
3694
|
+
// TODO better override formatString?
|
|
3803
3695
|
toString() {
|
|
3804
3696
|
let string = "[";
|
|
3805
3697
|
if (config.printRowMajor) {
|
|
3806
3698
|
string += "row-major:";
|
|
3807
3699
|
for (let row = 0; row < this.RANK; ++row) {
|
|
3808
3700
|
for (let col = 0; col < this.RANK; ++col) {
|
|
3809
|
-
string +=
|
|
3701
|
+
string += ` ${this[col * this.RANK + row]}`;
|
|
3810
3702
|
}
|
|
3811
3703
|
}
|
|
3812
3704
|
} else {
|
|
3813
3705
|
string += "column-major:";
|
|
3814
3706
|
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
3815
|
-
string +=
|
|
3707
|
+
string += ` ${this[i]}`;
|
|
3816
3708
|
}
|
|
3817
3709
|
}
|
|
3818
3710
|
string += "]";
|
|
@@ -3821,9 +3713,11 @@
|
|
|
3821
3713
|
getElementIndex(row, col) {
|
|
3822
3714
|
return col * this.RANK + row;
|
|
3823
3715
|
}
|
|
3716
|
+
// By default assumes row major indices
|
|
3824
3717
|
getElement(row, col) {
|
|
3825
3718
|
return this[col * this.RANK + row];
|
|
3826
3719
|
}
|
|
3720
|
+
// By default assumes row major indices
|
|
3827
3721
|
setElement(row, col, value) {
|
|
3828
3722
|
this[col * this.RANK + row] = checkNumber(value);
|
|
3829
3723
|
return this;
|
|
@@ -4589,6 +4483,7 @@
|
|
|
4589
4483
|
this[15] = array[15];
|
|
4590
4484
|
return this.check();
|
|
4591
4485
|
}
|
|
4486
|
+
// eslint-disable-next-line max-params
|
|
4592
4487
|
set(m00, m10, m20, m30, m01, m11, m21, m31, m02, m12, m22, m32, m03, m13, m23, m33) {
|
|
4593
4488
|
this[0] = m00;
|
|
4594
4489
|
this[1] = m10;
|
|
@@ -4608,6 +4503,8 @@
|
|
|
4608
4503
|
this[15] = m33;
|
|
4609
4504
|
return this.check();
|
|
4610
4505
|
}
|
|
4506
|
+
// accepts row major order, stores as column major
|
|
4507
|
+
// eslint-disable-next-line max-params
|
|
4611
4508
|
setRowMajor(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
|
|
4612
4509
|
this[0] = m00;
|
|
4613
4510
|
this[1] = m10;
|
|
@@ -4646,25 +4543,41 @@
|
|
|
4646
4543
|
result[15] = this[15];
|
|
4647
4544
|
return result;
|
|
4648
4545
|
}
|
|
4546
|
+
// Constructors
|
|
4547
|
+
/** Set to identity matrix */
|
|
4649
4548
|
identity() {
|
|
4650
4549
|
return this.copy(IDENTITY_MATRIX);
|
|
4651
4550
|
}
|
|
4551
|
+
/**
|
|
4552
|
+
*
|
|
4553
|
+
* @param object
|
|
4554
|
+
* @returns self
|
|
4555
|
+
*/
|
|
4556
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
4652
4557
|
fromObject(object) {
|
|
4653
4558
|
return this.check();
|
|
4654
4559
|
}
|
|
4560
|
+
/**
|
|
4561
|
+
* Calculates a 4x4 matrix from the given quaternion
|
|
4562
|
+
* @param quaternion Quaternion to create matrix from
|
|
4563
|
+
* @returns self
|
|
4564
|
+
*/
|
|
4655
4565
|
fromQuaternion(quaternion) {
|
|
4656
4566
|
fromQuat(this, quaternion);
|
|
4657
4567
|
return this.check();
|
|
4658
4568
|
}
|
|
4569
|
+
/**
|
|
4570
|
+
* Generates a frustum matrix with the given bounds
|
|
4571
|
+
* @param view.left - Left bound of the frustum
|
|
4572
|
+
* @param view.right - Right bound of the frustum
|
|
4573
|
+
* @param view.bottom - Bottom bound of the frustum
|
|
4574
|
+
* @param view.top - Top bound of the frustum
|
|
4575
|
+
* @param view.near - Near bound of the frustum
|
|
4576
|
+
* @param view.far - Far bound of the frustum. Can be set to Infinity.
|
|
4577
|
+
* @returns self
|
|
4578
|
+
*/
|
|
4659
4579
|
frustum(view) {
|
|
4660
|
-
const {
|
|
4661
|
-
left,
|
|
4662
|
-
right,
|
|
4663
|
-
bottom,
|
|
4664
|
-
top,
|
|
4665
|
-
near = DEFAULT_NEAR,
|
|
4666
|
-
far = DEFAULT_FAR
|
|
4667
|
-
} = view;
|
|
4580
|
+
const { left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
|
|
4668
4581
|
if (far === Infinity) {
|
|
4669
4582
|
computeInfinitePerspectiveOffCenter(this, left, right, bottom, top, near);
|
|
4670
4583
|
} else {
|
|
@@ -4672,35 +4585,47 @@
|
|
|
4672
4585
|
}
|
|
4673
4586
|
return this.check();
|
|
4674
4587
|
}
|
|
4588
|
+
/**
|
|
4589
|
+
* Generates a look-at matrix with the given eye position, focal point,
|
|
4590
|
+
* and up axis
|
|
4591
|
+
* @param view.eye - (vector) Position of the viewer
|
|
4592
|
+
* @param view.center - (vector) Point the viewer is looking at
|
|
4593
|
+
* @param view.up - (vector) Up axis
|
|
4594
|
+
* @returns self
|
|
4595
|
+
*/
|
|
4675
4596
|
lookAt(view) {
|
|
4676
|
-
const {
|
|
4677
|
-
eye,
|
|
4678
|
-
center = [0, 0, 0],
|
|
4679
|
-
up = [0, 1, 0]
|
|
4680
|
-
} = view;
|
|
4597
|
+
const { eye, center = [0, 0, 0], up = [0, 1, 0] } = view;
|
|
4681
4598
|
lookAt(this, eye, center, up);
|
|
4682
4599
|
return this.check();
|
|
4683
4600
|
}
|
|
4601
|
+
/**
|
|
4602
|
+
* Generates a orthogonal projection matrix with the given bounds
|
|
4603
|
+
* from "traditional" view space parameters
|
|
4604
|
+
* @param view.left - Left bound of the frustum
|
|
4605
|
+
* @param view.right number Right bound of the frustum
|
|
4606
|
+
* @param view.bottom - Bottom bound of the frustum
|
|
4607
|
+
* @param view.top number Top bound of the frustum
|
|
4608
|
+
* @param view.near - Near bound of the frustum
|
|
4609
|
+
* @param view.far number Far bound of the frustum
|
|
4610
|
+
* @returns self
|
|
4611
|
+
*/
|
|
4684
4612
|
ortho(view) {
|
|
4685
|
-
const {
|
|
4686
|
-
left,
|
|
4687
|
-
right,
|
|
4688
|
-
bottom,
|
|
4689
|
-
top,
|
|
4690
|
-
near = DEFAULT_NEAR,
|
|
4691
|
-
far = DEFAULT_FAR
|
|
4692
|
-
} = view;
|
|
4613
|
+
const { left, right, bottom, top, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
|
|
4693
4614
|
ortho(this, left, right, bottom, top, near, far);
|
|
4694
4615
|
return this.check();
|
|
4695
4616
|
}
|
|
4617
|
+
/**
|
|
4618
|
+
* Generates an orthogonal projection matrix with the same parameters
|
|
4619
|
+
* as a perspective matrix (plus focalDistance)
|
|
4620
|
+
* @param view.fovy Vertical field of view in radians
|
|
4621
|
+
* @param view.aspect Aspect ratio. Typically viewport width / viewport height
|
|
4622
|
+
* @param view.focalDistance Distance in the view frustum used for extent calculations
|
|
4623
|
+
* @param view.near Near bound of the frustum
|
|
4624
|
+
* @param view.far Far bound of the frustum
|
|
4625
|
+
* @returns self
|
|
4626
|
+
*/
|
|
4696
4627
|
orthographic(view) {
|
|
4697
|
-
const {
|
|
4698
|
-
fovy = DEFAULT_FOVY,
|
|
4699
|
-
aspect = DEFAULT_ASPECT,
|
|
4700
|
-
focalDistance = 1,
|
|
4701
|
-
near = DEFAULT_NEAR,
|
|
4702
|
-
far = DEFAULT_FAR
|
|
4703
|
-
} = view;
|
|
4628
|
+
const { fovy = DEFAULT_FOVY, aspect = DEFAULT_ASPECT, focalDistance = 1, near = DEFAULT_NEAR, far = DEFAULT_FAR } = view;
|
|
4704
4629
|
checkRadians(fovy);
|
|
4705
4630
|
const halfY = fovy / 2;
|
|
4706
4631
|
const top = focalDistance * Math.tan(halfY);
|
|
@@ -4714,32 +4639,53 @@
|
|
|
4714
4639
|
far
|
|
4715
4640
|
});
|
|
4716
4641
|
}
|
|
4642
|
+
/**
|
|
4643
|
+
* Generates a perspective projection matrix with the given bounds
|
|
4644
|
+
* @param view.fovy Vertical field of view in radians
|
|
4645
|
+
* @param view.aspect Aspect ratio. typically viewport width/height
|
|
4646
|
+
* @param view.near Near bound of the frustum
|
|
4647
|
+
* @param view.far Far bound of the frustum
|
|
4648
|
+
* @returns self
|
|
4649
|
+
*/
|
|
4717
4650
|
perspective(view) {
|
|
4718
|
-
const {
|
|
4719
|
-
fovy = 45 * Math.PI / 180,
|
|
4720
|
-
aspect = 1,
|
|
4721
|
-
near = 0.1,
|
|
4722
|
-
far = 500
|
|
4723
|
-
} = view;
|
|
4651
|
+
const { fovy = 45 * Math.PI / 180, aspect = 1, near = 0.1, far = 500 } = view;
|
|
4724
4652
|
checkRadians(fovy);
|
|
4725
4653
|
perspective(this, fovy, aspect, near, far);
|
|
4726
4654
|
return this.check();
|
|
4727
4655
|
}
|
|
4656
|
+
// Accessors
|
|
4728
4657
|
determinant() {
|
|
4729
4658
|
return determinant(this);
|
|
4730
4659
|
}
|
|
4660
|
+
/**
|
|
4661
|
+
* Extracts the non-uniform scale assuming the matrix is an affine transformation.
|
|
4662
|
+
* The scales are the "lengths" of the column vectors in the upper-left 3x3 matrix.
|
|
4663
|
+
* @param result
|
|
4664
|
+
* @returns self
|
|
4665
|
+
*/
|
|
4731
4666
|
getScale(result = [-0, -0, -0]) {
|
|
4732
4667
|
result[0] = Math.sqrt(this[0] * this[0] + this[1] * this[1] + this[2] * this[2]);
|
|
4733
4668
|
result[1] = Math.sqrt(this[4] * this[4] + this[5] * this[5] + this[6] * this[6]);
|
|
4734
4669
|
result[2] = Math.sqrt(this[8] * this[8] + this[9] * this[9] + this[10] * this[10]);
|
|
4735
4670
|
return result;
|
|
4736
4671
|
}
|
|
4672
|
+
/**
|
|
4673
|
+
* Gets the translation portion, assuming the matrix is a affine transformation matrix.
|
|
4674
|
+
* @param result
|
|
4675
|
+
* @returns self
|
|
4676
|
+
*/
|
|
4737
4677
|
getTranslation(result = [-0, -0, -0]) {
|
|
4738
4678
|
result[0] = this[12];
|
|
4739
4679
|
result[1] = this[13];
|
|
4740
4680
|
result[2] = this[14];
|
|
4741
4681
|
return result;
|
|
4742
4682
|
}
|
|
4683
|
+
/**
|
|
4684
|
+
* Gets upper left 3x3 pure rotation matrix (non-scaling), assume affine transformation matrix
|
|
4685
|
+
* @param result
|
|
4686
|
+
* @param scaleResult
|
|
4687
|
+
* @returns self
|
|
4688
|
+
*/
|
|
4743
4689
|
getRotation(result, scaleResult) {
|
|
4744
4690
|
result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0];
|
|
4745
4691
|
scaleResult = scaleResult || [-0, -0, -0];
|
|
@@ -4765,6 +4711,12 @@
|
|
|
4765
4711
|
result[15] = 1;
|
|
4766
4712
|
return result;
|
|
4767
4713
|
}
|
|
4714
|
+
/**
|
|
4715
|
+
*
|
|
4716
|
+
* @param result
|
|
4717
|
+
* @param scaleResult
|
|
4718
|
+
* @returns self
|
|
4719
|
+
*/
|
|
4768
4720
|
getRotationMatrix3(result, scaleResult) {
|
|
4769
4721
|
result = result || [-0, -0, -0, -0, -0, -0, -0, -0, -0];
|
|
4770
4722
|
scaleResult = scaleResult || [-0, -0, -0];
|
|
@@ -4783,6 +4735,7 @@
|
|
|
4783
4735
|
result[8] = this[10] * inverseScale2;
|
|
4784
4736
|
return result;
|
|
4785
4737
|
}
|
|
4738
|
+
// Modifiers
|
|
4786
4739
|
transpose() {
|
|
4787
4740
|
transpose(this, this);
|
|
4788
4741
|
return this.check();
|
|
@@ -4791,6 +4744,7 @@
|
|
|
4791
4744
|
invert(this, this);
|
|
4792
4745
|
return this.check();
|
|
4793
4746
|
}
|
|
4747
|
+
// Operations
|
|
4794
4748
|
multiplyLeft(a) {
|
|
4795
4749
|
multiply2(this, a, this);
|
|
4796
4750
|
return this.check();
|
|
@@ -4799,33 +4753,68 @@
|
|
|
4799
4753
|
multiply2(this, this, a);
|
|
4800
4754
|
return this.check();
|
|
4801
4755
|
}
|
|
4756
|
+
// Rotates a matrix by the given angle around the X axis
|
|
4802
4757
|
rotateX(radians2) {
|
|
4803
4758
|
rotateX2(this, this, radians2);
|
|
4804
4759
|
return this.check();
|
|
4805
4760
|
}
|
|
4761
|
+
// Rotates a matrix by the given angle around the Y axis.
|
|
4806
4762
|
rotateY(radians2) {
|
|
4807
4763
|
rotateY2(this, this, radians2);
|
|
4808
4764
|
return this.check();
|
|
4809
4765
|
}
|
|
4766
|
+
/**
|
|
4767
|
+
* Rotates a matrix by the given angle around the Z axis.
|
|
4768
|
+
* @param radians
|
|
4769
|
+
* @returns self
|
|
4770
|
+
*/
|
|
4810
4771
|
rotateZ(radians2) {
|
|
4811
4772
|
rotateZ2(this, this, radians2);
|
|
4812
4773
|
return this.check();
|
|
4813
4774
|
}
|
|
4775
|
+
/**
|
|
4776
|
+
*
|
|
4777
|
+
* @param param0
|
|
4778
|
+
* @returns self
|
|
4779
|
+
*/
|
|
4814
4780
|
rotateXYZ(angleXYZ) {
|
|
4815
4781
|
return this.rotateX(angleXYZ[0]).rotateY(angleXYZ[1]).rotateZ(angleXYZ[2]);
|
|
4816
4782
|
}
|
|
4783
|
+
/**
|
|
4784
|
+
*
|
|
4785
|
+
* @param radians
|
|
4786
|
+
* @param axis
|
|
4787
|
+
* @returns self
|
|
4788
|
+
*/
|
|
4817
4789
|
rotateAxis(radians2, axis) {
|
|
4818
4790
|
rotate(this, this, radians2, axis);
|
|
4819
4791
|
return this.check();
|
|
4820
4792
|
}
|
|
4793
|
+
/**
|
|
4794
|
+
*
|
|
4795
|
+
* @param factor
|
|
4796
|
+
* @returns self
|
|
4797
|
+
*/
|
|
4821
4798
|
scale(factor) {
|
|
4822
4799
|
scale2(this, this, Array.isArray(factor) ? factor : [factor, factor, factor]);
|
|
4823
4800
|
return this.check();
|
|
4824
4801
|
}
|
|
4802
|
+
/**
|
|
4803
|
+
*
|
|
4804
|
+
* @param vec
|
|
4805
|
+
* @returns self
|
|
4806
|
+
*/
|
|
4825
4807
|
translate(vector) {
|
|
4826
4808
|
translate(this, this, vector);
|
|
4827
4809
|
return this.check();
|
|
4828
4810
|
}
|
|
4811
|
+
// Transforms
|
|
4812
|
+
/**
|
|
4813
|
+
* Transforms any 2, 3 or 4 element vector. 2 and 3 elements are treated as points
|
|
4814
|
+
* @param vector
|
|
4815
|
+
* @param result
|
|
4816
|
+
* @returns self
|
|
4817
|
+
*/
|
|
4829
4818
|
transform(vector, result) {
|
|
4830
4819
|
if (vector.length === 4) {
|
|
4831
4820
|
result = transformMat43(result || [-0, -0, -0, -0], vector, this);
|
|
@@ -4834,10 +4823,14 @@
|
|
|
4834
4823
|
}
|
|
4835
4824
|
return this.transformAsPoint(vector, result);
|
|
4836
4825
|
}
|
|
4826
|
+
/**
|
|
4827
|
+
* Transforms any 2 or 3 element array as point (w implicitly 1)
|
|
4828
|
+
* @param vector
|
|
4829
|
+
* @param result
|
|
4830
|
+
* @returns self
|
|
4831
|
+
*/
|
|
4837
4832
|
transformAsPoint(vector, result) {
|
|
4838
|
-
const {
|
|
4839
|
-
length: length2
|
|
4840
|
-
} = vector;
|
|
4833
|
+
const { length: length2 } = vector;
|
|
4841
4834
|
let out;
|
|
4842
4835
|
switch (length2) {
|
|
4843
4836
|
case 2:
|
|
@@ -4852,6 +4845,12 @@
|
|
|
4852
4845
|
checkVector(out, vector.length);
|
|
4853
4846
|
return out;
|
|
4854
4847
|
}
|
|
4848
|
+
/**
|
|
4849
|
+
* Transforms any 2 or 3 element array as vector (w implicitly 0)
|
|
4850
|
+
* @param vector
|
|
4851
|
+
* @param result
|
|
4852
|
+
* @returns self
|
|
4853
|
+
*/
|
|
4855
4854
|
transformAsVector(vector, result) {
|
|
4856
4855
|
let out;
|
|
4857
4856
|
switch (vector.length) {
|
|
@@ -4867,15 +4866,19 @@
|
|
|
4867
4866
|
checkVector(out, vector.length);
|
|
4868
4867
|
return out;
|
|
4869
4868
|
}
|
|
4869
|
+
/** @deprecated */
|
|
4870
4870
|
transformPoint(vector, result) {
|
|
4871
4871
|
return this.transformAsPoint(vector, result);
|
|
4872
4872
|
}
|
|
4873
|
+
/** @deprecated */
|
|
4873
4874
|
transformVector(vector, result) {
|
|
4874
4875
|
return this.transformAsPoint(vector, result);
|
|
4875
4876
|
}
|
|
4877
|
+
/** @deprecated */
|
|
4876
4878
|
transformDirection(vector, result) {
|
|
4877
4879
|
return this.transformAsVector(vector, result);
|
|
4878
4880
|
}
|
|
4881
|
+
// three.js math API compatibility
|
|
4879
4882
|
makeRotationX(radians2) {
|
|
4880
4883
|
return this.identity().rotateX(radians2);
|
|
4881
4884
|
}
|
|
@@ -4990,11 +4993,20 @@
|
|
|
4990
4993
|
var WGS84_RADIUS_Z = 6356752314245179e-9;
|
|
4991
4994
|
var WGS84_CONSTANTS = {
|
|
4992
4995
|
radii: [WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z],
|
|
4993
|
-
radiiSquared: [
|
|
4996
|
+
radiiSquared: [
|
|
4997
|
+
WGS84_RADIUS_X * WGS84_RADIUS_X,
|
|
4998
|
+
WGS84_RADIUS_Y * WGS84_RADIUS_Y,
|
|
4999
|
+
WGS84_RADIUS_Z * WGS84_RADIUS_Z
|
|
5000
|
+
],
|
|
4994
5001
|
oneOverRadii: [1 / WGS84_RADIUS_X, 1 / WGS84_RADIUS_Y, 1 / WGS84_RADIUS_Z],
|
|
4995
|
-
oneOverRadiiSquared: [
|
|
5002
|
+
oneOverRadiiSquared: [
|
|
5003
|
+
1 / (WGS84_RADIUS_X * WGS84_RADIUS_X),
|
|
5004
|
+
1 / (WGS84_RADIUS_Y * WGS84_RADIUS_Y),
|
|
5005
|
+
1 / (WGS84_RADIUS_Z * WGS84_RADIUS_Z)
|
|
5006
|
+
],
|
|
4996
5007
|
maximumRadius: Math.max(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z),
|
|
4997
5008
|
centerToleranceSquared: 0.1
|
|
5009
|
+
// EPSILON1;
|
|
4998
5010
|
};
|
|
4999
5011
|
|
|
5000
5012
|
// ../../node_modules/@math.gl/geospatial/dist/type-utils.js
|
|
@@ -5124,19 +5136,11 @@
|
|
|
5124
5136
|
thirdAxisVector.scale(sign);
|
|
5125
5137
|
}
|
|
5126
5138
|
} else {
|
|
5127
|
-
const {
|
|
5128
|
-
up,
|
|
5129
|
-
east,
|
|
5130
|
-
north
|
|
5131
|
-
} = scratchAxisVectors;
|
|
5139
|
+
const { up, east, north } = scratchAxisVectors;
|
|
5132
5140
|
east.set(-origin.y, origin.x, 0).normalize();
|
|
5133
5141
|
ellipsoid.geodeticSurfaceNormal(origin, up);
|
|
5134
5142
|
north.copy(up).cross(east);
|
|
5135
|
-
const {
|
|
5136
|
-
down,
|
|
5137
|
-
west,
|
|
5138
|
-
south
|
|
5139
|
-
} = scratchAxisVectors;
|
|
5143
|
+
const { down, west, south } = scratchAxisVectors;
|
|
5140
5144
|
down.copy(up).scale(-1);
|
|
5141
5145
|
west.copy(east).scale(-1);
|
|
5142
5146
|
south.copy(north).scale(-1);
|
|
@@ -5168,11 +5172,7 @@
|
|
|
5168
5172
|
var scaleToGeodeticSurfaceIntersection = new Vector3();
|
|
5169
5173
|
var scaleToGeodeticSurfaceGradient = new Vector3();
|
|
5170
5174
|
function scaleToGeodeticSurface(cartesian, ellipsoid, result = []) {
|
|
5171
|
-
const {
|
|
5172
|
-
oneOverRadii,
|
|
5173
|
-
oneOverRadiiSquared,
|
|
5174
|
-
centerToleranceSquared
|
|
5175
|
-
} = ellipsoid;
|
|
5175
|
+
const { oneOverRadii, oneOverRadiiSquared, centerToleranceSquared } = ellipsoid;
|
|
5176
5176
|
scratchVector4.from(cartesian);
|
|
5177
5177
|
const positionX = scratchVector4.x;
|
|
5178
5178
|
const positionY = scratchVector4.y;
|
|
@@ -5232,15 +5232,7 @@
|
|
|
5232
5232
|
var scratchCartesian = new Vector3();
|
|
5233
5233
|
var Ellipsoid = class {
|
|
5234
5234
|
constructor(x = 0, y = 0, z = 0) {
|
|
5235
|
-
|
|
5236
|
-
_defineProperty(this, "radiiSquared", void 0);
|
|
5237
|
-
_defineProperty(this, "radiiToTheFourth", void 0);
|
|
5238
|
-
_defineProperty(this, "oneOverRadii", void 0);
|
|
5239
|
-
_defineProperty(this, "oneOverRadiiSquared", void 0);
|
|
5240
|
-
_defineProperty(this, "minimumRadius", void 0);
|
|
5241
|
-
_defineProperty(this, "maximumRadius", void 0);
|
|
5242
|
-
_defineProperty(this, "centerToleranceSquared", math_utils_exports.EPSILON1);
|
|
5243
|
-
_defineProperty(this, "squaredXOverSquaredZ", void 0);
|
|
5235
|
+
this.centerToleranceSquared = math_utils_exports.EPSILON1;
|
|
5244
5236
|
assert4(x >= 0);
|
|
5245
5237
|
assert4(y >= 0);
|
|
5246
5238
|
assert4(z >= 0);
|
|
@@ -5256,9 +5248,11 @@
|
|
|
5256
5248
|
}
|
|
5257
5249
|
Object.freeze(this);
|
|
5258
5250
|
}
|
|
5251
|
+
/** Compares this Ellipsoid against the provided Ellipsoid componentwise */
|
|
5259
5252
|
equals(right) {
|
|
5260
5253
|
return this === right || Boolean(right && this.radii.equals(right.radii));
|
|
5261
5254
|
}
|
|
5255
|
+
/** Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'. */
|
|
5262
5256
|
toString() {
|
|
5263
5257
|
return this.radii.toString();
|
|
5264
5258
|
}
|
|
@@ -5291,6 +5285,8 @@
|
|
|
5291
5285
|
eastNorthUpToFixedFrame(origin, result = new Matrix4()) {
|
|
5292
5286
|
return localFrameToFixedFrame(this, "east", "north", "up", origin, result);
|
|
5293
5287
|
}
|
|
5288
|
+
// Computes a 4x4 transformation matrix from a reference frame centered at
|
|
5289
|
+
// the provided origin to the ellipsoid's fixed reference frame.
|
|
5294
5290
|
localFrameToFixedFrame(firstAxis, secondAxis, thirdAxis, origin, result = new Matrix4()) {
|
|
5295
5291
|
return localFrameToFixedFrame(this, firstAxis, secondAxis, thirdAxis, origin, result);
|
|
5296
5292
|
}
|
|
@@ -5308,9 +5304,14 @@
|
|
|
5308
5304
|
geodeticSurfaceNormal(cartesian, result = [0, 0, 0]) {
|
|
5309
5305
|
return scratchVector5.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);
|
|
5310
5306
|
}
|
|
5307
|
+
/** Scales the provided Cartesian position along the geodetic surface normal
|
|
5308
|
+
* so that it is on the surface of this ellipsoid. If the position is
|
|
5309
|
+
* at the center of the ellipsoid, this function returns undefined. */
|
|
5311
5310
|
scaleToGeodeticSurface(cartesian, result) {
|
|
5312
5311
|
return scaleToGeodeticSurface(cartesian, this, result);
|
|
5313
5312
|
}
|
|
5313
|
+
/** Scales the provided Cartesian position along the geocentric surface normal
|
|
5314
|
+
* so that it is on the surface of this ellipsoid. */
|
|
5314
5315
|
scaleToGeocentricSurface(cartesian, result = [0, 0, 0]) {
|
|
5315
5316
|
scratchPosition.from(cartesian);
|
|
5316
5317
|
const positionX = scratchPosition.x;
|
|
@@ -5320,12 +5321,17 @@
|
|
|
5320
5321
|
const beta = 1 / Math.sqrt(positionX * positionX * oneOverRadiiSquared.x + positionY * positionY * oneOverRadiiSquared.y + positionZ * positionZ * oneOverRadiiSquared.z);
|
|
5321
5322
|
return scratchPosition.multiplyScalar(beta).to(result);
|
|
5322
5323
|
}
|
|
5324
|
+
/** Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying
|
|
5325
|
+
* its components by the result of `Ellipsoid#oneOverRadii` */
|
|
5323
5326
|
transformPositionToScaledSpace(position, result = [0, 0, 0]) {
|
|
5324
5327
|
return scratchPosition.from(position).scale(this.oneOverRadii).to(result);
|
|
5325
5328
|
}
|
|
5329
|
+
/** Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying
|
|
5330
|
+
* its components by the result of `Ellipsoid#radii`. */
|
|
5326
5331
|
transformPositionFromScaledSpace(position, result = [0, 0, 0]) {
|
|
5327
5332
|
return scratchPosition.from(position).scale(this.radii).to(result);
|
|
5328
5333
|
}
|
|
5334
|
+
/** Computes a point which is the intersection of the surface normal with the z-axis. */
|
|
5329
5335
|
getSurfaceNormalIntersectionWithZAxis(position, buffer = 0, result = [0, 0, 0]) {
|
|
5330
5336
|
assert4(equals(this.radii.x, this.radii.y, math_utils_exports.EPSILON15));
|
|
5331
5337
|
assert4(this.radii.z > 0);
|
|
@@ -5337,10 +5343,10 @@
|
|
|
5337
5343
|
return scratchPosition.set(0, 0, z).to(result);
|
|
5338
5344
|
}
|
|
5339
5345
|
};
|
|
5340
|
-
|
|
5346
|
+
Ellipsoid.WGS84 = new Ellipsoid(WGS84_RADIUS_X, WGS84_RADIUS_Y, WGS84_RADIUS_Z);
|
|
5341
5347
|
|
|
5342
5348
|
// ../images/src/lib/utils/version.ts
|
|
5343
|
-
var VERSION4 = true ? "4.3.0-alpha.
|
|
5349
|
+
var VERSION4 = true ? "4.3.0-alpha.8" : "latest";
|
|
5344
5350
|
|
|
5345
5351
|
// ../images/src/lib/category-api/image-type.ts
|
|
5346
5352
|
var parseImageNode = globalThis.loaders?.parseImageNode;
|
|
@@ -5748,7 +5754,7 @@
|
|
|
5748
5754
|
};
|
|
5749
5755
|
|
|
5750
5756
|
// ../draco/src/lib/utils/version.ts
|
|
5751
|
-
var VERSION5 = true ? "4.3.0-alpha.
|
|
5757
|
+
var VERSION5 = true ? "4.3.0-alpha.8" : "latest";
|
|
5752
5758
|
|
|
5753
5759
|
// ../draco/src/draco-loader.ts
|
|
5754
5760
|
var DracoLoader = {
|
|
@@ -6364,7 +6370,7 @@
|
|
|
6364
6370
|
}
|
|
6365
6371
|
|
|
6366
6372
|
// ../textures/src/lib/utils/version.ts
|
|
6367
|
-
var VERSION6 = true ? "4.3.0-alpha.
|
|
6373
|
+
var VERSION6 = true ? "4.3.0-alpha.8" : "latest";
|
|
6368
6374
|
|
|
6369
6375
|
// ../textures/src/lib/parsers/basis-module-loader.ts
|
|
6370
6376
|
var BASIS_EXTERNAL_LIBRARIES = {
|
|
@@ -6665,10 +6671,7 @@
|
|
|
6665
6671
|
10
|
|
6666
6672
|
];
|
|
6667
6673
|
function decodeText(buffer) {
|
|
6668
|
-
|
|
6669
|
-
return new TextDecoder().decode(buffer);
|
|
6670
|
-
}
|
|
6671
|
-
return Buffer.from(buffer).toString("utf8");
|
|
6674
|
+
return new TextDecoder().decode(buffer);
|
|
6672
6675
|
}
|
|
6673
6676
|
function read(data) {
|
|
6674
6677
|
const id = new Uint8Array(data.buffer, data.byteOffset, KTX2_ID.length);
|
|
@@ -8050,7 +8053,7 @@
|
|
|
8050
8053
|
}
|
|
8051
8054
|
|
|
8052
8055
|
// src/i3s-content-loader.ts
|
|
8053
|
-
var VERSION7 = true ? "4.3.0-alpha.
|
|
8056
|
+
var VERSION7 = true ? "4.3.0-alpha.8" : "latest";
|
|
8054
8057
|
var I3SContentLoader = {
|
|
8055
8058
|
dataType: null,
|
|
8056
8059
|
batchType: null,
|