@monogrid/gainmap-js 2.0.5 → 2.0.6
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/CHANGELOG.md +8 -0
- package/dist/{QuadRenderer-bEJB0XFk.js → QuadRenderer-gqnZPNP-.js} +4 -4
- package/dist/{_commonjsHelpers-bdHH9bEd.js → _commonjsHelpers-iRbo2TdN.js} +1 -1
- package/dist/{compress-aBsBfoFB.js → compress-_4jEQonS.js} +2 -2
- package/dist/decode/loaders/LoaderBase.d.ts +2 -1
- package/dist/decode.js +54 -26
- package/dist/decode.umd.js +54 -26
- package/dist/encode.js +25 -11
- package/dist/encode.umd.js +25 -11
- package/dist/libultrahdr.js +5 -3
- package/dist/libultrahdr.umd.js +5 -3
- package/dist/worker-interface.js +2 -2
- package/dist/worker-interface.umd.js +1 -1
- package/dist/worker.js +7 -4
- package/dist/worker.umd.js +6 -3
- package/package.json +23 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [2.0.6](https://github.com/MONOGRID/gainmap-js/compare/v2.0.5...v2.0.6) (2023-11-20)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **decode:** changes usage of `NoColorSpace` to `LinearSRGBColorSpace` ([587dc03](https://github.com/MONOGRID/gainmap-js/commit/587dc0377876533b18b506516d8757e04e830c62))
|
|
7
|
+
* **loaders:** fixes LoadingManager `onLoad` actually waiting for gainmaps to be generated ([77170f5](https://github.com/MONOGRID/gainmap-js/commit/77170f57c5ad277d3e97d1236ab93a29106c4a99))
|
|
8
|
+
|
|
1
9
|
## [2.0.5](https://github.com/MONOGRID/gainmap-js/compare/v2.0.4...v2.0.5) (2023-11-16)
|
|
2
10
|
|
|
3
11
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v2.0.
|
|
2
|
+
* @monogrid/gainmap-js v2.0.5
|
|
3
3
|
* With ❤️, by MONOGRID <hello@mono-grid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Scene, OrthographicCamera, HalfFloatType, FloatType, Mesh, PlaneGeometry, WebGLRenderTarget, RGBAFormat, LinearFilter, LinearMipMapLinearFilter, RepeatWrapping, WebGLRenderer, DataTexture, UVMapping,
|
|
6
|
+
import { Scene, OrthographicCamera, HalfFloatType, FloatType, Mesh, PlaneGeometry, WebGLRenderTarget, RGBAFormat, LinearFilter, LinearMipMapLinearFilter, RepeatWrapping, WebGLRenderer, DataTexture, UVMapping, LinearSRGBColorSpace, IntType, ShortType, ByteType, UnsignedIntType, UnsignedByteType, MeshBasicMaterial } from 'three';
|
|
7
7
|
|
|
8
8
|
const getBufferForType = (type, width, height) => {
|
|
9
9
|
let out;
|
|
@@ -51,7 +51,7 @@ const canReadPixels = (type, renderer, camera) => {
|
|
|
51
51
|
return _canReadPixelsResult;
|
|
52
52
|
const testRT = new WebGLRenderTarget(1, 1, {
|
|
53
53
|
type,
|
|
54
|
-
colorSpace:
|
|
54
|
+
colorSpace: LinearSRGBColorSpace,
|
|
55
55
|
format: RGBAFormat,
|
|
56
56
|
magFilter: LinearFilter,
|
|
57
57
|
minFilter: LinearFilter,
|
|
@@ -182,7 +182,7 @@ class QuadRenderer {
|
|
|
182
182
|
return out;
|
|
183
183
|
}
|
|
184
184
|
toDataTexture() {
|
|
185
|
-
return new DataTexture(this.toArray(), this.width, this.height, RGBAFormat, this._type, UVMapping, RepeatWrapping, RepeatWrapping, LinearFilter, LinearMipMapLinearFilter, 1,
|
|
185
|
+
return new DataTexture(this.toArray(), this.width, this.height, RGBAFormat, this._type, UVMapping, RepeatWrapping, RepeatWrapping, LinearFilter, LinearMipMapLinearFilter, 1, LinearSRGBColorSpace);
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
188
|
* If using a disposable renderer, it will dispose it.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v2.0.
|
|
2
|
+
* @monogrid/gainmap-js v2.0.5
|
|
3
3
|
* With ❤️, by MONOGRID <hello@mono-grid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -21,7 +21,7 @@ const canvasToBlob = async (canvas, mimeType, quality) => {
|
|
|
21
21
|
if (res)
|
|
22
22
|
resolve(res);
|
|
23
23
|
else
|
|
24
|
-
reject('Failed to convert canvas to blob');
|
|
24
|
+
reject(new Error('Failed to convert canvas to blob'));
|
|
25
25
|
}, mimeType, quality || 0.9);
|
|
26
26
|
});
|
|
27
27
|
};
|
|
@@ -3,7 +3,8 @@ import { QuadRenderer } from '../../core/QuadRenderer';
|
|
|
3
3
|
import { type GainMapMetadata } from '../../core/types';
|
|
4
4
|
import { GainMapDecoderMaterial } from '../materials/GainMapDecoderMaterial';
|
|
5
5
|
export declare class LoaderBase<TUrl = string> extends Loader<QuadRenderer<typeof HalfFloatType, GainMapDecoderMaterial>, TUrl> {
|
|
6
|
-
private
|
|
6
|
+
private _renderer;
|
|
7
|
+
protected _internalLoadingManager: LoadingManager;
|
|
7
8
|
/**
|
|
8
9
|
*
|
|
9
10
|
* @param renderer
|
package/dist/decode.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v2.0.
|
|
2
|
+
* @monogrid/gainmap-js v2.0.5
|
|
3
3
|
* With ❤️, by MONOGRID <hello@mono-grid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { Q as QuadRenderer } from './QuadRenderer-
|
|
7
|
-
import { ShaderMaterial, Vector3, NoBlending, SRGBColorSpace,
|
|
6
|
+
import { Q as QuadRenderer } from './QuadRenderer-gqnZPNP-.js';
|
|
7
|
+
import { ShaderMaterial, Vector3, NoBlending, SRGBColorSpace, LinearSRGBColorSpace, HalfFloatType, Loader, LoadingManager, Texture, UVMapping, ClampToEdgeWrapping, LinearFilter, LinearMipMapLinearFilter, RGBAFormat, UnsignedByteType, FileLoader } from 'three';
|
|
8
8
|
|
|
9
9
|
const vertexShader = /* glsl */ `
|
|
10
10
|
varying vec2 vUv;
|
|
@@ -208,16 +208,19 @@ const decode = (params) => {
|
|
|
208
208
|
sdr.colorSpace = SRGBColorSpace;
|
|
209
209
|
}
|
|
210
210
|
sdr.needsUpdate = true;
|
|
211
|
-
if (gainMap.colorSpace !==
|
|
212
|
-
console.warn('Gainmap Colorspace needs to be *
|
|
213
|
-
gainMap.colorSpace =
|
|
211
|
+
if (gainMap.colorSpace !== LinearSRGBColorSpace) {
|
|
212
|
+
console.warn('Gainmap Colorspace needs to be *LinearSRGBColorSpace*');
|
|
213
|
+
gainMap.colorSpace = LinearSRGBColorSpace;
|
|
214
214
|
}
|
|
215
215
|
gainMap.needsUpdate = true;
|
|
216
|
-
const material = new GainMapDecoderMaterial(
|
|
217
|
-
|
|
216
|
+
const material = new GainMapDecoderMaterial({
|
|
217
|
+
...params,
|
|
218
|
+
sdr,
|
|
219
|
+
gainMap
|
|
220
|
+
});
|
|
218
221
|
// TODO: three types are generic, eslint complains here, see how we can solve
|
|
219
222
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
220
|
-
const quadRenderer = new QuadRenderer(sdr.image.width, sdr.image.height, HalfFloatType,
|
|
223
|
+
const quadRenderer = new QuadRenderer(sdr.image.width, sdr.image.height, HalfFloatType, LinearSRGBColorSpace, material, renderer);
|
|
221
224
|
try {
|
|
222
225
|
quadRenderer.render();
|
|
223
226
|
}
|
|
@@ -330,7 +333,7 @@ class MPFExtractor {
|
|
|
330
333
|
// If you're executing this line on a big endian machine, it'll be reversed.
|
|
331
334
|
// bigEnd further down though, refers to the endianness of the image itself.
|
|
332
335
|
if (dataView.getUint16(0) !== 0xffd8) {
|
|
333
|
-
reject('Not a valid jpeg');
|
|
336
|
+
reject(new Error('Not a valid jpeg'));
|
|
334
337
|
return;
|
|
335
338
|
}
|
|
336
339
|
const length = dataView.byteLength;
|
|
@@ -339,11 +342,11 @@ class MPFExtractor {
|
|
|
339
342
|
let marker; // APP# marker
|
|
340
343
|
while (offset < length) {
|
|
341
344
|
if (++loops > 250) {
|
|
342
|
-
reject(`Found no marker after ${loops} loops 😵`);
|
|
345
|
+
reject(new Error(`Found no marker after ${loops} loops 😵`));
|
|
343
346
|
return;
|
|
344
347
|
}
|
|
345
348
|
if (dataView.getUint8(offset) !== 0xff) {
|
|
346
|
-
reject(`Not a valid marker at offset 0x${offset.toString(16)}, found: 0x${dataView.getUint8(offset).toString(16)}`);
|
|
349
|
+
reject(new Error(`Not a valid marker at offset 0x${offset.toString(16)}, found: 0x${dataView.getUint8(offset).toString(16)}`));
|
|
347
350
|
return;
|
|
348
351
|
}
|
|
349
352
|
marker = dataView.getUint8(offset + 1);
|
|
@@ -383,18 +386,18 @@ class MPFExtractor {
|
|
|
383
386
|
bigEnd = true;
|
|
384
387
|
}
|
|
385
388
|
else {
|
|
386
|
-
reject('No valid endianness marker found in TIFF header');
|
|
389
|
+
reject(new Error('No valid endianness marker found in TIFF header'));
|
|
387
390
|
return;
|
|
388
391
|
}
|
|
389
392
|
if (dataView.getUint16(tiffOffset + 2, !bigEnd) !== 0x002a) {
|
|
390
|
-
reject('Not valid TIFF data! (no 0x002A marker)');
|
|
393
|
+
reject(new Error('Not valid TIFF data! (no 0x002A marker)'));
|
|
391
394
|
return;
|
|
392
395
|
}
|
|
393
396
|
// 32 bit number stating the offset from the start of the 8 Byte MP Header
|
|
394
397
|
// to MP Index IFD Least possible value is thus 8 (means 0 offset)
|
|
395
398
|
const firstIFDOffset = dataView.getUint32(tiffOffset + 4, !bigEnd);
|
|
396
399
|
if (firstIFDOffset < 0x00000008) {
|
|
397
|
-
reject('Not valid TIFF data! (First offset less than 8)');
|
|
400
|
+
reject(new Error('Not valid TIFF data! (First offset less than 8)'));
|
|
398
401
|
return;
|
|
399
402
|
}
|
|
400
403
|
// Move ahead to MP Index IFD
|
|
@@ -524,7 +527,8 @@ class LoaderBase extends Loader {
|
|
|
524
527
|
*/
|
|
525
528
|
constructor(renderer, manager) {
|
|
526
529
|
super(manager);
|
|
527
|
-
this.
|
|
530
|
+
this._renderer = renderer;
|
|
531
|
+
this._internalLoadingManager = new LoadingManager();
|
|
528
532
|
}
|
|
529
533
|
/**
|
|
530
534
|
* @private
|
|
@@ -544,7 +548,7 @@ class LoaderBase extends Loader {
|
|
|
544
548
|
gainMap: new Texture(),
|
|
545
549
|
sdr: new Texture()
|
|
546
550
|
});
|
|
547
|
-
return new QuadRenderer(16, 16, HalfFloatType,
|
|
551
|
+
return new QuadRenderer(16, 16, HalfFloatType, LinearSRGBColorSpace, material, this._renderer);
|
|
548
552
|
}
|
|
549
553
|
/**
|
|
550
554
|
*
|
|
@@ -577,7 +581,7 @@ class LoaderBase extends Loader {
|
|
|
577
581
|
gainMapImage = res[0];
|
|
578
582
|
sdrImage = res[1];
|
|
579
583
|
}
|
|
580
|
-
const gainMap = new Texture(gainMapImage, UVMapping, ClampToEdgeWrapping, ClampToEdgeWrapping, LinearFilter, LinearMipMapLinearFilter, RGBAFormat, UnsignedByteType, 1,
|
|
584
|
+
const gainMap = new Texture(gainMapImage, UVMapping, ClampToEdgeWrapping, ClampToEdgeWrapping, LinearFilter, LinearMipMapLinearFilter, RGBAFormat, UnsignedByteType, 1, LinearSRGBColorSpace);
|
|
581
585
|
gainMap.flipY = needsFlip;
|
|
582
586
|
gainMap.needsUpdate = true;
|
|
583
587
|
const sdr = new Texture(sdrImage, UVMapping, ClampToEdgeWrapping, ClampToEdgeWrapping, LinearFilter, LinearMipMapLinearFilter, RGBAFormat, UnsignedByteType, 1, SRGBColorSpace);
|
|
@@ -669,6 +673,9 @@ class GainMapLoader extends LoaderBase {
|
|
|
669
673
|
await this.render(quadRenderer, gainMap, sdr, metadata);
|
|
670
674
|
if (typeof onLoad === 'function')
|
|
671
675
|
onLoad(quadRenderer);
|
|
676
|
+
this.manager.itemEnd(sdrUrl);
|
|
677
|
+
this.manager.itemEnd(gainMapUrl);
|
|
678
|
+
this.manager.itemEnd(metadataUrl);
|
|
672
679
|
quadRenderer.dispose();
|
|
673
680
|
}
|
|
674
681
|
};
|
|
@@ -689,7 +696,10 @@ class GainMapLoader extends LoaderBase {
|
|
|
689
696
|
onProgress(new ProgressEvent('progress', { lengthComputable, loaded, total }));
|
|
690
697
|
}
|
|
691
698
|
};
|
|
692
|
-
|
|
699
|
+
this.manager.itemStart(sdrUrl);
|
|
700
|
+
this.manager.itemStart(gainMapUrl);
|
|
701
|
+
this.manager.itemStart(metadataUrl);
|
|
702
|
+
const sdrLoader = new FileLoader(this._internalLoadingManager);
|
|
693
703
|
sdrLoader.setResponseType('arraybuffer');
|
|
694
704
|
sdrLoader.setRequestHeader(this.requestHeader);
|
|
695
705
|
sdrLoader.setPath(this.path);
|
|
@@ -704,8 +714,12 @@ class GainMapLoader extends LoaderBase {
|
|
|
704
714
|
sdrLoaded = e.loaded;
|
|
705
715
|
sdrTotal = e.total;
|
|
706
716
|
progressHandler();
|
|
707
|
-
},
|
|
708
|
-
|
|
717
|
+
}, (error) => {
|
|
718
|
+
this.manager.itemError(sdrUrl);
|
|
719
|
+
if (typeof onError === 'function')
|
|
720
|
+
onError(error);
|
|
721
|
+
});
|
|
722
|
+
const gainMapLoader = new FileLoader(this._internalLoadingManager);
|
|
709
723
|
gainMapLoader.setResponseType('arraybuffer');
|
|
710
724
|
gainMapLoader.setRequestHeader(this.requestHeader);
|
|
711
725
|
gainMapLoader.setPath(this.path);
|
|
@@ -720,8 +734,12 @@ class GainMapLoader extends LoaderBase {
|
|
|
720
734
|
gainMapLoaded = e.loaded;
|
|
721
735
|
gainMapTotal = e.total;
|
|
722
736
|
progressHandler();
|
|
723
|
-
},
|
|
724
|
-
|
|
737
|
+
}, (error) => {
|
|
738
|
+
this.manager.itemError(gainMapUrl);
|
|
739
|
+
if (typeof onError === 'function')
|
|
740
|
+
onError(error);
|
|
741
|
+
});
|
|
742
|
+
const metadataLoader = new FileLoader(this._internalLoadingManager);
|
|
725
743
|
// metadataLoader.setResponseType('json')
|
|
726
744
|
metadataLoader.setRequestHeader(this.requestHeader);
|
|
727
745
|
metadataLoader.setPath(this.path);
|
|
@@ -738,7 +756,11 @@ class GainMapLoader extends LoaderBase {
|
|
|
738
756
|
metadataLoaded = e.loaded;
|
|
739
757
|
metadataTotal = e.total;
|
|
740
758
|
progressHandler();
|
|
741
|
-
},
|
|
759
|
+
}, (error) => {
|
|
760
|
+
this.manager.itemError(metadataUrl);
|
|
761
|
+
if (typeof onError === 'function')
|
|
762
|
+
onError(error);
|
|
763
|
+
});
|
|
742
764
|
return quadRenderer;
|
|
743
765
|
}
|
|
744
766
|
}
|
|
@@ -800,11 +822,12 @@ class HDRJPGLoader extends LoaderBase {
|
|
|
800
822
|
*/
|
|
801
823
|
load(url, onLoad, onProgress, onError) {
|
|
802
824
|
const quadRenderer = this.prepareQuadRenderer();
|
|
803
|
-
const loader = new FileLoader(this.
|
|
825
|
+
const loader = new FileLoader(this._internalLoadingManager);
|
|
804
826
|
loader.setResponseType('arraybuffer');
|
|
805
827
|
loader.setRequestHeader(this.requestHeader);
|
|
806
828
|
loader.setPath(this.path);
|
|
807
829
|
loader.setWithCredentials(this.withCredentials);
|
|
830
|
+
this.manager.itemStart(url);
|
|
808
831
|
loader.load(url, async (jpeg) => {
|
|
809
832
|
if (typeof jpeg === 'string')
|
|
810
833
|
throw new Error('Invalid buffer');
|
|
@@ -812,8 +835,13 @@ class HDRJPGLoader extends LoaderBase {
|
|
|
812
835
|
await this.render(quadRenderer, gainMapJPEG, sdrJPEG, metadata);
|
|
813
836
|
if (typeof onLoad === 'function')
|
|
814
837
|
onLoad(quadRenderer);
|
|
838
|
+
this.manager.itemEnd(url);
|
|
815
839
|
quadRenderer.dispose();
|
|
816
|
-
}, onProgress,
|
|
840
|
+
}, onProgress, (error) => {
|
|
841
|
+
this.manager.itemError(url);
|
|
842
|
+
if (typeof onError === 'function')
|
|
843
|
+
onError(error);
|
|
844
|
+
});
|
|
817
845
|
return quadRenderer;
|
|
818
846
|
}
|
|
819
847
|
}
|
package/dist/decode.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v2.0.
|
|
2
|
+
* @monogrid/gainmap-js v2.0.5
|
|
3
3
|
* With ❤️, by MONOGRID <hello@mono-grid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
return _canReadPixelsResult;
|
|
56
56
|
const testRT = new three.WebGLRenderTarget(1, 1, {
|
|
57
57
|
type,
|
|
58
|
-
colorSpace: three.
|
|
58
|
+
colorSpace: three.LinearSRGBColorSpace,
|
|
59
59
|
format: three.RGBAFormat,
|
|
60
60
|
magFilter: three.LinearFilter,
|
|
61
61
|
minFilter: three.LinearFilter,
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
return out;
|
|
187
187
|
}
|
|
188
188
|
toDataTexture() {
|
|
189
|
-
return new three.DataTexture(this.toArray(), this.width, this.height, three.RGBAFormat, this._type, three.UVMapping, three.RepeatWrapping, three.RepeatWrapping, three.LinearFilter, three.LinearMipMapLinearFilter, 1, three.
|
|
189
|
+
return new three.DataTexture(this.toArray(), this.width, this.height, three.RGBAFormat, this._type, three.UVMapping, three.RepeatWrapping, three.RepeatWrapping, three.LinearFilter, three.LinearMipMapLinearFilter, 1, three.LinearSRGBColorSpace);
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
192
192
|
* If using a disposable renderer, it will dispose it.
|
|
@@ -441,16 +441,19 @@ void main() {
|
|
|
441
441
|
sdr.colorSpace = three.SRGBColorSpace;
|
|
442
442
|
}
|
|
443
443
|
sdr.needsUpdate = true;
|
|
444
|
-
if (gainMap.colorSpace !== three.
|
|
445
|
-
console.warn('Gainmap Colorspace needs to be *
|
|
446
|
-
gainMap.colorSpace = three.
|
|
444
|
+
if (gainMap.colorSpace !== three.LinearSRGBColorSpace) {
|
|
445
|
+
console.warn('Gainmap Colorspace needs to be *LinearSRGBColorSpace*');
|
|
446
|
+
gainMap.colorSpace = three.LinearSRGBColorSpace;
|
|
447
447
|
}
|
|
448
448
|
gainMap.needsUpdate = true;
|
|
449
|
-
const material = new GainMapDecoderMaterial(
|
|
450
|
-
|
|
449
|
+
const material = new GainMapDecoderMaterial({
|
|
450
|
+
...params,
|
|
451
|
+
sdr,
|
|
452
|
+
gainMap
|
|
453
|
+
});
|
|
451
454
|
// TODO: three types are generic, eslint complains here, see how we can solve
|
|
452
455
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
|
|
453
|
-
const quadRenderer = new QuadRenderer(sdr.image.width, sdr.image.height, three.HalfFloatType, three.
|
|
456
|
+
const quadRenderer = new QuadRenderer(sdr.image.width, sdr.image.height, three.HalfFloatType, three.LinearSRGBColorSpace, material, renderer);
|
|
454
457
|
try {
|
|
455
458
|
quadRenderer.render();
|
|
456
459
|
}
|
|
@@ -563,7 +566,7 @@ void main() {
|
|
|
563
566
|
// If you're executing this line on a big endian machine, it'll be reversed.
|
|
564
567
|
// bigEnd further down though, refers to the endianness of the image itself.
|
|
565
568
|
if (dataView.getUint16(0) !== 0xffd8) {
|
|
566
|
-
reject('Not a valid jpeg');
|
|
569
|
+
reject(new Error('Not a valid jpeg'));
|
|
567
570
|
return;
|
|
568
571
|
}
|
|
569
572
|
const length = dataView.byteLength;
|
|
@@ -572,11 +575,11 @@ void main() {
|
|
|
572
575
|
let marker; // APP# marker
|
|
573
576
|
while (offset < length) {
|
|
574
577
|
if (++loops > 250) {
|
|
575
|
-
reject(`Found no marker after ${loops} loops 😵`);
|
|
578
|
+
reject(new Error(`Found no marker after ${loops} loops 😵`));
|
|
576
579
|
return;
|
|
577
580
|
}
|
|
578
581
|
if (dataView.getUint8(offset) !== 0xff) {
|
|
579
|
-
reject(`Not a valid marker at offset 0x${offset.toString(16)}, found: 0x${dataView.getUint8(offset).toString(16)}`);
|
|
582
|
+
reject(new Error(`Not a valid marker at offset 0x${offset.toString(16)}, found: 0x${dataView.getUint8(offset).toString(16)}`));
|
|
580
583
|
return;
|
|
581
584
|
}
|
|
582
585
|
marker = dataView.getUint8(offset + 1);
|
|
@@ -616,18 +619,18 @@ void main() {
|
|
|
616
619
|
bigEnd = true;
|
|
617
620
|
}
|
|
618
621
|
else {
|
|
619
|
-
reject('No valid endianness marker found in TIFF header');
|
|
622
|
+
reject(new Error('No valid endianness marker found in TIFF header'));
|
|
620
623
|
return;
|
|
621
624
|
}
|
|
622
625
|
if (dataView.getUint16(tiffOffset + 2, !bigEnd) !== 0x002a) {
|
|
623
|
-
reject('Not valid TIFF data! (no 0x002A marker)');
|
|
626
|
+
reject(new Error('Not valid TIFF data! (no 0x002A marker)'));
|
|
624
627
|
return;
|
|
625
628
|
}
|
|
626
629
|
// 32 bit number stating the offset from the start of the 8 Byte MP Header
|
|
627
630
|
// to MP Index IFD Least possible value is thus 8 (means 0 offset)
|
|
628
631
|
const firstIFDOffset = dataView.getUint32(tiffOffset + 4, !bigEnd);
|
|
629
632
|
if (firstIFDOffset < 0x00000008) {
|
|
630
|
-
reject('Not valid TIFF data! (First offset less than 8)');
|
|
633
|
+
reject(new Error('Not valid TIFF data! (First offset less than 8)'));
|
|
631
634
|
return;
|
|
632
635
|
}
|
|
633
636
|
// Move ahead to MP Index IFD
|
|
@@ -757,7 +760,8 @@ void main() {
|
|
|
757
760
|
*/
|
|
758
761
|
constructor(renderer, manager) {
|
|
759
762
|
super(manager);
|
|
760
|
-
this.
|
|
763
|
+
this._renderer = renderer;
|
|
764
|
+
this._internalLoadingManager = new three.LoadingManager();
|
|
761
765
|
}
|
|
762
766
|
/**
|
|
763
767
|
* @private
|
|
@@ -777,7 +781,7 @@ void main() {
|
|
|
777
781
|
gainMap: new three.Texture(),
|
|
778
782
|
sdr: new three.Texture()
|
|
779
783
|
});
|
|
780
|
-
return new QuadRenderer(16, 16, three.HalfFloatType, three.
|
|
784
|
+
return new QuadRenderer(16, 16, three.HalfFloatType, three.LinearSRGBColorSpace, material, this._renderer);
|
|
781
785
|
}
|
|
782
786
|
/**
|
|
783
787
|
*
|
|
@@ -810,7 +814,7 @@ void main() {
|
|
|
810
814
|
gainMapImage = res[0];
|
|
811
815
|
sdrImage = res[1];
|
|
812
816
|
}
|
|
813
|
-
const gainMap = new three.Texture(gainMapImage, three.UVMapping, three.ClampToEdgeWrapping, three.ClampToEdgeWrapping, three.LinearFilter, three.LinearMipMapLinearFilter, three.RGBAFormat, three.UnsignedByteType, 1, three.
|
|
817
|
+
const gainMap = new three.Texture(gainMapImage, three.UVMapping, three.ClampToEdgeWrapping, three.ClampToEdgeWrapping, three.LinearFilter, three.LinearMipMapLinearFilter, three.RGBAFormat, three.UnsignedByteType, 1, three.LinearSRGBColorSpace);
|
|
814
818
|
gainMap.flipY = needsFlip;
|
|
815
819
|
gainMap.needsUpdate = true;
|
|
816
820
|
const sdr = new three.Texture(sdrImage, three.UVMapping, three.ClampToEdgeWrapping, three.ClampToEdgeWrapping, three.LinearFilter, three.LinearMipMapLinearFilter, three.RGBAFormat, three.UnsignedByteType, 1, three.SRGBColorSpace);
|
|
@@ -902,6 +906,9 @@ void main() {
|
|
|
902
906
|
await this.render(quadRenderer, gainMap, sdr, metadata);
|
|
903
907
|
if (typeof onLoad === 'function')
|
|
904
908
|
onLoad(quadRenderer);
|
|
909
|
+
this.manager.itemEnd(sdrUrl);
|
|
910
|
+
this.manager.itemEnd(gainMapUrl);
|
|
911
|
+
this.manager.itemEnd(metadataUrl);
|
|
905
912
|
quadRenderer.dispose();
|
|
906
913
|
}
|
|
907
914
|
};
|
|
@@ -922,7 +929,10 @@ void main() {
|
|
|
922
929
|
onProgress(new ProgressEvent('progress', { lengthComputable, loaded, total }));
|
|
923
930
|
}
|
|
924
931
|
};
|
|
925
|
-
|
|
932
|
+
this.manager.itemStart(sdrUrl);
|
|
933
|
+
this.manager.itemStart(gainMapUrl);
|
|
934
|
+
this.manager.itemStart(metadataUrl);
|
|
935
|
+
const sdrLoader = new three.FileLoader(this._internalLoadingManager);
|
|
926
936
|
sdrLoader.setResponseType('arraybuffer');
|
|
927
937
|
sdrLoader.setRequestHeader(this.requestHeader);
|
|
928
938
|
sdrLoader.setPath(this.path);
|
|
@@ -937,8 +947,12 @@ void main() {
|
|
|
937
947
|
sdrLoaded = e.loaded;
|
|
938
948
|
sdrTotal = e.total;
|
|
939
949
|
progressHandler();
|
|
940
|
-
},
|
|
941
|
-
|
|
950
|
+
}, (error) => {
|
|
951
|
+
this.manager.itemError(sdrUrl);
|
|
952
|
+
if (typeof onError === 'function')
|
|
953
|
+
onError(error);
|
|
954
|
+
});
|
|
955
|
+
const gainMapLoader = new three.FileLoader(this._internalLoadingManager);
|
|
942
956
|
gainMapLoader.setResponseType('arraybuffer');
|
|
943
957
|
gainMapLoader.setRequestHeader(this.requestHeader);
|
|
944
958
|
gainMapLoader.setPath(this.path);
|
|
@@ -953,8 +967,12 @@ void main() {
|
|
|
953
967
|
gainMapLoaded = e.loaded;
|
|
954
968
|
gainMapTotal = e.total;
|
|
955
969
|
progressHandler();
|
|
956
|
-
},
|
|
957
|
-
|
|
970
|
+
}, (error) => {
|
|
971
|
+
this.manager.itemError(gainMapUrl);
|
|
972
|
+
if (typeof onError === 'function')
|
|
973
|
+
onError(error);
|
|
974
|
+
});
|
|
975
|
+
const metadataLoader = new three.FileLoader(this._internalLoadingManager);
|
|
958
976
|
// metadataLoader.setResponseType('json')
|
|
959
977
|
metadataLoader.setRequestHeader(this.requestHeader);
|
|
960
978
|
metadataLoader.setPath(this.path);
|
|
@@ -971,7 +989,11 @@ void main() {
|
|
|
971
989
|
metadataLoaded = e.loaded;
|
|
972
990
|
metadataTotal = e.total;
|
|
973
991
|
progressHandler();
|
|
974
|
-
},
|
|
992
|
+
}, (error) => {
|
|
993
|
+
this.manager.itemError(metadataUrl);
|
|
994
|
+
if (typeof onError === 'function')
|
|
995
|
+
onError(error);
|
|
996
|
+
});
|
|
975
997
|
return quadRenderer;
|
|
976
998
|
}
|
|
977
999
|
}
|
|
@@ -1033,11 +1055,12 @@ void main() {
|
|
|
1033
1055
|
*/
|
|
1034
1056
|
load(url, onLoad, onProgress, onError) {
|
|
1035
1057
|
const quadRenderer = this.prepareQuadRenderer();
|
|
1036
|
-
const loader = new three.FileLoader(this.
|
|
1058
|
+
const loader = new three.FileLoader(this._internalLoadingManager);
|
|
1037
1059
|
loader.setResponseType('arraybuffer');
|
|
1038
1060
|
loader.setRequestHeader(this.requestHeader);
|
|
1039
1061
|
loader.setPath(this.path);
|
|
1040
1062
|
loader.setWithCredentials(this.withCredentials);
|
|
1063
|
+
this.manager.itemStart(url);
|
|
1041
1064
|
loader.load(url, async (jpeg) => {
|
|
1042
1065
|
if (typeof jpeg === 'string')
|
|
1043
1066
|
throw new Error('Invalid buffer');
|
|
@@ -1045,8 +1068,13 @@ void main() {
|
|
|
1045
1068
|
await this.render(quadRenderer, gainMapJPEG, sdrJPEG, metadata);
|
|
1046
1069
|
if (typeof onLoad === 'function')
|
|
1047
1070
|
onLoad(quadRenderer);
|
|
1071
|
+
this.manager.itemEnd(url);
|
|
1048
1072
|
quadRenderer.dispose();
|
|
1049
|
-
}, onProgress,
|
|
1073
|
+
}, onProgress, (error) => {
|
|
1074
|
+
this.manager.itemError(url);
|
|
1075
|
+
if (typeof onError === 'function')
|
|
1076
|
+
onError(error);
|
|
1077
|
+
});
|
|
1050
1078
|
return quadRenderer;
|
|
1051
1079
|
}
|
|
1052
1080
|
}
|
package/dist/encode.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v2.0.
|
|
2
|
+
* @monogrid/gainmap-js v2.0.5
|
|
3
3
|
* With ❤️, by MONOGRID <hello@mono-grid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { c as compress } from './compress-
|
|
7
|
-
import { DataTexture, RGBAFormat, UVMapping, RepeatWrapping, LinearFilter,
|
|
8
|
-
import { Q as QuadRenderer } from './QuadRenderer-
|
|
6
|
+
import { c as compress } from './compress-_4jEQonS.js';
|
|
7
|
+
import { DataTexture, RGBAFormat, UVMapping, RepeatWrapping, LinearFilter, LinearSRGBColorSpace, ShaderMaterial, Vector3, NoBlending, UnsignedByteType, ACESFilmicToneMapping, LinearToneMapping, CineonToneMapping, ReinhardToneMapping, SRGBColorSpace, Vector2, WebGLRenderTarget, NearestFilter, ClampToEdgeWrapping, FloatType, DataUtils } from 'three';
|
|
8
|
+
import { Q as QuadRenderer } from './QuadRenderer-gqnZPNP-.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Utility function to obtain a `DataTexture` from various input formats
|
|
@@ -25,7 +25,7 @@ const getDataTexture = (image) => {
|
|
|
25
25
|
dataTexture = image;
|
|
26
26
|
}
|
|
27
27
|
else {
|
|
28
|
-
dataTexture = new DataTexture(image.data, image.width, image.height, 'format' in image ? image.format : RGBAFormat, image.type, UVMapping, RepeatWrapping, RepeatWrapping, LinearFilter, LinearFilter, 1, 'colorSpace' in image && image.colorSpace === 'srgb' ? image.colorSpace :
|
|
28
|
+
dataTexture = new DataTexture(image.data, image.width, image.height, 'format' in image ? image.format : RGBAFormat, image.type, UVMapping, RepeatWrapping, RepeatWrapping, LinearFilter, LinearFilter, 1, 'colorSpace' in image && image.colorSpace === 'srgb' ? image.colorSpace : LinearSRGBColorSpace);
|
|
29
29
|
// TODO: This tries to detect a raw RGBE and applies flipY
|
|
30
30
|
// see if there's a better way to detect it?
|
|
31
31
|
if ('header' in image && 'gamma' in image) {
|
|
@@ -190,8 +190,12 @@ class GainMapEncoderMaterial extends ShaderMaterial {
|
|
|
190
190
|
const getGainMap = (params) => {
|
|
191
191
|
const { image, sdr, renderer } = params;
|
|
192
192
|
const dataTexture = getDataTexture(image);
|
|
193
|
-
const material = new GainMapEncoderMaterial(
|
|
194
|
-
|
|
193
|
+
const material = new GainMapEncoderMaterial({
|
|
194
|
+
...params,
|
|
195
|
+
sdr: sdr.renderTarget.texture,
|
|
196
|
+
hdr: dataTexture
|
|
197
|
+
});
|
|
198
|
+
const quadRenderer = new QuadRenderer(dataTexture.image.width, dataTexture.image.height, UnsignedByteType, LinearSRGBColorSpace, material, renderer);
|
|
195
199
|
try {
|
|
196
200
|
quadRenderer.render();
|
|
197
201
|
}
|
|
@@ -483,8 +487,12 @@ const encode = (params) => {
|
|
|
483
487
|
const { image, renderer } = params;
|
|
484
488
|
const dataTexture = getDataTexture(image);
|
|
485
489
|
const sdr = getSDRRendition(dataTexture, renderer, params.toneMapping);
|
|
486
|
-
const gainMapRenderer = getGainMap(
|
|
487
|
-
|
|
490
|
+
const gainMapRenderer = getGainMap({
|
|
491
|
+
...params,
|
|
492
|
+
image: dataTexture,
|
|
493
|
+
sdr,
|
|
494
|
+
renderer: sdr.renderer // reuse the same (maybe disposable?) renderer
|
|
495
|
+
});
|
|
488
496
|
return {
|
|
489
497
|
sdr,
|
|
490
498
|
gainMap: gainMapRenderer,
|
|
@@ -596,8 +604,14 @@ const encodeAndCompress = async (params) => {
|
|
|
596
604
|
}
|
|
597
605
|
encodingResult.sdr.dispose();
|
|
598
606
|
encodingResult.gainMap.dispose();
|
|
599
|
-
return
|
|
600
|
-
|
|
607
|
+
return {
|
|
608
|
+
...encodingResult,
|
|
609
|
+
...encodingResult.getMetadata(),
|
|
610
|
+
sdr: compressResult[0],
|
|
611
|
+
gainMap: compressResult[1],
|
|
612
|
+
rawSDR,
|
|
613
|
+
rawGainMap
|
|
614
|
+
};
|
|
601
615
|
};
|
|
602
616
|
|
|
603
617
|
const vertexShader = /* glsl */ `
|
package/dist/encode.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v2.0.
|
|
2
|
+
* @monogrid/gainmap-js v2.0.5
|
|
3
3
|
* With ❤️, by MONOGRID <hello@mono-grid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
if (res)
|
|
28
28
|
resolve(res);
|
|
29
29
|
else
|
|
30
|
-
reject('Failed to convert canvas to blob');
|
|
30
|
+
reject(new Error('Failed to convert canvas to blob'));
|
|
31
31
|
}, mimeType, quality || 0.9);
|
|
32
32
|
});
|
|
33
33
|
};
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
dataTexture = image;
|
|
104
104
|
}
|
|
105
105
|
else {
|
|
106
|
-
dataTexture = new three.DataTexture(image.data, image.width, image.height, 'format' in image ? image.format : three.RGBAFormat, image.type, three.UVMapping, three.RepeatWrapping, three.RepeatWrapping, three.LinearFilter, three.LinearFilter, 1, 'colorSpace' in image && image.colorSpace === 'srgb' ? image.colorSpace : three.
|
|
106
|
+
dataTexture = new three.DataTexture(image.data, image.width, image.height, 'format' in image ? image.format : three.RGBAFormat, image.type, three.UVMapping, three.RepeatWrapping, three.RepeatWrapping, three.LinearFilter, three.LinearFilter, 1, 'colorSpace' in image && image.colorSpace === 'srgb' ? image.colorSpace : three.LinearSRGBColorSpace);
|
|
107
107
|
// TODO: This tries to detect a raw RGBE and applies flipY
|
|
108
108
|
// see if there's a better way to detect it?
|
|
109
109
|
if ('header' in image && 'gamma' in image) {
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
return _canReadPixelsResult;
|
|
161
161
|
const testRT = new three.WebGLRenderTarget(1, 1, {
|
|
162
162
|
type,
|
|
163
|
-
colorSpace: three.
|
|
163
|
+
colorSpace: three.LinearSRGBColorSpace,
|
|
164
164
|
format: three.RGBAFormat,
|
|
165
165
|
magFilter: three.LinearFilter,
|
|
166
166
|
minFilter: three.LinearFilter,
|
|
@@ -291,7 +291,7 @@
|
|
|
291
291
|
return out;
|
|
292
292
|
}
|
|
293
293
|
toDataTexture() {
|
|
294
|
-
return new three.DataTexture(this.toArray(), this.width, this.height, three.RGBAFormat, this._type, three.UVMapping, three.RepeatWrapping, three.RepeatWrapping, three.LinearFilter, three.LinearMipMapLinearFilter, 1, three.
|
|
294
|
+
return new three.DataTexture(this.toArray(), this.width, this.height, three.RGBAFormat, this._type, three.UVMapping, three.RepeatWrapping, three.RepeatWrapping, three.LinearFilter, three.LinearMipMapLinearFilter, 1, three.LinearSRGBColorSpace);
|
|
295
295
|
}
|
|
296
296
|
/**
|
|
297
297
|
* If using a disposable renderer, it will dispose it.
|
|
@@ -498,8 +498,12 @@ void main() {
|
|
|
498
498
|
const getGainMap = (params) => {
|
|
499
499
|
const { image, sdr, renderer } = params;
|
|
500
500
|
const dataTexture = getDataTexture(image);
|
|
501
|
-
const material = new GainMapEncoderMaterial(
|
|
502
|
-
|
|
501
|
+
const material = new GainMapEncoderMaterial({
|
|
502
|
+
...params,
|
|
503
|
+
sdr: sdr.renderTarget.texture,
|
|
504
|
+
hdr: dataTexture
|
|
505
|
+
});
|
|
506
|
+
const quadRenderer = new QuadRenderer(dataTexture.image.width, dataTexture.image.height, three.UnsignedByteType, three.LinearSRGBColorSpace, material, renderer);
|
|
503
507
|
try {
|
|
504
508
|
quadRenderer.render();
|
|
505
509
|
}
|
|
@@ -791,8 +795,12 @@ void main() {
|
|
|
791
795
|
const { image, renderer } = params;
|
|
792
796
|
const dataTexture = getDataTexture(image);
|
|
793
797
|
const sdr = getSDRRendition(dataTexture, renderer, params.toneMapping);
|
|
794
|
-
const gainMapRenderer = getGainMap(
|
|
795
|
-
|
|
798
|
+
const gainMapRenderer = getGainMap({
|
|
799
|
+
...params,
|
|
800
|
+
image: dataTexture,
|
|
801
|
+
sdr,
|
|
802
|
+
renderer: sdr.renderer // reuse the same (maybe disposable?) renderer
|
|
803
|
+
});
|
|
796
804
|
return {
|
|
797
805
|
sdr,
|
|
798
806
|
gainMap: gainMapRenderer,
|
|
@@ -904,8 +912,14 @@ void main() {
|
|
|
904
912
|
}
|
|
905
913
|
encodingResult.sdr.dispose();
|
|
906
914
|
encodingResult.gainMap.dispose();
|
|
907
|
-
return
|
|
908
|
-
|
|
915
|
+
return {
|
|
916
|
+
...encodingResult,
|
|
917
|
+
...encodingResult.getMetadata(),
|
|
918
|
+
sdr: compressResult[0],
|
|
919
|
+
gainMap: compressResult[1],
|
|
920
|
+
rawSDR,
|
|
921
|
+
rawGainMap
|
|
922
|
+
};
|
|
909
923
|
};
|
|
910
924
|
|
|
911
925
|
const vertexShader = /* glsl */ `
|
package/dist/libultrahdr.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v2.0.
|
|
2
|
+
* @monogrid/gainmap-js v2.0.5
|
|
3
3
|
* With ❤️, by MONOGRID <hello@mono-grid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -6627,11 +6627,13 @@ const decodeJPEGMetadata = async (file) => {
|
|
|
6627
6627
|
hdrCapacityMin: parseFloat(hdrCapacityMin),
|
|
6628
6628
|
hdrCapacityMax: parseFloat(hdrCapacityMax)
|
|
6629
6629
|
};
|
|
6630
|
-
return
|
|
6630
|
+
return {
|
|
6631
|
+
...result,
|
|
6631
6632
|
/**
|
|
6632
6633
|
* Parsed metadata
|
|
6633
6634
|
*/
|
|
6634
|
-
parsedMetadata
|
|
6635
|
+
parsedMetadata
|
|
6636
|
+
};
|
|
6635
6637
|
};
|
|
6636
6638
|
|
|
6637
6639
|
/**
|
package/dist/libultrahdr.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v2.0.
|
|
2
|
+
* @monogrid/gainmap-js v2.0.5
|
|
3
3
|
* With ❤️, by MONOGRID <hello@mono-grid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -6634,11 +6634,13 @@
|
|
|
6634
6634
|
hdrCapacityMin: parseFloat(hdrCapacityMin),
|
|
6635
6635
|
hdrCapacityMax: parseFloat(hdrCapacityMax)
|
|
6636
6636
|
};
|
|
6637
|
-
return
|
|
6637
|
+
return {
|
|
6638
|
+
...result,
|
|
6638
6639
|
/**
|
|
6639
6640
|
* Parsed metadata
|
|
6640
6641
|
*/
|
|
6641
|
-
parsedMetadata
|
|
6642
|
+
parsedMetadata
|
|
6643
|
+
};
|
|
6642
6644
|
};
|
|
6643
6645
|
|
|
6644
6646
|
/**
|
package/dist/worker-interface.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v2.0.
|
|
2
|
+
* @monogrid/gainmap-js v2.0.5
|
|
3
3
|
* With ❤️, by MONOGRID <hello@mono-grid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-
|
|
6
|
+
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './_commonjsHelpers-iRbo2TdN.js';
|
|
7
7
|
|
|
8
8
|
var lib$1;
|
|
9
9
|
var hasRequiredLib$1;
|
package/dist/worker.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v2.0.
|
|
2
|
+
* @monogrid/gainmap-js v2.0.5
|
|
3
3
|
* With ❤️, by MONOGRID <hello@mono-grid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { g as getDefaultExportFromCjs } from './_commonjsHelpers-
|
|
7
|
-
import { c as compress } from './compress-
|
|
6
|
+
import { g as getDefaultExportFromCjs } from './_commonjsHelpers-iRbo2TdN.js';
|
|
7
|
+
import { c as compress } from './compress-_4jEQonS.js';
|
|
8
8
|
|
|
9
9
|
var isPromise$2 = {exports: {}};
|
|
10
10
|
|
|
@@ -111,7 +111,10 @@ var registerPromiseWorker$1 = /*@__PURE__*/getDefaultExportFromCjs(register);
|
|
|
111
111
|
// @ts-expect-error untyped lib
|
|
112
112
|
const _compress = async (message, withTransferList) => {
|
|
113
113
|
const result = await compress(message.payload);
|
|
114
|
-
return withTransferList(
|
|
114
|
+
return withTransferList({
|
|
115
|
+
...result,
|
|
116
|
+
source: message.payload.source instanceof ImageData ? message.payload.source.data : new Uint8ClampedArray(message.payload.source)
|
|
117
|
+
}, [result.data.buffer, message.payload.source instanceof ImageData ? message.payload.source.data.buffer : message.payload.source.buffer]);
|
|
115
118
|
};
|
|
116
119
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
117
120
|
registerPromiseWorker$1(async (message, withTransferList) => {
|
package/dist/worker.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v2.0.
|
|
2
|
+
* @monogrid/gainmap-js v2.0.5
|
|
3
3
|
* With ❤️, by MONOGRID <hello@mono-grid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
if (res)
|
|
133
133
|
resolve(res);
|
|
134
134
|
else
|
|
135
|
-
reject('Failed to convert canvas to blob');
|
|
135
|
+
reject(new Error('Failed to convert canvas to blob'));
|
|
136
136
|
}, mimeType, quality || 0.9);
|
|
137
137
|
});
|
|
138
138
|
};
|
|
@@ -193,7 +193,10 @@
|
|
|
193
193
|
// @ts-expect-error untyped lib
|
|
194
194
|
const _compress = async (message, withTransferList) => {
|
|
195
195
|
const result = await compress(message.payload);
|
|
196
|
-
return withTransferList(
|
|
196
|
+
return withTransferList({
|
|
197
|
+
...result,
|
|
198
|
+
source: message.payload.source instanceof ImageData ? message.payload.source.data : new Uint8ClampedArray(message.payload.source)
|
|
199
|
+
}, [result.data.buffer, message.payload.source instanceof ImageData ? message.payload.source.data.buffer : message.payload.source.buffer]);
|
|
197
200
|
};
|
|
198
201
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
199
202
|
registerPromiseWorker$1(async (message, withTransferList) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monogrid/gainmap-js",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "A Javascript (TypeScript) Port of Adobe Gainmap Technology for storing HDR Images using an SDR Image + a gain map",
|
|
5
5
|
"homepage": "https://github.com/MONOGRID/gainmap-js#readme",
|
|
6
6
|
"repository": {
|
|
@@ -80,20 +80,20 @@
|
|
|
80
80
|
"test": "jest",
|
|
81
81
|
"pretest": "npm run build",
|
|
82
82
|
"check": "concurrently -c auto npm:check:*",
|
|
83
|
-
"check:typecheck-src": "tsc
|
|
83
|
+
"check:typecheck-src": "tsc -p src",
|
|
84
84
|
"check:eslint-src": "eslint \"src/**/*.ts\"",
|
|
85
|
-
"check:typecheck-examples": "tsc
|
|
86
|
-
"check:eslint-examples": "eslint \"examples/**/*.ts\"",
|
|
87
|
-
"check:typecheck-tests": "tsc
|
|
88
|
-
"check:eslint-tests": "eslint \"tests/**/*.ts\"",
|
|
85
|
+
"check:typecheck-examples": "tsc -p examples",
|
|
86
|
+
"check:eslint-examples": "eslint \"examples/**/*.{ts,html}\"",
|
|
87
|
+
"check:typecheck-tests": "tsc -p tests",
|
|
88
|
+
"check:eslint-tests": "eslint \"tests/**/*.{ts,html}\"",
|
|
89
89
|
"ci:test": "JEST_JUNIT_OUTPUT_DIR=reports jest --ci --reporters=default --reporters=jest-junit",
|
|
90
90
|
"ci:check": "concurrently npm:ci:check:*",
|
|
91
|
-
"ci:check:typecheck-src": "tsc --pretty false
|
|
91
|
+
"ci:check:typecheck-src": "tsc --pretty false > reports/typecheck.log",
|
|
92
92
|
"ci:check:eslint-src": "eslint --format json --output-file reports/eslint-src.json \"src/**/*.ts\"",
|
|
93
|
-
"ci:check:typecheck-examples": "tsc --pretty false
|
|
94
|
-
"ci:check:eslint-examples": "eslint --format json --output-file reports/eslint-examples.json \"examples/**/*.ts\"",
|
|
95
|
-
"ci:check:typecheck-tests": "tsc --pretty false
|
|
96
|
-
"ci:check:eslint-tests": "eslint --format json --output-file reports/eslint-tests.json \"tests/**/*.ts\""
|
|
93
|
+
"ci:check:typecheck-examples": "tsc --pretty false -p examples > reports/typecheck-examples.log",
|
|
94
|
+
"ci:check:eslint-examples": "eslint --format json --output-file reports/eslint-examples.json \"examples/**/*.{ts,html}\"",
|
|
95
|
+
"ci:check:typecheck-tests": "tsc --pretty false -p tests > reports/typecheck-tests.log",
|
|
96
|
+
"ci:check:eslint-tests": "eslint --format json --output-file reports/eslint-tests.json \"tests/**/*.{ts,html}\""
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"three": ">= 0.157.0 < 0.159.0"
|
|
@@ -116,14 +116,16 @@
|
|
|
116
116
|
"@types/jest": "^29.5.8",
|
|
117
117
|
"@types/node": "^20.9.0",
|
|
118
118
|
"@types/three": "^0.158.2",
|
|
119
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
120
|
-
"@typescript-eslint/parser": "^6.
|
|
119
|
+
"@typescript-eslint/eslint-plugin": "^6.11.0",
|
|
120
|
+
"@typescript-eslint/parser": "^6.11.0",
|
|
121
121
|
"babel-jest": "^29.7.0",
|
|
122
122
|
"concurrently": "^8.2.2",
|
|
123
123
|
"conventional-changelog-conventionalcommits": "^7.0.2",
|
|
124
124
|
"cz-conventional-changelog": "^3.3.0",
|
|
125
|
-
"eslint": "^8.
|
|
125
|
+
"eslint": "^8.54.0",
|
|
126
|
+
"eslint-config-mdcs": "^5.0.0",
|
|
126
127
|
"eslint-config-standard": "^17.0.0",
|
|
128
|
+
"eslint-plugin-compat": "^4.2.0",
|
|
127
129
|
"eslint-plugin-html": "^7.1.0",
|
|
128
130
|
"eslint-plugin-import": "^2.29.0",
|
|
129
131
|
"eslint-plugin-jest-extended": "^2.0.0",
|
|
@@ -136,16 +138,19 @@
|
|
|
136
138
|
"jest-environment-jsdom": "^29.7.0",
|
|
137
139
|
"jest-extended": "^4.0.2",
|
|
138
140
|
"jest-junit": "^16.0.0",
|
|
139
|
-
"puppeteer": "^21.5.
|
|
140
|
-
"rollup": "^4.
|
|
141
|
+
"puppeteer": "^21.5.2",
|
|
142
|
+
"rollup": "^4.5.0",
|
|
141
143
|
"rollup-plugin-copy": "^3.5.0",
|
|
142
144
|
"rollup-plugin-license": "^3.2.0",
|
|
143
|
-
"semantic-release": "^22.0.
|
|
145
|
+
"semantic-release": "^22.0.8",
|
|
144
146
|
"three": "^0.158.0",
|
|
145
147
|
"ts-jest": "^29.1.1",
|
|
146
148
|
"typedoc": "^0.25.3",
|
|
147
149
|
"typedoc-github-wiki-theme": "^1.1.0",
|
|
148
150
|
"typedoc-plugin-markdown": "^3.17.1",
|
|
149
151
|
"typescript": "^5.2.2"
|
|
150
|
-
}
|
|
152
|
+
},
|
|
153
|
+
"browserslist": [
|
|
154
|
+
"> 1%, not dead, not ie 11, not op_mini all"
|
|
155
|
+
]
|
|
151
156
|
}
|