rayzee 11.12.0 → 11.14.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.
- package/README.md +59 -4
- package/dist/{ArchiveImporter-vUowipjh.js → ArchiveImporter-DBMmDG98.js} +1332 -1295
- package/dist/{BidirectionalIntegrator-DPh6PSYb.js → BidirectionalIntegrator-D6rcU7N1.js} +199 -198
- package/dist/{ColorManagement-3xw0xXRg.js → ColorManagement-D9eYhssc.js} +1083 -547
- package/dist/DepthPass-D4Zh108s.js +68 -0
- package/dist/{EngineIssues-CfJiBaNj.js → EngineIssues-B14FGIHX.js} +1 -0
- package/dist/{NeuralRetouch-wwAwssFM.js → NeuralRetouch-Cyh0AwUT.js} +3 -3
- package/dist/{NeuralSuperRes-DqV4v_gQ.js → NeuralSuperRes-BPp05Ipu.js} +3 -3
- package/dist/{SolarLimb-ZYl-Pwl0.js → PackedRayBuffer-BtJJxs43.js} +3 -7
- package/dist/{PathTracer-DW-ElMON.js → PathTracer-BLV2bVqi.js} +3499 -4243
- package/dist/{PhysicalSky-Ispr77Lf.js → PhysicalSky-VonV_lAD.js} +46 -45
- package/dist/{RayzeeRenderer-CPbY683A.js → RayzeeRenderer-D1NeGoVA.js} +796 -462
- package/dist/{SceneMetadata-BNA22-m3.js → SceneMetadata-BBx6k2EY.js} +1 -1
- package/dist/SolarLimb-DSig_M0f.js +8 -0
- package/dist/TextureBuckets-CcSAhgVc.js +308 -0
- package/dist/TextureSampling-C4Sg4Yw_.js +901 -0
- package/dist/{ToneMapGPU-4GPwoG_c.js → ToneMapGPU-l_79riZd.js} +21 -11
- package/dist/addons/archives.es.js +2 -2
- package/dist/addons/bidirectional.es.js +1 -1
- package/dist/addons/color.es.js +3 -3
- package/dist/addons/formats.es.js +1 -1
- package/dist/addons/physical-sky.es.js +1 -1
- package/dist/addons/storage.es.js +2 -2
- package/dist/encoders.es.js +942 -0
- package/dist/{openStorage-CdyVjmps.js → openStorage-D6DBv9_I.js} +3 -3
- package/dist/rayzee-core.es.js +12 -11
- package/dist/rayzee.es.js +179 -176
- package/dist/rayzee.umd.js +156 -114
- package/dist/{sceneCachePolicy-BLvdjkVh.js → sceneCachePolicy-DcEWCTKO.js} +165 -439
- package/package.json +4 -1
- package/src/Color/BakedViews.js +5 -1
- package/src/Color/BasicColor.js +7 -0
- package/src/Color/ColorManagement.js +64 -42
- package/src/Color/Displays.js +35 -0
- package/src/Color/LutBake.js +163 -9
- package/src/Color/OcioViews.js +508 -55
- package/src/EngineIssues.js +1 -0
- package/src/Processor/ArchiveImporter.js +25 -3
- package/src/Processor/AssetLoader.js +6 -4
- package/src/Processor/ImageEncoders.js +1306 -0
- package/src/Processor/InstanceTable.js +36 -11
- package/src/Processor/PBRT/PBRTCurves.js +6 -3
- package/src/Processor/PBRT/PBRTSceneBuilder.js +26 -3
- package/src/Processor/PBRT/index.js +1 -0
- package/src/Processor/SceneProcessor.js +44 -6
- package/src/Processor/TLASBuilder.js +5 -4
- package/src/Processor/TextureCreator.js +154 -48
- package/src/Processor/ToneMapCPU.js +35 -9
- package/src/Processor/ToneMapGPU.js +52 -6
- package/src/Processor/USD/USDScene.js +6 -1
- package/src/Processor/USD/index.js +2 -2
- package/src/Processor/Workers/TexturesWorker.js +10 -13
- package/src/Processor/utils.js +80 -1
- package/src/RayzeeRenderer.js +303 -36
- package/src/Stages/Compositor.js +112 -18
- package/src/Stages/PathTracer.js +22 -0
- package/src/Stages/PathTracerStage.js +80 -7
- package/src/Storage/SceneGraphCodec.js +17 -2
- package/src/TSL/BVHTraversal.js +1 -1
- package/src/TSL/DepthPass.js +146 -0
- package/src/managers/VideoRenderManager.js +6 -2
- /package/dist/{ActiveColor-YvuQq44O.js → ActiveColor-7CZdmrsz.js} +0 -0
- /package/dist/{AssetConfig-DSEntE65.js → AssetConfig-BY4jDfTH.js} +0 -0
- /package/dist/{BufferLayout-BROyMqO1.js → BufferLayout-SvkefbAs.js} +0 -0
- /package/dist/{FileFormats-sPGJeCRc.js → FileFormats-B_VqIVDq.js} +0 -0
- /package/dist/{ViewTransforms-CYN7bq2w.js → ViewTransforms-Crdom11t.js} +0 -0
- /package/dist/{WorkingMatrix-C6y233hT.js → WorkingMatrix-DWJV2JM2.js} +0 -0
- /package/dist/{ZipReader-gDSWr0I5.js → ZipReader-Bva4oiva.js} +0 -0
- /package/dist/{identity-C1cLD1C0.js → identity-CtOwEU7N.js} +0 -0
- /package/dist/{shared-BGBcSxBQ.js → shared-ubP8eJlr.js} +0 -0
|
@@ -1,83 +1,103 @@
|
|
|
1
1
|
import { r as e } from "./Logger-dDDGj9Av.js";
|
|
2
|
-
import { n as t } from "./EngineIssues-
|
|
3
|
-
import { a as n, n as r, t as i } from "./WorkingMatrix-
|
|
4
|
-
import { i as a, n as o, r as s, t as c } from "./ActiveColor-
|
|
5
|
-
import { n as l } from "./AssetConfig-
|
|
6
|
-
import { _ as u, a as d, c as f, d as p, f as m, g as h, h as g, l as _, m as v, n as y, o as
|
|
7
|
-
import { Fn as
|
|
8
|
-
import { ClampToEdgeWrapping as
|
|
2
|
+
import { n as t } from "./EngineIssues-B14FGIHX.js";
|
|
3
|
+
import { a as n, n as r, t as i } from "./WorkingMatrix-DWJV2JM2.js";
|
|
4
|
+
import { i as a, n as o, r as s, t as c } from "./ActiveColor-7CZdmrsz.js";
|
|
5
|
+
import { n as l } from "./AssetConfig-BY4jDfTH.js";
|
|
6
|
+
import { _ as u, a as d, c as f, d as p, f as m, g as h, h as g, l as _, m as v, n as y, o as b, p as x, u as S } from "./ViewTransforms-Crdom11t.js";
|
|
7
|
+
import { Fn as C, If as w, clamp as T, dot as E, float as D, floor as ee, int as te, ivec3 as O, log2 as ne, max as re, min as ie, mix as ae, sign as oe, step as k, texture3DLoad as se, vec3 as A } from "three/tsl";
|
|
8
|
+
import { ClampToEdgeWrapping as ce, Data3DTexture as le, HalfFloatType as ue, LinearSRGBColorSpace as de, NearestFilter as fe, NoColorSpace as pe, NoToneMapping as me, RGBAFormat as he, SRGBColorSpace as ge } from "three";
|
|
9
9
|
//#region src/Color/Displays.js
|
|
10
|
-
|
|
10
|
+
var _e = [
|
|
11
|
+
"Linear Rec.709 (sRGB)",
|
|
12
|
+
"lin_rec709_srgb",
|
|
13
|
+
"lin_rec709",
|
|
14
|
+
"lin_srgb",
|
|
15
|
+
"Linear Rec.709",
|
|
16
|
+
"Utility - Linear - sRGB",
|
|
17
|
+
"Utility - Linear - Rec.709",
|
|
18
|
+
"Linear BT.709",
|
|
19
|
+
"linrec709"
|
|
20
|
+
], ve = /^(lin(ear)?[\s_-]*(rec\.?\s*|bt\.?\s*)?709|linear[\s_-]*\(?srgb\)?$|utility - linear - (srgb|rec\.?709))/i;
|
|
21
|
+
function j(e) {
|
|
22
|
+
if (!e) return null;
|
|
23
|
+
let t = e.colorSpaces.filter((e) => !e.isData), n = (e) => [e.name, ...e.aliases ?? []];
|
|
24
|
+
for (let e of _e) {
|
|
25
|
+
let r = t.find((t) => n(t).some((t) => t.toLowerCase() === e.toLowerCase()));
|
|
26
|
+
if (r) return r.name;
|
|
27
|
+
}
|
|
28
|
+
return t.find((e) => n(e).some((e) => ve.test(e)))?.name ?? null;
|
|
29
|
+
}
|
|
30
|
+
function M(e) {
|
|
11
31
|
let t = String(e ?? "");
|
|
12
32
|
return /(hdr|pq|hlg|2100|st2084)/i.test(t) ? null : /^display\s*p3\b/i.test(t) ? "display-p3" : /^srgb\b(?!.*(p3|2020))/i.test(t) ? "srgb" : null;
|
|
13
33
|
}
|
|
14
|
-
var
|
|
15
|
-
function
|
|
34
|
+
var ye = new Set(["hdr-video", "edr-video"]), be = /(^|[^a-z])(hdr|pq|hlg|st-?2084|2100)([^a-z]|$)/i;
|
|
35
|
+
function xe(e, t) {
|
|
16
36
|
let n = /* @__PURE__ */ new Map();
|
|
17
37
|
for (let t of e?.colorSpaces ?? []) for (let e of [t.name, ...t.aliases ?? []]) n.set(e, t.encoding);
|
|
18
38
|
let r = (e) => e.colorSpace === "<USE_DISPLAY_NAME>" ? t : e.colorSpace;
|
|
19
39
|
return (e?.views?.[t] ?? []).map((e) => n.get(r(e))).filter(Boolean);
|
|
20
40
|
}
|
|
21
|
-
function
|
|
22
|
-
let n =
|
|
23
|
-
return n.length ? n.some((e) =>
|
|
41
|
+
function N(e, t) {
|
|
42
|
+
let n = xe(e, t);
|
|
43
|
+
return n.length ? n.some((e) => ye.has(e)) : be.test(t);
|
|
24
44
|
}
|
|
25
|
-
var
|
|
26
|
-
function
|
|
45
|
+
var Se = 1e3, P = (e) => String(e).replace(/\([^)]*\)/g, " ").split(/\s+-\s+/)[0].trim().replace(/\s+/g, " ").toLowerCase(), Ce = (e) => e.replace(/\s*\d+(\.\d+)*$/, ""), F = (e) => /\bHDR\b/i.test(e) ? "hdr" : /\bSDR\b/i.test(e) ? "sdr" : null;
|
|
46
|
+
function we(e, t) {
|
|
27
47
|
let n = e.findIndex((e, n) => e !== t[n]);
|
|
28
48
|
return n >= 0 && e[n] < t[n];
|
|
29
49
|
}
|
|
30
|
-
var
|
|
31
|
-
function
|
|
32
|
-
return
|
|
50
|
+
var Te = (e) => new Set((e?.colorSpaces ?? []).filter((e) => e.isData).flatMap((e) => [e.name, ...e.aliases ?? []]));
|
|
51
|
+
function Ee(e, t, n) {
|
|
52
|
+
return Te(e).has(e?.views?.[t]?.find((e) => e.name === n)?.colorSpace);
|
|
33
53
|
}
|
|
34
|
-
function
|
|
35
|
-
return
|
|
54
|
+
function De(e, t) {
|
|
55
|
+
return P(e) === P(t);
|
|
36
56
|
}
|
|
37
|
-
var
|
|
38
|
-
function
|
|
39
|
-
let r =
|
|
57
|
+
var Oe = (e, t) => Ce(P(e)) === Ce(P(t));
|
|
58
|
+
function ke(e, t, n) {
|
|
59
|
+
let r = F(t), i = Number(/(\d+)\s*nits/i.exec(t)?.[1] ?? Se);
|
|
40
60
|
return [
|
|
41
|
-
|
|
61
|
+
P(t) === P(e) ? 0 : 1,
|
|
42
62
|
(n ? r === "hdr" : r !== "hdr") ? 0 : 1,
|
|
43
63
|
t === e ? 0 : 1,
|
|
44
|
-
n ? Math.abs(Math.log2(i /
|
|
64
|
+
n ? Math.abs(Math.log2(i / Se)) : 0,
|
|
45
65
|
+!/p3/i.test(t)
|
|
46
66
|
];
|
|
47
67
|
}
|
|
48
|
-
function
|
|
49
|
-
let r =
|
|
68
|
+
function Ae(e, t, n) {
|
|
69
|
+
let r = Te(e), i = N(e, n), a = null;
|
|
50
70
|
for (let o of e?.views?.[n] ?? []) {
|
|
51
|
-
if (r.has(o.colorSpace) || !
|
|
52
|
-
let e =
|
|
53
|
-
(!a ||
|
|
71
|
+
if (r.has(o.colorSpace) || !Oe(t, o.name)) continue;
|
|
72
|
+
let e = ke(t, o.name, i);
|
|
73
|
+
(!a || we(e, a.rank)) && (a = {
|
|
54
74
|
view: o.name,
|
|
55
75
|
rank: e
|
|
56
76
|
});
|
|
57
77
|
}
|
|
58
78
|
return a;
|
|
59
79
|
}
|
|
60
|
-
function
|
|
61
|
-
if (
|
|
62
|
-
let t =
|
|
80
|
+
function je(e, t, n, r) {
|
|
81
|
+
if (Ee(e, t, n)) {
|
|
82
|
+
let t = Te(e);
|
|
63
83
|
return e?.views?.[r]?.find((e) => t.has(e.colorSpace))?.name ?? null;
|
|
64
84
|
}
|
|
65
|
-
return
|
|
85
|
+
return Ae(e, n, r)?.view ?? null;
|
|
66
86
|
}
|
|
67
|
-
function
|
|
68
|
-
if (
|
|
69
|
-
if (
|
|
87
|
+
function Me(e, t, n) {
|
|
88
|
+
if (Ee(e, t, n)) return null;
|
|
89
|
+
if (N(e, t)) return {
|
|
70
90
|
display: t,
|
|
71
91
|
view: n
|
|
72
92
|
};
|
|
73
|
-
if (
|
|
93
|
+
if (F(n) === "hdr") return null;
|
|
74
94
|
let r = null;
|
|
75
95
|
for (let t of e?.displays ?? []) {
|
|
76
|
-
if (!
|
|
77
|
-
let i =
|
|
78
|
-
if (!i ||
|
|
79
|
-
let o = [...i.rank,
|
|
80
|
-
(!r ||
|
|
96
|
+
if (!N(e, t)) continue;
|
|
97
|
+
let i = Ae(e, n, t), a = F(i?.view) === null;
|
|
98
|
+
if (!i || F(i.view) === "sdr" || a && (i.rank[0] || F(n) !== null)) continue;
|
|
99
|
+
let o = [...i.rank, xe(e, t).includes("edr-video") ? 0 : /pq|st-?2084/i.test(t) ? 1 : 2];
|
|
100
|
+
(!r || we(o, r.rank)) && (r = {
|
|
81
101
|
display: t,
|
|
82
102
|
view: i.view,
|
|
83
103
|
rank: o
|
|
@@ -90,13 +110,13 @@ function je(e, t, n) {
|
|
|
90
110
|
}
|
|
91
111
|
//#endregion
|
|
92
112
|
//#region src/Color/OcioRuntime.js
|
|
93
|
-
var
|
|
94
|
-
function
|
|
113
|
+
var Ne = e("ocio");
|
|
114
|
+
function Pe(e) {
|
|
95
115
|
let t = String(e);
|
|
96
|
-
/\[OpenColorIO Error\]/.test(t) ?
|
|
116
|
+
/\[OpenColorIO Error\]/.test(t) ? Ne.error(t) : /\[OpenColorIO Warning\]/.test(t) ? Ne.warn(t) : Ne.debug(t);
|
|
97
117
|
}
|
|
98
|
-
var
|
|
99
|
-
async function
|
|
118
|
+
var Fe = null, I = null, L = null, Ie = null, R = null;
|
|
119
|
+
async function Le() {
|
|
100
120
|
let { ocioRuntimeFactory: e, ocioRuntimeUrl: t } = l();
|
|
101
121
|
if (typeof e == "function") return await e();
|
|
102
122
|
if (typeof t == "string" && t) return await import(
|
|
@@ -105,28 +125,28 @@ async function Pe() {
|
|
|
105
125
|
);
|
|
106
126
|
throw Error("OpenColorIO runtime not configured. Call configureAssets({ ocioRuntimeFactory: () => import('@bb-studio/ocio') }) before loading a config.");
|
|
107
127
|
}
|
|
108
|
-
async function
|
|
109
|
-
return
|
|
110
|
-
let e = await
|
|
128
|
+
async function Re() {
|
|
129
|
+
return I || (Fe ||= (async () => {
|
|
130
|
+
let e = await Le();
|
|
111
131
|
if (typeof e.createOcioRuntime != "function") throw Error("OCIO module has no createOcioRuntime() — wrong package or version");
|
|
112
132
|
let { ocioWasmUrl: t } = l();
|
|
113
|
-
return
|
|
133
|
+
return I = await e.createOcioRuntime({
|
|
114
134
|
...t ? { wasmUrl: t } : {},
|
|
115
135
|
moduleOptions: {
|
|
116
|
-
print:
|
|
117
|
-
printErr:
|
|
136
|
+
print: Pe,
|
|
137
|
+
printErr: Pe
|
|
118
138
|
}
|
|
119
|
-
}),
|
|
139
|
+
}), I;
|
|
120
140
|
})().catch((e) => {
|
|
121
|
-
throw
|
|
122
|
-
}), await
|
|
141
|
+
throw Fe = null, e;
|
|
142
|
+
}), await Fe);
|
|
123
143
|
}
|
|
124
|
-
async function
|
|
125
|
-
return (await
|
|
144
|
+
async function ze() {
|
|
145
|
+
return (await Re()).ocio.listBuiltinConfigs();
|
|
126
146
|
}
|
|
127
|
-
async function
|
|
128
|
-
let a = await
|
|
129
|
-
if (e)
|
|
147
|
+
async function Be({ builtin: e, text: t, files: n = [], configPath: r = "config.ocio", id: i } = {}) {
|
|
148
|
+
let a = await Re();
|
|
149
|
+
if (e) L = a.loadBuiltinConfig(e), Ie = e, R = Ue(a, e);
|
|
130
150
|
else {
|
|
131
151
|
let e = n.map((e) => ({
|
|
132
152
|
relativePath: e.relativePath ?? e.path ?? e.name,
|
|
@@ -136,45 +156,45 @@ async function Le({ builtin: e, text: t, files: n = [], configPath: r = "config.
|
|
|
136
156
|
relativePath: r,
|
|
137
157
|
data: new TextEncoder().encode(t)
|
|
138
158
|
}), !e.some((e) => e.relativePath === r)) throw Error(`config package has no "${r}" — pass configPath to name the .ocio file`);
|
|
139
|
-
|
|
159
|
+
L = a.loadConfigPackage({
|
|
140
160
|
configRelativePath: r,
|
|
141
161
|
files: e
|
|
142
|
-
}, i ? { id: i } : void 0),
|
|
162
|
+
}, i ? { id: i } : void 0), Ie = i ?? L.id;
|
|
143
163
|
let o = e.find((e) => e.relativePath === r);
|
|
144
|
-
|
|
164
|
+
R = o ? new TextDecoder().decode(o.data) : null;
|
|
145
165
|
}
|
|
146
|
-
return
|
|
166
|
+
return H();
|
|
147
167
|
}
|
|
148
|
-
function
|
|
149
|
-
|
|
168
|
+
function Ve() {
|
|
169
|
+
L = null, Ie = null, R = null;
|
|
150
170
|
}
|
|
151
|
-
function
|
|
152
|
-
return
|
|
171
|
+
function z() {
|
|
172
|
+
return L !== null;
|
|
153
173
|
}
|
|
154
|
-
function
|
|
155
|
-
return
|
|
174
|
+
function B() {
|
|
175
|
+
return L ? I : null;
|
|
156
176
|
}
|
|
157
|
-
function
|
|
158
|
-
return
|
|
177
|
+
function V() {
|
|
178
|
+
return L;
|
|
159
179
|
}
|
|
160
|
-
function
|
|
161
|
-
return
|
|
180
|
+
function He() {
|
|
181
|
+
return R;
|
|
162
182
|
}
|
|
163
|
-
function
|
|
164
|
-
if (!
|
|
165
|
-
let e = Object.fromEntries(
|
|
183
|
+
function H() {
|
|
184
|
+
if (!L) return null;
|
|
185
|
+
let e = Object.fromEntries(L.roles.map((e) => [e.name, e.colorSpace]));
|
|
166
186
|
return {
|
|
167
|
-
id:
|
|
168
|
-
name:
|
|
169
|
-
ocioVersion:
|
|
170
|
-
version:
|
|
187
|
+
id: Ie,
|
|
188
|
+
name: R?.match(/^name:\s*(\S.*?)\s*$/m)?.[1] ?? null,
|
|
189
|
+
ocioVersion: L.ocioVersion,
|
|
190
|
+
version: L.version,
|
|
171
191
|
roles: e,
|
|
172
192
|
sceneLinear: e.scene_linear ?? null,
|
|
173
193
|
colorPicking: e.color_picking ?? e.texture_paint ?? null,
|
|
174
194
|
texturePaint: e.texture_paint ?? e.color_picking ?? null,
|
|
175
195
|
data: e.data ?? null,
|
|
176
196
|
compositingLog: e.compositing_log ?? e.color_timing ?? null,
|
|
177
|
-
colorSpaces:
|
|
197
|
+
colorSpaces: L.colorSpaces.map((e) => ({
|
|
178
198
|
name: e.name,
|
|
179
199
|
family: e.family,
|
|
180
200
|
categories: e.categories ?? [],
|
|
@@ -183,25 +203,25 @@ function I() {
|
|
|
183
203
|
aliases: e.aliases,
|
|
184
204
|
description: e.description
|
|
185
205
|
})),
|
|
186
|
-
displays:
|
|
187
|
-
defaultDisplay:
|
|
188
|
-
views: Object.fromEntries(Object.entries(
|
|
206
|
+
displays: L.displays.slice(),
|
|
207
|
+
defaultDisplay: L.defaultDisplay,
|
|
208
|
+
views: Object.fromEntries(Object.entries(L.viewsByDisplay).map(([e, t]) => [e, t.map((e) => ({
|
|
189
209
|
name: e.name,
|
|
190
210
|
transform: e.transform,
|
|
191
211
|
colorSpace: e.colorSpace,
|
|
192
212
|
looks: e.looks,
|
|
193
213
|
description: e.description
|
|
194
214
|
}))])),
|
|
195
|
-
defaultViews: { ...
|
|
196
|
-
looks:
|
|
215
|
+
defaultViews: { ...L.defaultViewsByDisplay },
|
|
216
|
+
looks: L.looks.map((e) => ({
|
|
197
217
|
name: e.name,
|
|
198
218
|
processSpace: e.processSpace,
|
|
199
219
|
description: e.description,
|
|
200
220
|
forward: e.hasForwardTransform,
|
|
201
221
|
inverse: e.hasInverseTransform
|
|
202
222
|
})),
|
|
203
|
-
namedTransforms:
|
|
204
|
-
fileRules:
|
|
223
|
+
namedTransforms: L.namedTransforms.map((e) => e.name),
|
|
224
|
+
fileRules: L.fileRules.map((e) => ({
|
|
205
225
|
index: e.index,
|
|
206
226
|
name: e.name,
|
|
207
227
|
colorSpace: e.colorSpace,
|
|
@@ -209,19 +229,19 @@ function I() {
|
|
|
209
229
|
extension: e.extension,
|
|
210
230
|
regex: e.regex
|
|
211
231
|
})),
|
|
212
|
-
contextVariables:
|
|
232
|
+
contextVariables: We()
|
|
213
233
|
};
|
|
214
234
|
}
|
|
215
|
-
function
|
|
235
|
+
function Ue(e, t) {
|
|
216
236
|
for (let n of [t, t.replace(/^ocio:\/\//, "")]) try {
|
|
217
237
|
let t = e.ocio.getBuiltinConfigYaml(n);
|
|
218
238
|
if (t) return t;
|
|
219
239
|
} catch {}
|
|
220
240
|
return null;
|
|
221
241
|
}
|
|
222
|
-
function
|
|
223
|
-
if (!
|
|
224
|
-
let e = /* @__PURE__ */ new Map(), t =
|
|
242
|
+
function We() {
|
|
243
|
+
if (!R) return [];
|
|
244
|
+
let e = /* @__PURE__ */ new Map(), t = R.split(/\r?\n/), n = t.findIndex((e) => /^environment:\s*(\{\s*\})?\s*$/.test(e));
|
|
225
245
|
if (n >= 0 && !/\{\s*\}/.test(t[n])) for (let r = n + 1; r < t.length; r++) {
|
|
226
246
|
let n = t[r];
|
|
227
247
|
if (/^\S/.test(n)) break;
|
|
@@ -232,99 +252,99 @@ function Ve() {
|
|
|
232
252
|
declared: !0
|
|
233
253
|
});
|
|
234
254
|
}
|
|
235
|
-
for (let t of
|
|
255
|
+
for (let t of R.matchAll(/\$\{?([A-Za-z_][A-Za-z0-9_]*)\}?/g)) e.has(t[1]) || e.set(t[1], {
|
|
236
256
|
name: t[1],
|
|
237
257
|
default: null,
|
|
238
258
|
declared: !1
|
|
239
259
|
});
|
|
240
260
|
return [...e.values()].sort((e, t) => e.name.localeCompare(t.name));
|
|
241
261
|
}
|
|
242
|
-
function
|
|
243
|
-
|
|
262
|
+
function Ge() {
|
|
263
|
+
Ve(), I?.dispose?.(), I = null, Fe = null;
|
|
244
264
|
}
|
|
245
265
|
//#endregion
|
|
246
266
|
//#region src/Color/ColorSpaces.js
|
|
247
|
-
var
|
|
248
|
-
function
|
|
267
|
+
var U = 1 << 20, Ke = /* @__PURE__ */ new Map(), W = /* @__PURE__ */ new Map(), qe = 4096, G = /* @__PURE__ */ new Map();
|
|
268
|
+
function Je(e, t, n) {
|
|
249
269
|
return `${e}\u0000${t}\u0000${n ? JSON.stringify(n) : ""}`;
|
|
250
270
|
}
|
|
251
|
-
function
|
|
252
|
-
for (let e of
|
|
253
|
-
|
|
271
|
+
function Ye() {
|
|
272
|
+
for (let e of Ke.values()) e.dispose?.();
|
|
273
|
+
Ke.clear(), W.clear(), G.clear();
|
|
254
274
|
}
|
|
255
|
-
function
|
|
256
|
-
if (!
|
|
257
|
-
let r =
|
|
275
|
+
function Xe(e, t, { context: n = null } = {}) {
|
|
276
|
+
if (!B() || e === t) return null;
|
|
277
|
+
let r = Je(e, t, n), i = Ke.get(r);
|
|
258
278
|
if (i !== void 0) return i;
|
|
259
279
|
try {
|
|
260
|
-
i =
|
|
280
|
+
i = $e().createColorSpaceProcessor(e, t, n ? { context: n } : void 0), i.isNoOp && (i.dispose(), i = null);
|
|
261
281
|
} catch (n) {
|
|
262
282
|
throw Error(`no OCIO transform from "${e}" to "${t}": ${n.message}`);
|
|
263
283
|
}
|
|
264
|
-
return
|
|
284
|
+
return Ke.set(r, i), i;
|
|
265
285
|
}
|
|
266
|
-
var
|
|
267
|
-
function
|
|
268
|
-
let e =
|
|
286
|
+
var K = null, Ze = null, Qe = !1;
|
|
287
|
+
function $e() {
|
|
288
|
+
let e = B();
|
|
269
289
|
if (!e) throw Error("no OCIO config loaded");
|
|
270
290
|
if (e.config) return e.config;
|
|
271
|
-
let t =
|
|
272
|
-
if (
|
|
273
|
-
if (
|
|
274
|
-
return
|
|
291
|
+
let t = V();
|
|
292
|
+
if (K && Ze === t.id) return K;
|
|
293
|
+
if (Qe && K?.dispose?.(), !t.id?.startsWith("ocio://")) throw Error("OCIO runtime exposes no Config handle for this config");
|
|
294
|
+
return K = e.ocio.createBuiltinConfig(t.id), Qe = !0, Ze = t.id, K;
|
|
275
295
|
}
|
|
276
|
-
function
|
|
277
|
-
|
|
296
|
+
function et() {
|
|
297
|
+
Qe && K?.dispose?.(), K = null, Ze = null, Qe = !1, Ye();
|
|
278
298
|
}
|
|
279
|
-
function
|
|
280
|
-
let i =
|
|
299
|
+
function tt(e, t, n, { context: r = null } = {}) {
|
|
300
|
+
let i = B();
|
|
281
301
|
if (!i || t === n) return [
|
|
282
302
|
e[0],
|
|
283
303
|
e[1],
|
|
284
304
|
e[2]
|
|
285
305
|
];
|
|
286
|
-
let a = `${
|
|
306
|
+
let a = `${Je(t, n, r)}\u0000${e[0]},${e[1]},${e[2]}`, o = W.get(a);
|
|
287
307
|
if (o) return o.slice();
|
|
288
308
|
let s = i.transformRgb(t, n, [
|
|
289
309
|
e[0],
|
|
290
310
|
e[1],
|
|
291
311
|
e[2]
|
|
292
312
|
], r ? { context: r } : void 0);
|
|
293
|
-
return
|
|
313
|
+
return W.size >= qe && W.clear(), W.set(a, s), s.slice();
|
|
294
314
|
}
|
|
295
|
-
function
|
|
315
|
+
function q(e, t, n, { context: r = null } = {}) {
|
|
296
316
|
if (e.length % 4 != 0) throw Error("convertPixelsF32 wants 4 floats per pixel");
|
|
297
|
-
let i =
|
|
317
|
+
let i = Xe(t, n, { context: r });
|
|
298
318
|
if (!i) return e;
|
|
299
319
|
let a = e.length / 4;
|
|
300
|
-
if (a <=
|
|
301
|
-
for (let t = 0; t < a; t +=
|
|
302
|
-
let n = Math.min(
|
|
320
|
+
if (a <= U) return i.applyRGBAF32(e), e;
|
|
321
|
+
for (let t = 0; t < a; t += U) {
|
|
322
|
+
let n = Math.min(U, a - t);
|
|
303
323
|
i.applyRGBAF32(e.subarray(t * 4, (t + n) * 4));
|
|
304
324
|
}
|
|
305
325
|
return e;
|
|
306
326
|
}
|
|
307
|
-
var
|
|
308
|
-
function
|
|
309
|
-
return e <= .04045 ? e / 12.92 : ((e +
|
|
327
|
+
var nt = .055;
|
|
328
|
+
function rt(e) {
|
|
329
|
+
return e <= .04045 ? e / 12.92 : ((e + nt) / (1 + nt)) ** 2.4;
|
|
310
330
|
}
|
|
311
|
-
function
|
|
312
|
-
return e <= 0 ? 0 : e <= .0031308 ? 12.92 * e : (1 +
|
|
331
|
+
function it(e) {
|
|
332
|
+
return e <= 0 ? 0 : e <= .0031308 ? 12.92 * e : (1 + nt) * e ** (1 / 2.4) - nt;
|
|
313
333
|
}
|
|
314
|
-
var
|
|
315
|
-
for (let e = 0; e < 256; e++)
|
|
316
|
-
var
|
|
317
|
-
for (let e = 0; e < 256; e++)
|
|
318
|
-
function
|
|
319
|
-
return e === "srgb" ?
|
|
334
|
+
var at = new Float32Array(256);
|
|
335
|
+
for (let e = 0; e < 256; e++) at[e] = rt(e / 255);
|
|
336
|
+
var ot = new Float32Array(256);
|
|
337
|
+
for (let e = 0; e < 256; e++) ot[e] = e / 255;
|
|
338
|
+
function st(e) {
|
|
339
|
+
return e === "srgb" ? at : ot;
|
|
320
340
|
}
|
|
321
|
-
function
|
|
341
|
+
function ct(e, t, n, { context: r = null, inputEncoding: i = "raw", outputEncoding: a = "srgb" } = {}) {
|
|
322
342
|
if (e.length % 4 != 0) throw Error("convertEncodedRGBA8 wants 4 bytes per pixel");
|
|
323
|
-
let o =
|
|
343
|
+
let o = Xe(t, n, { context: r });
|
|
324
344
|
if (!o) return e;
|
|
325
|
-
let s = e.length / 4, c =
|
|
326
|
-
for (let t = 0; t < s; t +=
|
|
327
|
-
let n = Math.min(
|
|
345
|
+
let s = e.length / 4, c = st(i), l = a === "srgb" ? dt : ft, u = new Float32Array(Math.min(U, s) * 4);
|
|
346
|
+
for (let t = 0; t < s; t += U) {
|
|
347
|
+
let n = Math.min(U, s - t), r = n * 4 === u.length ? u : u.subarray(0, n * 4);
|
|
328
348
|
for (let i = 0; i < n; i++) {
|
|
329
349
|
let n = (t + i) * 4, a = i * 4;
|
|
330
350
|
r[a] = c[e[n]], r[a + 1] = c[e[n + 1]], r[a + 2] = c[e[n + 2]], r[a + 3] = 1;
|
|
@@ -337,28 +357,28 @@ function nt(e, t, n, { context: r = null, inputEncoding: i = "raw", outputEncodi
|
|
|
337
357
|
}
|
|
338
358
|
return e;
|
|
339
359
|
}
|
|
340
|
-
var
|
|
341
|
-
for (let e = 0; e <=
|
|
342
|
-
let t = e /
|
|
343
|
-
|
|
360
|
+
var lt = 65536, ut = new Uint8Array(lt + 1);
|
|
361
|
+
for (let e = 0; e <= lt; e++) {
|
|
362
|
+
let t = e / lt;
|
|
363
|
+
ut[e] = Math.round(it(t * t) * 255);
|
|
344
364
|
}
|
|
345
|
-
function
|
|
346
|
-
return e > 0 ? e >= 1 ? 255 :
|
|
365
|
+
function dt(e) {
|
|
366
|
+
return e > 0 ? e >= 1 ? 255 : ut[Math.sqrt(e) * lt + .5 | 0] : 0;
|
|
347
367
|
}
|
|
348
|
-
function
|
|
368
|
+
function ft(e) {
|
|
349
369
|
return e > 0 ? e >= 1 ? 255 : e * 255 + .5 | 0 : 0;
|
|
350
370
|
}
|
|
351
|
-
function
|
|
371
|
+
function pt(e, t, n = "srgb") {
|
|
352
372
|
if (!t) return e;
|
|
353
|
-
let r =
|
|
373
|
+
let r = st(n), i = n === "srgb" ? dt : ft, [a, o, s, c, l, u, d, f, p] = t;
|
|
354
374
|
for (let t = 0; t < e.length; t += 4) {
|
|
355
375
|
let n = r[e[t]], m = r[e[t + 1]], h = r[e[t + 2]];
|
|
356
376
|
e[t] = i(a * n + o * m + s * h), e[t + 1] = i(c * n + l * m + u * h), e[t + 2] = i(d * n + f * m + p * h);
|
|
357
377
|
}
|
|
358
378
|
return e;
|
|
359
379
|
}
|
|
360
|
-
function
|
|
361
|
-
if (!
|
|
380
|
+
function mt(e, t, { context: n = null, tolerance: r = 1e-4 } = {}) {
|
|
381
|
+
if (!B()) return null;
|
|
362
382
|
if (e === t) return [
|
|
363
383
|
1,
|
|
364
384
|
0,
|
|
@@ -370,10 +390,10 @@ function st(e, t, { context: n = null, tolerance: r = 1e-4 } = {}) {
|
|
|
370
390
|
0,
|
|
371
391
|
1
|
|
372
392
|
];
|
|
373
|
-
let i =
|
|
374
|
-
if (
|
|
375
|
-
let a =
|
|
376
|
-
if (!a) return
|
|
393
|
+
let i = Je(e, t, n);
|
|
394
|
+
if (G.has(i)) return G.get(i);
|
|
395
|
+
let a = Xe(e, t, { context: n });
|
|
396
|
+
if (!a) return G.set(i, [
|
|
377
397
|
1,
|
|
378
398
|
0,
|
|
379
399
|
0,
|
|
@@ -383,7 +403,7 @@ function st(e, t, { context: n = null, tolerance: r = 1e-4 } = {}) {
|
|
|
383
403
|
0,
|
|
384
404
|
0,
|
|
385
405
|
1
|
|
386
|
-
]),
|
|
406
|
+
]), G.get(i);
|
|
387
407
|
let o = (e) => {
|
|
388
408
|
let t = new Float32Array([
|
|
389
409
|
e[0],
|
|
@@ -464,36 +484,36 @@ function st(e, t, { context: n = null, tolerance: r = 1e-4 } = {}) {
|
|
|
464
484
|
if (!d) break;
|
|
465
485
|
}
|
|
466
486
|
let f = d ? c : null;
|
|
467
|
-
return
|
|
487
|
+
return G.set(i, f), f;
|
|
468
488
|
}
|
|
469
|
-
function
|
|
470
|
-
let t =
|
|
489
|
+
function ht(e) {
|
|
490
|
+
let t = V();
|
|
471
491
|
if (!t) return !1;
|
|
472
492
|
let n = t.colorSpaces.find((t) => t.name === e || t.aliases?.includes(e));
|
|
473
493
|
return n ? n.isData : !1;
|
|
474
494
|
}
|
|
475
|
-
function
|
|
476
|
-
let t =
|
|
495
|
+
function J(e) {
|
|
496
|
+
let t = V();
|
|
477
497
|
return !t || !e ? !1 : t.colorSpaces.some((t) => t.name === e || t.aliases?.includes(e));
|
|
478
498
|
}
|
|
479
499
|
//#endregion
|
|
480
500
|
//#region src/Color/LutBake.js
|
|
481
|
-
var
|
|
482
|
-
function
|
|
501
|
+
var gt = 1e-10;
|
|
502
|
+
function _t(e, t, n, r) {
|
|
483
503
|
return e <= 0 ? 0 : 2 ** (n + e / (t - 1) * (r - n));
|
|
484
504
|
}
|
|
485
|
-
function
|
|
486
|
-
let i = (Math.log2(Math.max(e,
|
|
505
|
+
function vt(e, t, n, r) {
|
|
506
|
+
let i = (Math.log2(Math.max(e, gt)) - n) / (r - n);
|
|
487
507
|
return Math.min(Math.max(i, 0), 1) * (t - 1);
|
|
488
508
|
}
|
|
489
|
-
function
|
|
509
|
+
function yt({ size: e, minEv: t, maxEv: n, apply: r }) {
|
|
490
510
|
let i = e * e * e, a = new Float32Array(i * 4), o = new Float64Array(e);
|
|
491
|
-
for (let r = 0; r < e; r++) o[r] =
|
|
511
|
+
for (let r = 0; r < e; r++) o[r] = _t(r, e, t, n);
|
|
492
512
|
let s = 0;
|
|
493
513
|
for (let t = 0; t < e; t++) for (let n = 0; n < e; n++) for (let r = 0; r < e; r++) a[s++] = o[r], a[s++] = o[n], a[s++] = o[t], a[s++] = 1;
|
|
494
514
|
return r(a), a;
|
|
495
515
|
}
|
|
496
|
-
function
|
|
516
|
+
function bt(e) {
|
|
497
517
|
let t = new Uint16Array(e.length), n = new Float32Array(1), r = new Uint32Array(n.buffer);
|
|
498
518
|
for (let i = 0; i < e.length; i++) {
|
|
499
519
|
n[0] = e[i];
|
|
@@ -510,23 +530,23 @@ function pt(e) {
|
|
|
510
530
|
}
|
|
511
531
|
return t;
|
|
512
532
|
}
|
|
513
|
-
function
|
|
533
|
+
function xt(e, t = new Float32Array(e.length)) {
|
|
514
534
|
for (let n = 0; n < e.length; n++) {
|
|
515
535
|
let r = e[n], i = r & 32768 ? -1 : 1, a = (r & 31744) >> 10, o = r & 1023;
|
|
516
536
|
a === 0 ? t[n] = i * 2 ** -14 * (o / 1024) : a === 31 ? t[n] = o ? NaN : i * Infinity : t[n] = i * 2 ** (a - 15) * (1 + o / 1024);
|
|
517
537
|
}
|
|
518
538
|
return t;
|
|
519
539
|
}
|
|
520
|
-
var
|
|
521
|
-
function
|
|
522
|
-
if (!
|
|
540
|
+
var St = null;
|
|
541
|
+
function Ct() {
|
|
542
|
+
if (!St) {
|
|
523
543
|
let e = new Uint16Array(65536);
|
|
524
544
|
for (let t = 0; t < 65536; t++) e[t] = t;
|
|
525
|
-
|
|
545
|
+
St = xt(e);
|
|
526
546
|
}
|
|
527
|
-
return
|
|
547
|
+
return St;
|
|
528
548
|
}
|
|
529
|
-
function
|
|
549
|
+
function wt(e, t, n) {
|
|
530
550
|
return e > t ? t > n ? {
|
|
531
551
|
w: [
|
|
532
552
|
e,
|
|
@@ -667,34 +687,97 @@ function _t(e, t, n) {
|
|
|
667
687
|
]
|
|
668
688
|
};
|
|
669
689
|
}
|
|
670
|
-
function
|
|
671
|
-
let
|
|
672
|
-
return
|
|
673
|
-
|
|
690
|
+
function Tt(e) {
|
|
691
|
+
let t = Math.abs(e), n = t <= .0031308 ? 12.92 * t : 1.055 * t ** (1 / 2.4) - .055;
|
|
692
|
+
return e < 0 ? -n : n;
|
|
693
|
+
}
|
|
694
|
+
function Et(e) {
|
|
695
|
+
let t = Math.abs(e), n = t <= .04045 ? t / 12.92 : ((t + .055) / 1.055) ** 2.4;
|
|
696
|
+
return e < 0 ? -n : n;
|
|
697
|
+
}
|
|
698
|
+
function Dt(e, t) {
|
|
699
|
+
return Math.ceil(e / (t * t));
|
|
700
|
+
}
|
|
701
|
+
function Ot({ n: e, lo: t, hi: n, apply: r }) {
|
|
702
|
+
let i = new Float32Array(e * 4);
|
|
703
|
+
for (let r = 0; r < e; r++) {
|
|
704
|
+
let a = t + (n - t) * r / (e - 1);
|
|
705
|
+
i.set([
|
|
706
|
+
a,
|
|
707
|
+
a,
|
|
708
|
+
a,
|
|
709
|
+
1
|
|
710
|
+
], r * 4);
|
|
711
|
+
}
|
|
712
|
+
return r(i), i;
|
|
713
|
+
}
|
|
714
|
+
function kt({ data: e, size: t, minEv: n, maxEv: r, curve: i = null, linear: a = !1, clip: o = null, pre: s = null }) {
|
|
715
|
+
let c = t * t, l = t - 1, u = e instanceof Uint16Array, d = u ? Ct() : null, f = u ? (n, r, i, a) => d[e[(n + r * t + i * c) * 4 + a]] : (n, r, i, a) => e[(n + r * t + i * c) * 4 + a];
|
|
716
|
+
return function(p, m, h, g) {
|
|
717
|
+
if (s) {
|
|
718
|
+
let e = p, t = m, n = h;
|
|
719
|
+
p = s[0] * e + s[1] * t + s[2] * n, m = s[3] * e + s[4] * t + s[5] * n, h = s[6] * e + s[7] * t + s[8] * n;
|
|
720
|
+
}
|
|
721
|
+
let _ = vt(p, t, n, r), v = vt(m, t, n, r), y = vt(h, t, n, r), b = Math.min(Math.floor(_), l - 1), x = Math.min(Math.floor(v), l - 1), S = Math.min(Math.floor(y), l - 1), { w: C, c: w } = wt(Math.min(Math.max(_ - b, 0), 1), Math.min(Math.max(v - x, 0), 1), Math.min(Math.max(y - S, 0), 1));
|
|
674
722
|
for (let e = 0; e < 3; e++) {
|
|
675
|
-
let t =
|
|
723
|
+
let t = f(b, x, S, e), n = t, r = t;
|
|
724
|
+
for (let t = 0; t < 3; t++) {
|
|
725
|
+
let i = f(b + w[t][0], x + w[t][1], S + w[t][2], e);
|
|
726
|
+
n += (i - r) * C[t], r = i;
|
|
727
|
+
}
|
|
728
|
+
g[e] = n;
|
|
729
|
+
}
|
|
730
|
+
if (i) {
|
|
731
|
+
let n = Math.min(Math.max((g[0] - i.lo) / (i.hi - i.lo), 0), 1) * (i.n - 1), r = Math.min(Math.floor(n), i.n - 2), a = n - r, o = (t * c + r) * 4;
|
|
676
732
|
for (let t = 0; t < 3; t++) {
|
|
677
|
-
let
|
|
678
|
-
n
|
|
733
|
+
let n = u ? d[e[o + t]] : e[o + t];
|
|
734
|
+
g[t] = n + ((u ? d[e[o + 4 + t]] : e[o + 4 + t]) - n) * a;
|
|
679
735
|
}
|
|
680
|
-
s[e] = n;
|
|
681
736
|
}
|
|
737
|
+
if (o) {
|
|
738
|
+
let { toDisplay: e, fromDisplay: t } = o, [n, r, i] = a ? g : [
|
|
739
|
+
Et(g[0]),
|
|
740
|
+
Et(g[1]),
|
|
741
|
+
Et(g[2])
|
|
742
|
+
], s = Math.max(0, e[0] * n + e[1] * r + e[2] * i), c = Math.max(0, e[3] * n + e[4] * r + e[5] * i), l = Math.max(0, e[6] * n + e[7] * r + e[8] * i);
|
|
743
|
+
for (let e = 0; e < 3; e++) g[e] = Tt(t[e * 3] * s + t[e * 3 + 1] * c + t[e * 3 + 2] * l);
|
|
744
|
+
} else if (a) for (let e = 0; e < 3; e++) g[e] = Tt(g[e]);
|
|
682
745
|
};
|
|
683
746
|
}
|
|
684
|
-
function
|
|
685
|
-
let
|
|
747
|
+
function At({ fnName: e, texName: t, size: n, minEv: r, maxEv: i, curve: a = null, linear: o = !1, clip: s = null, pre: c = null }) {
|
|
748
|
+
let l = (e) => Number.isInteger(e) ? `${e}.0` : String(e), u = o || s, d = a || u ? `${e}_cube` : e, f = u ? `${e}_curve` : e, p = (e, t) => `vec3<f32>( ${l(e[t * 3])}, ${l(e[t * 3 + 1])}, ${l(e[t * 3 + 2])} )`, m = (e, t) => `vec3<f32>( dot( ${p(e, 0)}, ${t} ), dot( ${p(e, 1)}, ${t} ), dot( ${p(e, 2)}, ${t} ) )`, h = a ? `
|
|
749
|
+
fn ${e}_entry( i: i32 ) -> vec3<f32> {
|
|
750
|
+
return textureLoad( ${t}, vec3<i32>( i % ${n}, ( i / ${n} ) % ${n}, ${n} + i / ${n * n} ), 0 ).rgb;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
fn ${f}( c: vec3<f32> ) -> vec3<f32> {
|
|
754
|
+
let u = clamp( ( ${d}( c ).x - ${l(a.lo)} ) / ${l(a.hi - a.lo)}, 0.0, 1.0 ) * ${l(a.n - 1)};
|
|
755
|
+
let i0 = min( i32( floor( u ) ), ${a.n - 2} );
|
|
756
|
+
return mix( ${e}_entry( i0 ), ${e}_entry( i0 + 1 ), u - f32( i0 ) );
|
|
757
|
+
}
|
|
758
|
+
` : "", g = s ? `
|
|
759
|
+
let a0 = abs( v );
|
|
760
|
+
let light = ${o ? "v" : "sign( v ) * select( pow( ( a0 + 0.055 ) / 1.055, vec3<f32>( 2.4 ) ), a0 / 12.92, a0 <= vec3<f32>( 0.04045 ) )"};
|
|
761
|
+
let d = max( ${m(s.toDisplay, "light")}, vec3<f32>( 0.0 ) );
|
|
762
|
+
let o = ${m(s.fromDisplay, "d")};` : "\n let o = v;", _ = u ? `
|
|
763
|
+
fn ${e}( c: vec3<f32> ) -> vec3<f32> {
|
|
764
|
+
let v = ${a ? f : d}( c );${g}
|
|
765
|
+
let a = abs( o );
|
|
766
|
+
return sign( o ) * select( 1.055 * pow( a, vec3<f32>( 1.0 / 2.4 ) ) - 0.055, 12.92 * a, a <= vec3<f32>( 0.0031308 ) );
|
|
767
|
+
}
|
|
768
|
+
` : "";
|
|
686
769
|
return `
|
|
687
770
|
fn ${e}_shape( v: vec3<f32> ) -> vec3<f32> {
|
|
688
|
-
let ev = log2( max( v, vec3<f32>( 1e-10 ) ) );
|
|
689
|
-
let t = ( ev - vec3<f32>( ${
|
|
690
|
-
return clamp( t, vec3<f32>( 0.0 ), vec3<f32>( 1.0 ) ) * ${
|
|
771
|
+
let ev = log2( max( ${c ? m(c, "v") : "v"}, vec3<f32>( 1e-10 ) ) );
|
|
772
|
+
let t = ( ev - vec3<f32>( ${l(r)} ) ) / ${l(i - r)};
|
|
773
|
+
return clamp( t, vec3<f32>( 0.0 ), vec3<f32>( 1.0 ) ) * ${l(n - 1)};
|
|
691
774
|
}
|
|
692
775
|
|
|
693
776
|
fn ${e}_fetch( i: vec3<i32> ) -> vec3<f32> {
|
|
694
777
|
return textureLoad( ${t}, clamp( i, vec3<i32>( 0 ), vec3<i32>( ${n - 1} ) ), 0 ).rgb;
|
|
695
778
|
}
|
|
696
779
|
|
|
697
|
-
fn ${
|
|
780
|
+
fn ${d}( c: vec3<f32> ) -> vec3<f32> {
|
|
698
781
|
let p = ${e}_shape( c );
|
|
699
782
|
let i0 = clamp( vec3<i32>( floor( p ) ), vec3<i32>( 0 ), vec3<i32>( ${n - 2} ) );
|
|
700
783
|
let f = clamp( p - vec3<f32>( i0 ), vec3<f32>( 0.0 ), vec3<f32>( 1.0 ) );
|
|
@@ -735,52 +818,119 @@ fn ${e}( c: vec3<f32> ) -> vec3<f32> {
|
|
|
735
818
|
|
|
736
819
|
return c000 + ( v1 - c000 ) * w.x + ( v2 - v1 ) * w.y + ( v3 - v2 ) * w.z;
|
|
737
820
|
}
|
|
738
|
-
`;
|
|
821
|
+
${h}${_}`;
|
|
822
|
+
}
|
|
823
|
+
var jt = [
|
|
824
|
+
[
|
|
825
|
+
1,
|
|
826
|
+
0,
|
|
827
|
+
0
|
|
828
|
+
],
|
|
829
|
+
[
|
|
830
|
+
0,
|
|
831
|
+
1,
|
|
832
|
+
0
|
|
833
|
+
],
|
|
834
|
+
[
|
|
835
|
+
0,
|
|
836
|
+
0,
|
|
837
|
+
1
|
|
838
|
+
],
|
|
839
|
+
[
|
|
840
|
+
1,
|
|
841
|
+
1,
|
|
842
|
+
0
|
|
843
|
+
],
|
|
844
|
+
[
|
|
845
|
+
0,
|
|
846
|
+
1,
|
|
847
|
+
1
|
|
848
|
+
],
|
|
849
|
+
[
|
|
850
|
+
1,
|
|
851
|
+
0,
|
|
852
|
+
1
|
|
853
|
+
],
|
|
854
|
+
[
|
|
855
|
+
1,
|
|
856
|
+
.5,
|
|
857
|
+
.5
|
|
858
|
+
],
|
|
859
|
+
[
|
|
860
|
+
.5,
|
|
861
|
+
1,
|
|
862
|
+
.5
|
|
863
|
+
],
|
|
864
|
+
[
|
|
865
|
+
.5,
|
|
866
|
+
.5,
|
|
867
|
+
1
|
|
868
|
+
],
|
|
869
|
+
[
|
|
870
|
+
1,
|
|
871
|
+
.5,
|
|
872
|
+
0
|
|
873
|
+
],
|
|
874
|
+
[
|
|
875
|
+
0,
|
|
876
|
+
.5,
|
|
877
|
+
1
|
|
878
|
+
]
|
|
879
|
+
];
|
|
880
|
+
function Mt() {
|
|
881
|
+
let e = [];
|
|
882
|
+
for (let t = -3; t <= 4; t += .5) for (let n of jt) e.push(n.map((e) => e * 2 ** t));
|
|
883
|
+
return e;
|
|
739
884
|
}
|
|
740
|
-
function
|
|
741
|
-
let
|
|
885
|
+
function Nt({ sampler: e, apply: t, count: n = 4e3, seed: r = 31337, edges: i = Mt(), clamped: a = !1 }) {
|
|
886
|
+
let o = r >>> 0, s = () => (o = o * 1664525 + 1013904223 >>> 0) / 4294967296, c = [];
|
|
742
887
|
for (let e = 0; e < n; e++) {
|
|
743
|
-
let e = .18 * 2 ** (-7 +
|
|
888
|
+
let e = .18 * 2 ** (-7 + s() * 13), t = s() ** 1.2, n = s() * 6, r = [
|
|
744
889
|
0,
|
|
745
890
|
1,
|
|
746
891
|
2
|
|
747
892
|
].map((e) => 1 - t * Math.min(1, Math.abs((n + e * 2) % 6 - 3))), i = Math.max(...r) || 1;
|
|
748
|
-
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
893
|
+
c.push(r.map((t) => Math.max(t, 0) / i * e));
|
|
894
|
+
}
|
|
895
|
+
c.push(...i);
|
|
896
|
+
let l = new Float32Array(c.length * 4);
|
|
897
|
+
c.forEach((e, t) => {
|
|
898
|
+
l[t * 4] = e[0], l[t * 4 + 1] = e[1], l[t * 4 + 2] = e[2], l[t * 4 + 3] = 1;
|
|
899
|
+
}), t(l);
|
|
900
|
+
let u = [
|
|
755
901
|
0,
|
|
756
902
|
0,
|
|
757
903
|
0
|
|
758
|
-
],
|
|
759
|
-
for (let t = 0; t <
|
|
760
|
-
e(
|
|
761
|
-
for (let e = 0; e < 3; e++)
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
904
|
+
], d = (e) => Math.min(Math.max(e, 0), 1), f = [], p = 0;
|
|
905
|
+
for (let t = 0; t < c.length; t++) {
|
|
906
|
+
e(c[t][0], c[t][1], c[t][2], u);
|
|
907
|
+
for (let e = 0; e < 3; e++) {
|
|
908
|
+
let r = l[t * 4 + e];
|
|
909
|
+
t >= n ? p = Math.max(p, Math.abs(d(u[e]) - d(r)) * 255) : f.push(Math.abs(a ? d(u[e]) - d(r) : u[e] - r) * 255);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
return f.sort((e, t) => e - t), {
|
|
913
|
+
mean: f.reduce((e, t) => e + t, 0) / f.length,
|
|
914
|
+
p95: f[Math.floor(f.length * .95)],
|
|
915
|
+
max: f[f.length - 1],
|
|
916
|
+
edge: p,
|
|
917
|
+
samples: f.length
|
|
768
918
|
};
|
|
769
919
|
}
|
|
770
920
|
//#endregion
|
|
771
921
|
//#region src/Color/OcioViews.js
|
|
772
|
-
var
|
|
773
|
-
function
|
|
774
|
-
|
|
922
|
+
var Pt = -12.47393, Ft = 12.5260688117, It = 65, Lt = 97, Rt = (e) => Math.max(e.edge / 5, e.mean / .4), zt = null, Y = /* @__PURE__ */ new Map();
|
|
923
|
+
function Bt(e) {
|
|
924
|
+
zt = e;
|
|
775
925
|
}
|
|
776
|
-
function
|
|
777
|
-
let e =
|
|
926
|
+
function Vt() {
|
|
927
|
+
let e = B();
|
|
778
928
|
if (!e) throw Error("load an OCIO config first");
|
|
779
929
|
if (!e.config) throw Error("OCIO runtime exposes no Config handle");
|
|
780
930
|
return e.config;
|
|
781
931
|
}
|
|
782
|
-
function
|
|
783
|
-
let s =
|
|
932
|
+
function Ht({ source: e, display: t, view: n, look: r, context: i, decodeFrom: a = null, decodeTo: o = null }) {
|
|
933
|
+
let s = Vt(), c = i ? { context: i } : void 0;
|
|
784
934
|
return !r && !o ? s.createDisplayViewProcessor({
|
|
785
935
|
source: e,
|
|
786
936
|
display: t,
|
|
@@ -806,16 +956,16 @@ function Dt({ source: e, display: t, view: n, look: r, context: i, decodeFrom: a
|
|
|
806
956
|
}] : []
|
|
807
957
|
], c);
|
|
808
958
|
}
|
|
809
|
-
function
|
|
959
|
+
function Ut(e, t, n) {
|
|
810
960
|
let r = e.viewsByDisplay[t]?.find((e) => e.name === n)?.colorSpace;
|
|
811
961
|
return !r || r === "<USE_DISPLAY_NAME>" ? t : r;
|
|
812
962
|
}
|
|
813
|
-
var
|
|
963
|
+
var Wt = /* @__PURE__ */ new WeakMap(), Gt = (e) => Math.sign(e) * (Math.abs(e) <= .04045 ? Math.abs(e) / 12.92 : ((Math.abs(e) + .055) / 1.055) ** 2.4), Kt = (e, t) => [
|
|
814
964
|
0,
|
|
815
965
|
3,
|
|
816
966
|
6
|
|
817
967
|
].map((n) => e[n] * t[0] + e[n + 1] * t[1] + e[n + 2] * t[2]);
|
|
818
|
-
function
|
|
968
|
+
function qt(e) {
|
|
819
969
|
let [t, n, r, i, a, o, s, c, l] = e, u = a * l - o * c, d = o * s - i * l, f = i * c - a * s, p = t * u + n * d + r * f;
|
|
820
970
|
return [
|
|
821
971
|
u,
|
|
@@ -829,17 +979,17 @@ function Mt(e) {
|
|
|
829
979
|
t * a - n * i
|
|
830
980
|
].map((e) => e / p);
|
|
831
981
|
}
|
|
832
|
-
function
|
|
833
|
-
let t =
|
|
982
|
+
function Jt(e) {
|
|
983
|
+
let t = V();
|
|
834
984
|
if (!t) return {
|
|
835
|
-
fit:
|
|
985
|
+
fit: M(e),
|
|
836
986
|
wide: !1,
|
|
837
987
|
convertible: !1
|
|
838
988
|
};
|
|
839
|
-
let n =
|
|
840
|
-
if (n ||
|
|
841
|
-
let r = t.colorSpaces.find((t) => t.name === e || t.aliases?.includes(e)), i =
|
|
842
|
-
fit:
|
|
989
|
+
let n = Wt.get(t);
|
|
990
|
+
if (n || Wt.set(t, n = /* @__PURE__ */ new Map()), n.has(e)) return n.get(e);
|
|
991
|
+
let r = t.colorSpaces.find((t) => t.name === e || t.aliases?.includes(e)), i = $(), a = {
|
|
992
|
+
fit: M(e),
|
|
843
993
|
wide: !1,
|
|
844
994
|
convertible: !1
|
|
845
995
|
};
|
|
@@ -885,7 +1035,7 @@ function Nt(e) {
|
|
|
885
1035
|
1,
|
|
886
1036
|
1
|
|
887
1037
|
]
|
|
888
|
-
], n = new Float32Array(t.flatMap((e) => [...e, 1])), r =
|
|
1038
|
+
], n = new Float32Array(t.flatMap((e) => [...e, 1])), r = Vt().createColorSpaceProcessor(e, i);
|
|
889
1039
|
try {
|
|
890
1040
|
r.applyRGBAF32(n);
|
|
891
1041
|
} finally {
|
|
@@ -896,14 +1046,14 @@ function Nt(e) {
|
|
|
896
1046
|
n[e * 4 + 1],
|
|
897
1047
|
n[e * 4 + 2]
|
|
898
1048
|
], s = (e) => {
|
|
899
|
-
let n =
|
|
900
|
-
return t.every((e, t) =>
|
|
1049
|
+
let n = qt(Q[e]);
|
|
1050
|
+
return t.every((e, t) => Kt(n, e.map(Gt)).every((e, n) => Math.abs(o(t)[n] - e) <= .002 * Math.max(1, Math.abs(e))));
|
|
901
1051
|
}, c = [
|
|
902
1052
|
0,
|
|
903
1053
|
1,
|
|
904
1054
|
2
|
|
905
1055
|
].some((e) => {
|
|
906
|
-
let t =
|
|
1056
|
+
let t = Kt(Q.srgb, o(e));
|
|
907
1057
|
return Math.min(...t) < -.001 * Math.max(...t.map(Math.abs));
|
|
908
1058
|
});
|
|
909
1059
|
a = {
|
|
@@ -914,75 +1064,390 @@ function Nt(e) {
|
|
|
914
1064
|
}
|
|
915
1065
|
return n.set(e, a), a;
|
|
916
1066
|
}
|
|
917
|
-
|
|
918
|
-
|
|
1067
|
+
var Yt = /* @__PURE__ */ new WeakMap(), Xt = (e, t) => [
|
|
1068
|
+
0,
|
|
1069
|
+
1,
|
|
1070
|
+
2
|
|
1071
|
+
].flatMap((n) => [
|
|
1072
|
+
0,
|
|
1073
|
+
1,
|
|
1074
|
+
2
|
|
1075
|
+
].map((r) => e[n * 3] * t[r] + e[n * 3 + 1] * t[3 + r] + e[n * 3 + 2] * t[6 + r]));
|
|
1076
|
+
function Zt(e, t) {
|
|
1077
|
+
let n = V(), r = Yt.get(n);
|
|
1078
|
+
r || Yt.set(n, r = /* @__PURE__ */ new Map());
|
|
1079
|
+
let i = `${e}|${t}`;
|
|
1080
|
+
if (r.has(i)) return r.get(i);
|
|
1081
|
+
let a = null, o = $();
|
|
1082
|
+
try {
|
|
1083
|
+
let n = Vt(), r = n.createColorSpaceProcessor(e, o), i = n.createColorSpaceProcessor(o, e);
|
|
1084
|
+
try {
|
|
1085
|
+
let e = r.applyRGBAF32(new Float32Array([
|
|
1086
|
+
1,
|
|
1087
|
+
0,
|
|
1088
|
+
0,
|
|
1089
|
+
1,
|
|
1090
|
+
0,
|
|
1091
|
+
1,
|
|
1092
|
+
0,
|
|
1093
|
+
1,
|
|
1094
|
+
0,
|
|
1095
|
+
0,
|
|
1096
|
+
1,
|
|
1097
|
+
1
|
|
1098
|
+
]), { copy: !0 }), n = [
|
|
1099
|
+
e[0],
|
|
1100
|
+
e[4],
|
|
1101
|
+
e[8],
|
|
1102
|
+
e[1],
|
|
1103
|
+
e[5],
|
|
1104
|
+
e[9],
|
|
1105
|
+
e[2],
|
|
1106
|
+
e[6],
|
|
1107
|
+
e[10]
|
|
1108
|
+
], o = Kt(n, [
|
|
1109
|
+
-.05,
|
|
1110
|
+
.3,
|
|
1111
|
+
.3
|
|
1112
|
+
]), s = r.applyRGBAF32(i.applyRGBAF32(new Float32Array([...o, 1]), { copy: !0 }), { copy: !0 });
|
|
1113
|
+
if (Math.abs(Kt(qt(n), [
|
|
1114
|
+
s[0],
|
|
1115
|
+
s[1],
|
|
1116
|
+
s[2]
|
|
1117
|
+
])[0]) < .001) {
|
|
1118
|
+
let e = Xt(Q[t], n);
|
|
1119
|
+
a = {
|
|
1120
|
+
toDisplay: qt(e),
|
|
1121
|
+
fromDisplay: e
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
} finally {
|
|
1125
|
+
r.dispose(), i.dispose();
|
|
1126
|
+
}
|
|
1127
|
+
} catch {
|
|
1128
|
+
a = null;
|
|
1129
|
+
}
|
|
1130
|
+
return r.set(i, a), a;
|
|
1131
|
+
}
|
|
1132
|
+
function Qt(e, t) {
|
|
1133
|
+
let n = Q[t];
|
|
919
1134
|
for (let t = 0; t < e.length; t += 4) {
|
|
920
1135
|
let r = e[t], i = e[t + 1], a = e[t + 2];
|
|
921
|
-
e[t] =
|
|
1136
|
+
e[t] = n[0] * r + n[1] * i + n[2] * a, e[t + 1] = n[3] * r + n[4] * i + n[5] * a, e[t + 2] = n[6] * r + n[7] * i + n[8] * a;
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
var X = null, Z = (e) => e.search(/\S/);
|
|
1140
|
+
function $t(e, t) {
|
|
1141
|
+
let n = e.ocio?.module?.FS, r = "/ocio-runtime/configs";
|
|
1142
|
+
try {
|
|
1143
|
+
for (let e of n?.readdir(r) ?? []) {
|
|
1144
|
+
if (e[0] === ".") continue;
|
|
1145
|
+
let i = `${r}/${e}`;
|
|
1146
|
+
if (n.readdir(i).some((e) => e.endsWith(".ocio") && new TextDecoder().decode(n.readFile(`${i}/${e}`)) === t)) return i;
|
|
1147
|
+
}
|
|
1148
|
+
} catch {}
|
|
1149
|
+
return "";
|
|
1150
|
+
}
|
|
1151
|
+
function en(e) {
|
|
1152
|
+
let t = /* @__PURE__ */ new Map();
|
|
1153
|
+
for (let n = 0; n < e.length; n++) {
|
|
1154
|
+
if (!/^\s*-\s*!<ViewTransform>\s*$/.test(e[n])) continue;
|
|
1155
|
+
let r = Z(e[n]), i = n + 1;
|
|
1156
|
+
for (; i < e.length && !(e[i].trim() && Z(e[i]) <= r);) i++;
|
|
1157
|
+
let a = e.slice(n + 1, i), o = a.map((e) => e.match(/^\s*name:\s*(.+?)\s*$/)?.[1]).find(Boolean)?.replace(/^(["'])(.*)\1$/, "$2"), s = a.findIndex((e) => /^\s*from_scene_reference:/.test(e));
|
|
1158
|
+
if (!o || s < 0) continue;
|
|
1159
|
+
let c = Z(a[s]), l = s + 1;
|
|
1160
|
+
for (; l < a.length && !(a[l].trim() && Z(a[l]) <= c);) l++;
|
|
1161
|
+
t.set(o, a.slice(s, l).filter((e) => e.trim()));
|
|
922
1162
|
}
|
|
1163
|
+
return t;
|
|
1164
|
+
}
|
|
1165
|
+
function tn(e) {
|
|
1166
|
+
if (!/:\s*!<GroupTransform>\s*$/.test(e[0])) return null;
|
|
1167
|
+
let t = e.slice(1).filter((e) => !/^\s*children:\s*$/.test(e));
|
|
1168
|
+
if (!t.every((e) => /^\s*-\s*!<\w+>\s*\{.*\}\s*$/.test(e))) return null;
|
|
1169
|
+
let n = t.map((e) => e.replace(/^\s*-\s*/, "").trim()), r = n.findLastIndex((e) => /^!<FileTransform>/.test(e) && /\.spi1d\b/i.test(e) && !/direction:\s*inverse/.test(e));
|
|
1170
|
+
return r <= 0 ? null : {
|
|
1171
|
+
pre: n.slice(0, r),
|
|
1172
|
+
post: n.slice(r),
|
|
1173
|
+
src: n[r].match(/\bsrc:\s*["']?([^,}"']+?)["']?\s*[,}]/)?.[1]
|
|
1174
|
+
};
|
|
923
1175
|
}
|
|
924
|
-
function
|
|
925
|
-
let
|
|
1176
|
+
function nn(e, t, n, r) {
|
|
1177
|
+
let i = (n.match(/^search_path:\s*(.+?)\s*$/m)?.[1].replace(/^["']|["']$/g, "").split(":") ?? [""]).concat("");
|
|
1178
|
+
for (let n of i) try {
|
|
1179
|
+
let i = new TextDecoder().decode(e.readFile([
|
|
1180
|
+
t,
|
|
1181
|
+
n,
|
|
1182
|
+
r
|
|
1183
|
+
].filter(Boolean).join("/")).subarray(0, 512)), a = i.match(/^From\s+(\S+)\s+(\S+)/m), o = Number(i.match(/^Length\s+(\d+)/m)?.[1]);
|
|
1184
|
+
if (o > 1) return {
|
|
1185
|
+
lo: a ? Number(a[1]) : 0,
|
|
1186
|
+
hi: a ? Number(a[2]) : 1,
|
|
1187
|
+
n: o
|
|
1188
|
+
};
|
|
1189
|
+
} catch {}
|
|
1190
|
+
return null;
|
|
1191
|
+
}
|
|
1192
|
+
function rn() {
|
|
1193
|
+
let e = He();
|
|
1194
|
+
if (X?.text === e) return X;
|
|
1195
|
+
if (on(), !e) return null;
|
|
1196
|
+
let t = e.split("\n");
|
|
1197
|
+
X = {
|
|
1198
|
+
text: e,
|
|
1199
|
+
lines: t,
|
|
1200
|
+
config: null,
|
|
1201
|
+
built: !1,
|
|
1202
|
+
views: /* @__PURE__ */ new Map()
|
|
1203
|
+
};
|
|
1204
|
+
let n = 0;
|
|
1205
|
+
for (let [e, r] of en(t)) X.views.set(e, {
|
|
1206
|
+
space: `__rayzee_view_${n}`,
|
|
1207
|
+
value: r,
|
|
1208
|
+
split: tn(r),
|
|
1209
|
+
index: n
|
|
1210
|
+
}), n++;
|
|
1211
|
+
return X;
|
|
1212
|
+
}
|
|
1213
|
+
function an(e) {
|
|
1214
|
+
if (e.built) return e.config;
|
|
1215
|
+
e.built = !0;
|
|
1216
|
+
let n = B(), { lines: r } = e, i = r.findIndex((e) => /^colorspaces:\s*$/.test(e));
|
|
1217
|
+
if (!n?.ocio || i < 0 || !e.views.size) return null;
|
|
1218
|
+
try {
|
|
1219
|
+
let t = " ".repeat(Math.max(0, Z(r.slice(i + 1).find((e) => /^\s*-/.test(e)) ?? " -"))), a = $t(n, e.text), o = n.ocio.module?.FS, s = [], c = [];
|
|
1220
|
+
for (let n of e.views.values()) {
|
|
1221
|
+
let { value: r, index: i } = n, l = t.length + 2 - Z(r[0]);
|
|
1222
|
+
s.push(`${t}- !<ColorSpace>`, `${t} name: ${n.space}`, `${t} isdata: false`, ...r.map((e) => l >= 0 ? " ".repeat(l) + e : e.slice(-l)));
|
|
1223
|
+
let u = n.split?.src && o ? nn(o, a, e.text, n.split.src) : null;
|
|
1224
|
+
if (!u) {
|
|
1225
|
+
n.split = null;
|
|
1226
|
+
continue;
|
|
1227
|
+
}
|
|
1228
|
+
let { pre: d, post: f } = n.split;
|
|
1229
|
+
n.split = {
|
|
1230
|
+
pre: `__rayzee_pre_${i}`,
|
|
1231
|
+
post: `__rayzee_post_${i}`,
|
|
1232
|
+
...u
|
|
1233
|
+
}, s.push(`${t}- !<ColorSpace>`, `${t} name: ${n.split.pre}`, `${t} isdata: false`, `${t} from_scene_reference: !<GroupTransform>`, `${t} children:`, ...d.map((e) => `${t} - ${e}`)), c.push(" - !<NamedTransform>", ` name: ${n.split.post}`, " transform: !<GroupTransform>", " children:", ...f.map((e) => ` - ${e}`));
|
|
1234
|
+
}
|
|
1235
|
+
let l = r.slice();
|
|
1236
|
+
l.splice(i + 1, 0, ...s);
|
|
1237
|
+
let u = l.findIndex((e) => /^named_transforms:\s*$/.test(e));
|
|
1238
|
+
c.length && l.splice(u < 0 ? l.length : u + 1, 0, ...u < 0 ? ["named_transforms:"] : [], ...c), e.config = n.ocio.createConfigFromString(l.join("\n"), { workingDir: a }), e.config.validate();
|
|
1239
|
+
let d = new Float32Array([
|
|
1240
|
+
1,
|
|
1241
|
+
.2,
|
|
1242
|
+
.05,
|
|
1243
|
+
1,
|
|
1244
|
+
.02,
|
|
1245
|
+
.6,
|
|
1246
|
+
.1,
|
|
1247
|
+
1,
|
|
1248
|
+
.3,
|
|
1249
|
+
.1,
|
|
1250
|
+
2,
|
|
1251
|
+
1,
|
|
1252
|
+
.18,
|
|
1253
|
+
.18,
|
|
1254
|
+
.18,
|
|
1255
|
+
1
|
|
1256
|
+
]);
|
|
1257
|
+
for (let t of e.views.values()) {
|
|
1258
|
+
if (!t.split) continue;
|
|
1259
|
+
let n = e.config.createGroupTransformProcessor([{
|
|
1260
|
+
type: "colorSpace",
|
|
1261
|
+
source: H().sceneLinear,
|
|
1262
|
+
destination: t.split.pre
|
|
1263
|
+
}]), r = n.applyRGBAF32(d, { copy: !0 });
|
|
1264
|
+
n.dispose();
|
|
1265
|
+
for (let e = 0; e < r.length; e += 4) Math.abs(r[e] - r[e + 1]) + Math.abs(r[e + 1] - r[e + 2]) > 1e-5 && (t.split = null);
|
|
1266
|
+
}
|
|
1267
|
+
} catch (n) {
|
|
1268
|
+
e.config?.dispose(), e.config = null, zt?.warn(t.VIEW_TRANSFORM_BAKE_FAILED, `views bake from OCIO's display output instead: ${n.message}`);
|
|
1269
|
+
}
|
|
1270
|
+
return e.config;
|
|
1271
|
+
}
|
|
1272
|
+
function on() {
|
|
1273
|
+
X?.config?.dispose(), X = null;
|
|
1274
|
+
}
|
|
1275
|
+
function sn(e, t, n) {
|
|
1276
|
+
let r = V()?.viewsByDisplay[e]?.find((e) => e.name === t);
|
|
1277
|
+
if (!r?.transform || r.looks) return null;
|
|
1278
|
+
let i = rn(), a = i?.views.get(r.transform);
|
|
1279
|
+
if (!a || !n && !a.split) return null;
|
|
1280
|
+
let o = an(i);
|
|
1281
|
+
return !o || !n && !a.split ? null : {
|
|
1282
|
+
config: o,
|
|
1283
|
+
space: a.space,
|
|
1284
|
+
split: a.split
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
function cn(e, t) {
|
|
1288
|
+
let n = Mt(), r = j(V());
|
|
1289
|
+
if (!r || r === e) return n;
|
|
1290
|
+
let i = B().config.createGroupTransformProcessor([{
|
|
1291
|
+
type: "colorSpace",
|
|
1292
|
+
source: r,
|
|
1293
|
+
destination: e
|
|
1294
|
+
}], t), a = new Float32Array(n.flatMap((e) => [...e, 1]));
|
|
1295
|
+
return i.applyRGBAF32(a), i.dispose(), n.map((e, t) => [
|
|
1296
|
+
a[t * 4],
|
|
1297
|
+
a[t * 4 + 1],
|
|
1298
|
+
a[t * 4 + 2]
|
|
1299
|
+
]);
|
|
1300
|
+
}
|
|
1301
|
+
function ln({ source: e, display: t, view: n, look: r, context: i, canvas: a = null, size: o = null, minEv: s, maxEv: c }) {
|
|
1302
|
+
let l = Ut(V(), t, n), u = i ? { context: i } : void 0, d = sn(t, n, a), f = (e) => a && Qt(e, a), p = (e, t = 0) => {
|
|
1303
|
+
for (let n = t; n < e.length; n++) n % 4 != 3 && (e[n] = Tt(e[n]));
|
|
1304
|
+
}, m = (e) => {
|
|
1305
|
+
let o = r ? [{
|
|
1306
|
+
type: "look",
|
|
1307
|
+
source: e,
|
|
1308
|
+
destination: e,
|
|
1309
|
+
looks: r
|
|
1310
|
+
}] : [];
|
|
1311
|
+
return d?.split ? d.config.createGroupTransformProcessor([...o, {
|
|
1312
|
+
type: "colorSpace",
|
|
1313
|
+
source: e,
|
|
1314
|
+
destination: d.split.pre
|
|
1315
|
+
}], u) : a && d ? d.config.createGroupTransformProcessor([...o, {
|
|
1316
|
+
type: "colorSpace",
|
|
1317
|
+
source: e,
|
|
1318
|
+
destination: d.space
|
|
1319
|
+
}], u) : Ht({
|
|
1320
|
+
source: e,
|
|
1321
|
+
display: t,
|
|
1322
|
+
view: n,
|
|
1323
|
+
look: r,
|
|
1324
|
+
context: i,
|
|
1325
|
+
decodeFrom: a ? l : null,
|
|
1326
|
+
decodeTo: a && $()
|
|
1327
|
+
});
|
|
1328
|
+
}, h = /* @__PURE__ */ new Map(), g = (e) => h.get(e) ?? h.set(e, m(e)).get(e), _ = null, v = null;
|
|
1329
|
+
if (d?.split) {
|
|
1330
|
+
let { post: e, lo: t, hi: n, n: r } = d.split;
|
|
1331
|
+
_ = d.config.createGroupTransformProcessor([{
|
|
1332
|
+
type: "named",
|
|
1333
|
+
name: e
|
|
1334
|
+
}, ...a ? [] : [{
|
|
1335
|
+
type: "colorSpace",
|
|
1336
|
+
source: $(),
|
|
1337
|
+
destination: l
|
|
1338
|
+
}]], u), v = {
|
|
1339
|
+
n: r,
|
|
1340
|
+
lo: t,
|
|
1341
|
+
hi: n
|
|
1342
|
+
};
|
|
1343
|
+
}
|
|
1344
|
+
let y = a && d ? Zt(l, a) : null, b = a && d ? Ht({
|
|
926
1345
|
source: e,
|
|
927
1346
|
display: t,
|
|
928
1347
|
view: n,
|
|
929
1348
|
look: r,
|
|
930
1349
|
context: i,
|
|
931
|
-
decodeFrom:
|
|
932
|
-
decodeTo:
|
|
933
|
-
}),
|
|
934
|
-
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
size: o,
|
|
1350
|
+
decodeFrom: l,
|
|
1351
|
+
decodeTo: $()
|
|
1352
|
+
}) : null, x = (t) => {
|
|
1353
|
+
b ? b.applyRGBAF32(t) : (g(e).applyRGBAF32(t), _ && _.applyRGBAF32(t)), f(t), a && p(t);
|
|
1354
|
+
}, S = cn(e, u), C = !N(H(), t), w = j(V()), T = w && w !== e ? mt(e, w, { context: i }) : null, E = (t, n) => {
|
|
1355
|
+
let r = g(n), i = n === e ? null : T, o = yt({
|
|
1356
|
+
size: t,
|
|
939
1357
|
minEv: s,
|
|
940
1358
|
maxEv: c,
|
|
941
|
-
apply:
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
|
|
1359
|
+
apply: (e) => {
|
|
1360
|
+
r.applyRGBAF32(e), v || f(e);
|
|
1361
|
+
}
|
|
1362
|
+
});
|
|
1363
|
+
if (v) {
|
|
1364
|
+
let e = new Float32Array((t ** 3 + Dt(v.n, t) * t * t) * 4);
|
|
1365
|
+
e.set(o), e.set(Ot({
|
|
1366
|
+
...v,
|
|
1367
|
+
apply: (e) => {
|
|
1368
|
+
_.applyRGBAF32(e), f(e);
|
|
1369
|
+
}
|
|
1370
|
+
}), t ** 3 * 4), o = e;
|
|
1371
|
+
}
|
|
1372
|
+
let l = (e, r) => {
|
|
1373
|
+
let a = bt(e), o = kt({
|
|
1374
|
+
data: a,
|
|
1375
|
+
size: t,
|
|
1376
|
+
minEv: s,
|
|
1377
|
+
maxEv: c,
|
|
1378
|
+
curve: v,
|
|
1379
|
+
linear: r,
|
|
1380
|
+
clip: y,
|
|
1381
|
+
pre: i
|
|
1382
|
+
});
|
|
1383
|
+
return {
|
|
1384
|
+
half: a,
|
|
1385
|
+
size: t,
|
|
1386
|
+
input: n,
|
|
1387
|
+
pre: i,
|
|
1388
|
+
curve: v,
|
|
1389
|
+
linear: r,
|
|
1390
|
+
clip: y,
|
|
1391
|
+
error: Nt({
|
|
1392
|
+
sampler: o,
|
|
1393
|
+
apply: x,
|
|
1394
|
+
edges: S,
|
|
1395
|
+
clamped: C
|
|
1396
|
+
})
|
|
1397
|
+
};
|
|
954
1398
|
};
|
|
1399
|
+
if (!a) return l(o, !1);
|
|
1400
|
+
let u = l(o, !0), d = o.slice();
|
|
1401
|
+
p(d, v ? t ** 3 * 4 : 0);
|
|
1402
|
+
let m = l(d, !1);
|
|
1403
|
+
return u.error.max * 2 < m.error.max ? u : m;
|
|
1404
|
+
}, D = (e, t) => Rt(t.error) < .8 * Rt(e.error) && t.error.mean <= e.error.mean * 1.1 + .02 ? t : e;
|
|
1405
|
+
try {
|
|
1406
|
+
let t = null;
|
|
1407
|
+
for (let n of [e, ...T ? [w] : []]) {
|
|
1408
|
+
let e = E(o ?? 65, n);
|
|
1409
|
+
if (t = t ? D(t, e) : e, Rt(t.error) <= 1) return t;
|
|
1410
|
+
}
|
|
1411
|
+
return o ? t : D(t, E(Lt, t.input));
|
|
955
1412
|
} finally {
|
|
956
|
-
|
|
957
|
-
}
|
|
958
|
-
}
|
|
959
|
-
function
|
|
960
|
-
let
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
1413
|
+
h.forEach((e) => e.dispose()), _?.dispose(), b?.dispose();
|
|
1414
|
+
}
|
|
1415
|
+
}
|
|
1416
|
+
function un({ texture: e, size: t, minEv: n, maxEv: r, curve: i = null, linear: a = !1, clip: o = null, pre: s = null }) {
|
|
1417
|
+
let c = (e) => {
|
|
1418
|
+
let t = e.abs();
|
|
1419
|
+
return ae(t.pow(A(1 / 2.4)).mul(1.055).sub(.055), t.mul(12.92), k(t, A(.0031308))).mul(oe(e));
|
|
1420
|
+
}, l = (e) => {
|
|
1421
|
+
let t = e.abs();
|
|
1422
|
+
return ae(t.add(.055).div(1.055).pow(A(2.4)), t.div(12.92), k(t, A(.04045))).mul(oe(e));
|
|
1423
|
+
}, u = (e, t) => A(E(A(e[0], e[1], e[2]), t), E(A(e[3], e[4], e[5]), t), E(A(e[6], e[7], e[8]), t)), d = (e) => o ? c(u(o.fromDisplay, re(u(o.toDisplay, a ? e : l(e)), A(0)))) : a ? c(e) : e, f = t - 1, p = r - n, m = (t) => se(e, T(t, O(0), O(f))).rgb;
|
|
1424
|
+
return C(([r, a]) => {
|
|
1425
|
+
let o = r.mul(a), c = T(ne(re(re(s ? u(s, o) : o, A(0)), A(1e-10))).sub(D(n)).div(D(p)), A(0), A(1)).mul(D(f)).toVar(), l = T(O(ee(c)), O(0), O(t - 2)).toVar(), h = T(c.sub(A(l)), A(0), A(1)).toVar(), g = A(0).toVar(), _ = O(0).toVar(), v = O(0).toVar(), y = O(1).toVar();
|
|
1426
|
+
w(h.x.greaterThan(h.y), () => {
|
|
1427
|
+
w(h.y.greaterThan(h.z), () => {
|
|
1428
|
+
g.assign(A(h.x, h.y, h.z)), _.assign(O(1, 0, 0)), v.assign(O(1, 1, 0)), y.assign(O(1, 1, 1));
|
|
1429
|
+
}).ElseIf(h.x.greaterThan(h.z), () => {
|
|
1430
|
+
g.assign(A(h.x, h.z, h.y)), _.assign(O(1, 0, 0)), v.assign(O(1, 0, 1)), y.assign(O(1, 1, 1));
|
|
968
1431
|
}).Else(() => {
|
|
969
|
-
|
|
1432
|
+
g.assign(A(h.z, h.x, h.y)), _.assign(O(0, 0, 1)), v.assign(O(1, 0, 1)), y.assign(O(1, 1, 1));
|
|
970
1433
|
});
|
|
971
1434
|
}).Else(() => {
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
}).ElseIf(
|
|
975
|
-
|
|
1435
|
+
w(h.z.greaterThan(h.y), () => {
|
|
1436
|
+
g.assign(A(h.z, h.y, h.x)), _.assign(O(0, 0, 1)), v.assign(O(0, 1, 1)), y.assign(O(1, 1, 1));
|
|
1437
|
+
}).ElseIf(h.z.greaterThan(h.x), () => {
|
|
1438
|
+
g.assign(A(h.y, h.z, h.x)), _.assign(O(0, 1, 0)), v.assign(O(0, 1, 1)), y.assign(O(1, 1, 1));
|
|
976
1439
|
}).Else(() => {
|
|
977
|
-
|
|
1440
|
+
g.assign(A(h.y, h.x, h.z)), _.assign(O(0, 1, 0)), v.assign(O(1, 1, 0)), y.assign(O(1, 1, 1));
|
|
978
1441
|
});
|
|
979
1442
|
});
|
|
980
|
-
let
|
|
981
|
-
|
|
1443
|
+
let b = m(l).toVar(), x = m(l.add(_)).toVar(), S = m(l.add(v)).toVar(), C = m(l.add(y)).toVar(), E = b.add(x.sub(b).mul(g.x)).add(S.sub(x).mul(g.y)).add(C.sub(S).mul(g.z));
|
|
1444
|
+
if (!i) return d(E);
|
|
1445
|
+
let oe = T(E.x.sub(i.lo).div(i.hi - i.lo), 0, 1).mul(i.n - 1).toVar(), k = ie(te(ee(oe)), te(i.n - 2)).toVar(), ce = (n) => se(e, O(n.mod(t), n.div(t).mod(t), n.div(t * t).add(t))).rgb;
|
|
1446
|
+
return d(ae(ce(k), ce(k.add(1)), oe.sub(D(k))));
|
|
982
1447
|
});
|
|
983
1448
|
}
|
|
984
|
-
function
|
|
985
|
-
let d =
|
|
1449
|
+
function dn({ display: e, view: n, look: r = null, context: i = null, source: a = null, size: o = null, minEv: s = Pt, maxEv: c = Ft, id: l = null, name: u = null } = {}) {
|
|
1450
|
+
let d = V();
|
|
986
1451
|
if (!d) throw Error("load an OCIO config first");
|
|
987
1452
|
let f = d.roles.find((e) => e.name === "scene_linear")?.colorSpace, p = a ?? f;
|
|
988
1453
|
if (!p) throw Error("config has no scene_linear role — pass an explicit source space");
|
|
@@ -990,12 +1455,12 @@ function Lt({ display: e, view: n, look: r = null, context: i = null, source: a
|
|
|
990
1455
|
let m = (d.viewsByDisplay[e] ?? []).map((e) => e.name);
|
|
991
1456
|
if (!m.includes(n)) throw Error(`display "${e}" has no view "${n}" — has ${m.join(", ")}`);
|
|
992
1457
|
if (r && !d.looks.some((e) => e.name === r)) throw Error(`config has no look "${r}" — has ${d.looks.map((e) => e.name).join(", ")}`);
|
|
993
|
-
let { fit: h, wide: g, convertible: _ } =
|
|
994
|
-
!h &&
|
|
1458
|
+
let { fit: h, wide: g, convertible: _ } = Jt(Ut(d, e, n)), v = !h && _, y = h ?? (v && g ? "display-p3" : "srgb");
|
|
1459
|
+
!h && !$() && !Ee(H(), e, n) && zt?.warn(t.VIEW_TRANSFORM_DISPLAY_MISMATCH, `"${e}" is no canvas colour space and the config cannot convert it, so the screen shows its codes as sRGB`, {
|
|
995
1460
|
display: e,
|
|
996
1461
|
view: n
|
|
997
1462
|
});
|
|
998
|
-
let
|
|
1463
|
+
let b = ln({
|
|
999
1464
|
source: p,
|
|
1000
1465
|
display: e,
|
|
1001
1466
|
view: n,
|
|
@@ -1005,11 +1470,11 @@ function Lt({ display: e, view: n, look: r = null, context: i = null, source: a
|
|
|
1005
1470
|
size: o,
|
|
1006
1471
|
minEv: s,
|
|
1007
1472
|
maxEv: c
|
|
1008
|
-
});
|
|
1009
|
-
return
|
|
1473
|
+
}), { half: x, error: S, curve: C, linear: w, clip: T, pre: E } = b;
|
|
1474
|
+
return mn({
|
|
1010
1475
|
id: l,
|
|
1011
|
-
half:
|
|
1012
|
-
error:
|
|
1476
|
+
half: x,
|
|
1477
|
+
error: S,
|
|
1013
1478
|
name: u ?? (r ? `${n} + ${r} (${e})` : `${n} (${e})`),
|
|
1014
1479
|
ocio: {
|
|
1015
1480
|
display: e,
|
|
@@ -1018,17 +1483,22 @@ function Lt({ display: e, view: n, look: r = null, context: i = null, source: a
|
|
|
1018
1483
|
context: i,
|
|
1019
1484
|
source: p,
|
|
1020
1485
|
configId: d.id,
|
|
1021
|
-
size:
|
|
1486
|
+
size: b.size,
|
|
1487
|
+
requestedSize: o,
|
|
1022
1488
|
minEv: s,
|
|
1023
1489
|
maxEv: c,
|
|
1024
1490
|
canvas: y,
|
|
1025
|
-
emulated: v
|
|
1491
|
+
emulated: v,
|
|
1492
|
+
curve: C,
|
|
1493
|
+
linear: w,
|
|
1494
|
+
clip: T,
|
|
1495
|
+
pre: E
|
|
1026
1496
|
}
|
|
1027
1497
|
});
|
|
1028
1498
|
}
|
|
1029
|
-
function
|
|
1030
|
-
let { name: n, data: r, error: i, configId: a, display: o, view: s, look: c, context: l, source: u, size: d, minEv: f, maxEv: p, fingerprint: m, ocioVersion: h, canvas: g, emulated: _ } = e;
|
|
1031
|
-
return
|
|
1499
|
+
function fn(e, t = null) {
|
|
1500
|
+
let { name: n, data: r, error: i, configId: a, display: o, view: s, look: c, context: l, source: u, size: d, minEv: f, maxEv: p, fingerprint: m, ocioVersion: h, canvas: g, emulated: _, curve: v, linear: y, clip: b, pre: x } = e;
|
|
1501
|
+
return mn({
|
|
1032
1502
|
id: t,
|
|
1033
1503
|
name: n,
|
|
1034
1504
|
error: i,
|
|
@@ -1043,8 +1513,12 @@ function Rt(e, t = null) {
|
|
|
1043
1513
|
size: d,
|
|
1044
1514
|
minEv: f,
|
|
1045
1515
|
maxEv: p,
|
|
1046
|
-
canvas: g ??
|
|
1516
|
+
canvas: g ?? M(o) ?? "srgb",
|
|
1047
1517
|
emulated: !!_,
|
|
1518
|
+
curve: v ?? null,
|
|
1519
|
+
linear: !!y,
|
|
1520
|
+
clip: b ?? null,
|
|
1521
|
+
pre: x ?? null,
|
|
1048
1522
|
baked: {
|
|
1049
1523
|
fingerprint: m ?? null,
|
|
1050
1524
|
ocioVersion: h ?? null
|
|
@@ -1052,55 +1526,81 @@ function Rt(e, t = null) {
|
|
|
1052
1526
|
}
|
|
1053
1527
|
});
|
|
1054
1528
|
}
|
|
1055
|
-
function
|
|
1056
|
-
let
|
|
1057
|
-
return
|
|
1529
|
+
function pn(e, t, n = null) {
|
|
1530
|
+
let r = new le(e, t, t, t + (n ? Dt(n.n, t) : 0));
|
|
1531
|
+
return r.format = he, r.type = ue, r.minFilter = fe, r.magFilter = fe, r.wrapS = r.wrapT = r.wrapR = ce, r.needsUpdate = !0, r;
|
|
1058
1532
|
}
|
|
1059
|
-
function
|
|
1060
|
-
let { size: a, minEv: o, maxEv: s } = i,
|
|
1533
|
+
function mn({ id: e, name: t, half: n, error: r, ocio: i }) {
|
|
1534
|
+
let { size: a, minEv: o, maxEv: s, curve: c = null, linear: l = !1, clip: u = null, pre: d = null } = i, f = kt({
|
|
1061
1535
|
data: n,
|
|
1062
1536
|
size: a,
|
|
1063
1537
|
minEv: o,
|
|
1064
|
-
maxEv: s
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1538
|
+
maxEv: s,
|
|
1539
|
+
curve: c,
|
|
1540
|
+
linear: l,
|
|
1541
|
+
clip: u,
|
|
1542
|
+
pre: d
|
|
1543
|
+
}), p = e ?? m(), h = `TM_OCIO_${p}`, g = `tm_ocio_${p}`, _ = Y.get(p), v = _ && _.size === a && _.minEv === o && _.maxEv === s && JSON.stringify([
|
|
1544
|
+
_.curve,
|
|
1545
|
+
_.linear,
|
|
1546
|
+
_.clip,
|
|
1547
|
+
_.pre
|
|
1548
|
+
]) === JSON.stringify([
|
|
1549
|
+
c,
|
|
1550
|
+
l,
|
|
1551
|
+
u,
|
|
1552
|
+
d
|
|
1553
|
+
]), y, b;
|
|
1554
|
+
return v ? (y = _.texture, y.image.data = n, y.needsUpdate = !0, b = _.tsl) : (_?.texture.dispose(), y = pn(n, a, c), b = un({
|
|
1555
|
+
texture: y,
|
|
1068
1556
|
size: a,
|
|
1069
1557
|
minEv: o,
|
|
1070
|
-
maxEv: s
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1558
|
+
maxEv: s,
|
|
1559
|
+
curve: c,
|
|
1560
|
+
linear: l,
|
|
1561
|
+
clip: u,
|
|
1562
|
+
pre: d
|
|
1563
|
+
})), Y.set(p, {
|
|
1564
|
+
texture: y,
|
|
1565
|
+
tsl: b,
|
|
1074
1566
|
size: a,
|
|
1075
1567
|
minEv: o,
|
|
1076
|
-
maxEv: s
|
|
1568
|
+
maxEv: s,
|
|
1569
|
+
curve: c,
|
|
1570
|
+
linear: l,
|
|
1571
|
+
clip: u,
|
|
1572
|
+
pre: d
|
|
1077
1573
|
}), {
|
|
1078
|
-
id:
|
|
1574
|
+
id: p,
|
|
1079
1575
|
name: t,
|
|
1080
|
-
wgslConst:
|
|
1576
|
+
wgslConst: h,
|
|
1081
1577
|
source: "ocio",
|
|
1082
1578
|
outputEncoded: !0,
|
|
1083
1579
|
appliesExposure: !0,
|
|
1084
|
-
cpu: (e, t, n, r, i) =>
|
|
1085
|
-
wgsl:
|
|
1086
|
-
fnName:
|
|
1087
|
-
texName: `${
|
|
1580
|
+
cpu: (e, t, n, r, i) => f(e * r, t * r, n * r, i),
|
|
1581
|
+
wgsl: At({
|
|
1582
|
+
fnName: g,
|
|
1583
|
+
texName: `${h.toLowerCase()}_tex`,
|
|
1088
1584
|
size: a,
|
|
1089
1585
|
minEv: o,
|
|
1090
|
-
maxEv: s
|
|
1586
|
+
maxEv: s,
|
|
1587
|
+
curve: c,
|
|
1588
|
+
linear: l,
|
|
1589
|
+
clip: u,
|
|
1590
|
+
pre: d
|
|
1091
1591
|
}),
|
|
1092
|
-
call: `${
|
|
1093
|
-
tsl:
|
|
1592
|
+
call: `${g}( c )`,
|
|
1593
|
+
tsl: b,
|
|
1094
1594
|
table: {
|
|
1095
1595
|
data: n,
|
|
1096
1596
|
size: a,
|
|
1097
|
-
texture:
|
|
1597
|
+
texture: y
|
|
1098
1598
|
},
|
|
1099
1599
|
error: r,
|
|
1100
1600
|
ocio: i
|
|
1101
1601
|
};
|
|
1102
1602
|
}
|
|
1103
|
-
var
|
|
1603
|
+
var Q = Object.freeze({
|
|
1104
1604
|
srgb: [
|
|
1105
1605
|
3.2409699419045226,
|
|
1106
1606
|
-1.537383177570094,
|
|
@@ -1124,21 +1624,17 @@ var J = Object.freeze({
|
|
|
1124
1624
|
316169 / 330415
|
|
1125
1625
|
]
|
|
1126
1626
|
});
|
|
1127
|
-
function
|
|
1128
|
-
let
|
|
1129
|
-
return e < 0 ? -n : n;
|
|
1130
|
-
}
|
|
1131
|
-
function Y() {
|
|
1132
|
-
let e = F()?.colorSpaces.find((e) => e.encoding === "display-linear")?.name, t = (ze()?.split(/^display_colorspaces:[^\n]*$/m)[1]?.split(/^\S/m)[0] ?? "").split(/-\s*!<ColorSpace>/).slice(1), n = t.find((e) => /^\s*encoding:\s*display-linear\s*$/m.test(e)) ?? t.find((e) => !/_display_reference:/.test(e)), r = e ?? n?.match(/^\s*name:\s*(.+?)\s*$/m)?.[1].replace(/^["']|["']$/g, "") ?? null;
|
|
1627
|
+
function $() {
|
|
1628
|
+
let e = V()?.colorSpaces.find((e) => e.encoding === "display-linear")?.name, t = (He()?.split(/^display_colorspaces:[^\n]*$/m)[1]?.split(/^\S/m)[0] ?? "").split(/-\s*!<ColorSpace>/).slice(1), n = t.find((e) => /^\s*encoding:\s*display-linear\s*$/m.test(e)) ?? t.find((e) => !/_display_reference:/.test(e)), r = e ?? n?.match(/^\s*name:\s*(.+?)\s*$/m)?.[1].replace(/^["']|["']$/g, "") ?? null;
|
|
1133
1629
|
return r && /xyz/i.test(r) ? r : null;
|
|
1134
1630
|
}
|
|
1135
|
-
function
|
|
1136
|
-
let u =
|
|
1631
|
+
function hn({ display: e, view: t, look: n = null, context: r = null, source: i = null, canvas: a = "srgb", for: o = null, size: s = null, minEv: c = Pt, maxEv: l = Ft } = {}) {
|
|
1632
|
+
let u = V();
|
|
1137
1633
|
if (!u) throw Error("load an OCIO config first");
|
|
1138
1634
|
let d = i ?? u.roles.find((e) => e.name === "scene_linear")?.colorSpace;
|
|
1139
|
-
if (
|
|
1140
|
-
if (!
|
|
1141
|
-
let
|
|
1635
|
+
if (!$()) throw Error("the config names no display-referred CIE XYZ space to decode its displays in");
|
|
1636
|
+
if (!Q[a]) throw Error(`no encoding for a "${a}" canvas`);
|
|
1637
|
+
let f = ln({
|
|
1142
1638
|
source: d,
|
|
1143
1639
|
display: e,
|
|
1144
1640
|
view: t,
|
|
@@ -1148,11 +1644,11 @@ function Ht({ display: e, view: t, look: n = null, context: r = null, source: i
|
|
|
1148
1644
|
size: s,
|
|
1149
1645
|
minEv: c,
|
|
1150
1646
|
maxEv: l
|
|
1151
|
-
});
|
|
1152
|
-
return
|
|
1647
|
+
}), { half: p, error: m, curve: h, linear: g, clip: _, pre: v } = f;
|
|
1648
|
+
return _n({
|
|
1153
1649
|
name: n ? `${t} + ${n} (${e})` : `${t} (${e})`,
|
|
1154
|
-
half:
|
|
1155
|
-
error:
|
|
1650
|
+
half: p,
|
|
1651
|
+
error: m,
|
|
1156
1652
|
ocio: {
|
|
1157
1653
|
display: e,
|
|
1158
1654
|
view: t,
|
|
@@ -1160,17 +1656,22 @@ function Ht({ display: e, view: t, look: n = null, context: r = null, source: i
|
|
|
1160
1656
|
context: r,
|
|
1161
1657
|
source: d,
|
|
1162
1658
|
configId: u.id,
|
|
1163
|
-
size:
|
|
1659
|
+
size: f.size,
|
|
1660
|
+
requestedSize: s,
|
|
1164
1661
|
minEv: c,
|
|
1165
1662
|
maxEv: l,
|
|
1166
1663
|
canvas: a,
|
|
1167
|
-
for: o
|
|
1664
|
+
for: o,
|
|
1665
|
+
curve: h,
|
|
1666
|
+
linear: g,
|
|
1667
|
+
clip: _,
|
|
1668
|
+
pre: v
|
|
1168
1669
|
}
|
|
1169
1670
|
});
|
|
1170
1671
|
}
|
|
1171
|
-
function
|
|
1172
|
-
let { name: t, data: n, error: r, configId: i, display: a, view: o, look: s, context: c, source: l, size: u, minEv: d, maxEv: f, canvas: p, for: m } = e;
|
|
1173
|
-
return
|
|
1672
|
+
function gn(e) {
|
|
1673
|
+
let { name: t, data: n, error: r, configId: i, display: a, view: o, look: s, context: c, source: l, size: u, minEv: d, maxEv: f, canvas: p, for: m, linear: h, clip: g, pre: _ } = e;
|
|
1674
|
+
return _n({
|
|
1174
1675
|
name: t,
|
|
1175
1676
|
half: n,
|
|
1176
1677
|
error: r,
|
|
@@ -1185,12 +1686,15 @@ function Ut(e) {
|
|
|
1185
1686
|
minEv: d,
|
|
1186
1687
|
maxEv: f,
|
|
1187
1688
|
canvas: p ?? "srgb",
|
|
1188
|
-
for: m ?? null
|
|
1689
|
+
for: m ?? null,
|
|
1690
|
+
linear: !!h,
|
|
1691
|
+
clip: g ?? null,
|
|
1692
|
+
pre: _ ?? null
|
|
1189
1693
|
}
|
|
1190
1694
|
});
|
|
1191
1695
|
}
|
|
1192
|
-
function
|
|
1193
|
-
let { size: i, minEv: a, maxEv: o } = r,
|
|
1696
|
+
function _n({ name: e, half: t, error: n, ocio: r }) {
|
|
1697
|
+
let { size: i, minEv: a, maxEv: o, curve: s = null, linear: c = !1, clip: l = null, pre: u = null } = r, d = pn(t, i, s);
|
|
1194
1698
|
return {
|
|
1195
1699
|
name: e,
|
|
1196
1700
|
source: "ocio",
|
|
@@ -1199,22 +1703,26 @@ function Wt({ name: e, half: t, error: n, ocio: r }) {
|
|
|
1199
1703
|
table: {
|
|
1200
1704
|
data: t,
|
|
1201
1705
|
size: i,
|
|
1202
|
-
texture:
|
|
1706
|
+
texture: d
|
|
1203
1707
|
},
|
|
1204
|
-
tsl:
|
|
1205
|
-
texture:
|
|
1708
|
+
tsl: un({
|
|
1709
|
+
texture: d,
|
|
1206
1710
|
size: i,
|
|
1207
1711
|
minEv: a,
|
|
1208
|
-
maxEv: o
|
|
1712
|
+
maxEv: o,
|
|
1713
|
+
curve: s,
|
|
1714
|
+
linear: c,
|
|
1715
|
+
clip: l,
|
|
1716
|
+
pre: u
|
|
1209
1717
|
}),
|
|
1210
|
-
dispose: () =>
|
|
1718
|
+
dispose: () => d.dispose()
|
|
1211
1719
|
};
|
|
1212
1720
|
}
|
|
1213
|
-
function
|
|
1214
|
-
return
|
|
1721
|
+
function vn(e) {
|
|
1722
|
+
return b(dn(e));
|
|
1215
1723
|
}
|
|
1216
|
-
function
|
|
1217
|
-
let o =
|
|
1724
|
+
function yn({ display: e = null, look: n = null, context: r = null, source: i = null, size: a = null } = {}) {
|
|
1725
|
+
let o = V();
|
|
1218
1726
|
if (!o) throw Error("load an OCIO config first");
|
|
1219
1727
|
let s = e ?? o.defaultDisplay, c = o.viewsByDisplay[s] ?? [], l = [], u = [];
|
|
1220
1728
|
for (let e of c) {
|
|
@@ -1226,7 +1734,7 @@ function Gt({ display: e = null, look: n = null, context: r = null, source: i =
|
|
|
1226
1734
|
continue;
|
|
1227
1735
|
}
|
|
1228
1736
|
try {
|
|
1229
|
-
l.push(
|
|
1737
|
+
l.push(vn({
|
|
1230
1738
|
display: s,
|
|
1231
1739
|
view: e.name,
|
|
1232
1740
|
look: n,
|
|
@@ -1238,7 +1746,7 @@ function Gt({ display: e = null, look: n = null, context: r = null, source: i =
|
|
|
1238
1746
|
u.push({
|
|
1239
1747
|
view: e.name,
|
|
1240
1748
|
reason: n.message
|
|
1241
|
-
}),
|
|
1749
|
+
}), zt?.warn(t.VIEW_TRANSFORM_BAKE_FAILED, `could not bake "${e.name}" (${s}): ${n.message}`, {
|
|
1242
1750
|
display: s,
|
|
1243
1751
|
view: e.name
|
|
1244
1752
|
});
|
|
@@ -1249,38 +1757,38 @@ function Gt({ display: e = null, look: n = null, context: r = null, source: i =
|
|
|
1249
1757
|
skipped: u
|
|
1250
1758
|
};
|
|
1251
1759
|
}
|
|
1252
|
-
function
|
|
1253
|
-
let t =
|
|
1254
|
-
t && (t.texture.dispose(),
|
|
1760
|
+
function bn(e) {
|
|
1761
|
+
let t = Y.get(e);
|
|
1762
|
+
t && (t.texture.dispose(), Y.delete(e));
|
|
1255
1763
|
}
|
|
1256
|
-
function
|
|
1764
|
+
function xn(e = null) {
|
|
1257
1765
|
for (let t of d.values()) t.source === "ocio" && !e?.has(t.id) && t.table?.texture?.dispose?.();
|
|
1258
|
-
for (let [t, n] of
|
|
1766
|
+
for (let [t, n] of Y) e?.has(t) || (n.texture.dispose(), Y.delete(t));
|
|
1259
1767
|
}
|
|
1260
1768
|
//#endregion
|
|
1261
1769
|
//#region src/Color/BakedViews.js
|
|
1262
|
-
var
|
|
1770
|
+
var Sn = [
|
|
1263
1771
|
82,
|
|
1264
1772
|
90,
|
|
1265
1773
|
86,
|
|
1266
1774
|
84
|
|
1267
|
-
],
|
|
1268
|
-
async function
|
|
1775
|
+
], Cn = "rayzee-baked-view", wn = 15360;
|
|
1776
|
+
async function Tn(e, t) {
|
|
1269
1777
|
return new Uint8Array(await new Response(new Blob([e]).stream().pipeThrough(t)).arrayBuffer());
|
|
1270
1778
|
}
|
|
1271
|
-
async function
|
|
1779
|
+
async function En(e, t = {}) {
|
|
1272
1780
|
let n = e?.table?.data;
|
|
1273
1781
|
if (e?.source !== "ocio" || !(n instanceof Uint16Array)) throw Error("only a baked OCIO view can be saved");
|
|
1274
1782
|
let { size: r, minEv: i, maxEv: a } = e.ocio, o = r * r * r;
|
|
1275
1783
|
if (n.length !== o * 4) throw Error(`table holds ${n.length} values, expected ${o * 4}`);
|
|
1276
1784
|
let s = new Uint8Array(o * 6);
|
|
1277
1785
|
for (let e = 0; e < 3; e++) for (let t = 0; t < o; t++) {
|
|
1278
|
-
if (e === 0 && n[t * 4 + 3] !==
|
|
1786
|
+
if (e === 0 && n[t * 4 + 3] !== wn) throw Error("table alpha is not 1");
|
|
1279
1787
|
let i = n[t * 4 + e] - (t % r ? n[(t - 1) * 4 + e] : 0) & 65535;
|
|
1280
1788
|
s[e * o + t] = i >> 8, s[3 * o + e * o + t] = i & 255;
|
|
1281
1789
|
}
|
|
1282
|
-
let { display: c, view: l, look: u, context: d, source: f, configId: p, canvas: m, emulated: h, for: g } = e.ocio,
|
|
1283
|
-
format:
|
|
1790
|
+
let { display: c, view: l, look: u, context: d, source: f, configId: p, canvas: m, emulated: h, for: g, linear: _, clip: v, pre: y } = e.ocio, b = new TextEncoder().encode(JSON.stringify({
|
|
1791
|
+
format: Cn,
|
|
1284
1792
|
version: 1,
|
|
1285
1793
|
name: e.name,
|
|
1286
1794
|
configId: p,
|
|
@@ -1298,15 +1806,18 @@ async function Qt(e, t = {}) {
|
|
|
1298
1806
|
emulated: !!h
|
|
1299
1807
|
} : {},
|
|
1300
1808
|
...g ? { for: g } : {},
|
|
1809
|
+
..._ ? { linear: !0 } : {},
|
|
1810
|
+
...v ? { clip: v } : {},
|
|
1811
|
+
...y ? { pre: y } : {},
|
|
1301
1812
|
...t
|
|
1302
|
-
})),
|
|
1303
|
-
return
|
|
1813
|
+
})), x = new Uint8Array(8 + b.length + s.length);
|
|
1814
|
+
return x.set(Sn, 0), new DataView(x.buffer).setUint32(4, b.length, !0), x.set(b, 8), x.set(s, 8 + b.length), await Tn(x, new CompressionStream("gzip"));
|
|
1304
1815
|
}
|
|
1305
|
-
async function
|
|
1306
|
-
let t = await
|
|
1307
|
-
if (t.length < 8 ||
|
|
1816
|
+
async function Dn(e) {
|
|
1817
|
+
let t = await Tn(e, new DecompressionStream("gzip"));
|
|
1818
|
+
if (t.length < 8 || Sn.some((e, n) => t[n] !== e)) throw Error("not a baked view file");
|
|
1308
1819
|
let n = new DataView(t.buffer, t.byteOffset).getUint32(4, !0), r = JSON.parse(new TextDecoder().decode(t.subarray(8, 8 + n)));
|
|
1309
|
-
if (r.format !==
|
|
1820
|
+
if (r.format !== Cn || r.version !== 1) throw Error(`unsupported baked view ${r.format} v${r.version}`);
|
|
1310
1821
|
let { size: i, minEv: a, maxEv: o } = r;
|
|
1311
1822
|
if (!Number.isInteger(i) || i < 2 || i > 129 || !(a < o)) throw Error("baked view has a bad table shape");
|
|
1312
1823
|
let s = i * i * i, c = t.subarray(8 + n);
|
|
@@ -1316,13 +1827,13 @@ async function $t(e) {
|
|
|
1316
1827
|
let t = 0;
|
|
1317
1828
|
for (let n = 0; n < s; n++) n % i === 0 && (t = 0), t = t + (c[e * s + n] << 8 | c[3 * s + e * s + n]) & 65535, l[n * 4 + e] = t;
|
|
1318
1829
|
}
|
|
1319
|
-
for (let e = 0; e < s; e++) l[e * 4 + 3] =
|
|
1830
|
+
for (let e = 0; e < s; e++) l[e * 4 + 3] = wn;
|
|
1320
1831
|
return {
|
|
1321
1832
|
...r,
|
|
1322
1833
|
data: l
|
|
1323
1834
|
};
|
|
1324
1835
|
}
|
|
1325
|
-
async function
|
|
1836
|
+
async function On({ builtin: e, text: t, files: n = [], configPath: r = "config.ocio" } = {}) {
|
|
1326
1837
|
if (e) return `builtin:${e}`;
|
|
1327
1838
|
let i = globalThis.crypto?.subtle;
|
|
1328
1839
|
if (!i) return null;
|
|
@@ -1331,35 +1842,35 @@ async function en({ builtin: e, text: t, files: n = [], configPath: r = "config.
|
|
|
1331
1842
|
}
|
|
1332
1843
|
//#endregion
|
|
1333
1844
|
//#region src/Color/InputColorSpaces.js
|
|
1334
|
-
var
|
|
1335
|
-
function
|
|
1336
|
-
return
|
|
1845
|
+
var kn = [], An = 0;
|
|
1846
|
+
function jn() {
|
|
1847
|
+
return An;
|
|
1337
1848
|
}
|
|
1338
|
-
function
|
|
1339
|
-
|
|
1849
|
+
function Mn() {
|
|
1850
|
+
An++;
|
|
1340
1851
|
}
|
|
1341
|
-
function
|
|
1342
|
-
|
|
1852
|
+
function Nn(e, t) {
|
|
1853
|
+
kn.unshift({
|
|
1343
1854
|
match: e,
|
|
1344
1855
|
colorSpace: t
|
|
1345
|
-
}),
|
|
1856
|
+
}), An++;
|
|
1346
1857
|
}
|
|
1347
|
-
function
|
|
1348
|
-
|
|
1858
|
+
function Pn() {
|
|
1859
|
+
kn.length !== 0 && (kn.length = 0, An++);
|
|
1349
1860
|
}
|
|
1350
|
-
function
|
|
1351
|
-
return
|
|
1861
|
+
function Fn() {
|
|
1862
|
+
return kn.map((e) => ({
|
|
1352
1863
|
match: String(e.match),
|
|
1353
1864
|
colorSpace: e.colorSpace
|
|
1354
1865
|
}));
|
|
1355
1866
|
}
|
|
1356
|
-
function
|
|
1867
|
+
function In(e) {
|
|
1357
1868
|
if (!e) return null;
|
|
1358
|
-
for (let t of
|
|
1869
|
+
for (let t of kn) if (t.match instanceof RegExp ? t.match.test(e) : e.includes(t.match)) return t.colorSpace;
|
|
1359
1870
|
return null;
|
|
1360
1871
|
}
|
|
1361
|
-
function
|
|
1362
|
-
return
|
|
1872
|
+
function Ln() {
|
|
1873
|
+
return V()?.fileRules.map((e) => ({
|
|
1363
1874
|
index: e.index,
|
|
1364
1875
|
name: e.name,
|
|
1365
1876
|
colorSpace: e.colorSpace,
|
|
@@ -1368,24 +1879,24 @@ function cn() {
|
|
|
1368
1879
|
regex: e.regex
|
|
1369
1880
|
})) ?? [];
|
|
1370
1881
|
}
|
|
1371
|
-
function
|
|
1372
|
-
let t =
|
|
1882
|
+
function Rn(e) {
|
|
1883
|
+
let t = V();
|
|
1373
1884
|
if (!t) return null;
|
|
1374
1885
|
let n = (e) => t.roles.find((t) => t.name === e)?.colorSpace ?? null;
|
|
1375
|
-
return e ===
|
|
1886
|
+
return e === pe ? n("data") : e === ge ? n("texture_paint") ?? n("color_picking") ?? t.colorSpaces.find((e) => /^srgb\b/i.test(e.name) && !/display/i.test(e.name))?.name ?? null : e === de ? t.colorSpaces.find((e) => /^lin(ear)?[\s_-]*(rec\.?\s*)?709/i.test(e.name))?.name ?? t.colorSpaces.find((e) => /^linear.*srgb/i.test(e.name))?.name ?? n("scene_linear") : null;
|
|
1376
1887
|
}
|
|
1377
|
-
function
|
|
1378
|
-
if (!
|
|
1379
|
-
let n =
|
|
1888
|
+
function zn(e, { threeColorSpace: t = null } = {}) {
|
|
1889
|
+
if (!V()) return null;
|
|
1890
|
+
let n = In(e);
|
|
1380
1891
|
if (n) return {
|
|
1381
1892
|
colorSpace: n,
|
|
1382
1893
|
via: "override",
|
|
1383
1894
|
rule: null
|
|
1384
1895
|
};
|
|
1385
|
-
let r =
|
|
1896
|
+
let r = B();
|
|
1386
1897
|
if (r && e) {
|
|
1387
1898
|
let t = r.matchFileRule(e);
|
|
1388
|
-
if (t && !t.isDefaultRule &&
|
|
1899
|
+
if (t && !t.isDefaultRule && J(t.colorSpace)) return {
|
|
1389
1900
|
colorSpace: t.colorSpace,
|
|
1390
1901
|
via: "rule",
|
|
1391
1902
|
rule: {
|
|
@@ -1394,16 +1905,16 @@ function $(e, { threeColorSpace: t = null } = {}) {
|
|
|
1394
1905
|
}
|
|
1395
1906
|
};
|
|
1396
1907
|
}
|
|
1397
|
-
let i =
|
|
1908
|
+
let i = Rn(t);
|
|
1398
1909
|
if (i) return {
|
|
1399
1910
|
colorSpace: i,
|
|
1400
1911
|
via: "three",
|
|
1401
1912
|
rule: null
|
|
1402
1913
|
};
|
|
1403
|
-
let a =
|
|
1914
|
+
let a = B();
|
|
1404
1915
|
if (a && e) {
|
|
1405
1916
|
let t = a.matchFileRule(e);
|
|
1406
|
-
if (t &&
|
|
1917
|
+
if (t && J(t.colorSpace)) return {
|
|
1407
1918
|
colorSpace: t.colorSpace,
|
|
1408
1919
|
via: "rule",
|
|
1409
1920
|
rule: {
|
|
@@ -1415,37 +1926,46 @@ function $(e, { threeColorSpace: t = null } = {}) {
|
|
|
1415
1926
|
}
|
|
1416
1927
|
return null;
|
|
1417
1928
|
}
|
|
1418
|
-
function
|
|
1929
|
+
function Bn(e) {
|
|
1419
1930
|
if (!e) return !1;
|
|
1420
|
-
if (e.colorSpace ===
|
|
1931
|
+
if (e.colorSpace === pe) return !0;
|
|
1421
1932
|
let t = e.userData?.ocioColorSpace;
|
|
1422
|
-
return !!(t &&
|
|
1933
|
+
return !!(t && ht(t));
|
|
1423
1934
|
}
|
|
1424
|
-
function
|
|
1935
|
+
function Vn(e, t) {
|
|
1425
1936
|
return t ?? e.userData?.sourcePath ?? (e.name || null) ?? e.image?.src ?? null;
|
|
1426
1937
|
}
|
|
1427
|
-
function
|
|
1428
|
-
if (!
|
|
1938
|
+
function Hn(e, t = null) {
|
|
1939
|
+
if (!V() || !e) return null;
|
|
1429
1940
|
let n = e.userData?.ocioColorSpace;
|
|
1430
|
-
return n ?
|
|
1941
|
+
return n ? J(n) ? {
|
|
1431
1942
|
colorSpace: n,
|
|
1432
1943
|
via: "tag",
|
|
1433
1944
|
rule: null
|
|
1434
|
-
} : null :
|
|
1945
|
+
} : null : Bn(e) ? null : zn(Vn(e, t), { threeColorSpace: e.colorSpace });
|
|
1435
1946
|
}
|
|
1436
|
-
function
|
|
1437
|
-
return
|
|
1947
|
+
function Un(e, t = null) {
|
|
1948
|
+
return Hn(e, t)?.colorSpace ?? null;
|
|
1438
1949
|
}
|
|
1439
1950
|
//#endregion
|
|
1440
1951
|
//#region src/Color/ColorManagement.js
|
|
1441
|
-
function
|
|
1442
|
-
return
|
|
1443
|
-
}
|
|
1444
|
-
function
|
|
1445
|
-
return e?.source === "ocio" ? e.ocio.canvas ??
|
|
1446
|
-
}
|
|
1447
|
-
var
|
|
1448
|
-
|
|
1952
|
+
function Wn(e) {
|
|
1953
|
+
return M(e) ?? "srgb";
|
|
1954
|
+
}
|
|
1955
|
+
function Gn(e) {
|
|
1956
|
+
return e?.source === "ocio" ? e.ocio.canvas ?? Wn(e.ocio.display) : "srgb";
|
|
1957
|
+
}
|
|
1958
|
+
var Kn = 4, qn = Object.freeze([
|
|
1959
|
+
.64,
|
|
1960
|
+
.33,
|
|
1961
|
+
.3,
|
|
1962
|
+
.6,
|
|
1963
|
+
.15,
|
|
1964
|
+
.06,
|
|
1965
|
+
.3127,
|
|
1966
|
+
.329
|
|
1967
|
+
]), Jn = "native";
|
|
1968
|
+
function Yn(e, t) {
|
|
1449
1969
|
return JSON.stringify([
|
|
1450
1970
|
e.configId,
|
|
1451
1971
|
e.display,
|
|
@@ -1456,29 +1976,9 @@ function _n(e, t) {
|
|
|
1456
1976
|
t
|
|
1457
1977
|
]);
|
|
1458
1978
|
}
|
|
1459
|
-
var
|
|
1460
|
-
"Linear Rec.709 (sRGB)",
|
|
1461
|
-
"lin_rec709_srgb",
|
|
1462
|
-
"lin_rec709",
|
|
1463
|
-
"lin_srgb",
|
|
1464
|
-
"Linear Rec.709",
|
|
1465
|
-
"Utility - Linear - sRGB",
|
|
1466
|
-
"Utility - Linear - Rec.709",
|
|
1467
|
-
"Linear BT.709",
|
|
1468
|
-
"linrec709"
|
|
1469
|
-
], yn = /^(lin(ear)?[\s_-]*(rec\.?\s*|bt\.?\s*)?709|linear[\s_-]*\(?srgb\)?$|utility - linear - (srgb|rec\.?709))/i;
|
|
1470
|
-
function bn(e) {
|
|
1471
|
-
if (!e) return null;
|
|
1472
|
-
let t = e.colorSpaces.filter((e) => !e.isData), n = (e) => [e.name, ...e.aliases ?? []];
|
|
1473
|
-
for (let e of vn) {
|
|
1474
|
-
let r = t.find((t) => n(t).some((t) => t.toLowerCase() === e.toLowerCase()));
|
|
1475
|
-
if (r) return r.name;
|
|
1476
|
-
}
|
|
1477
|
-
return t.find((e) => n(e).some((e) => yn.test(e)))?.name ?? null;
|
|
1478
|
-
}
|
|
1479
|
-
var xn = class {
|
|
1979
|
+
var Xn = class {
|
|
1480
1980
|
constructor({ issues: e = null, renderer: t = null } = {}) {
|
|
1481
|
-
this._issues = e, this._renderer = t, this._listeners = /* @__PURE__ */ new Map(), this._workingSpace = null, this._activeView = null, this._exportSpace = null, this._context = null, this._lastUsed = /* @__PURE__ */ new Map(), this._useClock = 0, this._lastBuiltin = y, this._fingerprint = null, this._hdrOutput = !1, this._canvasView = null, this._canvasReason = null, this._bakedCanvasViews = /* @__PURE__ */ new Map(), this._recentCanvasViews = /* @__PURE__ */ new Map(),
|
|
1981
|
+
this._issues = e, this._renderer = t, this._listeners = /* @__PURE__ */ new Map(), this._workingSpace = null, this._activeView = null, this._exportSpace = null, this._context = null, this._lastUsed = /* @__PURE__ */ new Map(), this._useClock = 0, this._lastBuiltin = y, this._fingerprint = null, this._hdrOutput = !1, this._canvasView = null, this._canvasReason = null, this._bakedCanvasViews = /* @__PURE__ */ new Map(), this._recentCanvasViews = /* @__PURE__ */ new Map(), Bt(e), this._offRegistry = x(() => {
|
|
1482
1982
|
this._renderer && v(this._renderer), this._emit("transforms");
|
|
1483
1983
|
}), o(this);
|
|
1484
1984
|
}
|
|
@@ -1493,23 +1993,23 @@ var xn = class {
|
|
|
1493
1993
|
});
|
|
1494
1994
|
}
|
|
1495
1995
|
static async listBuiltinConfigs() {
|
|
1496
|
-
return await
|
|
1996
|
+
return await ze();
|
|
1497
1997
|
}
|
|
1498
1998
|
async loadConfig({ adoptWorkingSpace: e = !1, registerViews: n = !0, display: r = null, lutSize: i, ...a } = {}) {
|
|
1499
|
-
await
|
|
1500
|
-
let o =
|
|
1999
|
+
await Re();
|
|
2000
|
+
let o = On(a).catch(() => null), s = await this._bakedViewsFrom(a.builtin ?? a.id ?? null, o), c;
|
|
1501
2001
|
try {
|
|
1502
|
-
c = await
|
|
2002
|
+
c = await Be(a);
|
|
1503
2003
|
} catch (e) {
|
|
1504
2004
|
throw this._issues?.warn(t.COLOR_CONFIG_LOAD_FAILED, `colour config failed to load; the previous one stays in effect: ${e.message}`, {
|
|
1505
2005
|
builtin: a.builtin ?? null,
|
|
1506
2006
|
configPath: a.configPath ?? null
|
|
1507
2007
|
}), e;
|
|
1508
2008
|
}
|
|
1509
|
-
this._releaseViews(new Set(s.filter((e) => e.ocio.baked.ocioVersion === c.ocioVersion).map((e) => e.id))), this._fingerprint = o,
|
|
2009
|
+
this._releaseViews(new Set(s.filter((e) => e.ocio.baked.ocioVersion === c.ocioVersion).map((e) => e.id))), this._fingerprint = o, Mn(), et(), this._context = null;
|
|
1510
2010
|
let l = this._workingSpace;
|
|
1511
|
-
if (e ? this._workingSpace = c.sceneLinear : l && !
|
|
1512
|
-
let e = r ?? c.defaultDisplay, { added: t, skipped: n } =
|
|
2011
|
+
if (e ? this._workingSpace = c.sceneLinear : l && !J(l) && (this._workingSpace = null), j(V()) || this._issues?.warn(t.COLOR_CONFIG_LOAD_FAILED, `"${c.id}" names no linear Rec.709 space, so until a working space is adopted its views treat the render as ${c.sceneLinear} — colours will be off by that primaries change`, { sceneLinear: c.sceneLinear }), this._publishWorkingMatrix(), this._emit("config", c), n) {
|
|
2012
|
+
let e = r ?? c.defaultDisplay, { added: t, skipped: n } = yn({
|
|
1513
2013
|
display: e,
|
|
1514
2014
|
context: this._context,
|
|
1515
2015
|
source: this.workingSpace,
|
|
@@ -1527,12 +2027,12 @@ var xn = class {
|
|
|
1527
2027
|
return (this._workingSpace ?? null) !== (l ?? null) && this._emit("workingSpace", this.workingSpace), this._updateCanvasView(), c;
|
|
1528
2028
|
}
|
|
1529
2029
|
unloadConfig() {
|
|
1530
|
-
this.workingSpaceAdopted && this._issues?.warn(t.COLOR_CONFIG_LOAD_FAILED, `unloaded while rendering in ${this._workingSpace}; the environment stays converted into it — use app.unloadColorConfig(), which reverts the scene first`, { workingSpace: this._workingSpace }), this._releaseViews(),
|
|
2030
|
+
this.workingSpaceAdopted && this._issues?.warn(t.COLOR_CONFIG_LOAD_FAILED, `unloaded while rendering in ${this._workingSpace}; the environment stays converted into it — use app.unloadColorConfig(), which reverts the scene first`, { workingSpace: this._workingSpace }), this._releaseViews(), Ve(), et(), Pn(), Mn(), this._fingerprint = null, this._workingSpace = null, this._activeView = null, this._exportSpace = null, this._context = null, n(null), this._applyRendererOutputColorSpace(), this._updateCanvasView(), this._emit("config", null), this._emit("workingSpace", this.workingSpace);
|
|
1531
2031
|
}
|
|
1532
2032
|
_releaseViews(e = null) {
|
|
1533
|
-
|
|
2033
|
+
xn(e), on(), g(e);
|
|
1534
2034
|
for (let t of this._lastUsed.keys()) e?.has(t) || this._lastUsed.delete(t);
|
|
1535
|
-
this._renderer &&
|
|
2035
|
+
this._renderer && S(this._renderer.toneMapping) === null && (this._renderer.toneMapping = S(this._lastBuiltin) ? this._lastBuiltin : y, this._activeView = null, this._applyRendererOutputColorSpace(), this._updateCanvasView());
|
|
1536
2036
|
}
|
|
1537
2037
|
async _bakedViewsFrom(e, t) {
|
|
1538
2038
|
let n = [...d.values()].filter((t) => t.ocio?.baked && e !== null && t.ocio.configId === e);
|
|
@@ -1541,59 +2041,59 @@ var xn = class {
|
|
|
1541
2041
|
return r ? n.filter((e) => e.ocio.baked.fingerprint === r) : [];
|
|
1542
2042
|
}
|
|
1543
2043
|
async loadBakedView(e, { expect: t = null } = {}) {
|
|
1544
|
-
let n = await
|
|
2044
|
+
let n = await Dn(e);
|
|
1545
2045
|
for (let [e, r] of Object.entries(t ?? {})) if ((n[e] ?? null) !== (r ?? null)) throw Error(`baked view has ${e} "${n[e]}", expected "${r}"`);
|
|
1546
|
-
let r =
|
|
2046
|
+
let r = H();
|
|
1547
2047
|
if (r && (r.id !== n.configId || await this._fingerprint !== n.fingerprint)) throw Error(`baked view is from "${n.configId}", not the loaded "${r.id}"`);
|
|
1548
2048
|
if (n.for) {
|
|
1549
|
-
let e =
|
|
2049
|
+
let e = Yn({
|
|
1550
2050
|
...n,
|
|
1551
2051
|
...n.for
|
|
1552
2052
|
}, n.canvas ?? "srgb"), t = this._bakedCanvasViews.get(e);
|
|
1553
|
-
return this._bakedCanvasViews.set(e,
|
|
2053
|
+
return this._bakedCanvasViews.set(e, gn(n)), t && t !== this._canvasView?.table && t.dispose(), this._updateCanvasView(), [...d.values()].find((e) => e.source === "ocio" && e.ocio.display === n.for.display && e.ocio.view === n.for.view && (e.ocio.look ?? null) === (n.look ?? null)) ?? null;
|
|
1554
2054
|
}
|
|
1555
2055
|
let i = [...d.values()].find((e) => e.source === "ocio" && e.ocio.display === n.display && e.ocio.view === n.view && (e.ocio.look ?? null) === (n.look ?? null));
|
|
1556
|
-
return i || this._makeRoomForTable(),
|
|
2056
|
+
return i || this._makeRoomForTable(), b(fn(n, i?.id ?? null));
|
|
1557
2057
|
}
|
|
1558
2058
|
async saveBakedView(e, { hdr: t = !1 } = {}) {
|
|
1559
|
-
let n =
|
|
2059
|
+
let n = S(e);
|
|
1560
2060
|
if (n?.source !== "ocio") throw Error(`no OCIO view with id ${e}`);
|
|
1561
|
-
let r =
|
|
2061
|
+
let r = H(), i = {
|
|
1562
2062
|
configId: r?.id ?? n.ocio.configId,
|
|
1563
2063
|
fingerprint: (r ? await this._fingerprint : null) ?? n.ocio.baked?.fingerprint ?? null,
|
|
1564
2064
|
ocioVersion: r?.ocioVersion ?? n.ocio.baked?.ocioVersion ?? null
|
|
1565
2065
|
};
|
|
1566
|
-
if (!t) return await
|
|
1567
|
-
let a =
|
|
2066
|
+
if (!t) return await En(n, i);
|
|
2067
|
+
let a = Gn(n), o = Yn(n.ocio, a), s = this._canvasView?.key === o ? this._canvasView.table : this._bakedCanvasViews.get(o) ?? this._recentCanvasViews.get(o), c = s ? null : r && Me(r, n.ocio.display, n.ocio.view);
|
|
1568
2068
|
if (!s && !c) throw Error(`"${n.name}" has no HDR version${r ? " in this config" : " without its config loaded"}`);
|
|
1569
2069
|
let l = s ?? this._buildCanvasView(n, c, a);
|
|
1570
2070
|
try {
|
|
1571
|
-
return await
|
|
2071
|
+
return await En(l, i);
|
|
1572
2072
|
} finally {
|
|
1573
2073
|
l !== s && l.dispose();
|
|
1574
2074
|
}
|
|
1575
2075
|
}
|
|
1576
2076
|
get hasConfig() {
|
|
1577
|
-
return
|
|
2077
|
+
return z();
|
|
1578
2078
|
}
|
|
1579
2079
|
describe() {
|
|
1580
|
-
return
|
|
2080
|
+
return H();
|
|
1581
2081
|
}
|
|
1582
2082
|
get workingSpace() {
|
|
1583
|
-
return this._workingSpace ? this._workingSpace :
|
|
2083
|
+
return this._workingSpace ? this._workingSpace : z() ? this.nativeLinearSpace ?? H()?.sceneLinear ?? "Linear Rec.709 (sRGB)" : c;
|
|
1584
2084
|
}
|
|
1585
2085
|
get workingSpaceAdopted() {
|
|
1586
2086
|
return this._workingSpace !== null;
|
|
1587
2087
|
}
|
|
1588
2088
|
setWorkingSpace(e) {
|
|
1589
2089
|
if (e !== null) {
|
|
1590
|
-
if (!
|
|
1591
|
-
if (!
|
|
2090
|
+
if (!z()) throw Error("load an OCIO config before choosing a working space");
|
|
2091
|
+
if (!J(e)) throw Error(`config has no colour space "${e}"`);
|
|
1592
2092
|
}
|
|
1593
|
-
(this._workingSpace ?? null) !== (e ?? null) && (this._workingSpace = e,
|
|
2093
|
+
(this._workingSpace ?? null) !== (e ?? null) && (this._workingSpace = e, Ye(), this._publishWorkingMatrix(), this._rebakeViews(), this._emit("workingSpace", this.workingSpace));
|
|
1594
2094
|
}
|
|
1595
2095
|
matrixToWorking(e) {
|
|
1596
|
-
return
|
|
2096
|
+
return z() ? mt(e, this.workingSpace, { context: this._context }) : null;
|
|
1597
2097
|
}
|
|
1598
2098
|
listViews() {
|
|
1599
2099
|
return p();
|
|
@@ -1602,7 +2102,7 @@ var xn = class {
|
|
|
1602
2102
|
return this._activeView;
|
|
1603
2103
|
}
|
|
1604
2104
|
setActiveView(e) {
|
|
1605
|
-
let t =
|
|
2105
|
+
let t = S(e);
|
|
1606
2106
|
if (!t) throw Error(`no view transform with id ${e}`);
|
|
1607
2107
|
return this._isStale(t) && (t = this._rebakeView(t) ?? t), this._activeView = t.source === "ocio" ? {
|
|
1608
2108
|
...t.ocio,
|
|
@@ -1611,10 +2111,10 @@ var xn = class {
|
|
|
1611
2111
|
} : null, this._lastUsed.set(e, ++this._useClock), t.source === "builtin" && (this._lastBuiltin = e), this._renderer && (this._renderer.toneMapping = e), this._applyRendererOutputColorSpace(), this._updateCanvasView(), this._emit("view", t), t;
|
|
1612
2112
|
}
|
|
1613
2113
|
setView({ display: e, view: t, look: n = null, size: r } = {}) {
|
|
1614
|
-
if (!
|
|
2114
|
+
if (!z()) throw Error("load an OCIO config first");
|
|
1615
2115
|
let i = [...d.values()].find((i) => i.source === "ocio" && i.ocio.display === e && i.ocio.view === t && (i.ocio.look ?? null) === (n ?? null) && (!r || i.ocio.size === r));
|
|
1616
2116
|
i || this._makeRoomForTable();
|
|
1617
|
-
let a = i ??
|
|
2117
|
+
let a = i ?? vn({
|
|
1618
2118
|
display: e,
|
|
1619
2119
|
view: t,
|
|
1620
2120
|
look: n,
|
|
@@ -1622,12 +2122,12 @@ var xn = class {
|
|
|
1622
2122
|
source: this.workingSpace,
|
|
1623
2123
|
...r ? { size: r } : {}
|
|
1624
2124
|
});
|
|
1625
|
-
return this.setActiveView(a.id),
|
|
2125
|
+
return this.setActiveView(a.id), S(a.id);
|
|
1626
2126
|
}
|
|
1627
2127
|
_makeRoomForTable() {
|
|
1628
2128
|
if (f() < 12) return;
|
|
1629
2129
|
let e = this._renderer?.toneMapping ?? this._activeView?.id ?? null, t = [...d.values()].filter((t) => t.source === "ocio" && t.id !== e).sort((e, t) => (this._lastUsed.get(e.id) ?? 0) - (this._lastUsed.get(t.id) ?? 0))[0];
|
|
1630
|
-
t && (
|
|
2130
|
+
t && (bn(t.id), h(t.id), this._lastUsed.delete(t.id));
|
|
1631
2131
|
}
|
|
1632
2132
|
setLook(e) {
|
|
1633
2133
|
if (!this._activeView) throw Error("no OCIO view is active");
|
|
@@ -1638,24 +2138,24 @@ var xn = class {
|
|
|
1638
2138
|
}
|
|
1639
2139
|
setContext(e) {
|
|
1640
2140
|
let t = e && Object.keys(e).length ? { ...e } : null;
|
|
1641
|
-
JSON.stringify(t) !== JSON.stringify(this._context) && (this._context = t,
|
|
2141
|
+
JSON.stringify(t) !== JSON.stringify(this._context) && (this._context = t, z() && (this._context && B()?.invalidateContext(this._context), Ye(), this._rebakeViews()), this._emit("context", this._context));
|
|
1642
2142
|
}
|
|
1643
2143
|
get context() {
|
|
1644
2144
|
return this._context;
|
|
1645
2145
|
}
|
|
1646
2146
|
_isStale(e) {
|
|
1647
|
-
return e.source !== "ocio" || !
|
|
2147
|
+
return e.source !== "ocio" || !z() ? !1 : e.ocio.source !== this.workingSpace || JSON.stringify(e.ocio.context ?? null) !== JSON.stringify(this._context ?? null);
|
|
1648
2148
|
}
|
|
1649
2149
|
_rebakeView(e) {
|
|
1650
2150
|
try {
|
|
1651
|
-
let t =
|
|
2151
|
+
let t = vn({
|
|
1652
2152
|
id: e.id,
|
|
1653
2153
|
display: e.ocio.display,
|
|
1654
2154
|
view: e.ocio.view,
|
|
1655
2155
|
look: e.ocio.look,
|
|
1656
2156
|
context: this._context,
|
|
1657
2157
|
source: this.workingSpace,
|
|
1658
|
-
size: e.ocio.
|
|
2158
|
+
size: e.ocio.requestedSize ?? null,
|
|
1659
2159
|
minEv: e.ocio.minEv,
|
|
1660
2160
|
maxEv: e.ocio.maxEv
|
|
1661
2161
|
}), n = e.table?.texture;
|
|
@@ -1665,7 +2165,7 @@ var xn = class {
|
|
|
1665
2165
|
}
|
|
1666
2166
|
}
|
|
1667
2167
|
_rebakeViews() {
|
|
1668
|
-
let e = this._renderer?.toneMapping ?? this._activeView?.id ?? null, t = e === null ? null :
|
|
2168
|
+
let e = this._renderer?.toneMapping ?? this._activeView?.id ?? null, t = e === null ? null : S(e);
|
|
1669
2169
|
if (!t || !this._isStale(t)) return;
|
|
1670
2170
|
let n = this._rebakeView(t);
|
|
1671
2171
|
n && (this._activeView = {
|
|
@@ -1675,31 +2175,37 @@ var xn = class {
|
|
|
1675
2175
|
}), this._updateCanvasView();
|
|
1676
2176
|
}
|
|
1677
2177
|
attachRenderer(e) {
|
|
1678
|
-
this._renderer = e,
|
|
2178
|
+
this._renderer = e, S(e.toneMapping)?.source === "builtin" && (this._lastBuiltin = e.toneMapping);
|
|
1679
2179
|
let t = v(e);
|
|
1680
2180
|
return this._applyRendererOutputColorSpace(), this._updateCanvasView(), t;
|
|
1681
2181
|
}
|
|
1682
2182
|
_applyRendererOutputColorSpace() {
|
|
1683
2183
|
if (!this._renderer) return;
|
|
1684
|
-
let e =
|
|
1685
|
-
this._renderer.outputColorSpace = e?.outputEncoded ?
|
|
2184
|
+
let e = S(this._renderer.toneMapping);
|
|
2185
|
+
this._renderer.outputColorSpace = e?.outputEncoded ? de : ge, this._applyCanvasColorSpace(Gn(e));
|
|
1686
2186
|
}
|
|
1687
2187
|
_applyCanvasColorSpace(e) {
|
|
1688
2188
|
this._canvasColorSpace = e;
|
|
1689
|
-
let n =
|
|
1690
|
-
if (!
|
|
1691
|
-
if (!
|
|
1692
|
-
let e = n.configure.bind(
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
2189
|
+
let n = this._renderer?.domElement, r = n?.getContext?.("webgpu");
|
|
2190
|
+
if (!r?.configure) return;
|
|
2191
|
+
if (!r.__rayzeeConfigure) {
|
|
2192
|
+
let e = typeof HTMLCanvasElement < "u" && n instanceof HTMLCanvasElement || typeof OffscreenCanvas < "u" && n instanceof OffscreenCanvas, t = r.configure.bind(r);
|
|
2193
|
+
r.__rayzeeConfigure = t, r.configure = (i) => {
|
|
2194
|
+
let a = r.getConfiguration?.(), o = {
|
|
2195
|
+
...i,
|
|
2196
|
+
colorSpace: r.__rayzeeColorSpace ?? i.colorSpace
|
|
2197
|
+
};
|
|
2198
|
+
if (t(o), e && a && (a.format !== o.format || (a.colorSpace ?? "srgb") !== (o.colorSpace ?? "srgb"))) {
|
|
2199
|
+
let { width: e } = n;
|
|
2200
|
+
n.width = e;
|
|
2201
|
+
}
|
|
2202
|
+
};
|
|
1697
2203
|
}
|
|
1698
|
-
|
|
1699
|
-
let
|
|
1700
|
-
if (!(!
|
|
1701
|
-
|
|
1702
|
-
...
|
|
2204
|
+
r.__rayzeeColorSpace = e;
|
|
2205
|
+
let i = r.getConfiguration?.();
|
|
2206
|
+
if (!(!i || i.colorSpace === e)) try {
|
|
2207
|
+
r.configure({
|
|
2208
|
+
...i,
|
|
1703
2209
|
colorSpace: e
|
|
1704
2210
|
});
|
|
1705
2211
|
} catch (n) {
|
|
@@ -1716,7 +2222,7 @@ var xn = class {
|
|
|
1716
2222
|
return this._canvasColorSpace ?? "srgb";
|
|
1717
2223
|
}
|
|
1718
2224
|
displayFit(e) {
|
|
1719
|
-
return
|
|
2225
|
+
return z() ? Jt(e).fit : M(e);
|
|
1720
2226
|
}
|
|
1721
2227
|
get canvasTransform() {
|
|
1722
2228
|
return this._canvasView?.table?.tsl ?? null;
|
|
@@ -1726,26 +2232,26 @@ var xn = class {
|
|
|
1726
2232
|
return typeof HTMLCanvasElement < "u" && e instanceof HTMLCanvasElement || typeof OffscreenCanvas < "u" && e instanceof OffscreenCanvas;
|
|
1727
2233
|
}
|
|
1728
2234
|
_canvasPlan() {
|
|
1729
|
-
let e = this._renderer ?
|
|
2235
|
+
let e = this._renderer ? S(this._renderer.toneMapping) : null;
|
|
1730
2236
|
if (!e || !this._hdrOutput) return { reason: null };
|
|
1731
|
-
if (e.source !== "ocio") return e.id ===
|
|
2237
|
+
if (e.source !== "ocio") return e.id === me ? {
|
|
1732
2238
|
key: "none",
|
|
1733
2239
|
table: null,
|
|
1734
2240
|
hdr: !0
|
|
1735
2241
|
} : { reason: "no-hdr-version" };
|
|
1736
|
-
let t =
|
|
1737
|
-
if (
|
|
2242
|
+
let t = H();
|
|
2243
|
+
if (N(t, e.ocio.display)) return {
|
|
1738
2244
|
key: "own",
|
|
1739
2245
|
table: null,
|
|
1740
2246
|
hdr: !0
|
|
1741
2247
|
};
|
|
1742
|
-
let n =
|
|
2248
|
+
let n = Gn(e), r = Yn(e.ocio, n), i = this._bakedCanvasViews.get(r);
|
|
1743
2249
|
if (i) return {
|
|
1744
2250
|
key: r,
|
|
1745
2251
|
table: i,
|
|
1746
2252
|
hdr: !0
|
|
1747
2253
|
};
|
|
1748
|
-
let a = t &&
|
|
2254
|
+
let a = t && Me(t, e.ocio.display, e.ocio.view);
|
|
1749
2255
|
return a ? {
|
|
1750
2256
|
key: r,
|
|
1751
2257
|
target: a,
|
|
@@ -1755,13 +2261,13 @@ var xn = class {
|
|
|
1755
2261
|
} : { reason: t ? "no-hdr-version" : "needs-config" };
|
|
1756
2262
|
}
|
|
1757
2263
|
_buildCanvasView(e, t, n) {
|
|
1758
|
-
let { look: r, context: i, source: a,
|
|
1759
|
-
return
|
|
2264
|
+
let { look: r, context: i, source: a, requestedSize: o, display: s, view: c } = e.ocio;
|
|
2265
|
+
return hn({
|
|
1760
2266
|
...t,
|
|
1761
2267
|
look: r,
|
|
1762
2268
|
context: i,
|
|
1763
2269
|
source: a,
|
|
1764
|
-
size: o,
|
|
2270
|
+
size: o ?? null,
|
|
1765
2271
|
canvas: n,
|
|
1766
2272
|
for: {
|
|
1767
2273
|
display: s,
|
|
@@ -1785,7 +2291,7 @@ var xn = class {
|
|
|
1785
2291
|
}
|
|
1786
2292
|
_rememberCanvasView(e, t) {
|
|
1787
2293
|
let n = this._recentCanvasViews;
|
|
1788
|
-
for (n.delete(e), n.set(e, t); n.size >
|
|
2294
|
+
for (n.delete(e), n.set(e, t); n.size > Kn;) {
|
|
1789
2295
|
let [e, r] = n.entries().next().value;
|
|
1790
2296
|
n.delete(e), r !== this._canvasView?.table && r !== t && r.dispose();
|
|
1791
2297
|
}
|
|
@@ -1795,28 +2301,28 @@ var xn = class {
|
|
|
1795
2301
|
n?.table && n.table !== e?.table && !r.has(n.table) && n.table.dispose();
|
|
1796
2302
|
let i = !!e?.hdr && this._canvasOnScreen(), a = t ?? (e?.hdr && !i ? "no-screen" : null), o = (n?.table ?? null) !== (e?.table ?? null) || !!n?.hdr != !!e?.hdr || this._canvasReason !== a;
|
|
1797
2303
|
this._canvasView = e, this._canvasReason = a;
|
|
1798
|
-
let s = this._renderer?.backend, c = i ?
|
|
2304
|
+
let s = this._renderer?.backend, c = i ? ue : void 0;
|
|
1799
2305
|
s?.parameters && s.parameters.outputType !== c && (s.parameters.outputType = c, s.updateSize?.()), o && this._emit("canvas", this.canvasTransform);
|
|
1800
2306
|
}
|
|
1801
2307
|
resolveInput(e, t) {
|
|
1802
|
-
return
|
|
2308
|
+
return zn(e, t);
|
|
1803
2309
|
}
|
|
1804
2310
|
textureSpace(e, t) {
|
|
1805
|
-
return
|
|
2311
|
+
return Un(e, t);
|
|
1806
2312
|
}
|
|
1807
2313
|
resolveTexture(e, t) {
|
|
1808
|
-
return
|
|
2314
|
+
return Hn(e, t);
|
|
1809
2315
|
}
|
|
1810
2316
|
describeTextureSpace(e) {
|
|
1811
2317
|
let t = e?.userData ?? {}, n = t.ocioColorSpace ?? t.__rayzeeColorSpaceChoice ?? null, r = null, i = t.__rayzeeOriginalColorSpace ?? e?.colorSpace;
|
|
1812
|
-
return
|
|
2318
|
+
return z() && (r = Hn({
|
|
1813
2319
|
...e,
|
|
1814
2320
|
name: e?.name,
|
|
1815
2321
|
image: e?.image,
|
|
1816
2322
|
colorSpace: i,
|
|
1817
2323
|
userData: {}
|
|
1818
2324
|
})), r ||= {
|
|
1819
|
-
colorSpace: i ===
|
|
2325
|
+
colorSpace: i === ge ? "sRGB" : "Linear",
|
|
1820
2326
|
via: "three"
|
|
1821
2327
|
}, {
|
|
1822
2328
|
choice: n,
|
|
@@ -1824,29 +2330,29 @@ var xn = class {
|
|
|
1824
2330
|
};
|
|
1825
2331
|
}
|
|
1826
2332
|
get inputKey() {
|
|
1827
|
-
return
|
|
2333
|
+
return z() ? `${H()?.id}|${this.workingSpace}|${jn()}|${JSON.stringify(this._context)}` : "-";
|
|
1828
2334
|
}
|
|
1829
2335
|
overrideInput(e, t) {
|
|
1830
|
-
|
|
2336
|
+
Nn(e, t);
|
|
1831
2337
|
}
|
|
1832
2338
|
fileRules() {
|
|
1833
|
-
return
|
|
2339
|
+
return Ln();
|
|
1834
2340
|
}
|
|
1835
2341
|
toWorkingPixels(e, t) {
|
|
1836
|
-
return !
|
|
2342
|
+
return !z() || !t ? e : q(e, t, this.workingSpace, { context: this._context });
|
|
1837
2343
|
}
|
|
1838
2344
|
get nativeLinearSpace() {
|
|
1839
|
-
return
|
|
2345
|
+
return j(V());
|
|
1840
2346
|
}
|
|
1841
2347
|
_publishWorkingMatrix() {
|
|
1842
2348
|
let e = s();
|
|
1843
|
-
e !== null && e !== this || n(
|
|
2349
|
+
e !== null && e !== this || n(z() ? this.primariesMatrixToWorking() : null, this.workingSpace);
|
|
1844
2350
|
}
|
|
1845
2351
|
primariesMatrixToWorking() {
|
|
1846
|
-
if (!
|
|
2352
|
+
if (!z() || !this.workingSpaceAdopted) return null;
|
|
1847
2353
|
let e = this.nativeLinearSpace;
|
|
1848
2354
|
if (!e || e === this.workingSpace) return null;
|
|
1849
|
-
let t =
|
|
2355
|
+
let t = mt(e, this.workingSpace, { context: this._context });
|
|
1850
2356
|
return t ? [
|
|
1851
2357
|
1,
|
|
1852
2358
|
0,
|
|
@@ -1866,69 +2372,99 @@ var xn = class {
|
|
|
1866
2372
|
return r(e, t, n);
|
|
1867
2373
|
}
|
|
1868
2374
|
convertTexturePixels(e, { space: n = null } = {}) {
|
|
1869
|
-
if (!
|
|
2375
|
+
if (!z()) return !1;
|
|
1870
2376
|
let r = e?.image?.data;
|
|
1871
2377
|
if (!r) return !1;
|
|
1872
|
-
let i = this.nativeLinearSpace, a = e.userData?.__rayzeeColorSpace ?? n ?? i,
|
|
1873
|
-
if (!
|
|
1874
|
-
let
|
|
1875
|
-
if (r instanceof Float32Array)
|
|
2378
|
+
let i = this.nativeLinearSpace, a = e.userData?.__rayzeeColorSpace, o = a === Jn ? i : a ?? n ?? i, s = this.workingSpaceAdopted ? this.workingSpace : i;
|
|
2379
|
+
if (!o || !s || o === s) return !1;
|
|
2380
|
+
let c = !1;
|
|
2381
|
+
if (r instanceof Float32Array) q(r, o, s, { context: this._context }), c = !0;
|
|
1876
2382
|
else if (r instanceof Uint16Array) {
|
|
1877
|
-
let e =
|
|
1878
|
-
|
|
1879
|
-
} else if (r instanceof Uint8Array || r instanceof Uint8ClampedArray)
|
|
2383
|
+
let e = xt(r);
|
|
2384
|
+
q(e, o, s, { context: this._context }), r.set(bt(e)), c = !0;
|
|
2385
|
+
} else if (r instanceof Uint8Array || r instanceof Uint8ClampedArray) ct(r, o, s, {
|
|
1880
2386
|
context: this._context,
|
|
1881
2387
|
inputEncoding: "srgb",
|
|
1882
2388
|
outputEncoding: "srgb"
|
|
1883
|
-
}),
|
|
2389
|
+
}), c = !0;
|
|
1884
2390
|
else return this._issues?.warn(t.VIEW_TRANSFORM_BAKE_FAILED, `texture data is ${r.constructor?.name ?? typeof r}, which cannot be colour-converted`, {
|
|
1885
|
-
from:
|
|
1886
|
-
to:
|
|
2391
|
+
from: o,
|
|
2392
|
+
to: s
|
|
1887
2393
|
}), !1;
|
|
1888
|
-
return e.userData = e.userData ?? {}, e.userData.__rayzeeColorSpace =
|
|
2394
|
+
return e.userData = e.userData ?? {}, e.userData.__rayzeeColorSpace = s === i ? Jn : s, e.needsUpdate = !0, c;
|
|
1889
2395
|
}
|
|
1890
2396
|
convertTextureBytes(e, { space: t = null, encoding: n = "srgb" } = {}) {
|
|
1891
|
-
if (!
|
|
1892
|
-
if (t) return t === this.workingSpace ? !1 : (
|
|
2397
|
+
if (!z()) return !1;
|
|
2398
|
+
if (t) return t === this.workingSpace ? !1 : (ct(e, t, this.workingSpace, {
|
|
1893
2399
|
context: this._context,
|
|
1894
2400
|
inputEncoding: "raw",
|
|
1895
2401
|
outputEncoding: n
|
|
1896
2402
|
}), !0);
|
|
1897
2403
|
let r = this.primariesMatrixToWorking();
|
|
1898
|
-
return r ? (
|
|
2404
|
+
return r ? (pt(e, r, n), !0) : !1;
|
|
1899
2405
|
}
|
|
1900
2406
|
toWorkingColor(e, t) {
|
|
1901
|
-
return !
|
|
2407
|
+
return !z() || !t ? [
|
|
1902
2408
|
e[0],
|
|
1903
2409
|
e[1],
|
|
1904
2410
|
e[2]
|
|
1905
|
-
] :
|
|
2411
|
+
] : tt(e, t, this.workingSpace, { context: this._context });
|
|
1906
2412
|
}
|
|
1907
2413
|
convert(e, t, n) {
|
|
1908
|
-
return
|
|
2414
|
+
return tt(e, t, n, { context: this._context });
|
|
1909
2415
|
}
|
|
1910
2416
|
get exportSpace() {
|
|
1911
2417
|
return this._exportSpace;
|
|
1912
2418
|
}
|
|
1913
2419
|
setExportSpace(e) {
|
|
1914
2420
|
if (e != null) {
|
|
1915
|
-
if (!
|
|
1916
|
-
if (!
|
|
2421
|
+
if (!z()) throw Error("load an OCIO config before choosing an export space");
|
|
2422
|
+
if (!J(e)) throw Error(`config has no colour space "${e}"`);
|
|
1917
2423
|
}
|
|
1918
2424
|
this._exportSpace = e ?? null, this._emit("export", this._exportSpace);
|
|
1919
2425
|
}
|
|
1920
2426
|
exportPixels(e, t = void 0) {
|
|
1921
2427
|
let n = t === void 0 ? this._exportSpace : t;
|
|
1922
|
-
return !n || !
|
|
2428
|
+
return !n || !z() ? {
|
|
1923
2429
|
rgba: e,
|
|
1924
2430
|
colorSpace: this.workingSpace
|
|
1925
|
-
} : (
|
|
2431
|
+
} : (q(e, this.workingSpace, n, { context: this._context }), {
|
|
1926
2432
|
rgba: e,
|
|
1927
2433
|
colorSpace: n
|
|
1928
2434
|
});
|
|
1929
2435
|
}
|
|
2436
|
+
chromaticities(e = this.workingSpace) {
|
|
2437
|
+
let t = z() ? H()?.roles?.cie_xyz_d65_interchange : null;
|
|
2438
|
+
if (!t || !J(t) || !J(e)) return e === "Linear Rec.709 (sRGB)" ? qn : null;
|
|
2439
|
+
let n = new Float32Array([
|
|
2440
|
+
1,
|
|
2441
|
+
0,
|
|
2442
|
+
0,
|
|
2443
|
+
1,
|
|
2444
|
+
0,
|
|
2445
|
+
1,
|
|
2446
|
+
0,
|
|
2447
|
+
1,
|
|
2448
|
+
0,
|
|
2449
|
+
0,
|
|
2450
|
+
1,
|
|
2451
|
+
1,
|
|
2452
|
+
1,
|
|
2453
|
+
1,
|
|
2454
|
+
1,
|
|
2455
|
+
1
|
|
2456
|
+
]);
|
|
2457
|
+
q(n, e, t, { context: this._context });
|
|
2458
|
+
let r = [];
|
|
2459
|
+
for (let e = 0; e < 16; e += 4) {
|
|
2460
|
+
let t = n[e] + n[e + 1] + n[e + 2];
|
|
2461
|
+
if (!(t > 0)) return null;
|
|
2462
|
+
r.push(n[e] / t, n[e + 1] / t);
|
|
2463
|
+
}
|
|
2464
|
+
return r;
|
|
2465
|
+
}
|
|
1930
2466
|
status() {
|
|
1931
|
-
let e =
|
|
2467
|
+
let e = H(), t = this._renderer ? S(this._renderer.toneMapping) : null, n = !!this._canvasView?.hdr && this._canvasOnScreen();
|
|
1932
2468
|
return {
|
|
1933
2469
|
config: e,
|
|
1934
2470
|
workingSpace: this.workingSpace,
|
|
@@ -1960,14 +2496,14 @@ var xn = class {
|
|
|
1960
2496
|
...this._bakedCanvasViews.values(),
|
|
1961
2497
|
...this._recentCanvasViews.values()
|
|
1962
2498
|
])) e?.dispose();
|
|
1963
|
-
this._canvasView = null, this._bakedCanvasViews.clear(), this._recentCanvasViews.clear(),
|
|
2499
|
+
this._canvasView = null, this._bakedCanvasViews.clear(), this._recentCanvasViews.clear(), Bt(null), this._renderer = null, this._issues = null, s() === this && (n(null), a(null));
|
|
1964
2500
|
}
|
|
1965
2501
|
static resetAll() {
|
|
1966
|
-
a(null), n(null),
|
|
2502
|
+
a(null), n(null), xn(), on(), u(), et(), Pn(), Ge();
|
|
1967
2503
|
}
|
|
1968
2504
|
};
|
|
1969
|
-
function
|
|
1970
|
-
return
|
|
2505
|
+
function Zn() {
|
|
2506
|
+
return z();
|
|
1971
2507
|
}
|
|
1972
2508
|
//#endregion
|
|
1973
|
-
export {
|
|
2509
|
+
export { M as A, ct as C, ht as D, J as E, De as F, Me as M, N, it as O, je as P, tt as S, mt as T, dn as _, Bn as a, Nt as b, zn as c, It as d, Ft as f, hn as g, vn as h, Pn as i, j, rt as k, Nn as l, yn as m, Wn as n, Ln as o, Pt as p, Zn as r, Fn as s, Xn as t, Un as u, yt as v, q as w, pt as x, kt as y };
|