@monogrid/gainmap-js 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +111 -133
  3. package/dist/{QuadRenderer-DPiEee1I.js → QuadRenderer-CXtNzoCY.js} +1 -1
  4. package/dist/{QuadRenderer-DIHDdKl6.js → QuadRenderer-DcBTBLz6.js} +1 -1
  5. package/dist/{_commonjsHelpers-S7tZmPW-.js → _commonjsHelpers-Cdw2adc2.js} +1 -1
  6. package/dist/{_commonjsHelpers-DVRbpukU.js → _commonjsHelpers-CnYhShyx.js} +1 -1
  7. package/dist/{compress-5gFn7Y4a.js → compress-C42bpk6O.js} +1 -1
  8. package/dist/{compress-CTBeaiI1.js → compress-CzMz2bpX.js} +1 -2
  9. package/dist/decode/shared/index.d.ts +1 -0
  10. package/dist/decode/shared/utils/create-textures.d.ts +26 -0
  11. package/dist/decode/shared/utils/warn-deprecated.d.ts +8 -0
  12. package/dist/decode/webgl/decode.d.ts +1 -0
  13. package/dist/decode/webgl/index.d.ts +4 -0
  14. package/dist/decode/webgl/loaders/GainMapLoader.d.ts +3 -1
  15. package/dist/decode/webgl/loaders/HDRJPGLoader.d.ts +3 -1
  16. package/dist/decode/webgl/materials/GainMapDecoderMaterial.d.ts +1 -0
  17. package/dist/decode/webgpu/core/QuadRenderer.d.ts +1 -0
  18. package/dist/decode/webgpu/decode.d.ts +1 -0
  19. package/dist/decode/webgpu/index.d.ts +7 -0
  20. package/dist/decode/webgpu/loaders/GainMapLoader.d.ts +3 -1
  21. package/dist/decode/webgpu/loaders/GainMapNodeLoader.d.ts +42 -0
  22. package/dist/decode/webgpu/loaders/HDRJPGLoader.d.ts +3 -1
  23. package/dist/decode/webgpu/loaders/HDRJPGNodeLoader.d.ts +41 -0
  24. package/dist/decode/webgpu/loaders/LoaderBaseNode.d.ts +24 -0
  25. package/dist/decode/webgpu/materials/GainMapDecoderMaterial.d.ts +1 -0
  26. package/dist/decode/webgpu/nodes/GainMapNode.d.ts +137 -0
  27. package/dist/decode.js +18 -5
  28. package/dist/decode.min.js +2 -2
  29. package/dist/decode.umd.cjs +86 -32
  30. package/dist/decode.umd.min.cjs +2 -2
  31. package/dist/decode.webgpu.js +453 -9
  32. package/dist/decode.webgpu.min.js +2 -2
  33. package/dist/decode.webgpu.umd.cjs +523 -34
  34. package/dist/decode.webgpu.umd.min.cjs +2 -2
  35. package/dist/encode.js +3 -3
  36. package/dist/encode.min.js +2 -2
  37. package/dist/encode.umd.cjs +1 -2
  38. package/dist/encode.umd.min.cjs +1 -1
  39. package/dist/{iso-gainmap-metadata-Dk2F4Eoz.js → iso-gainmap-metadata-ByNqnUPn.js} +1 -1
  40. package/dist/{iso-gainmap-metadata-DNTSE4Qp.js → iso-gainmap-metadata-CEaaU7RT.js} +1 -1
  41. package/dist/libultrahdr.js +2 -2
  42. package/dist/libultrahdr.min.js +2 -2
  43. package/dist/libultrahdr.umd.cjs +1 -1
  44. package/dist/libultrahdr.umd.min.cjs +1 -1
  45. package/dist/{Loader-CL7itwBq.js → warn-deprecated-Bk17fVbj.js} +74 -35
  46. package/dist/{Loader-BdKdEGSJ.js → warn-deprecated-D0kPpXtA.js} +2 -2
  47. package/dist/worker-interface.js +2 -2
  48. package/dist/worker-interface.min.js +2 -2
  49. package/dist/worker-interface.umd.cjs +1 -1
  50. package/dist/worker-interface.umd.min.cjs +1 -1
  51. package/dist/worker.js +3 -3
  52. package/dist/worker.min.js +2 -2
  53. package/dist/worker.umd.cjs +1 -2
  54. package/dist/worker.umd.min.cjs +1 -1
  55. package/package.json +34 -41
@@ -1,10 +1,11 @@
1
- import { HalfFloatType } from 'three/webgpu';
1
+ import { HalfFloatType, LoadingManager, WebGPURenderer } from 'three/webgpu';
2
2
  import { QuadRenderer } from '../core/QuadRenderer';
3
3
  import { GainMapDecoderMaterial } from '../materials/GainMapDecoderMaterial';
4
4
  import { LoaderBaseWebGPU } from './LoaderBaseWebGPU';
5
5
  /**
6
6
  * A Three.js Loader for a JPEG with embedded gainmap metadata (WebGPU version).
7
7
  *
8
+ * @deprecated Will be removed in v4.0.0. Use {@link HDRJPGNodeLoader} instead: it is **not a drop-in replacement**, it returns a {@link GainMapNode} instead of a render target, see the [migration guide](https://github.com/MONOGRID/gainmap-js#migrating-to-v400).
8
9
  * @category Loaders
9
10
  * @group Loaders
10
11
  *
@@ -51,6 +52,7 @@ import { LoaderBaseWebGPU } from './LoaderBaseWebGPU';
51
52
  *
52
53
  */
