@loaders.gl/gltf 4.3.0-alpha.3 → 4.3.0-alpha.4
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/dist.dev.js +346 -375
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/lib/utils/version.js +1 -1
- package/package.json +7 -7
package/dist/dist.dev.js
CHANGED
|
@@ -261,8 +261,8 @@ var __exports__ = (() => {
|
|
|
261
261
|
}
|
|
262
262
|
const dataView = new DataView(arrayBuffer);
|
|
263
263
|
let magic = "";
|
|
264
|
-
for (let
|
|
265
|
-
magic += String.fromCharCode(dataView.getUint8(byteOffset +
|
|
264
|
+
for (let i = 0; i < length; i++) {
|
|
265
|
+
magic += String.fromCharCode(dataView.getUint8(byteOffset + i));
|
|
266
266
|
}
|
|
267
267
|
return magic;
|
|
268
268
|
}
|
|
@@ -314,8 +314,8 @@ var __exports__ = (() => {
|
|
|
314
314
|
);
|
|
315
315
|
const sourceArray = new Uint8Array(sourceBuffer);
|
|
316
316
|
targetArray.set(sourceArray);
|
|
317
|
-
for (let
|
|
318
|
-
dataView.setUint8(byteOffset + sourceBuffer.byteLength +
|
|
317
|
+
for (let i = 0; i < padLength; ++i) {
|
|
318
|
+
dataView.setUint8(byteOffset + sourceBuffer.byteLength + i, 32);
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
byteOffset += paddedLength;
|
|
@@ -526,8 +526,8 @@ var __exports__ = (() => {
|
|
|
526
526
|
}
|
|
527
527
|
function checkString(buffer, header, offset = 0) {
|
|
528
528
|
const headerBytes = stringToBytes(header);
|
|
529
|
-
for (let
|
|
530
|
-
if (headerBytes[
|
|
529
|
+
for (let i = 0; i < headerBytes.length; ++i) {
|
|
530
|
+
if (headerBytes[i] !== buffer[i + offset]) {
|
|
531
531
|
return false;
|
|
532
532
|
}
|
|
533
533
|
}
|
|
@@ -597,30 +597,30 @@ var __exports__ = (() => {
|
|
|
597
597
|
return null;
|
|
598
598
|
}
|
|
599
599
|
const { tableMarkers, sofMarkers } = getJpegMarkers();
|
|
600
|
-
let
|
|
601
|
-
while (
|
|
602
|
-
const marker = dataView.getUint16(
|
|
600
|
+
let i = 2;
|
|
601
|
+
while (i + 9 < dataView.byteLength) {
|
|
602
|
+
const marker = dataView.getUint16(i, BIG_ENDIAN);
|
|
603
603
|
if (sofMarkers.has(marker)) {
|
|
604
604
|
return {
|
|
605
605
|
mimeType: "image/jpeg",
|
|
606
|
-
height: dataView.getUint16(
|
|
606
|
+
height: dataView.getUint16(i + 5, BIG_ENDIAN),
|
|
607
607
|
// Number of lines
|
|
608
|
-
width: dataView.getUint16(
|
|
608
|
+
width: dataView.getUint16(i + 7, BIG_ENDIAN)
|
|
609
609
|
// Number of pixels per line
|
|
610
610
|
};
|
|
611
611
|
}
|
|
612
612
|
if (!tableMarkers.has(marker)) {
|
|
613
613
|
return null;
|
|
614
614
|
}
|
|
615
|
-
|
|
616
|
-
|
|
615
|
+
i += 2;
|
|
616
|
+
i += dataView.getUint16(i, BIG_ENDIAN);
|
|
617
617
|
}
|
|
618
618
|
return null;
|
|
619
619
|
}
|
|
620
620
|
function getJpegMarkers() {
|
|
621
621
|
const tableMarkers = /* @__PURE__ */ new Set([65499, 65476, 65484, 65501, 65534]);
|
|
622
|
-
for (let
|
|
623
|
-
tableMarkers.add(
|
|
622
|
+
for (let i = 65504; i < 65520; ++i) {
|
|
623
|
+
tableMarkers.add(i);
|
|
624
624
|
}
|
|
625
625
|
const sofMarkers = /* @__PURE__ */ new Set([
|
|
626
626
|
65472,
|
|
@@ -865,7 +865,7 @@ var __exports__ = (() => {
|
|
|
865
865
|
let { images, bufferViews } = gltf;
|
|
866
866
|
images = images || [];
|
|
867
867
|
bufferViews = bufferViews || [];
|
|
868
|
-
const imageBufferViews = images.map((
|
|
868
|
+
const imageBufferViews = images.map((i) => i.bufferView);
|
|
869
869
|
bufferViews = bufferViews.filter((view) => !imageBufferViews.includes(view));
|
|
870
870
|
const bufferMemory = bufferViews.reduce((acc, view) => acc + view.byteLength, 0);
|
|
871
871
|
const pixelCount = images.reduce((acc, image) => {
|
|
@@ -904,13 +904,13 @@ var __exports__ = (() => {
|
|
|
904
904
|
return result2;
|
|
905
905
|
}
|
|
906
906
|
const result = new ArrayType(length);
|
|
907
|
-
for (let
|
|
907
|
+
for (let i = 0; i < gltfAccessor.count; i++) {
|
|
908
908
|
const values = new ArrayType(
|
|
909
909
|
arrayBuffer,
|
|
910
|
-
byteOffset +
|
|
910
|
+
byteOffset + i * elementAddressScale,
|
|
911
911
|
numberOfComponentsInElement
|
|
912
912
|
);
|
|
913
|
-
result.set(values,
|
|
913
|
+
result.set(values, i * numberOfComponentsInElement);
|
|
914
914
|
}
|
|
915
915
|
return result;
|
|
916
916
|
}
|
|
@@ -1441,8 +1441,8 @@ var __exports__ = (() => {
|
|
|
1441
1441
|
};
|
|
1442
1442
|
|
|
1443
1443
|
// src/lib/extensions/utils/3d-tiles-utils.ts
|
|
1444
|
-
function emod(
|
|
1445
|
-
return (
|
|
1444
|
+
function emod(n) {
|
|
1445
|
+
return (n % 1 + 1) % 1;
|
|
1446
1446
|
}
|
|
1447
1447
|
var ATTRIBUTE_TYPE_TO_COMPONENTS2 = {
|
|
1448
1448
|
SCALAR: 1,
|
|
@@ -2013,11 +2013,11 @@ var __exports__ = (() => {
|
|
|
2013
2013
|
}
|
|
2014
2014
|
function getEnumsArray(valuesData, offset, count, enumEntry) {
|
|
2015
2015
|
const array = [];
|
|
2016
|
-
for (let
|
|
2016
|
+
for (let i = 0; i < count; i++) {
|
|
2017
2017
|
if (valuesData instanceof BigInt64Array || valuesData instanceof BigUint64Array) {
|
|
2018
2018
|
array.push("");
|
|
2019
2019
|
} else {
|
|
2020
|
-
const value = valuesData[offset +
|
|
2020
|
+
const value = valuesData[offset + i];
|
|
2021
2021
|
const enumObject = getEnumByValue(enumEntry, value);
|
|
2022
2022
|
if (enumObject) {
|
|
2023
2023
|
array.push(enumObject.name);
|
|
@@ -2476,34 +2476,6 @@ var __exports__ = (() => {
|
|
|
2476
2476
|
}
|
|
2477
2477
|
}
|
|
2478
2478
|
|
|
2479
|
-
// ../../node_modules/ktx-parse/dist/ktx-parse.modern.js
|
|
2480
|
-
var t = new Uint8Array([0]);
|
|
2481
|
-
var n;
|
|
2482
|
-
var i;
|
|
2483
|
-
var s;
|
|
2484
|
-
var a;
|
|
2485
|
-
var r;
|
|
2486
|
-
var o;
|
|
2487
|
-
var l;
|
|
2488
|
-
var f;
|
|
2489
|
-
!function(t2) {
|
|
2490
|
-
t2[t2.NONE = 0] = "NONE", t2[t2.BASISLZ = 1] = "BASISLZ", t2[t2.ZSTD = 2] = "ZSTD", t2[t2.ZLIB = 3] = "ZLIB";
|
|
2491
|
-
}(n || (n = {})), function(t2) {
|
|
2492
|
-
t2[t2.BASICFORMAT = 0] = "BASICFORMAT";
|
|
2493
|
-
}(i || (i = {})), function(t2) {
|
|
2494
|
-
t2[t2.UNSPECIFIED = 0] = "UNSPECIFIED", t2[t2.ETC1S = 163] = "ETC1S", t2[t2.UASTC = 166] = "UASTC";
|
|
2495
|
-
}(s || (s = {})), function(t2) {
|
|
2496
|
-
t2[t2.UNSPECIFIED = 0] = "UNSPECIFIED", t2[t2.SRGB = 1] = "SRGB";
|
|
2497
|
-
}(a || (a = {})), function(t2) {
|
|
2498
|
-
t2[t2.UNSPECIFIED = 0] = "UNSPECIFIED", t2[t2.LINEAR = 1] = "LINEAR", t2[t2.SRGB = 2] = "SRGB", t2[t2.ITU = 3] = "ITU", t2[t2.NTSC = 4] = "NTSC", t2[t2.SLOG = 5] = "SLOG", t2[t2.SLOG2 = 6] = "SLOG2";
|
|
2499
|
-
}(r || (r = {})), function(t2) {
|
|
2500
|
-
t2[t2.ALPHA_STRAIGHT = 0] = "ALPHA_STRAIGHT", t2[t2.ALPHA_PREMULTIPLIED = 1] = "ALPHA_PREMULTIPLIED";
|
|
2501
|
-
}(o || (o = {})), function(t2) {
|
|
2502
|
-
t2[t2.RGB = 0] = "RGB", t2[t2.RRR = 3] = "RRR", t2[t2.GGG = 4] = "GGG", t2[t2.AAA = 15] = "AAA";
|
|
2503
|
-
}(l || (l = {})), function(t2) {
|
|
2504
|
-
t2[t2.RGB = 0] = "RGB", t2[t2.RGBA = 3] = "RGBA", t2[t2.RRR = 4] = "RRR", t2[t2.RRRG = 5] = "RRRG";
|
|
2505
|
-
}(f || (f = {}));
|
|
2506
|
-
|
|
2507
2479
|
// ../textures/src/lib/parsers/parse-ktx.ts
|
|
2508
2480
|
var KTX2_ID = [
|
|
2509
2481
|
// '´', 'K', 'T', 'X', '2', '0', 'ª', '\r', '\n', '\x1A', '\n'
|
|
@@ -2662,7 +2634,6 @@ var __exports__ = (() => {
|
|
|
2662
2634
|
const levels = [];
|
|
2663
2635
|
for (let levelIndex = 0; levelIndex < levelsCount; levelIndex++) {
|
|
2664
2636
|
levels.push(transcodeKTX2Image(ktx2File, levelIndex, options));
|
|
2665
|
-
break;
|
|
2666
2637
|
}
|
|
2667
2638
|
return [levels];
|
|
2668
2639
|
} finally {
|
|
@@ -3066,13 +3037,13 @@ var __exports__ = (() => {
|
|
|
3066
3037
|
}
|
|
3067
3038
|
function unpack(data) {
|
|
3068
3039
|
const result = new Uint8Array(data.length);
|
|
3069
|
-
for (let
|
|
3070
|
-
const ch = data.charCodeAt(
|
|
3071
|
-
result[
|
|
3040
|
+
for (let i = 0; i < data.length; ++i) {
|
|
3041
|
+
const ch = data.charCodeAt(i);
|
|
3042
|
+
result[i] = ch > 96 ? ch - 71 : ch > 64 ? ch - 65 : ch > 47 ? ch + 4 : ch > 46 ? 63 : 62;
|
|
3072
3043
|
}
|
|
3073
3044
|
let write = 0;
|
|
3074
|
-
for (let
|
|
3075
|
-
result[write++] = result[
|
|
3045
|
+
for (let i = 0; i < data.length; ++i) {
|
|
3046
|
+
result[write++] = result[i] < 60 ? wasmpack[result[i]] : (result[i] - 60) * 64 + result[++i];
|
|
3076
3047
|
}
|
|
3077
3048
|
return result.buffer.slice(0, write);
|
|
3078
3049
|
}
|
|
@@ -3262,10 +3233,10 @@ var __exports__ = (() => {
|
|
|
3262
3233
|
let maxZ = -Infinity;
|
|
3263
3234
|
const positions = attributes.POSITION ? attributes.POSITION.value : [];
|
|
3264
3235
|
const len = positions && positions.length;
|
|
3265
|
-
for (let
|
|
3266
|
-
const x = positions[
|
|
3267
|
-
const y = positions[
|
|
3268
|
-
const z = positions[
|
|
3236
|
+
for (let i = 0; i < len; i += 3) {
|
|
3237
|
+
const x = positions[i];
|
|
3238
|
+
const y = positions[i + 1];
|
|
3239
|
+
const z = positions[i + 2];
|
|
3269
3240
|
minX = x < minX ? x : minX;
|
|
3270
3241
|
minY = y < minY ? y : minY;
|
|
3271
3242
|
minZ = z < minZ ? z : minZ;
|
|
@@ -3733,7 +3704,7 @@ var __exports__ = (() => {
|
|
|
3733
3704
|
return {
|
|
3734
3705
|
quantization_bits: transform.quantization_bits(),
|
|
3735
3706
|
range: transform.range(),
|
|
3736
|
-
min_values: new Float32Array([1, 2, 3]).map((
|
|
3707
|
+
min_values: new Float32Array([1, 2, 3]).map((i) => transform.min_value(i))
|
|
3737
3708
|
};
|
|
3738
3709
|
}
|
|
3739
3710
|
} finally {
|
|
@@ -3785,16 +3756,16 @@ var __exports__ = (() => {
|
|
|
3785
3756
|
function getInt32Array(dracoArray) {
|
|
3786
3757
|
const numValues = dracoArray.size();
|
|
3787
3758
|
const intArray = new Int32Array(numValues);
|
|
3788
|
-
for (let
|
|
3789
|
-
intArray[
|
|
3759
|
+
for (let i = 0; i < numValues; i++) {
|
|
3760
|
+
intArray[i] = dracoArray.GetValue(i);
|
|
3790
3761
|
}
|
|
3791
3762
|
return intArray;
|
|
3792
3763
|
}
|
|
3793
3764
|
function getUint32Array(dracoArray) {
|
|
3794
3765
|
const numValues = dracoArray.size();
|
|
3795
3766
|
const intArray = new Int32Array(numValues);
|
|
3796
|
-
for (let
|
|
3797
|
-
intArray[
|
|
3767
|
+
for (let i = 0; i < numValues; i++) {
|
|
3768
|
+
intArray[i] = dracoArray.GetValue(i);
|
|
3798
3769
|
}
|
|
3799
3770
|
return intArray;
|
|
3800
3771
|
}
|
|
@@ -4087,34 +4058,34 @@ var __exports__ = (() => {
|
|
|
4087
4058
|
function isArray(value) {
|
|
4088
4059
|
return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView);
|
|
4089
4060
|
}
|
|
4090
|
-
function equals(
|
|
4061
|
+
function equals(a, b, epsilon) {
|
|
4091
4062
|
const oldEpsilon = config.EPSILON;
|
|
4092
4063
|
if (epsilon) {
|
|
4093
4064
|
config.EPSILON = epsilon;
|
|
4094
4065
|
}
|
|
4095
4066
|
try {
|
|
4096
|
-
if (
|
|
4067
|
+
if (a === b) {
|
|
4097
4068
|
return true;
|
|
4098
4069
|
}
|
|
4099
|
-
if (isArray(
|
|
4100
|
-
if (
|
|
4070
|
+
if (isArray(a) && isArray(b)) {
|
|
4071
|
+
if (a.length !== b.length) {
|
|
4101
4072
|
return false;
|
|
4102
4073
|
}
|
|
4103
|
-
for (let
|
|
4104
|
-
if (!equals(
|
|
4074
|
+
for (let i = 0; i < a.length; ++i) {
|
|
4075
|
+
if (!equals(a[i], b[i])) {
|
|
4105
4076
|
return false;
|
|
4106
4077
|
}
|
|
4107
4078
|
}
|
|
4108
4079
|
return true;
|
|
4109
4080
|
}
|
|
4110
|
-
if (
|
|
4111
|
-
return
|
|
4081
|
+
if (a && a.equals) {
|
|
4082
|
+
return a.equals(b);
|
|
4112
4083
|
}
|
|
4113
4084
|
if (b && b.equals) {
|
|
4114
|
-
return b.equals(
|
|
4085
|
+
return b.equals(a);
|
|
4115
4086
|
}
|
|
4116
|
-
if (typeof
|
|
4117
|
-
return Math.abs(
|
|
4087
|
+
if (typeof a === "number" && typeof b === "number") {
|
|
4088
|
+
return Math.abs(a - b) <= config.EPSILON * Math.max(1, Math.abs(a), Math.abs(b));
|
|
4118
4089
|
}
|
|
4119
4090
|
return false;
|
|
4120
4091
|
} finally {
|
|
@@ -4152,14 +4123,14 @@ var __exports__ = (() => {
|
|
|
4152
4123
|
return new this.constructor().copy(this);
|
|
4153
4124
|
}
|
|
4154
4125
|
fromArray(array, offset = 0) {
|
|
4155
|
-
for (let
|
|
4156
|
-
this[
|
|
4126
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4127
|
+
this[i] = array[i + offset];
|
|
4157
4128
|
}
|
|
4158
4129
|
return this.check();
|
|
4159
4130
|
}
|
|
4160
4131
|
toArray(targetArray = [], offset = 0) {
|
|
4161
|
-
for (let
|
|
4162
|
-
targetArray[offset +
|
|
4132
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4133
|
+
targetArray[offset + i] = this[i];
|
|
4163
4134
|
}
|
|
4164
4135
|
return targetArray;
|
|
4165
4136
|
}
|
|
@@ -4186,8 +4157,8 @@ var __exports__ = (() => {
|
|
|
4186
4157
|
}
|
|
4187
4158
|
formatString(opts) {
|
|
4188
4159
|
let string = "";
|
|
4189
|
-
for (let
|
|
4190
|
-
string += (
|
|
4160
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4161
|
+
string += (i > 0 ? ", " : "") + formatValue(this[i], opts);
|
|
4191
4162
|
}
|
|
4192
4163
|
return "".concat(opts.printTypes ? this.constructor.name : "", "[").concat(string, "]");
|
|
4193
4164
|
}
|
|
@@ -4195,8 +4166,8 @@ var __exports__ = (() => {
|
|
|
4195
4166
|
if (!array || this.length !== array.length) {
|
|
4196
4167
|
return false;
|
|
4197
4168
|
}
|
|
4198
|
-
for (let
|
|
4199
|
-
if (!equals(this[
|
|
4169
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4170
|
+
if (!equals(this[i], array[i])) {
|
|
4200
4171
|
return false;
|
|
4201
4172
|
}
|
|
4202
4173
|
}
|
|
@@ -4206,79 +4177,79 @@ var __exports__ = (() => {
|
|
|
4206
4177
|
if (!array || this.length !== array.length) {
|
|
4207
4178
|
return false;
|
|
4208
4179
|
}
|
|
4209
|
-
for (let
|
|
4210
|
-
if (this[
|
|
4180
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4181
|
+
if (this[i] !== array[i]) {
|
|
4211
4182
|
return false;
|
|
4212
4183
|
}
|
|
4213
4184
|
}
|
|
4214
4185
|
return true;
|
|
4215
4186
|
}
|
|
4216
4187
|
negate() {
|
|
4217
|
-
for (let
|
|
4218
|
-
this[
|
|
4188
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4189
|
+
this[i] = -this[i];
|
|
4219
4190
|
}
|
|
4220
4191
|
return this.check();
|
|
4221
4192
|
}
|
|
4222
|
-
lerp(
|
|
4223
|
-
if (
|
|
4224
|
-
return this.lerp(this,
|
|
4193
|
+
lerp(a, b, t) {
|
|
4194
|
+
if (t === void 0) {
|
|
4195
|
+
return this.lerp(this, a, b);
|
|
4225
4196
|
}
|
|
4226
|
-
for (let
|
|
4227
|
-
const ai =
|
|
4228
|
-
const endValue = typeof b === "number" ? b : b[
|
|
4229
|
-
this[
|
|
4197
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4198
|
+
const ai = a[i];
|
|
4199
|
+
const endValue = typeof b === "number" ? b : b[i];
|
|
4200
|
+
this[i] = ai + t * (endValue - ai);
|
|
4230
4201
|
}
|
|
4231
4202
|
return this.check();
|
|
4232
4203
|
}
|
|
4233
4204
|
min(vector) {
|
|
4234
|
-
for (let
|
|
4235
|
-
this[
|
|
4205
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4206
|
+
this[i] = Math.min(vector[i], this[i]);
|
|
4236
4207
|
}
|
|
4237
4208
|
return this.check();
|
|
4238
4209
|
}
|
|
4239
4210
|
max(vector) {
|
|
4240
|
-
for (let
|
|
4241
|
-
this[
|
|
4211
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4212
|
+
this[i] = Math.max(vector[i], this[i]);
|
|
4242
4213
|
}
|
|
4243
4214
|
return this.check();
|
|
4244
4215
|
}
|
|
4245
4216
|
clamp(minVector, maxVector) {
|
|
4246
|
-
for (let
|
|
4247
|
-
this[
|
|
4217
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4218
|
+
this[i] = Math.min(Math.max(this[i], minVector[i]), maxVector[i]);
|
|
4248
4219
|
}
|
|
4249
4220
|
return this.check();
|
|
4250
4221
|
}
|
|
4251
4222
|
add(...vectors) {
|
|
4252
4223
|
for (const vector of vectors) {
|
|
4253
|
-
for (let
|
|
4254
|
-
this[
|
|
4224
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4225
|
+
this[i] += vector[i];
|
|
4255
4226
|
}
|
|
4256
4227
|
}
|
|
4257
4228
|
return this.check();
|
|
4258
4229
|
}
|
|
4259
4230
|
subtract(...vectors) {
|
|
4260
4231
|
for (const vector of vectors) {
|
|
4261
|
-
for (let
|
|
4262
|
-
this[
|
|
4232
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4233
|
+
this[i] -= vector[i];
|
|
4263
4234
|
}
|
|
4264
4235
|
}
|
|
4265
4236
|
return this.check();
|
|
4266
4237
|
}
|
|
4267
4238
|
scale(scale2) {
|
|
4268
4239
|
if (typeof scale2 === "number") {
|
|
4269
|
-
for (let
|
|
4270
|
-
this[
|
|
4240
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4241
|
+
this[i] *= scale2;
|
|
4271
4242
|
}
|
|
4272
4243
|
} else {
|
|
4273
|
-
for (let
|
|
4274
|
-
this[
|
|
4244
|
+
for (let i = 0; i < this.ELEMENTS && i < scale2.length; ++i) {
|
|
4245
|
+
this[i] *= scale2[i];
|
|
4275
4246
|
}
|
|
4276
4247
|
}
|
|
4277
4248
|
return this.check();
|
|
4278
4249
|
}
|
|
4279
4250
|
multiplyByScalar(scalar) {
|
|
4280
|
-
for (let
|
|
4281
|
-
this[
|
|
4251
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4252
|
+
this[i] *= scalar;
|
|
4282
4253
|
}
|
|
4283
4254
|
return this.check();
|
|
4284
4255
|
}
|
|
@@ -4290,41 +4261,41 @@ var __exports__ = (() => {
|
|
|
4290
4261
|
}
|
|
4291
4262
|
validate() {
|
|
4292
4263
|
let valid = this.length === this.ELEMENTS;
|
|
4293
|
-
for (let
|
|
4294
|
-
valid = valid && Number.isFinite(this[
|
|
4264
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4265
|
+
valid = valid && Number.isFinite(this[i]);
|
|
4295
4266
|
}
|
|
4296
4267
|
return valid;
|
|
4297
4268
|
}
|
|
4298
|
-
sub(
|
|
4299
|
-
return this.subtract(
|
|
4269
|
+
sub(a) {
|
|
4270
|
+
return this.subtract(a);
|
|
4300
4271
|
}
|
|
4301
|
-
setScalar(
|
|
4302
|
-
for (let
|
|
4303
|
-
this[
|
|
4272
|
+
setScalar(a) {
|
|
4273
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4274
|
+
this[i] = a;
|
|
4304
4275
|
}
|
|
4305
4276
|
return this.check();
|
|
4306
4277
|
}
|
|
4307
|
-
addScalar(
|
|
4308
|
-
for (let
|
|
4309
|
-
this[
|
|
4278
|
+
addScalar(a) {
|
|
4279
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4280
|
+
this[i] += a;
|
|
4310
4281
|
}
|
|
4311
4282
|
return this.check();
|
|
4312
4283
|
}
|
|
4313
|
-
subScalar(
|
|
4314
|
-
return this.addScalar(-
|
|
4284
|
+
subScalar(a) {
|
|
4285
|
+
return this.addScalar(-a);
|
|
4315
4286
|
}
|
|
4316
4287
|
multiplyScalar(scalar) {
|
|
4317
|
-
for (let
|
|
4318
|
-
this[
|
|
4288
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4289
|
+
this[i] *= scalar;
|
|
4319
4290
|
}
|
|
4320
4291
|
return this.check();
|
|
4321
4292
|
}
|
|
4322
|
-
divideScalar(
|
|
4323
|
-
return this.multiplyByScalar(1 /
|
|
4293
|
+
divideScalar(a) {
|
|
4294
|
+
return this.multiplyByScalar(1 / a);
|
|
4324
4295
|
}
|
|
4325
4296
|
clampScalar(min, max) {
|
|
4326
|
-
for (let
|
|
4327
|
-
this[
|
|
4297
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4298
|
+
this[i] = Math.min(Math.max(this[i], min), max);
|
|
4328
4299
|
}
|
|
4329
4300
|
return this.check();
|
|
4330
4301
|
}
|
|
@@ -4338,8 +4309,8 @@ var __exports__ = (() => {
|
|
|
4338
4309
|
if (v.length !== length) {
|
|
4339
4310
|
return false;
|
|
4340
4311
|
}
|
|
4341
|
-
for (let
|
|
4342
|
-
if (!Number.isFinite(v[
|
|
4312
|
+
for (let i = 0; i < v.length; ++i) {
|
|
4313
|
+
if (!Number.isFinite(v[i])) {
|
|
4343
4314
|
return false;
|
|
4344
4315
|
}
|
|
4345
4316
|
}
|
|
@@ -4387,8 +4358,8 @@ var __exports__ = (() => {
|
|
|
4387
4358
|
}
|
|
4388
4359
|
lengthSquared() {
|
|
4389
4360
|
let length = 0;
|
|
4390
|
-
for (let
|
|
4391
|
-
length += this[
|
|
4361
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4362
|
+
length += this[i] * this[i];
|
|
4392
4363
|
}
|
|
4393
4364
|
return length;
|
|
4394
4365
|
}
|
|
@@ -4400,40 +4371,40 @@ var __exports__ = (() => {
|
|
|
4400
4371
|
}
|
|
4401
4372
|
distanceSquared(mathArray) {
|
|
4402
4373
|
let length = 0;
|
|
4403
|
-
for (let
|
|
4404
|
-
const dist = this[
|
|
4374
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4375
|
+
const dist = this[i] - mathArray[i];
|
|
4405
4376
|
length += dist * dist;
|
|
4406
4377
|
}
|
|
4407
4378
|
return checkNumber(length);
|
|
4408
4379
|
}
|
|
4409
4380
|
dot(mathArray) {
|
|
4410
4381
|
let product = 0;
|
|
4411
|
-
for (let
|
|
4412
|
-
product += this[
|
|
4382
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4383
|
+
product += this[i] * mathArray[i];
|
|
4413
4384
|
}
|
|
4414
4385
|
return checkNumber(product);
|
|
4415
4386
|
}
|
|
4416
4387
|
normalize() {
|
|
4417
4388
|
const length = this.magnitude();
|
|
4418
4389
|
if (length !== 0) {
|
|
4419
|
-
for (let
|
|
4420
|
-
this[
|
|
4390
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4391
|
+
this[i] /= length;
|
|
4421
4392
|
}
|
|
4422
4393
|
}
|
|
4423
4394
|
return this.check();
|
|
4424
4395
|
}
|
|
4425
4396
|
multiply(...vectors) {
|
|
4426
4397
|
for (const vector of vectors) {
|
|
4427
|
-
for (let
|
|
4428
|
-
this[
|
|
4398
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4399
|
+
this[i] *= vector[i];
|
|
4429
4400
|
}
|
|
4430
4401
|
}
|
|
4431
4402
|
return this.check();
|
|
4432
4403
|
}
|
|
4433
4404
|
divide(...vectors) {
|
|
4434
4405
|
for (const vector of vectors) {
|
|
4435
|
-
for (let
|
|
4436
|
-
this[
|
|
4406
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4407
|
+
this[i] /= vector[i];
|
|
4437
4408
|
}
|
|
4438
4409
|
}
|
|
4439
4410
|
return this.check();
|
|
@@ -4447,26 +4418,26 @@ var __exports__ = (() => {
|
|
|
4447
4418
|
distanceToSquared(vector) {
|
|
4448
4419
|
return this.distanceSquared(vector);
|
|
4449
4420
|
}
|
|
4450
|
-
getComponent(
|
|
4451
|
-
assert4(
|
|
4452
|
-
return checkNumber(this[
|
|
4421
|
+
getComponent(i) {
|
|
4422
|
+
assert4(i >= 0 && i < this.ELEMENTS, "index is out of range");
|
|
4423
|
+
return checkNumber(this[i]);
|
|
4453
4424
|
}
|
|
4454
|
-
setComponent(
|
|
4455
|
-
assert4(
|
|
4456
|
-
this[
|
|
4425
|
+
setComponent(i, value) {
|
|
4426
|
+
assert4(i >= 0 && i < this.ELEMENTS, "index is out of range");
|
|
4427
|
+
this[i] = value;
|
|
4457
4428
|
return this.check();
|
|
4458
4429
|
}
|
|
4459
|
-
addVectors(
|
|
4460
|
-
return this.copy(
|
|
4430
|
+
addVectors(a, b) {
|
|
4431
|
+
return this.copy(a).add(b);
|
|
4461
4432
|
}
|
|
4462
|
-
subVectors(
|
|
4463
|
-
return this.copy(
|
|
4433
|
+
subVectors(a, b) {
|
|
4434
|
+
return this.copy(a).subtract(b);
|
|
4464
4435
|
}
|
|
4465
|
-
multiplyVectors(
|
|
4466
|
-
return this.copy(
|
|
4436
|
+
multiplyVectors(a, b) {
|
|
4437
|
+
return this.copy(a).multiply(b);
|
|
4467
4438
|
}
|
|
4468
|
-
addScaledVector(
|
|
4469
|
-
return this.add(new this.constructor(
|
|
4439
|
+
addScaledVector(a, b) {
|
|
4440
|
+
return this.add(new this.constructor(a).multiplyScalar(b));
|
|
4470
4441
|
}
|
|
4471
4442
|
};
|
|
4472
4443
|
|
|
@@ -4483,18 +4454,18 @@ var __exports__ = (() => {
|
|
|
4483
4454
|
}
|
|
4484
4455
|
return out;
|
|
4485
4456
|
}
|
|
4486
|
-
function transformMat3(out,
|
|
4487
|
-
const x =
|
|
4488
|
-
const y =
|
|
4457
|
+
function transformMat3(out, a, m) {
|
|
4458
|
+
const x = a[0];
|
|
4459
|
+
const y = a[1];
|
|
4489
4460
|
out[0] = m[0] * x + m[3] * y + m[6];
|
|
4490
4461
|
out[1] = m[1] * x + m[4] * y + m[7];
|
|
4491
4462
|
return out;
|
|
4492
4463
|
}
|
|
4493
4464
|
var forEach = function() {
|
|
4494
4465
|
const vec = create();
|
|
4495
|
-
return function(
|
|
4496
|
-
let
|
|
4497
|
-
let
|
|
4466
|
+
return function(a, stride, offset, count, fn, arg) {
|
|
4467
|
+
let i;
|
|
4468
|
+
let l;
|
|
4498
4469
|
if (!stride) {
|
|
4499
4470
|
stride = 2;
|
|
4500
4471
|
}
|
|
@@ -4502,48 +4473,48 @@ var __exports__ = (() => {
|
|
|
4502
4473
|
offset = 0;
|
|
4503
4474
|
}
|
|
4504
4475
|
if (count) {
|
|
4505
|
-
|
|
4476
|
+
l = Math.min(count * stride + offset, a.length);
|
|
4506
4477
|
} else {
|
|
4507
|
-
|
|
4478
|
+
l = a.length;
|
|
4508
4479
|
}
|
|
4509
|
-
for (
|
|
4510
|
-
vec[0] =
|
|
4511
|
-
vec[1] =
|
|
4480
|
+
for (i = offset; i < l; i += stride) {
|
|
4481
|
+
vec[0] = a[i];
|
|
4482
|
+
vec[1] = a[i + 1];
|
|
4512
4483
|
fn(vec, vec, arg);
|
|
4513
|
-
|
|
4514
|
-
|
|
4484
|
+
a[i] = vec[0];
|
|
4485
|
+
a[i + 1] = vec[1];
|
|
4515
4486
|
}
|
|
4516
|
-
return
|
|
4487
|
+
return a;
|
|
4517
4488
|
};
|
|
4518
4489
|
}();
|
|
4519
4490
|
|
|
4520
4491
|
// ../../node_modules/@math.gl/core/dist/lib/gl-matrix-extras.js
|
|
4521
|
-
function vec3_transformMat4AsVector(out,
|
|
4522
|
-
const x =
|
|
4523
|
-
const y =
|
|
4524
|
-
const z =
|
|
4492
|
+
function vec3_transformMat4AsVector(out, a, m) {
|
|
4493
|
+
const x = a[0];
|
|
4494
|
+
const y = a[1];
|
|
4495
|
+
const z = a[2];
|
|
4525
4496
|
const w = m[3] * x + m[7] * y + m[11] * z || 1;
|
|
4526
4497
|
out[0] = (m[0] * x + m[4] * y + m[8] * z) / w;
|
|
4527
4498
|
out[1] = (m[1] * x + m[5] * y + m[9] * z) / w;
|
|
4528
4499
|
out[2] = (m[2] * x + m[6] * y + m[10] * z) / w;
|
|
4529
4500
|
return out;
|
|
4530
4501
|
}
|
|
4531
|
-
function vec3_transformMat2(out,
|
|
4532
|
-
const x =
|
|
4533
|
-
const y =
|
|
4502
|
+
function vec3_transformMat2(out, a, m) {
|
|
4503
|
+
const x = a[0];
|
|
4504
|
+
const y = a[1];
|
|
4534
4505
|
out[0] = m[0] * x + m[2] * y;
|
|
4535
4506
|
out[1] = m[1] * x + m[3] * y;
|
|
4536
|
-
out[2] =
|
|
4507
|
+
out[2] = a[2];
|
|
4537
4508
|
return out;
|
|
4538
4509
|
}
|
|
4539
|
-
function vec4_transformMat3(out,
|
|
4540
|
-
const x =
|
|
4541
|
-
const y =
|
|
4542
|
-
const z =
|
|
4510
|
+
function vec4_transformMat3(out, a, m) {
|
|
4511
|
+
const x = a[0];
|
|
4512
|
+
const y = a[1];
|
|
4513
|
+
const z = a[2];
|
|
4543
4514
|
out[0] = m[0] * x + m[3] * y + m[6] * z;
|
|
4544
4515
|
out[1] = m[1] * x + m[4] * y + m[7] * z;
|
|
4545
4516
|
out[2] = m[2] * x + m[5] * y + m[8] * z;
|
|
4546
|
-
out[3] =
|
|
4517
|
+
out[3] = a[3];
|
|
4547
4518
|
return out;
|
|
4548
4519
|
}
|
|
4549
4520
|
|
|
@@ -4557,13 +4528,13 @@ var __exports__ = (() => {
|
|
|
4557
4528
|
}
|
|
4558
4529
|
return out;
|
|
4559
4530
|
}
|
|
4560
|
-
function dot(
|
|
4561
|
-
return
|
|
4531
|
+
function dot(a, b) {
|
|
4532
|
+
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
|
|
4562
4533
|
}
|
|
4563
|
-
function cross(out,
|
|
4564
|
-
const ax =
|
|
4565
|
-
const ay =
|
|
4566
|
-
const az =
|
|
4534
|
+
function cross(out, a, b) {
|
|
4535
|
+
const ax = a[0];
|
|
4536
|
+
const ay = a[1];
|
|
4537
|
+
const az = a[2];
|
|
4567
4538
|
const bx = b[0];
|
|
4568
4539
|
const by = b[1];
|
|
4569
4540
|
const bz = b[2];
|
|
@@ -4572,10 +4543,10 @@ var __exports__ = (() => {
|
|
|
4572
4543
|
out[2] = ax * by - ay * bx;
|
|
4573
4544
|
return out;
|
|
4574
4545
|
}
|
|
4575
|
-
function transformMat4(out,
|
|
4576
|
-
const x =
|
|
4577
|
-
const y =
|
|
4578
|
-
const z =
|
|
4546
|
+
function transformMat4(out, a, m) {
|
|
4547
|
+
const x = a[0];
|
|
4548
|
+
const y = a[1];
|
|
4549
|
+
const z = a[2];
|
|
4579
4550
|
let w = m[3] * x + m[7] * y + m[11] * z + m[15];
|
|
4580
4551
|
w = w || 1;
|
|
4581
4552
|
out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
|
|
@@ -4583,23 +4554,23 @@ var __exports__ = (() => {
|
|
|
4583
4554
|
out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
|
|
4584
4555
|
return out;
|
|
4585
4556
|
}
|
|
4586
|
-
function transformMat32(out,
|
|
4587
|
-
const x =
|
|
4588
|
-
const y =
|
|
4589
|
-
const z =
|
|
4557
|
+
function transformMat32(out, a, m) {
|
|
4558
|
+
const x = a[0];
|
|
4559
|
+
const y = a[1];
|
|
4560
|
+
const z = a[2];
|
|
4590
4561
|
out[0] = x * m[0] + y * m[3] + z * m[6];
|
|
4591
4562
|
out[1] = x * m[1] + y * m[4] + z * m[7];
|
|
4592
4563
|
out[2] = x * m[2] + y * m[5] + z * m[8];
|
|
4593
4564
|
return out;
|
|
4594
4565
|
}
|
|
4595
|
-
function transformQuat(out,
|
|
4566
|
+
function transformQuat(out, a, q) {
|
|
4596
4567
|
const qx = q[0];
|
|
4597
4568
|
const qy = q[1];
|
|
4598
4569
|
const qz = q[2];
|
|
4599
4570
|
const qw = q[3];
|
|
4600
|
-
const x =
|
|
4601
|
-
const y =
|
|
4602
|
-
const z =
|
|
4571
|
+
const x = a[0];
|
|
4572
|
+
const y = a[1];
|
|
4573
|
+
const z = a[2];
|
|
4603
4574
|
let uvx = qy * z - qz * y;
|
|
4604
4575
|
let uvy = qz * x - qx * z;
|
|
4605
4576
|
let uvz = qx * y - qy * x;
|
|
@@ -4618,64 +4589,64 @@ var __exports__ = (() => {
|
|
|
4618
4589
|
out[2] = z + uvz + uuvz;
|
|
4619
4590
|
return out;
|
|
4620
4591
|
}
|
|
4621
|
-
function rotateX(out,
|
|
4622
|
-
const
|
|
4623
|
-
const
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
out[0] =
|
|
4631
|
-
out[1] =
|
|
4632
|
-
out[2] =
|
|
4592
|
+
function rotateX(out, a, b, rad) {
|
|
4593
|
+
const p = [];
|
|
4594
|
+
const r = [];
|
|
4595
|
+
p[0] = a[0] - b[0];
|
|
4596
|
+
p[1] = a[1] - b[1];
|
|
4597
|
+
p[2] = a[2] - b[2];
|
|
4598
|
+
r[0] = p[0];
|
|
4599
|
+
r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad);
|
|
4600
|
+
r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad);
|
|
4601
|
+
out[0] = r[0] + b[0];
|
|
4602
|
+
out[1] = r[1] + b[1];
|
|
4603
|
+
out[2] = r[2] + b[2];
|
|
4633
4604
|
return out;
|
|
4634
4605
|
}
|
|
4635
|
-
function rotateY(out,
|
|
4636
|
-
const
|
|
4637
|
-
const
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
out[0] =
|
|
4645
|
-
out[1] =
|
|
4646
|
-
out[2] =
|
|
4606
|
+
function rotateY(out, a, b, rad) {
|
|
4607
|
+
const p = [];
|
|
4608
|
+
const r = [];
|
|
4609
|
+
p[0] = a[0] - b[0];
|
|
4610
|
+
p[1] = a[1] - b[1];
|
|
4611
|
+
p[2] = a[2] - b[2];
|
|
4612
|
+
r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad);
|
|
4613
|
+
r[1] = p[1];
|
|
4614
|
+
r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad);
|
|
4615
|
+
out[0] = r[0] + b[0];
|
|
4616
|
+
out[1] = r[1] + b[1];
|
|
4617
|
+
out[2] = r[2] + b[2];
|
|
4647
4618
|
return out;
|
|
4648
4619
|
}
|
|
4649
|
-
function rotateZ(out,
|
|
4650
|
-
const
|
|
4651
|
-
const
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
out[0] =
|
|
4659
|
-
out[1] =
|
|
4660
|
-
out[2] =
|
|
4620
|
+
function rotateZ(out, a, b, rad) {
|
|
4621
|
+
const p = [];
|
|
4622
|
+
const r = [];
|
|
4623
|
+
p[0] = a[0] - b[0];
|
|
4624
|
+
p[1] = a[1] - b[1];
|
|
4625
|
+
p[2] = a[2] - b[2];
|
|
4626
|
+
r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad);
|
|
4627
|
+
r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad);
|
|
4628
|
+
r[2] = p[2];
|
|
4629
|
+
out[0] = r[0] + b[0];
|
|
4630
|
+
out[1] = r[1] + b[1];
|
|
4631
|
+
out[2] = r[2] + b[2];
|
|
4661
4632
|
return out;
|
|
4662
4633
|
}
|
|
4663
|
-
function angle(
|
|
4664
|
-
const ax =
|
|
4665
|
-
const ay =
|
|
4666
|
-
const az =
|
|
4634
|
+
function angle(a, b) {
|
|
4635
|
+
const ax = a[0];
|
|
4636
|
+
const ay = a[1];
|
|
4637
|
+
const az = a[2];
|
|
4667
4638
|
const bx = b[0];
|
|
4668
4639
|
const by = b[1];
|
|
4669
4640
|
const bz = b[2];
|
|
4670
4641
|
const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz));
|
|
4671
|
-
const cosine = mag && dot(
|
|
4642
|
+
const cosine = mag && dot(a, b) / mag;
|
|
4672
4643
|
return Math.acos(Math.min(Math.max(cosine, -1), 1));
|
|
4673
4644
|
}
|
|
4674
4645
|
var forEach2 = function() {
|
|
4675
4646
|
const vec = create2();
|
|
4676
|
-
return function(
|
|
4677
|
-
let
|
|
4678
|
-
let
|
|
4647
|
+
return function(a, stride, offset, count, fn, arg) {
|
|
4648
|
+
let i;
|
|
4649
|
+
let l;
|
|
4679
4650
|
if (!stride) {
|
|
4680
4651
|
stride = 3;
|
|
4681
4652
|
}
|
|
@@ -4683,20 +4654,20 @@ var __exports__ = (() => {
|
|
|
4683
4654
|
offset = 0;
|
|
4684
4655
|
}
|
|
4685
4656
|
if (count) {
|
|
4686
|
-
|
|
4657
|
+
l = Math.min(count * stride + offset, a.length);
|
|
4687
4658
|
} else {
|
|
4688
|
-
|
|
4659
|
+
l = a.length;
|
|
4689
4660
|
}
|
|
4690
|
-
for (
|
|
4691
|
-
vec[0] =
|
|
4692
|
-
vec[1] =
|
|
4693
|
-
vec[2] =
|
|
4661
|
+
for (i = offset; i < l; i += stride) {
|
|
4662
|
+
vec[0] = a[i];
|
|
4663
|
+
vec[1] = a[i + 1];
|
|
4664
|
+
vec[2] = a[i + 2];
|
|
4694
4665
|
fn(vec, vec, arg);
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4666
|
+
a[i] = vec[0];
|
|
4667
|
+
a[i + 1] = vec[1];
|
|
4668
|
+
a[i + 2] = vec[2];
|
|
4698
4669
|
}
|
|
4699
|
-
return
|
|
4670
|
+
return a;
|
|
4700
4671
|
};
|
|
4701
4672
|
}();
|
|
4702
4673
|
|
|
@@ -4830,8 +4801,8 @@ var __exports__ = (() => {
|
|
|
4830
4801
|
}
|
|
4831
4802
|
} else {
|
|
4832
4803
|
string += "column-major:";
|
|
4833
|
-
for (let
|
|
4834
|
-
string += " ".concat(this[
|
|
4804
|
+
for (let i = 0; i < this.ELEMENTS; ++i) {
|
|
4805
|
+
string += " ".concat(this[i]);
|
|
4835
4806
|
}
|
|
4836
4807
|
}
|
|
4837
4808
|
string += "]";
|
|
@@ -4849,55 +4820,55 @@ var __exports__ = (() => {
|
|
|
4849
4820
|
}
|
|
4850
4821
|
getColumn(columnIndex, result = new Array(this.RANK).fill(-0)) {
|
|
4851
4822
|
const firstIndex = columnIndex * this.RANK;
|
|
4852
|
-
for (let
|
|
4853
|
-
result[
|
|
4823
|
+
for (let i = 0; i < this.RANK; ++i) {
|
|
4824
|
+
result[i] = this[firstIndex + i];
|
|
4854
4825
|
}
|
|
4855
4826
|
return result;
|
|
4856
4827
|
}
|
|
4857
4828
|
setColumn(columnIndex, columnVector) {
|
|
4858
4829
|
const firstIndex = columnIndex * this.RANK;
|
|
4859
|
-
for (let
|
|
4860
|
-
this[firstIndex +
|
|
4830
|
+
for (let i = 0; i < this.RANK; ++i) {
|
|
4831
|
+
this[firstIndex + i] = columnVector[i];
|
|
4861
4832
|
}
|
|
4862
4833
|
return this;
|
|
4863
4834
|
}
|
|
4864
4835
|
};
|
|
4865
4836
|
|
|
4866
4837
|
// ../../node_modules/@math.gl/core/dist/gl-matrix/mat3.js
|
|
4867
|
-
function transpose(out,
|
|
4868
|
-
if (out ===
|
|
4869
|
-
const a01 =
|
|
4870
|
-
const a02 =
|
|
4871
|
-
const a12 =
|
|
4872
|
-
out[1] =
|
|
4873
|
-
out[2] =
|
|
4838
|
+
function transpose(out, a) {
|
|
4839
|
+
if (out === a) {
|
|
4840
|
+
const a01 = a[1];
|
|
4841
|
+
const a02 = a[2];
|
|
4842
|
+
const a12 = a[5];
|
|
4843
|
+
out[1] = a[3];
|
|
4844
|
+
out[2] = a[6];
|
|
4874
4845
|
out[3] = a01;
|
|
4875
|
-
out[5] =
|
|
4846
|
+
out[5] = a[7];
|
|
4876
4847
|
out[6] = a02;
|
|
4877
4848
|
out[7] = a12;
|
|
4878
4849
|
} else {
|
|
4879
|
-
out[0] =
|
|
4880
|
-
out[1] =
|
|
4881
|
-
out[2] =
|
|
4882
|
-
out[3] =
|
|
4883
|
-
out[4] =
|
|
4884
|
-
out[5] =
|
|
4885
|
-
out[6] =
|
|
4886
|
-
out[7] =
|
|
4887
|
-
out[8] =
|
|
4850
|
+
out[0] = a[0];
|
|
4851
|
+
out[1] = a[3];
|
|
4852
|
+
out[2] = a[6];
|
|
4853
|
+
out[3] = a[1];
|
|
4854
|
+
out[4] = a[4];
|
|
4855
|
+
out[5] = a[7];
|
|
4856
|
+
out[6] = a[2];
|
|
4857
|
+
out[7] = a[5];
|
|
4858
|
+
out[8] = a[8];
|
|
4888
4859
|
}
|
|
4889
4860
|
return out;
|
|
4890
4861
|
}
|
|
4891
|
-
function invert(out,
|
|
4892
|
-
const a00 =
|
|
4893
|
-
const a01 =
|
|
4894
|
-
const a02 =
|
|
4895
|
-
const a10 =
|
|
4896
|
-
const a11 =
|
|
4897
|
-
const a12 =
|
|
4898
|
-
const a20 =
|
|
4899
|
-
const a21 =
|
|
4900
|
-
const a22 =
|
|
4862
|
+
function invert(out, a) {
|
|
4863
|
+
const a00 = a[0];
|
|
4864
|
+
const a01 = a[1];
|
|
4865
|
+
const a02 = a[2];
|
|
4866
|
+
const a10 = a[3];
|
|
4867
|
+
const a11 = a[4];
|
|
4868
|
+
const a12 = a[5];
|
|
4869
|
+
const a20 = a[6];
|
|
4870
|
+
const a21 = a[7];
|
|
4871
|
+
const a22 = a[8];
|
|
4901
4872
|
const b01 = a22 * a11 - a12 * a21;
|
|
4902
4873
|
const b11 = -a22 * a10 + a12 * a20;
|
|
4903
4874
|
const b21 = a21 * a10 - a11 * a20;
|
|
@@ -4917,28 +4888,28 @@ var __exports__ = (() => {
|
|
|
4917
4888
|
out[8] = (a11 * a00 - a01 * a10) * det;
|
|
4918
4889
|
return out;
|
|
4919
4890
|
}
|
|
4920
|
-
function determinant(
|
|
4921
|
-
const a00 =
|
|
4922
|
-
const a01 =
|
|
4923
|
-
const a02 =
|
|
4924
|
-
const a10 =
|
|
4925
|
-
const a11 =
|
|
4926
|
-
const a12 =
|
|
4927
|
-
const a20 =
|
|
4928
|
-
const a21 =
|
|
4929
|
-
const a22 =
|
|
4891
|
+
function determinant(a) {
|
|
4892
|
+
const a00 = a[0];
|
|
4893
|
+
const a01 = a[1];
|
|
4894
|
+
const a02 = a[2];
|
|
4895
|
+
const a10 = a[3];
|
|
4896
|
+
const a11 = a[4];
|
|
4897
|
+
const a12 = a[5];
|
|
4898
|
+
const a20 = a[6];
|
|
4899
|
+
const a21 = a[7];
|
|
4900
|
+
const a22 = a[8];
|
|
4930
4901
|
return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);
|
|
4931
4902
|
}
|
|
4932
|
-
function multiply(out,
|
|
4933
|
-
const a00 =
|
|
4934
|
-
const a01 =
|
|
4935
|
-
const a02 =
|
|
4936
|
-
const a10 =
|
|
4937
|
-
const a11 =
|
|
4938
|
-
const a12 =
|
|
4939
|
-
const a20 =
|
|
4940
|
-
const a21 =
|
|
4941
|
-
const a22 =
|
|
4903
|
+
function multiply(out, a, b) {
|
|
4904
|
+
const a00 = a[0];
|
|
4905
|
+
const a01 = a[1];
|
|
4906
|
+
const a02 = a[2];
|
|
4907
|
+
const a10 = a[3];
|
|
4908
|
+
const a11 = a[4];
|
|
4909
|
+
const a12 = a[5];
|
|
4910
|
+
const a20 = a[6];
|
|
4911
|
+
const a21 = a[7];
|
|
4912
|
+
const a22 = a[8];
|
|
4942
4913
|
const b00 = b[0];
|
|
4943
4914
|
const b01 = b[1];
|
|
4944
4915
|
const b02 = b[2];
|
|
@@ -4959,16 +4930,16 @@ var __exports__ = (() => {
|
|
|
4959
4930
|
out[8] = b20 * a02 + b21 * a12 + b22 * a22;
|
|
4960
4931
|
return out;
|
|
4961
4932
|
}
|
|
4962
|
-
function translate(out,
|
|
4963
|
-
const a00 =
|
|
4964
|
-
const a01 =
|
|
4965
|
-
const a02 =
|
|
4966
|
-
const a10 =
|
|
4967
|
-
const a11 =
|
|
4968
|
-
const a12 =
|
|
4969
|
-
const a20 =
|
|
4970
|
-
const a21 =
|
|
4971
|
-
const a22 =
|
|
4933
|
+
function translate(out, a, v) {
|
|
4934
|
+
const a00 = a[0];
|
|
4935
|
+
const a01 = a[1];
|
|
4936
|
+
const a02 = a[2];
|
|
4937
|
+
const a10 = a[3];
|
|
4938
|
+
const a11 = a[4];
|
|
4939
|
+
const a12 = a[5];
|
|
4940
|
+
const a20 = a[6];
|
|
4941
|
+
const a21 = a[7];
|
|
4942
|
+
const a22 = a[8];
|
|
4972
4943
|
const x = v[0];
|
|
4973
4944
|
const y = v[1];
|
|
4974
4945
|
out[0] = a00;
|
|
@@ -4982,41 +4953,41 @@ var __exports__ = (() => {
|
|
|
4982
4953
|
out[8] = x * a02 + y * a12 + a22;
|
|
4983
4954
|
return out;
|
|
4984
4955
|
}
|
|
4985
|
-
function rotate(out,
|
|
4986
|
-
const a00 =
|
|
4987
|
-
const a01 =
|
|
4988
|
-
const a02 =
|
|
4989
|
-
const a10 =
|
|
4990
|
-
const a11 =
|
|
4991
|
-
const a12 =
|
|
4992
|
-
const a20 =
|
|
4993
|
-
const a21 =
|
|
4994
|
-
const a22 =
|
|
4995
|
-
const
|
|
4956
|
+
function rotate(out, a, rad) {
|
|
4957
|
+
const a00 = a[0];
|
|
4958
|
+
const a01 = a[1];
|
|
4959
|
+
const a02 = a[2];
|
|
4960
|
+
const a10 = a[3];
|
|
4961
|
+
const a11 = a[4];
|
|
4962
|
+
const a12 = a[5];
|
|
4963
|
+
const a20 = a[6];
|
|
4964
|
+
const a21 = a[7];
|
|
4965
|
+
const a22 = a[8];
|
|
4966
|
+
const s = Math.sin(rad);
|
|
4996
4967
|
const c = Math.cos(rad);
|
|
4997
|
-
out[0] = c * a00 +
|
|
4998
|
-
out[1] = c * a01 +
|
|
4999
|
-
out[2] = c * a02 +
|
|
5000
|
-
out[3] = c * a10 -
|
|
5001
|
-
out[4] = c * a11 -
|
|
5002
|
-
out[5] = c * a12 -
|
|
4968
|
+
out[0] = c * a00 + s * a10;
|
|
4969
|
+
out[1] = c * a01 + s * a11;
|
|
4970
|
+
out[2] = c * a02 + s * a12;
|
|
4971
|
+
out[3] = c * a10 - s * a00;
|
|
4972
|
+
out[4] = c * a11 - s * a01;
|
|
4973
|
+
out[5] = c * a12 - s * a02;
|
|
5003
4974
|
out[6] = a20;
|
|
5004
4975
|
out[7] = a21;
|
|
5005
4976
|
out[8] = a22;
|
|
5006
4977
|
return out;
|
|
5007
4978
|
}
|
|
5008
|
-
function scale(out,
|
|
4979
|
+
function scale(out, a, v) {
|
|
5009
4980
|
const x = v[0];
|
|
5010
4981
|
const y = v[1];
|
|
5011
|
-
out[0] = x *
|
|
5012
|
-
out[1] = x *
|
|
5013
|
-
out[2] = x *
|
|
5014
|
-
out[3] = y *
|
|
5015
|
-
out[4] = y *
|
|
5016
|
-
out[5] = y *
|
|
5017
|
-
out[6] =
|
|
5018
|
-
out[7] =
|
|
5019
|
-
out[8] =
|
|
4982
|
+
out[0] = x * a[0];
|
|
4983
|
+
out[1] = x * a[1];
|
|
4984
|
+
out[2] = x * a[2];
|
|
4985
|
+
out[3] = y * a[3];
|
|
4986
|
+
out[4] = y * a[4];
|
|
4987
|
+
out[5] = y * a[5];
|
|
4988
|
+
out[6] = a[6];
|
|
4989
|
+
out[7] = a[7];
|
|
4990
|
+
out[8] = a[8];
|
|
5020
4991
|
return out;
|
|
5021
4992
|
}
|
|
5022
4993
|
function fromQuat(out, q) {
|
|
@@ -5145,12 +5116,12 @@ var __exports__ = (() => {
|
|
|
5145
5116
|
invert(this, this);
|
|
5146
5117
|
return this.check();
|
|
5147
5118
|
}
|
|
5148
|
-
multiplyLeft(
|
|
5149
|
-
multiply(this,
|
|
5119
|
+
multiplyLeft(a) {
|
|
5120
|
+
multiply(this, a, this);
|
|
5150
5121
|
return this.check();
|
|
5151
5122
|
}
|
|
5152
|
-
multiplyRight(
|
|
5153
|
-
multiply(this, this,
|
|
5123
|
+
multiplyRight(a) {
|
|
5124
|
+
multiply(this, this, a);
|
|
5154
5125
|
return this.check();
|
|
5155
5126
|
}
|
|
5156
5127
|
rotate(radians) {
|
|
@@ -5227,8 +5198,8 @@ var __exports__ = (() => {
|
|
|
5227
5198
|
return;
|
|
5228
5199
|
}
|
|
5229
5200
|
const materials = gltfData.json.materials || [];
|
|
5230
|
-
for (let
|
|
5231
|
-
transformTexCoords(
|
|
5201
|
+
for (let i = 0; i < materials.length; i++) {
|
|
5202
|
+
transformTexCoords(i, gltfData);
|
|
5232
5203
|
}
|
|
5233
5204
|
}
|
|
5234
5205
|
function transformTexCoords(materialIndex, gltfData) {
|
|
@@ -5294,11 +5265,11 @@ var __exports__ = (() => {
|
|
|
5294
5265
|
const components = COMPONENTS[accessor.type];
|
|
5295
5266
|
const elementAddressScale = bufferView.byteStride || bytes * components;
|
|
5296
5267
|
const result = new Float32Array(length);
|
|
5297
|
-
for (let
|
|
5298
|
-
const uv = new ArrayType(arrayBuffer, byteOffset +
|
|
5268
|
+
for (let i = 0; i < accessor.count; i++) {
|
|
5269
|
+
const uv = new ArrayType(arrayBuffer, byteOffset + i * elementAddressScale, 2);
|
|
5299
5270
|
scratchVector.set(uv[0], uv[1], 1);
|
|
5300
5271
|
scratchVector.transformByMatrix3(matrix);
|
|
5301
|
-
result.set([scratchVector[0], scratchVector[1]],
|
|
5272
|
+
result.set([scratchVector[0], scratchVector[1]], i * components);
|
|
5302
5273
|
}
|
|
5303
5274
|
if (originalTexCoord === texCoord) {
|
|
5304
5275
|
updateGltf(accessor, bufferView, gltfData.buffers, result);
|
|
@@ -5832,22 +5803,22 @@ var __exports__ = (() => {
|
|
|
5832
5803
|
}
|
|
5833
5804
|
async function loadBuffers(gltf, options, context) {
|
|
5834
5805
|
const buffers = gltf.json.buffers || [];
|
|
5835
|
-
for (let
|
|
5836
|
-
const buffer = buffers[
|
|
5806
|
+
for (let i = 0; i < buffers.length; ++i) {
|
|
5807
|
+
const buffer = buffers[i];
|
|
5837
5808
|
if (buffer.uri) {
|
|
5838
5809
|
const { fetch: fetch2 } = context;
|
|
5839
5810
|
assert3(fetch2);
|
|
5840
5811
|
const uri = resolveUrl(buffer.uri, options);
|
|
5841
5812
|
const response = await context?.fetch?.(uri);
|
|
5842
5813
|
const arrayBuffer = await response?.arrayBuffer?.();
|
|
5843
|
-
gltf.buffers[
|
|
5814
|
+
gltf.buffers[i] = {
|
|
5844
5815
|
arrayBuffer,
|
|
5845
5816
|
byteOffset: 0,
|
|
5846
5817
|
byteLength: arrayBuffer.byteLength
|
|
5847
5818
|
};
|
|
5848
5819
|
delete buffer.uri;
|
|
5849
|
-
} else if (gltf.buffers[
|
|
5850
|
-
gltf.buffers[
|
|
5820
|
+
} else if (gltf.buffers[i] === null) {
|
|
5821
|
+
gltf.buffers[i] = {
|
|
5851
5822
|
arrayBuffer: new ArrayBuffer(buffer.byteLength),
|
|
5852
5823
|
byteOffset: 0,
|
|
5853
5824
|
byteLength: buffer.byteLength
|
|
@@ -6177,35 +6148,35 @@ var __exports__ = (() => {
|
|
|
6177
6148
|
const json = { ...gltf };
|
|
6178
6149
|
this.json = json;
|
|
6179
6150
|
if (gltf.bufferViews) {
|
|
6180
|
-
json.bufferViews = gltf.bufferViews.map((bufView,
|
|
6151
|
+
json.bufferViews = gltf.bufferViews.map((bufView, i) => this._resolveBufferView(bufView, i));
|
|
6181
6152
|
}
|
|
6182
6153
|
if (gltf.images) {
|
|
6183
|
-
json.images = gltf.images.map((image,
|
|
6154
|
+
json.images = gltf.images.map((image, i) => this._resolveImage(image, i));
|
|
6184
6155
|
}
|
|
6185
6156
|
if (gltf.samplers) {
|
|
6186
|
-
json.samplers = gltf.samplers.map((sampler,
|
|
6157
|
+
json.samplers = gltf.samplers.map((sampler, i) => this._resolveSampler(sampler, i));
|
|
6187
6158
|
}
|
|
6188
6159
|
if (gltf.textures) {
|
|
6189
|
-
json.textures = gltf.textures.map((texture,
|
|
6160
|
+
json.textures = gltf.textures.map((texture, i) => this._resolveTexture(texture, i));
|
|
6190
6161
|
}
|
|
6191
6162
|
if (gltf.accessors) {
|
|
6192
|
-
json.accessors = gltf.accessors.map((accessor,
|
|
6163
|
+
json.accessors = gltf.accessors.map((accessor, i) => this._resolveAccessor(accessor, i));
|
|
6193
6164
|
}
|
|
6194
6165
|
if (gltf.materials) {
|
|
6195
|
-
json.materials = gltf.materials.map((material,
|
|
6166
|
+
json.materials = gltf.materials.map((material, i) => this._resolveMaterial(material, i));
|
|
6196
6167
|
}
|
|
6197
6168
|
if (gltf.meshes) {
|
|
6198
|
-
json.meshes = gltf.meshes.map((mesh,
|
|
6169
|
+
json.meshes = gltf.meshes.map((mesh, i) => this._resolveMesh(mesh, i));
|
|
6199
6170
|
}
|
|
6200
6171
|
if (gltf.nodes) {
|
|
6201
|
-
json.nodes = gltf.nodes.map((node,
|
|
6202
|
-
json.nodes = json.nodes.map((node,
|
|
6172
|
+
json.nodes = gltf.nodes.map((node, i) => this._resolveNode(node, i));
|
|
6173
|
+
json.nodes = json.nodes.map((node, i) => this._resolveNodeChildren(node));
|
|
6203
6174
|
}
|
|
6204
6175
|
if (gltf.skins) {
|
|
6205
|
-
json.skins = gltf.skins.map((skin,
|
|
6176
|
+
json.skins = gltf.skins.map((skin, i) => this._resolveSkin(skin, i));
|
|
6206
6177
|
}
|
|
6207
6178
|
if (gltf.scenes) {
|
|
6208
|
-
json.scenes = gltf.scenes.map((scene,
|
|
6179
|
+
json.scenes = gltf.scenes.map((scene, i) => this._resolveScene(scene, i));
|
|
6209
6180
|
}
|
|
6210
6181
|
if (typeof this.json.scene === "number" && json.scenes) {
|
|
6211
6182
|
json.scene = json.scenes[this.json.scene];
|
|
@@ -6421,11 +6392,11 @@ var __exports__ = (() => {
|
|
|
6421
6392
|
*/
|
|
6422
6393
|
_getValueFromInterleavedBuffer(buffer, byteOffset, byteStride, bytesPerElement, count) {
|
|
6423
6394
|
const result = new Uint8Array(count * bytesPerElement);
|
|
6424
|
-
for (let
|
|
6425
|
-
const elementOffset = byteOffset +
|
|
6395
|
+
for (let i = 0; i < count; i++) {
|
|
6396
|
+
const elementOffset = byteOffset + i * byteStride;
|
|
6426
6397
|
result.set(
|
|
6427
6398
|
new Uint8Array(buffer.arrayBuffer.slice(elementOffset, elementOffset + bytesPerElement)),
|
|
6428
|
-
|
|
6399
|
+
i * bytesPerElement
|
|
6429
6400
|
);
|
|
6430
6401
|
}
|
|
6431
6402
|
return result.buffer;
|