super-three 0.173.1 → 0.173.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/build/three.cjs +63 -577
- package/build/three.core.js +0 -15
- package/build/three.core.min.js +1 -1
- package/build/three.module.js +64 -563
- package/build/three.module.min.js +1 -1
- package/package.json +1 -1
- package/src/renderers/webgl/WebGLTextures.js +1 -2
package/build/three.cjs
CHANGED
|
@@ -29857,21 +29857,6 @@ class ObjectLoader extends Loader {
|
|
|
29857
29857
|
geometry = bufferGeometryLoader.parse( data );
|
|
29858
29858
|
break;
|
|
29859
29859
|
|
|
29860
|
-
case 'Geometry':
|
|
29861
|
-
|
|
29862
|
-
if ( 'THREE' in window && 'LegacyJSONLoader' in THREE ) {
|
|
29863
|
-
|
|
29864
|
-
var geometryLoader = new THREE.LegacyJSONLoader();
|
|
29865
|
-
geometry = geometryLoader.parse( data, this.resourcePath ).geometry;
|
|
29866
|
-
|
|
29867
|
-
|
|
29868
|
-
} else {
|
|
29869
|
-
|
|
29870
|
-
console.error( 'THREE.ObjectLoader: You have to import LegacyJSONLoader in order load geometry data of type "Geometry".' );
|
|
29871
|
-
|
|
29872
|
-
}
|
|
29873
|
-
break;
|
|
29874
|
-
|
|
29875
29860
|
default:
|
|
29876
29861
|
|
|
29877
29862
|
if ( data.type in Geometries ) {
|
|
@@ -38807,7 +38792,7 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
|
|
|
38807
38792
|
if ( boxMesh === undefined ) {
|
|
38808
38793
|
|
|
38809
38794
|
boxMesh = new Mesh(
|
|
38810
|
-
new BoxGeometry(
|
|
38795
|
+
new BoxGeometry( 1, 1, 1 ),
|
|
38811
38796
|
new ShaderMaterial( {
|
|
38812
38797
|
name: 'BackgroundCubeMaterial',
|
|
38813
38798
|
uniforms: cloneUniforms( ShaderLib.backgroundCube.uniforms ),
|
|
@@ -41718,103 +41703,6 @@ function WebGLMorphtargets( gl, capabilities, textures ) {
|
|
|
41718
41703
|
|
|
41719
41704
|
}
|
|
41720
41705
|
|
|
41721
|
-
/**
|
|
41722
|
-
* @author fernandojsg / http://fernandojsg.com
|
|
41723
|
-
* @author Takahiro https://github.com/takahirox
|
|
41724
|
-
*/
|
|
41725
|
-
|
|
41726
|
-
class WebGLMultiview {
|
|
41727
|
-
|
|
41728
|
-
constructor( renderer, extensions, gl ) {
|
|
41729
|
-
|
|
41730
|
-
this.renderer = renderer;
|
|
41731
|
-
|
|
41732
|
-
this.DEFAULT_NUMVIEWS = 2;
|
|
41733
|
-
this.maxNumViews = 0;
|
|
41734
|
-
this.gl = gl;
|
|
41735
|
-
|
|
41736
|
-
this.extensions = extensions;
|
|
41737
|
-
|
|
41738
|
-
this.available = this.extensions.has( 'OCULUS_multiview' );
|
|
41739
|
-
|
|
41740
|
-
if ( this.available ) {
|
|
41741
|
-
|
|
41742
|
-
const extension = this.extensions.get( 'OCULUS_multiview' );
|
|
41743
|
-
|
|
41744
|
-
this.maxNumViews = this.gl.getParameter( extension.MAX_VIEWS_OVR );
|
|
41745
|
-
|
|
41746
|
-
this.mat4 = [];
|
|
41747
|
-
this.mat3 = [];
|
|
41748
|
-
this.cameraArray = [];
|
|
41749
|
-
|
|
41750
|
-
for ( var i = 0; i < this.maxNumViews; i ++ ) {
|
|
41751
|
-
|
|
41752
|
-
this.mat4[ i ] = new Matrix4();
|
|
41753
|
-
this.mat3[ i ] = new Matrix3();
|
|
41754
|
-
|
|
41755
|
-
}
|
|
41756
|
-
|
|
41757
|
-
}
|
|
41758
|
-
|
|
41759
|
-
}
|
|
41760
|
-
|
|
41761
|
-
//
|
|
41762
|
-
getCameraArray( camera ) {
|
|
41763
|
-
|
|
41764
|
-
if ( camera.isArrayCamera ) return camera.cameras;
|
|
41765
|
-
|
|
41766
|
-
this.cameraArray[ 0 ] = camera;
|
|
41767
|
-
|
|
41768
|
-
return this.cameraArray;
|
|
41769
|
-
|
|
41770
|
-
}
|
|
41771
|
-
|
|
41772
|
-
updateCameraProjectionMatricesUniform( camera, uniforms ) {
|
|
41773
|
-
|
|
41774
|
-
var cameras = this.getCameraArray( camera );
|
|
41775
|
-
|
|
41776
|
-
for ( var i = 0; i < cameras.length; i ++ ) {
|
|
41777
|
-
|
|
41778
|
-
this.mat4[ i ].copy( cameras[ i ].projectionMatrix );
|
|
41779
|
-
|
|
41780
|
-
}
|
|
41781
|
-
|
|
41782
|
-
uniforms.setValue( this.gl, 'projectionMatrices', this.mat4 );
|
|
41783
|
-
|
|
41784
|
-
}
|
|
41785
|
-
|
|
41786
|
-
updateCameraViewMatricesUniform( camera, uniforms ) {
|
|
41787
|
-
|
|
41788
|
-
var cameras = this.getCameraArray( camera );
|
|
41789
|
-
|
|
41790
|
-
for ( var i = 0; i < cameras.length; i ++ ) {
|
|
41791
|
-
|
|
41792
|
-
this.mat4[ i ].copy( cameras[ i ].matrixWorldInverse );
|
|
41793
|
-
|
|
41794
|
-
}
|
|
41795
|
-
|
|
41796
|
-
uniforms.setValue( this.gl, 'viewMatrices', this.mat4 );
|
|
41797
|
-
|
|
41798
|
-
}
|
|
41799
|
-
|
|
41800
|
-
updateObjectMatricesUniforms( object, camera, uniforms ) {
|
|
41801
|
-
|
|
41802
|
-
var cameras = this.getCameraArray( camera );
|
|
41803
|
-
|
|
41804
|
-
for ( var i = 0; i < cameras.length; i ++ ) {
|
|
41805
|
-
|
|
41806
|
-
this.mat4[ i ].multiplyMatrices( cameras[ i ].matrixWorldInverse, object.matrixWorld );
|
|
41807
|
-
this.mat3[ i ].getNormalMatrix( this.mat4[ i ] );
|
|
41808
|
-
|
|
41809
|
-
}
|
|
41810
|
-
|
|
41811
|
-
uniforms.setValue( this.gl, 'modelViewMatrices', this.mat4 );
|
|
41812
|
-
uniforms.setValue( this.gl, 'normalMatrices', this.mat3 );
|
|
41813
|
-
|
|
41814
|
-
}
|
|
41815
|
-
|
|
41816
|
-
}
|
|
41817
|
-
|
|
41818
41706
|
function WebGLObjects( gl, geometries, attributes, info ) {
|
|
41819
41707
|
|
|
41820
41708
|
let updateMap = new WeakMap();
|
|
@@ -43566,8 +43454,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
43566
43454
|
let prefixVertex, prefixFragment;
|
|
43567
43455
|
let versionString = parameters.glslVersion ? '#version ' + parameters.glslVersion + '\n' : '';
|
|
43568
43456
|
|
|
43569
|
-
const numMultiviewViews = parameters.numMultiviewViews;
|
|
43570
|
-
|
|
43571
43457
|
if ( parameters.isRawShaderMaterial ) {
|
|
43572
43458
|
|
|
43573
43459
|
prefixVertex = [
|
|
@@ -43955,53 +43841,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
43955
43841
|
'#define textureCubeGradEXT textureGrad'
|
|
43956
43842
|
].join( '\n' ) + '\n' + prefixFragment;
|
|
43957
43843
|
|
|
43958
|
-
// Multiview
|
|
43959
|
-
|
|
43960
|
-
if ( numMultiviewViews > 0 ) {
|
|
43961
|
-
|
|
43962
|
-
// TODO: fix light transforms here?
|
|
43963
|
-
|
|
43964
|
-
prefixVertex = [
|
|
43965
|
-
'#extension GL_OVR_multiview : require',
|
|
43966
|
-
'layout(num_views = ' + numMultiviewViews + ') in;',
|
|
43967
|
-
'#define VIEW_ID gl_ViewID_OVR'
|
|
43968
|
-
].join( '\n' ) + '\n' + prefixVertex;
|
|
43969
|
-
|
|
43970
|
-
prefixVertex = prefixVertex.replace(
|
|
43971
|
-
[
|
|
43972
|
-
'uniform mat4 modelViewMatrix;',
|
|
43973
|
-
'uniform mat4 projectionMatrix;',
|
|
43974
|
-
'uniform mat4 viewMatrix;',
|
|
43975
|
-
'uniform mat3 normalMatrix;'
|
|
43976
|
-
].join( '\n' ),
|
|
43977
|
-
[
|
|
43978
|
-
'uniform mat4 modelViewMatrices[' + numMultiviewViews + '];',
|
|
43979
|
-
'uniform mat4 projectionMatrices[' + numMultiviewViews + '];',
|
|
43980
|
-
'uniform mat4 viewMatrices[' + numMultiviewViews + '];',
|
|
43981
|
-
'uniform mat3 normalMatrices[' + numMultiviewViews + '];',
|
|
43982
|
-
|
|
43983
|
-
'#define modelViewMatrix modelViewMatrices[VIEW_ID]',
|
|
43984
|
-
'#define projectionMatrix projectionMatrices[VIEW_ID]',
|
|
43985
|
-
'#define viewMatrix viewMatrices[VIEW_ID]',
|
|
43986
|
-
'#define normalMatrix normalMatrices[VIEW_ID]'
|
|
43987
|
-
].join( '\n' )
|
|
43988
|
-
);
|
|
43989
|
-
|
|
43990
|
-
prefixFragment = [
|
|
43991
|
-
'#extension GL_OVR_multiview : require',
|
|
43992
|
-
'#define VIEW_ID gl_ViewID_OVR'
|
|
43993
|
-
].join( '\n' ) + '\n' + prefixFragment;
|
|
43994
|
-
|
|
43995
|
-
prefixFragment = prefixFragment.replace(
|
|
43996
|
-
'uniform mat4 viewMatrix;',
|
|
43997
|
-
[
|
|
43998
|
-
'uniform mat4 viewMatrices[' + numMultiviewViews + '];',
|
|
43999
|
-
'#define viewMatrix viewMatrices[VIEW_ID]'
|
|
44000
|
-
].join( '\n' )
|
|
44001
|
-
);
|
|
44002
|
-
|
|
44003
|
-
}
|
|
44004
|
-
|
|
44005
43844
|
}
|
|
44006
43845
|
|
|
44007
43846
|
const vertexGlsl = versionString + prefixVertex + vertexShader;
|
|
@@ -44194,7 +44033,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
|
|
|
44194
44033
|
this.program = program;
|
|
44195
44034
|
this.vertexShader = glVertexShader;
|
|
44196
44035
|
this.fragmentShader = glFragmentShader;
|
|
44197
|
-
this.numMultiviewViews = numMultiviewViews;
|
|
44198
44036
|
|
|
44199
44037
|
return this;
|
|
44200
44038
|
|
|
@@ -44427,8 +44265,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
44427
44265
|
const currentRenderTarget = renderer.getRenderTarget();
|
|
44428
44266
|
const reverseDepthBuffer = renderer.state.buffers.depth.getReversed();
|
|
44429
44267
|
|
|
44430
|
-
const numMultiviewViews = currentRenderTarget && currentRenderTarget.isWebGLMultiviewRenderTarget ? currentRenderTarget.numViews : 0;
|
|
44431
|
-
|
|
44432
44268
|
const IS_INSTANCEDMESH = object.isInstancedMesh === true;
|
|
44433
44269
|
const IS_BATCHEDMESH = object.isBatchedMesh === true;
|
|
44434
44270
|
|
|
@@ -44518,7 +44354,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
44518
44354
|
instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
|
|
44519
44355
|
|
|
44520
44356
|
supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,
|
|
44521
|
-
numMultiviewViews: numMultiviewViews,
|
|
44522
44357
|
outputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),
|
|
44523
44358
|
alphaToCoverage: !! material.alphaToCoverage,
|
|
44524
44359
|
|
|
@@ -44883,8 +44718,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
|
|
|
44883
44718
|
_programLayers.enable( 20 );
|
|
44884
44719
|
if ( parameters.alphaToCoverage )
|
|
44885
44720
|
_programLayers.enable( 21 );
|
|
44886
|
-
if ( parameters.numMultiviewViews )
|
|
44887
|
-
_programLayers.enable( 21 );
|
|
44888
44721
|
|
|
44889
44722
|
array.push( _programLayers.mask );
|
|
44890
44723
|
|
|
@@ -47682,7 +47515,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
47682
47515
|
|
|
47683
47516
|
const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
|
|
47684
47517
|
const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
|
|
47685
|
-
const multiviewExt = extensions.has( 'OCULUS_multiview' ) ? extensions.get( 'OCULUS_multiview' ) : null;
|
|
47686
47518
|
|
|
47687
47519
|
const _imageDimensions = new Vector2();
|
|
47688
47520
|
const _videoTextures = new WeakMap();
|
|
@@ -47690,9 +47522,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
47690
47522
|
|
|
47691
47523
|
const _sources = new WeakMap(); // maps WebglTexture objects to instances of Source
|
|
47692
47524
|
|
|
47693
|
-
let _deferredUploads = [];
|
|
47694
|
-
let _deferTextureUploads = false;
|
|
47695
|
-
|
|
47696
47525
|
// cordova iOS (as of 5.0) still uses UIWebView, which provides OffscreenCanvas,
|
|
47697
47526
|
// also OffscreenCanvas.getContext("webgl"), but not OffscreenCanvas.getContext("2d")!
|
|
47698
47527
|
// Some implementations may only implement OffscreenCanvas partially (e.g. lacking 2d).
|
|
@@ -48207,11 +48036,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
48207
48036
|
|
|
48208
48037
|
} else {
|
|
48209
48038
|
|
|
48210
|
-
|
|
48211
|
-
|
|
48212
|
-
return;
|
|
48213
|
-
|
|
48214
|
-
}
|
|
48039
|
+
uploadTexture( textureProperties, texture, slot );
|
|
48040
|
+
return;
|
|
48215
48041
|
|
|
48216
48042
|
}
|
|
48217
48043
|
|
|
@@ -48420,45 +48246,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
48420
48246
|
|
|
48421
48247
|
}
|
|
48422
48248
|
|
|
48423
|
-
function setDeferTextureUploads( deferFlag ) {
|
|
48424
|
-
|
|
48425
|
-
_deferTextureUploads = deferFlag;
|
|
48426
|
-
|
|
48427
|
-
}
|
|
48428
|
-
|
|
48429
|
-
function runDeferredUploads() {
|
|
48430
|
-
|
|
48431
|
-
const previousDeferSetting = _deferTextureUploads;
|
|
48432
|
-
_deferTextureUploads = false;
|
|
48433
|
-
|
|
48434
|
-
for ( const upload of _deferredUploads ) {
|
|
48435
|
-
|
|
48436
|
-
uploadTexture( upload.textureProperties, upload.texture, upload.slot );
|
|
48437
|
-
upload.texture.isPendingDeferredUpload = false;
|
|
48438
|
-
|
|
48439
|
-
}
|
|
48440
|
-
|
|
48441
|
-
_deferredUploads = [];
|
|
48442
|
-
|
|
48443
|
-
_deferTextureUploads = previousDeferSetting;
|
|
48444
|
-
|
|
48445
|
-
}
|
|
48446
|
-
|
|
48447
48249
|
function uploadTexture( textureProperties, texture, slot ) {
|
|
48448
48250
|
|
|
48449
|
-
if ( _deferTextureUploads ) {
|
|
48450
|
-
|
|
48451
|
-
if ( ! texture.isPendingDeferredUpload ) {
|
|
48452
|
-
|
|
48453
|
-
texture.isPendingDeferredUpload = true;
|
|
48454
|
-
_deferredUploads.push( { textureProperties: textureProperties, texture: texture, slot: slot } );
|
|
48455
|
-
|
|
48456
|
-
}
|
|
48457
|
-
|
|
48458
|
-
return false;
|
|
48459
|
-
|
|
48460
|
-
}
|
|
48461
|
-
|
|
48462
48251
|
let textureType = _gl.TEXTURE_2D;
|
|
48463
48252
|
|
|
48464
48253
|
if ( texture.isDataArrayTexture || texture.isCompressedArrayTexture ) textureType = _gl.TEXTURE_2D_ARRAY;
|
|
@@ -48888,7 +48677,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
48888
48677
|
}
|
|
48889
48678
|
|
|
48890
48679
|
textureProperties.__version = texture.version;
|
|
48891
|
-
return true;
|
|
48892
48680
|
|
|
48893
48681
|
}
|
|
48894
48682
|
|
|
@@ -49147,11 +48935,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
49147
48935
|
const width = Math.max( 1, renderTarget.width >> level );
|
|
49148
48936
|
const height = Math.max( 1, renderTarget.height >> level );
|
|
49149
48937
|
|
|
49150
|
-
if (
|
|
49151
|
-
|
|
49152
|
-
state.texStorage3D( _gl.TEXTURE_2D_ARRAY, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.numViews );
|
|
49153
|
-
|
|
49154
|
-
} else if ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {
|
|
48938
|
+
if ( textureTarget === _gl.TEXTURE_3D || textureTarget === _gl.TEXTURE_2D_ARRAY ) {
|
|
49155
48939
|
|
|
49156
48940
|
state.texImage3D( textureTarget, level, glInternalFormat, width, height, renderTarget.depth, 0, glFormat, glType, null );
|
|
49157
48941
|
|
|
@@ -49165,31 +48949,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
49165
48949
|
|
|
49166
48950
|
state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
|
|
49167
48951
|
|
|
49168
|
-
|
|
49169
|
-
|
|
49170
|
-
if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
|
|
49171
|
-
|
|
49172
|
-
if ( multisampled ) {
|
|
48952
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
49173
48953
|
|
|
49174
|
-
|
|
49175
|
-
|
|
49176
|
-
} else {
|
|
49177
|
-
|
|
49178
|
-
multiviewExt.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, _gl.COLOR_ATTACHMENT0, textureProperties.__webglTexture, 0, 0, renderTarget.numViews );
|
|
49179
|
-
|
|
49180
|
-
}
|
|
48954
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, 0, getRenderTargetSamples( renderTarget ) );
|
|
49181
48955
|
|
|
49182
48956
|
} else if ( textureTarget === _gl.TEXTURE_2D || ( textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z ) ) { // see #24753
|
|
49183
48957
|
|
|
49184
|
-
|
|
49185
|
-
|
|
49186
|
-
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, 0, getRenderTargetSamples( renderTarget ) );
|
|
49187
|
-
|
|
49188
|
-
} else {
|
|
49189
|
-
|
|
49190
|
-
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, level );
|
|
49191
|
-
|
|
49192
|
-
}
|
|
48958
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, attachment, textureTarget, textureProperties.__webglTexture, level );
|
|
49193
48959
|
|
|
49194
48960
|
}
|
|
49195
48961
|
|
|
@@ -49202,59 +48968,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
49202
48968
|
|
|
49203
48969
|
_gl.bindRenderbuffer( _gl.RENDERBUFFER, renderbuffer );
|
|
49204
48970
|
|
|
49205
|
-
if ( renderTarget.
|
|
49206
|
-
|
|
49207
|
-
const useMultisample = useMultisampledRTT( renderTarget );
|
|
49208
|
-
const numViews = renderTarget.numViews;
|
|
49209
|
-
|
|
49210
|
-
const depthTexture = renderTarget.depthTexture;
|
|
49211
|
-
let glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
49212
|
-
let glDepthAttachment = _gl.DEPTH_ATTACHMENT;
|
|
49213
|
-
|
|
49214
|
-
if ( depthTexture && depthTexture.isDepthTexture ) {
|
|
49215
|
-
|
|
49216
|
-
if ( depthTexture.type === FloatType ) {
|
|
49217
|
-
|
|
49218
|
-
glInternalFormat = _gl.DEPTH_COMPONENT32F;
|
|
49219
|
-
|
|
49220
|
-
} else if ( depthTexture.type === UnsignedInt248Type ) {
|
|
49221
|
-
|
|
49222
|
-
glInternalFormat = _gl.DEPTH24_STENCIL8;
|
|
49223
|
-
glDepthAttachment = _gl.DEPTH_STENCIL_ATTACHMENT;
|
|
49224
|
-
|
|
49225
|
-
}
|
|
49226
|
-
|
|
49227
|
-
// we're defaulting to _gl.DEPTH_COMPONENT24 so don't assign here
|
|
49228
|
-
// or else DeepScan will complain
|
|
49229
|
-
|
|
49230
|
-
// else if ( depthTexture.type === UnsignedIntType ) {
|
|
49231
|
-
|
|
49232
|
-
// glInternalFormat = _gl.DEPTH_COMPONENT24;
|
|
49233
|
-
|
|
49234
|
-
// }
|
|
49235
|
-
|
|
49236
|
-
}
|
|
49237
|
-
|
|
49238
|
-
let depthStencilTexture = properties.get( renderTarget.depthTexture ).__webglTexture;
|
|
49239
|
-
if ( depthStencilTexture === undefined ) {
|
|
49240
|
-
|
|
49241
|
-
depthStencilTexture = _gl.createTexture();
|
|
49242
|
-
_gl.bindTexture( _gl.TEXTURE_2D_ARRAY, depthStencilTexture );
|
|
49243
|
-
_gl.texStorage3D( _gl.TEXTURE_2D_ARRAY, 1, glInternalFormat, renderTarget.width, renderTarget.height, numViews );
|
|
49244
|
-
|
|
49245
|
-
}
|
|
49246
|
-
|
|
49247
|
-
if ( useMultisample ) {
|
|
49248
|
-
|
|
49249
|
-
multiviewExt.framebufferTextureMultisampleMultiviewOVR( _gl.FRAMEBUFFER, glDepthAttachment, depthStencilTexture, 0, getRenderTargetSamples( renderTarget ), 0, numViews );
|
|
49250
|
-
|
|
49251
|
-
} else {
|
|
49252
|
-
|
|
49253
|
-
multiviewExt.framebufferTextureMultiviewOVR( _gl.FRAMEBUFFER, glDepthAttachment, depthStencilTexture, 0, 0, numViews );
|
|
49254
|
-
|
|
49255
|
-
}
|
|
49256
|
-
|
|
49257
|
-
} else if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {
|
|
48971
|
+
if ( renderTarget.depthBuffer ) {
|
|
49258
48972
|
|
|
49259
48973
|
// retrieve the depth attachment types
|
|
49260
48974
|
const depthTexture = renderTarget.depthTexture;
|
|
@@ -49345,85 +49059,37 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
49345
49059
|
}
|
|
49346
49060
|
|
|
49347
49061
|
setTexture2D( renderTarget.depthTexture, 0 );
|
|
49348
|
-
if ( renderTarget.depthTexture.image.depth != 1 ) {
|
|
49349
|
-
|
|
49350
|
-
setTexture2DArray( renderTarget.depthTexture, 0 );
|
|
49351
|
-
|
|
49352
|
-
} else {
|
|
49353
|
-
|
|
49354
|
-
setTexture2D( renderTarget.depthTexture, 0 );
|
|
49355
|
-
|
|
49356
|
-
}
|
|
49357
49062
|
|
|
49358
49063
|
const webglDepthTexture = textureProperties.__webglTexture;
|
|
49359
49064
|
const samples = getRenderTargetSamples( renderTarget );
|
|
49360
49065
|
|
|
49361
|
-
if ( renderTarget.
|
|
49362
|
-
|
|
49363
|
-
const useMultisample = useMultisampledRTT( renderTarget );
|
|
49364
|
-
const numViews = renderTarget.numViews;
|
|
49365
|
-
|
|
49366
|
-
if ( renderTarget.depthTexture.format === DepthFormat ) {
|
|
49367
|
-
|
|
49368
|
-
if ( useMultisample ) {
|
|
49369
|
-
|
|
49370
|
-
multiviewExt.framebufferTextureMultisampleMultiviewOVR( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, webglDepthTexture, 0, samples, 0, numViews );
|
|
49371
|
-
|
|
49372
|
-
} else {
|
|
49066
|
+
if ( renderTarget.depthTexture.format === DepthFormat ) {
|
|
49373
49067
|
|
|
49374
|
-
|
|
49068
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
49375
49069
|
|
|
49376
|
-
|
|
49070
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
|
|
49377
49071
|
|
|
49378
|
-
} else
|
|
49072
|
+
} else {
|
|
49379
49073
|
|
|
49380
|
-
|
|
49074
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
|
|
49381
49075
|
|
|
49382
|
-
|
|
49076
|
+
}
|
|
49383
49077
|
|
|
49384
|
-
|
|
49078
|
+
} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
|
|
49385
49079
|
|
|
49386
|
-
|
|
49080
|
+
if ( useMultisampledRTT( renderTarget ) ) {
|
|
49387
49081
|
|
|
49388
|
-
|
|
49082
|
+
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
|
|
49389
49083
|
|
|
49390
49084
|
} else {
|
|
49391
49085
|
|
|
49392
|
-
|
|
49086
|
+
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
|
|
49393
49087
|
|
|
49394
49088
|
}
|
|
49395
49089
|
|
|
49396
49090
|
} else {
|
|
49397
49091
|
|
|
49398
|
-
|
|
49399
|
-
|
|
49400
|
-
if ( useMultisampledRTT( renderTarget ) ) {
|
|
49401
|
-
|
|
49402
|
-
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
|
|
49403
|
-
|
|
49404
|
-
} else {
|
|
49405
|
-
|
|
49406
|
-
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
|
|
49407
|
-
|
|
49408
|
-
}
|
|
49409
|
-
|
|
49410
|
-
} else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
|
|
49411
|
-
|
|
49412
|
-
if ( useMultisampledRTT( renderTarget ) ) {
|
|
49413
|
-
|
|
49414
|
-
multisampledRTTExt.framebufferTexture2DMultisampleEXT( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0, samples );
|
|
49415
|
-
|
|
49416
|
-
} else {
|
|
49417
|
-
|
|
49418
|
-
_gl.framebufferTexture2D( _gl.FRAMEBUFFER, _gl.DEPTH_STENCIL_ATTACHMENT, _gl.TEXTURE_2D, webglDepthTexture, 0 );
|
|
49419
|
-
|
|
49420
|
-
}
|
|
49421
|
-
|
|
49422
|
-
} else {
|
|
49423
|
-
|
|
49424
|
-
throw new Error( 'Unknown depthTexture format' );
|
|
49425
|
-
|
|
49426
|
-
}
|
|
49092
|
+
throw new Error( 'Unknown depthTexture format' );
|
|
49427
49093
|
|
|
49428
49094
|
}
|
|
49429
49095
|
|
|
@@ -49738,12 +49404,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
49738
49404
|
|
|
49739
49405
|
}
|
|
49740
49406
|
|
|
49741
|
-
if ( renderTarget.isWebGLMultiviewRenderTarget === true ) {
|
|
49742
|
-
|
|
49743
|
-
glTextureType = _gl.TEXTURE_2D_ARRAY;
|
|
49744
|
-
|
|
49745
|
-
}
|
|
49746
|
-
|
|
49747
49407
|
state.bindTexture( glTextureType, textureProperties.__webglTexture );
|
|
49748
49408
|
setTextureParameters( glTextureType, texture );
|
|
49749
49409
|
|
|
@@ -49773,9 +49433,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
49773
49433
|
|
|
49774
49434
|
// Setup depth and stencil buffers
|
|
49775
49435
|
|
|
49776
|
-
if ( renderTarget.depthBuffer
|
|
49436
|
+
if ( renderTarget.depthBuffer ) {
|
|
49777
49437
|
|
|
49778
|
-
|
|
49438
|
+
setupDepthRenderbuffer( renderTarget );
|
|
49779
49439
|
|
|
49780
49440
|
}
|
|
49781
49441
|
|
|
@@ -50020,16 +49680,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
|
|
|
50020
49680
|
this.setTexture3D = setTexture3D;
|
|
50021
49681
|
this.setTextureCube = setTextureCube;
|
|
50022
49682
|
this.rebindTextures = rebindTextures;
|
|
50023
|
-
this.uploadTexture = uploadTexture;
|
|
50024
49683
|
this.setupRenderTarget = setupRenderTarget;
|
|
50025
49684
|
this.updateRenderTargetMipmap = updateRenderTargetMipmap;
|
|
50026
49685
|
this.updateMultisampleRenderTarget = updateMultisampleRenderTarget;
|
|
50027
|
-
this.setupDepthTexture = setupDepthTexture;
|
|
50028
49686
|
this.setupDepthRenderbuffer = setupDepthRenderbuffer;
|
|
50029
49687
|
this.setupFrameBufferTexture = setupFrameBufferTexture;
|
|
50030
49688
|
this.useMultisampledRTT = useMultisampledRTT;
|
|
50031
|
-
this.runDeferredUploads = runDeferredUploads;
|
|
50032
|
-
this.setDeferTextureUploads = setDeferTextureUploads;
|
|
50033
49689
|
|
|
50034
49690
|
}
|
|
50035
49691
|
|
|
@@ -50242,39 +49898,6 @@ function WebGLUtils( gl, extensions ) {
|
|
|
50242
49898
|
|
|
50243
49899
|
}
|
|
50244
49900
|
|
|
50245
|
-
/**
|
|
50246
|
-
* @author fernandojsg / http://fernandojsg.com
|
|
50247
|
-
* @author Takahiro https://github.com/takahirox
|
|
50248
|
-
*/
|
|
50249
|
-
|
|
50250
|
-
|
|
50251
|
-
class WebGLMultiviewRenderTarget extends WebGLRenderTarget {
|
|
50252
|
-
|
|
50253
|
-
constructor( width, height, numViews, options = {} ) {
|
|
50254
|
-
|
|
50255
|
-
super( width, height, options );
|
|
50256
|
-
|
|
50257
|
-
this.depthBuffer = false;
|
|
50258
|
-
this.stencilBuffer = false;
|
|
50259
|
-
|
|
50260
|
-
this.numViews = numViews;
|
|
50261
|
-
|
|
50262
|
-
}
|
|
50263
|
-
|
|
50264
|
-
copy( source ) {
|
|
50265
|
-
|
|
50266
|
-
super.copy( source );
|
|
50267
|
-
|
|
50268
|
-
this.numViews = source.numViews;
|
|
50269
|
-
|
|
50270
|
-
return this;
|
|
50271
|
-
|
|
50272
|
-
}
|
|
50273
|
-
|
|
50274
|
-
}
|
|
50275
|
-
|
|
50276
|
-
WebGLMultiviewRenderTarget.prototype.isWebGLMultiviewRenderTarget = true;
|
|
50277
|
-
|
|
50278
49901
|
const _occlusion_vertex = `
|
|
50279
49902
|
void main() {
|
|
50280
49903
|
|
|
@@ -50381,7 +50004,7 @@ class WebXRDepthSensing {
|
|
|
50381
50004
|
|
|
50382
50005
|
class WebXRManager extends EventDispatcher {
|
|
50383
50006
|
|
|
50384
|
-
constructor( renderer, gl
|
|
50007
|
+
constructor( renderer, gl ) {
|
|
50385
50008
|
|
|
50386
50009
|
super();
|
|
50387
50010
|
|
|
@@ -50390,7 +50013,6 @@ class WebXRManager extends EventDispatcher {
|
|
|
50390
50013
|
let session = null;
|
|
50391
50014
|
|
|
50392
50015
|
let framebufferScaleFactor = 1.0;
|
|
50393
|
-
var poseTarget = null;
|
|
50394
50016
|
|
|
50395
50017
|
let referenceSpace = null;
|
|
50396
50018
|
let referenceSpaceType = 'local-floor';
|
|
@@ -50399,8 +50021,6 @@ class WebXRManager extends EventDispatcher {
|
|
|
50399
50021
|
let customReferenceSpace = null;
|
|
50400
50022
|
|
|
50401
50023
|
let pose = null;
|
|
50402
|
-
var layers = [];
|
|
50403
|
-
|
|
50404
50024
|
let glBinding = null;
|
|
50405
50025
|
let glProjLayer = null;
|
|
50406
50026
|
let glBaseLayer = null;
|
|
@@ -50434,18 +50054,11 @@ class WebXRManager extends EventDispatcher {
|
|
|
50434
50054
|
let _currentDepthFar = null;
|
|
50435
50055
|
|
|
50436
50056
|
//
|
|
50057
|
+
|
|
50437
50058
|
this.cameraAutoUpdate = true;
|
|
50438
|
-
this.layersEnabled = false;
|
|
50439
50059
|
this.enabled = false;
|
|
50440
50060
|
|
|
50441
50061
|
this.isPresenting = false;
|
|
50442
|
-
this.isMultiview = false;
|
|
50443
|
-
|
|
50444
|
-
this.getCameraPose = function ( ) {
|
|
50445
|
-
|
|
50446
|
-
return pose;
|
|
50447
|
-
|
|
50448
|
-
};
|
|
50449
50062
|
|
|
50450
50063
|
this.getController = function ( index ) {
|
|
50451
50064
|
|
|
@@ -50614,12 +50227,6 @@ class WebXRManager extends EventDispatcher {
|
|
|
50614
50227
|
|
|
50615
50228
|
};
|
|
50616
50229
|
|
|
50617
|
-
this.getRenderTarget = function () {
|
|
50618
|
-
|
|
50619
|
-
return newRenderTarget;
|
|
50620
|
-
|
|
50621
|
-
};
|
|
50622
|
-
|
|
50623
50230
|
this.getFrame = function () {
|
|
50624
50231
|
|
|
50625
50232
|
return xrFrame;
|
|
@@ -50704,20 +50311,12 @@ class WebXRManager extends EventDispatcher {
|
|
|
50704
50311
|
|
|
50705
50312
|
}
|
|
50706
50313
|
|
|
50707
|
-
scope.isMultiview = useMultiview && extensions.has( 'OCULUS_multiview' );
|
|
50708
|
-
|
|
50709
50314
|
const projectionlayerInit = {
|
|
50710
50315
|
colorFormat: gl.RGBA8,
|
|
50711
50316
|
depthFormat: glDepthFormat,
|
|
50712
50317
|
scaleFactor: framebufferScaleFactor
|
|
50713
50318
|
};
|
|
50714
50319
|
|
|
50715
|
-
if ( scope.isMultiview ) {
|
|
50716
|
-
|
|
50717
|
-
projectionlayerInit.textureType = 'texture-array';
|
|
50718
|
-
|
|
50719
|
-
}
|
|
50720
|
-
|
|
50721
50320
|
glBinding = new XRWebGLBinding( session, gl );
|
|
50722
50321
|
|
|
50723
50322
|
glProjLayer = glBinding.createProjectionLayer( projectionlayerInit );
|
|
@@ -50727,32 +50326,18 @@ class WebXRManager extends EventDispatcher {
|
|
|
50727
50326
|
renderer.setPixelRatio( 1 );
|
|
50728
50327
|
renderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );
|
|
50729
50328
|
|
|
50730
|
-
|
|
50731
|
-
|
|
50732
|
-
|
|
50733
|
-
|
|
50734
|
-
|
|
50735
|
-
|
|
50736
|
-
|
|
50737
|
-
|
|
50738
|
-
|
|
50739
|
-
|
|
50740
|
-
|
|
50741
|
-
|
|
50742
|
-
const extension = extensions.get( 'OCULUS_multiview' );
|
|
50743
|
-
|
|
50744
|
-
this.maxNumViews = gl.getParameter( extension.MAX_VIEWS_OVR );
|
|
50745
|
-
|
|
50746
|
-
newRenderTarget = new WebGLMultiviewRenderTarget( glProjLayer.textureWidth, glProjLayer.textureHeight, 2, renderTargetOptions );
|
|
50747
|
-
|
|
50748
|
-
} else {
|
|
50749
|
-
|
|
50750
|
-
newRenderTarget = new WebGLRenderTarget(
|
|
50751
|
-
glProjLayer.textureWidth,
|
|
50752
|
-
glProjLayer.textureHeight,
|
|
50753
|
-
renderTargetOptions );
|
|
50754
|
-
|
|
50755
|
-
}
|
|
50329
|
+
newRenderTarget = new WebGLRenderTarget(
|
|
50330
|
+
glProjLayer.textureWidth,
|
|
50331
|
+
glProjLayer.textureHeight,
|
|
50332
|
+
{
|
|
50333
|
+
format: RGBAFormat,
|
|
50334
|
+
type: UnsignedByteType,
|
|
50335
|
+
depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
|
|
50336
|
+
stencilBuffer: attributes.stencil,
|
|
50337
|
+
colorSpace: renderer.outputColorSpace,
|
|
50338
|
+
samples: attributes.antialias ? 4 : 0,
|
|
50339
|
+
resolveDepthBuffer: ( glProjLayer.ignoreDepthValues === false )
|
|
50340
|
+
} );
|
|
50756
50341
|
|
|
50757
50342
|
}
|
|
50758
50343
|
|
|
@@ -50781,28 +50366,7 @@ class WebXRManager extends EventDispatcher {
|
|
|
50781
50366
|
return session.environmentBlendMode;
|
|
50782
50367
|
|
|
50783
50368
|
}
|
|
50784
|
-
};
|
|
50785
|
-
|
|
50786
|
-
this.addLayer = function(layer) {
|
|
50787
|
-
if (!window.XRWebGLBinding || !this.layersEnabled || !session) { return; }
|
|
50788
|
-
|
|
50789
|
-
layers.push( layer );
|
|
50790
|
-
this.updateLayers();
|
|
50791
|
-
};
|
|
50792
|
-
|
|
50793
|
-
this.removeLayer = function(layer) {
|
|
50794
|
-
|
|
50795
|
-
layers.splice( layers.indexOf(layer), 1 );
|
|
50796
|
-
if (!window.XRWebGLBinding || !this.layersEnabled || !session) { return; }
|
|
50797
|
-
|
|
50798
|
-
this.updateLayers();
|
|
50799
|
-
};
|
|
50800
|
-
|
|
50801
|
-
this.updateLayers = function() {
|
|
50802
|
-
var layersCopy = layers.map(function (x) { return x; });
|
|
50803
50369
|
|
|
50804
|
-
layersCopy.unshift( session.renderState.layers[0] );
|
|
50805
|
-
session.updateRenderState( { layers: layersCopy } );
|
|
50806
50370
|
};
|
|
50807
50371
|
|
|
50808
50372
|
this.getDepthTexture = function () {
|
|
@@ -50971,12 +50535,6 @@ class WebXRManager extends EventDispatcher {
|
|
|
50971
50535
|
|
|
50972
50536
|
}
|
|
50973
50537
|
|
|
50974
|
-
this.setPoseTarget = function ( object ) {
|
|
50975
|
-
|
|
50976
|
-
if ( object !== undefined ) poseTarget = object;
|
|
50977
|
-
|
|
50978
|
-
};
|
|
50979
|
-
|
|
50980
50538
|
this.updateCamera = function ( camera ) {
|
|
50981
50539
|
|
|
50982
50540
|
if ( session === null ) return;
|
|
@@ -51012,9 +50570,8 @@ class WebXRManager extends EventDispatcher {
|
|
|
51012
50570
|
cameraR.layers.mask = camera.layers.mask | 0b100;
|
|
51013
50571
|
cameraXR.layers.mask = cameraL.layers.mask | cameraR.layers.mask;
|
|
51014
50572
|
|
|
50573
|
+
const parent = camera.parent;
|
|
51015
50574
|
const cameras = cameraXR.cameras;
|
|
51016
|
-
var object = poseTarget || camera;
|
|
51017
|
-
const parent = object.parent;
|
|
51018
50575
|
|
|
51019
50576
|
updateCamera( cameraXR, parent );
|
|
51020
50577
|
|
|
@@ -51038,28 +50595,28 @@ class WebXRManager extends EventDispatcher {
|
|
|
51038
50595
|
|
|
51039
50596
|
}
|
|
51040
50597
|
|
|
51041
|
-
|
|
50598
|
+
// update user camera and its children
|
|
51042
50599
|
|
|
51043
|
-
|
|
50600
|
+
updateUserCamera( camera, cameraXR, parent );
|
|
51044
50601
|
|
|
51045
|
-
|
|
50602
|
+
};
|
|
51046
50603
|
|
|
51047
|
-
|
|
50604
|
+
function updateUserCamera( camera, cameraXR, parent ) {
|
|
51048
50605
|
|
|
51049
|
-
if (
|
|
50606
|
+
if ( parent === null ) {
|
|
51050
50607
|
|
|
51051
|
-
|
|
50608
|
+
camera.matrix.copy( cameraXR.matrixWorld );
|
|
51052
50609
|
|
|
51053
50610
|
} else {
|
|
51054
50611
|
|
|
51055
|
-
|
|
51056
|
-
|
|
51057
|
-
|
|
50612
|
+
camera.matrix.copy( parent.matrixWorld );
|
|
50613
|
+
camera.matrix.invert();
|
|
50614
|
+
camera.matrix.multiply( cameraXR.matrixWorld );
|
|
51058
50615
|
|
|
51059
50616
|
}
|
|
51060
50617
|
|
|
51061
|
-
|
|
51062
|
-
|
|
50618
|
+
camera.matrix.decompose( camera.position, camera.quaternion, camera.scale );
|
|
50619
|
+
camera.updateMatrixWorld( true );
|
|
51063
50620
|
|
|
51064
50621
|
camera.projectionMatrix.copy( cameraXR.projectionMatrix );
|
|
51065
50622
|
camera.projectionMatrixInverse.copy( cameraXR.projectionMatrixInverse );
|
|
@@ -52271,7 +51828,6 @@ class WebGLRenderer {
|
|
|
52271
51828
|
powerPreference = 'default',
|
|
52272
51829
|
failIfMajorPerformanceCaveat = false,
|
|
52273
51830
|
reverseDepthBuffer = false,
|
|
52274
|
-
multiviewStereo = false,
|
|
52275
51831
|
} = parameters;
|
|
52276
51832
|
|
|
52277
51833
|
this.isWebGLRenderer = true;
|
|
@@ -52479,7 +52035,6 @@ class WebGLRenderer {
|
|
|
52479
52035
|
let extensions, capabilities, state, info;
|
|
52480
52036
|
let properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;
|
|
52481
52037
|
let programCache, materials, renderLists, renderStates, clipping, shadowMap;
|
|
52482
|
-
let multiview;
|
|
52483
52038
|
|
|
52484
52039
|
let background, morphtargets, bufferRenderer, indexedBufferRenderer;
|
|
52485
52040
|
|
|
@@ -52518,7 +52073,6 @@ class WebGLRenderer {
|
|
|
52518
52073
|
renderLists = new WebGLRenderLists();
|
|
52519
52074
|
renderStates = new WebGLRenderStates( extensions );
|
|
52520
52075
|
background = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );
|
|
52521
|
-
multiview = new WebGLMultiview( _this, extensions, _gl );
|
|
52522
52076
|
shadowMap = new WebGLShadowMap( _this, objects, capabilities );
|
|
52523
52077
|
uniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );
|
|
52524
52078
|
|
|
@@ -53455,21 +53009,11 @@ class WebGLRenderer {
|
|
|
53455
53009
|
|
|
53456
53010
|
if ( _renderBackground ) background.render( scene );
|
|
53457
53011
|
|
|
53458
|
-
|
|
53012
|
+
for ( let i = 0, l = cameras.length; i < l; i ++ ) {
|
|
53459
53013
|
|
|
53460
|
-
|
|
53014
|
+
const camera2 = cameras[ i ];
|
|
53461
53015
|
|
|
53462
|
-
renderScene( currentRenderList, scene,
|
|
53463
|
-
|
|
53464
|
-
} else {
|
|
53465
|
-
|
|
53466
|
-
for ( let i = 0, l = cameras.length; i < l; i ++ ) {
|
|
53467
|
-
|
|
53468
|
-
const camera2 = cameras[ i ];
|
|
53469
|
-
|
|
53470
|
-
renderScene( currentRenderList, scene, camera2, camera2.viewport );
|
|
53471
|
-
|
|
53472
|
-
}
|
|
53016
|
+
renderScene( currentRenderList, scene, camera2, camera2.viewport );
|
|
53473
53017
|
|
|
53474
53018
|
}
|
|
53475
53019
|
|
|
@@ -53995,7 +53539,6 @@ class WebGLRenderer {
|
|
|
53995
53539
|
materialProperties.vertexAlphas = parameters.vertexAlphas;
|
|
53996
53540
|
materialProperties.vertexTangents = parameters.vertexTangents;
|
|
53997
53541
|
materialProperties.toneMapping = parameters.toneMapping;
|
|
53998
|
-
materialProperties.numMultiviewViews = parameters.numMultiviewViews;
|
|
53999
53542
|
|
|
54000
53543
|
}
|
|
54001
53544
|
|
|
@@ -54027,8 +53570,6 @@ class WebGLRenderer {
|
|
|
54027
53570
|
|
|
54028
53571
|
}
|
|
54029
53572
|
|
|
54030
|
-
const numMultiviewViews = _currentRenderTarget && _currentRenderTarget.isWebGLMultiviewRenderTarget ? _currentRenderTarget.numViews : 0;
|
|
54031
|
-
|
|
54032
53573
|
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
|
|
54033
53574
|
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
|
|
54034
53575
|
|
|
@@ -54156,10 +53697,6 @@ class WebGLRenderer {
|
|
|
54156
53697
|
|
|
54157
53698
|
needsProgramChange = true;
|
|
54158
53699
|
|
|
54159
|
-
} else if ( materialProperties.numMultiviewViews !== numMultiviewViews ) {
|
|
54160
|
-
|
|
54161
|
-
needsProgramChange = true;
|
|
54162
|
-
|
|
54163
53700
|
}
|
|
54164
53701
|
|
|
54165
53702
|
} else {
|
|
@@ -54206,34 +53743,25 @@ class WebGLRenderer {
|
|
|
54206
53743
|
|
|
54207
53744
|
// common camera uniforms
|
|
54208
53745
|
|
|
54209
|
-
|
|
54210
|
-
|
|
54211
|
-
multiview.updateCameraProjectionMatricesUniform( camera, p_uniforms );
|
|
54212
|
-
multiview.updateCameraViewMatricesUniform( camera, p_uniforms );
|
|
54213
|
-
|
|
54214
|
-
} else {
|
|
54215
|
-
|
|
54216
|
-
const reverseDepthBuffer = state.buffers.depth.getReversed();
|
|
53746
|
+
const reverseDepthBuffer = state.buffers.depth.getReversed();
|
|
54217
53747
|
|
|
54218
|
-
|
|
53748
|
+
if ( reverseDepthBuffer ) {
|
|
54219
53749
|
|
|
54220
|
-
|
|
53750
|
+
_currentProjectionMatrix.copy( camera.projectionMatrix );
|
|
54221
53751
|
|
|
54222
|
-
|
|
54223
|
-
|
|
53752
|
+
toNormalizedProjectionMatrix( _currentProjectionMatrix );
|
|
53753
|
+
toReversedProjectionMatrix( _currentProjectionMatrix );
|
|
54224
53754
|
|
|
54225
|
-
|
|
53755
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', _currentProjectionMatrix );
|
|
54226
53756
|
|
|
54227
|
-
|
|
54228
|
-
|
|
54229
|
-
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
54230
|
-
|
|
54231
|
-
}
|
|
53757
|
+
} else {
|
|
54232
53758
|
|
|
54233
|
-
p_uniforms.setValue( _gl, '
|
|
53759
|
+
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
|
|
54234
53760
|
|
|
54235
53761
|
}
|
|
54236
53762
|
|
|
53763
|
+
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
|
|
53764
|
+
|
|
54237
53765
|
const uCamPos = p_uniforms.map.cameraPosition;
|
|
54238
53766
|
|
|
54239
53767
|
if ( uCamPos !== undefined ) {
|
|
@@ -54394,17 +53922,8 @@ class WebGLRenderer {
|
|
|
54394
53922
|
|
|
54395
53923
|
// common matrices
|
|
54396
53924
|
|
|
54397
|
-
|
|
54398
|
-
|
|
54399
|
-
multiview.updateObjectMatricesUniforms( object, camera, p_uniforms );
|
|
54400
|
-
|
|
54401
|
-
} else {
|
|
54402
|
-
|
|
54403
|
-
p_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );
|
|
54404
|
-
p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );
|
|
54405
|
-
|
|
54406
|
-
}
|
|
54407
|
-
|
|
53925
|
+
p_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );
|
|
53926
|
+
p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );
|
|
54408
53927
|
p_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );
|
|
54409
53928
|
|
|
54410
53929
|
// UBOs
|
|
@@ -54454,32 +53973,6 @@ class WebGLRenderer {
|
|
|
54454
53973
|
|
|
54455
53974
|
}
|
|
54456
53975
|
|
|
54457
|
-
this.setTexture2D = ( function () {
|
|
54458
|
-
|
|
54459
|
-
var warned = false;
|
|
54460
|
-
|
|
54461
|
-
// backwards compatibility: peel texture.texture
|
|
54462
|
-
return function setTexture2D( texture, slot ) {
|
|
54463
|
-
|
|
54464
|
-
if ( texture && texture.isWebGLRenderTarget ) {
|
|
54465
|
-
|
|
54466
|
-
if ( ! warned ) {
|
|
54467
|
-
|
|
54468
|
-
console.warn( "THREE.WebGLRenderer.setTexture2D: don't use render targets as textures. Use their .texture property instead." );
|
|
54469
|
-
warned = true;
|
|
54470
|
-
|
|
54471
|
-
}
|
|
54472
|
-
|
|
54473
|
-
texture = texture.texture;
|
|
54474
|
-
|
|
54475
|
-
}
|
|
54476
|
-
|
|
54477
|
-
textures.setTexture2D( texture, slot );
|
|
54478
|
-
|
|
54479
|
-
};
|
|
54480
|
-
|
|
54481
|
-
}() );
|
|
54482
|
-
|
|
54483
53976
|
this.getActiveCubeFace = function () {
|
|
54484
53977
|
|
|
54485
53978
|
return _currentActiveCubeFace;
|
|
@@ -54508,7 +54001,7 @@ class WebGLRenderer {
|
|
|
54508
54001
|
|
|
54509
54002
|
renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
|
|
54510
54003
|
|
|
54511
|
-
if ( ! renderTargetProperties.__autoAllocateDepthBuffer
|
|
54004
|
+
if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
|
|
54512
54005
|
|
|
54513
54006
|
// The multisample_render_to_texture extension doesn't work properly if there
|
|
54514
54007
|
// are midframe flushes and an external depth buffer. Disable use of the extension.
|
|
@@ -54534,13 +54027,6 @@ class WebGLRenderer {
|
|
|
54534
54027
|
const _scratchFrameBuffer = _gl.createFramebuffer();
|
|
54535
54028
|
this.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {
|
|
54536
54029
|
|
|
54537
|
-
// Render to base layer instead of canvas in WebXR
|
|
54538
|
-
if ( renderTarget === null && this.xr.isPresenting ) {
|
|
54539
|
-
|
|
54540
|
-
renderTarget = this.xr.getRenderTarget();
|
|
54541
|
-
|
|
54542
|
-
}
|
|
54543
|
-
|
|
54544
54030
|
_currentRenderTarget = renderTarget;
|
|
54545
54031
|
_currentActiveCubeFace = activeCubeFace;
|
|
54546
54032
|
_currentActiveMipmapLevel = activeMipmapLevel;
|