super-three 0.173.0 → 0.173.1

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.
@@ -9,6 +9,8 @@ import { CopyShader } from '../shaders/CopyShader.js';
9
9
  import { ShaderPass } from './ShaderPass.js';
10
10
  import { ClearMaskPass, MaskPass } from './MaskPass.js';
11
11
 
12
+ const size = /* @__PURE__ */ new Vector2();
13
+
12
14
  class EffectComposer {
13
15
 
14
16
  constructor( renderer, renderTarget ) {
@@ -19,7 +21,7 @@ class EffectComposer {
19
21
 
20
22
  if ( renderTarget === undefined ) {
21
23
 
22
- const size = renderer.getSize( new Vector2() );
24
+ renderer.getSize( size );
23
25
  this._width = size.width;
24
26
  this._height = size.height;
25
27
 
@@ -48,6 +50,22 @@ class EffectComposer {
48
50
  this.copyPass.material.blending = NoBlending;
49
51
 
50
52
  this.clock = new Clock();
53
+
54
+ this.onSessionStateChange = this.onSessionStateChange.bind( this );
55
+ this.renderer.xr.addEventListener( 'sessionstart', this.onSessionStateChange );
56
+ this.renderer.xr.addEventListener( 'sessionend', this.onSessionStateChange );
57
+
58
+ }
59
+
60
+ onSessionStateChange() {
61
+
62
+ this.renderer.getSize( size );
63
+ this._width = size.width;
64
+ this._height = size.height;
65
+
66
+ this._pixelRatio = this.renderer.xr.isPresenting ? 1 : this.renderer.getPixelRatio();
67
+
68
+ this.setSize( this._width, this._height );
51
69
 
52
70
  }
53
71
 
@@ -169,7 +187,7 @@ class EffectComposer {
169
187
 
170
188
  if ( renderTarget === undefined ) {
171
189
 
172
- const size = this.renderer.getSize( new Vector2() );
190
+ this.renderer.getSize( size );
173
191
  this._pixelRatio = this.renderer.getPixelRatio();
174
192
  this._width = size.width;
175
193
  this._height = size.height;
@@ -223,6 +241,9 @@ class EffectComposer {
223
241
 
224
242
  this.copyPass.dispose();
225
243
 
244
+ this.renderer.xr.removeEventListener( 'sessionstart', this.onSessionStateChange );
245
+ this.renderer.xr.removeEventListener( 'sessionend', this.onSessionStateChange );
246
+
226
247
  }
227
248
 
228
249
  }
@@ -74,8 +74,13 @@ class FullScreenQuad {
74
74
 
75
75
  render( renderer ) {
76
76
 
77
- renderer.render( this._mesh, _camera );
77
+ // Disable XR projection for fullscreen effects
78
+ // https://github.com/mrdoob/three.js/pull/18846
79
+ const xrEnabled = renderer.xr.enabled;
78
80
 
81
+ renderer.xr.enabled = false;
82
+ renderer.render( this._mesh, _camera );
83
+ renderer.xr.enabled = xrEnabled;
79
84
  }
80
85
 
81
86
  get material() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "super-three",
3
- "version": "0.173.0",
3
+ "version": "0.173.1",
4
4
  "description": "JavaScript 3D library",
5
5
  "type": "module",
6
6
  "main": "./build/three.cjs",