rayzee 7.22.2 → 7.22.3

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
@@ -10920,9 +10920,9 @@ var ef = ai("wavefront"), tf = 256, nf = [
10920
10920
  this._chunkRows = Math.max(1, Math.min(Math.floor(n / e), t)), this._numChunks = Math.max(1, Math.ceil(t / this._chunkRows));
10921
10921
  }
10922
10922
  reallocateReservedStorage() {
10923
- if (!this._packedBuffers || !(this.materialData?.materialCount > 0)) return;
10923
+ if (!this.storageTextures.writeColor) return;
10924
10924
  let e = Math.min(this.storageTextures.renderWidth || 1, Y), t = Math.min(this.storageTextures.renderHeight || 1, Y);
10925
- this.storageTextures.create(e, t), this.resolution.value.set(e, t), this._kernelManager && this._kernelManager.dispose(), this._wavefrontReady = !1, this._buildWavefrontKernels();
10925
+ this.storageTextures.create(e, t), this.resolution.value.set(e, t), !(!this._packedBuffers || !(this.materialData?.materialCount > 0)) && (this._kernelManager && this._kernelManager.dispose(), this._wavefrontReady = !1, this._buildWavefrontKernels());
10926
10926
  }
10927
10927
  _buildWavefrontKernels() {
10928
10928
  let e = this.shaderBuilder.getSceneTextureNodes();
@@ -17449,7 +17449,7 @@ var Cm = 4096, wm = class {
17449
17449
  } catch (e) {
17450
17450
  Nm.warn("prior canvas owner dispose failed", e);
17451
17451
  }
17452
- Mm.set(e, this), this.canvas = e, this._autoResize = t.autoResize !== !1, this._container = t.container || null, this.settings = new Ep(J), this.renderer = null, this.scene = null, this.meshScene = null, this._sceneHelpers = null, this.assetLoader = null, this._sdf = null, this._animRefitInFlight = !1, this._maxTextureSize = J.maxTextureSize, this.pipeline = null, this.stages = {}, this.cameraManager = null, this.lightManager = null, this.goboManager = null, this.iesManager = null, this.denoisingManager = null, this.overlayManager = null, this.interactionManager = null, this.transformManager = null, this.animationManager = new Om(), this.environmentManager = null, this.isInitialized = !1, this.pauseRendering = !1, this._pathTracerEnabled = !0, this._rasterPrecompile = null, this.animationManagerId = null, this.needsReset = !1, this._loadingInProgress = !1, this._needsDisplayRefresh = !1, this._paused = !1, this._emissiveSamplingUserSet = !1, this.completion = new Vf(), this._resizeDebounceTimer = null, this._trackedListeners = [], this._disposed = !1, this._deviceLost = !1, this._deterministic = !1, this._dispatchPinned = !1, this._deterministicRestore = null;
17452
+ Mm.set(e, this), this.canvas = e, this._autoResize = t.autoResize !== !1, this._container = t.container || null, this.settings = new Ep(J), this.renderer = null, this.scene = null, this.meshScene = null, this._sceneHelpers = null, this.assetLoader = null, this._sdf = null, this._animRefitInFlight = !1, this._maxTextureSize = J.maxTextureSize, this.pipeline = null, this._pendingReservedRenderSize = null, this.stages = {}, this.cameraManager = null, this.lightManager = null, this.goboManager = null, this.iesManager = null, this.denoisingManager = null, this.overlayManager = null, this.interactionManager = null, this.transformManager = null, this.animationManager = new Om(), this.environmentManager = null, this.isInitialized = !1, this.pauseRendering = !1, this._pathTracerEnabled = !0, this._rasterPrecompile = null, this.animationManagerId = null, this.needsReset = !1, this._loadingInProgress = !1, this._needsDisplayRefresh = !1, this._paused = !1, this._emissiveSamplingUserSet = !1, this.completion = new Vf(), this._resizeDebounceTimer = null, this._trackedListeners = [], this._disposed = !1, this._deviceLost = !1, this._deterministic = !1, this._dispatchPinned = !1, this._deterministicRestore = null;
17453
17453
  }