53
54
  export declare class HDRJPGLoader extends LoaderBaseWebGPU<string> {
55
+ constructor(renderer?: WebGPURenderer, manager?: LoadingManager);
54
56
  /**
55
57
  * Loads a JPEG containing gain map metadata
56
58
  * Renders a normal SDR image if gainmap data is not found
@@ -0,0 +1,41 @@
1
+ import { GainMapNode } from '../nodes/GainMapNode';
2
+ import { LoaderBaseNode } from './LoaderBaseNode';
3
+ /**
4
+ * A Three.js Loader for a JPEG with embedded gain map metadata,
5
+ * returning a {@link GainMapNode} (a TSL texture node holding the decoded HDR image).
6
+ *
7
+ * No renderer is needed: `load` returns the node synchronously
8
+ * (like `TextureLoader` returns a `Texture`), it can be assigned to materials right away
9
+ * and it is decoded on the GPU once loaded.
10
+ *
11
+ * @category Loaders
12
+ * @group Loaders
13
+ *
14
+ * @example
15
+ * import { HDRJPGNodeLoader } from '@monogrid/gainmap-js/webgpu'
16
+ * import { equirectUV } from 'three/tsl'
17
+ * import { MeshBasicNodeMaterial } from 'three/webgpu'
18
+ *
19
+ * const hdr = new HDRJPGNodeLoader().load('gainmap.jpeg')
20
+ *
21
+ * const material = new MeshBasicNodeMaterial()
22
+ * material.colorNode = hdr
23
+ *
24
+ * scene.backgroundNode = hdr.sample(equirectUV())
25
+ *
26
+ * // all parameters are uniforms, changing them re-decodes the image once
27
+ * hdr.maxDisplayBoost.value = 2
28
+ */
29
+ export declare class HDRJPGNodeLoader extends LoaderBaseNode<string> {
30
+ /**
31
+ * Loads a JPEG containing gain map metadata
32
+ * Renders a normal SDR image if gainmap data is not found
33
+ *
34
+ * @param url Path to a JPEG file containing embedded gain map metadata
35
+ * @param onLoad Load complete callback, will receive the node
36
+ * @param onProgress Progress callback, will receive a `ProgressEvent`
37
+ * @param onError Error callback
38
+ * @returns a node which can be used immediately, it will hold the image once loaded
39
+ */
40
+ load(url: string, onLoad?: (data: GainMapNode) => void, onProgress?: (event: ProgressEvent) => void, onError?: (err: unknown) => void): GainMapNode;
41
+ }
@@ -0,0 +1,24 @@
1
+ import { FileLoader, Loader } from 'three/webgpu';
2
+ import { type GainMapMetadata } from '../../../core/types';
3
+ import { GainMapNode } from '../nodes/GainMapNode';
4
+ /**
5
+ * Base class for loaders returning a {@link GainMapNode}
6
+ * @template TUrl - The type of URL used to load resources
7
+ */
8
+ export declare abstract class LoaderBaseNode<TUrl = string> extends Loader<GainMapNode, TUrl> {
9
+ /**
10
+ * @private
11
+ * @param responseType
12
+ */
13
+ protected createFileLoader(responseType?: 'arraybuffer'): FileLoader<string | ArrayBuffer>;
14
+ /**
15
+ * Decodes the images and feeds them to the node, together with the metadata
16
+ *
17
+ * @private
18
+ * @param node
19
+ * @param metadata
20
+ * @param sdrBuffer
21
+ * @param gainMapBuffer
22
+ */
23
+ protected fillNode(node: GainMapNode, metadata: GainMapMetadata, sdrBuffer: ArrayBuffer, gainMapBuffer?: ArrayBuffer): Promise<void>;
24
+ }
@@ -4,6 +4,7 @@ import { type GainmapDecodingParameters } from '../../shared';
4
4
  /**
5
5
  * A Material which is able to decode the Gainmap into a full HDR Representation using TSL (Three.js Shading Language)
6
6
  *
7
+ * @deprecated Will be removed in v4.0.0. The decode now happens in {@link GainMapNode}, see the [migration guide](https://github.com/MONOGRID/gainmap-js#migrating-to-v400).
7
8
  * @category Materials
8
9
  * @group Materials
9
10
  */
@@ -0,0 +1,137 @@
1
+ import { type Node, type NodeFrame, RenderTarget, Texture, TextureNode, type UniformNode, Vector3, type WebGPURenderer } from 'three/webgpu';
2
+ import { type GainMapMetadata } from '../../../core/types';
3
+ /**
4
+ * Textures and uniforms driving a {@link GainMapNode} decode
5
+ */
6
+ export type GainMapNodeUniforms = {
7
+ sdr: TextureNode;
8
+ gainMap: TextureNode;
9
+ gamma: UniformNode<'vec3', Vector3>;
10
+ offsetSdr: UniformNode<'vec3', Vector3>;
11
+ offsetHdr: UniformNode<'vec3', Vector3>;
12
+ gainMapMin: UniformNode<'vec3', Vector3>;
13
+ gainMapMax: UniformNode<'vec3', Vector3>;
14
+ hdrCapacityMin: UniformNode<'float', number>;
15
+ hdrCapacityMax: UniformNode<'float', number>;
16
+ maxDisplayBoost: UniformNode<'float', number>;
17
+ };
18
+ /**
19
+ * A TSL texture node holding the HDR image decoded from an SDR image + gain map.
20
+ *
21
+ * The decode runs on the GPU into a HalfFloat render target, and only when something changed
22
+ * (textures loaded/swapped or any uniform value changed): sampling the node costs a single
23
+ * texture read, like any other texture.
24
+ *
25
+ * The node updates itself before rendering whenever it is part of a rendered node graph
26
+ * (material, `scene.backgroundNode`, ...). When only its texture is used (`node.value`,
27
+ * e.g. `scene.environment = node.value`) call {@link GainMapNode.decode} yourself.
28
+ *
29
+ * Re-decoding also flags the texture for PMREM regeneration,
30
+ * so environment maps are recomputed only when the image actually changes.
31
+ *
32
+ * `node.value` gets its final size once loaded: three.js PMREMs don't follow texture resizes,
33
+ * so assign it to `scene.environment` (or `pmremTexture()`) after load.
34
+ *
35
+ * @category Nodes
36
+ * @group Nodes
37
+ *
38
+ * @example
39
+ * import { GainMapNode } from '@monogrid/gainmap-js/webgpu'
40
+ * import { equirectUV } from 'three/tsl'
41
+ *
42
+ * const hdr = new GainMapNode()
43
+ * .setTextures(sdrTexture, gainMapTexture)
44
+ * .setMetadata(metadata)
45
+ *
46
+ * material.colorNode = hdr
47
+ * scene.backgroundNode = hdr.sample(equirectUV())
48
+ * hdr.maxDisplayBoost.value = 2 // re-decodes once, on the next frame
49
+ */
50
+ export declare class GainMapNode extends TextureNode {
51
+ static get type(): string;
52
+ /**
53
+ * Shared textures and uniforms
54
+ */
55
+ readonly uniforms: GainMapNodeUniforms;
56
+ /**
57
+ * The render target holding the decoded HDR image
58
+ */
59
+ readonly renderTarget: RenderTarget;
60
+ private _quadMesh;
61
+ private _material;
62
+ private _rendererState;
63
+ private _state;
64
+ constructor();
65
+ /** The SDR rendition texture (sRGB) */
66
+ get sdr(): Texture<unknown, import("three").TextureEventMap>;
67
+ /** The gain map recovery texture (linear) */
68
+ get gainMap(): Texture<unknown, import("three").TextureEventMap>;
69
+ /** @see {@link GainMapMetadata.gamma} */
70
+ get gamma(): UniformNode<"vec3", Vector3>;
71
+ /** @see {@link GainMapMetadata.offsetSdr} */
72
+ get offsetSdr(): UniformNode<"vec3", Vector3>;
73
+ /** @see {@link GainMapMetadata.offsetHdr} */
74
+ get offsetHdr(): UniformNode<"vec3", Vector3>;
75
+ /** @see {@link GainMapMetadata.gainMapMin} */
76
+ get gainMapMin(): UniformNode<"vec3", Vector3>;
77
+ /** @see {@link GainMapMetadata.gainMapMax} */
78
+ get gainMapMax(): UniformNode<"vec3", Vector3>;
79
+ /** @see {@link GainMapMetadata.hdrCapacityMin} */
80
+ get hdrCapacityMin(): UniformNode<"float", number>;
81
+ /** @see {@link GainMapMetadata.hdrCapacityMax} */
82
+ get hdrCapacityMax(): UniformNode<"float", number>;
83
+ /**
84
+ * @see {@link GainmapDecodingParameters.maxDisplayBoost}
85
+ * @remarks Non Logarithmic space
86
+ */
87
+ get maxDisplayBoost(): UniformNode<"float", number>;
88
+ /** Width of the SDR image, 0 until loaded */
89
+ get width(): number;
90
+ /** Height of the SDR image, 0 until loaded */
91
+ get height(): number;
92
+ /**
93
+ * Sets the SDR and gain map textures.
94
+ * The SDR texture is expected in sRGB color space, the gain map in linear.
95
+ *
96
+ * @param sdr
97
+ * @param gainMap
98
+ */
99
+ setTextures(sdr: Texture, gainMap: Texture): this;
100
+ /**
101
+ * Copies the gain map metadata into the uniforms.
102
+ * Also sets `maxDisplayBoost` to fully restore the HDR range.
103
+ *
104
+ * @param metadata
105
+ */
106
+ setMetadata(metadata: GainMapMetadata): this;
107
+ private _currentState;
108
+ /**
109
+ * Decodes the image into {@link GainMapNode.renderTarget}, only if something changed since the last decode.
110
+ *
111
+ * Called automatically when the node is part of a rendered node graph.
112
+ *
113
+ * @param renderer
114
+ * @returns `true` if the image was decoded
115
+ */
116
+ decode(renderer: WebGPURenderer): boolean;
117
+ updateBefore(frame: NodeFrame): undefined;
118
+ set value(value: Texture);
119
+ get value(): Texture;
120
+ /**
121
+ * Clones created by `sample()` & co. are plain TextureNodes reading this node's texture,
122
+ * they keep it updated before rendering as well
123
+ */
124
+ clone(): this;
125
+ /**
126
+ * Disposes the render target, the SDR and gain map textures
127
+ */
128
+ dispose(): void;
129
+ }
130
+ /**
131
+ * TSL function creating a {@link GainMapNode} from an SDR texture, a gain map texture and its metadata
132
+ *
133
+ * @param sdr
134
+ * @param gainMap
135
+ * @param metadata
136
+ */
137
+ export declare const gainMapNode: (sdr: Texture, gainMap: Texture, metadata: GainMapMetadata) => GainMapNode & Node;
package/dist/decode.js CHANGED
@@ -1,13 +1,13 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.5.0
2
+ * @monogrid/gainmap-js v3.6.0
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
5
 
6
- import { Q as QuadRenderer } from './QuadRenderer-DPiEee1I.js';
7
- import { c as createDecodeFunction, L as LoaderBaseShared, e as extractGainmapFromJPEG, X as XMPMetadataNotFoundError, G as GainMapNotFoundError } from './Loader-CL7itwBq.js';
8
- export { M as MPFExtractor, a as extractISO, b as extractXMP } from './Loader-CL7itwBq.js';
6
+ import { Q as QuadRenderer } from './QuadRenderer-CXtNzoCY.js';
7
+ import { w as warnDeprecated, c as createDecodeFunction, L as LoaderBaseShared, e as extractGainmapFromJPEG, X as XMPMetadataNotFoundError, G as GainMapNotFoundError } from './warn-deprecated-Bk17fVbj.js';
8
+ export { M as MPFExtractor, a as createTextures, b as extractISO, d as extractXMP, p as processImages } from './warn-deprecated-Bk17fVbj.js';
9
9
  import { ShaderMaterial, NoBlending, Vector3, WebGLRenderer, FileLoader } from 'three';
10
- import './iso-gainmap-metadata-Dk2F4Eoz.js';
10
+ import './iso-gainmap-metadata-ByNqnUPn.js';
11
11
 
12
12
  const vertexShader = /* glsl */ `
13
13
  varying vec2 vUv;
@@ -47,6 +47,7 @@ void main() {
47
47
  /**
48
48
  * A Material which is able to decode the Gainmap into a full HDR Representation
49
49
  *
50
+ * @deprecated Will be removed in v4.0.0. The decode now happens in `GainMapNode` from `@monogrid/gainmap-js/webgpu`, see the [migration guide](https://github.com/MONOGRID/gainmap-js#migrating-to-v400).
50
51
  * @category Materials
51
52
  * @group Materials
52
53
  */
@@ -163,6 +164,7 @@ const decodeImpl = createDecodeFunction({
163
164
  /**
164
165
  * Decodes a gain map using a WebGL RenderTarget
165
166
  *
167
+ * @deprecated Will be removed in v4.0.0. Use `gainMapNode()` from `@monogrid/gainmap-js/webgpu` with `WebGPURenderer` (which also has a WebGL2 backend) instead: it is **not a drop-in replacement**, it returns a `GainMapNode` instead of a render target, see the [migration guide](https://github.com/MONOGRID/gainmap-js#migrating-to-v400).
166
168
  * @category Decoding Functions
167
169
  * @group Decoding Functions
168
170
  * @example
@@ -216,6 +218,7 @@ const decodeImpl = createDecodeFunction({
216
218
  * @throws {Error} if the WebGLRenderer fails to render the gain map
217
219
  */
218
220
  const decode = (params) => {
221
+ warnDeprecated('decode()', '@monogrid/gainmap-js', 'gainMapNode()');
219
222
  // Ensure renderer is defined for the base function
220
223
  if (!params.renderer) {
221
224
  throw new Error('Renderer is required for decode function');
@@ -264,6 +267,7 @@ class LoaderBaseWebGL extends LoaderBaseShared {
264
267
  /**
265
268
  * A Three.js Loader for the gain map format.
266
269
  *
270
+ * @deprecated Will be removed in v4.0.0. Use GainMapNodeLoader from `@monogrid/gainmap-js/webgpu` with `WebGPURenderer` (which also has a WebGL2 backend) instead: it is **not a drop-in replacement**, it returns a `GainMapNode` instead of a render target, see the [migration guide](https://github.com/MONOGRID/gainmap-js#migrating-to-v400).
267
271
  * @category Loaders
268
272
  * @group Loaders
269
273
  *
@@ -309,6 +313,10 @@ class LoaderBaseWebGL extends LoaderBaseShared {
309
313
  *
310
314
  */
311
315
  class GainMapLoader extends LoaderBaseWebGL {
316
+ constructor(renderer, manager) {
317
+ super(renderer, manager);
318
+ warnDeprecated('GainMapLoader', '@monogrid/gainmap-js', 'GainMapNodeLoader');
319
+ }
312
320
  /**
313
321
  * Loads a gainmap using separate data
314
322
  * * sdr image
@@ -449,6 +457,7 @@ class GainMapLoader extends LoaderBaseWebGL {
449
457
  /**
450
458
  * A Three.js Loader for a JPEG with embedded gainmap metadata.
451
459
  *
460
+ * @deprecated Will be removed in v4.0.0. Use HDRJPGNodeLoader from `@monogrid/gainmap-js/webgpu` with `WebGPURenderer` (which also has a WebGL2 backend) instead: it is **not a drop-in replacement**, it returns a `GainMapNode` instead of a render target, see the [migration guide](https://github.com/MONOGRID/gainmap-js#migrating-to-v400).
452
461
  * @category Loaders
453
462
  * @group Loaders
454
463
  *
@@ -494,6 +503,10 @@ class GainMapLoader extends LoaderBaseWebGL {
494
503
  *
495
504
  */
496
505
  class HDRJPGLoader extends LoaderBaseWebGL {
506
+ constructor(renderer, manager) {
507
+ super(renderer, manager);
508
+ warnDeprecated('HDRJPGLoader', '@monogrid/gainmap-js', 'HDRJPGNodeLoader');
509
+ }
497
510
  /**
498
511
  * Loads a JPEG containing gain map metadata
499
512
  * Renders a normal SDR image if gainmap data is not found
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.5.0
2
+ * @monogrid/gainmap-js v3.6.0
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
- import{Q as e}from"./QuadRenderer-DIHDdKl6.js";import{c as t,L as r,e as n,X as i,G as s}from"./Loader-BdKdEGSJ.js";export{M as MPFExtractor,a as extractISO,b as extractXMP}from"./Loader-BdKdEGSJ.js";import{ShaderMaterial as o,NoBlending as d,Vector3 as h,WebGLRenderer as f,FileLoader as m}from"three";import"./iso-gainmap-metadata-DNTSE4Qp.js";class p extends o{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:a,offsetSdr:t,gainMapMin:r,gainMapMax:n,maxDisplayBoost:i,hdrCapacityMin:s,hdrCapacityMax:o,sdr:f,gainMap:m}){super({name:"GainMapDecoderMaterial",vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n// min half float value\n#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )\n// max half float value\n#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )\n\nuniform sampler2D sdr;\nuniform sampler2D gainMap;\nuniform vec3 gamma;\nuniform vec3 offsetHdr;\nuniform vec3 offsetSdr;\nuniform vec3 gainMapMin;\nuniform vec3 gainMapMax;\nuniform float weightFactor;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec3 rgb = texture2D( sdr, vUv ).rgb;\n vec3 recovery = texture2D( gainMap, vUv ).rgb;\n vec3 logRecovery = pow( recovery, gamma );\n vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;\n vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;\n vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));\n gl_FragColor = vec4( clampedHdrColor , 1.0 );\n}\n",uniforms:{sdr:{value:f},gainMap:{value:m},gamma:{value:new h(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:(new h).fromArray(a)},offsetSdr:{value:(new h).fromArray(t)},gainMapMin:{value:(new h).fromArray(r)},gainMapMax:{value:(new h).fromArray(n)},weightFactor:{value:(Math.log2(i)-s)/(o-s)}},blending:d,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=s,this._hdrCapacityMax=o,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const a=this.uniforms.gamma.value;a.x=1/e[0],a.y=1/e[1],a.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}const c=t({renderer:f,createMaterial:e=>new p(e),createQuadRenderer:a=>new e(a)}),l=e=>{if(!e.renderer)throw new Error("Renderer is required for decode function");const a=c({...e,renderer:e.renderer});try{a.render()}catch(e){throw a.disposeOnDemandRenderer(),e}return a};class u extends r{constructor(a,t){super({renderer:a,createMaterial:e=>new p(e),createQuadRenderer:a=>new e(a)},t)}async render(e,a,t,r){const{sdrImage:n,gainMapImage:i,needsFlip:s}=await this.processImages(t,r,"flipY"),{gainMap:o,sdr:d}=this.createTextures(n,i,s);this.updateQuadRenderer(e,n,o,d,a),e.render()}}class g extends u{load([e,a,t],r,n,i){const s=this.prepareQuadRenderer();let o,d,h;const f=async()=>{if(o&&d&&h){try{await this.render(s,h,o,d)}catch(r){return this.manager.itemError(e),this.manager.itemError(a),this.manager.itemError(t),"function"==typeof i&&i(r),void s.disposeOnDemandRenderer()}"function"==typeof r&&r(s),this.manager.itemEnd(e),this.manager.itemEnd(a),this.manager.itemEnd(t),s.disposeOnDemandRenderer()}};let p=!0,c=0,l=0,u=!0,g=0,M=0,y=!0,v=0,x=0;const w=()=>{if("function"==typeof n){n(new ProgressEvent("progress",{lengthComputable:p&&u&&y,loaded:l+M+x,total:c+g+v}))}};this.manager.itemStart(e),this.manager.itemStart(a),this.manager.itemStart(t);const C=new m(this._internalLoadingManager);C.setResponseType("arraybuffer"),C.setRequestHeader(this.requestHeader),C.setPath(this.path),C.setWithCredentials(this.withCredentials),C.load(e,async e=>{if("string"==typeof e)throw new Error("Invalid sdr buffer");o=e,await f()},e=>{p=e.lengthComputable,l=e.loaded,c=e.total,w()},a=>{this.manager.itemError(e),"function"==typeof i&&i(a)});const _=new m(this._internalLoadingManager);_.setResponseType("arraybuffer"),_.setRequestHeader(this.requestHeader),_.setPath(this.path),_.setWithCredentials(this.withCredentials),_.load(a,async e=>{if("string"==typeof e)throw new Error("Invalid gainmap buffer");d=e,await f()},e=>{u=e.lengthComputable,M=e.loaded,g=e.total,w()},e=>{this.manager.itemError(a),"function"==typeof i&&i(e)});const R=new m(this._internalLoadingManager);return R.setRequestHeader(this.requestHeader),R.setPath(this.path),R.setWithCredentials(this.withCredentials),R.load(t,async e=>{if("string"!=typeof e)throw new Error("Invalid metadata string");h=JSON.parse(e),await f()},e=>{y=e.lengthComputable,x=e.loaded,v=e.total,w()},e=>{this.manager.itemError(t),"function"==typeof i&&i(e)}),s}}class y extends u{load(e,a,t,r){const o=this.prepareQuadRenderer(),d=new m(this._internalLoadingManager);return d.setResponseType("arraybuffer"),d.setRequestHeader(this.requestHeader),d.setPath(this.path),d.setWithCredentials(this.withCredentials),this.manager.itemStart(e),d.load(e,async t=>{if("string"==typeof t)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const d=new Uint8Array(t);let h,f,m;try{const e=await n(d);h=e.sdr,f=e.gainMap,m=e.metadata}catch(a){if(!(a instanceof i||a instanceof s))throw a;console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),m={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=d}try{await this.render(o,m,h.buffer,f?.buffer)}catch(a){return this.manager.itemError(e),"function"==typeof r&&r(a),void o.disposeOnDemandRenderer()}"function"==typeof a&&a(o),this.manager.itemEnd(e),o.disposeOnDemandRenderer()},t,a=>{this.manager.itemError(e),"function"==typeof r&&r(a)}),o}}export{p as GainMapDecoderMaterial,g as GainMapLoader,s as GainMapNotFoundError,y as HDRJPGLoader,y as JPEGRLoader,r as LoaderBaseShared,e as QuadRenderer,i as XMPMetadataNotFoundError,t as createDecodeFunction,l as decode,n as extractGainmapFromJPEG};
5
+ import{Q as e}from"./QuadRenderer-DcBTBLz6.js";import{w as r,c as t,L as n,e as i,X as s,G as o}from"./warn-deprecated-D0kPpXtA.js";export{M as MPFExtractor,a as createTextures,b as extractISO,d as extractXMP,p as processImages}from"./warn-deprecated-D0kPpXtA.js";import{ShaderMaterial as h,NoBlending as m,Vector3 as f,WebGLRenderer as c,FileLoader as g}from"three";import"./iso-gainmap-metadata-CEaaU7RT.js";class u extends h{_maxDisplayBoost;_hdrCapacityMin;_hdrCapacityMax;constructor({gamma:e,offsetHdr:a,offsetSdr:r,gainMapMin:t,gainMapMax:n,maxDisplayBoost:i,hdrCapacityMin:s,hdrCapacityMax:o,sdr:d,gainMap:h}){super({name:"GainMapDecoderMaterial",vertexShader:"\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n",fragmentShader:"\n// min half float value\n#define HALF_FLOAT_MIN vec3( -65504, -65504, -65504 )\n// max half float value\n#define HALF_FLOAT_MAX vec3( 65504, 65504, 65504 )\n\nuniform sampler2D sdr;\nuniform sampler2D gainMap;\nuniform vec3 gamma;\nuniform vec3 offsetHdr;\nuniform vec3 offsetSdr;\nuniform vec3 gainMapMin;\nuniform vec3 gainMapMax;\nuniform float weightFactor;\n\nvarying vec2 vUv;\n\nvoid main() {\n vec3 rgb = texture2D( sdr, vUv ).rgb;\n vec3 recovery = texture2D( gainMap, vUv ).rgb;\n vec3 logRecovery = pow( recovery, gamma );\n vec3 logBoost = gainMapMin * ( 1.0 - logRecovery ) + gainMapMax * logRecovery;\n vec3 hdrColor = (rgb + offsetSdr) * exp2( logBoost * weightFactor ) - offsetHdr;\n vec3 clampedHdrColor = max( HALF_FLOAT_MIN, min( HALF_FLOAT_MAX, hdrColor ));\n gl_FragColor = vec4( clampedHdrColor , 1.0 );\n}\n",uniforms:{sdr:{value:d},gainMap:{value:h},gamma:{value:new f(1/e[0],1/e[1],1/e[2])},offsetHdr:{value:(new f).fromArray(a)},offsetSdr:{value:(new f).fromArray(r)},gainMapMin:{value:(new f).fromArray(t)},gainMapMax:{value:(new f).fromArray(n)},weightFactor:{value:(Math.log2(i)-s)/(o-s)}},blending:m,depthTest:!1,depthWrite:!1}),this._maxDisplayBoost=i,this._hdrCapacityMin=s,this._hdrCapacityMax=o,this.needsUpdate=!0,this.uniformsNeedUpdate=!0}get sdr(){return this.uniforms.sdr.value}set sdr(e){this.uniforms.sdr.value=e}get gainMap(){return this.uniforms.gainMap.value}set gainMap(e){this.uniforms.gainMap.value=e}get offsetHdr(){return this.uniforms.offsetHdr.value.toArray()}set offsetHdr(e){this.uniforms.offsetHdr.value.fromArray(e)}get offsetSdr(){return this.uniforms.offsetSdr.value.toArray()}set offsetSdr(e){this.uniforms.offsetSdr.value.fromArray(e)}get gainMapMin(){return this.uniforms.gainMapMin.value.toArray()}set gainMapMin(e){this.uniforms.gainMapMin.value.fromArray(e)}get gainMapMax(){return this.uniforms.gainMapMax.value.toArray()}set gainMapMax(e){this.uniforms.gainMapMax.value.fromArray(e)}get gamma(){const e=this.uniforms.gamma.value;return[1/e.x,1/e.y,1/e.z]}set gamma(e){const a=this.uniforms.gamma.value;a.x=1/e[0],a.y=1/e[1],a.z=1/e[2]}get hdrCapacityMin(){return this._hdrCapacityMin}set hdrCapacityMin(e){this._hdrCapacityMin=e,this.calculateWeight()}get hdrCapacityMax(){return this._hdrCapacityMax}set hdrCapacityMax(e){this._hdrCapacityMax=e,this.calculateWeight()}get maxDisplayBoost(){return this._maxDisplayBoost}set maxDisplayBoost(e){this._maxDisplayBoost=Math.max(1,Math.min(65504,e)),this.calculateWeight()}calculateWeight(){const e=(Math.log2(this._maxDisplayBoost)-this._hdrCapacityMin)/(this._hdrCapacityMax-this._hdrCapacityMin);this.uniforms.weightFactor.value=Math.max(0,Math.min(1,e))}}const l=t({renderer:c,createMaterial:e=>new u(e),createQuadRenderer:a=>new e(a)}),y=e=>{if(r("decode()","@monogrid/gainmap-js","gainMapNode()"),!e.renderer)throw new Error("Renderer is required for decode function");const a=l({...e,renderer:e.renderer});try{a.render()}catch(e){throw a.disposeOnDemandRenderer(),e}return a};class v extends n{constructor(a,r){super({renderer:a,createMaterial:e=>new u(e),createQuadRenderer:a=>new e(a)},r)}async render(e,a,r,t){const{sdrImage:n,gainMapImage:i,needsFlip:s}=await this.processImages(r,t,"flipY"),{gainMap:o,sdr:d}=this.createTextures(n,i,s);this.updateQuadRenderer(e,n,o,d,a),e.render()}}class w extends v{constructor(e,a){super(e,a),r("GainMapLoader","@monogrid/gainmap-js","GainMapNodeLoader")}load([e,a,r],t,n,i){const s=this.prepareQuadRenderer();let o,d,h;const m=async()=>{if(o&&d&&h){try{await this.render(s,h,o,d)}catch(t){return this.manager.itemError(e),this.manager.itemError(a),this.manager.itemError(r),"function"==typeof i&&i(t),void s.disposeOnDemandRenderer()}"function"==typeof t&&t(s),this.manager.itemEnd(e),this.manager.itemEnd(a),this.manager.itemEnd(r),s.disposeOnDemandRenderer()}};let f=!0,p=0,c=0,u=!0,l=0,M=0,y=!0,v=0,w=0;const x=()=>{if("function"==typeof n){n(new ProgressEvent("progress",{lengthComputable:f&&u&&y,loaded:c+M+w,total:p+l+v}))}};this.manager.itemStart(e),this.manager.itemStart(a),this.manager.itemStart(r);const C=new g(this._internalLoadingManager);C.setResponseType("arraybuffer"),C.setRequestHeader(this.requestHeader),C.setPath(this.path),C.setWithCredentials(this.withCredentials),C.load(e,async e=>{if("string"==typeof e)throw new Error("Invalid sdr buffer");o=e,await m()},e=>{f=e.lengthComputable,c=e.loaded,p=e.total,x()},a=>{this.manager.itemError(e),"function"==typeof i&&i(a)});const _=new g(this._internalLoadingManager);_.setResponseType("arraybuffer"),_.setRequestHeader(this.requestHeader),_.setPath(this.path),_.setWithCredentials(this.withCredentials),_.load(a,async e=>{if("string"==typeof e)throw new Error("Invalid gainmap buffer");d=e,await m()},e=>{u=e.lengthComputable,M=e.loaded,l=e.total,x()},e=>{this.manager.itemError(a),"function"==typeof i&&i(e)});const R=new g(this._internalLoadingManager);return R.setRequestHeader(this.requestHeader),R.setPath(this.path),R.setWithCredentials(this.withCredentials),R.load(r,async e=>{if("string"!=typeof e)throw new Error("Invalid metadata string");h=JSON.parse(e),await m()},e=>{y=e.lengthComputable,w=e.loaded,v=e.total,x()},e=>{this.manager.itemError(r),"function"==typeof i&&i(e)}),s}}class x extends v{constructor(e,a){super(e,a),r("HDRJPGLoader","@monogrid/gainmap-js","HDRJPGNodeLoader")}load(e,a,r,t){const n=this.prepareQuadRenderer(),d=new g(this._internalLoadingManager);return d.setResponseType("arraybuffer"),d.setRequestHeader(this.requestHeader),d.setPath(this.path),d.setWithCredentials(this.withCredentials),this.manager.itemStart(e),d.load(e,async r=>{if("string"==typeof r)throw new Error("Invalid buffer, received [string], was expecting [ArrayBuffer]");const d=new Uint8Array(r);let h,m,f;try{const e=await i(d);h=e.sdr,m=e.gainMap,f=e.metadata}catch(a){if(!(a instanceof s||a instanceof o))throw a;console.warn(`Failure to reconstruct an HDR image from ${e}: Gain map metadata not found in the file, HDRJPGLoader will render the SDR jpeg`),f={gainMapMin:[0,0,0],gainMapMax:[1,1,1],gamma:[1,1,1],hdrCapacityMin:0,hdrCapacityMax:1,offsetHdr:[0,0,0],offsetSdr:[0,0,0]},h=d}try{await this.render(n,f,h.buffer,m?.buffer)}catch(a){return this.manager.itemError(e),"function"==typeof t&&t(a),void n.disposeOnDemandRenderer()}"function"==typeof a&&a(n),this.manager.itemEnd(e),n.disposeOnDemandRenderer()},r,a=>{this.manager.itemError(e),"function"==typeof t&&t(a)}),n}}export{u as GainMapDecoderMaterial,w as GainMapLoader,o as GainMapNotFoundError,x as HDRJPGLoader,x as JPEGRLoader,n as LoaderBaseShared,e as QuadRenderer,s as XMPMetadataNotFoundError,t as createDecodeFunction,y as decode,i as extractGainmapFromJPEG};
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @monogrid/gainmap-js v3.5.0
2
+ * @monogrid/gainmap-js v3.6.0
3
3
  * With ❤️, by MONOGRID <gainmap@monogrid.com>
4
4
  */
5
5
 
@@ -743,6 +743,57 @@
743
743
  });
744
744
  };
745
745
 
746
+ /**
747
+ * Decodes the SDR and (optional) gain map JPEG buffers into images
748
+ *
749
+ * @param sdrBuffer
750
+ * @param gainMapBuffer
751
+ * @param imageOrientation
752
+ * @returns
753
+ */
754
+ const processImages = async (sdrBuffer, gainMapBuffer, imageOrientation) => {
755
+ const gainMapBlob = gainMapBuffer ? new Blob([gainMapBuffer], { type: 'image/jpeg' }) : undefined;
756
+ const sdrBlob = new Blob([sdrBuffer], { type: 'image/jpeg' });
757
+ let sdrImage;
758
+ let gainMapImage;
759
+ let needsFlip = false;
760
+ if (typeof createImageBitmap === 'undefined') {
761
+ const res = await Promise.all([
762
+ gainMapBlob ? getHTMLImageFromBlob(gainMapBlob) : Promise.resolve(undefined),
763
+ getHTMLImageFromBlob(sdrBlob)
764
+ ]);
765
+ gainMapImage = res[0];
766
+ sdrImage = res[1];
767
+ needsFlip = imageOrientation === 'flipY';
768
+ }
769
+ else {
770
+ const res = await Promise.all([
771
+ gainMapBlob ? createImageBitmap(gainMapBlob, { imageOrientation: imageOrientation || 'flipY' }) : Promise.resolve(undefined),
772
+ createImageBitmap(sdrBlob, { imageOrientation: imageOrientation || 'flipY' })
773
+ ]);
774
+ gainMapImage = res[0];
775
+ sdrImage = res[1];
776
+ }
777
+ return { sdrImage, gainMapImage, needsFlip };
778
+ };
779
+ /**
780
+ * Creates the SDR (sRGB) and gain map (linear) textures from decoded images
781
+ *
782
+ * @param sdrImage
783
+ * @param gainMapImage
784
+ * @param needsFlip
785
+ * @returns
786
+ */
787
+ const createTextures = (sdrImage, gainMapImage, needsFlip) => {
788
+ const gainMap = new three.Texture(gainMapImage || new ImageData(2, 2), three.UVMapping, three.ClampToEdgeWrapping, three.ClampToEdgeWrapping, three.LinearFilter, three.LinearMipMapLinearFilter, three.RGBAFormat, three.UnsignedByteType, 1, three.LinearSRGBColorSpace);
789
+ gainMap.flipY = needsFlip;
790
+ gainMap.needsUpdate = true;
791
+ const sdr = new three.Texture(sdrImage, three.UVMapping, three.ClampToEdgeWrapping, three.ClampToEdgeWrapping, three.LinearFilter, three.LinearMipMapLinearFilter, three.RGBAFormat, three.UnsignedByteType, 1, three.SRGBColorSpace);
792
+ sdr.flipY = needsFlip;
793
+ sdr.needsUpdate = true;
794
+ return { gainMap, sdr };
795
+ };
796
+
746
797
  /**
747
798
  * Shared base class for loaders that extracts common logic
748
799
  */
@@ -792,39 +843,11 @@
792
843
  renderTargetOptions: this._renderTargetOptions
793
844
  });
794
845
  }
795
- async processImages(sdrBuffer, gainMapBuffer, imageOrientation) {
796
- const gainMapBlob = gainMapBuffer ? new Blob([gainMapBuffer], { type: 'image/jpeg' }) : undefined;
797
- const sdrBlob = new Blob([sdrBuffer], { type: 'image/jpeg' });
798
- let sdrImage;
799
- let gainMapImage;
800
- let needsFlip = false;
801
- if (typeof createImageBitmap === 'undefined') {
802
- const res = await Promise.all([
803
- gainMapBlob ? getHTMLImageFromBlob(gainMapBlob) : Promise.resolve(undefined),
804
- getHTMLImageFromBlob(sdrBlob)
805
- ]);
806
- gainMapImage = res[0];
807
- sdrImage = res[1];
808
- needsFlip = imageOrientation === 'flipY';
809
- }
810
- else {
811
- const res = await Promise.all([
812
- gainMapBlob ? createImageBitmap(gainMapBlob, { imageOrientation: imageOrientation || 'flipY' }) : Promise.resolve(undefined),
813
- createImageBitmap(sdrBlob, { imageOrientation: imageOrientation || 'flipY' })
814
- ]);
815
- gainMapImage = res[0];
816
- sdrImage = res[1];
817
- }
818
- return { sdrImage, gainMapImage, needsFlip };
846
+ processImages(sdrBuffer, gainMapBuffer, imageOrientation) {
847
+ return processImages(sdrBuffer, gainMapBuffer, imageOrientation);
819
848
  }
820
849
  createTextures(sdrImage, gainMapImage, needsFlip) {
821
- const gainMap = new three.Texture(gainMapImage || new ImageData(2, 2), three.UVMapping, three.ClampToEdgeWrapping, three.ClampToEdgeWrapping, three.LinearFilter, three.LinearMipMapLinearFilter, three.RGBAFormat, three.UnsignedByteType, 1, three.LinearSRGBColorSpace);
822
- gainMap.flipY = needsFlip;
823
- gainMap.needsUpdate = true;
824
- const sdr = new three.Texture(sdrImage, three.UVMapping, three.ClampToEdgeWrapping, three.ClampToEdgeWrapping, three.LinearFilter, three.LinearMipMapLinearFilter, three.RGBAFormat, three.UnsignedByteType, 1, three.SRGBColorSpace);
825
- sdr.flipY = needsFlip;
826
- sdr.needsUpdate = true;
827
- return { gainMap, sdr };
850
+ return createTextures(sdrImage, gainMapImage, needsFlip);
828
851
  }
829
852
  updateQuadRenderer(quadRenderer, sdrImage, gainMap, sdr, metadata) {
830
853
  quadRenderer.width = sdrImage.width;
@@ -843,6 +866,22 @@
843
866
  }
844
867
  }
845
868
 
869
+ const warned = new Set();
870
+ /**
871
+ * Warns once per API that a render target based decode API is going away in v4.0.0
872
+ *
873
+ * @param name deprecated API
874
+ * @param entry entry point exposing the deprecated API
875
+ * @param replacement node based API replacing it, from `@monogrid/gainmap-js/webgpu`
876
+ */
877
+ const warnDeprecated = (name, entry, replacement) => {
878
+ const key = `${entry}:${name}`;
879
+ if (warned.has(key))
880
+ return;
881
+ warned.add(key);
882
+ console.warn(`gainmap-js: ${name} from '${entry}' is deprecated and will be removed in v4.0.0. Use ${replacement} from '@monogrid/gainmap-js/webgpu' with WebGPURenderer (which also has a WebGL2 backend) instead. It is not a drop-in replacement (it returns a GainMapNode, not a render target), see https://github.com/MONOGRID/gainmap-js#migrating-to-v400`);
883
+ };
884
+
846
885
  const vertexShader = /* glsl */ `
847
886
  varying vec2 vUv;
848
887
 
@@ -881,6 +920,7 @@ void main() {
881
920
  /**
882
921
  * A Material which is able to decode the Gainmap into a full HDR Representation
883
922
  *
923
+ * @deprecated Will be removed in v4.0.0. The decode now happens in `GainMapNode` from `@monogrid/gainmap-js/webgpu`, see the [migration guide](https://github.com/MONOGRID/gainmap-js#migrating-to-v400).
884
924
  * @category Materials
885
925
  * @group Materials
886
926
  */
@@ -997,6 +1037,7 @@ void main() {
997
1037
  /**
998
1038
  * Decodes a gain map using a WebGL RenderTarget
999
1039
  *
1040
+ * @deprecated Will be removed in v4.0.0. Use `gainMapNode()` from `@monogrid/gainmap-js/webgpu` with `WebGPURenderer` (which also has a WebGL2 backend) instead: it is **not a drop-in replacement**, it returns a `GainMapNode` instead of a render target, see the [migration guide](https://github.com/MONOGRID/gainmap-js#migrating-to-v400).
1000
1041
  * @category Decoding Functions
1001
1042
  * @group Decoding Functions
1002
1043
  * @example
@@ -1050,6 +1091,7 @@ void main() {
1050
1091
  * @throws {Error} if the WebGLRenderer fails to render the gain map
1051
1092
  */
1052
1093
  const decode = (params) => {
1094
+ warnDeprecated('decode()', '@monogrid/gainmap-js', 'gainMapNode()');
1053
1095
  // Ensure renderer is defined for the base function
1054
1096
  if (!params.renderer) {
1055
1097
  throw new Error('Renderer is required for decode function');
@@ -1098,6 +1140,7 @@ void main() {
1098
1140
  /**
1099
1141
  * A Three.js Loader for the gain map format.
1100
1142
  *
1143
+ * @deprecated Will be removed in v4.0.0. Use GainMapNodeLoader from `@monogrid/gainmap-js/webgpu` with `WebGPURenderer` (which also has a WebGL2 backend) instead: it is **not a drop-in replacement**, it returns a `GainMapNode` instead of a render target, see the [migration guide](https://github.com/MONOGRID/gainmap-js#migrating-to-v400).
1101
1144
  * @category Loaders
1102
1145
  * @group Loaders
1103
1146
  *
@@ -1143,6 +1186,10 @@ void main() {
1143
1186
  *
1144
1187
  */
1145
1188
  class GainMapLoader extends LoaderBaseWebGL {
1189
+ constructor(renderer, manager) {
1190
+ super(renderer, manager);
1191
+ warnDeprecated('GainMapLoader', '@monogrid/gainmap-js', 'GainMapNodeLoader');
1192
+ }
1146
1193
  /**
1147
1194
  * Loads a gainmap using separate data
1148
1195
  * * sdr image
@@ -1283,6 +1330,7 @@ void main() {
1283
1330
  /**
1284
1331
  * A Three.js Loader for a JPEG with embedded gainmap metadata.
1285
1332
  *
1333
+ * @deprecated Will be removed in v4.0.0. Use HDRJPGNodeLoader from `@monogrid/gainmap-js/webgpu` with `WebGPURenderer` (which also has a WebGL2 backend) instead: it is **not a drop-in replacement**, it returns a `GainMapNode` instead of a render target, see the [migration guide](https://github.com/MONOGRID/gainmap-js#migrating-to-v400).
1286
1334
  * @category Loaders
1287
1335
  * @group Loaders
1288
1336
  *
@@ -1328,6 +1376,10 @@ void main() {
1328
1376
  *
1329
1377
  */
1330
1378
  class HDRJPGLoader extends LoaderBaseWebGL {
1379
+ constructor(renderer, manager) {
1380
+ super(renderer, manager);
1381
+ warnDeprecated('HDRJPGLoader', '@monogrid/gainmap-js', 'HDRJPGNodeLoader');
1382
+ }
1331
1383
  /**
1332
1384
  * Loads a JPEG containing gain map metadata
1333
1385
  * Renders a normal SDR image if gainmap data is not found
@@ -1416,9 +1468,11 @@ void main() {
1416
1468
  exports.QuadRenderer = QuadRenderer;
1417
1469
  exports.XMPMetadataNotFoundError = XMPMetadataNotFoundError;
1418
1470
  exports.createDecodeFunction = createDecodeFunction;
1471
+ exports.createTextures = createTextures;
1419
1472
  exports.decode = decode;
1420
1473
  exports.extractGainmapFromJPEG = extractGainmapFromJPEG;
1421
1474
  exports.extractISO = extractISO;
1422
1475
  exports.extractXMP = extractXMP;
1476
+ exports.processImages = processImages;
1423
1477
 
1424
1478
  }));