@loaders.gl/textures 4.3.0-alpha.3 → 4.3.0-alpha.5
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/basis-worker-node.js +74 -251
- package/dist/basis-worker.js +2 -31
- package/dist/compressed-texture-worker.js +253 -98
- package/dist/crunch-worker.js +2 -2
- package/dist/dist.dev.js +268 -113
- package/dist/dist.min.js +2 -2
- package/dist/index.cjs +1 -2
- package/dist/index.cjs.map +2 -2
- package/dist/ktx2-basis-writer-worker-node.js +2 -2
- package/dist/ktx2-basis-writer-worker.js +2 -2
- package/dist/lib/parsers/parse-basis.d.ts.map +1 -1
- package/dist/lib/parsers/parse-basis.js +0 -1
- package/dist/lib/utils/version.js +1 -1
- package/dist/npy-worker.js +1 -1
- package/package.json +7 -7
- package/src/lib/parsers/parse-basis.ts +0 -1
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
);
|
|
29
29
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
30
30
|
} else {
|
|
31
|
-
globalThis._loadersgl_.version = "4.3.0-alpha.
|
|
31
|
+
globalThis._loadersgl_.version = "4.3.0-alpha.4";
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
return globalThis._loadersgl_.version;
|
|
@@ -243,7 +243,7 @@
|
|
|
243
243
|
script.id = id;
|
|
244
244
|
try {
|
|
245
245
|
script.appendChild(document.createTextNode(scriptSource));
|
|
246
|
-
} catch (
|
|
246
|
+
} catch (e) {
|
|
247
247
|
script.text = scriptSource;
|
|
248
248
|
}
|
|
249
249
|
document.body.appendChild(script);
|
|
@@ -348,102 +348,258 @@
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
// src/lib/utils/version.ts
|
|
351
|
-
var VERSION2 = true ? "4.3.0-alpha.
|
|
351
|
+
var VERSION2 = true ? "4.3.0-alpha.4" : "latest";
|
|
352
352
|
|
|
353
353
|
// ../../node_modules/ktx-parse/dist/ktx-parse.modern.js
|
|
354
|
-
var
|
|
355
|
-
var
|
|
356
|
-
var
|
|
357
|
-
var
|
|
358
|
-
var
|
|
359
|
-
var
|
|
360
|
-
var
|
|
361
|
-
var
|
|
362
|
-
var
|
|
363
|
-
var
|
|
364
|
-
|
|
365
|
-
t2[t2.NONE = 0] = "NONE", t2[t2.BASISLZ = 1] = "BASISLZ", t2[t2.ZSTD = 2] = "ZSTD", t2[t2.ZLIB = 3] = "ZLIB";
|
|
366
|
-
}(n || (n = {})), function(t2) {
|
|
367
|
-
t2[t2.BASICFORMAT = 0] = "BASICFORMAT";
|
|
368
|
-
}(i || (i = {})), function(t2) {
|
|
369
|
-
t2[t2.UNSPECIFIED = 0] = "UNSPECIFIED", t2[t2.ETC1S = 163] = "ETC1S", t2[t2.UASTC = 166] = "UASTC";
|
|
370
|
-
}(s || (s = {})), function(t2) {
|
|
371
|
-
t2[t2.UNSPECIFIED = 0] = "UNSPECIFIED", t2[t2.SRGB = 1] = "SRGB";
|
|
372
|
-
}(a || (a = {})), function(t2) {
|
|
373
|
-
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";
|
|
374
|
-
}(r || (r = {})), function(t2) {
|
|
375
|
-
t2[t2.ALPHA_STRAIGHT = 0] = "ALPHA_STRAIGHT", t2[t2.ALPHA_PREMULTIPLIED = 1] = "ALPHA_PREMULTIPLIED";
|
|
376
|
-
}(o || (o = {})), function(t2) {
|
|
377
|
-
t2[t2.RGB = 0] = "RGB", t2[t2.RRR = 3] = "RRR", t2[t2.GGG = 4] = "GGG", t2[t2.AAA = 15] = "AAA";
|
|
378
|
-
}(l || (l = {})), function(t2) {
|
|
379
|
-
t2[t2.RGB = 0] = "RGB", t2[t2.RGBA = 3] = "RGBA", t2[t2.RRR = 4] = "RRR", t2[t2.RRRG = 5] = "RRRG";
|
|
380
|
-
}(f || (f = {}));
|
|
381
|
-
var U = class {
|
|
354
|
+
var KHR_SUPERCOMPRESSION_NONE = 0;
|
|
355
|
+
var KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT = 0;
|
|
356
|
+
var KHR_DF_VENDORID_KHRONOS = 0;
|
|
357
|
+
var KHR_DF_VERSION = 2;
|
|
358
|
+
var KHR_DF_MODEL_UNSPECIFIED = 0;
|
|
359
|
+
var KHR_DF_FLAG_ALPHA_STRAIGHT = 0;
|
|
360
|
+
var KHR_DF_TRANSFER_SRGB = 2;
|
|
361
|
+
var KHR_DF_PRIMARIES_BT709 = 1;
|
|
362
|
+
var KHR_DF_SAMPLE_DATATYPE_SIGNED = 64;
|
|
363
|
+
var VK_FORMAT_UNDEFINED = 0;
|
|
364
|
+
var KTX2Container = class {
|
|
382
365
|
constructor() {
|
|
383
|
-
this.vkFormat =
|
|
366
|
+
this.vkFormat = VK_FORMAT_UNDEFINED;
|
|
367
|
+
this.typeSize = 1;
|
|
368
|
+
this.pixelWidth = 0;
|
|
369
|
+
this.pixelHeight = 0;
|
|
370
|
+
this.pixelDepth = 0;
|
|
371
|
+
this.layerCount = 0;
|
|
372
|
+
this.faceCount = 1;
|
|
373
|
+
this.supercompressionScheme = KHR_SUPERCOMPRESSION_NONE;
|
|
374
|
+
this.levels = [];
|
|
375
|
+
this.dataFormatDescriptor = [{
|
|
376
|
+
vendorId: KHR_DF_VENDORID_KHRONOS,
|
|
377
|
+
descriptorType: KHR_DF_KHR_DESCRIPTORTYPE_BASICFORMAT,
|
|
378
|
+
descriptorBlockSize: 0,
|
|
379
|
+
versionNumber: KHR_DF_VERSION,
|
|
380
|
+
colorModel: KHR_DF_MODEL_UNSPECIFIED,
|
|
381
|
+
colorPrimaries: KHR_DF_PRIMARIES_BT709,
|
|
382
|
+
transferFunction: KHR_DF_TRANSFER_SRGB,
|
|
383
|
+
flags: KHR_DF_FLAG_ALPHA_STRAIGHT,
|
|
384
|
+
texelBlockDimension: [0, 0, 0, 0],
|
|
385
|
+
bytesPlane: [0, 0, 0, 0, 0, 0, 0, 0],
|
|
386
|
+
samples: []
|
|
387
|
+
}];
|
|
388
|
+
this.keyValue = {};
|
|
389
|
+
this.globalData = null;
|
|
384
390
|
}
|
|
385
391
|
};
|
|
386
|
-
var
|
|
387
|
-
constructor(
|
|
388
|
-
this._dataView =
|
|
392
|
+
var BufferReader = class {
|
|
393
|
+
constructor(data, byteOffset, byteLength, littleEndian) {
|
|
394
|
+
this._dataView = void 0;
|
|
395
|
+
this._littleEndian = void 0;
|
|
396
|
+
this._offset = void 0;
|
|
397
|
+
this._dataView = new DataView(data.buffer, data.byteOffset + byteOffset, byteLength);
|
|
398
|
+
this._littleEndian = littleEndian;
|
|
399
|
+
this._offset = 0;
|
|
389
400
|
}
|
|
390
401
|
_nextUint8() {
|
|
391
|
-
const
|
|
392
|
-
|
|
402
|
+
const value = this._dataView.getUint8(this._offset);
|
|
403
|
+
this._offset += 1;
|
|
404
|
+
return value;
|
|
393
405
|
}
|
|
394
406
|
_nextUint16() {
|
|
395
|
-
const
|
|
396
|
-
|
|
407
|
+
const value = this._dataView.getUint16(this._offset, this._littleEndian);
|
|
408
|
+
this._offset += 2;
|
|
409
|
+
return value;
|
|
397
410
|
}
|
|
398
411
|
_nextUint32() {
|
|
399
|
-
const
|
|
400
|
-
|
|
412
|
+
const value = this._dataView.getUint32(this._offset, this._littleEndian);
|
|
413
|
+
this._offset += 4;
|
|
414
|
+
return value;
|
|
401
415
|
}
|
|
402
416
|
_nextUint64() {
|
|
403
|
-
const
|
|
404
|
-
|
|
417
|
+
const left = this._dataView.getUint32(this._offset, this._littleEndian);
|
|
418
|
+
const right = this._dataView.getUint32(this._offset + 4, this._littleEndian);
|
|
419
|
+
const value = left + 2 ** 32 * right;
|
|
420
|
+
this._offset += 8;
|
|
421
|
+
return value;
|
|
405
422
|
}
|
|
406
|
-
|
|
407
|
-
|
|
423
|
+
_nextInt32() {
|
|
424
|
+
const value = this._dataView.getInt32(this._offset, this._littleEndian);
|
|
425
|
+
this._offset += 4;
|
|
426
|
+
return value;
|
|
408
427
|
}
|
|
409
|
-
|
|
410
|
-
const
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
428
|
+
_nextUint8Array(len) {
|
|
429
|
+
const value = new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + this._offset, len);
|
|
430
|
+
this._offset += len;
|
|
431
|
+
return value;
|
|
432
|
+
}
|
|
433
|
+
_skip(bytes) {
|
|
434
|
+
this._offset += bytes;
|
|
435
|
+
return this;
|
|
436
|
+
}
|
|
437
|
+
_scan(maxByteLength, term = 0) {
|
|
438
|
+
const byteOffset = this._offset;
|
|
439
|
+
let byteLength = 0;
|
|
440
|
+
while (this._dataView.getUint8(this._offset) !== term && byteLength < maxByteLength) {
|
|
441
|
+
byteLength++;
|
|
442
|
+
this._offset++;
|
|
443
|
+
}
|
|
444
|
+
if (byteLength < maxByteLength)
|
|
445
|
+
this._offset++;
|
|
446
|
+
return new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + byteOffset, byteLength);
|
|
415
447
|
}
|
|
416
448
|
};
|
|
417
|
-
|
|
418
|
-
|
|
449
|
+
var NUL = new Uint8Array([0]);
|
|
450
|
+
var KTX2_ID = [
|
|
451
|
+
// '´', 'K', 'T', 'X', '2', '0', 'ª', '\r', '\n', '\x1A', '\n'
|
|
452
|
+
171,
|
|
453
|
+
75,
|
|
454
|
+
84,
|
|
455
|
+
88,
|
|
456
|
+
32,
|
|
457
|
+
50,
|
|
458
|
+
48,
|
|
459
|
+
187,
|
|
460
|
+
13,
|
|
461
|
+
10,
|
|
462
|
+
26,
|
|
463
|
+
10
|
|
464
|
+
];
|
|
465
|
+
function decodeText(buffer) {
|
|
466
|
+
if (typeof TextDecoder !== "undefined") {
|
|
467
|
+
return new TextDecoder().decode(buffer);
|
|
468
|
+
}
|
|
469
|
+
return Buffer.from(buffer).toString("utf8");
|
|
419
470
|
}
|
|
420
|
-
function
|
|
421
|
-
const
|
|
422
|
-
if (
|
|
471
|
+
function read(data) {
|
|
472
|
+
const id = new Uint8Array(data.buffer, data.byteOffset, KTX2_ID.length);
|
|
473
|
+
if (id[0] !== KTX2_ID[0] || // '´'
|
|
474
|
+
id[1] !== KTX2_ID[1] || // 'K'
|
|
475
|
+
id[2] !== KTX2_ID[2] || // 'T'
|
|
476
|
+
id[3] !== KTX2_ID[3] || // 'X'
|
|
477
|
+
id[4] !== KTX2_ID[4] || // ' '
|
|
478
|
+
id[5] !== KTX2_ID[5] || // '2'
|
|
479
|
+
id[6] !== KTX2_ID[6] || // '0'
|
|
480
|
+
id[7] !== KTX2_ID[7] || // 'ª'
|
|
481
|
+
id[8] !== KTX2_ID[8] || // '\r'
|
|
482
|
+
id[9] !== KTX2_ID[9] || // '\n'
|
|
483
|
+
id[10] !== KTX2_ID[10] || // '\x1A'
|
|
484
|
+
id[11] !== KTX2_ID[11]) {
|
|
423
485
|
throw new Error("Missing KTX 2.0 identifier.");
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
const
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
const
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
const
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
486
|
+
}
|
|
487
|
+
const container = new KTX2Container();
|
|
488
|
+
const headerByteLength = 17 * Uint32Array.BYTES_PER_ELEMENT;
|
|
489
|
+
const headerReader = new BufferReader(data, KTX2_ID.length, headerByteLength, true);
|
|
490
|
+
container.vkFormat = headerReader._nextUint32();
|
|
491
|
+
container.typeSize = headerReader._nextUint32();
|
|
492
|
+
container.pixelWidth = headerReader._nextUint32();
|
|
493
|
+
container.pixelHeight = headerReader._nextUint32();
|
|
494
|
+
container.pixelDepth = headerReader._nextUint32();
|
|
495
|
+
container.layerCount = headerReader._nextUint32();
|
|
496
|
+
container.faceCount = headerReader._nextUint32();
|
|
497
|
+
const levelCount = headerReader._nextUint32();
|
|
498
|
+
container.supercompressionScheme = headerReader._nextUint32();
|
|
499
|
+
const dfdByteOffset = headerReader._nextUint32();
|
|
500
|
+
const dfdByteLength = headerReader._nextUint32();
|
|
501
|
+
const kvdByteOffset = headerReader._nextUint32();
|
|
502
|
+
const kvdByteLength = headerReader._nextUint32();
|
|
503
|
+
const sgdByteOffset = headerReader._nextUint64();
|
|
504
|
+
const sgdByteLength = headerReader._nextUint64();
|
|
505
|
+
const levelByteLength = levelCount * 3 * 8;
|
|
506
|
+
const levelReader = new BufferReader(data, KTX2_ID.length + headerByteLength, levelByteLength, true);
|
|
507
|
+
for (let i = 0; i < levelCount; i++) {
|
|
508
|
+
container.levels.push({
|
|
509
|
+
levelData: new Uint8Array(data.buffer, data.byteOffset + levelReader._nextUint64(), levelReader._nextUint64()),
|
|
510
|
+
uncompressedByteLength: levelReader._nextUint64()
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
const dfdReader = new BufferReader(data, dfdByteOffset, dfdByteLength, true);
|
|
514
|
+
const dfd = {
|
|
515
|
+
vendorId: dfdReader._skip(
|
|
516
|
+
4
|
|
517
|
+
/* totalSize */
|
|
518
|
+
)._nextUint16(),
|
|
519
|
+
descriptorType: dfdReader._nextUint16(),
|
|
520
|
+
versionNumber: dfdReader._nextUint16(),
|
|
521
|
+
descriptorBlockSize: dfdReader._nextUint16(),
|
|
522
|
+
colorModel: dfdReader._nextUint8(),
|
|
523
|
+
colorPrimaries: dfdReader._nextUint8(),
|
|
524
|
+
transferFunction: dfdReader._nextUint8(),
|
|
525
|
+
flags: dfdReader._nextUint8(),
|
|
526
|
+
texelBlockDimension: [dfdReader._nextUint8(), dfdReader._nextUint8(), dfdReader._nextUint8(), dfdReader._nextUint8()],
|
|
527
|
+
bytesPlane: [dfdReader._nextUint8(), dfdReader._nextUint8(), dfdReader._nextUint8(), dfdReader._nextUint8(), dfdReader._nextUint8(), dfdReader._nextUint8(), dfdReader._nextUint8(), dfdReader._nextUint8()],
|
|
528
|
+
samples: []
|
|
529
|
+
};
|
|
530
|
+
const sampleStart = 6;
|
|
531
|
+
const sampleWords = 4;
|
|
532
|
+
const numSamples = (dfd.descriptorBlockSize / 4 - sampleStart) / sampleWords;
|
|
533
|
+
for (let i = 0; i < numSamples; i++) {
|
|
534
|
+
const sample = {
|
|
535
|
+
bitOffset: dfdReader._nextUint16(),
|
|
536
|
+
bitLength: dfdReader._nextUint8(),
|
|
537
|
+
channelType: dfdReader._nextUint8(),
|
|
538
|
+
samplePosition: [dfdReader._nextUint8(), dfdReader._nextUint8(), dfdReader._nextUint8(), dfdReader._nextUint8()],
|
|
539
|
+
sampleLower: -Infinity,
|
|
540
|
+
sampleUpper: Infinity
|
|
541
|
+
};
|
|
542
|
+
if (sample.channelType & KHR_DF_SAMPLE_DATATYPE_SIGNED) {
|
|
543
|
+
sample.sampleLower = dfdReader._nextInt32();
|
|
544
|
+
sample.sampleUpper = dfdReader._nextInt32();
|
|
545
|
+
} else {
|
|
546
|
+
sample.sampleLower = dfdReader._nextUint32();
|
|
547
|
+
sample.sampleUpper = dfdReader._nextUint32();
|
|
548
|
+
}
|
|
549
|
+
dfd.samples[i] = sample;
|
|
550
|
+
}
|
|
551
|
+
container.dataFormatDescriptor.length = 0;
|
|
552
|
+
container.dataFormatDescriptor.push(dfd);
|
|
553
|
+
const kvdReader = new BufferReader(data, kvdByteOffset, kvdByteLength, true);
|
|
554
|
+
while (kvdReader._offset < kvdByteLength) {
|
|
555
|
+
const keyValueByteLength = kvdReader._nextUint32();
|
|
556
|
+
const keyData = kvdReader._scan(keyValueByteLength);
|
|
557
|
+
const key = decodeText(keyData);
|
|
558
|
+
container.keyValue[key] = kvdReader._nextUint8Array(keyValueByteLength - keyData.byteLength - 1);
|
|
559
|
+
if (key.match(/^ktx/i)) {
|
|
560
|
+
const text = decodeText(container.keyValue[key]);
|
|
561
|
+
container.keyValue[key] = text.substring(0, text.lastIndexOf("\0"));
|
|
562
|
+
}
|
|
563
|
+
const kvPadding = keyValueByteLength % 4 ? 4 - keyValueByteLength % 4 : 0;
|
|
564
|
+
kvdReader._skip(kvPadding);
|
|
565
|
+
}
|
|
566
|
+
if (sgdByteLength <= 0)
|
|
567
|
+
return container;
|
|
568
|
+
const sgdReader = new BufferReader(data, sgdByteOffset, sgdByteLength, true);
|
|
569
|
+
const endpointCount = sgdReader._nextUint16();
|
|
570
|
+
const selectorCount = sgdReader._nextUint16();
|
|
571
|
+
const endpointsByteLength = sgdReader._nextUint32();
|
|
572
|
+
const selectorsByteLength = sgdReader._nextUint32();
|
|
573
|
+
const tablesByteLength = sgdReader._nextUint32();
|
|
574
|
+
const extendedByteLength = sgdReader._nextUint32();
|
|
575
|
+
const imageDescs = [];
|
|
576
|
+
for (let i = 0; i < levelCount; i++) {
|
|
577
|
+
imageDescs.push({
|
|
578
|
+
imageFlags: sgdReader._nextUint32(),
|
|
579
|
+
rgbSliceByteOffset: sgdReader._nextUint32(),
|
|
580
|
+
rgbSliceByteLength: sgdReader._nextUint32(),
|
|
581
|
+
alphaSliceByteOffset: sgdReader._nextUint32(),
|
|
582
|
+
alphaSliceByteLength: sgdReader._nextUint32()
|
|
583
|
+
});
|
|
584
|
+
}
|
|
585
|
+
const endpointsByteOffset = sgdByteOffset + sgdReader._offset;
|
|
586
|
+
const selectorsByteOffset = endpointsByteOffset + endpointsByteLength;
|
|
587
|
+
const tablesByteOffset = selectorsByteOffset + selectorsByteLength;
|
|
588
|
+
const extendedByteOffset = tablesByteOffset + tablesByteLength;
|
|
589
|
+
const endpointsData = new Uint8Array(data.buffer, data.byteOffset + endpointsByteOffset, endpointsByteLength);
|
|
590
|
+
const selectorsData = new Uint8Array(data.buffer, data.byteOffset + selectorsByteOffset, selectorsByteLength);
|
|
591
|
+
const tablesData = new Uint8Array(data.buffer, data.byteOffset + tablesByteOffset, tablesByteLength);
|
|
592
|
+
const extendedData = new Uint8Array(data.buffer, data.byteOffset + extendedByteOffset, extendedByteLength);
|
|
593
|
+
container.globalData = {
|
|
594
|
+
endpointCount,
|
|
595
|
+
selectorCount,
|
|
596
|
+
imageDescs,
|
|
597
|
+
endpointsData,
|
|
598
|
+
selectorsData,
|
|
599
|
+
tablesData,
|
|
600
|
+
extendedData
|
|
601
|
+
};
|
|
602
|
+
return container;
|
|
447
603
|
}
|
|
448
604
|
|
|
449
605
|
// src/lib/utils/extract-mipmap-images.ts
|
|
@@ -452,10 +608,10 @@
|
|
|
452
608
|
let levelWidth = options.width;
|
|
453
609
|
let levelHeight = options.height;
|
|
454
610
|
let offset = 0;
|
|
455
|
-
for (let
|
|
456
|
-
const levelSize = getLevelSize(options, levelWidth, levelHeight, data,
|
|
457
|
-
const levelData = getLevelData(data,
|
|
458
|
-
images[
|
|
611
|
+
for (let i = 0; i < options.mipMapLevels; ++i) {
|
|
612
|
+
const levelSize = getLevelSize(options, levelWidth, levelHeight, data, i);
|
|
613
|
+
const levelData = getLevelData(data, i, offset, levelSize);
|
|
614
|
+
images[i] = {
|
|
459
615
|
compressed: true,
|
|
460
616
|
format: options.internalFormat,
|
|
461
617
|
data: levelData,
|
|
@@ -668,7 +824,7 @@
|
|
|
668
824
|
}
|
|
669
825
|
|
|
670
826
|
// src/lib/parsers/parse-ktx.ts
|
|
671
|
-
var
|
|
827
|
+
var KTX2_ID2 = [
|
|
672
828
|
// '´', 'K', 'T', 'X', '2', '0', 'ª', '\r', '\n', '\x1A', '\n'
|
|
673
829
|
171,
|
|
674
830
|
75,
|
|
@@ -685,23 +841,23 @@
|
|
|
685
841
|
];
|
|
686
842
|
function isKTX(data) {
|
|
687
843
|
const id = new Uint8Array(data);
|
|
688
|
-
const notKTX = id.byteLength <
|
|
689
|
-
id[1] !==
|
|
690
|
-
id[2] !==
|
|
691
|
-
id[3] !==
|
|
692
|
-
id[4] !==
|
|
693
|
-
id[5] !==
|
|
694
|
-
id[6] !==
|
|
695
|
-
id[7] !==
|
|
696
|
-
id[8] !==
|
|
697
|
-
id[9] !==
|
|
698
|
-
id[10] !==
|
|
699
|
-
id[11] !==
|
|
844
|
+
const notKTX = id.byteLength < KTX2_ID2.length || id[0] !== KTX2_ID2[0] || // '´'
|
|
845
|
+
id[1] !== KTX2_ID2[1] || // 'K'
|
|
846
|
+
id[2] !== KTX2_ID2[2] || // 'T'
|
|
847
|
+
id[3] !== KTX2_ID2[3] || // 'X'
|
|
848
|
+
id[4] !== KTX2_ID2[4] || // ' '
|
|
849
|
+
id[5] !== KTX2_ID2[5] || // '2'
|
|
850
|
+
id[6] !== KTX2_ID2[6] || // '0'
|
|
851
|
+
id[7] !== KTX2_ID2[7] || // 'ª'
|
|
852
|
+
id[8] !== KTX2_ID2[8] || // '\r'
|
|
853
|
+
id[9] !== KTX2_ID2[9] || // '\n'
|
|
854
|
+
id[10] !== KTX2_ID2[10] || // '\x1A'
|
|
855
|
+
id[11] !== KTX2_ID2[11];
|
|
700
856
|
return !notKTX;
|
|
701
857
|
}
|
|
702
858
|
function parseKTX(arrayBuffer) {
|
|
703
859
|
const uint8Array = new Uint8Array(arrayBuffer);
|
|
704
|
-
const ktx =
|
|
860
|
+
const ktx = read(uint8Array);
|
|
705
861
|
const mipMapLevels = Math.max(1, ktx.levels.length);
|
|
706
862
|
const width = ktx.pixelWidth;
|
|
707
863
|
const height = ktx.pixelHeight;
|
|
@@ -1246,7 +1402,6 @@
|
|
|
1246
1402
|
const levels = [];
|
|
1247
1403
|
for (let levelIndex = 0; levelIndex < levelsCount; levelIndex++) {
|
|
1248
1404
|
levels.push(transcodeKTX2Image(ktx2File, levelIndex, options));
|
|
1249
|
-
break;
|
|
1250
1405
|
}
|
|
1251
1406
|
return [levels];
|
|
1252
1407
|
} finally {
|
package/dist/crunch-worker.js
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
);
|
|
29
29
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
30
30
|
} else {
|
|
31
|
-
globalThis._loadersgl_.version = "4.3.0-alpha.
|
|
31
|
+
globalThis._loadersgl_.version = "4.3.0-alpha.4";
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
return globalThis._loadersgl_.version;
|
|
@@ -348,7 +348,7 @@
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
// src/lib/utils/version.ts
|
|
351
|
-
var VERSION2 = true ? "4.3.0-alpha.
|
|
351
|
+
var VERSION2 = true ? "4.3.0-alpha.4" : "latest";
|
|
352
352
|
|
|
353
353
|
// src/crunch-loader.ts
|
|
354
354
|
var CrunchLoader = {
|