Skip to content

Commit b7250c8

Browse files
committed
fix webxr layers bug + enabled multiview in native layers sample
1 parent fa041e4 commit b7250c8

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

examples/webgpu_xr_native_layers.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@
180180

181181
//
182182

183-
renderer = new THREE.WebGPURenderer( { antialias: true, forceWebGL: true, colorBufferType: THREE.UnsignedByteType } );
183+
renderer = new THREE.WebGPURenderer( { antialias: true, forceWebGL: true, colorBufferType: THREE.UnsignedByteType, multiview: true } );
184184
renderer.setPixelRatio( window.devicePixelRatio );
185185
renderer.setSize( window.innerWidth, window.innerHeight );
186186
renderer.setAnimationLoop( render );

src/core/RenderTarget.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Texture } from '../textures/Texture.js';
33
import { LinearFilter } from '../constants.js';
44
import { Vector4 } from '../math/Vector4.js';
55
import { Source } from '../textures/Source.js';
6+
import { mx_bilerp_1 } from '../nodes/materialx/lib/mx_noise.js';
67

78
/**
89
* A render target is a buffer where the video card draws pixels for a scene
@@ -80,7 +81,7 @@ class RenderTarget extends EventDispatcher {
8081
* @type {number}
8182
* @default 1
8283
*/
83-
this.depth = options.depth ? options.depth : 1;
84+
this.depth = mx_bilerp_1;//options.depth ? options.depth : 1;
8485

8586
/**
8687
* A rectangular area inside the render target's viewport. Fragments that are
@@ -108,7 +109,7 @@ class RenderTarget extends EventDispatcher {
108109
*/
109110
this.viewport = new Vector4( 0, 0, width, height );
110111

111-
const image = { width: width, height: height, depth: this.depth };
112+
const image = { width: width, height: height, depth: 1/*this.depth*/ };
112113

113114
options = Object.assign( {
114115
generateMipmaps: false,

src/renderers/common/XRManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -910,6 +910,8 @@ class XRManager extends EventDispatcher {
910910

911911
this._supportsLayers = session.enabledFeatures.includes( 'layers' );
912912

913+
this._referenceSpace = await session.requestReferenceSpace( this.getReferenceSpaceType() );
914+
913915
if ( this._supportsLayers ) {
914916

915917
// switch layers to native
@@ -971,8 +973,6 @@ class XRManager extends EventDispatcher {
971973

972974
this.setFoveation( this.getFoveation() );
973975

974-
this._referenceSpace = await session.requestReferenceSpace( this.getReferenceSpaceType() );
975-
976976
renderer._animation.setAnimationLoop( this._onAnimationFrame );
977977
renderer._animation.setContext( session );
978978
renderer._animation.start();

0 commit comments

Comments
 (0)