rayzee 4.8.10 → 4.8.12

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 CHANGED
@@ -11051,7 +11051,265 @@ var oc = class extends fn {
11051
11051
  removeAllEventListeners() {
11052
11052
  super.dispose();
11053
11053
  }
11054
- }, mc = {
11054
+ }, mc = class {
11055
+ constructor(e) {
11056
+ this._app = e;
11057
+ }
11058
+ getCanvas() {
11059
+ return this._app.getOutputCanvas();
11060
+ }
11061
+ screenshot() {
11062
+ this._app.takeScreenshot();
11063
+ }
11064
+ getStatistics() {
11065
+ return this._app.getSceneStatistics();
11066
+ }
11067
+ setSize(e, t) {
11068
+ this._app.setCanvasSize(e, t);
11069
+ }
11070
+ resize() {
11071
+ this._app.onResize();
11072
+ }
11073
+ isComplete() {
11074
+ return this._app.isComplete();
11075
+ }
11076
+ getFrameCount() {
11077
+ return this._app.getFrameCount();
11078
+ }
11079
+ }, hc = class {
11080
+ constructor(e) {
11081
+ this._app = e;
11082
+ }
11083
+ add(e) {
11084
+ return this._app.addLight(e);
11085
+ }
11086
+ remove(e) {
11087
+ return this._app.removeLight(e);
11088
+ }
11089
+ clear() {
11090
+ this._app.clearLights();
11091
+ }
11092
+ getAll() {
11093
+ return this._app.getLights();
11094
+ }
11095
+ sync() {
11096
+ this._app.updateLights();
11097
+ }
11098
+ showHelpers(e) {
11099
+ this._app.setShowLightHelper(e);
11100
+ }
11101
+ }, gc = class {
11102
+ constructor(e) {
11103
+ this._app = e;
11104
+ }
11105
+ play(e = 0) {
11106
+ this._app.playAnimation(e);
11107
+ }
11108
+ pause() {
11109
+ this._app.pauseAnimation();
11110
+ }
11111
+ resume() {
11112
+ this._app.resumeAnimation();
11113
+ }
11114
+ stop() {
11115
+ this._app.stopAnimationPlayback();
11116
+ }
11117
+ setSpeed(e) {
11118
+ this._app.setAnimationSpeed(e);
11119
+ }
11120
+ setLoop(e) {
11121
+ this._app.setAnimationLoop(e);
11122
+ }
11123
+ get clips() {
11124
+ return this._app.animationClips;
11125
+ }
11126
+ }, _c = class {
11127
+ constructor(e) {
11128
+ this._app = e;
11129
+ }
11130
+ select(e) {
11131
+ this._app.selectObject(e);
11132
+ }
11133
+ deselect() {
11134
+ this._app.selectObject(null);
11135
+ }
11136
+ toggleMode() {
11137
+ return this._app.toggleSelectMode();
11138
+ }
11139
+ disableMode() {
11140
+ this._app.disableSelectMode();
11141
+ }
11142
+ toggleFocusMode() {
11143
+ return this._app.toggleFocusMode();
11144
+ }
11145
+ dispatchEvent(e) {
11146
+ this._app.dispatchInteractionEvent(e);
11147
+ }
11148
+ on(e, t) {
11149
+ return this._app.onInteractionEvent(e, t);
11150
+ }
11151
+ }, vc = class {
11152
+ constructor(e) {
11153
+ this._app = e;
11154
+ }
11155
+ setMode(e) {
11156
+ this._app.setTransformMode(e);
11157
+ }
11158
+ setSpace(e) {
11159
+ this._app.setTransformSpace(e);
11160
+ }
11161
+ get manager() {
11162
+ return this._app.transformManager;
11163
+ }
11164
+ }, yc = class {
11165
+ constructor(e) {
11166
+ this._app = e;
11167
+ }
11168
+ get active() {
11169
+ return this._app.cameraManager?.camera ?? this._app._camera;
11170
+ }
11171
+ get controls() {
11172
+ return this._app.cameraManager?.controls ?? this._app._controls;
11173
+ }
11174
+ switch(e) {
11175
+ this._app.switchCamera(e);
11176
+ }
11177
+ getNames() {
11178
+ return this._app.getCameraNames();
11179
+ }
11180
+ focusOn(e) {
11181
+ this._app.focusOnPoint(e);
11182
+ }
11183
+ setAutoFocusMode(e) {
11184
+ this._app.cameraManager?.setAutoFocusMode(e);
11185
+ }
11186
+ setAFScreenPoint(e, t) {
11187
+ this._app.cameraManager?.setAFScreenPoint(e, t);
11188
+ }
11189
+ enterAFPointPlacementMode() {
11190
+ this._app.cameraManager?.enterAFPointPlacementMode();
11191
+ }
11192
+ exitAFPointPlacementMode() {
11193
+ this._app.cameraManager?.exitAFPointPlacementMode();
11194
+ }
11195
+ }, bc = class {
11196
+ constructor(e) {
11197
+ this._app = e;
11198
+ }
11199
+ get params() {
11200
+ return this._app.getEnvParams();
11201
+ }
11202
+ get texture() {
11203
+ return this._app.getEnvironmentTexture();
11204
+ }
11205
+ async load(e) {
11206
+ await this._app.loadEnvironment(e);
11207
+ }
11208
+ async setTexture(e) {
11209
+ await this._app.setEnvironmentMap(e);
11210
+ }
11211
+ async setMode(e) {
11212
+ await this._app.setEnvironmentMode(e);
11213
+ }
11214
+ async generateProcedural() {
11215
+ return this._app.generateProceduralSkyTexture();
11216
+ }
11217
+ async generateGradient() {
11218
+ return this._app.generateGradientTexture();
11219
+ }
11220
+ async generateSolid() {
11221
+ return this._app.generateSolidColorTexture();
11222
+ }
11223
+ markDirty() {
11224
+ this._app.markEnvironmentNeedsUpdate();
11225
+ }
11226
+ }, xc = class {
11227
+ constructor(e) {
11228
+ this._app = e;
11229
+ }
11230
+ setProperty(e, t, n) {
11231
+ this._app.updateMaterialProperty(e, t, n);
11232
+ }
11233
+ setTextureTransform(e, t, n) {
11234
+ this._app.updateTextureTransform(e, t, n);
11235
+ }
11236
+ refresh() {
11237
+ this._app.refreshMaterial();
11238
+ }
11239
+ replace(e, t) {
11240
+ this._app.updateMaterial(e, t);
11241
+ }
11242
+ async rebuild(e) {
11243
+ await this._app.rebuildMaterials(e);
11244
+ }
11245
+ }, Sc = class {
11246
+ constructor(e) {
11247
+ this._app = e;
11248
+ }
11249
+ setStrategy(e, t) {
11250
+ this._app.setDenoiserStrategy(e, t);
11251
+ }
11252
+ setASVGFEnabled(e, t) {
11253
+ this._app.setASVGFEnabled(e, t);
11254
+ }
11255
+ applyASVGFPreset(e) {
11256
+ this._app.applyASVGFPreset(e);
11257
+ }
11258
+ setAutoExposure(e) {
11259
+ this._app.setAutoExposureEnabled(e);
11260
+ }
11261
+ setAdaptiveSampling(e) {
11262
+ this._app.setAdaptiveSamplingEnabled(e);
11263
+ }
11264
+ setASVGFParams(e) {
11265
+ this._app.updateASVGFParameters(e);
11266
+ }
11267
+ toggleASVGFHeatmap(e) {
11268
+ this._app.toggleASVGFHeatmap(e);
11269
+ }
11270
+ configureASVGFForMode(e) {
11271
+ this._app.configureASVGFForMode(e);
11272
+ }
11273
+ setSSRCParams(e) {
11274
+ this._app.updateSSRCParameters(e);
11275
+ }
11276
+ setEdgeAwareParams(e) {
11277
+ this._app.updateEdgeAwareUniforms(e);
11278
+ }
11279
+ setAutoExposureParams(e) {
11280
+ this._app.updateAutoExposureParameters(e);
11281
+ }
11282
+ setAdaptiveSamplingParams(e) {
11283
+ this._app.setAdaptiveSamplingParameters(e);
11284
+ }
11285
+ toggleAdaptiveSamplingHelper(e) {
11286
+ this._app.toggleAdaptiveSamplingHelper(e);
11287
+ }
11288
+ setOIDNEnabled(e) {
11289
+ this._app.setOIDNEnabled(e);
11290
+ }
11291
+ setOIDNQuality(e) {
11292
+ this._app.updateOIDNQuality(e);
11293
+ }
11294
+ setOIDNTileHelper(e) {
11295
+ this._app.setOIDNTileHelper(e);
11296
+ }
11297
+ setTileHelperEnabled(e) {
11298
+ this._app.setTileHelperEnabled(e);
11299
+ }
11300
+ setTileHighlightEnabled(e) {
11301
+ this._app.setTileHighlightEnabled(e);
11302
+ }
11303
+ setUpscalerEnabled(e) {
11304
+ this._app.setUpscalerEnabled(e);
11305
+ }
11306
+ setUpscalerScaleFactor(e) {
11307
+ this._app.setUpscalerScaleFactor(e);
11308
+ }
11309
+ setUpscalerQuality(e) {
11310
+ this._app.setUpscalerQuality(e);
11311
+ }
11312
+ }, Cc = {
11055
11313
  maxBounces: {
11056
11314
  uniform: "maxBounces",
11057
11315
  reset: !0
@@ -11154,11 +11412,11 @@ var oc = class extends fn {
11154
11412
  },
11155
11413
  renderMode: { handler: "handleRenderMode" },
11156
11414
  environmentRotation: { handler: "handleEnvironmentRotation" }
11157
- }, hc = {
11415
+ }, wc = {
11158
11416
  bounces: "maxBounces",
11159
11417
  adaptiveSampling: "useAdaptiveSampling",
11160
11418
  debugMode: "visMode"
11161
- }, gc = class extends E {
11419
+ }, Tc = class extends E {
11162
11420
  constructor(e = Z) {
11163
11421
  super(), this._values = /* @__PURE__ */ new Map(), this._pathTracer = null, this._resetCallback = null, this._handlers = {}, this._delegates = {}, this._initDefaults(e);
11164
11422
  }
@@ -11169,7 +11427,7 @@ var oc = class extends fn {
11169
11427
  let i = this._values.get(e);
11170
11428
  if (i === t) return;
11171
11429
  this._values.set(e, t);
11172
- let a = mc[e];
11430
+ let a = Cc[e];
11173
11431
  a && (this._applyRoute(a, t, i), (n === void 0 ? a.reset ?? !0 : n) && this._resetCallback?.(), r || this.dispatchEvent({
11174
11432
  type: hn.SETTING_CHANGED,
11175
11433
  key: e,
@@ -11183,7 +11441,7 @@ var oc = class extends fn {
11183
11441
  let e = this._values.get(r);
11184
11442
  if (e === i) continue;
11185
11443
  this._values.set(r, i);
11186
- let a = mc[r];
11444
+ let a = Cc[r];
11187
11445
  a && (this._applyRoute(a, i, e), (a.reset ?? !0) && (n = !0), t || this.dispatchEvent({
11188
11446
  type: hn.SETTING_CHANGED,
11189
11447
  key: r,
@@ -11201,7 +11459,7 @@ var oc = class extends fn {
11201
11459
  }
11202
11460
  applyAll() {
11203
11461
  for (let [e, t] of this._values) {
11204
- let n = mc[e];
11462
+ let n = Cc[e];
11205
11463
  n && this._applyRoute(n, t, void 0);
11206
11464
  }
11207
11465
  }
@@ -11209,10 +11467,10 @@ var oc = class extends fn {
11209
11467
  e.uniform ? (this._pathTracer?.setUniform(e.uniform, t), e.after && this._pathTracer?.[e.after]?.()) : e.handler ? this._handlers[e.handler]?.(t, n) : e.delegate && this._delegates[e.delegate]?.updateParam?.(e.param, t);
11210
11468
  }
11211
11469
  _initDefaults(e) {
11212
- for (let t of Object.keys(mc)) t in e && this._values.set(t, e[t]);
11213
- for (let [t, n] of Object.entries(hc)) t in e && this._values.set(n, e[t]);
11470
+ for (let t of Object.keys(Cc)) t in e && this._values.set(t, e[t]);
11471
+ for (let [t, n] of Object.entries(wc)) t in e && this._values.set(n, e[t]);
11214
11472
  }
11215
- }, _c = class extends E {
11473
+ }, Ec = class extends E {
11216
11474
  constructor(e, t, n) {
11217
11475
  super(), this.camera = e, this.controls = t, this.interactionManager = n, this.cameras = [e], this.currentCameraIndex = 0, this.autoFocusMode = In.SMOOTHING_FACTOR ? "auto" : "manual", this.afScreenPoint = {
11218
11476
  x: .5,
@@ -11296,7 +11554,7 @@ var oc = class extends fn {
11296
11554
  m ? s?.() : n > In.RESET_THRESHOLD && o?.();
11297
11555
  }
11298
11556
  }
11299
- }, vc = class extends E {
11557
+ }, Dc = class extends E {
11300
11558
  constructor(e, t, n) {
11301
11559
  super(), this.scene = e, this.sceneHelpers = t, this.pathTracer = n;
11302
11560
  }
@@ -11428,39 +11686,39 @@ var oc = class extends fn {
11428
11686
  ]);
11429
11687
  return n;
11430
11688
  }
11431
- }, yc = (e) => Math.min(Math.max(e, 0), 1);
11432
- function bc(e, t, n, r, i) {
11433
- i[0] = yc(e), i[1] = yc(t), i[2] = yc(n);
11689
+ }, Oc = (e) => Math.min(Math.max(e, 0), 1);
11690
+ function kc(e, t, n, r, i) {
11691
+ i[0] = Oc(e), i[1] = Oc(t), i[2] = Oc(n);
11434
11692
  }
11435
- function xc(e, t, n, r, i) {
11436
- i[0] = yc(e * r), i[1] = yc(t * r), i[2] = yc(n * r);
11693
+ function Ac(e, t, n, r, i) {
11694
+ i[0] = Oc(e * r), i[1] = Oc(t * r), i[2] = Oc(n * r);
11437
11695
  }
11438
- function Sc(e, t, n, r, i) {
11439
- e *= r, t *= r, n *= r, i[0] = yc(e / (e + 1)), i[1] = yc(t / (t + 1)), i[2] = yc(n / (n + 1));
11696
+ function jc(e, t, n, r, i) {
11697
+ e *= r, t *= r, n *= r, i[0] = Oc(e / (e + 1)), i[1] = Oc(t / (t + 1)), i[2] = Oc(n / (n + 1));
11440
11698
  }
11441
- function Cc(e, t, n, r, i) {
11699
+ function Mc(e, t, n, r, i) {
11442
11700
  e = Math.max(e * r - .004, 0), t = Math.max(t * r - .004, 0), n = Math.max(n * r - .004, 0);
11443
11701
  let a = (e) => (e * (6.2 * e + .5) / (e * (6.2 * e + 1.7) + .06)) ** 2.2;
11444
11702
  i[0] = a(e), i[1] = a(t), i[2] = a(n);
11445
11703
  }
11446
- function wc(e, t, n, r, i) {
11704
+ function Nc(e, t, n, r, i) {
11447
11705
  e = e * r / .6, t = t * r / .6, n = n * r / .6;
11448
11706
  let a = .59719 * e + .35458 * t + .04823 * n, o = .076 * e + .90834 * t + .01566 * n, s = .0284 * e + .13383 * t + .83777 * n, c = (e) => (e * (e + .0245786) - 90537e-9) / (e * (.983729 * e + .432951) + .238081);
11449
- a = c(a), o = c(o), s = c(s), i[0] = yc(1.60475 * a - .53108 * o - .07367 * s), i[1] = yc(-.10208 * a + 1.10813 * o - .00605 * s), i[2] = yc(-.00327 * a - .07276 * o + 1.07602 * s);
11707
+ a = c(a), o = c(o), s = c(s), i[0] = Oc(1.60475 * a - .53108 * o - .07367 * s), i[1] = Oc(-.10208 * a + 1.10813 * o - .00605 * s), i[2] = Oc(-.00327 * a - .07276 * o + 1.07602 * s);
11450
11708
  }
11451
- function Tc(e, t, n, r, i) {
11709
+ function Pc(e, t, n, r, i) {
11452
11710
  e *= r, t *= r, n *= r;
11453
11711
  let a = .6274 * e + .3293 * t + .0433 * n, o = .0691 * e + .9195 * t + .0113 * n, s = .0164 * e + .088 * t + .8956 * n, c = .856627153315983 * a + .0951212405381588 * o + .0482516061458583 * s, l = .137318972929847 * a + .761241990602591 * o + .101439036467562 * s, u = .11189821299995 * a + .0767994186031903 * o + .811302368396859 * s, d = -12.47393, f = 4.026069 - d;
11454
- c = yc((Math.log2(Math.max(c, 1e-10)) - d) / f), l = yc((Math.log2(Math.max(l, 1e-10)) - d) / f), u = yc((Math.log2(Math.max(u, 1e-10)) - d) / f);
11712
+ c = Oc((Math.log2(Math.max(c, 1e-10)) - d) / f), l = Oc((Math.log2(Math.max(l, 1e-10)) - d) / f), u = Oc((Math.log2(Math.max(u, 1e-10)) - d) / f);
11455
11713
  let p = (e) => {
11456
11714
  let t = e * e, n = t * t;
11457
11715
  return 15.5 * n * t - 40.14 * n * e + 31.96 * n - 6.868 * t * e + .4298 * t + .1191 * e - .00232;
11458
11716
  };
11459
11717
  c = p(c), l = p(l), u = p(u);
11460
11718
  let m = 1.1271005818144368 * c - .11060664309660323 * l - .016493938717834573 * u, h = -.1413297634984383 * c + 1.157823702216272 * l - .016493938717834257 * u, g = -.14132976349843826 * c - .11060664309660294 * l + 1.2519364065950405 * u;
11461
- m = Math.max(0, m) ** 2.2, h = Math.max(0, h) ** 2.2, g = Math.max(0, g) ** 2.2, i[0] = yc(1.6605 * m - .5876 * h - .0728 * g), i[1] = yc(-.1246 * m + 1.1329 * h - .0083 * g), i[2] = yc(-.0182 * m - .1006 * h + 1.1187 * g);
11719
+ m = Math.max(0, m) ** 2.2, h = Math.max(0, h) ** 2.2, g = Math.max(0, g) ** 2.2, i[0] = Oc(1.6605 * m - .5876 * h - .0728 * g), i[1] = Oc(-.1246 * m + 1.1329 * h - .0083 * g), i[2] = Oc(-.0182 * m - .1006 * h + 1.1187 * g);
11462
11720
  }
11463
- function Ec(e, t, n, r, i) {
11721
+ function Fc(e, t, n, r, i) {
11464
11722
  let a = .76;
11465
11723
  e *= r, t *= r, n *= r;
11466
11724
  let o = Math.min(e, Math.min(t, n)), s = o < .08 ? o - 6.25 * o * o : .04;
@@ -11475,27 +11733,27 @@ function Ec(e, t, n, r, i) {
11475
11733
  let f = 1 - 1 / (.15 * (c - u) + 1);
11476
11734
  i[0] = e + (u - e) * f, i[1] = t + (u - t) * f, i[2] = n + (u - n) * f;
11477
11735
  }
11478
- var Dc = new Map([
11479
- [me, bc],
11480
- [te, xc],
11481
- [Te, Sc],
11482
- [h, Cc],
11483
- [c, wc],
11484
- [u, Tc],
11485
- [fe, Ec]
11486
- ]), Oc = 1 / 2.2, kc = .2126, Ac = .7152, jc = .0722;
11487
- function Mc(e, t) {
11736
+ var Ic = new Map([
11737
+ [me, kc],
11738
+ [te, Ac],
11739
+ [Te, jc],
11740
+ [h, Mc],
11741
+ [c, Nc],
11742
+ [u, Pc],
11743
+ [fe, Fc]
11744
+ ]), Lc = 1 / 2.2, Rc = .2126, zc = .7152, Bc = .0722;
11745
+ function Vc(e, t) {
11488
11746
  if (t === 1) return;
11489
- let n = e[0] * kc + e[1] * Ac + e[2] * jc;
11747
+ let n = e[0] * Rc + e[1] * zc + e[2] * Bc;
11490
11748
  e[0] = n + (e[0] - n) * t, e[1] = n + (e[1] - n) * t, e[2] = n + (e[2] - n) * t;
11491
11749
  }
11492
11750
  //#endregion
11493
11751
  //#region src/Passes/OIDNDenoiser.js
11494
- var Nc = null;
11495
- async function Pc() {
11496
- return Nc ||= (await import("oidn-web")).initUNetFromURL, Nc;
11752
+ var Hc = null;
11753
+ async function Uc() {
11754
+ return Hc ||= (await import("oidn-web")).initUNetFromURL, Hc;
11497
11755
  }
11498
- var Fc = new Float32Array(3), Ic = {
11756
+ var Wc = new Float32Array(3), Gc = {
11499
11757
  BASE_URL: "https://cdn.jsdelivr.net/npm/denoiser/tzas/",
11500
11758
  QUALITY_SUFFIXES: {
11501
11759
  fast: "_small",
@@ -11508,7 +11766,7 @@ var Fc = new Float32Array(3), Ic = {
11508
11766
  debugGbufferMaps: !0,
11509
11767
  tileSize: 256
11510
11768
  }
11511
- }, Lc = class extends E {
11769
+ }, Kc = class extends E {
11512
11770
  constructor(e, t, n, r, i = {}) {
11513
11771
  if (super(), !e || !t || !n || !r) throw Error("OIDNDenoiser requires output canvas, renderer, scene, and camera");
11514
11772
  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 || (() => c), this.getSaturation = i.getSaturation || (() => 1), this.getTransparentBackground = i.getTransparentBackground || (() => !1), this.isGPUMode = !!this.backendParamsGetter, this.gpuDevice = null, this._gpuInputBuffers = {
@@ -11519,7 +11777,7 @@ var Fc = new Float32Array(3), Ic = {
11519
11777
  width: 0,
11520
11778
  height: 0
11521
11779
  }, this._cachedAlpha = null, this._cachedAlphaWidth = 0, this.config = {
11522
- ...Ic.DEFAULT_OPTIONS,
11780
+ ...Gc.DEFAULT_OPTIONS,
11523
11781
  ...i
11524
11782
  }, this.enabled = this.config.enableOIDN, this.quality = this.config.oidnQuality, this.debugGbufferMaps = this.config.debugGbufferMaps, this.tileSize = this.config.tileSize, this.state = {
11525
11783
  isDenoising: !1,
@@ -11575,7 +11833,7 @@ var Fc = new Float32Array(3), Ic = {
11575
11833
  let e = this.backendParamsGetter();
11576
11834
  this.gpuDevice = e?.device ?? null, t = e?.device ? e : void 0;
11577
11835
  }
11578
- this.unet = await (await Pc())(e, t, {
11836
+ this.unet = await (await Uc())(e, t, {
11579
11837
  aux: !0,
11580
11838
  hdr: !0,
11581
11839
  maxTileSize: this.tileSize
@@ -11590,14 +11848,14 @@ var Fc = new Float32Array(3), Ic = {
11590
11848
  }
11591
11849
  }
11592
11850
  _generateTzaUrl() {
11593
- let { BASE_URL: e, QUALITY_SUFFIXES: t } = Ic;
11851
+ let { BASE_URL: e, QUALITY_SUFFIXES: t } = Gc;
11594
11852
  return `${e}rt_hdr_alb_nrm${t[this.quality] || ""}.tza`;
11595
11853
  }
11596
11854
  async updateConfiguration(e) {
11597
11855
  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());
11598
11856
  }
11599
11857
  async updateQuality(e) {
11600
- if (!Object.prototype.hasOwnProperty.call(Ic.QUALITY_SUFFIXES, e)) throw Error(`Invalid quality setting: ${e}. Must be one of: ${Object.keys(Ic.QUALITY_SUFFIXES).join(", ")}`);
11858
+ if (!Object.prototype.hasOwnProperty.call(Gc.QUALITY_SUFFIXES, e)) throw Error(`Invalid quality setting: ${e}. Must be one of: ${Object.keys(Gc.QUALITY_SUFFIXES).join(", ")}`);
11601
11859
  await this.updateConfiguration({ oidnQuality: e });
11602
11860
  }
11603
11861
  async start() {
@@ -11633,21 +11891,45 @@ var Fc = new Float32Array(3), Ic = {
11633
11891
  let r = this.gpuDevice;
11634
11892
  if (!r) return console.warn("OIDNDenoiser: gpuDevice not available"), !1;
11635
11893
  this._ensureGPUInputBuffers(e, t);
11636
- let i = r.createCommandEncoder({ label: "oidn-tex-to-buf" }), a = e * 16, o = (n, r) => i.copyTextureToBuffer({
11637
- texture: n,
11638
- mipLevel: 0
11639
- }, {
11640
- buffer: r,
11641
- offset: 0,
11642
- bytesPerRow: a,
11643
- rowsPerImage: t
11644
- }, {
11645
- width: e,
11646
- height: t,
11647
- depthOrArrayLayers: 1
11648
- });
11649
- o(n.color, this._gpuInputBuffers.color), o(n.albedo, this._gpuInputBuffers.albedo), o(n.normal, this._gpuInputBuffers.normal), r.queue.submit([i.finish()]), this.getTransparentBackground() ? await this._cacheInputAlpha(r, e, t) : this._cachedAlpha = null, this.ctx.drawImage(this.input, 0, 0, e, t);
11650
- let s = {
11894
+ let i = r.createCommandEncoder({ label: "oidn-tex-to-buf" }), a = e * 16, o = Math.ceil(a / 256) * 256, s = o !== a, c = [], l = (n, l) => {
11895
+ if (!s) i.copyTextureToBuffer({
11896
+ texture: n,
11897
+ mipLevel: 0
11898
+ }, {
11899
+ buffer: l,
11900
+ offset: 0,
11901
+ bytesPerRow: a,
11902
+ rowsPerImage: t
11903
+ }, {
11904
+ width: e,
11905
+ height: t,
11906
+ depthOrArrayLayers: 1
11907
+ });
11908
+ else {
11909
+ let s = r.createBuffer({
11910
+ size: o * t,
11911
+ usage: GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC
11912
+ });
11913
+ c.push(s), i.copyTextureToBuffer({
11914
+ texture: n,
11915
+ mipLevel: 0
11916
+ }, {
11917
+ buffer: s,
11918
+ offset: 0,
11919
+ bytesPerRow: o,
11920
+ rowsPerImage: t
11921
+ }, {
11922
+ width: e,
11923
+ height: t,
11924
+ depthOrArrayLayers: 1
11925
+ });
11926
+ for (let e = 0; e < t; e++) i.copyBufferToBuffer(s, e * o, l, e * a, a);
11927
+ }
11928
+ };
11929
+ l(n.color, this._gpuInputBuffers.color), l(n.albedo, this._gpuInputBuffers.albedo), l(n.normal, this._gpuInputBuffers.normal), r.queue.submit([i.finish()]);
11930
+ for (let e of c) e.destroy();
11931
+ this.getTransparentBackground() ? await this._cacheInputAlpha(r, e, t) : this._cachedAlpha = null, this.ctx.drawImage(this.input, 0, 0, e, t);
11932
+ let u = {
11651
11933
  color: {
11652
11934
  data: this._gpuInputBuffers.color,
11653
11935
  width: e,
@@ -11664,13 +11946,13 @@ var Fc = new Float32Array(3), Ic = {
11664
11946
  height: t
11665
11947
  }
11666
11948
  };
11667
- return this._executeWithAbortGPU(s);
11949
+ return this._executeWithAbortGPU(u);
11668
11950
  }
11669
11951
  _ensureGPUInputBuffers(e, t) {
11670
11952
  let { width: n, height: r } = this._gpuInputBufferSize;
11671
11953
  if (n === e && r === t && this._gpuInputBuffers.color) return;
11672
11954
  this._destroyGPUInputBuffers();
11673
- let i = this.gpuDevice, a = e * t * 4 * 4, o = GPUBufferUsage.COPY_DST | GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC;
11955
+ let i = this.gpuDevice, a = e * t * 16, o = GPUBufferUsage.COPY_DST | GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC;
11674
11956
  this._gpuInputBuffers.color = i.createBuffer({
11675
11957
  label: "oidn-in-color",
11676
11958
  size: a,
@@ -11699,7 +11981,7 @@ var Fc = new Float32Array(3), Ic = {
11699
11981
  };
11700
11982
  }
11701
11983
  async _cacheInputAlpha(e, t, n) {
11702
- let r = t * n * 4 * 4, i = e.createBuffer({
11984
+ let r = t * n * 16, i = e.createBuffer({
11703
11985
  label: "oidn-alpha-staging",
11704
11986
  size: r,
11705
11987
  usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST
@@ -11736,24 +12018,26 @@ var Fc = new Float32Array(3), Ic = {
11736
12018
  imageWidth: e.width,
11737
12019
  imageHeight: e.height
11738
12020
  });
11739
- let r = this.gpuDevice, i = e.width, a = n.width * 16, o = n.width * n.height * 16, s = r.createBuffer({
11740
- size: o,
12021
+ let r = this.gpuDevice, i = e.width, a = e.height, o = Math.min(n.width, i - n.x), s = Math.min(n.height, a - n.y);
12022
+ if (o <= 0 || s <= 0) return;
12023
+ let l = o * 16, u = o * s * 16, d = r.createBuffer({
12024
+ size: u,
11741
12025
  usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST
11742
- }), l = r.createCommandEncoder();
11743
- for (let t = 0; t < n.height; t++) {
11744
- let r = ((n.y + t) * i + n.x) * 16, o = t * a;
11745
- l.copyBufferToBuffer(e.data, r, s, o, a);
12026
+ }), f = r.createCommandEncoder();
12027
+ for (let t = 0; t < s; t++) {
12028
+ let r = ((n.y + t) * i + n.x) * 16, a = t * l;
12029
+ f.copyBufferToBuffer(e.data, r, d, a, l);
11746
12030
  }
11747
- r.queue.submit([l.finish()]), s.mapAsync(GPUMapMode.READ).then(() => {
11748
- let e = new Float32Array(s.getMappedRange()), t = new ImageData(n.width, n.height), r = this.getExposure(), i = this.getSaturation(), a = Dc.get(this.getToneMapping()) || Dc.get(c), o = this._cachedAlpha, l = this._cachedAlphaWidth;
12031
+ r.queue.submit([f.finish()]), d.mapAsync(GPUMapMode.READ).then(() => {
12032
+ let e = new Float32Array(d.getMappedRange()), t = new ImageData(o, s), r = this.getExposure(), i = this.getSaturation(), a = Ic.get(this.getToneMapping()) || Ic.get(c), l = this._cachedAlpha, u = this._cachedAlphaWidth;
11749
12033
  for (let s = 0, c = e.length; s < c; s += 4) {
11750
- let c = e[s] * r, u = e[s + 1] * r, d = e[s + 2] * r;
11751
- if (i !== 1 && (Fc[0] = c, Fc[1] = u, Fc[2] = d, Mc(Fc, i), c = Fc[0], u = Fc[1], d = Fc[2]), a(c, u, d, 1, Fc), t.data[s] = Fc[0] ** Oc * 255 | 0, t.data[s + 1] = Fc[1] ** Oc * 255 | 0, t.data[s + 2] = Fc[2] ** Oc * 255 | 0, o) {
11752
- let e = (s >> 2) % n.width, r = (s >> 2) / n.width | 0;
11753
- t.data[s + 3] = o[(n.y + r) * l + n.x + e];
12034
+ let c = e[s] * r, d = e[s + 1] * r, f = e[s + 2] * r;
12035
+ if (i !== 1 && (Wc[0] = c, Wc[1] = d, Wc[2] = f, Vc(Wc, i), c = Wc[0], d = Wc[1], f = Wc[2]), a(c, d, f, 1, Wc), t.data[s] = Wc[0] ** Lc * 255 | 0, t.data[s + 1] = Wc[1] ** Lc * 255 | 0, t.data[s + 2] = Wc[2] ** Lc * 255 | 0, l) {
12036
+ let e = (s >> 2) % o, r = (s >> 2) / o | 0;
12037
+ t.data[s + 3] = l[(n.y + r) * u + n.x + e];
11754
12038
  } else t.data[s + 3] = 255;
11755
12039
  }
11756
- s.unmap(), s.destroy(), this.ctx.putImageData(t, n.x, n.y);
12040
+ d.unmap(), d.destroy(), this.ctx.putImageData(t, n.x, n.y);
11757
12041
  });
11758
12042
  }
11759
12043
  });
@@ -11771,10 +12055,10 @@ var Fc = new Float32Array(3), Ic = {
11771
12055
  usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST
11772
12056
  }), o = r.createCommandEncoder({ label: "oidn-readback" });
11773
12057
  o.copyBufferToBuffer(e, 0, a, 0, i), r.queue.submit([o.finish()]), await a.mapAsync(GPUMapMode.READ);
11774
- let s = new Float32Array(a.getMappedRange()), l = new ImageData(t, n), u = this.getExposure(), d = this.getSaturation(), f = Dc.get(this.getToneMapping()) || Dc.get(c), p = this._cachedAlpha;
12058
+ let s = new Float32Array(a.getMappedRange()), l = new ImageData(t, n), u = this.getExposure(), d = this.getSaturation(), f = Ic.get(this.getToneMapping()) || Ic.get(c), p = this._cachedAlpha;
11775
12059
  for (let e = 0, t = s.length; e < t; e += 4) {
11776
12060
  let t = s[e] * u, n = s[e + 1] * u, r = s[e + 2] * u;
11777
- d !== 1 && (Fc[0] = t, Fc[1] = n, Fc[2] = r, Mc(Fc, d), t = Fc[0], n = Fc[1], r = Fc[2]), f(t, n, r, 1, Fc), l.data[e] = Fc[0] ** Oc * 255 | 0, l.data[e + 1] = Fc[1] ** Oc * 255 | 0, l.data[e + 2] = Fc[2] ** Oc * 255 | 0, l.data[e + 3] = p ? p[e >> 2] : 255;
12061
+ d !== 1 && (Wc[0] = t, Wc[1] = n, Wc[2] = r, Vc(Wc, d), t = Wc[0], n = Wc[1], r = Wc[2]), f(t, n, r, 1, Wc), l.data[e] = Wc[0] ** Lc * 255 | 0, l.data[e + 1] = Wc[1] ** Lc * 255 | 0, l.data[e + 2] = Wc[2] ** Lc * 255 | 0, l.data[e + 3] = p ? p[e >> 2] : 255;
11778
12062
  }
11779
12063
  a.unmap(), a.destroy(), this.ctx.putImageData(l, 0, 0);
11780
12064
  }
@@ -11819,19 +12103,19 @@ var Fc = new Float32Array(3), Ic = {
11819
12103
  dispose() {
11820
12104
  this.abort(), 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");
11821
12105
  }
11822
- }, Rc = "https://huggingface.co/notaneimu/onnx-image-models/resolve/main/", zc = {
12106
+ }, qc = "https://huggingface.co/notaneimu/onnx-image-models/resolve/main/", Jc = {
11823
12107
  QUALITY_PRESETS: {
11824
12108
  fast: {
11825
- 2: Rc + "2x-spanx2-ch48.onnx",
11826
- 4: Rc + "4xNomos8k_span_otf_strong_fp32_opset17.onnx"
12109
+ 2: qc + "2x-spanx2-ch48.onnx",
12110
+ 4: qc + "4xNomos8k_span_otf_strong_fp32_opset17.onnx"
11827
12111
  },
11828
12112
  balanced: {
11829
- 2: Rc + "2xNomosUni_compact_otf_medium.onnx",
11830
- 4: Rc + "RealESRGAN_x4plus.onnx"
12113
+ 2: qc + "2xNomosUni_compact_otf_medium.onnx",
12114
+ 4: qc + "RealESRGAN_x4plus.onnx"
11831
12115
  },
11832
12116
  quality: {
11833
- 2: Rc + "2x-realesrgan-x2plus.onnx",
11834
- 4: Rc + "4xNomos2_hq_mosr_fp32.onnx"
12117
+ 2: qc + "2x-realesrgan-x2plus.onnx",
12118
+ 4: qc + "4xNomos2_hq_mosr_fp32.onnx"
11835
12119
  }
11836
12120
  },
11837
12121
  TILE_SIZE: 512,
@@ -11843,17 +12127,17 @@ var Fc = new Float32Array(3), Ic = {
11843
12127
  }],
11844
12128
  graphOptimizationLevel: "all"
11845
12129
  }
11846
- }, Bc = class extends E {
12130
+ }, Yc = class extends E {
11847
12131
  constructor(e, t, n = {}) {
11848
12132
  if (super(), !e || !t) throw Error("AIUpscaler requires output canvas and renderer");
11849
- 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 || (() => c), 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 || zc.TILE_SIZE, this._tileSizeOverride = !!n.tileSize, this.state = {
12133
+ 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 || (() => c), 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 || Jc.TILE_SIZE, this._tileSizeOverride = !!n.tileSize, this.state = {
11850
12134
  isUpscaling: !1,
11851
12135
  isLoading: !1,
11852
12136
  abortController: null
11853
12137
  }, this._worker = null, this._currentModelUrl = null, this._tileId = 0, this._upscaledAlpha = null, this._upscaledAlphaWidth = 0, this._backupCanvas = null, this._baseWidth = e.width, this._baseHeight = e.height;
11854
12138
  }
11855
12139
  async _ensureSession() {
11856
- let e = zc.QUALITY_PRESETS[this.quality];
12140
+ let e = Jc.QUALITY_PRESETS[this.quality];
11857
12141
  if (!e) throw Error(`Unknown quality preset: ${this.quality}`);
11858
12142
  let t = e[this.scaleFactor];
11859
12143
  if (!t) throw Error(`No model for ${this.quality}/${this.scaleFactor}x`);
@@ -11874,7 +12158,7 @@ var Fc = new Float32Array(3), Ic = {
11874
12158
  this._worker.addEventListener("message", r), this._worker.postMessage({
11875
12159
  type: "load",
11876
12160
  url: t,
11877
- sessionOptions: zc.SESSION_OPTIONS
12161
+ sessionOptions: Jc.SESSION_OPTIONS
11878
12162
  });
11879
12163
  }), this._currentModelUrl = t, this.dispatchEvent({ type: "loaded" });
11880
12164
  } catch (e) {
@@ -11941,8 +12225,8 @@ var Fc = new Float32Array(3), Ic = {
11941
12225
  willReadFrequently: !0,
11942
12226
  alpha: !0
11943
12227
  });
11944
- this._cacheUpscaledAlpha(t, n * i, r * i), t.isHDR && (this._hdrToneMapFn = Dc.get(this.getToneMapping()) || Dc.get(c), this._hdrExposure = this.getExposure(), this._hdrSaturation = this.getSaturation(), this._tmOut = new Float32Array(3));
11945
- let o = zc.TILE_OVERLAP, s = this.tileSize, l = s - o * 2, u = Math.ceil(n / l), d = Math.ceil(r / l), f = u * d, p = 0;
12228
+ this._cacheUpscaledAlpha(t, n * i, r * i), t.isHDR && (this._hdrToneMapFn = Ic.get(this.getToneMapping()) || Ic.get(c), this._hdrExposure = this.getExposure(), this._hdrSaturation = this.getSaturation(), this._tmOut = new Float32Array(3));
12229
+ let o = Jc.TILE_OVERLAP, s = this.tileSize, l = s - o * 2, u = Math.ceil(n / l), d = Math.ceil(r / l), f = u * d, p = 0;
11946
12230
  for (let o = 0; o < d; o++) for (let c = 0; c < u; c++) {
11947
12231
  if (e.aborted) throw new DOMException("Aborted", "AbortError");
11948
12232
  let u = Math.min(c * l, Math.max(0, n - s)), d = Math.min(o * l, Math.max(0, r - s)), m = Math.min(s, n - u), h = Math.min(s, r - d), g = this._extractTile(t, u, d, m, h), _ = await this._inferTile(g, m, h), v = u * i, y = d * i, b = m * i, x = h * i, S = this._tensorToImageData(_, b, x, v, y);
@@ -12012,7 +12296,7 @@ var Fc = new Float32Array(3), Ic = {
12012
12296
  let u = ((n + e) * o + (t + i)) * 4, d = e * r + i;
12013
12297
  if (s) {
12014
12298
  let e = this._hdrToneMapFn, t = this._hdrExposure, n = this._hdrSaturation, r = a[u] * t, i = a[u + 1] * t, o = a[u + 2] * t;
12015
- n !== 1 && (this._tmOut[0] = r, this._tmOut[1] = i, this._tmOut[2] = o, Mc(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] ** +Oc, l[c + d] = this._tmOut[1] ** +Oc, l[2 * c + d] = this._tmOut[2] ** +Oc;
12299
+ n !== 1 && (this._tmOut[0] = r, this._tmOut[1] = i, this._tmOut[2] = o, Vc(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] ** +Lc, l[c + d] = this._tmOut[1] ** +Lc, l[2 * c + d] = this._tmOut[2] ** +Lc;
12016
12300
  } else l[d] = a[u] / 255, l[c + d] = a[u + 1] / 255, l[2 * c + d] = a[u + 2] / 255;
12017
12301
  }
12018
12302
  return l;
@@ -12070,10 +12354,10 @@ var Fc = new Float32Array(3), Ic = {
12070
12354
  this._backupCanvas = document.createElement("canvas"), this._backupCanvas.width = e.width, this._backupCanvas.height = e.height;
12071
12355
  let t = this._backupCanvas.getContext("2d");
12072
12356
  if (e.isHDR) {
12073
- let { data: n, width: r, height: i } = e, a = t.createImageData(r, i), o = a.data, s = Dc.get(this.getToneMapping()) || Dc.get(c), l = this.getExposure(), u = this.getSaturation(), d = new Float32Array(3);
12357
+ let { data: n, width: r, height: i } = e, a = t.createImageData(r, i), o = a.data, s = Ic.get(this.getToneMapping()) || Ic.get(c), l = this.getExposure(), u = this.getSaturation(), d = new Float32Array(3);
12074
12358
  for (let e = 0, t = r * i; e < t; e++) {
12075
12359
  let t = e * 4, r = n[t] * l, i = n[t + 1] * l, a = n[t + 2] * l;
12076
- u !== 1 && (d[0] = r, d[1] = i, d[2] = a, Mc(d, u), r = d[0], i = d[1], a = d[2]), s(r, i, a, 1, d), o[t] = d[0] ** +Oc * 255 + .5 | 0, o[t + 1] = d[1] ** +Oc * 255 + .5 | 0, o[t + 2] = d[2] ** +Oc * 255 + .5 | 0, o[t + 3] = 255;
12360
+ u !== 1 && (d[0] = r, d[1] = i, d[2] = a, Vc(d, u), r = d[0], i = d[1], a = d[2]), s(r, i, a, 1, d), o[t] = d[0] ** +Lc * 255 + .5 | 0, o[t + 1] = d[1] ** +Lc * 255 + .5 | 0, o[t + 2] = d[2] ** +Lc * 255 + .5 | 0, o[t + 3] = 255;
12077
12361
  }
12078
12362
  t.putImageData(a, 0, 0);
12079
12363
  } else t.putImageData(e, 0, 0);
@@ -12085,7 +12369,7 @@ var Fc = new Float32Array(3), Ic = {
12085
12369
  this.hdr = !!e;
12086
12370
  }
12087
12371
  setQuality(e) {
12088
- if (!zc.QUALITY_PRESETS[e]) {
12372
+ if (!Jc.QUALITY_PRESETS[e]) {
12089
12373
  console.warn(`AIUpscaler: Invalid quality "${e}", must be fast/balanced/quality`);
12090
12374
  return;
12091
12375
  }
@@ -12104,14 +12388,14 @@ var Fc = new Float32Array(3), Ic = {
12104
12388
  async dispose() {
12105
12389
  this.abort(), this._worker &&= (this._worker.postMessage({ type: "dispose" }), this._worker.terminate(), null), this._currentModelUrl = null, this._backupCanvas = null, this._upscaledAlpha = null, this.state.abortController = null, console.log("AIUpscaler disposed");
12106
12390
  }
12107
- }, Vc = class extends E {
12391
+ }, Xc = class extends E {
12108
12392
  constructor({ renderer: e, denoiserCanvas: t, scene: n, camera: r, stages: i, pipeline: a, getExposure: o, getSaturation: s, getTransparentBg: c }) {
12109
12393
  super(), this.renderer = e, this.denoiserCanvas = 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;
12110
12394
  }
12111
12395
  setupDenoiser() {
12112
12396
  if (!this.denoiserCanvas) return;
12113
12397
  let e = this._stages.pathTracer;
12114
- this.denoiser = new Lc(this.denoiserCanvas, this.renderer, this.scene, this.camera, {
12398
+ this.denoiser = new Kc(this.denoiserCanvas, this.renderer, this.scene, this.camera, {
12115
12399
  ...Z,
12116
12400
  backendParams: () => ({
12117
12401
  device: this.renderer.backend.device,
@@ -12136,7 +12420,7 @@ var Fc = new Float32Array(3), Ic = {
12136
12420
  setupUpscaler() {
12137
12421
  if (!this.denoiserCanvas) return;
12138
12422
  let e = this._stages.pathTracer;
12139
- this.upscaler = new Bc(this.denoiserCanvas, this.renderer, {
12423
+ this.upscaler = new Yc(this.denoiserCanvas, this.renderer, {
12140
12424
  scaleFactor: Z.upscalerScale || 2,
12141
12425
  quality: Z.upscalerQuality || "fast",
12142
12426
  getSourceCanvas: () => this.denoiser?.enabled ? null : this.renderer.domElement,
@@ -12224,7 +12508,7 @@ var Fc = new Float32Array(3), Ic = {
12224
12508
  let t = jn[e];
12225
12509
  t && this._stages.asvgf?.updateParameters(t);
12226
12510
  }
12227
- }, Hc = class {
12511
+ }, Zc = class {
12228
12512
  constructor(e, t) {
12229
12513
  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;
12230
12514
  }
@@ -12290,7 +12574,7 @@ var Fc = new Float32Array(3), Ic = {
12290
12574
  for (let e of this._helpers.values()) e.dispose?.();
12291
12575
  this._helpers.clear(), this._hudCanvas.parentElement && this._hudCanvas.parentElement.removeChild(this._hudCanvas);
12292
12576
  }
12293
- }, Uc = class {
12577
+ }, Qc = class {
12294
12578
  constructor() {
12295
12579
  this.mixer = null, this.timer = new Ne(), this.actions = [], this.isPlaying = !1, this._scene = null, this._mixerRoot = null, this._meshes = null, this._meshTriRanges = null, this._posBuffer = null, this._tempVec = new Le(), this._skinnedCache = null, this._totalTriangleCount = 0, this._clipsCache = null, this._savedTimeScale = 1, this.onFinished = null;
12296
12580
  }
@@ -12390,7 +12674,7 @@ var Fc = new Float32Array(3), Ic = {
12390
12674
  dispose() {
12391
12675
  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;
12392
12676
  }
12393
- }, Wc = class {
12677
+ }, $c = class {
12394
12678
  constructor({ camera: e, canvas: t, orbitControls: n, app: r }) {
12395
12679
  this._app = r, this._orbitControls = n, this._camera = e, this._controls = new Lt(e, t), this._gizmoScene = new Oe(), 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 Le(), this._normalMatrix = new oe(), 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);
12396
12680
  }
@@ -12498,7 +12782,7 @@ var Fc = new Float32Array(3), Ic = {
12498
12782
  dispose() {
12499
12783
  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;
12500
12784
  }
12501
- }, Gc = class {
12785
+ }, el = class {
12502
12786
  constructor() {
12503
12787
  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;
12504
12788
  }
@@ -12522,7 +12806,7 @@ var Fc = new Float32Array(3), Ic = {
12522
12806
  dispose() {
12523
12807
  this.visible = !1;
12524
12808
  }
12525
- }, Kc = class {
12809
+ }, tl = class {
12526
12810
  constructor(n, r, i) {
12527
12811
  this.layer = "scene", this.visible = !0, this._outlineNode = Rt(r, i, {
12528
12812
  selectedObjects: [],
@@ -12556,9 +12840,9 @@ var Fc = new Float32Array(3), Ic = {
12556
12840
  dispose() {
12557
12841
  this.visible = !1, this._outlineNode?.dispose(), this._material?.dispose(), this._quad?.dispose();
12558
12842
  }
12559
- }, qc = class extends E {
12843
+ }, nl = class extends E {
12560
12844
  constructor(e, t = {}) {
12561
- super(), this.canvas = e, this.denoiserCanvas = null, this._autoResize = t.autoResize !== !1, this._statsContainer = t.statsContainer || null, this.settings = new gc(Z), this.renderer = null, this._camera = null, this.scene = null, this.meshScene = null, this._sceneHelpers = null, this._controls = null, this.assetLoader = null, this._sdf = null, this.animationManager = new Uc(), this._animRefitInFlight = !1, this.pipeline = null, this.stages = {}, this.cameraManager = null, this.lightManager = null, this.denoisingManager = null, this.overlayManager = null, this.isInitialized = !1, this.pauseRendering = !1, this.pathTracerEnabled = !0, this.animationId = null, this.needsReset = !1, this._renderCompleteDispatched = !1, this._loadingInProgress = !1, this._needsDisplayRefresh = !1, this._paused = !1, this.lastResetTime = performance.now(), this.timeElapsed = 0, this._lastRenderWidth = 0, this._lastRenderHeight = 0, this._resizeDebounceTimer = null;
12845
+ super(), this.canvas = e, this.denoiserCanvas = null, this._autoResize = t.autoResize !== !1, this._statsContainer = t.statsContainer || null, this.settings = new Tc(Z), this.renderer = null, this._camera = null, this.scene = null, this.meshScene = null, this._sceneHelpers = null, this._controls = null, this.assetLoader = null, this._sdf = null, this.animationManager = new Qc(), this._animRefitInFlight = !1, this.pipeline = null, this.stages = {}, this.cameraManager = null, this.lightManager = null, this.denoisingManager = null, this.overlayManager = null, this.isInitialized = !1, this.pauseRendering = !1, this.pathTracerEnabled = !0, this.animationId = null, this.needsReset = !1, this._renderCompleteDispatched = !1, this._loadingInProgress = !1, this._needsDisplayRefresh = !1, this._paused = !1, this.lastResetTime = performance.now(), this.timeElapsed = 0, this._lastRenderWidth = 0, this._lastRenderHeight = 0, this._resizeDebounceTimer = null, this._outputAPI = null, this._lightsAPI = null, this._animationAPI = null, this._selectionAPI = null, this._transformAPI = null, this._cameraAPI = null, this._environmentAPI = null, this._materialsAPI = null, this._denoisingAPI = null;
12562
12846
  }
12563
12847
  set(e, t, n) {
12564
12848
  this.settings.set(e, t, n);
@@ -12572,6 +12856,33 @@ var Fc = new Float32Array(3), Ic = {
12572
12856
  getAll() {
12573
12857
  return this.settings.getAll();
12574
12858
  }
12859
+ get output() {
12860
+ return this._outputAPI ||= new mc(this), this._outputAPI;
12861
+ }
12862
+ get lights() {
12863
+ return this._lightsAPI ||= new hc(this), this._lightsAPI;
12864
+ }
12865
+ get animation() {
12866
+ return this._animationAPI ||= new gc(this), this._animationAPI;
12867
+ }
12868
+ get selection() {
12869
+ return this._selectionAPI ||= new _c(this), this._selectionAPI;
12870
+ }
12871
+ get transform() {
12872
+ return this._transformAPI ||= new vc(this), this._transformAPI;
12873
+ }
12874
+ get camera() {
12875
+ return this._cameraAPI ||= new yc(this), this._cameraAPI;
12876
+ }
12877
+ get environment() {
12878
+ return this._environmentAPI ||= new bc(this), this._environmentAPI;
12879
+ }
12880
+ get materials() {
12881
+ return this._materialsAPI ||= new xc(this), this._materialsAPI;
12882
+ }
12883
+ get denoising() {
12884
+ return this._denoisingAPI ||= new Sc(this), this._denoisingAPI;
12885
+ }
12575
12886
  async init() {
12576
12887
  if (_n((e) => this.dispatchEvent(e)), !navigator.gpu) throw Error("WebGPU is not supported in this browser");
12577
12888
  let e = await navigator.gpu.requestAdapter({ powerPreference: "high-performance" });
@@ -12601,7 +12912,7 @@ var Fc = new Float32Array(3), Ic = {
12601
12912
  assetLoader: this.assetLoader,
12602
12913
  pathTracer: null,
12603
12914
  floorPlane: this._floorPlane
12604
- }), this._setupInteractionListeners(), this.cameraManager = new _c(this._camera, this._controls, this._interactionManager), this.lightManager = new vc(this.scene, this._sceneHelpers, this.stages.pathTracer), this._createDenoiserCanvas(), this._setupDenoisingManager(), this._setupOverlayManager(), this._transformManager = new Wc({
12915
+ }), this._setupInteractionListeners(), this.cameraManager = new Ec(this._camera, this._controls, this._interactionManager), this.lightManager = new Dc(this.scene, this._sceneHelpers, this.stages.pathTracer), this._createDenoiserCanvas(), this._setupDenoisingManager(), this._setupOverlayManager(), this._transformManager = new $c({
12605
12916
  camera: this._camera,
12606
12917
  canvas: this.canvas,
12607
12918
  orbitControls: this._controls,
@@ -12982,12 +13293,9 @@ var Fc = new Float32Array(3), Ic = {
12982
13293
  getFrameCount() {
12983
13294
  return this.stages.pathTracer?.frameCount || 0;
12984
13295
  }
12985
- get camera() {
13296
+ get activeCamera() {
12986
13297
  return this.cameraManager?.camera ?? this._camera;
12987
13298
  }
12988
- get controls() {
12989
- return this.cameraManager?.controls ?? this._controls;
12990
- }
12991
13299
  getSceneStatistics() {
12992
13300
  try {
12993
13301
  return this._sdf?.getStatistics?.() ?? null;
@@ -13143,7 +13451,7 @@ var Fc = new Float32Array(3), Ic = {
13143
13451
  t.width = this.canvas.width, t.height = this.canvas.height, t.style.width = `${this.canvas.clientWidth}px`, t.style.height = `${this.canvas.clientHeight}px`, e.insertBefore(t, this.canvas), this.denoiserCanvas = t;
13144
13452
  }
13145
13453
  _setupDenoisingManager() {
13146
- this.denoisingManager = new Vc({
13454
+ this.denoisingManager = new Xc({
13147
13455
  renderer: this.renderer,
13148
13456
  denoiserCanvas: this.denoiserCanvas,
13149
13457
  scene: this.scene,
@@ -13282,14 +13590,14 @@ var Fc = new Float32Array(3), Ic = {
13282
13590
  this.scene.updateMatrixWorld(), this.overlayManager?.render(), this._transformManager?.render(this.renderer);
13283
13591
  }
13284
13592
  _setupOverlayManager() {
13285
- this.overlayManager = new Hc(this.renderer, this._camera), this.overlayManager.setHelperScene(this._sceneHelpers);
13286
- let e = new Gc();
13593
+ this.overlayManager = new Zc(this.renderer, this._camera), this.overlayManager.setHelperScene(this._sceneHelpers);
13594
+ let e = new el();
13287
13595
  this.overlayManager.register("tiles", e), e.setRenderSize(this._lastRenderWidth || 1, this._lastRenderHeight || 1), this.addEventListener("resolution_changed", (t) => {
13288
13596
  e.setRenderSize(t.width, t.height);
13289
13597
  }), this.pipeline.eventBus.on("tile:changed", (t) => {
13290
13598
  t.renderMode === 1 && t.tileBounds && (e.setActiveTile(t.tileBounds), e.show());
13291
13599
  }), this.pipeline.eventBus.on("pipeline:reset", () => e.hide()), this.addEventListener(hn.RENDER_COMPLETE, () => e.hide()), this._setupDenoiserTileHelper(e);
13292
- let t = new Kc(this.renderer, this.meshScene, this._camera);
13600
+ let t = new tl(this.renderer, this.meshScene, this._camera);
13293
13601
  this.overlayManager.register("outline", t);
13294
13602
  }
13295
13603
  _setupDenoiserTileHelper(e) {
@@ -13306,7 +13614,7 @@ var Fc = new Float32Array(3), Ic = {
13306
13614
  _forwardEvents(e, t) {
13307
13615
  if (e) for (let n of t) e.addEventListener(n, (e) => this.dispatchEvent(e));
13308
13616
  }
13309
- }, Jc = class {
13617
+ }, rl = class {
13310
13618
  constructor(e) {
13311
13619
  this._app = e, this._cancelled = !1, this._rendering = !1;
13312
13620
  }
@@ -13406,6 +13714,6 @@ var Fc = new Float32Array(3), Ic = {
13406
13714
  }
13407
13715
  };
13408
13716
  //#endregion
13409
- export { In as AF_DEFAULTS, jn as ASVGF_QUALITY_PRESETS, Fn as AUTO_FOCUS_MODES, Uc as AnimationManager, Ln as BVH_LEAF_MARKERS, Pn as CAMERA_PRESETS, Mn as CAMERA_RANGES, _c as CameraManager, zn as DEFAULT_TEXTURE_MATRIX, Vc as DenoisingManager, Z as ENGINE_DEFAULTS, hn as EngineEvents, Bn as FINAL_RENDER_CONFIG, vc as LightManager, Hn as MEMORY_CONSTANTS, Hc as OverlayManager, Vn as PREVIEW_RENDER_CONFIG, qc as PathTracerApp, cc as PipelineContext, uc as RenderPipeline, gc as RenderSettings, fn as RenderStage, Nn as SKY_PRESETS, dn as StageExecutionMode, Rn as TEXTURE_CONSTANTS, Q as TRIANGLE_DATA_LAYOUT, Wc as TransformManager, Jc as VideoRenderManager };
13717
+ export { In as AF_DEFAULTS, jn as ASVGF_QUALITY_PRESETS, Fn as AUTO_FOCUS_MODES, gc as AnimationAPI, Qc as AnimationManager, Ln as BVH_LEAF_MARKERS, Pn as CAMERA_PRESETS, Mn as CAMERA_RANGES, yc as CameraAPI, Ec as CameraManager, zn as DEFAULT_TEXTURE_MATRIX, Sc as DenoisingAPI, Xc as DenoisingManager, Z as ENGINE_DEFAULTS, hn as EngineEvents, bc as EnvironmentAPI, Bn as FINAL_RENDER_CONFIG, Dc as LightManager, hc as LightsAPI, Hn as MEMORY_CONSTANTS, xc as MaterialsAPI, mc as OutputAPI, Zc as OverlayManager, Vn as PREVIEW_RENDER_CONFIG, nl as PathTracerApp, cc as PipelineContext, uc as RenderPipeline, Tc as RenderSettings, fn as RenderStage, Nn as SKY_PRESETS, _c as SelectionAPI, dn as StageExecutionMode, Rn as TEXTURE_CONSTANTS, Q as TRIANGLE_DATA_LAYOUT, vc as TransformAPI, $c as TransformManager, rl as VideoRenderManager };
13410
13718
 
13411
13719
  //# sourceMappingURL=rayzee.es.js.map