@monogrid/gainmap-js 3.5.0 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +111 -133
- package/dist/{QuadRenderer-DIHDdKl6.js → QuadRenderer-Bhn3yOPC.js} +1 -1
- package/dist/{QuadRenderer-DPiEee1I.js → QuadRenderer-DMno-Vj6.js} +1 -1
- package/dist/{_commonjsHelpers-S7tZmPW-.js → _commonjsHelpers-C8qmDUO8.js} +1 -1
- package/dist/{_commonjsHelpers-DVRbpukU.js → _commonjsHelpers-DFuDJEaJ.js} +1 -1
- package/dist/{compress-5gFn7Y4a.js → compress-TBp7MS8D.js} +1 -1
- package/dist/{compress-CTBeaiI1.js → compress-oIjJuPa8.js} +1 -2
- package/dist/decode/shared/index.d.ts +1 -0
- package/dist/decode/shared/utils/create-textures.d.ts +26 -0
- package/dist/decode/shared/utils/warn-deprecated.d.ts +8 -0
- package/dist/decode/webgl/decode.d.ts +1 -0
- package/dist/decode/webgl/index.d.ts +4 -0
- package/dist/decode/webgl/loaders/GainMapLoader.d.ts +3 -1
- package/dist/decode/webgl/loaders/HDRJPGLoader.d.ts +3 -1
- package/dist/decode/webgl/materials/GainMapDecoderMaterial.d.ts +1 -0
- package/dist/decode/webgpu/core/QuadRenderer.d.ts +1 -0
- package/dist/decode/webgpu/decode.d.ts +1 -0
- package/dist/decode/webgpu/index.d.ts +7 -0
- package/dist/decode/webgpu/loaders/GainMapLoader.d.ts +3 -1
- package/dist/decode/webgpu/loaders/GainMapNodeLoader.d.ts +42 -0
- package/dist/decode/webgpu/loaders/HDRJPGLoader.d.ts +3 -1
- package/dist/decode/webgpu/loaders/HDRJPGNodeLoader.d.ts +41 -0
- package/dist/decode/webgpu/loaders/LoaderBaseNode.d.ts +24 -0
- package/dist/decode/webgpu/materials/GainMapDecoderMaterial.d.ts +1 -0
- package/dist/decode/webgpu/nodes/GainMapNode.d.ts +142 -0
- package/dist/decode.js +18 -5
- package/dist/decode.min.js +2 -2
- package/dist/decode.umd.cjs +86 -32
- package/dist/decode.umd.min.cjs +2 -2
- package/dist/decode.webgpu.js +472 -10
- package/dist/decode.webgpu.min.js +2 -2
- package/dist/decode.webgpu.umd.cjs +542 -35
- package/dist/decode.webgpu.umd.min.cjs +2 -2
- package/dist/encode.js +3 -3
- package/dist/encode.min.js +2 -2
- package/dist/encode.umd.cjs +1 -2
- package/dist/encode.umd.min.cjs +1 -1
- package/dist/{iso-gainmap-metadata-Dk2F4Eoz.js → iso-gainmap-metadata-C1io5isX.js} +1 -1
- package/dist/{iso-gainmap-metadata-DNTSE4Qp.js → iso-gainmap-metadata-Oi7gAKNC.js} +1 -1
- package/dist/libultrahdr.js +2 -2
- package/dist/libultrahdr.min.js +2 -2
- package/dist/libultrahdr.umd.cjs +1 -1
- package/dist/libultrahdr.umd.min.cjs +1 -1
- package/dist/{Loader-CL7itwBq.js → warn-deprecated-DtCQWGKi.js} +74 -35
- package/dist/{Loader-BdKdEGSJ.js → warn-deprecated-gLZfP_DV.js} +2 -2
- package/dist/worker-interface.js +2 -2
- package/dist/worker-interface.min.js +2 -2
- package/dist/worker-interface.umd.cjs +1 -1
- package/dist/worker-interface.umd.min.cjs +1 -1
- package/dist/worker.js +3 -3
- package/dist/worker.min.js +2 -2
- package/dist/worker.umd.cjs +1 -2
- package/dist/worker.umd.min.cjs +1 -1
- package/package.json +35 -42
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [3.6.1](https://github.com/MONOGRID/gainmap-js/compare/v3.6.0...v3.6.1) (2026-10-19)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **webgpu:** normalize QuadRenderer.toArray() pixel layout across backends ([e8996f2](https://github.com/MONOGRID/gainmap-js/commit/e8996f2e3bf00fed02054b13a0d1d8c8a0474afe))
|
|
7
|
+
|
|
8
|
+
# [3.6.0](https://github.com/MONOGRID/gainmap-js/compare/v3.5.0...v3.6.0) (2026-10-18)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **webgpu:** node-based gain map loaders ([#86](https://github.com/MONOGRID/gainmap-js/issues/86)) ([3275ff9](https://github.com/MONOGRID/gainmap-js/commit/3275ff98da4a117adbd115654243bcff152b3d52))
|
|
14
|
+
|
|
1
15
|
# [3.5.0](https://github.com/MONOGRID/gainmap-js/compare/v3.4.1...v3.5.0) (2026-10-18)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Your contributions and creative ideas make our community stronger. We can’t wa
|
|
|
16
16
|
|
|
17
17
|
## Live Demo
|
|
18
18
|
|
|
19
|
-
* [WebGPU Version](https://monogrid.github.io/gainmap-js/webgpu.html)
|
|
19
|
+
* [WebGPU Version (node loaders)](https://monogrid.github.io/gainmap-js/webgpu-node.html)
|
|
20
20
|
* [Legacy WebGL Version](https://monogrid.github.io/gainmap-js/)
|
|
21
21
|
|
|
22
22
|
Both compares loading:
|
|
@@ -24,6 +24,10 @@ Both compares loading:
|
|
|
24
24
|
2. a `webp` sdr file + a `webp` gain map + metadata JSON
|
|
25
25
|
3. a comparable size `.hdr` file for comparison
|
|
26
26
|
|
|
27
|
+
## Benchmark
|
|
28
|
+
|
|
29
|
+
[Loader benchmark](https://monogrid.github.io/gainmap-js/benchmark.html): compares `HDRJPGNodeLoader` (GPU decode) against three.js `UltraHDRLoader` (CPU decode), loading the same gain map JPEGs in your browser.
|
|
30
|
+
|
|
27
31
|
## [Free online encoder](https://gainmap-creator.monogrid.com)
|
|
28
32
|
|
|
29
33
|
Use it to convert `.hdr` and `.exr` files into gain maps. It's free and the whole process happens in your browser.
|
|
@@ -60,9 +64,18 @@ Refer to the [WIKI](https://github.com/MONOGRID/gainmap-js/wiki) for detailed do
|
|
|
60
64
|
The main use case of this library is to decode a JPEG file that contains gain map data
|
|
61
65
|
and use it instead of a traditional `.exr` or `.hdr` image.
|
|
62
66
|
|
|
67
|
+
The recommended way is to use the **node loaders** from the `@monogrid/gainmap-js/webgpu` entry point,
|
|
68
|
+
together with three.js `WebGPURenderer`.
|
|
69
|
+
|
|
70
|
+
Node loaders return a `GainMapNode`: a [TSL](https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language) texture node holding the decoded HDR image.
|
|
71
|
+
|
|
72
|
+
* **No renderer needed**: `load()` returns the node synchronously (like `TextureLoader` returns a `Texture`), it can be assigned to materials right away.
|
|
73
|
+
* **Decoded on the GPU** into a HalfFloat render target, and only when something changes: sampling the node costs a single texture read.
|
|
74
|
+
* **Every parameter is a uniform**: changing e.g. `maxDisplayBoost` re-decodes the image (and the environment PMREM) once, on the next frame.
|
|
75
|
+
|
|
63
76
|
> NOTE: Starting from v3.1.0 Decoding also works in a WebWorker, thanks to [Alejandro Romano](https://github.com/Arecsu) for the [contribution](https://github.com/MONOGRID/gainmap-js/pull/59)
|
|
64
77
|
|
|
65
|
-
|
|
78
|
+
#### Using a single JPEG with embedded Gain map Metadata
|
|
66
79
|
|
|
67
80
|
This approach lets you load a single file with an embedded Gain Map.
|
|
68
81
|
|
|
@@ -70,51 +83,58 @@ The advantage is to have a single file to load.
|
|
|
70
83
|
|
|
71
84
|
The disadvantages are:
|
|
72
85
|
* No WEBP compression
|
|
73
|
-
*
|
|
74
|
-
|
|
86
|
+
* Editing software that does not support gain maps will only see (and save) the SDR image, discarding the HDR information.
|
|
87
|
+
Software support is growing: Adobe Lightroom and Camera Raw and Pixelmator Pro can export gain map JPEGs,
|
|
88
|
+
while others (e.g. GIMP, Affinity) can't yet, and Photoshop needs Camera Raw or third party plugins.
|
|
89
|
+
You can also use our [free online encoder](https://gainmap-creator.monogrid.com) to create them from `.hdr` and `.exr` files.
|
|
90
|
+
* Many websites and services (e.g. Facebook, Slack) re-encode uploaded images and strip the gain map, leaving you with only the SDR Representation.
|
|
91
|
+
Serve the files yourself, unmodified, to keep the HDR information.
|
|
75
92
|
|
|
76
93
|
```ts
|
|
77
|
-
import {
|
|
94
|
+
import { HDRJPGNodeLoader } from '@monogrid/gainmap-js/webgpu'
|
|
95
|
+
import { equirectUV } from 'three/tsl'
|
|
78
96
|
import {
|
|
79
97
|
EquirectangularReflectionMapping,
|
|
80
98
|
Mesh,
|
|
81
|
-
|
|
99
|
+
MeshBasicNodeMaterial,
|
|
82
100
|
PerspectiveCamera,
|
|
83
101
|
PlaneGeometry,
|
|
84
102
|
Scene,
|
|
85
|
-
|
|
86
|
-
} from 'three'
|
|
87
|
-
|
|
88
|
-
const renderer = new WebGLRenderer()
|
|
103
|
+
WebGPURenderer
|
|
104
|
+
} from 'three/webgpu'
|
|
89
105
|
|
|
90
|
-
const
|
|
91
|
-
|
|
106
|
+
const renderer = new WebGPURenderer()
|
|
107
|
+
await renderer.init()
|
|
92
108
|
|
|
93
|
-
|
|
94
|
-
//
|
|
109
|
+
// no renderer needed, `hdr` is a TSL texture node which can be used right away
|
|
110
|
+
// the image is decoded on the GPU once loaded
|
|
111
|
+
const hdr = new HDRJPGNodeLoader().load('gainmap.jpeg', () => {
|
|
112
|
+
// `hdr.value` is the decoded HDR texture, for APIs requiring a Texture
|
|
113
|
+
// it's kept up to date as long as the node is used in a rendered node graph
|
|
114
|
+
// (here: the plane material and the background), otherwise call `hdr.decode(renderer)`
|
|
115
|
+
// assign it once loaded: the texture gets its final size on load and PMREMs don't follow resizes
|
|
116
|
+
hdr.value.mapping = EquirectangularReflectionMapping
|
|
117
|
+
scene.environment = hdr.value
|
|
118
|
+
})
|
|
95
119
|
|
|
96
120
|
const scene = new Scene()
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
)
|
|
101
|
-
scene.add(mesh)
|
|
102
|
-
renderer.render(scene, new PerspectiveCamera())
|
|
121
|
+
const material = new MeshBasicNodeMaterial()
|
|
122
|
+
material.colorNode = hdr
|
|
123
|
+
scene.add(new Mesh(new PlaneGeometry(), material))
|
|
103
124
|
|
|
104
|
-
//
|
|
105
|
-
|
|
106
|
-
// also be used as Equirectangular scene background
|
|
107
|
-
//
|
|
108
|
-
// it was previously needed to convert it
|
|
109
|
-
// to a DataTexture with `result.toDataTexture()`
|
|
110
|
-
scene.background = result.renderTarget.texture
|
|
125
|
+
// sample with different uvs, e.g. as an equirectangular background
|
|
126
|
+
scene.backgroundNode = hdr.sample(equirectUV())
|
|
111
127
|
|
|
112
|
-
//
|
|
113
|
-
|
|
114
|
-
|
|
128
|
+
// every parameter is a uniform: changing it re-decodes the image (and the environment PMREM) once
|
|
129
|
+
hdr.maxDisplayBoost.value = 2
|
|
130
|
+
|
|
131
|
+
renderer.render(scene, new PerspectiveCamera())
|
|
132
|
+
|
|
133
|
+
// the node must be manually disposed when you are done using it
|
|
134
|
+
hdr.dispose()
|
|
115
135
|
```
|
|
116
136
|
|
|
117
|
-
|
|
137
|
+
#### Using separate files
|
|
118
138
|
|
|
119
139
|
Using separate files will get rid of the limitations of using a single JPEG file but it will force to use three separate files
|
|
120
140
|
|
|
@@ -122,129 +142,92 @@ Using separate files will get rid of the limitations of using a single JPEG file
|
|
|
122
142
|
2. A Gainmap file
|
|
123
143
|
3. A JSON containing the gainmap metadata used for decoding
|
|
124
144
|
|
|
125
|
-
|
|
126
145
|
```ts
|
|
127
|
-
import {
|
|
146
|
+
import { GainMapNodeLoader } from '@monogrid/gainmap-js/webgpu'
|
|
128
147
|
import {
|
|
129
|
-
EquirectangularReflectionMapping,
|
|
130
148
|
Mesh,
|
|
131
|
-
|
|
149
|
+
MeshBasicNodeMaterial,
|
|
132
150
|
PerspectiveCamera,
|
|
133
151
|
PlaneGeometry,
|
|
134
152
|
Scene,
|
|
135
|
-
|
|
136
|
-
} from 'three'
|
|
137
|
-
|
|
138
|
-
const renderer = new WebGLRenderer()
|
|
153
|
+
WebGPURenderer
|
|
154
|
+
} from 'three/webgpu'
|
|
139
155
|
|
|
140
|
-
const
|
|
141
|
-
|
|
156
|
+
const renderer = new WebGPURenderer()
|
|
157
|
+
await renderer.init()
|
|
142
158
|
|
|
143
|
-
const
|
|
144
|
-
|
|
159
|
+
const hdr = new GainMapNodeLoader().load([
|
|
160
|
+
'sdr.webp',
|
|
161
|
+
'gainmap.webp',
|
|
162
|
+
'metadata.json'
|
|
163
|
+
])
|
|
145
164
|
|
|
146
165
|
const scene = new Scene()
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
)
|
|
151
|
-
scene.add(mesh)
|
|
152
|
-
renderer.render(scene, new PerspectiveCamera())
|
|
166
|
+
const material = new MeshBasicNodeMaterial()
|
|
167
|
+
material.colorNode = hdr
|
|
168
|
+
scene.add(new Mesh(new PlaneGeometry(), material))
|
|
153
169
|
|
|
154
|
-
|
|
155
|
-
// `result.renderTarget.texture` can
|
|
156
|
-
// also be used as Equirectangular scene background
|
|
157
|
-
//
|
|
158
|
-
// it was previously needed to convert it
|
|
159
|
-
// to a DataTexture with `result.toDataTexture()`
|
|
160
|
-
scene.background = result.renderTarget.texture
|
|
170
|
+
renderer.render(scene, new PerspectiveCamera())
|
|
161
171
|
|
|
162
|
-
//
|
|
163
|
-
|
|
164
|
-
result.dispose()
|
|
172
|
+
// the node must be manually disposed when you are done using it
|
|
173
|
+
hdr.dispose()
|
|
165
174
|
```
|
|
166
175
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
> NOTE: WebGPU decoding requires three.js r163 or higher and a browser that supports WebGPU
|
|
170
|
-
|
|
171
|
-
The library provides WebGPU-accelerated decoding through the `@monogrid/gainmap-js/webgpu` entry point. WebGPU decoding uses Three.js Shading Language (TSL) and offers improved performance and modern GPU architecture support.
|
|
176
|
+
#### Migrating to upcoming v4.0.0
|
|
172
177
|
|
|
173
|
-
|
|
178
|
+
> [!WARNING]
|
|
179
|
+
> All render target based decoding APIs are deprecated and **will be removed in v4.0.0**,
|
|
180
|
+
> both from the main `@monogrid/gainmap-js` entry point (`WebGLRenderer`) and from `@monogrid/gainmap-js/webgpu`:
|
|
181
|
+
> `HDRJPGLoader`, `JPEGRLoader`, `GainMapLoader`, `decode()` and `GainMapDecoderMaterial` (plus the WebGPU `QuadRenderer`).
|
|
182
|
+
> The loaders and `decode()` log a deprecation warning once when used.
|
|
183
|
+
>
|
|
184
|
+
> From v4.0.0 the node loaders are the only way to decode gain maps.
|
|
174
185
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
Mesh,
|
|
180
|
-
MeshBasicMaterial,
|
|
181
|
-
PerspectiveCamera,
|
|
182
|
-
PlaneGeometry,
|
|
183
|
-
Scene,
|
|
184
|
-
WebGPURenderer
|
|
185
|
-
} from 'three/webgpu'
|
|
186
|
+
If you are using `WebGLRenderer`, switch to `WebGPURenderer` from `three/webgpu`: it falls back to a WebGL2 backend
|
|
187
|
+
where WebGPU is not available, so the node loaders work in the same browsers. Use `new WebGPURenderer({ forceWebGL: true })`
|
|
188
|
+
to keep the WebGL2 backend everywhere. Materials need to be node materials (`MeshBasicNodeMaterial`, `MeshStandardNodeMaterial`, ...),
|
|
189
|
+
or regular materials using `hdr.value` as a texture.
|
|
186
190
|
|
|
187
|
-
|
|
188
|
-
await renderer.init()
|
|
191
|
+
The node loaders are **not a drop-in replacement**: they return a `GainMapNode` instead of a render target.
|
|
189
192
|
|
|
190
|
-
|
|
191
|
-
|
|
193
|
+
| Before (deprecated) | After |
|
|
194
|
+
| --- | --- |
|
|
195
|
+
| `import { ... } from '@monogrid/gainmap-js'` | `import { ... } from '@monogrid/gainmap-js/webgpu'` |
|
|
196
|
+
| `new WebGLRenderer()` | `new WebGPURenderer()` + `await renderer.init()` |
|
|
197
|
+
| `new HDRJPGLoader(renderer)` | `new HDRJPGNodeLoader()`, no renderer |
|
|
198
|
+
| `new GainMapLoader(renderer)` | `new GainMapNodeLoader()`, no renderer |
|
|
199
|
+
| `decode({ sdr, gainMap, renderer, ...metadata })` | `gainMapNode(sdr, gainMap, metadata)` |
|
|
200
|
+
| `await loader.loadAsync(url)` | `loader.load(url)` returns the node right away, `loadAsync` resolves once loaded |
|
|
201
|
+
| `result.renderTarget.texture` | `hdr` in node materials (`material.colorNode = hdr`), `hdr.value` where a `Texture` is needed |
|
|
202
|
+
| `material.map = result.renderTarget.texture` | `material.colorNode = hdr` (or `hdr.sample(uv)`) |
|
|
203
|
+
| `scene.background = result.renderTarget.texture` | `scene.backgroundNode = hdr.sample(equirectUV())` |
|
|
204
|
+
| `setRenderTargetOptions({ mapping })` | `hdr.value.mapping = ...` once loaded |
|
|
205
|
+
| `result.material.maxDisplayBoost = 2; result.render()` | `hdr.maxDisplayBoost.value = 2`, re-decoded on the next frame |
|
|
206
|
+
| `result.toDataTexture()` / `result.toArray()` | `await renderer.readRenderTargetPixelsAsync(hdr.renderTarget, 0, 0, hdr.width, hdr.height)` |
|
|
207
|
+
| `result.dispose()` | `hdr.dispose()` |
|
|
192
208
|
|
|
193
|
-
|
|
194
|
-
|
|
209
|
+
When the node is not part of a rendered node graph (e.g. only `scene.environment = hdr.value` is used),
|
|
210
|
+
call `hdr.decode(renderer)` after load to update its texture.
|
|
195
211
|
|
|
196
|
-
|
|
197
|
-
const mesh = new Mesh(
|
|
198
|
-
new PlaneGeometry(),
|
|
199
|
-
new MeshBasicMaterial({ map: result.renderTarget.texture })
|
|
200
|
-
)
|
|
201
|
-
scene.add(mesh)
|
|
202
|
-
renderer.render(scene, new PerspectiveCamera())
|
|
212
|
+
#### Decoding with WebGLRenderer (deprecated)
|
|
203
213
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
// also be used as Equirectangular scene background
|
|
207
|
-
scene.background = result.renderTarget.texture
|
|
214
|
+
> [!WARNING]
|
|
215
|
+
> Deprecated, will be removed in v4.0.0, see [Migrating to v4.0.0](#migrating-to-v400).
|
|
208
216
|
|
|
209
|
-
|
|
210
|
-
// when you are done using it
|
|
211
|
-
result.dispose()
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
#### Using separate files (WebGPU)
|
|
217
|
+
The main `@monogrid/gainmap-js` entry point exposes `HDRJPGLoader` and `GainMapLoader`, which decode into a `WebGLRenderTarget`.
|
|
215
218
|
|
|
216
219
|
```ts
|
|
217
|
-
import {
|
|
218
|
-
import {
|
|
219
|
-
EquirectangularReflectionMapping,
|
|
220
|
-
Mesh,
|
|
221
|
-
MeshBasicMaterial,
|
|
222
|
-
PerspectiveCamera,
|
|
223
|
-
PlaneGeometry,
|
|
224
|
-
Scene,
|
|
225
|
-
WebGPURenderer
|
|
226
|
-
} from 'three/webgpu'
|
|
220
|
+
import { HDRJPGLoader } from '@monogrid/gainmap-js'
|
|
221
|
+
import { EquirectangularReflectionMapping, Scene, WebGLRenderer } from 'three'
|
|
227
222
|
|
|
228
|
-
const renderer = new
|
|
229
|
-
|
|
223
|
+
const renderer = new WebGLRenderer()
|
|
224
|
+
const scene = new Scene()
|
|
230
225
|
|
|
231
|
-
const
|
|
226
|
+
const result = await new HDRJPGLoader(renderer)
|
|
232
227
|
.setRenderTargetOptions({ mapping: EquirectangularReflectionMapping })
|
|
228
|
+
.loadAsync('gainmap.jpeg')
|
|
229
|
+
// or: await new GainMapLoader(renderer).loadAsync(['sdr.webp', 'gainmap.webp', 'metadata.json'])
|
|
233
230
|
|
|
234
|
-
const result = await loader.loadAsync(['sdr.jpeg', 'gainmap.jpeg', 'metadata.json'])
|
|
235
|
-
// `result` can be used to populate a Texture
|
|
236
|
-
|
|
237
|
-
const scene = new Scene()
|
|
238
|
-
const mesh = new Mesh(
|
|
239
|
-
new PlaneGeometry(),
|
|
240
|
-
new MeshBasicMaterial({ map: result.renderTarget.texture })
|
|
241
|
-
)
|
|
242
|
-
scene.add(mesh)
|
|
243
|
-
renderer.render(scene, new PerspectiveCamera())
|
|
244
|
-
|
|
245
|
-
// Starting from three.js r159
|
|
246
|
-
// `result.renderTarget.texture` can
|
|
247
|
-
// also be used as Equirectangular scene background
|
|
248
231
|
scene.background = result.renderTarget.texture
|
|
249
232
|
|
|
250
233
|
// result must be manually disposed
|
|
@@ -252,13 +235,8 @@ scene.background = result.renderTarget.texture
|
|
|
252
235
|
result.dispose()
|
|
253
236
|
```
|
|
254
237
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
1. **Import path**: Use `@monogrid/gainmap-js/webgpu` instead of `@monogrid/gainmap-js`
|
|
258
|
-
2. **Three.js imports**: Use `three/webgpu` instead of `three`
|
|
259
|
-
3. **Renderer**: Use `WebGPURenderer` instead of `WebGLRenderer`
|
|
260
|
-
4. **Renderer initialization**: Call `await renderer.init()` before using WebGPU renderer
|
|
261
|
-
5. **Async decoding**: The `decode()` function is async in WebGPU
|
|
238
|
+
Other decoding APIs (the `GainMapNode` constructor, the deprecated `decode()` function and render target based
|
|
239
|
+
`HDRJPGLoader` / `GainMapLoader` for `WebGPURenderer`) are documented in the [WIKI](https://github.com/MONOGRID/gainmap-js/wiki).
|
|
262
240
|
|
|
263
241
|
### Encoding
|
|
264
242
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.
|
|
2
|
+
* @monogrid/gainmap-js v3.6.1
|
|
3
3
|
* With ❤️, by MONOGRID <gainmap@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
import{ClampToEdgeWrapping as e,LinearFilter as r,Scene as t,OrthographicCamera as i,HalfFloatType as s,FloatType as a,Mesh as n,PlaneGeometry as h,WebGLRenderTarget as o,RGBAFormat as d,UVMapping as p,WebGLRenderer as _,DataTexture as g,LinearSRGBColorSpace as l,ShaderMaterial as c,Texture as w,MeshBasicMaterial as m,IntType as T,ShortType as u,ByteType as y,UnsignedIntType as f,UnsignedByteType as O}from"three";const b=(e,r,t)=>{let i;switch(e){case O:i=new Uint8ClampedArray(r*t*4);break;case s:i=new Uint16Array(r*t*4);break;case f:i=new Uint32Array(r*t*4);break;case y:i=new Int8Array(r*t*4);break;case u:i=new Int16Array(r*t*4);break;case T:i=new Int32Array(r*t*4);break;case a:i=new Float32Array(r*t*4);break;default:throw new Error("Unsupported data type")}return i};let v;class R{_renderer;_rendererIsDisposable=!1;_material;_scene;_camera;_quad;_renderTarget;_width;_height;_type;_colorSpace;_supportsReadPixels=!0;constructor(_){this._width=_.width,this._height=_.height,this._type=_.type,this._colorSpace=_.colorSpace;const g={format:d,depthBuffer:!1,stencilBuffer:!1,type:this._type,colorSpace:this._colorSpace,anisotropy:void 0!==_.renderTargetOptions?.anisotropy?_.renderTargetOptions?.anisotropy:1,generateMipmaps:void 0!==_.renderTargetOptions?.generateMipmaps&&_.renderTargetOptions?.generateMipmaps,magFilter:void 0!==_.renderTargetOptions?.magFilter?_.renderTargetOptions?.magFilter:r,minFilter:void 0!==_.renderTargetOptions?.minFilter?_.renderTargetOptions?.minFilter:r,samples:void 0!==_.renderTargetOptions?.samples?_.renderTargetOptions?.samples:void 0,wrapS:void 0!==_.renderTargetOptions?.wrapS?_.renderTargetOptions?.wrapS:e,wrapT:void 0!==_.renderTargetOptions?.wrapT?_.renderTargetOptions?.wrapT:e};if(this._material=_.material,_.renderer?this._renderer=_.renderer:(this._renderer=R.instantiateRenderer(),this._rendererIsDisposable=!0),this._scene=new t,this._camera=new i,this._camera.position.set(0,0,10),this._camera.left=-.5,this._camera.right=.5,this._camera.top=.5,this._camera.bottom=-.5,this._camera.updateProjectionMatrix(),!((e,r,t,i)=>{if(void 0!==v)return v;const s=new o(1,1,i);r.setRenderTarget(s);const a=new n(new h,new m({color:16777215}));r.render(a,t),r.setRenderTarget(null);const d=b(e,s.width,s.height);return r.readRenderTargetPixels(s,0,0,s.width,s.height,d),s.dispose(),a.geometry.dispose(),a.material.dispose(),v=0!==d[0],v})(this._type,this._renderer,this._camera,g)){let e;if(this._type===s)e=this._renderer.extensions.has("EXT_color_buffer_float")?a:void 0;void 0!==e?(console.warn(`This browser does not support reading pixels from ${this._type} RenderTargets, switching to ${a}`),this._type=e):(this._supportsReadPixels=!1,console.warn("This browser dos not support toArray or toDataTexture, calls to those methods will result in an error thrown"))}this._quad=new n(new h,this._material),this._quad.geometry.computeBoundingBox(),this._scene.add(this._quad),this._renderTarget=new o(this.width,this.height,g),this._renderTarget.texture.mapping=void 0!==_.renderTargetOptions?.mapping?_.renderTargetOptions?.mapping:p}static instantiateRenderer(){const e=new _;return e.setSize(128,128),e}render=()=>{this._renderer.setRenderTarget(this._renderTarget);try{this._renderer.render(this._scene,this._camera)}catch(e){throw this._renderer.setRenderTarget(null),e}this._renderer.setRenderTarget(null)};toArray(){if(!this._supportsReadPixels)throw new Error("Can't read pixels in this browser");const e=b(this._type,this._width,this._height);return this._renderer.readRenderTargetPixels(this._renderTarget,0,0,this._width,this._height,e),e}toDataTexture(t){const i=new g(this.toArray(),this.width,this.height,d,this._type,t?.mapping||p,t?.wrapS||e,t?.wrapT||e,t?.magFilter||r,t?.minFilter||r,t?.anisotropy||1,l);return i.generateMipmaps=void 0!==t?.generateMipmaps&&t?.generateMipmaps,i}disposeOnDemandRenderer(){this._renderer.setRenderTarget(null),this._rendererIsDisposable&&(this._renderer.dispose(),this._renderer.forceContextLoss())}dispose(e){this.disposeOnDemandRenderer(),e&&this.renderTarget.dispose(),this.material instanceof c&&Object.values(this.material.uniforms).forEach(e=>{e.value instanceof w&&e.value.dispose()}),Object.values(this.material).forEach(e=>{e instanceof w&&e.dispose()}),this.material.dispose(),this._quad.geometry.dispose()}get width(){return this._width}set width(e){this._width=e,this._renderTarget.setSize(this._width,this._height)}get height(){return this._height}set height(e){this._height=e,this._renderTarget.setSize(this._width,this._height)}get renderer(){return this._renderer}get renderTarget(){return this._renderTarget}set renderTarget(e){this._renderTarget=e,this._width=e.width,this._height=e.height}get material(){return this._material}get type(){return this._type}get colorSpace(){return this._colorSpace}}export{R as Q};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.
|
|
2
|
+
* @monogrid/gainmap-js v3.6.1
|
|
3
3
|
* With ❤️, by MONOGRID <gainmap@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function o(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}export{e as c,o as g};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.
|
|
2
|
+
* @monogrid/gainmap-js v3.6.1
|
|
3
3
|
* With ❤️, by MONOGRID <gainmap@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
const e=async e=>{if("undefined"==typeof createImageBitmap)throw new Error("createImageBitmap() not supported.");const{source:t,mimeType:a,quality:n,flipY:r}=e;let o;if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&"sourceMimeType"in e)o=new Blob([t],{type:e.sourceMimeType});else{if(!(t instanceof ImageData))throw new Error("Invalid source image");o=t}const i=await createImageBitmap(o),s=i.width,c=i.height;let f;"undefined"!=typeof OffscreenCanvas?f=new OffscreenCanvas(s,c):(f=document.createElement("canvas"),f.width=s,f.height=c);const m=f.getContext("2d");if(!m)throw new Error("Failed to create canvas Context");!0===r&&(m.translate(0,c),m.scale(1,-1)),m.drawImage(i,0,0,s,c);const w=await(async(e,t,a)=>{if("undefined"!=typeof OffscreenCanvas&&e instanceof OffscreenCanvas)return e.convertToBlob({type:t,quality:a||.9});if(e instanceof HTMLCanvasElement)return new Promise((n,r)=>{e.toBlob(e=>{e?n(e):r(new Error("Failed to convert canvas to blob"))},t,a||.9)});throw new Error("Unsupported canvas element")})(f,a,n||.9);return{data:new Uint8Array(await w.arrayBuffer()),mimeType:a,width:s,height:c}};export{e as c};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @monogrid/gainmap-js v3.
|
|
2
|
+
* @monogrid/gainmap-js v3.6.1
|
|
3
3
|
* With ❤️, by MONOGRID <gainmap@monogrid.com>
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -69,7 +69,6 @@ const compress = async (params) => {
|
|
|
69
69
|
canvas.height = height;
|
|
70
70
|
}
|
|
71
71
|
// apparently we do need to assert the type here for npx tsc to be happy
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
73
72
|
const ctx = canvas.getContext('2d');
|
|
74
73
|
if (!ctx)
|
|
75
74
|
throw new Error('Failed to create canvas Context');
|
|
@@ -4,6 +4,7 @@ export * from './errors/XMPMetadataNotFoundError';
|
|
|
4
4
|
export * from './extract';
|
|
5
5
|
export * from './Loader';
|
|
6
6
|
export * from './types';
|
|
7
|
+
export * from './utils/create-textures';
|
|
7
8
|
export * from './utils/extractISO';
|
|
8
9
|
export * from './utils/extractXMP';
|
|
9
10
|
export * from './utils/MPFExtractor';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Texture } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Decodes the SDR and (optional) gain map JPEG buffers into images
|
|
4
|
+
*
|
|
5
|
+
* @param sdrBuffer
|
|
6
|
+
* @param gainMapBuffer
|
|
7
|
+
* @param imageOrientation
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare const processImages: (sdrBuffer: ArrayBuffer, gainMapBuffer?: ArrayBuffer, imageOrientation?: "flipY" | "from-image") => Promise<{
|
|
11
|
+
sdrImage: ImageBitmap | HTMLImageElement;
|
|
12
|
+
gainMapImage: ImageBitmap | HTMLImageElement | undefined;
|
|
13
|
+
needsFlip: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Creates the SDR (sRGB) and gain map (linear) textures from decoded images
|
|
17
|
+
*
|
|
18
|
+
* @param sdrImage
|
|
19
|
+
* @param gainMapImage
|
|
20
|
+
* @param needsFlip
|
|
21
|
+
* @returns
|
|
22
|
+
*/
|
|
23
|
+
export declare const createTextures: (sdrImage: ImageBitmap | HTMLImageElement, gainMapImage: ImageBitmap | HTMLImageElement | undefined, needsFlip: boolean) => {
|
|
24
|
+
gainMap: Texture;
|
|
25
|
+
sdr: Texture;
|
|
26
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Warns once per API that a render target based decode API is going away in v4.0.0
|
|
3
|
+
*
|
|
4
|
+
* @param name deprecated API
|
|
5
|
+
* @param entry entry point exposing the deprecated API
|
|
6
|
+
* @param replacement node based API replacing it, from `@monogrid/gainmap-js/webgpu`
|
|
7
|
+
*/
|
|
8
|
+
export declare const warnDeprecated: (name: string, entry: "@monogrid/gainmap-js" | "@monogrid/gainmap-js/webgpu", replacement: string) => void;
|
|
@@ -5,6 +5,7 @@ import { GainMapDecoderMaterial } from './materials/GainMapDecoderMaterial';
|
|
|
5
5
|
/**
|
|
6
6
|
* Decodes a gain map using a WebGL RenderTarget
|
|
7
7
|
*
|
|
8
|
+
* @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).
|
|
8
9
|
* @category Decoding Functions
|
|
9
10
|
* @group Decoding Functions
|
|
10
11
|
* @example
|
|
@@ -4,5 +4,9 @@ export * from '../shared';
|
|
|
4
4
|
export * from './decode';
|
|
5
5
|
export * from './loaders/GainMapLoader';
|
|
6
6
|
export * from './loaders/HDRJPGLoader';
|
|
7
|
+
/**
|
|
8
|
+
* Legacy name
|
|
9
|
+
* @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).
|
|
10
|
+
*/
|
|
7
11
|
export { HDRJPGLoader as JPEGRLoader } from './loaders/HDRJPGLoader';
|
|
8
12
|
export * from './materials/GainMapDecoderMaterial';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { HalfFloatType } from 'three';
|
|
1
|
+
import { HalfFloatType, LoadingManager, WebGLRenderer } from 'three';
|
|
2
2
|
import { QuadRenderer } from '../../../core/QuadRenderer';
|
|
3
3
|
import { GainMapDecoderMaterial } from '../materials/GainMapDecoderMaterial';
|
|
4
4
|
import { LoaderBaseWebGL } from './LoaderBaseWebGL';
|
|
5
5
|
/**
|
|
6
6
|
* A Three.js Loader for the gain map format.
|
|
7
7
|
*
|
|
8
|
+
* @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).
|
|
8
9
|
* @category Loaders
|
|
9
10
|
* @group Loaders
|
|
10
11
|
*
|
|
@@ -50,6 +51,7 @@ import { LoaderBaseWebGL } from './LoaderBaseWebGL';
|
|
|
50
51
|
*
|
|
51
52
|
*/
|
|
52
53
|
export declare class GainMapLoader extends LoaderBaseWebGL<[string, string, string]> {
|
|
54
|
+
constructor(renderer?: WebGLRenderer, manager?: LoadingManager);
|
|
53
55
|
/**
|
|
54
56
|
* Loads a gainmap using separate data
|
|
55
57
|
* * sdr image
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { HalfFloatType } from 'three';
|
|
1
|
+
import { HalfFloatType, LoadingManager, WebGLRenderer } from 'three';
|
|
2
2
|
import { QuadRenderer } from '../../../core/QuadRenderer';
|
|
3
3
|
import { GainMapDecoderMaterial } from '../materials/GainMapDecoderMaterial';
|
|
4
4
|
import { LoaderBaseWebGL } from './LoaderBaseWebGL';
|
|
5
5
|
/**
|
|
6
6
|
* A Three.js Loader for a JPEG with embedded gainmap metadata.
|
|
7
7
|
*
|
|
8
|
+
* @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).
|
|
8
9
|
* @category Loaders
|
|
9
10
|
* @group Loaders
|
|
10
11
|
*
|
|
@@ -50,6 +51,7 @@ import { LoaderBaseWebGL } from './LoaderBaseWebGL';
|
|
|
50
51
|
*
|
|
51
52
|
*/
|
|
52
53
|
export declare class HDRJPGLoader extends LoaderBaseWebGL<string> {
|
|
54
|
+
constructor(renderer?: WebGLRenderer, manager?: LoadingManager);
|
|
53
55
|
/**
|
|
54
56
|
* Loads a JPEG containing gain map metadata
|
|
55
57
|
* Renders a normal SDR image if gainmap data is not found
|
|
@@ -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
|
|
6
6
|
*
|
|
7
|
+
* @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).
|
|
7
8
|
* @category Materials
|
|
8
9
|
* @group Materials
|
|
9
10
|
*/
|
|
@@ -40,6 +40,7 @@ export type QuadRendererOptions<TType extends TextureDataType, TMaterial extends
|
|
|
40
40
|
/**
|
|
41
41
|
* Utility class used for rendering a texture with a material (WebGPU version)
|
|
42
42
|
*
|
|
43
|
+
* @deprecated Will be removed in v4.0.0. The WebGPU decode now happens in {@link GainMapNode}, use {@link HDRJPGNodeLoader}, {@link GainMapNodeLoader} or {@link gainMapNode}, see the [migration guide](https://github.com/MONOGRID/gainmap-js#migrating-to-v400).
|
|
43
44
|
* @category Core
|
|
44
45
|
* @group Core
|
|
45
46
|
*/
|
|
@@ -5,6 +5,7 @@ import { GainMapDecoderMaterial } from './materials/GainMapDecoderMaterial';
|
|
|
5
5
|
/**
|
|
6
6
|
* Decodes a gain map using WebGPU RenderTarget
|
|
7
7
|
*
|
|
8
|
+
* @deprecated Will be removed in v4.0.0. Use {@link gainMapNode} 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 Decoding Functions
|
|
9
10
|
* @group Decoding Functions
|
|
10
11
|
* @example
|
|
@@ -3,6 +3,13 @@ export * from '../shared';
|
|
|
3
3
|
export * from './core/QuadRenderer';
|
|
4
4
|
export * from './decode';
|
|
5
5
|
export * from './loaders/GainMapLoader';
|
|
6
|
+
export * from './loaders/GainMapNodeLoader';
|
|
6
7
|
export * from './loaders/HDRJPGLoader';
|
|
8
|
+
export * from './loaders/HDRJPGNodeLoader';
|
|
9
|
+
/**
|
|
10
|
+
* Legacy name
|
|
11
|
+
* @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).
|
|
12
|
+
*/
|
|
7
13
|
export { HDRJPGLoader as JPEGRLoader } from './loaders/HDRJPGLoader';
|
|
8
14
|
export * from './materials/GainMapDecoderMaterial';
|
|
15
|
+
export * from './nodes/GainMapNode';
|
|
@@ -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 the gain map format (WebGPU version).
|
|
7
7
|
*
|
|
8
|
+
* @deprecated Will be removed in v4.0.0. Use {@link GainMapNodeLoader} 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 GainMapLoader extends LoaderBaseWebGPU<[string, string, string]> {
|
|
55
|
+
constructor(renderer?: WebGPURenderer, manager?: LoadingManager);
|
|
54
56
|
/**
|
|
55
57
|
* Loads a gainmap using separate data
|
|
56
58
|
* * sdr image
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { GainMapNode } from '../nodes/GainMapNode';
|
|
2
|
+
import { LoaderBaseNode } from './LoaderBaseNode';
|
|
3
|
+
/**
|
|
4
|
+
* A Three.js Loader for the gain map format stored as separate files (sdr image, gain map image, metadata json),
|
|
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, it can be assigned to materials right away
|
|
8
|
+
* and it is decoded on the GPU once loaded.
|
|
9
|
+
*
|
|
10
|
+
* @category Loaders
|
|
11
|
+
* @group Loaders
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* import { GainMapNodeLoader } from '@monogrid/gainmap-js/webgpu'
|
|
15
|
+
* import { MeshBasicNodeMaterial } from 'three/webgpu'
|
|
16
|
+
*
|
|
17
|
+
* const hdr = new GainMapNodeLoader().load([
|
|
18
|
+
* 'sdr.webp',
|
|
19
|
+
* 'gainmap.webp',
|
|
20
|
+
* 'metadata.json'
|
|
21
|
+
* ])
|
|
22
|
+
*
|
|
23
|
+
* const material = new MeshBasicNodeMaterial()
|
|
24
|
+
* material.colorNode = hdr
|
|
25
|
+
*/
|
|
26
|
+
export declare class GainMapNodeLoader extends LoaderBaseNode<[string, string, string]> {
|
|
27
|
+
/**
|
|
28
|
+
* Loads a gainmap using separate data
|
|
29
|
+
* * sdr image
|
|
30
|
+
* * gain map image
|
|
31
|
+
* * metadata json
|
|
32
|
+
*
|
|
33
|
+
* useful for webp gain maps
|
|
34
|
+
*
|
|
35
|
+
* @param urls An array in the form of [sdr.jpg, gainmap.jpg, metadata.json]
|
|
36
|
+
* @param onLoad Load complete callback, will receive the node
|
|
37
|
+
* @param onProgress Progress callback, will receive a `ProgressEvent`
|
|
38
|
+
* @param onError Error callback
|
|
39
|
+
* @returns a node which can be used immediately, it will hold the image once loaded
|
|
40
|
+
*/
|
|
41
|
+
load(urls: [string, string, string], onLoad?: (data: GainMapNode) => void, onProgress?: (event: ProgressEvent) => void, onError?: (err: unknown) => void): GainMapNode;
|
|
42
|
+
}
|