17454
17454
  _addTrackedListener(e, t, n) {
17455
17455
  e && (e.addEventListener(t, n), this._trackedListeners.push({
@@ -17467,7 +17467,7 @@ var Cm = 4096, wm = class {
17467
17467
  this._trackedListeners.length = 0;
17468
17468
  }
17469
17469
  async init() {
17470
- return await this._initRenderer(), this._initCameraManager(), this._initScenes(), this._initAssetPipeline(), this._initPipeline(), await this._initManagers(), this._wireEvents(), this.stages.pathTracer.setTriangleData(new Float32Array(32), 0), this.stages.pathTracer.setBVHData(new Float32Array(16)), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setupMaterial(), this.isInitialized = !0, Nm.debug("WebGPU path tracer app initialized"), this;
17470
+ return await this._initRenderer(), this._applyPendingReservedRenderSize(), this._initCameraManager(), this._initScenes(), this._initAssetPipeline(), this._initPipeline(), await this._initManagers(), this._wireEvents(), this.stages.pathTracer.setTriangleData(new Float32Array(32), 0), this.stages.pathTracer.setBVHData(new Float32Array(16)), this.stages.pathTracer.materialData.setMaterialData(new Float32Array(16)), this.stages.pathTracer.setupMaterial(), this.isInitialized = !0, Nm.debug("WebGPU path tracer app initialized"), this;
17471
17471
  }
17472
17472
  animate() {
17473
17473
  if (!this._deviceLost) {
@@ -17745,8 +17745,13 @@ var Cm = 4096, wm = class {
17745
17745
  }), r;
17746
17746
  }
17747
17747
  setReservedRenderResolution(e, { allowLower: t = !1 } = {}) {
17748
- let n = this.renderer?.backend?.device?.limits?.maxStorageBufferBindingSize || 128 * 1024 * 1024, r = (typeof navigator < "u" && navigator.deviceMemory || 4) >= 8 && n >= 1024 * 1024 * 1024 ? Dr : 2048, i = Y, a = Or(Math.min(t ? e : Math.max(e, i), r));
17749
- if (a !== i && this.stages?.pathTracer?._packedBuffers) {
17748
+ let n = t ? e : Math.max(e, Y);
17749
+ if (!this.renderer) return this._pendingReservedRenderSize = {
17750
+ requestedPx: e,
17751
+ allowLower: t
17752
+ }, Math.max(256, Math.min(Dr, Math.floor(n) || 256));
17753
+ let r = this.renderer.backend?.device?.limits?.maxStorageBufferBindingSize || 128 * 1024 * 1024, i = (typeof navigator < "u" && navigator.deviceMemory || 4) >= 8 && r >= 1024 * 1024 * 1024 ? Dr : 2048, a = Or(Math.min(n, i));
17754
+ if ((this.stages?.pathTracer?.storageTextures?.writeColor?.image?.width ?? a) !== a) {
17750
17755
  let e = this.pauseRendering;
17751
17756
  this.pauseRendering = !0;
17752
17757
  try {
@@ -17763,11 +17768,21 @@ var Cm = 4096, wm = class {
17763
17768
  }
17764
17769
  return a;
17765
17770
  }
17771
+ _applyPendingReservedRenderSize() {
17772
+ let e = this._pendingReservedRenderSize;
17773
+ if (!e) return;
17774
+ this._pendingReservedRenderSize = null;
17775
+ let t = this.setReservedRenderResolution(e.requestedPx, { allowLower: e.allowLower });
17776
+ t < e.requestedPx && Nm.warn(`reserved render size ${Q.n(e.requestedPx)}px was capped to ${Q.n(t)}px by this device's limits — renders above ${Q.n(t)}px will be declined.`), this.dispatchEvent({
17777
+ type: "reserved_render_size_changed",
17778
+ size: t
17779
+ });
17780
+ }
17766
17781
  getReservedRenderResolution() {
17767
17782
  return Y;
17768
17783
  }
17769
17784
  _isRenderSizeSupported(e, t) {
17770
- return e > Y || t > Y ? (Nm.warn(`render resolution ${e}×${t} exceeds the ${Y}px limit (compute storage textures are pre-allocated at ${Y}px). Ignoring resize — use a resolution ≤ ${Y}.`), !1) : !0;
17785
+ return e > Y || t > Y ? (Nm.warn(`render resolution ${e}×${t} exceeds the ${Y}px reserve (compute storage textures are pre-allocated at ${Y}px). Ignoring resize — raise the reserve with setReservedRenderResolution( ${Math.max(e, t)} ) first, or use a resolution ≤ ${Y}.`), !1) : !0;
17771
17786
  }
17772
17787
  onResize() {
17773
17788
  let e = this.canvas.clientWidth, t = this.canvas.clientHeight;
@@ -17786,7 +17801,10 @@ var Cm = 4096, wm = class {
17786
17801
  }));
17787
17802
  }
17788
17803
  setCanvasSize(e, t) {
17789
- e === 0 || t === 0 || this._isRenderSizeSupported(e, t) && (this.renderer.setPixelRatio(1), this.renderer.setSize(e, t, !1), this.cameraManager.camera.aspect = e / t, this.cameraManager.camera.updateProjectionMatrix(), clearTimeout(this._resizeDebounceTimer), this._applyRenderResize(e, t));
17804
+ return e === 0 || t === 0 || !this._isRenderSizeSupported(e, t) ? null : (this.renderer.setPixelRatio(1), this.renderer.setSize(e, t, !1), this.cameraManager.camera.aspect = e / t, this.cameraManager.camera.updateProjectionMatrix(), clearTimeout(this._resizeDebounceTimer), this._applyRenderResize(e, t), {
17805
+ width: e,
17806
+ height: t
17807
+ });
17790
17808
  }
17791
17809
  configureForMode(e, t = {}) {
17792
17810
  let n = e === "production", r = n ? Vr : Hr;
@@ -18319,4 +18337,4 @@ var Cm = 4096, wm = class {
18319
18337
  }
18320
18338
  };
18321
18339
  //#endregion
18322
- export { Pr as AF_DEFAULTS, kr as ASVGF_QUALITY_PRESETS, Nr as AUTO_FOCUS_MODES, Om as AnimationManager, Fr as BVH_LEAF_MARKERS, Mr as CAMERA_PRESETS, Ar as CAMERA_RANGES, Dp as CameraManager, Br as DEFAULT_TEXTURE_MATRIX, vm as DenoisingManager, J as ENGINE_DEFAULTS, dr as EngineEvents, kp as GoboManager, Bp as IESManager, Hr as INTERACTIVE_RENDER_CONFIG, Hf as InteractionManager, Wr as LOG_LEVELS, Op as LightManager, ii as Logger, Ur as MEMORY_CONSTANTS, Dm as OverlayManager, Vr as PRODUCTION_RENDER_CONFIG, Pm as PathTracerApp, Of as PipelineContext, Bf as RenderPipeline, Ep as RenderSettings, lr as RenderStage, jr as SKY_PRESETS, cr as StageExecutionMode, Ir as TEXTURE_CONSTANTS, X as TRIANGLE_DATA_LAYOUT, Am as TransformManager, uu as VRAMTracker, Fm as VideoRenderManager, cu as bufferBytes, Ff as clearBindingAuditFindings, sl as configureAssets, ai as createLogger, Q as fmt, cl as getAssetConfig, Pf as getBindingAuditFindings, Nf as setBindingAudit, lu as textureBytes };
18340
+ export { Pr as AF_DEFAULTS, kr as ASVGF_QUALITY_PRESETS, Nr as AUTO_FOCUS_MODES, Om as AnimationManager, Fr as BVH_LEAF_MARKERS, Mr as CAMERA_PRESETS, Ar as CAMERA_RANGES, Dp as CameraManager, Br as DEFAULT_TEXTURE_MATRIX, vm as DenoisingManager, J as ENGINE_DEFAULTS, dr as EngineEvents, kp as GoboManager, Bp as IESManager, Hr as INTERACTIVE_RENDER_CONFIG, Hf as InteractionManager, Wr as LOG_LEVELS, Op as LightManager, ii as Logger, Dr as MAX_RESERVABLE_RENDER_SIZE, Ur as MEMORY_CONSTANTS, Dm as OverlayManager, Vr as PRODUCTION_RENDER_CONFIG, Pm as PathTracerApp, Of as PipelineContext, Bf as RenderPipeline, Ep as RenderSettings, lr as RenderStage, jr as SKY_PRESETS, cr as StageExecutionMode, Ir as TEXTURE_CONSTANTS, X as TRIANGLE_DATA_LAYOUT, Am as TransformManager, uu as VRAMTracker, Fm as VideoRenderManager, cu as bufferBytes, Ff as clearBindingAuditFindings, sl as configureAssets, ai as createLogger, Q as fmt, cl as getAssetConfig, Pf as getBindingAuditFindings, Nf as setBindingAudit, lu as textureBytes };