rayzee 5.3.0 → 5.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rayzee",
3
- "version": "5.3.0",
3
+ "version": "5.3.2",
4
4
  "type": "module",
5
5
  "description": "Real-time WebGPU path tracing engine built on Three.js",
6
6
  "main": "dist/rayzee.umd.js",
@@ -128,6 +128,9 @@ export class PathTracerApp extends EventDispatcher {
128
128
 
129
129
  // Resolution state
130
130
  this._resizeDebounceTimer = null;
131
+ this._resizeObserver = null;
132
+ this._lastObservedWidth = 0;
133
+ this._lastObservedHeight = 0;
131
134
 
132
135
  }
133
136
 
@@ -383,7 +386,7 @@ export class PathTracerApp extends EventDispatcher {
383
386
  }
384
387
 
385
388
  clearTimeout( this._resizeDebounceTimer );
386
- window.removeEventListener( 'resize', this.resizeHandler );
389
+ this._resizeObserver?.disconnect();
387
390
 
388
391
  this.isInitialized = false;
389
392
 
@@ -639,6 +642,9 @@ export class PathTracerApp extends EventDispatcher {
639
642
  const width = this.canvas.clientWidth;
640
643
  const height = this.canvas.clientHeight;
641
644
  if ( width === 0 || height === 0 ) return;
645
+ if ( width === this._lastObservedWidth && height === this._lastObservedHeight ) return;
646
+ this._lastObservedWidth = width;
647
+ this._lastObservedHeight = height;
642
648
 
643
649
  this.renderer.setPixelRatio( 1.0 );
644
650
  this.renderer.setSize( width, height, false );
@@ -1155,10 +1161,10 @@ export class PathTracerApp extends EventDispatcher {
1155
1161
 
1156
1162
  // Resize handling
1157
1163
  this.onResize();
1158
- this.resizeHandler = () => this.onResize();
1159
1164
  if ( this._autoResize ) {
1160
1165
 
1161
- window.addEventListener( 'resize', this.resizeHandler );
1166
+ this._resizeObserver = new ResizeObserver( () => this.onResize() );
1167
+ this._resizeObserver.observe( this.canvas );
1162
1168
 
1163
1169
  }
1164
1170
 
@@ -111,6 +111,7 @@ export class Display extends RenderStage {
111
111
  dispose() {
112
112
 
113
113
  this.displayMaterial?.dispose();
114
+ this.displayQuad?.dispose();
114
115
 
115
116
  }
116
117
 
@@ -699,7 +699,7 @@ export class InteractionManager extends EventDispatcher {
699
699
 
700
700
  this.select( event.object );
701
701
  app.refreshFrame();
702
- app.dispatchEvent( { type: 'objectSelected', object: event.object, uuid: event.uuid } );
702
+ app.dispatchEvent( { type: EngineEvents.OBJECT_SELECTED, object: event.object, uuid: event.uuid } );
703
703
 
704
704
  } );
705
705
 
@@ -707,7 +707,7 @@ export class InteractionManager extends EventDispatcher {
707
707
 
708
708
  this.select( null );
709
709
  app.refreshFrame();
710
- app.dispatchEvent( { type: 'objectDeselected', object: event.object, uuid: event.uuid } );
710
+ app.dispatchEvent( { type: EngineEvents.OBJECT_DESELECTED, object: event.object, uuid: event.uuid } );
711
711
 
712
712
  } );
713
713