rayzee 5.9.2 → 5.9.4
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 +60 -48
- 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 +33 -2
- package/src/managers/helpers/TileHelper.js +11 -4
package/dist/rayzee.es.js
CHANGED
|
@@ -11931,11 +11931,23 @@ function fl(e, t) {
|
|
|
11931
11931
|
}
|
|
11932
11932
|
//#endregion
|
|
11933
11933
|
//#region src/Passes/OIDNDenoiser.js
|
|
11934
|
-
var pl = null;
|
|
11935
|
-
async function
|
|
11936
|
-
|
|
11934
|
+
var pl = null, ml = null;
|
|
11935
|
+
async function hl() {
|
|
11936
|
+
if (!pl) {
|
|
11937
|
+
let [e, t] = await Promise.all([import("oidn-web"), import("@tensorflow/tfjs-core")]);
|
|
11938
|
+
pl = e.initUNetFromURL, ml = t.engine;
|
|
11939
|
+
}
|
|
11940
|
+
return pl;
|
|
11941
|
+
}
|
|
11942
|
+
function gl() {
|
|
11943
|
+
if (ml) try {
|
|
11944
|
+
let e = ml();
|
|
11945
|
+
e?.registryFactory && "webgpu-oidn" in e.registryFactory && e.removeBackend("webgpu-oidn");
|
|
11946
|
+
} catch (e) {
|
|
11947
|
+
console.warn("OIDNDenoiser: failed to clear cached TFJS backend", e);
|
|
11948
|
+
}
|
|
11937
11949
|
}
|
|
11938
|
-
var
|
|
11950
|
+
var _l = new Float32Array(3), vl = {
|
|
11939
11951
|
BASE_URL: "https://cdn.jsdelivr.net/npm/denoiser/tzas/",
|
|
11940
11952
|
QUALITY_MODELS: {
|
|
11941
11953
|
fast: "rt_hdr_calb_cnrm_small",
|
|
@@ -11948,7 +11960,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
11948
11960
|
debugGbufferMaps: !0,
|
|
11949
11961
|
tileSize: 256
|
|
11950
11962
|
}
|
|
11951
|
-
},
|
|
11963
|
+
}, yl = class extends Ke {
|
|
11952
11964
|
constructor(e, t, n, r, i = {}) {
|
|
11953
11965
|
if (super(), !e || !t || !n || !r) throw Error("OIDNDenoiser requires output canvas, renderer, scene, and camera");
|
|
11954
11966
|
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 = {
|
|
@@ -11959,7 +11971,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
11959
11971
|
width: 0,
|
|
11960
11972
|
height: 0
|
|
11961
11973
|
}, this._gpuInputPadBuffer = null, this._gpuInputPaddedRowBytes = 0, this._alphaReadbackBuffer = null, this._alphaReadbackMapped = !1, this._cachedAlpha = null, this._cachedAlphaWidth = 0, this.config = {
|
|
11962
|
-
...
|
|
11974
|
+
...vl.DEFAULT_OPTIONS,
|
|
11963
11975
|
...i
|
|
11964
11976
|
}, this.enabled = this.config.enableOIDN, this.quality = this.config.oidnQuality, this.debugGbufferMaps = this.config.debugGbufferMaps, this.tileSize = this.config.tileSize, this.state = {
|
|
11965
11977
|
isDenoising: !1,
|
|
@@ -12015,7 +12027,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
12015
12027
|
let e = this.backendParamsGetter();
|
|
12016
12028
|
this.gpuDevice = e?.device ?? null, t = e?.device ? e : void 0;
|
|
12017
12029
|
}
|
|
12018
|
-
this.unet = await (await
|
|
12030
|
+
this.unet = await (await hl())(e, t, {
|
|
12019
12031
|
aux: !0,
|
|
12020
12032
|
hdr: !0,
|
|
12021
12033
|
maxTileSize: this.tileSize
|
|
@@ -12030,14 +12042,14 @@ var hl = new Float32Array(3), gl = {
|
|
|
12030
12042
|
}
|
|
12031
12043
|
}
|
|
12032
12044
|
_generateTzaUrl() {
|
|
12033
|
-
let { BASE_URL: e, QUALITY_MODELS: t } =
|
|
12045
|
+
let { BASE_URL: e, QUALITY_MODELS: t } = vl;
|
|
12034
12046
|
return `${e}${t[this.quality] || t.balance}.tza`;
|
|
12035
12047
|
}
|
|
12036
12048
|
async updateConfiguration(e) {
|
|
12037
12049
|
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());
|
|
12038
12050
|
}
|
|
12039
12051
|
async updateQuality(e) {
|
|
12040
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
12052
|
+
if (!Object.prototype.hasOwnProperty.call(vl.QUALITY_MODELS, e)) throw Error(`Invalid quality setting: ${e}. Must be one of: ${Object.keys(vl.QUALITY_MODELS).join(", ")}`);
|
|
12041
12053
|
await this.updateConfiguration({ oidnQuality: e });
|
|
12042
12054
|
}
|
|
12043
12055
|
async start() {
|
|
@@ -12221,7 +12233,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
12221
12233
|
let e = new Float32Array(u.getMappedRange()), t = new ImageData(o, s), r = this.getExposure(), c = this.getSaturation(), l = ol.get(this.getToneMapping()) || ol.get(Oe), d = this._cachedAlpha, f = this._cachedAlphaWidth;
|
|
12222
12234
|
for (let i = 0, a = e.length; i < a; i += 4) {
|
|
12223
12235
|
let a = e[i] * r, s = e[i + 1] * r, u = e[i + 2] * r;
|
|
12224
|
-
if (c !== 1 && (
|
|
12236
|
+
if (c !== 1 && (_l[0] = a, _l[1] = s, _l[2] = u, fl(_l, c), a = _l[0], s = _l[1], u = _l[2]), l(a, s, u, 1, _l), t.data[i] = cl(_l[0]) * 255 + .5 | 0, t.data[i + 1] = cl(_l[1]) * 255 + .5 | 0, t.data[i + 2] = cl(_l[2]) * 255 + .5 | 0, d) {
|
|
12225
12237
|
let e = (i >> 2) % o, r = (i >> 2) / o | 0;
|
|
12226
12238
|
t.data[i + 3] = d[(n.y + r) * f + n.x + e];
|
|
12227
12239
|
} else t.data[i + 3] = 255;
|
|
@@ -12261,7 +12273,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
12261
12273
|
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;
|
|
12262
12274
|
for (let e = 0, t = s.length; e < t; e += 4) {
|
|
12263
12275
|
let t = s[e] * l, n = s[e + 1] * l, r = s[e + 2] * l;
|
|
12264
|
-
u !== 1 && (
|
|
12276
|
+
u !== 1 && (_l[0] = t, _l[1] = n, _l[2] = r, fl(_l, u), t = _l[0], n = _l[1], r = _l[2]), d(t, n, r, 1, _l), c.data[e] = cl(_l[0]) * 255 + .5 | 0, c.data[e + 1] = cl(_l[1]) * 255 + .5 | 0, c.data[e + 2] = cl(_l[2]) * 255 + .5 | 0, c.data[e + 3] = f ? f[e >> 2] : 255;
|
|
12265
12277
|
}
|
|
12266
12278
|
a.unmap(), this.ctx.putImageData(c, 0, 0);
|
|
12267
12279
|
} finally {
|
|
@@ -12311,21 +12323,21 @@ var hl = new Float32Array(3), gl = {
|
|
|
12311
12323
|
this._pendingStagingBuffers.clear();
|
|
12312
12324
|
}
|
|
12313
12325
|
dispose() {
|
|
12314
|
-
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");
|
|
12326
|
+
this.abort(), this._destroyPendingStagingBuffers(), this.unet?.dispose(), gl(), 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");
|
|
12315
12327
|
}
|
|
12316
|
-
},
|
|
12328
|
+
}, bl = "" + new URL("assets/AIUpscalerWorker-D58dcMrY.js", import.meta.url).href, xl = "https://huggingface.co/notaneimu/onnx-image-models/resolve/main/", Sl = {
|
|
12317
12329
|
QUALITY_PRESETS: {
|
|
12318
12330
|
fast: {
|
|
12319
|
-
2:
|
|
12320
|
-
4:
|
|
12331
|
+
2: xl + "2x-spanx2-ch48.onnx",
|
|
12332
|
+
4: xl + "4xNomos8k_span_otf_strong_fp32_opset17.onnx"
|
|
12321
12333
|
},
|
|
12322
12334
|
balanced: {
|
|
12323
|
-
2:
|
|
12324
|
-
4:
|
|
12335
|
+
2: xl + "2xNomosUni_compact_otf_medium.onnx",
|
|
12336
|
+
4: xl + "RealESRGAN_x4plus.onnx"
|
|
12325
12337
|
},
|
|
12326
12338
|
quality: {
|
|
12327
|
-
2:
|
|
12328
|
-
4:
|
|
12339
|
+
2: xl + "2x-realesrgan-x2plus.onnx",
|
|
12340
|
+
4: xl + "4xNomos2_hq_mosr_fp32.onnx"
|
|
12329
12341
|
}
|
|
12330
12342
|
},
|
|
12331
12343
|
TILE_SIZE: 512,
|
|
@@ -12337,17 +12349,17 @@ var hl = new Float32Array(3), gl = {
|
|
|
12337
12349
|
}],
|
|
12338
12350
|
graphOptimizationLevel: "all"
|
|
12339
12351
|
}
|
|
12340
|
-
},
|
|
12352
|
+
}, Cl = class extends Ke {
|
|
12341
12353
|
constructor(e, t, n = {}) {
|
|
12342
12354
|
if (super(), !e || !t) throw Error("AIUpscaler requires output canvas and renderer");
|
|
12343
|
-
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 ||
|
|
12355
|
+
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 || Sl.TILE_SIZE, this._tileSizeOverride = !!n.tileSize, this.state = {
|
|
12344
12356
|
isUpscaling: !1,
|
|
12345
12357
|
isLoading: !1,
|
|
12346
12358
|
abortController: null
|
|
12347
12359
|
}, 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;
|
|
12348
12360
|
}
|
|
12349
12361
|
async _ensureSession() {
|
|
12350
|
-
let e =
|
|
12362
|
+
let e = Sl.QUALITY_PRESETS[this.quality];
|
|
12351
12363
|
if (!e) throw Error(`Unknown quality preset: ${this.quality}`);
|
|
12352
12364
|
let t = e[this.scaleFactor];
|
|
12353
12365
|
if (!t) throw Error(`No model for ${this.quality}/${this.scaleFactor}x`);
|
|
@@ -12358,10 +12370,10 @@ var hl = new Float32Array(3), gl = {
|
|
|
12358
12370
|
});
|
|
12359
12371
|
try {
|
|
12360
12372
|
if (!this._worker) try {
|
|
12361
|
-
this._worker = new Worker(
|
|
12373
|
+
this._worker = new Worker(bl, { type: "module" });
|
|
12362
12374
|
} catch (e) {
|
|
12363
12375
|
if (e.name !== "SecurityError") throw e;
|
|
12364
|
-
this._worker = await cr(
|
|
12376
|
+
this._worker = await cr(bl);
|
|
12365
12377
|
}
|
|
12366
12378
|
await new Promise((e, n) => {
|
|
12367
12379
|
let r = (t) => {
|
|
@@ -12370,7 +12382,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
12370
12382
|
this._worker.addEventListener("message", r), this._worker.postMessage({
|
|
12371
12383
|
type: "load",
|
|
12372
12384
|
url: t,
|
|
12373
|
-
sessionOptions:
|
|
12385
|
+
sessionOptions: Sl.SESSION_OPTIONS
|
|
12374
12386
|
});
|
|
12375
12387
|
}), this._currentModelUrl = t, this.dispatchEvent({ type: "loaded" });
|
|
12376
12388
|
} catch (e) {
|
|
@@ -12438,7 +12450,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
12438
12450
|
alpha: !0
|
|
12439
12451
|
});
|
|
12440
12452
|
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));
|
|
12441
|
-
let o =
|
|
12453
|
+
let o = Sl.TILE_OVERLAP, s = this.tileSize, c = s - o * 2, l = Math.ceil(n / c), u = Math.ceil(r / c), d = l * u, f = 0;
|
|
12442
12454
|
for (let o = 0; o < u; o++) for (let u = 0; u < l; u++) {
|
|
12443
12455
|
if (e.aborted) throw new DOMException("Aborted", "AbortError");
|
|
12444
12456
|
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);
|
|
@@ -12584,7 +12596,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
12584
12596
|
this.hdr = !!e;
|
|
12585
12597
|
}
|
|
12586
12598
|
setQuality(e) {
|
|
12587
|
-
if (!
|
|
12599
|
+
if (!Sl.QUALITY_PRESETS[e]) {
|
|
12588
12600
|
console.warn(`AIUpscaler: Invalid quality "${e}", must be fast/balanced/quality`);
|
|
12589
12601
|
return;
|
|
12590
12602
|
}
|
|
@@ -12607,7 +12619,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
12607
12619
|
async dispose() {
|
|
12608
12620
|
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");
|
|
12609
12621
|
}
|
|
12610
|
-
},
|
|
12622
|
+
}, wl = class extends Ke {
|
|
12611
12623
|
constructor({ renderer: e, mainCanvas: t, scene: n, camera: r, stages: i, pipeline: a, getExposure: o, getSaturation: s, getTransparentBg: c }) {
|
|
12612
12624
|
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;
|
|
12613
12625
|
}
|
|
@@ -12628,7 +12640,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
12628
12640
|
setupDenoiser() {
|
|
12629
12641
|
if (!this.denoiserCanvas) return;
|
|
12630
12642
|
let e = this._stages.pathTracer;
|
|
12631
|
-
this.denoiser = new
|
|
12643
|
+
this.denoiser = new yl(this.denoiserCanvas, this.renderer, this.scene, this.camera, {
|
|
12632
12644
|
...X,
|
|
12633
12645
|
backendParams: () => ({
|
|
12634
12646
|
device: this.renderer.backend.device,
|
|
@@ -12653,7 +12665,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
12653
12665
|
setupUpscaler() {
|
|
12654
12666
|
if (!this.denoiserCanvas) return;
|
|
12655
12667
|
let e = this._stages.pathTracer;
|
|
12656
|
-
this.upscaler = new
|
|
12668
|
+
this.upscaler = new Cl(this.denoiserCanvas, this.renderer, {
|
|
12657
12669
|
scaleFactor: X.upscalerScale || 2,
|
|
12658
12670
|
quality: X.upscalerQuality || "fast",
|
|
12659
12671
|
getSourceCanvas: () => this.denoiser?.enabled ? null : this.renderer.domElement,
|
|
@@ -12814,9 +12826,9 @@ var hl = new Float32Array(3), gl = {
|
|
|
12814
12826
|
let t = Hn[e];
|
|
12815
12827
|
t && this._stages.asvgf?.updateParameters(t);
|
|
12816
12828
|
}
|
|
12817
|
-
},
|
|
12829
|
+
}, Tl = class {
|
|
12818
12830
|
constructor() {
|
|
12819
|
-
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.
|
|
12831
|
+
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._borderWidthRatio = 1 / 540, this._borderWidthMin = 1.5, this._borderWidthMax = 4;
|
|
12820
12832
|
}
|
|
12821
12833
|
setActiveTile(e) {
|
|
12822
12834
|
this._tileBounds = e;
|
|
@@ -12826,8 +12838,8 @@ var hl = new Float32Array(3), gl = {
|
|
|
12826
12838
|
}
|
|
12827
12839
|
render(e, t, n) {
|
|
12828
12840
|
if (!this._tileBounds) return;
|
|
12829
|
-
let r = this._tileBounds, i = t / this._imageWidth, a = n / this._imageHeight, o = r.x * i, s = r.y * a, c = r.width * i, l = r.height * a;
|
|
12830
|
-
e.strokeStyle = this._borderColor, e.lineWidth =
|
|
12841
|
+
let r = this._tileBounds, i = t / this._imageWidth, a = n / this._imageHeight, o = r.x * i, s = r.y * a, c = r.width * i, l = r.height * a, u = Math.min(this._borderWidthMax, Math.max(this._borderWidthMin, Math.min(t, n) * this._borderWidthRatio));
|
|
12842
|
+
e.strokeStyle = this._borderColor, e.lineWidth = u, e.strokeRect(o, s, c, l);
|
|
12831
12843
|
}
|
|
12832
12844
|
show() {
|
|
12833
12845
|
this.enabled && (this.visible = !0);
|
|
@@ -12838,7 +12850,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
12838
12850
|
dispose() {
|
|
12839
12851
|
this.visible = !1;
|
|
12840
12852
|
}
|
|
12841
|
-
},
|
|
12853
|
+
}, El = class {
|
|
12842
12854
|
constructor(n, r, i) {
|
|
12843
12855
|
this.layer = "scene", this.visible = !0, this._outlineNode = Jt(r, i, {
|
|
12844
12856
|
selectedObjects: [],
|
|
@@ -12872,7 +12884,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
12872
12884
|
dispose() {
|
|
12873
12885
|
this.visible = !1, this._outlineNode?.dispose(), this._material?.dispose(), this._quad = null;
|
|
12874
12886
|
}
|
|
12875
|
-
},
|
|
12887
|
+
}, Dl = class {
|
|
12876
12888
|
constructor(e, t) {
|
|
12877
12889
|
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;
|
|
12878
12890
|
}
|
|
@@ -12884,13 +12896,13 @@ var hl = new Float32Array(3), gl = {
|
|
|
12884
12896
|
}
|
|
12885
12897
|
setupDefaultHelpers({ helperScene: e, meshScene: t, pipeline: n, denoisingManager: r, app: i, renderWidth: a, renderHeight: o }) {
|
|
12886
12898
|
this.setHelperScene(e);
|
|
12887
|
-
let s = new
|
|
12899
|
+
let s = new Tl();
|
|
12888
12900
|
this.register("tiles", s), s.setRenderSize(a || 1, o || 1), i.addEventListener("resolution_changed", (e) => {
|
|
12889
12901
|
s.setRenderSize(e.width, e.height);
|
|
12890
12902
|
}), n.eventBus.on("tile:changed", (e) => {
|
|
12891
12903
|
e.renderMode === 1 && e.tileBounds && (s.setActiveTile(e.tileBounds), s.show());
|
|
12892
12904
|
}), n.eventBus.on("pipeline:reset", () => s.hide()), i.addEventListener(Y.RENDER_COMPLETE, () => s.hide()), this._wireDenoiserTileEvents(s, r);
|
|
12893
|
-
let c = new
|
|
12905
|
+
let c = new El(this.renderer, t, this.camera);
|
|
12894
12906
|
this.register("outline", c);
|
|
12895
12907
|
}
|
|
12896
12908
|
_wireDenoiserTileEvents(e, t) {
|
|
@@ -12957,7 +12969,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
12957
12969
|
for (let e of this._helpers.values()) e.dispose?.();
|
|
12958
12970
|
this._helpers.clear(), this._hudCanvas.parentElement && this._hudCanvas.parentElement.removeChild(this._hudCanvas);
|
|
12959
12971
|
}
|
|
12960
|
-
},
|
|
12972
|
+
}, Ol = class extends Ke {
|
|
12961
12973
|
constructor() {
|
|
12962
12974
|
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;
|
|
12963
12975
|
}
|
|
@@ -13057,7 +13069,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
13057
13069
|
dispose() {
|
|
13058
13070
|
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;
|
|
13059
13071
|
}
|
|
13060
|
-
},
|
|
13072
|
+
}, kl = class {
|
|
13061
13073
|
constructor({ camera: e, canvas: t, orbitControls: n, app: r }) {
|
|
13062
13074
|
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);
|
|
13063
13075
|
}
|
|
@@ -13168,15 +13180,15 @@ var hl = new Float32Array(3), gl = {
|
|
|
13168
13180
|
dispose() {
|
|
13169
13181
|
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;
|
|
13170
13182
|
}
|
|
13171
|
-
},
|
|
13183
|
+
}, Al = /* @__PURE__ */ new WeakMap(), jl = class extends Ke {
|
|
13172
13184
|
constructor(e, t = {}) {
|
|
13173
13185
|
super();
|
|
13174
13186
|
try {
|
|
13175
|
-
|
|
13187
|
+
Al.get(e)?.dispose();
|
|
13176
13188
|
} catch (e) {
|
|
13177
13189
|
console.warn("PathTracerApp: prior canvas owner dispose failed", e);
|
|
13178
13190
|
}
|
|
13179
|
-
|
|
13191
|
+
Al.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 Ol(), 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;
|
|
13180
13192
|
}
|
|
13181
13193
|
_addTrackedListener(e, t, n) {
|
|
13182
13194
|
e && (e.addEventListener(t, n), this._trackedListeners.push({
|
|
@@ -13482,7 +13494,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
13482
13494
|
assetLoader: this.assetLoader,
|
|
13483
13495
|
pathTracer: null,
|
|
13484
13496
|
floorPlane: this.assetLoader.floorPlane
|
|
13485
|
-
}), 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
|
|
13497
|
+
}), 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 kl({
|
|
13486
13498
|
camera: this.cameraManager.camera,
|
|
13487
13499
|
canvas: this.canvas,
|
|
13488
13500
|
orbitControls: this.cameraManager.controls,
|
|
@@ -13559,7 +13571,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
13559
13571
|
}), 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 });
|
|
13560
13572
|
}
|
|
13561
13573
|
_setupDenoisingManager() {
|
|
13562
|
-
this.denoisingManager = new
|
|
13574
|
+
this.denoisingManager = new wl({
|
|
13563
13575
|
renderer: this.renderer,
|
|
13564
13576
|
mainCanvas: this.canvas,
|
|
13565
13577
|
scene: this.scene,
|
|
@@ -13611,7 +13623,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
13611
13623
|
this.scene.updateMatrixWorld(), this.overlayManager?.render(), this.transformManager?.render(this.renderer);
|
|
13612
13624
|
}
|
|
13613
13625
|
_setupOverlayManager() {
|
|
13614
|
-
this.overlayManager = new
|
|
13626
|
+
this.overlayManager = new Dl(this.renderer, this.cameraManager.camera), this.overlayManager.setupDefaultHelpers({
|
|
13615
13627
|
helperScene: this._sceneHelpers,
|
|
13616
13628
|
meshScene: this.meshScene,
|
|
13617
13629
|
pipeline: this.pipeline,
|
|
@@ -13627,7 +13639,7 @@ var hl = new Float32Array(3), gl = {
|
|
|
13627
13639
|
_forwardEvents(e, t) {
|
|
13628
13640
|
if (e) for (let n of t) this._addTrackedListener(e, n, (e) => this.dispatchEvent(e));
|
|
13629
13641
|
}
|
|
13630
|
-
},
|
|
13642
|
+
}, Ml = class {
|
|
13631
13643
|
constructor(e) {
|
|
13632
13644
|
this._app = e, this._cancelled = !1, this._rendering = !1;
|
|
13633
13645
|
}
|
|
@@ -13727,6 +13739,6 @@ var hl = new Float32Array(3), gl = {
|
|
|
13727
13739
|
}
|
|
13728
13740
|
};
|
|
13729
13741
|
//#endregion
|
|
13730
|
-
export { qn as AF_DEFAULTS, Hn as ASVGF_QUALITY_PRESETS, Kn as AUTO_FOCUS_MODES,
|
|
13742
|
+
export { qn as AF_DEFAULTS, Hn as ASVGF_QUALITY_PRESETS, Kn as AUTO_FOCUS_MODES, Ol as AnimationManager, Jn as BVH_LEAF_MARKERS, Gn as CAMERA_PRESETS, Un as CAMERA_RANGES, Xc as CameraManager, Xn as DEFAULT_TEXTURE_MATRIX, wl as DenoisingManager, X as ENGINE_DEFAULTS, Y as EngineEvents, Zn as FINAL_RENDER_CONFIG, Wc as InteractionManager, Zc as LightManager, $n as MEMORY_CONSTANTS, Dl as OverlayManager, Qn as PREVIEW_RENDER_CONFIG, jl 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, kl as TransformManager, Ml as VideoRenderManager };
|
|
13731
13743
|
|
|
13732
13744
|
//# sourceMappingURL=rayzee.es.js.map
|