rayzee 5.8.2 → 5.9.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/dist/rayzee.es.js +53 -49
- package/dist/rayzee.es.js.map +1 -1
- package/dist/rayzee.umd.js +1 -1
- package/dist/rayzee.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/Passes/OIDNDenoiser.js +7 -7
- package/src/Processor/ToneMapCPU.js +12 -1
package/dist/rayzee.es.js
CHANGED
|
@@ -11919,19 +11919,23 @@ var ol = new Map([
|
|
|
11919
11919
|
[Oe, rl],
|
|
11920
11920
|
[Ae, il],
|
|
11921
11921
|
[lt, al]
|
|
11922
|
-
]), sl = 1 / 2.2
|
|
11923
|
-
function
|
|
11922
|
+
]), sl = 1 / 2.2;
|
|
11923
|
+
function cl(e) {
|
|
11924
|
+
return e <= .0031308 ? 12.92 * e : 1.055 * e ** (1 / 2.4) - .055;
|
|
11925
|
+
}
|
|
11926
|
+
var ll = .2126, ul = .7152, dl = .0722;
|
|
11927
|
+
function fl(e, t) {
|
|
11924
11928
|
if (t === 1) return;
|
|
11925
|
-
let n = e[0] *
|
|
11929
|
+
let n = e[0] * ll + e[1] * ul + e[2] * dl;
|
|
11926
11930
|
e[0] = n + (e[0] - n) * t, e[1] = n + (e[1] - n) * t, e[2] = n + (e[2] - n) * t;
|
|
11927
11931
|
}
|
|
11928
11932
|
//#endregion
|
|
11929
11933
|
//#region src/Passes/OIDNDenoiser.js
|
|
11930
|
-
var
|
|
11931
|
-
async function
|
|
11932
|
-
return
|
|
11934
|
+
var pl = null;
|
|
11935
|
+
async function ml() {
|
|
11936
|
+
return pl ||= (await import("oidn-web")).initUNetFromURL, pl;
|
|
11933
11937
|
}
|
|
11934
|
-
var
|
|
11938
|
+
var hl = new Float32Array(3), gl = {
|
|
11935
11939
|
BASE_URL: "https://cdn.jsdelivr.net/npm/denoiser/tzas/",
|
|
11936
11940
|
QUALITY_SUFFIXES: {
|
|
11937
11941
|
fast: "_small",
|
|
@@ -11944,7 +11948,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
11944
11948
|
debugGbufferMaps: !0,
|
|
11945
11949
|
tileSize: 256
|
|
11946
11950
|
}
|
|
11947
|
-
},
|
|
11951
|
+
}, _l = class extends Ke {
|
|
11948
11952
|
constructor(e, t, n, r, i = {}) {
|
|
11949
11953
|
if (super(), !e || !t || !n || !r) throw Error("OIDNDenoiser requires output canvas, renderer, scene, and camera");
|
|
11950
11954
|
this.renderer = t, this.scene = n, this.camera = r, this.input = t.domElement, this.output = e, this.debugContainer = i.debugContainer || null, this.extractGBufferData = i.extractGBufferData || null, this.getMRTRenderTarget = i.getMRTRenderTarget || null, this.backendParamsGetter = i.backendParams || null, this.getGPUTextures = i.getGPUTextures || null, this.getExposure = i.getExposure || (() => 1), this.getToneMapping = i.getToneMapping || (() => Oe), this.getSaturation = i.getSaturation || (() => 1), this.getTransparentBackground = i.getTransparentBackground || (() => !1), this.isGPUMode = !!this.backendParamsGetter, this.gpuDevice = null, this._gpuInputBuffers = {
|
|
@@ -11955,7 +11959,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
11955
11959
|
width: 0,
|
|
11956
11960
|
height: 0
|
|
11957
11961
|
}, this._gpuInputPadBuffer = null, this._gpuInputPaddedRowBytes = 0, this._alphaReadbackBuffer = null, this._alphaReadbackMapped = !1, this._cachedAlpha = null, this._cachedAlphaWidth = 0, this.config = {
|
|
11958
|
-
...
|
|
11962
|
+
...gl.DEFAULT_OPTIONS,
|
|
11959
11963
|
...i
|
|
11960
11964
|
}, this.enabled = this.config.enableOIDN, this.quality = this.config.oidnQuality, this.debugGbufferMaps = this.config.debugGbufferMaps, this.tileSize = this.config.tileSize, this.state = {
|
|
11961
11965
|
isDenoising: !1,
|
|
@@ -12011,7 +12015,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12011
12015
|
let e = this.backendParamsGetter();
|
|
12012
12016
|
this.gpuDevice = e?.device ?? null, t = e?.device ? e : void 0;
|
|
12013
12017
|
}
|
|
12014
|
-
this.unet = await (await
|
|
12018
|
+
this.unet = await (await ml())(e, t, {
|
|
12015
12019
|
aux: !0,
|
|
12016
12020
|
hdr: !0,
|
|
12017
12021
|
maxTileSize: this.tileSize
|
|
@@ -12026,14 +12030,14 @@ var ml = new Float32Array(3), hl = {
|
|
|
12026
12030
|
}
|
|
12027
12031
|
}
|
|
12028
12032
|
_generateTzaUrl() {
|
|
12029
|
-
let { BASE_URL: e, QUALITY_SUFFIXES: t } =
|
|
12033
|
+
let { BASE_URL: e, QUALITY_SUFFIXES: t } = gl;
|
|
12030
12034
|
return `${e}rt_hdr_alb_nrm${t[this.quality] || ""}.tza`;
|
|
12031
12035
|
}
|
|
12032
12036
|
async updateConfiguration(e) {
|
|
12033
12037
|
Object.keys(e).some((t) => this.config[t] !== e[t]) && (Object.assign(this.config, e), this.quality = this.config.oidnQuality, this.debugGbufferMaps = this.config.debugGbufferMaps, this.tileSize = this.config.tileSize, await this._setupUNetDenoiser());
|
|
12034
12038
|
}
|
|
12035
12039
|
async updateQuality(e) {
|
|
12036
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
12040
|
+
if (!Object.prototype.hasOwnProperty.call(gl.QUALITY_SUFFIXES, e)) throw Error(`Invalid quality setting: ${e}. Must be one of: ${Object.keys(gl.QUALITY_SUFFIXES).join(", ")}`);
|
|
12037
12041
|
await this.updateConfiguration({ oidnQuality: e });
|
|
12038
12042
|
}
|
|
12039
12043
|
async start() {
|
|
@@ -12223,7 +12227,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12223
12227
|
let e = new Float32Array(u.getMappedRange()), t = new ImageData(o, s), r = this.getExposure(), i = this.getSaturation(), a = ol.get(this.getToneMapping()) || ol.get(Oe), c = this._cachedAlpha, l = this._cachedAlphaWidth;
|
|
12224
12228
|
for (let s = 0, u = e.length; s < u; s += 4) {
|
|
12225
12229
|
let u = e[s] * r, d = e[s + 1] * r, f = e[s + 2] * r;
|
|
12226
|
-
if (i !== 1 && (
|
|
12230
|
+
if (i !== 1 && (hl[0] = u, hl[1] = d, hl[2] = f, fl(hl, i), u = hl[0], d = hl[1], f = hl[2]), a(u, d, f, 1, hl), t.data[s] = cl(hl[0]) * 255 + .5 | 0, t.data[s + 1] = cl(hl[1]) * 255 + .5 | 0, t.data[s + 2] = cl(hl[2]) * 255 + .5 | 0, c) {
|
|
12227
12231
|
let e = (s >> 2) % o, r = (s >> 2) / o | 0;
|
|
12228
12232
|
t.data[s + 3] = c[(n.y + r) * l + n.x + e];
|
|
12229
12233
|
} else t.data[s + 3] = 255;
|
|
@@ -12253,7 +12257,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12253
12257
|
let s = new Float32Array(a.getMappedRange()), c = new ImageData(t, n), l = this.getExposure(), u = this.getSaturation(), d = ol.get(this.getToneMapping()) || ol.get(Oe), f = this._cachedAlpha;
|
|
12254
12258
|
for (let e = 0, t = s.length; e < t; e += 4) {
|
|
12255
12259
|
let t = s[e] * l, n = s[e + 1] * l, r = s[e + 2] * l;
|
|
12256
|
-
u !== 1 && (
|
|
12260
|
+
u !== 1 && (hl[0] = t, hl[1] = n, hl[2] = r, fl(hl, u), t = hl[0], n = hl[1], r = hl[2]), d(t, n, r, 1, hl), c.data[e] = cl(hl[0]) * 255 + .5 | 0, c.data[e + 1] = cl(hl[1]) * 255 + .5 | 0, c.data[e + 2] = cl(hl[2]) * 255 + .5 | 0, c.data[e + 3] = f ? f[e >> 2] : 255;
|
|
12257
12261
|
}
|
|
12258
12262
|
a.unmap(), this.ctx.putImageData(c, 0, 0);
|
|
12259
12263
|
} finally {
|
|
@@ -12305,19 +12309,19 @@ var ml = new Float32Array(3), hl = {
|
|
|
12305
12309
|
dispose() {
|
|
12306
12310
|
this.abort(), this._destroyPendingStagingBuffers(), this.unet?.dispose(), this._destroyGPUInputBuffers(), this.debugHelpers &&= (this.debugHelpers.albedo?.dispose(), this.debugHelpers.normal?.dispose(), null), this._lastAlbedoTexture = null, this._lastNormalTexture = null, this.output?.parentNode && this.output.remove(), this.unet = null, this.ctx = null, this.state.abortController = null, this.removeAllListeners?.(), console.log("OIDNDenoiser disposed");
|
|
12307
12311
|
}
|
|
12308
|
-
},
|
|
12312
|
+
}, vl = "" + new URL("assets/AIUpscalerWorker-D58dcMrY.js", import.meta.url).href, yl = "https://huggingface.co/notaneimu/onnx-image-models/resolve/main/", bl = {
|
|
12309
12313
|
QUALITY_PRESETS: {
|
|
12310
12314
|
fast: {
|
|
12311
|
-
2:
|
|
12312
|
-
4:
|
|
12315
|
+
2: yl + "2x-spanx2-ch48.onnx",
|
|
12316
|
+
4: yl + "4xNomos8k_span_otf_strong_fp32_opset17.onnx"
|
|
12313
12317
|
},
|
|
12314
12318
|
balanced: {
|
|
12315
|
-
2:
|
|
12316
|
-
4:
|
|
12319
|
+
2: yl + "2xNomosUni_compact_otf_medium.onnx",
|
|
12320
|
+
4: yl + "RealESRGAN_x4plus.onnx"
|
|
12317
12321
|
},
|
|
12318
12322
|
quality: {
|
|
12319
|
-
2:
|
|
12320
|
-
4:
|
|
12323
|
+
2: yl + "2x-realesrgan-x2plus.onnx",
|
|
12324
|
+
4: yl + "4xNomos2_hq_mosr_fp32.onnx"
|
|
12321
12325
|
}
|
|
12322
12326
|
},
|
|
12323
12327
|
TILE_SIZE: 512,
|
|
@@ -12329,17 +12333,17 @@ var ml = new Float32Array(3), hl = {
|
|
|
12329
12333
|
}],
|
|
12330
12334
|
graphOptimizationLevel: "all"
|
|
12331
12335
|
}
|
|
12332
|
-
},
|
|
12336
|
+
}, xl = class extends Ke {
|
|
12333
12337
|
constructor(e, t, n = {}) {
|
|
12334
12338
|
if (super(), !e || !t) throw Error("AIUpscaler requires output canvas and renderer");
|
|
12335
|
-
this.renderer = t, this.input = t.domElement, this.output = e, this.getSourceCanvas = n.getSourceCanvas || null, this.getGPUTextures = n.getGPUTextures || null, this.getExposure = n.getExposure || (() => 1), this.getToneMapping = n.getToneMapping || (() => Oe), this.getSaturation = n.getSaturation || (() => 1), this.enabled = !1, this.hdr = !1, this.scaleFactor = n.scaleFactor || 2, this.quality = n.quality || "fast", this.tileSize = n.tileSize ||
|
|
12339
|
+
this.renderer = t, this.input = t.domElement, this.output = e, this.getSourceCanvas = n.getSourceCanvas || null, this.getGPUTextures = n.getGPUTextures || null, this.getExposure = n.getExposure || (() => 1), this.getToneMapping = n.getToneMapping || (() => Oe), this.getSaturation = n.getSaturation || (() => 1), this.enabled = !1, this.hdr = !1, this.scaleFactor = n.scaleFactor || 2, this.quality = n.quality || "fast", this.tileSize = n.tileSize || bl.TILE_SIZE, this._tileSizeOverride = !!n.tileSize, this.state = {
|
|
12336
12340
|
isUpscaling: !1,
|
|
12337
12341
|
isLoading: !1,
|
|
12338
12342
|
abortController: null
|
|
12339
12343
|
}, this._worker = null, this._currentModelUrl = null, this._tileId = 0, this._pendingWorkerHandlers = /* @__PURE__ */ new Set(), this._upscaledAlpha = null, this._upscaledAlphaWidth = 0, this._backupCanvas = null, this._baseWidth = e.width, this._baseHeight = e.height, this._hdrStagingBuffer = null, this._hdrStagingWidth = 0, this._hdrStagingHeight = 0;
|
|
12340
12344
|
}
|
|
12341
12345
|
async _ensureSession() {
|
|
12342
|
-
let e =
|
|
12346
|
+
let e = bl.QUALITY_PRESETS[this.quality];
|
|
12343
12347
|
if (!e) throw Error(`Unknown quality preset: ${this.quality}`);
|
|
12344
12348
|
let t = e[this.scaleFactor];
|
|
12345
12349
|
if (!t) throw Error(`No model for ${this.quality}/${this.scaleFactor}x`);
|
|
@@ -12350,10 +12354,10 @@ var ml = new Float32Array(3), hl = {
|
|
|
12350
12354
|
});
|
|
12351
12355
|
try {
|
|
12352
12356
|
if (!this._worker) try {
|
|
12353
|
-
this._worker = new Worker(
|
|
12357
|
+
this._worker = new Worker(vl, { type: "module" });
|
|
12354
12358
|
} catch (e) {
|
|
12355
12359
|
if (e.name !== "SecurityError") throw e;
|
|
12356
|
-
this._worker = await cr(
|
|
12360
|
+
this._worker = await cr(vl);
|
|
12357
12361
|
}
|
|
12358
12362
|
await new Promise((e, n) => {
|
|
12359
12363
|
let r = (t) => {
|
|
@@ -12362,7 +12366,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12362
12366
|
this._worker.addEventListener("message", r), this._worker.postMessage({
|
|
12363
12367
|
type: "load",
|
|
12364
12368
|
url: t,
|
|
12365
|
-
sessionOptions:
|
|
12369
|
+
sessionOptions: bl.SESSION_OPTIONS
|
|
12366
12370
|
});
|
|
12367
12371
|
}), this._currentModelUrl = t, this.dispatchEvent({ type: "loaded" });
|
|
12368
12372
|
} catch (e) {
|
|
@@ -12430,7 +12434,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12430
12434
|
alpha: !0
|
|
12431
12435
|
});
|
|
12432
12436
|
this._cacheUpscaledAlpha(t, n * i, r * i), t.isHDR && (this._hdrToneMapFn = ol.get(this.getToneMapping()) || ol.get(Oe), this._hdrExposure = this.getExposure(), this._hdrSaturation = this.getSaturation(), this._tmOut = new Float32Array(3));
|
|
12433
|
-
let o =
|
|
12437
|
+
let o = bl.TILE_OVERLAP, s = this.tileSize, c = s - o * 2, l = Math.ceil(n / c), u = Math.ceil(r / c), d = l * u, f = 0;
|
|
12434
12438
|
for (let o = 0; o < u; o++) for (let u = 0; u < l; u++) {
|
|
12435
12439
|
if (e.aborted) throw new DOMException("Aborted", "AbortError");
|
|
12436
12440
|
let l = Math.min(u * c, Math.max(0, n - s)), p = Math.min(o * c, Math.max(0, r - s)), m = Math.min(s, n - l), h = Math.min(s, r - p), g = this._extractTile(t, l, p, m, h), _ = await this._inferTile(g, m, h), v = l * i, y = p * i, b = m * i, x = h * i, S = this._tensorToImageData(_, b, x, v, y);
|
|
@@ -12503,7 +12507,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12503
12507
|
let u = ((n + e) * o + (t + i)) * 4, d = e * r + i;
|
|
12504
12508
|
if (s) {
|
|
12505
12509
|
let e = this._hdrToneMapFn, t = this._hdrExposure, n = this._hdrSaturation, r = a[u] * t, i = a[u + 1] * t, o = a[u + 2] * t;
|
|
12506
|
-
n !== 1 && (this._tmOut[0] = r, this._tmOut[1] = i, this._tmOut[2] = o,
|
|
12510
|
+
n !== 1 && (this._tmOut[0] = r, this._tmOut[1] = i, this._tmOut[2] = o, fl(this._tmOut, n), r = this._tmOut[0], i = this._tmOut[1], o = this._tmOut[2]), e(r, i, o, 1, this._tmOut), l[d] = this._tmOut[0] ** +sl, l[c + d] = this._tmOut[1] ** +sl, l[2 * c + d] = this._tmOut[2] ** +sl;
|
|
12507
12511
|
} else l[d] = a[u] / 255, l[c + d] = a[u + 1] / 255, l[2 * c + d] = a[u + 2] / 255;
|
|
12508
12512
|
}
|
|
12509
12513
|
return l;
|
|
@@ -12564,7 +12568,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12564
12568
|
let { data: n, width: r, height: i } = e, a = t.createImageData(r, i), o = a.data, s = ol.get(this.getToneMapping()) || ol.get(Oe), c = this.getExposure(), l = this.getSaturation(), u = new Float32Array(3);
|
|
12565
12569
|
for (let e = 0, t = r * i; e < t; e++) {
|
|
12566
12570
|
let t = e * 4, r = n[t] * c, i = n[t + 1] * c, a = n[t + 2] * c;
|
|
12567
|
-
l !== 1 && (u[0] = r, u[1] = i, u[2] = a,
|
|
12571
|
+
l !== 1 && (u[0] = r, u[1] = i, u[2] = a, fl(u, l), r = u[0], i = u[1], a = u[2]), s(r, i, a, 1, u), o[t] = u[0] ** +sl * 255 + .5 | 0, o[t + 1] = u[1] ** +sl * 255 + .5 | 0, o[t + 2] = u[2] ** +sl * 255 + .5 | 0, o[t + 3] = 255;
|
|
12568
12572
|
}
|
|
12569
12573
|
t.putImageData(a, 0, 0);
|
|
12570
12574
|
} else t.putImageData(e, 0, 0);
|
|
@@ -12576,7 +12580,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12576
12580
|
this.hdr = !!e;
|
|
12577
12581
|
}
|
|
12578
12582
|
setQuality(e) {
|
|
12579
|
-
if (!
|
|
12583
|
+
if (!bl.QUALITY_PRESETS[e]) {
|
|
12580
12584
|
console.warn(`AIUpscaler: Invalid quality "${e}", must be fast/balanced/quality`);
|
|
12581
12585
|
return;
|
|
12582
12586
|
}
|
|
@@ -12599,7 +12603,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12599
12603
|
async dispose() {
|
|
12600
12604
|
this.abort(), this._cleanupPendingWorkerHandlers(), this._worker &&= (this._worker.postMessage({ type: "dispose" }), this._worker.terminate(), null), this._currentModelUrl = null, this._backupCanvas = null, this._upscaledAlpha = null, this.state.abortController = null, this._hdrStagingBuffer?.destroy(), this._hdrStagingBuffer = null, this._hdrStagingWidth = 0, this._hdrStagingHeight = 0, console.log("AIUpscaler disposed");
|
|
12601
12605
|
}
|
|
12602
|
-
},
|
|
12606
|
+
}, Sl = class extends Ke {
|
|
12603
12607
|
constructor({ renderer: e, mainCanvas: t, scene: n, camera: r, stages: i, pipeline: a, getExposure: o, getSaturation: s, getTransparentBg: c }) {
|
|
12604
12608
|
super(), this.renderer = e, this.mainCanvas = t, this.denoiserCanvas = this._createDenoiserCanvas(t), this.scene = n, this.camera = r, this.pipeline = a, this._stages = i, this._getExposure = o, this._getSaturation = s, this._getTransparentBg = c, this.denoiser = null, this.upscaler = null, this._lastRenderWidth = 0, this._lastRenderHeight = 0, this._pendingStartUpscaler = null, this._denoiserStartHandler = null, this._denoiserEndHandler = null, this._upscalerResChangedHandler = null, this._upscalerStartHandler = null, this._upscalerProgressHandler = null, this._upscalerEndHandler = null;
|
|
12605
12609
|
}
|
|
@@ -12620,7 +12624,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12620
12624
|
setupDenoiser() {
|
|
12621
12625
|
if (!this.denoiserCanvas) return;
|
|
12622
12626
|
let e = this._stages.pathTracer;
|
|
12623
|
-
this.denoiser = new
|
|
12627
|
+
this.denoiser = new _l(this.denoiserCanvas, this.renderer, this.scene, this.camera, {
|
|
12624
12628
|
...X,
|
|
12625
12629
|
backendParams: () => ({
|
|
12626
12630
|
device: this.renderer.backend.device,
|
|
@@ -12645,7 +12649,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12645
12649
|
setupUpscaler() {
|
|
12646
12650
|
if (!this.denoiserCanvas) return;
|
|
12647
12651
|
let e = this._stages.pathTracer;
|
|
12648
|
-
this.upscaler = new
|
|
12652
|
+
this.upscaler = new xl(this.denoiserCanvas, this.renderer, {
|
|
12649
12653
|
scaleFactor: X.upscalerScale || 2,
|
|
12650
12654
|
quality: X.upscalerQuality || "fast",
|
|
12651
12655
|
getSourceCanvas: () => this.denoiser?.enabled ? null : this.renderer.domElement,
|
|
@@ -12806,7 +12810,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12806
12810
|
let t = Hn[e];
|
|
12807
12811
|
t && this._stages.asvgf?.updateParameters(t);
|
|
12808
12812
|
}
|
|
12809
|
-
},
|
|
12813
|
+
}, Cl = class {
|
|
12810
12814
|
constructor() {
|
|
12811
12815
|
this.layer = "hud", this.visible = !1, this._tileBounds = null, this._imageWidth = 1, this._imageHeight = 1, this.enabled = !0, this._borderColor = "rgba(255, 0, 0, 0.6)", this._borderWidth = 2;
|
|
12812
12816
|
}
|
|
@@ -12830,7 +12834,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12830
12834
|
dispose() {
|
|
12831
12835
|
this.visible = !1;
|
|
12832
12836
|
}
|
|
12833
|
-
},
|
|
12837
|
+
}, wl = class {
|
|
12834
12838
|
constructor(n, r, i) {
|
|
12835
12839
|
this.layer = "scene", this.visible = !0, this._outlineNode = Jt(r, i, {
|
|
12836
12840
|
selectedObjects: [],
|
|
@@ -12864,7 +12868,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12864
12868
|
dispose() {
|
|
12865
12869
|
this.visible = !1, this._outlineNode?.dispose(), this._material?.dispose(), this._quad = null;
|
|
12866
12870
|
}
|
|
12867
|
-
},
|
|
12871
|
+
}, Tl = class {
|
|
12868
12872
|
constructor(e, t) {
|
|
12869
12873
|
this.renderer = e, this.camera = t, this._helpers = /* @__PURE__ */ new Map(), this._hudCanvas = document.createElement("canvas"), this._hudCanvas.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;", this._hudCtx = this._hudCanvas.getContext("2d"), this._helperScene = null;
|
|
12870
12874
|
}
|
|
@@ -12876,13 +12880,13 @@ var ml = new Float32Array(3), hl = {
|
|
|
12876
12880
|
}
|
|
12877
12881
|
setupDefaultHelpers({ helperScene: e, meshScene: t, pipeline: n, denoisingManager: r, app: i, renderWidth: a, renderHeight: o }) {
|
|
12878
12882
|
this.setHelperScene(e);
|
|
12879
|
-
let s = new
|
|
12883
|
+
let s = new Cl();
|
|
12880
12884
|
this.register("tiles", s), s.setRenderSize(a || 1, o || 1), i.addEventListener("resolution_changed", (e) => {
|
|
12881
12885
|
s.setRenderSize(e.width, e.height);
|
|
12882
12886
|
}), n.eventBus.on("tile:changed", (e) => {
|
|
12883
12887
|
e.renderMode === 1 && e.tileBounds && (s.setActiveTile(e.tileBounds), s.show());
|
|
12884
12888
|
}), n.eventBus.on("pipeline:reset", () => s.hide()), i.addEventListener(Y.RENDER_COMPLETE, () => s.hide()), this._wireDenoiserTileEvents(s, r);
|
|
12885
|
-
let c = new
|
|
12889
|
+
let c = new wl(this.renderer, t, this.camera);
|
|
12886
12890
|
this.register("outline", c);
|
|
12887
12891
|
}
|
|
12888
12892
|
_wireDenoiserTileEvents(e, t) {
|
|
@@ -12949,7 +12953,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
12949
12953
|
for (let e of this._helpers.values()) e.dispose?.();
|
|
12950
12954
|
this._helpers.clear(), this._hudCanvas.parentElement && this._hudCanvas.parentElement.removeChild(this._hudCanvas);
|
|
12951
12955
|
}
|
|
12952
|
-
},
|
|
12956
|
+
}, El = class extends Ke {
|
|
12953
12957
|
constructor() {
|
|
12954
12958
|
super(), this.mixer = null, this.timer = new At(), this.actions = [], this.isPlaying = !1, this._scene = null, this._mixerRoot = null, this._meshes = null, this._meshTriRanges = null, this._posBuffer = null, this._tempVec = new Pt(), this._skinnedCache = null, this._totalTriangleCount = 0, this._clipsCache = null, this._savedTimeScale = 1, this.onFinished = null, this.wakeCallback = null;
|
|
12955
12959
|
}
|
|
@@ -13049,7 +13053,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
13049
13053
|
dispose() {
|
|
13050
13054
|
this.mixer &&= (this.mixer.stopAllAction(), this.mixer.uncacheRoot(this._mixerRoot), null), this.actions = [], this.isPlaying = !1, this.timer.reset(), this._scene = null, this._mixerRoot = null, this._meshes = null, this._meshTriRanges = null, this._posBuffer = null, this._skinnedCache = null, this._clipsCache = null;
|
|
13051
13055
|
}
|
|
13052
|
-
},
|
|
13056
|
+
}, Dl = class {
|
|
13053
13057
|
constructor({ camera: e, canvas: t, orbitControls: n, app: r }) {
|
|
13054
13058
|
this._app = r, this._orbitControls = n, this._camera = e, this._controls = new Yt(e, t), this._gizmoScene = new Tt(), this._gizmoScene.add(this._controls.getHelper()), this._attached = null, this._isDragging = !1, this._meshes = null, this._meshTriRanges = null, this._posBuffer = null, this._normalBuffer = null, this._skinnedCache = null, this._normalCache = null, this._tempVec = new Pt(), this._normalMatrix = new nt(), this._refitInFlight = !1, this._baselineComputed = !1, this._onDraggingChanged = this._onDraggingChanged.bind(this), this._onObjectChange = this._onObjectChange.bind(this), this._controls.addEventListener("dragging-changed", this._onDraggingChanged), this._controls.addEventListener("objectChange", this._onObjectChange);
|
|
13055
13059
|
}
|
|
@@ -13160,15 +13164,15 @@ var ml = new Float32Array(3), hl = {
|
|
|
13160
13164
|
dispose() {
|
|
13161
13165
|
this._controls.removeEventListener("dragging-changed", this._onDraggingChanged), this._controls.removeEventListener("objectChange", this._onObjectChange), this.detach(), this._gizmoScene.remove(this._controls.getHelper()), this._controls.dispose(), this._meshes = null, this._meshTriRanges = null, this._posBuffer = null, this._normalBuffer = null, this._skinnedCache = null, this._normalCache = null, this._baselineComputed = !1, this._app = null, this._orbitControls = null, this._camera = null, this._controls = null, this._gizmoScene = null;
|
|
13162
13166
|
}
|
|
13163
|
-
},
|
|
13167
|
+
}, Ol = /* @__PURE__ */ new WeakMap(), kl = class extends Ke {
|
|
13164
13168
|
constructor(e, t = {}) {
|
|
13165
13169
|
super();
|
|
13166
13170
|
try {
|
|
13167
|
-
|
|
13171
|
+
Ol.get(e)?.dispose();
|
|
13168
13172
|
} catch (e) {
|
|
13169
13173
|
console.warn("PathTracerApp: prior canvas owner dispose failed", e);
|
|
13170
13174
|
}
|
|
13171
|
-
|
|
13175
|
+
Ol.set(e, this), this.canvas = e, this._autoResize = t.autoResize !== !1, this._showStats = t.showStats !== !1, this._statsContainer = t.statsContainer || null, this.settings = new Yc(X), this.renderer = null, this.scene = null, this.meshScene = null, this._sceneHelpers = null, this.assetLoader = null, this._sdf = null, this._animRefitInFlight = !1, this.pipeline = null, this.stages = {}, this.cameraManager = null, this.lightManager = null, this.denoisingManager = null, this.overlayManager = null, this.interactionManager = null, this.transformManager = null, this.animationManager = new El(), this.environmentManager = null, this.isInitialized = !1, this.pauseRendering = !1, this.pathTracerEnabled = !0, this.animationManagerId = null, this.needsReset = !1, this._loadingInProgress = !1, this._needsDisplayRefresh = !1, this._paused = !1, this.completion = new Uc(), this._resizeDebounceTimer = null, this._trackedListeners = [], this._disposed = !1;
|
|
13172
13176
|
}
|
|
13173
13177
|
_addTrackedListener(e, t, n) {
|
|
13174
13178
|
e && (e.addEventListener(t, n), this._trackedListeners.push({
|
|
@@ -13474,7 +13478,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
13474
13478
|
assetLoader: this.assetLoader,
|
|
13475
13479
|
pathTracer: null,
|
|
13476
13480
|
floorPlane: this.assetLoader.floorPlane
|
|
13477
|
-
}), this.interactionManager.wireAppEvents(this), this.cameraManager.setInteractionManager(this.interactionManager), this.lightManager = new Zc(this.scene, this._sceneHelpers, this.stages.pathTracer, { onReset: () => this.reset() }), this._setupDenoisingManager(), this._setupOverlayManager(), this.transformManager = new
|
|
13481
|
+
}), this.interactionManager.wireAppEvents(this), this.cameraManager.setInteractionManager(this.interactionManager), this.lightManager = new Zc(this.scene, this._sceneHelpers, this.stages.pathTracer, { onReset: () => this.reset() }), this._setupDenoisingManager(), this._setupOverlayManager(), this.transformManager = new Dl({
|
|
13478
13482
|
camera: this.cameraManager.camera,
|
|
13479
13483
|
canvas: this.canvas,
|
|
13480
13484
|
orbitControls: this.cameraManager.controls,
|
|
@@ -13551,7 +13555,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
13551
13555
|
}), this.stages.edgeFilter = new Oc(this.renderer, { enabled: !1 }), this.stages.autoExposure = new Fc(this.renderer, { enabled: X.autoExposure ?? !1 }), this.stages.compositor = new zc(this.renderer, { saturation: this.settings.get("saturation") ?? X.saturation });
|
|
13552
13556
|
}
|
|
13553
13557
|
_setupDenoisingManager() {
|
|
13554
|
-
this.denoisingManager = new
|
|
13558
|
+
this.denoisingManager = new Sl({
|
|
13555
13559
|
renderer: this.renderer,
|
|
13556
13560
|
mainCanvas: this.canvas,
|
|
13557
13561
|
scene: this.scene,
|
|
@@ -13603,7 +13607,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
13603
13607
|
this.scene.updateMatrixWorld(), this.overlayManager?.render(), this.transformManager?.render(this.renderer);
|
|
13604
13608
|
}
|
|
13605
13609
|
_setupOverlayManager() {
|
|
13606
|
-
this.overlayManager = new
|
|
13610
|
+
this.overlayManager = new Tl(this.renderer, this.cameraManager.camera), this.overlayManager.setupDefaultHelpers({
|
|
13607
13611
|
helperScene: this._sceneHelpers,
|
|
13608
13612
|
meshScene: this.meshScene,
|
|
13609
13613
|
pipeline: this.pipeline,
|
|
@@ -13619,7 +13623,7 @@ var ml = new Float32Array(3), hl = {
|
|
|
13619
13623
|
_forwardEvents(e, t) {
|
|
13620
13624
|
if (e) for (let n of t) this._addTrackedListener(e, n, (e) => this.dispatchEvent(e));
|
|
13621
13625
|
}
|
|
13622
|
-
},
|
|
13626
|
+
}, Al = class {
|
|
13623
13627
|
constructor(e) {
|
|
13624
13628
|
this._app = e, this._cancelled = !1, this._rendering = !1;
|
|
13625
13629
|
}
|
|
@@ -13719,6 +13723,6 @@ var ml = new Float32Array(3), hl = {
|
|
|
13719
13723
|
}
|
|
13720
13724
|
};
|
|
13721
13725
|
//#endregion
|
|
13722
|
-
export { qn as AF_DEFAULTS, Hn as ASVGF_QUALITY_PRESETS, Kn as AUTO_FOCUS_MODES,
|
|
13726
|
+
export { qn as AF_DEFAULTS, Hn as ASVGF_QUALITY_PRESETS, Kn as AUTO_FOCUS_MODES, El as AnimationManager, Jn as BVH_LEAF_MARKERS, Gn as CAMERA_PRESETS, Un as CAMERA_RANGES, Xc as CameraManager, Xn as DEFAULT_TEXTURE_MATRIX, Sl as DenoisingManager, X as ENGINE_DEFAULTS, Y as EngineEvents, Zn as FINAL_RENDER_CONFIG, Wc as InteractionManager, Zc as LightManager, $n as MEMORY_CONSTANTS, Tl as OverlayManager, Qn as PREVIEW_RENDER_CONFIG, kl as PathTracerApp, Bc as PipelineContext, Hc as RenderPipeline, Yc as RenderSettings, wn as RenderStage, Wn as SKY_PRESETS, Cn as StageExecutionMode, Yn as TEXTURE_CONSTANTS, Z as TRIANGLE_DATA_LAYOUT, Dl as TransformManager, Al as VideoRenderManager };
|
|
13723
13727
|
|
|
13724
13728
|
//# sourceMappingURL=rayzee.es.js.map
|