rayzee 4.8.10 → 4.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +160 -74
- package/dist/rayzee.es.js +368 -86
- 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/PathTracerApp.js +179 -27
- package/src/api/AnimationAPI.js +87 -0
- package/src/api/CameraAPI.js +109 -0
- package/src/api/DenoisingAPI.js +243 -0
- package/src/api/EnvironmentAPI.js +106 -0
- package/src/api/LightsAPI.js +80 -0
- package/src/api/MaterialsAPI.js +73 -0
- package/src/api/OutputAPI.js +90 -0
- package/src/api/SelectionAPI.js +89 -0
- package/src/api/TransformAPI.js +49 -0
- package/src/api/index.js +16 -0
- package/src/index.js +13 -0
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
|
-
},
|
|
11415
|
+
}, wc = {
|
|
11158
11416
|
bounces: "maxBounces",
|
|
11159
11417
|
adaptiveSampling: "useAdaptiveSampling",
|
|
11160
11418
|
debugMode: "visMode"
|
|
11161
|
-
},
|
|
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 =
|
|
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 =
|
|
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 =
|
|
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(
|
|
11213
|
-
for (let [t, n] of Object.entries(
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
11432
|
-
function
|
|
11433
|
-
i[0] =
|
|
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
|
|
11436
|
-
i[0] =
|
|
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
|
|
11439
|
-
e *= r, t *= r, n *= r, i[0] =
|
|
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
|
|
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
|
|
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] =
|
|
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
|
|
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 =
|
|
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] =
|
|
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
|
|
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
|
|
11479
|
-
[me,
|
|
11480
|
-
[te,
|
|
11481
|
-
[Te,
|
|
11482
|
-
[h,
|
|
11483
|
-
[c,
|
|
11484
|
-
[u,
|
|
11485
|
-
[fe,
|
|
11486
|
-
]),
|
|
11487
|
-
function
|
|
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] *
|
|
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
|
|
11495
|
-
async function
|
|
11496
|
-
return
|
|
11752
|
+
var Hc = null;
|
|
11753
|
+
async function Uc() {
|
|
11754
|
+
return Hc ||= (await import("oidn-web")).initUNetFromURL, Hc;
|
|
11497
11755
|
}
|
|
11498
|
-
var
|
|
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
|
-
},
|
|
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
|
-
...
|
|
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
|
|
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 } =
|
|
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(
|
|
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() {
|
|
@@ -11745,10 +12003,10 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
11745
12003
|
l.copyBufferToBuffer(e.data, r, s, o, a);
|
|
11746
12004
|
}
|
|
11747
12005
|
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 =
|
|
12006
|
+
let e = new Float32Array(s.getMappedRange()), t = new ImageData(n.width, n.height), r = this.getExposure(), i = this.getSaturation(), a = Ic.get(this.getToneMapping()) || Ic.get(c), o = this._cachedAlpha, l = this._cachedAlphaWidth;
|
|
11749
12007
|
for (let s = 0, c = e.length; s < c; s += 4) {
|
|
11750
12008
|
let c = e[s] * r, u = e[s + 1] * r, d = e[s + 2] * r;
|
|
11751
|
-
if (i !== 1 && (
|
|
12009
|
+
if (i !== 1 && (Wc[0] = c, Wc[1] = u, Wc[2] = d, Vc(Wc, i), c = Wc[0], u = Wc[1], d = Wc[2]), a(c, u, d, 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, o) {
|
|
11752
12010
|
let e = (s >> 2) % n.width, r = (s >> 2) / n.width | 0;
|
|
11753
12011
|
t.data[s + 3] = o[(n.y + r) * l + n.x + e];
|
|
11754
12012
|
} else t.data[s + 3] = 255;
|
|
@@ -11771,10 +12029,10 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
11771
12029
|
usage: GPUBufferUsage.MAP_READ | GPUBufferUsage.COPY_DST
|
|
11772
12030
|
}), o = r.createCommandEncoder({ label: "oidn-readback" });
|
|
11773
12031
|
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 =
|
|
12032
|
+
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
12033
|
for (let e = 0, t = s.length; e < t; e += 4) {
|
|
11776
12034
|
let t = s[e] * u, n = s[e + 1] * u, r = s[e + 2] * u;
|
|
11777
|
-
d !== 1 && (
|
|
12035
|
+
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
12036
|
}
|
|
11779
12037
|
a.unmap(), a.destroy(), this.ctx.putImageData(l, 0, 0);
|
|
11780
12038
|
}
|
|
@@ -11819,19 +12077,19 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
11819
12077
|
dispose() {
|
|
11820
12078
|
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
12079
|
}
|
|
11822
|
-
},
|
|
12080
|
+
}, qc = "https://huggingface.co/notaneimu/onnx-image-models/resolve/main/", Jc = {
|
|
11823
12081
|
QUALITY_PRESETS: {
|
|
11824
12082
|
fast: {
|
|
11825
|
-
2:
|
|
11826
|
-
4:
|
|
12083
|
+
2: qc + "2x-spanx2-ch48.onnx",
|
|
12084
|
+
4: qc + "4xNomos8k_span_otf_strong_fp32_opset17.onnx"
|
|
11827
12085
|
},
|
|
11828
12086
|
balanced: {
|
|
11829
|
-
2:
|
|
11830
|
-
4:
|
|
12087
|
+
2: qc + "2xNomosUni_compact_otf_medium.onnx",
|
|
12088
|
+
4: qc + "RealESRGAN_x4plus.onnx"
|
|
11831
12089
|
},
|
|
11832
12090
|
quality: {
|
|
11833
|
-
2:
|
|
11834
|
-
4:
|
|
12091
|
+
2: qc + "2x-realesrgan-x2plus.onnx",
|
|
12092
|
+
4: qc + "4xNomos2_hq_mosr_fp32.onnx"
|
|
11835
12093
|
}
|
|
11836
12094
|
},
|
|
11837
12095
|
TILE_SIZE: 512,
|
|
@@ -11843,17 +12101,17 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
11843
12101
|
}],
|
|
11844
12102
|
graphOptimizationLevel: "all"
|
|
11845
12103
|
}
|
|
11846
|
-
},
|
|
12104
|
+
}, Yc = class extends E {
|
|
11847
12105
|
constructor(e, t, n = {}) {
|
|
11848
12106
|
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 ||
|
|
12107
|
+
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
12108
|
isUpscaling: !1,
|
|
11851
12109
|
isLoading: !1,
|
|
11852
12110
|
abortController: null
|
|
11853
12111
|
}, 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
12112
|
}
|
|
11855
12113
|
async _ensureSession() {
|
|
11856
|
-
let e =
|
|
12114
|
+
let e = Jc.QUALITY_PRESETS[this.quality];
|
|
11857
12115
|
if (!e) throw Error(`Unknown quality preset: ${this.quality}`);
|
|
11858
12116
|
let t = e[this.scaleFactor];
|
|
11859
12117
|
if (!t) throw Error(`No model for ${this.quality}/${this.scaleFactor}x`);
|
|
@@ -11874,7 +12132,7 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
11874
12132
|
this._worker.addEventListener("message", r), this._worker.postMessage({
|
|
11875
12133
|
type: "load",
|
|
11876
12134
|
url: t,
|
|
11877
|
-
sessionOptions:
|
|
12135
|
+
sessionOptions: Jc.SESSION_OPTIONS
|
|
11878
12136
|
});
|
|
11879
12137
|
}), this._currentModelUrl = t, this.dispatchEvent({ type: "loaded" });
|
|
11880
12138
|
} catch (e) {
|
|
@@ -11941,8 +12199,8 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
11941
12199
|
willReadFrequently: !0,
|
|
11942
12200
|
alpha: !0
|
|
11943
12201
|
});
|
|
11944
|
-
this._cacheUpscaledAlpha(t, n * i, r * i), t.isHDR && (this._hdrToneMapFn =
|
|
11945
|
-
let o =
|
|
12202
|
+
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));
|
|
12203
|
+
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
12204
|
for (let o = 0; o < d; o++) for (let c = 0; c < u; c++) {
|
|
11947
12205
|
if (e.aborted) throw new DOMException("Aborted", "AbortError");
|
|
11948
12206
|
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 +12270,7 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
12012
12270
|
let u = ((n + e) * o + (t + i)) * 4, d = e * r + i;
|
|
12013
12271
|
if (s) {
|
|
12014
12272
|
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,
|
|
12273
|
+
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
12274
|
} else l[d] = a[u] / 255, l[c + d] = a[u + 1] / 255, l[2 * c + d] = a[u + 2] / 255;
|
|
12017
12275
|
}
|
|
12018
12276
|
return l;
|
|
@@ -12070,10 +12328,10 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
12070
12328
|
this._backupCanvas = document.createElement("canvas"), this._backupCanvas.width = e.width, this._backupCanvas.height = e.height;
|
|
12071
12329
|
let t = this._backupCanvas.getContext("2d");
|
|
12072
12330
|
if (e.isHDR) {
|
|
12073
|
-
let { data: n, width: r, height: i } = e, a = t.createImageData(r, i), o = a.data, s =
|
|
12331
|
+
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
12332
|
for (let e = 0, t = r * i; e < t; e++) {
|
|
12075
12333
|
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,
|
|
12334
|
+
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
12335
|
}
|
|
12078
12336
|
t.putImageData(a, 0, 0);
|
|
12079
12337
|
} else t.putImageData(e, 0, 0);
|
|
@@ -12085,7 +12343,7 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
12085
12343
|
this.hdr = !!e;
|
|
12086
12344
|
}
|
|
12087
12345
|
setQuality(e) {
|
|
12088
|
-
if (!
|
|
12346
|
+
if (!Jc.QUALITY_PRESETS[e]) {
|
|
12089
12347
|
console.warn(`AIUpscaler: Invalid quality "${e}", must be fast/balanced/quality`);
|
|
12090
12348
|
return;
|
|
12091
12349
|
}
|
|
@@ -12104,14 +12362,14 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
12104
12362
|
async dispose() {
|
|
12105
12363
|
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
12364
|
}
|
|
12107
|
-
},
|
|
12365
|
+
}, Xc = class extends E {
|
|
12108
12366
|
constructor({ renderer: e, denoiserCanvas: t, scene: n, camera: r, stages: i, pipeline: a, getExposure: o, getSaturation: s, getTransparentBg: c }) {
|
|
12109
12367
|
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
12368
|
}
|
|
12111
12369
|
setupDenoiser() {
|
|
12112
12370
|
if (!this.denoiserCanvas) return;
|
|
12113
12371
|
let e = this._stages.pathTracer;
|
|
12114
|
-
this.denoiser = new
|
|
12372
|
+
this.denoiser = new Kc(this.denoiserCanvas, this.renderer, this.scene, this.camera, {
|
|
12115
12373
|
...Z,
|
|
12116
12374
|
backendParams: () => ({
|
|
12117
12375
|
device: this.renderer.backend.device,
|
|
@@ -12136,7 +12394,7 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
12136
12394
|
setupUpscaler() {
|
|
12137
12395
|
if (!this.denoiserCanvas) return;
|
|
12138
12396
|
let e = this._stages.pathTracer;
|
|
12139
|
-
this.upscaler = new
|
|
12397
|
+
this.upscaler = new Yc(this.denoiserCanvas, this.renderer, {
|
|
12140
12398
|
scaleFactor: Z.upscalerScale || 2,
|
|
12141
12399
|
quality: Z.upscalerQuality || "fast",
|
|
12142
12400
|
getSourceCanvas: () => this.denoiser?.enabled ? null : this.renderer.domElement,
|
|
@@ -12224,7 +12482,7 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
12224
12482
|
let t = jn[e];
|
|
12225
12483
|
t && this._stages.asvgf?.updateParameters(t);
|
|
12226
12484
|
}
|
|
12227
|
-
},
|
|
12485
|
+
}, Zc = class {
|
|
12228
12486
|
constructor(e, t) {
|
|
12229
12487
|
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
12488
|
}
|
|
@@ -12290,7 +12548,7 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
12290
12548
|
for (let e of this._helpers.values()) e.dispose?.();
|
|
12291
12549
|
this._helpers.clear(), this._hudCanvas.parentElement && this._hudCanvas.parentElement.removeChild(this._hudCanvas);
|
|
12292
12550
|
}
|
|
12293
|
-
},
|
|
12551
|
+
}, Qc = class {
|
|
12294
12552
|
constructor() {
|
|
12295
12553
|
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
12554
|
}
|
|
@@ -12390,7 +12648,7 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
12390
12648
|
dispose() {
|
|
12391
12649
|
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
12650
|
}
|
|
12393
|
-
},
|
|
12651
|
+
}, $c = class {
|
|
12394
12652
|
constructor({ camera: e, canvas: t, orbitControls: n, app: r }) {
|
|
12395
12653
|
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
12654
|
}
|
|
@@ -12498,7 +12756,7 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
12498
12756
|
dispose() {
|
|
12499
12757
|
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
12758
|
}
|
|
12501
|
-
},
|
|
12759
|
+
}, el = class {
|
|
12502
12760
|
constructor() {
|
|
12503
12761
|
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
12762
|
}
|
|
@@ -12522,7 +12780,7 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
12522
12780
|
dispose() {
|
|
12523
12781
|
this.visible = !1;
|
|
12524
12782
|
}
|
|
12525
|
-
},
|
|
12783
|
+
}, tl = class {
|
|
12526
12784
|
constructor(n, r, i) {
|
|
12527
12785
|
this.layer = "scene", this.visible = !0, this._outlineNode = Rt(r, i, {
|
|
12528
12786
|
selectedObjects: [],
|
|
@@ -12556,9 +12814,9 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
12556
12814
|
dispose() {
|
|
12557
12815
|
this.visible = !1, this._outlineNode?.dispose(), this._material?.dispose(), this._quad?.dispose();
|
|
12558
12816
|
}
|
|
12559
|
-
},
|
|
12817
|
+
}, nl = class extends E {
|
|
12560
12818
|
constructor(e, t = {}) {
|
|
12561
|
-
super(), this.canvas = e, this.denoiserCanvas = null, this._autoResize = t.autoResize !== !1, this._statsContainer = t.statsContainer || null, this.settings = new
|
|
12819
|
+
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
12820
|
}
|
|
12563
12821
|
set(e, t, n) {
|
|
12564
12822
|
this.settings.set(e, t, n);
|
|
@@ -12572,6 +12830,33 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
12572
12830
|
getAll() {
|
|
12573
12831
|
return this.settings.getAll();
|
|
12574
12832
|
}
|
|
12833
|
+
get output() {
|
|
12834
|
+
return this._outputAPI ||= new mc(this), this._outputAPI;
|
|
12835
|
+
}
|
|
12836
|
+
get lights() {
|
|
12837
|
+
return this._lightsAPI ||= new hc(this), this._lightsAPI;
|
|
12838
|
+
}
|
|
12839
|
+
get animation() {
|
|
12840
|
+
return this._animationAPI ||= new gc(this), this._animationAPI;
|
|
12841
|
+
}
|
|
12842
|
+
get selection() {
|
|
12843
|
+
return this._selectionAPI ||= new _c(this), this._selectionAPI;
|
|
12844
|
+
}
|
|
12845
|
+
get transform() {
|
|
12846
|
+
return this._transformAPI ||= new vc(this), this._transformAPI;
|
|
12847
|
+
}
|
|
12848
|
+
get camera() {
|
|
12849
|
+
return this._cameraAPI ||= new yc(this), this._cameraAPI;
|
|
12850
|
+
}
|
|
12851
|
+
get environment() {
|
|
12852
|
+
return this._environmentAPI ||= new bc(this), this._environmentAPI;
|
|
12853
|
+
}
|
|
12854
|
+
get materials() {
|
|
12855
|
+
return this._materialsAPI ||= new xc(this), this._materialsAPI;
|
|
12856
|
+
}
|
|
12857
|
+
get denoising() {
|
|
12858
|
+
return this._denoisingAPI ||= new Sc(this), this._denoisingAPI;
|
|
12859
|
+
}
|
|
12575
12860
|
async init() {
|
|
12576
12861
|
if (_n((e) => this.dispatchEvent(e)), !navigator.gpu) throw Error("WebGPU is not supported in this browser");
|
|
12577
12862
|
let e = await navigator.gpu.requestAdapter({ powerPreference: "high-performance" });
|
|
@@ -12601,7 +12886,7 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
12601
12886
|
assetLoader: this.assetLoader,
|
|
12602
12887
|
pathTracer: null,
|
|
12603
12888
|
floorPlane: this._floorPlane
|
|
12604
|
-
}), this._setupInteractionListeners(), this.cameraManager = new
|
|
12889
|
+
}), 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
12890
|
camera: this._camera,
|
|
12606
12891
|
canvas: this.canvas,
|
|
12607
12892
|
orbitControls: this._controls,
|
|
@@ -12982,12 +13267,9 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
12982
13267
|
getFrameCount() {
|
|
12983
13268
|
return this.stages.pathTracer?.frameCount || 0;
|
|
12984
13269
|
}
|
|
12985
|
-
get
|
|
13270
|
+
get activeCamera() {
|
|
12986
13271
|
return this.cameraManager?.camera ?? this._camera;
|
|
12987
13272
|
}
|
|
12988
|
-
get controls() {
|
|
12989
|
-
return this.cameraManager?.controls ?? this._controls;
|
|
12990
|
-
}
|
|
12991
13273
|
getSceneStatistics() {
|
|
12992
13274
|
try {
|
|
12993
13275
|
return this._sdf?.getStatistics?.() ?? null;
|
|
@@ -13143,7 +13425,7 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
13143
13425
|
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
13426
|
}
|
|
13145
13427
|
_setupDenoisingManager() {
|
|
13146
|
-
this.denoisingManager = new
|
|
13428
|
+
this.denoisingManager = new Xc({
|
|
13147
13429
|
renderer: this.renderer,
|
|
13148
13430
|
denoiserCanvas: this.denoiserCanvas,
|
|
13149
13431
|
scene: this.scene,
|
|
@@ -13282,14 +13564,14 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
13282
13564
|
this.scene.updateMatrixWorld(), this.overlayManager?.render(), this._transformManager?.render(this.renderer);
|
|
13283
13565
|
}
|
|
13284
13566
|
_setupOverlayManager() {
|
|
13285
|
-
this.overlayManager = new
|
|
13286
|
-
let e = new
|
|
13567
|
+
this.overlayManager = new Zc(this.renderer, this._camera), this.overlayManager.setHelperScene(this._sceneHelpers);
|
|
13568
|
+
let e = new el();
|
|
13287
13569
|
this.overlayManager.register("tiles", e), e.setRenderSize(this._lastRenderWidth || 1, this._lastRenderHeight || 1), this.addEventListener("resolution_changed", (t) => {
|
|
13288
13570
|
e.setRenderSize(t.width, t.height);
|
|
13289
13571
|
}), this.pipeline.eventBus.on("tile:changed", (t) => {
|
|
13290
13572
|
t.renderMode === 1 && t.tileBounds && (e.setActiveTile(t.tileBounds), e.show());
|
|
13291
13573
|
}), this.pipeline.eventBus.on("pipeline:reset", () => e.hide()), this.addEventListener(hn.RENDER_COMPLETE, () => e.hide()), this._setupDenoiserTileHelper(e);
|
|
13292
|
-
let t = new
|
|
13574
|
+
let t = new tl(this.renderer, this.meshScene, this._camera);
|
|
13293
13575
|
this.overlayManager.register("outline", t);
|
|
13294
13576
|
}
|
|
13295
13577
|
_setupDenoiserTileHelper(e) {
|
|
@@ -13306,7 +13588,7 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
13306
13588
|
_forwardEvents(e, t) {
|
|
13307
13589
|
if (e) for (let n of t) e.addEventListener(n, (e) => this.dispatchEvent(e));
|
|
13308
13590
|
}
|
|
13309
|
-
},
|
|
13591
|
+
}, rl = class {
|
|
13310
13592
|
constructor(e) {
|
|
13311
13593
|
this._app = e, this._cancelled = !1, this._rendering = !1;
|
|
13312
13594
|
}
|
|
@@ -13406,6 +13688,6 @@ var Fc = new Float32Array(3), Ic = {
|
|
|
13406
13688
|
}
|
|
13407
13689
|
};
|
|
13408
13690
|
//#endregion
|
|
13409
|
-
export { In as AF_DEFAULTS, jn as ASVGF_QUALITY_PRESETS, Fn as AUTO_FOCUS_MODES,
|
|
13691
|
+
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
13692
|
|
|
13411
13693
|
//# sourceMappingURL=rayzee.es.js.map
|