|
|
@@ -41019,7 +41019,7 @@ const mx_worley_distance_1 = /*@__PURE__*/ Fn( ( [ p_immutable, x_immutable, y_i
|
|
|
|
|
|
If( metric.equal( int( 3 ) ), () => {
|
|
|
|
|
|
- return max$1( max$1( abs( diff.x ), abs( diff.y ) ), abs( diff.z ) );
|
|
|
+ return max$1( abs( diff.x ), abs( diff.y ), abs( diff.z ) );
|
|
|
|
|
|
} );
|
|
|
|
|
|
@@ -41569,7 +41569,7 @@ const getParallaxCorrectNormal = /*@__PURE__*/ Fn( ( [ normal, cubeSize, cubePos
|
|
|
rbminmax.y = nDir.y.greaterThan( float( 0 ) ).select( rbmax.y, rbmin.y );
|
|
|
rbminmax.z = nDir.z.greaterThan( float( 0 ) ).select( rbmax.z, rbmin.z );
|
|
|
|
|
|
- const correction = min$1( min$1( rbminmax.x, rbminmax.y ), rbminmax.z ).toVar();
|
|
|
+ const correction = min$1( rbminmax.x, rbminmax.y, rbminmax.z ).toVar();
|
|
|
const boxIntersection = positionWorld.add( nDir.mul( correction ) ).toVar();
|
|
|
return boxIntersection.sub( cubePos );
|
|
|
|
|
|
@@ -50219,7 +50219,7 @@ class XRManager extends EventDispatcher {
|
|
|
session.updateRenderState( { baseLayer: glBaseLayer } );
|
|
|
|
|
|
renderer.setPixelRatio( 1 );
|
|
|
- renderer.setSize( glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, false );
|
|
|
+ renderer._setXRLayerSize( glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight );
|
|
|
|
|
|
this._xrRenderTarget = new XRRenderTarget(
|
|
|
glBaseLayer.framebufferWidth,
|
|
|
@@ -52061,6 +52061,7 @@ class Renderer {
|
|
|
frameBufferTarget.scissorTest = this._scissorTest;
|
|
|
frameBufferTarget.multiview = outputRenderTarget !== null ? outputRenderTarget.multiview : false;
|
|
|
frameBufferTarget.resolveDepthBuffer = outputRenderTarget !== null ? outputRenderTarget.resolveDepthBuffer : true;
|
|
|
+ frameBufferTarget.autoAllocateDepthBuffer = outputRenderTarget !== null ? outputRenderTarget.autoAllocateDepthBuffer : false;
|
|
|
|
|
|
return frameBufferTarget;
|
|
|
|
|
|
@@ -59217,25 +59218,6 @@ class WebGLTextureUtils {
|
|
|
if ( texture.isRenderTargetTexture || ( textureGPU === undefined /* unsupported texture format */ ) )
|
|
|
return;
|
|
|
|
|
|
- const getImage = ( source ) => {
|
|
|
-
|
|
|
- if ( source.isDataTexture ) {
|
|
|
-
|
|
|
- return source.image.data;
|
|
|
-
|
|
|
- } else if ( ( typeof HTMLImageElement !== 'undefined' && source instanceof HTMLImageElement ) ||
|
|
|
- ( typeof HTMLCanvasElement !== 'undefined' && source instanceof HTMLCanvasElement ) ||
|
|
|
- ( typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap ) ||
|
|
|
- source instanceof OffscreenCanvas ) {
|
|
|
-
|
|
|
- return source;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return source.data;
|
|
|
-
|
|
|
- };
|
|
|
-
|
|
|
this.backend.state.bindTexture( glTextureType, textureGPU );
|
|
|
|
|
|
this.setTextureParameters( glTextureType, texture );
|
|
|
@@ -59874,6 +59856,25 @@ class WebGLTextureUtils {
|
|
|
|
|
|
}
|
|
|
|
|
|
+function getImage( source ) {
|
|
|
+
|
|
|
+ if ( source.isDataTexture ) {
|
|
|
+
|
|
|
+ return source.image.data;
|
|
|
+
|
|
|
+ } else if ( ( typeof HTMLImageElement !== 'undefined' && source instanceof HTMLImageElement ) ||
|
|
|
+ ( typeof HTMLCanvasElement !== 'undefined' && source instanceof HTMLCanvasElement ) ||
|
|
|
+ ( typeof ImageBitmap !== 'undefined' && source instanceof ImageBitmap ) ||
|
|
|
+ ( typeof OffscreenCanvas !== 'undefined' && source instanceof OffscreenCanvas ) ) {
|
|
|
+
|
|
|
+ return source;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return source.data;
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* A WebGL 2 backend utility module for managing extensions.
|
|
|
*
|
|
|
@@ -61212,7 +61213,7 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
}
|
|
|
|
|
|
- } else if ( resolveDepthBuffer === false ) {
|
|
|
+ } else if ( resolveDepthBuffer === false && renderTargetContextData.framebuffers ) {
|
|
|
|
|
|
const fb = renderTargetContextData.framebuffers[ renderContext.getCacheKey() ];
|
|
|
state.bindFramebuffer( gl.DRAW_FRAMEBUFFER, fb );
|
|
|
@@ -62692,7 +62693,7 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
} else {
|
|
|
|
|
|
- if ( hasExternalTextures && useMultisampledRTT ) {
|
|
|
+ if ( useMultisampledRTT ) {
|
|
|
|
|
|
multisampledRTTExt.framebufferTexture2DMultisampleEXT( gl.FRAMEBUFFER, attachment, gl.TEXTURE_2D, textureData.textureGPU, 0, samples );
|
|
|
|
|
|
@@ -62710,13 +62711,19 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
}
|
|
|
|
|
|
- if ( renderTarget.isXRRenderTarget && renderTarget.autoAllocateDepthBuffer === true ) {
|
|
|
+ const depthStyle = stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
|
|
|
+
|
|
|
+ if ( renderTarget.autoAllocateDepthBuffer === true ) {
|
|
|
|
|
|
const renderbuffer = gl.createRenderbuffer();
|
|
|
this.textureUtils.setupRenderBufferStorage( renderbuffer, descriptor, 0, useMultisampledRTT );
|
|
|
renderTargetContextData.xrDepthRenderbuffer = renderbuffer;
|
|
|
depthInvalidationArray.push( stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT );
|
|
|
|
|
|
+ gl.bindRenderbuffer( gl.RENDERBUFFER, renderbuffer );
|
|
|
+ gl.framebufferRenderbuffer( gl.FRAMEBUFFER, depthStyle, gl.RENDERBUFFER, renderbuffer );
|
|
|
+
|
|
|
+
|
|
|
} else {
|
|
|
|
|
|
if ( descriptor.depthTexture !== null ) {
|
|
|
@@ -62724,7 +62731,6 @@ class WebGLBackend extends Backend {
|
|
|
depthInvalidationArray.push( stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT );
|
|
|
|
|
|
const textureData = this.get( descriptor.depthTexture );
|
|
|
- const depthStyle = stencilBuffer ? gl.DEPTH_STENCIL_ATTACHMENT : gl.DEPTH_ATTACHMENT;
|
|
|
textureData.renderTarget = descriptor.renderTarget;
|
|
|
textureData.cacheKey = cacheKey; // required for copyTextureToTexture()
|
|
|
|
|
|
@@ -62783,7 +62789,7 @@ class WebGLBackend extends Backend {
|
|
|
|
|
|
// rebind external XR textures
|
|
|
|
|
|
- if ( ( isXRRenderTarget && hasExternalTextures ) || renderTarget.multiview ) {
|
|
|
+ if ( isXRRenderTarget || useMultisampledRTT || renderTarget.multiview ) {
|
|
|
|
|
|
state.bindFramebuffer( gl.FRAMEBUFFER, fb );
|
|
|
|