super-three 0.162.0 → 0.163.0

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.
Files changed (122) hide show
  1. package/build/three.cjs +407 -1014
  2. package/build/three.module.js +406 -1013
  3. package/build/three.module.min.js +1 -1
  4. package/examples/jsm/controls/TransformControls.js +3 -3
  5. package/examples/jsm/exporters/GLTFExporter.js +21 -4
  6. package/examples/jsm/exporters/USDZExporter.js +15 -0
  7. package/examples/jsm/geometries/TextGeometry.js +10 -2
  8. package/examples/jsm/interactive/HTMLMesh.js +7 -9
  9. package/examples/jsm/libs/fflate.module.js +694 -496
  10. package/examples/jsm/lines/LineMaterial.js +0 -2
  11. package/examples/jsm/loaders/3MFLoader.js +2 -0
  12. package/examples/jsm/loaders/EXRLoader.js +89 -19
  13. package/examples/jsm/loaders/FBXLoader.js +1 -1
  14. package/examples/jsm/loaders/GLTFLoader.js +6 -0
  15. package/examples/jsm/loaders/KTX2Loader.js +2 -6
  16. package/examples/jsm/loaders/LUT3dlLoader.js +0 -15
  17. package/examples/jsm/loaders/LUTCubeLoader.js +0 -14
  18. package/examples/jsm/loaders/LUTImageLoader.js +0 -14
  19. package/examples/jsm/loaders/RGBMLoader.js +16 -0
  20. package/examples/jsm/misc/GPUComputationRenderer.js +0 -6
  21. package/examples/jsm/nodes/Nodes.js +6 -1
  22. package/examples/jsm/nodes/accessors/BatchNode.js +78 -0
  23. package/examples/jsm/nodes/accessors/InstanceNode.js +25 -2
  24. package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +1 -1
  25. package/examples/jsm/nodes/accessors/MorphNode.js +13 -3
  26. package/examples/jsm/nodes/accessors/NormalNode.js +12 -2
  27. package/examples/jsm/nodes/accessors/ReferenceNode.js +1 -1
  28. package/examples/jsm/nodes/accessors/RendererReferenceNode.js +29 -0
  29. package/examples/jsm/nodes/accessors/TextureNode.js +30 -7
  30. package/examples/jsm/nodes/core/Node.js +55 -4
  31. package/examples/jsm/nodes/core/NodeBuilder.js +21 -16
  32. package/examples/jsm/nodes/core/NodeFrame.js +10 -10
  33. package/examples/jsm/nodes/core/NodeUtils.js +2 -2
  34. package/examples/jsm/nodes/core/UniformNode.js +20 -0
  35. package/examples/jsm/nodes/display/PassNode.js +17 -1
  36. package/examples/jsm/nodes/display/ToneMappingNode.js +8 -4
  37. package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +6 -0
  38. package/examples/jsm/nodes/fog/FogExp2Node.js +4 -5
  39. package/examples/jsm/nodes/fog/FogNode.js +13 -3
  40. package/examples/jsm/nodes/fog/FogRangeNode.js +4 -3
  41. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +1 -1
  42. package/examples/jsm/nodes/lighting/EnvironmentNode.js +12 -69
  43. package/examples/jsm/nodes/materials/NodeMaterial.js +33 -11
  44. package/examples/jsm/nodes/pmrem/PMREMNode.js +193 -0
  45. package/examples/jsm/nodes/pmrem/PMREMUtils.js +288 -0
  46. package/examples/jsm/nodes/shadernode/ShaderNode.js +1 -1
  47. package/examples/jsm/nodes/utils/EquirectUVNode.js +1 -1
  48. package/examples/jsm/objects/QuadMesh.js +7 -23
  49. package/examples/jsm/physics/RapierPhysics.js +4 -4
  50. package/examples/jsm/postprocessing/GlitchPass.js +0 -3
  51. package/examples/jsm/postprocessing/LUTPass.js +5 -71
  52. package/examples/jsm/postprocessing/SAOPass.js +0 -1
  53. package/examples/jsm/postprocessing/SSAOPass.js +0 -3
  54. package/examples/jsm/renderers/common/Animation.js +3 -0
  55. package/examples/jsm/renderers/common/Background.js +5 -5
  56. package/examples/jsm/renderers/common/Info.js +11 -19
  57. package/examples/jsm/renderers/common/PostProcessing.js +12 -4
  58. package/examples/jsm/renderers/common/RenderContext.js +1 -1
  59. package/examples/jsm/renderers/common/RenderObject.js +4 -4
  60. package/examples/jsm/renderers/common/RenderObjects.js +1 -1
  61. package/examples/jsm/renderers/common/Renderer.js +25 -8
  62. package/examples/jsm/renderers/common/extras/PMREMGenerator.js +777 -0
  63. package/examples/jsm/renderers/common/nodes/Nodes.js +5 -18
  64. package/examples/jsm/renderers/webgl/WebGLBackend.js +148 -24
  65. package/examples/jsm/renderers/webgl/WebGLBufferRenderer.js +141 -0
  66. package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +3 -3
  67. package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +1 -1
  68. package/examples/jsm/renderers/webgl/utils/WebGLConstants.js +1 -0
  69. package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +43 -0
  70. package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +3 -2
  71. package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +0 -2
  72. package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +0 -2
  73. package/examples/jsm/renderers/webgpu/WebGPUBackend.js +54 -25
  74. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +5 -3
  75. package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +25 -0
  76. package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +18 -4
  77. package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +92 -18
  78. package/examples/jsm/utils/GPUStatsPanel.js +10 -45
  79. package/examples/jsm/utils/TextureUtils.js +1 -1
  80. package/package.json +1 -1
  81. package/src/Three.js +0 -1
  82. package/src/animation/AnimationClip.js +1 -1
  83. package/src/constants.js +3 -3
  84. package/src/core/Object3D.js +10 -7
  85. package/src/extras/PMREMGenerator.js +9 -0
  86. package/src/loaders/ObjectLoader.js +2 -0
  87. package/src/materials/ShaderMaterial.js +0 -4
  88. package/src/math/Spherical.js +4 -5
  89. package/src/objects/BatchedMesh.js +4 -3
  90. package/src/objects/InstancedMesh.js +10 -0
  91. package/src/renderers/WebGLRenderer.js +55 -114
  92. package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +2 -2
  93. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
  94. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +2 -10
  95. package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +2 -16
  96. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +32 -22
  97. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +1 -1
  98. package/src/renderers/shaders/ShaderLib.js +1 -1
  99. package/src/renderers/shaders/UniformsUtils.js +10 -1
  100. package/src/renderers/webgl/WebGLAttributes.js +6 -33
  101. package/src/renderers/webgl/WebGLBindingStates.js +14 -51
  102. package/src/renderers/webgl/WebGLBufferRenderer.js +3 -25
  103. package/src/renderers/webgl/WebGLCapabilities.js +2 -12
  104. package/src/renderers/webgl/WebGLCubeUVMaps.js +10 -6
  105. package/src/renderers/webgl/WebGLExtensions.js +4 -19
  106. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +3 -25
  107. package/src/renderers/webgl/WebGLLights.js +6 -32
  108. package/src/renderers/webgl/WebGLMaterials.js +2 -3
  109. package/src/renderers/webgl/WebGLMorphtargets.js +79 -217
  110. package/src/renderers/webgl/WebGLProgram.js +18 -47
  111. package/src/renderers/webgl/WebGLPrograms.js +20 -32
  112. package/src/renderers/webgl/WebGLRenderStates.js +8 -6
  113. package/src/renderers/webgl/WebGLState.js +15 -59
  114. package/src/renderers/webgl/WebGLTextures.js +75 -237
  115. package/src/renderers/webgl/WebGLUniformsGroups.js +1 -1
  116. package/src/renderers/webgl/WebGLUtils.js +6 -57
  117. package/src/renderers/webxr/WebXRDepthSensing.js +2 -3
  118. package/src/renderers/webxr/WebXRManager.js +2 -2
  119. package/src/scenes/Scene.js +7 -1
  120. package/src/textures/Texture.js +11 -1
  121. package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +0 -37
  122. package/src/renderers/WebGL1Renderer.js +0 -7
@@ -3,7 +3,7 @@
3
3
  * Copyright 2010-2023 Three.js Authors
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
- const REVISION = '162';
6
+ const REVISION = '163';
7
7
 
8
8
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
9
9
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
@@ -96,7 +96,9 @@ const HalfFloatType = 1016;
96
96
  const UnsignedShort4444Type = 1017;
97
97
  const UnsignedShort5551Type = 1018;
98
98
  const UnsignedInt248Type = 1020;
99
+ const UnsignedInt5999Type = 35902;
99
100
  const AlphaFormat = 1021;
101
+ const RGBFormat = 1022;
100
102
  const RGBAFormat = 1023;
101
103
  const LuminanceFormat = 1024;
102
104
  const LuminanceAlphaFormat = 1025;
@@ -212,8 +214,6 @@ const StreamCopyUsage = 35042;
212
214
  const GLSL1 = '100';
213
215
  const GLSL3 = '300 es';
214
216
 
215
- const _SRGBAFormat = 1035; // fallback for WebGL 1
216
-
217
217
  const WebGLCoordinateSystem = 2000;
218
218
  const WebGPUCoordinateSystem = 2001;
219
219
 
@@ -2001,7 +2001,7 @@ class Texture extends EventDispatcher {
2001
2001
  this.onUpdate = null;
2002
2002
 
2003
2003
  this.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not
2004
- this.needsPMREMUpdate = false; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)
2004
+ this.pmremVersion = 0; // indicates whether this texture should be processed by PMREMGenerator or not (only relevant for render target textures)
2005
2005
 
2006
2006
  }
2007
2007
 
@@ -2232,6 +2232,16 @@ class Texture extends EventDispatcher {
2232
2232
 
2233
2233
  }
2234
2234
 
2235
+ set needsPMREMUpdate( value ) {
2236
+
2237
+ if ( value === true ) {
2238
+
2239
+ this.pmremVersion ++;
2240
+
2241
+ }
2242
+
2243
+ }
2244
+
2235
2245
  }
2236
2246
 
2237
2247
  Texture.DEFAULT_IMAGE = null;
@@ -7400,12 +7410,7 @@ class Object3D extends EventDispatcher {
7400
7410
 
7401
7411
  if ( object && object.isObject3D ) {
7402
7412
 
7403
- if ( object.parent !== null ) {
7404
-
7405
- object.parent.remove( object );
7406
-
7407
- }
7408
-
7413
+ object.removeFromParent();
7409
7414
  object.parent = this;
7410
7415
  this.children.push( object );
7411
7416
 
@@ -7498,10 +7503,18 @@ class Object3D extends EventDispatcher {
7498
7503
 
7499
7504
  object.applyMatrix4( _m1$3 );
7500
7505
 
7501
- this.add( object );
7506
+ object.removeFromParent();
7507
+ object.parent = this;
7508
+ this.children.push( object );
7502
7509
 
7503
7510
  object.updateWorldMatrix( false, true );
7504
7511
 
7512
+ object.dispatchEvent( _addedEvent );
7513
+
7514
+ _childaddedEvent.child = object;
7515
+ this.dispatchEvent( _childaddedEvent );
7516
+ _childaddedEvent.child = null;
7517
+
7505
7518
  return this;
7506
7519
 
7507
7520
  }
@@ -12128,13 +12141,22 @@ function cloneUniformsGroups( src ) {
12128
12141
 
12129
12142
  function getUnlitUniformColorSpace( renderer ) {
12130
12143
 
12131
- if ( renderer.getRenderTarget() === null ) {
12144
+ const currentRenderTarget = renderer.getRenderTarget();
12145
+
12146
+ if ( currentRenderTarget === null ) {
12132
12147
 
12133
12148
  // https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398
12134
12149
  return renderer.outputColorSpace;
12135
12150
 
12136
12151
  }
12137
12152
 
12153
+ // https://github.com/mrdoob/three.js/issues/27868
12154
+ if ( currentRenderTarget.isXRRenderTarget === true ) {
12155
+
12156
+ return currentRenderTarget.texture.colorSpace;
12157
+
12158
+ }
12159
+
12138
12160
  return ColorManagement.workingColorSpace;
12139
12161
 
12140
12162
  }
@@ -12176,10 +12198,6 @@ class ShaderMaterial extends Material {
12176
12198
  this.forceSinglePass = true;
12177
12199
 
12178
12200
  this.extensions = {
12179
- derivatives: false, // set to use derivatives
12180
- fragDepth: false, // set to use fragment depth values
12181
- drawBuffers: false, // set to use draw buffers
12182
- shaderTextureLOD: false, // set to use shader texture LOD
12183
12201
  clipCullDistance: false, // set to use vertex shader clipping
12184
12202
  multiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID
12185
12203
  };
@@ -13420,9 +13438,7 @@ function WebGLAnimation() {
13420
13438
 
13421
13439
  }
13422
13440
 
13423
- function WebGLAttributes( gl, capabilities ) {
13424
-
13425
- const isWebGL2 = capabilities.isWebGL2;
13441
+ function WebGLAttributes( gl ) {
13426
13442
 
13427
13443
  const buffers = new WeakMap();
13428
13444
 
@@ -13449,15 +13465,7 @@ function WebGLAttributes( gl, capabilities ) {
13449
13465
 
13450
13466
  if ( attribute.isFloat16BufferAttribute ) {
13451
13467
 
13452
- if ( isWebGL2 ) {
13453
-
13454
- type = gl.HALF_FLOAT;
13455
-
13456
- } else {
13457
-
13458
- throw new Error( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );
13459
-
13460
- }
13468
+ type = gl.HALF_FLOAT;
13461
13469
 
13462
13470
  } else {
13463
13471
 
@@ -13525,17 +13533,9 @@ function WebGLAttributes( gl, capabilities ) {
13525
13533
  for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
13526
13534
 
13527
13535
  const range = updateRanges[ i ];
13528
- if ( isWebGL2 ) {
13529
13536
 
13530
- gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
13531
- array, range.start, range.count );
13532
-
13533
- } else {
13534
-
13535
- gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
13536
- array.subarray( range.start, range.start + range.count ) );
13537
-
13538
- }
13537
+ gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
13538
+ array, range.start, range.count );
13539
13539
 
13540
13540
  }
13541
13541
 
@@ -13546,17 +13546,8 @@ function WebGLAttributes( gl, capabilities ) {
13546
13546
  // @deprecated, r159
13547
13547
  if ( updateRange.count !== - 1 ) {
13548
13548
 
13549
- if ( isWebGL2 ) {
13550
-
13551
- gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
13552
- array, updateRange.offset, updateRange.count );
13553
-
13554
- } else {
13555
-
13556
- gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
13557
- array.subarray( updateRange.offset, updateRange.offset + updateRange.count ) );
13558
-
13559
- }
13549
+ gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
13550
+ array, updateRange.offset, updateRange.count );
13560
13551
 
13561
13552
  updateRange.count = - 1; // reset range
13562
13553
 
@@ -13855,13 +13846,13 @@ var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGH
13855
13846
 
13856
13847
  var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";
13857
13848
 
13858
- var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
13849
+ var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF )\n\tgl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
13859
13850
 
13860
- var logdepthbuf_pars_fragment = "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
13851
+ var logdepthbuf_pars_fragment = "#if defined( USE_LOGDEPTHBUF )\n\tuniform float logDepthBufFC;\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
13861
13852
 
13862
- var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvarying float vFragDepth;\n\t\tvarying float vIsPerspective;\n\t#else\n\t\tuniform float logDepthBufFC;\n\t#endif\n#endif";
13853
+ var logdepthbuf_pars_vertex = "#ifdef USE_LOGDEPTHBUF\n\tvarying float vFragDepth;\n\tvarying float vIsPerspective;\n#endif";
13863
13854
 
13864
- var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif";
13855
+ var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\tvFragDepth = 1.0 + gl_Position.w;\n\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n#endif";
13865
13856
 
13866
13857
  var map_fragment = "#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
13867
13858
 
@@ -13921,7 +13912,7 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
13921
13912
 
13922
13913
  var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
13923
13914
 
13924
- var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif";
13915
+ var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n\tuniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;\n\t\tbool frustumTest = inFrustum && shadowCoord.z <= 1.0;\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tfloat shadow = 1.0;\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\t\n\t\tfloat lightToPositionLength = length( lightToPosition );\n\t\tif ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {\n\t\t\tfloat dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\t\tdp += shadowBias;\n\t\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\t\tshadow = (\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t\t) * ( 1.0 / 9.0 );\n\t\t\t#else\n\t\t\t\tshadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n#endif";
13925
13916
 
13926
13917
  var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n\tuniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n\tvarying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
13927
13918
 
@@ -13943,7 +13934,7 @@ var specularmap_pars_fragment = "#ifdef USE_SPECULARMAP\n\tuniform sampler2D spe
13943
13934
 
13944
13935
  var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
13945
13936
 
13946
- var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tfloat startCompression = 0.8 - 0.04;\n\tfloat desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min(color.r, min(color.g, color.b));\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max(color.r, max(color.g, color.b));\n\tif (peak < startCompression) return color;\n\tfloat d = 1. - startCompression;\n\tfloat newPeak = 1. - d * d / (peak + d - startCompression);\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n\treturn mix(color, vec3(1, 1, 1), g);\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
13937
+ var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tfloat startCompression = 0.8 - 0.04;\n\tfloat desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min(color.r, min(color.g, color.b));\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max(color.r, max(color.g, color.b));\n\tif (peak < startCompression) return color;\n\tfloat d = 1. - startCompression;\n\tfloat newPeak = 1. - d * d / (peak + d - startCompression);\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n\treturn mix(color, newPeak * vec3(1, 1, 1), g);\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
13947
13938
 
13948
13939
  var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmitted = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );\n#endif";
13949
13940
 
@@ -14484,7 +14475,7 @@ const ShaderLib = {
14484
14475
  emissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },
14485
14476
  roughness: { value: 1.0 },
14486
14477
  metalness: { value: 0.0 },
14487
- envMapIntensity: { value: 1 } // temporary
14478
+ envMapIntensity: { value: 1 }
14488
14479
  }
14489
14480
  ] ),
14490
14481
 
@@ -14990,13 +14981,10 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
14990
14981
 
14991
14982
  }
14992
14983
 
14993
- function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
14984
+ function WebGLBindingStates( gl, attributes ) {
14994
14985
 
14995
14986
  const maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );
14996
14987
 
14997
- const extension = capabilities.isWebGL2 ? null : extensions.get( 'OES_vertex_array_object' );
14998
- const vaoAvailable = capabilities.isWebGL2 || extension !== null;
14999
-
15000
14988
  const bindingStates = {};
15001
14989
 
15002
14990
  const defaultState = createBindingState( null );
@@ -15007,38 +14995,18 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
15007
14995
 
15008
14996
  let updateBuffers = false;
15009
14997
 
15010
- if ( vaoAvailable ) {
15011
-
15012
- const state = getBindingState( geometry, program, material );
15013
-
15014
- if ( currentState !== state ) {
15015
-
15016
- currentState = state;
15017
- bindVertexArrayObject( currentState.object );
14998
+ const state = getBindingState( geometry, program, material );
15018
14999
 
15019
- }
15020
-
15021
- updateBuffers = needsUpdate( object, geometry, program, index );
15022
-
15023
- if ( updateBuffers ) saveCache( object, geometry, program, index );
15024
-
15025
- } else {
15000
+ if ( currentState !== state ) {
15026
15001
 
15027
- const wireframe = ( material.wireframe === true );
15002
+ currentState = state;
15003
+ bindVertexArrayObject( currentState.object );
15028
15004
 
15029
- if ( currentState.geometry !== geometry.id ||
15030
- currentState.program !== program.id ||
15031
- currentState.wireframe !== wireframe ) {
15032
-
15033
- currentState.geometry = geometry.id;
15034
- currentState.program = program.id;
15035
- currentState.wireframe = wireframe;
15005
+ }
15036
15006
 
15037
- updateBuffers = true;
15007
+ updateBuffers = needsUpdate( object, geometry, program, index );
15038
15008
 
15039
- }
15040
-
15041
- }
15009
+ if ( updateBuffers ) saveCache( object, geometry, program, index );
15042
15010
 
15043
15011
  if ( index !== null ) {
15044
15012
 
@@ -15064,25 +15032,19 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
15064
15032
 
15065
15033
  function createVertexArrayObject() {
15066
15034
 
15067
- if ( capabilities.isWebGL2 ) return gl.createVertexArray();
15068
-
15069
- return extension.createVertexArrayOES();
15035
+ return gl.createVertexArray();
15070
15036
 
15071
15037
  }
15072
15038
 
15073
15039
  function bindVertexArrayObject( vao ) {
15074
15040
 
15075
- if ( capabilities.isWebGL2 ) return gl.bindVertexArray( vao );
15076
-
15077
- return extension.bindVertexArrayOES( vao );
15041
+ return gl.bindVertexArray( vao );
15078
15042
 
15079
15043
  }
15080
15044
 
15081
15045
  function deleteVertexArrayObject( vao ) {
15082
15046
 
15083
- if ( capabilities.isWebGL2 ) return gl.deleteVertexArray( vao );
15084
-
15085
- return extension.deleteVertexArrayOES( vao );
15047
+ return gl.deleteVertexArray( vao );
15086
15048
 
15087
15049
  }
15088
15050
 
@@ -15280,9 +15242,7 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
15280
15242
 
15281
15243
  if ( attributeDivisors[ attribute ] !== meshPerAttribute ) {
15282
15244
 
15283
- const extension = capabilities.isWebGL2 ? gl : extensions.get( 'ANGLE_instanced_arrays' );
15284
-
15285
- extension[ capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE' ]( attribute, meshPerAttribute );
15245
+ gl.vertexAttribDivisor( attribute, meshPerAttribute );
15286
15246
  attributeDivisors[ attribute ] = meshPerAttribute;
15287
15247
 
15288
15248
  }
@@ -15323,12 +15283,6 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
15323
15283
 
15324
15284
  function setupVertexAttributes( object, material, program, geometry ) {
15325
15285
 
15326
- if ( capabilities.isWebGL2 === false && ( object.isInstancedMesh || geometry.isInstancedBufferGeometry ) ) {
15327
-
15328
- if ( extensions.get( 'ANGLE_instanced_arrays' ) === null ) return;
15329
-
15330
- }
15331
-
15332
15286
  initAttributes();
15333
15287
 
15334
15288
  const geometryAttributes = geometry.attributes;
@@ -15367,9 +15321,9 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
15367
15321
  const type = attribute.type;
15368
15322
  const bytesPerElement = attribute.bytesPerElement;
15369
15323
 
15370
- // check for integer attributes (WebGL 2 only)
15324
+ // check for integer attributes
15371
15325
 
15372
- const integer = ( capabilities.isWebGL2 === true && ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType ) );
15326
+ const integer = ( type === gl.INT || type === gl.UNSIGNED_INT || geometryAttribute.gpuType === IntType );
15373
15327
 
15374
15328
  if ( geometryAttribute.isInterleavedBufferAttribute ) {
15375
15329
 
@@ -15617,9 +15571,7 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
15617
15571
 
15618
15572
  }
15619
15573
 
15620
- function WebGLBufferRenderer( gl, extensions, info, capabilities ) {
15621
-
15622
- const isWebGL2 = capabilities.isWebGL2;
15574
+ function WebGLBufferRenderer( gl, extensions, info ) {
15623
15575
 
15624
15576
  let mode;
15625
15577
 
@@ -15641,28 +15593,7 @@ function WebGLBufferRenderer( gl, extensions, info, capabilities ) {
15641
15593
 
15642
15594
  if ( primcount === 0 ) return;
15643
15595
 
15644
- let extension, methodName;
15645
-
15646
- if ( isWebGL2 ) {
15647
-
15648
- extension = gl;
15649
- methodName = 'drawArraysInstanced';
15650
-
15651
- } else {
15652
-
15653
- extension = extensions.get( 'ANGLE_instanced_arrays' );
15654
- methodName = 'drawArraysInstancedANGLE';
15655
-
15656
- if ( extension === null ) {
15657
-
15658
- console.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );
15659
- return;
15660
-
15661
- }
15662
-
15663
- }
15664
-
15665
- extension[ methodName ]( mode, start, count, primcount );
15596
+ gl.drawArraysInstanced( mode, start, count, primcount );
15666
15597
 
15667
15598
  info.update( count, mode, primcount );
15668
15599
 
@@ -15673,6 +15604,7 @@ function WebGLBufferRenderer( gl, extensions, info, capabilities ) {
15673
15604
  if ( drawCount === 0 ) return;
15674
15605
 
15675
15606
  const extension = extensions.get( 'WEBGL_multi_draw' );
15607
+
15676
15608
  if ( extension === null ) {
15677
15609
 
15678
15610
  for ( let i = 0; i < drawCount; i ++ ) {
@@ -15761,8 +15693,6 @@ function WebGLCapabilities( gl, extensions, parameters ) {
15761
15693
 
15762
15694
  }
15763
15695
 
15764
- const isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl.constructor.name === 'WebGL2RenderingContext';
15765
-
15766
15696
  let precision = parameters.precision !== undefined ? parameters.precision : 'highp';
15767
15697
  const maxPrecision = getMaxPrecision( precision );
15768
15698
 
@@ -15773,8 +15703,6 @@ function WebGLCapabilities( gl, extensions, parameters ) {
15773
15703
 
15774
15704
  }
15775
15705
 
15776
- const drawBuffers = isWebGL2 || extensions.has( 'WEBGL_draw_buffers' );
15777
-
15778
15706
  const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
15779
15707
 
15780
15708
  const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
@@ -15788,16 +15716,12 @@ function WebGLCapabilities( gl, extensions, parameters ) {
15788
15716
  const maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );
15789
15717
 
15790
15718
  const vertexTextures = maxVertexTextures > 0;
15791
- const floatFragmentTextures = isWebGL2 || extensions.has( 'OES_texture_float' );
15792
- const floatVertexTextures = vertexTextures && floatFragmentTextures;
15793
15719
 
15794
- const maxSamples = isWebGL2 ? gl.getParameter( gl.MAX_SAMPLES ) : 0;
15720
+ const maxSamples = gl.getParameter( gl.MAX_SAMPLES );
15795
15721
 
15796
15722
  return {
15797
15723
 
15798
- isWebGL2: isWebGL2,
15799
-
15800
- drawBuffers: drawBuffers,
15724
+ isWebGL2: true, // keeping this for backwards compatibility
15801
15725
 
15802
15726
  getMaxAnisotropy: getMaxAnisotropy,
15803
15727
  getMaxPrecision: getMaxPrecision,
@@ -15816,8 +15740,6 @@ function WebGLCapabilities( gl, extensions, parameters ) {
15816
15740
  maxFragmentUniforms: maxFragmentUniforms,
15817
15741
 
15818
15742
  vertexTextures: vertexTextures,
15819
- floatFragmentTextures: floatFragmentTextures,
15820
- floatVertexTextures: floatVertexTextures,
15821
15743
 
15822
15744
  maxSamples: maxSamples
15823
15745
 
@@ -16236,6 +16158,7 @@ const _clearColor = /*@__PURE__*/ new Color();
16236
16158
  let _oldTarget = null;
16237
16159
  let _oldActiveCubeFace = 0;
16238
16160
  let _oldActiveMipmapLevel = 0;
16161
+ let _oldXrEnabled = false;
16239
16162
 
16240
16163
  // Golden Ratio
16241
16164
  const PHI = ( 1 + Math.sqrt( 5 ) ) / 2;
@@ -16303,6 +16226,9 @@ class PMREMGenerator {
16303
16226
  _oldTarget = this._renderer.getRenderTarget();
16304
16227
  _oldActiveCubeFace = this._renderer.getActiveCubeFace();
16305
16228
  _oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
16229
+ _oldXrEnabled = this._renderer.xr.enabled;
16230
+
16231
+ this._renderer.xr.enabled = false;
16306
16232
 
16307
16233
  this._setSize( 256 );
16308
16234
 
@@ -16418,6 +16344,8 @@ class PMREMGenerator {
16418
16344
  _cleanup( outputTarget ) {
16419
16345
 
16420
16346
  this._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );
16347
+ this._renderer.xr.enabled = _oldXrEnabled;
16348
+
16421
16349
  outputTarget.scissorTest = false;
16422
16350
  _setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );
16423
16351
 
@@ -16438,6 +16366,9 @@ class PMREMGenerator {
16438
16366
  _oldTarget = this._renderer.getRenderTarget();
16439
16367
  _oldActiveCubeFace = this._renderer.getActiveCubeFace();
16440
16368
  _oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
16369
+ _oldXrEnabled = this._renderer.xr.enabled;
16370
+
16371
+ this._renderer.xr.enabled = false;
16441
16372
 
16442
16373
  const cubeUVRenderTarget = renderTarget || this._allocateTargets();
16443
16374
  this._textureToCubeUV( texture, cubeUVRenderTarget );
@@ -17120,24 +17051,26 @@ function WebGLCubeUVMaps( renderer ) {
17120
17051
 
17121
17052
  if ( isEquirectMap || isCubeMap ) {
17122
17053
 
17123
- if ( texture.isRenderTargetTexture && texture.needsPMREMUpdate === true ) {
17054
+ let renderTarget = cubeUVmaps.get( texture );
17124
17055
 
17125
- texture.needsPMREMUpdate = false;
17056
+ const currentPMREMVersion = renderTarget !== undefined ? renderTarget.texture.pmremVersion : 0;
17126
17057
 
17127
- let renderTarget = cubeUVmaps.get( texture );
17058
+ if ( texture.isRenderTargetTexture && texture.pmremVersion !== currentPMREMVersion ) {
17128
17059
 
17129
17060
  if ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );
17130
17061
 
17131
17062
  renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture, renderTarget ) : pmremGenerator.fromCubemap( texture, renderTarget );
17063
+ renderTarget.texture.pmremVersion = texture.pmremVersion;
17064
+
17132
17065
  cubeUVmaps.set( texture, renderTarget );
17133
17066
 
17134
17067
  return renderTarget.texture;
17135
17068
 
17136
17069
  } else {
17137
17070
 
17138
- if ( cubeUVmaps.has( texture ) ) {
17071
+ if ( renderTarget !== undefined ) {
17139
17072
 
17140
- return cubeUVmaps.get( texture ).texture;
17073
+ return renderTarget.texture;
17141
17074
 
17142
17075
  } else {
17143
17076
 
@@ -17147,7 +17080,9 @@ function WebGLCubeUVMaps( renderer ) {
17147
17080
 
17148
17081
  if ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );
17149
17082
 
17150
- const renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );
17083
+ renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture ) : pmremGenerator.fromCubemap( texture );
17084
+ renderTarget.texture.pmremVersion = texture.pmremVersion;
17085
+
17151
17086
  cubeUVmaps.set( texture, renderTarget );
17152
17087
 
17153
17088
  texture.addEventListener( 'dispose', onTextureDispose );
@@ -17278,29 +17213,14 @@ function WebGLExtensions( gl ) {
17278
17213
 
17279
17214
  },
17280
17215
 
17281
- init: function ( capabilities ) {
17282
-
17283
- if ( capabilities.isWebGL2 ) {
17284
-
17285
- getExtension( 'EXT_color_buffer_float' );
17286
- getExtension( 'WEBGL_clip_cull_distance' );
17287
-
17288
- } else {
17289
-
17290
- getExtension( 'WEBGL_depth_texture' );
17291
- getExtension( 'OES_texture_float' );
17292
- getExtension( 'OES_texture_half_float' );
17293
- getExtension( 'OES_texture_half_float_linear' );
17294
- getExtension( 'OES_standard_derivatives' );
17295
- getExtension( 'OES_element_index_uint' );
17296
- getExtension( 'OES_vertex_array_object' );
17297
- getExtension( 'ANGLE_instanced_arrays' );
17298
-
17299
- }
17216
+ init: function () {
17300
17217
 
17218
+ getExtension( 'EXT_color_buffer_float' );
17219
+ getExtension( 'WEBGL_clip_cull_distance' );
17301
17220
  getExtension( 'OES_texture_float_linear' );
17302
17221
  getExtension( 'EXT_color_buffer_half_float' );
17303
17222
  getExtension( 'WEBGL_multisampled_render_to_texture' );
17223
+ getExtension( 'WEBGL_render_shared_exponent' );
17304
17224
 
17305
17225
  },
17306
17226
 
@@ -17528,9 +17448,7 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
17528
17448
 
17529
17449
  }
17530
17450
 
17531
- function WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {
17532
-
17533
- const isWebGL2 = capabilities.isWebGL2;
17451
+ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
17534
17452
 
17535
17453
  let mode;
17536
17454
 
@@ -17561,28 +17479,7 @@ function WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {
17561
17479
 
17562
17480
  if ( primcount === 0 ) return;
17563
17481
 
17564
- let extension, methodName;
17565
-
17566
- if ( isWebGL2 ) {
17567
-
17568
- extension = gl;
17569
- methodName = 'drawElementsInstanced';
17570
-
17571
- } else {
17572
-
17573
- extension = extensions.get( 'ANGLE_instanced_arrays' );
17574
- methodName = 'drawElementsInstancedANGLE';
17575
-
17576
- if ( extension === null ) {
17577
-
17578
- console.error( 'THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );
17579
- return;
17580
-
17581
- }
17582
-
17583
- }
17584
-
17585
- extension[ methodName ]( mode, count, type, start * bytesPerElement, primcount );
17482
+ gl.drawElementsInstanced( mode, count, type, start * bytesPerElement, primcount );
17586
17483
 
17587
17484
  info.update( count, mode, primcount );
17588
17485
 
@@ -17593,6 +17490,7 @@ function WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {
17593
17490
  if ( drawCount === 0 ) return;
17594
17491
 
17595
17492
  const extension = extensions.get( 'WEBGL_multi_draw' );
17493
+
17596
17494
  if ( extension === null ) {
17597
17495
 
17598
17496
  for ( let i = 0; i < drawCount; i ++ ) {
@@ -17697,296 +17595,158 @@ function WebGLInfo( gl ) {
17697
17595
 
17698
17596
  }
17699
17597
 
17700
- function numericalSort( a, b ) {
17701
-
17702
- return a[ 0 ] - b[ 0 ];
17703
-
17704
- }
17705
-
17706
- function absNumericalSort( a, b ) {
17707
-
17708
- return Math.abs( b[ 1 ] ) - Math.abs( a[ 1 ] );
17709
-
17710
- }
17711
-
17712
17598
  function WebGLMorphtargets( gl, capabilities, textures ) {
17713
17599
 
17714
- const influencesList = {};
17715
- const morphInfluences = new Float32Array( 8 );
17716
17600
  const morphTextures = new WeakMap();
17717
17601
  const morph = new Vector4();
17718
17602
 
17719
- const workInfluences = [];
17720
-
17721
- for ( let i = 0; i < 8; i ++ ) {
17722
-
17723
- workInfluences[ i ] = [ i, 0 ];
17724
-
17725
- }
17726
-
17727
17603
  function update( object, geometry, program ) {
17728
17604
 
17729
17605
  const objectInfluences = object.morphTargetInfluences;
17730
17606
 
17731
- if ( capabilities.isWebGL2 === true ) {
17732
-
17733
- // instead of using attributes, the WebGL 2 code path encodes morph targets
17734
- // into an array of data textures. Each layer represents a single morph target.
17735
-
17736
- const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
17737
- const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
17738
-
17739
- let entry = morphTextures.get( geometry );
17740
-
17741
- if ( entry === undefined || entry.count !== morphTargetsCount ) {
17742
-
17743
- if ( entry !== undefined ) entry.texture.dispose();
17744
-
17745
- const hasMorphPosition = geometry.morphAttributes.position !== undefined;
17746
- const hasMorphNormals = geometry.morphAttributes.normal !== undefined;
17747
- const hasMorphColors = geometry.morphAttributes.color !== undefined;
17748
-
17749
- const morphTargets = geometry.morphAttributes.position || [];
17750
- const morphNormals = geometry.morphAttributes.normal || [];
17751
- const morphColors = geometry.morphAttributes.color || [];
17607
+ // instead of using attributes, the WebGL 2 code path encodes morph targets
17608
+ // into an array of data textures. Each layer represents a single morph target.
17752
17609
 
17753
- let vertexDataCount = 0;
17610
+ const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
17611
+ const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
17754
17612
 
17755
- if ( hasMorphPosition === true ) vertexDataCount = 1;
17756
- if ( hasMorphNormals === true ) vertexDataCount = 2;
17757
- if ( hasMorphColors === true ) vertexDataCount = 3;
17613
+ let entry = morphTextures.get( geometry );
17758
17614
 
17759
- let width = geometry.attributes.position.count * vertexDataCount;
17760
- let height = 1;
17615
+ if ( entry === undefined || entry.count !== morphTargetsCount ) {
17761
17616
 
17762
- if ( width > capabilities.maxTextureSize ) {
17617
+ if ( entry !== undefined ) entry.texture.dispose();
17763
17618
 
17764
- height = Math.ceil( width / capabilities.maxTextureSize );
17765
- width = capabilities.maxTextureSize;
17619
+ const hasMorphPosition = geometry.morphAttributes.position !== undefined;
17620
+ const hasMorphNormals = geometry.morphAttributes.normal !== undefined;
17621
+ const hasMorphColors = geometry.morphAttributes.color !== undefined;
17766
17622
 
17767
- }
17623
+ const morphTargets = geometry.morphAttributes.position || [];
17624
+ const morphNormals = geometry.morphAttributes.normal || [];
17625
+ const morphColors = geometry.morphAttributes.color || [];
17768
17626
 
17769
- const buffer = new Float32Array( width * height * 4 * morphTargetsCount );
17770
-
17771
- const texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );
17772
- texture.type = FloatType;
17773
- texture.needsUpdate = true;
17627
+ let vertexDataCount = 0;
17774
17628
 
17775
- // fill buffer
17629
+ if ( hasMorphPosition === true ) vertexDataCount = 1;
17630
+ if ( hasMorphNormals === true ) vertexDataCount = 2;
17631
+ if ( hasMorphColors === true ) vertexDataCount = 3;
17776
17632
 
17777
- const vertexDataStride = vertexDataCount * 4;
17633
+ let width = geometry.attributes.position.count * vertexDataCount;
17634
+ let height = 1;
17778
17635
 
17779
- for ( let i = 0; i < morphTargetsCount; i ++ ) {
17636
+ if ( width > capabilities.maxTextureSize ) {
17780
17637
 
17781
- const morphTarget = morphTargets[ i ];
17782
- const morphNormal = morphNormals[ i ];
17783
- const morphColor = morphColors[ i ];
17638
+ height = Math.ceil( width / capabilities.maxTextureSize );
17639
+ width = capabilities.maxTextureSize;
17784
17640
 
17785
- const offset = width * height * 4 * i;
17786
-
17787
- for ( let j = 0; j < morphTarget.count; j ++ ) {
17788
-
17789
- const stride = j * vertexDataStride;
17641
+ }
17790
17642
 
17791
- if ( hasMorphPosition === true ) {
17643
+ const buffer = new Float32Array( width * height * 4 * morphTargetsCount );
17792
17644
 
17793
- morph.fromBufferAttribute( morphTarget, j );
17645
+ const texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );
17646
+ texture.type = FloatType;
17647
+ texture.needsUpdate = true;
17794
17648
 
17795
- buffer[ offset + stride + 0 ] = morph.x;
17796
- buffer[ offset + stride + 1 ] = morph.y;
17797
- buffer[ offset + stride + 2 ] = morph.z;
17798
- buffer[ offset + stride + 3 ] = 0;
17649
+ // fill buffer
17799
17650
 
17800
- }
17651
+ const vertexDataStride = vertexDataCount * 4;
17801
17652
 
17802
- if ( hasMorphNormals === true ) {
17653
+ for ( let i = 0; i < morphTargetsCount; i ++ ) {
17803
17654
 
17804
- morph.fromBufferAttribute( morphNormal, j );
17655
+ const morphTarget = morphTargets[ i ];
17656
+ const morphNormal = morphNormals[ i ];
17657
+ const morphColor = morphColors[ i ];
17805
17658
 
17806
- buffer[ offset + stride + 4 ] = morph.x;
17807
- buffer[ offset + stride + 5 ] = morph.y;
17808
- buffer[ offset + stride + 6 ] = morph.z;
17809
- buffer[ offset + stride + 7 ] = 0;
17659
+ const offset = width * height * 4 * i;
17810
17660
 
17811
- }
17661
+ for ( let j = 0; j < morphTarget.count; j ++ ) {
17812
17662
 
17813
- if ( hasMorphColors === true ) {
17663
+ const stride = j * vertexDataStride;
17814
17664
 
17815
- morph.fromBufferAttribute( morphColor, j );
17665
+ if ( hasMorphPosition === true ) {
17816
17666
 
17817
- buffer[ offset + stride + 8 ] = morph.x;
17818
- buffer[ offset + stride + 9 ] = morph.y;
17819
- buffer[ offset + stride + 10 ] = morph.z;
17820
- buffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;
17667
+ morph.fromBufferAttribute( morphTarget, j );
17821
17668
 
17822
- }
17669
+ buffer[ offset + stride + 0 ] = morph.x;
17670
+ buffer[ offset + stride + 1 ] = morph.y;
17671
+ buffer[ offset + stride + 2 ] = morph.z;
17672
+ buffer[ offset + stride + 3 ] = 0;
17823
17673
 
17824
17674
  }
17825
17675
 
17826
- }
17827
-
17828
- entry = {
17829
- count: morphTargetsCount,
17830
- texture: texture,
17831
- size: new Vector2( width, height )
17832
- };
17833
-
17834
- morphTextures.set( geometry, entry );
17835
-
17836
- function disposeTexture() {
17837
-
17838
- texture.dispose();
17676
+ if ( hasMorphNormals === true ) {
17839
17677
 
17840
- morphTextures.delete( geometry );
17678
+ morph.fromBufferAttribute( morphNormal, j );
17841
17679
 
17842
- geometry.removeEventListener( 'dispose', disposeTexture );
17680
+ buffer[ offset + stride + 4 ] = morph.x;
17681
+ buffer[ offset + stride + 5 ] = morph.y;
17682
+ buffer[ offset + stride + 6 ] = morph.z;
17683
+ buffer[ offset + stride + 7 ] = 0;
17843
17684
 
17844
- }
17845
-
17846
- geometry.addEventListener( 'dispose', disposeTexture );
17847
-
17848
- }
17849
-
17850
- //
17851
- if ( object.isInstancedMesh === true && object.morphTexture !== null ) {
17685
+ }
17852
17686
 
17853
- program.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );
17687
+ if ( hasMorphColors === true ) {
17854
17688
 
17855
- } else {
17689
+ morph.fromBufferAttribute( morphColor, j );
17856
17690
 
17857
- let morphInfluencesSum = 0;
17691
+ buffer[ offset + stride + 8 ] = morph.x;
17692
+ buffer[ offset + stride + 9 ] = morph.y;
17693
+ buffer[ offset + stride + 10 ] = morph.z;
17694
+ buffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;
17858
17695
 
17859
- for ( let i = 0; i < objectInfluences.length; i ++ ) {
17860
-
17861
- morphInfluencesSum += objectInfluences[ i ];
17696
+ }
17862
17697
 
17863
17698
  }
17864
17699
 
17865
- const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
17866
-
17867
-
17868
- program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
17869
- program.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );
17870
-
17871
17700
  }
17872
17701
 
17873
- program.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );
17874
- program.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );
17875
-
17876
- } else {
17877
-
17878
- // When object doesn't have morph target influences defined, we treat it as a 0-length array
17879
- // This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences
17880
-
17881
- const length = objectInfluences === undefined ? 0 : objectInfluences.length;
17882
-
17883
- let influences = influencesList[ geometry.id ];
17884
-
17885
- if ( influences === undefined || influences.length !== length ) {
17886
-
17887
- // initialise list
17888
-
17889
- influences = [];
17890
-
17891
- for ( let i = 0; i < length; i ++ ) {
17892
-
17893
- influences[ i ] = [ i, 0 ];
17894
-
17895
- }
17896
-
17897
- influencesList[ geometry.id ] = influences;
17702
+ entry = {
17703
+ count: morphTargetsCount,
17704
+ texture: texture,
17705
+ size: new Vector2( width, height )
17706
+ };
17898
17707
 
17899
- }
17708
+ morphTextures.set( geometry, entry );
17900
17709
 
17901
- // Collect influences
17710
+ function disposeTexture() {
17902
17711
 
17903
- for ( let i = 0; i < length; i ++ ) {
17712
+ texture.dispose();
17904
17713
 
17905
- const influence = influences[ i ];
17714
+ morphTextures.delete( geometry );
17906
17715
 
17907
- influence[ 0 ] = i;
17908
- influence[ 1 ] = objectInfluences[ i ];
17716
+ geometry.removeEventListener( 'dispose', disposeTexture );
17909
17717
 
17910
17718
  }
17911
17719
 
17912
- influences.sort( absNumericalSort );
17720
+ geometry.addEventListener( 'dispose', disposeTexture );
17913
17721
 
17914
- for ( let i = 0; i < 8; i ++ ) {
17915
-
17916
- if ( i < length && influences[ i ][ 1 ] ) {
17917
-
17918
- workInfluences[ i ][ 0 ] = influences[ i ][ 0 ];
17919
- workInfluences[ i ][ 1 ] = influences[ i ][ 1 ];
17920
-
17921
- } else {
17922
-
17923
- workInfluences[ i ][ 0 ] = Number.MAX_SAFE_INTEGER;
17924
- workInfluences[ i ][ 1 ] = 0;
17925
-
17926
- }
17722
+ }
17927
17723
 
17928
- }
17724
+ //
17725
+ if ( object.isInstancedMesh === true && object.morphTexture !== null ) {
17929
17726
 
17930
- workInfluences.sort( numericalSort );
17727
+ program.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );
17931
17728
 
17932
- const morphTargets = geometry.morphAttributes.position;
17933
- const morphNormals = geometry.morphAttributes.normal;
17729
+ } else {
17934
17730
 
17935
17731
  let morphInfluencesSum = 0;
17936
17732
 
17937
- for ( let i = 0; i < 8; i ++ ) {
17938
-
17939
- const influence = workInfluences[ i ];
17940
- const index = influence[ 0 ];
17941
- const value = influence[ 1 ];
17942
-
17943
- if ( index !== Number.MAX_SAFE_INTEGER && value ) {
17944
-
17945
- if ( morphTargets && geometry.getAttribute( 'morphTarget' + i ) !== morphTargets[ index ] ) {
17946
-
17947
- geometry.setAttribute( 'morphTarget' + i, morphTargets[ index ] );
17948
-
17949
- }
17950
-
17951
- if ( morphNormals && geometry.getAttribute( 'morphNormal' + i ) !== morphNormals[ index ] ) {
17952
-
17953
- geometry.setAttribute( 'morphNormal' + i, morphNormals[ index ] );
17954
-
17955
- }
17956
-
17957
- morphInfluences[ i ] = value;
17958
- morphInfluencesSum += value;
17959
-
17960
- } else {
17961
-
17962
- if ( morphTargets && geometry.hasAttribute( 'morphTarget' + i ) === true ) {
17963
-
17964
- geometry.deleteAttribute( 'morphTarget' + i );
17965
-
17966
- }
17733
+ for ( let i = 0; i < objectInfluences.length; i ++ ) {
17967
17734
 
17968
- if ( morphNormals && geometry.hasAttribute( 'morphNormal' + i ) === true ) {
17969
-
17970
- geometry.deleteAttribute( 'morphNormal' + i );
17971
-
17972
- }
17973
-
17974
- morphInfluences[ i ] = 0;
17975
-
17976
- }
17735
+ morphInfluencesSum += objectInfluences[ i ];
17977
17736
 
17978
17737
  }
17979
17738
 
17980
- // GLSL shader uses formula baseinfluence * base + sum(target * influence)
17981
- // This allows us to switch between absolute morphs and relative morphs without changing shader code
17982
- // When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)
17983
17739
  const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
17984
17740
 
17741
+
17985
17742
  program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
17986
- program.getUniforms().setValue( gl, 'morphTargetInfluences', morphInfluences );
17743
+ program.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );
17987
17744
 
17988
17745
  }
17989
17746
 
17747
+ program.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );
17748
+ program.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );
17749
+
17990
17750
  }
17991
17751
 
17992
17752
  return {
@@ -19536,19 +19296,6 @@ function getToneMappingFunction( functionName, toneMapping ) {
19536
19296
 
19537
19297
  }
19538
19298
 
19539
- function generateExtensions( parameters ) {
19540
-
19541
- const chunks = [
19542
- ( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.alphaToCoverage || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',
19543
- ( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',
19544
- ( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',
19545
- ( parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''
19546
- ];
19547
-
19548
- return chunks.filter( filterEmptyLine ).join( '\n' );
19549
-
19550
- }
19551
-
19552
19299
  function generateVertexExtensions( parameters ) {
19553
19300
 
19554
19301
  const chunks = [
@@ -19716,27 +19463,21 @@ function generatePrecision( parameters ) {
19716
19463
  precision ${parameters.precision} int;
19717
19464
  precision ${parameters.precision} sampler2D;
19718
19465
  precision ${parameters.precision} samplerCube;
19466
+ precision ${parameters.precision} sampler3D;
19467
+ precision ${parameters.precision} sampler2DArray;
19468
+ precision ${parameters.precision} sampler2DShadow;
19469
+ precision ${parameters.precision} samplerCubeShadow;
19470
+ precision ${parameters.precision} sampler2DArrayShadow;
19471
+ precision ${parameters.precision} isampler2D;
19472
+ precision ${parameters.precision} isampler3D;
19473
+ precision ${parameters.precision} isamplerCube;
19474
+ precision ${parameters.precision} isampler2DArray;
19475
+ precision ${parameters.precision} usampler2D;
19476
+ precision ${parameters.precision} usampler3D;
19477
+ precision ${parameters.precision} usamplerCube;
19478
+ precision ${parameters.precision} usampler2DArray;
19719
19479
  `;
19720
19480
 
19721
- if ( parameters.isWebGL2 ) {
19722
-
19723
- precisionstring += `precision ${parameters.precision} sampler3D;
19724
- precision ${parameters.precision} sampler2DArray;
19725
- precision ${parameters.precision} sampler2DShadow;
19726
- precision ${parameters.precision} samplerCubeShadow;
19727
- precision ${parameters.precision} sampler2DArrayShadow;
19728
- precision ${parameters.precision} isampler2D;
19729
- precision ${parameters.precision} isampler3D;
19730
- precision ${parameters.precision} isamplerCube;
19731
- precision ${parameters.precision} isampler2DArray;
19732
- precision ${parameters.precision} usampler2D;
19733
- precision ${parameters.precision} usampler3D;
19734
- precision ${parameters.precision} usamplerCube;
19735
- precision ${parameters.precision} usampler2DArray;
19736
- `;
19737
-
19738
- }
19739
-
19740
19481
  if ( parameters.precision === 'highp' ) {
19741
19482
 
19742
19483
  precisionstring += '\n#define HIGH_PRECISION';
@@ -19885,8 +19626,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
19885
19626
  const envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );
19886
19627
  const envMapCubeUVSize = generateCubeUVSize( parameters );
19887
19628
 
19888
- const customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );
19889
-
19890
19629
  const customVertexExtensions = generateVertexExtensions( parameters );
19891
19630
 
19892
19631
  const customDefines = generateDefines( defines );
@@ -19917,8 +19656,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
19917
19656
 
19918
19657
  prefixFragment = [
19919
19658
 
19920
- customExtensions,
19921
-
19922
19659
  '#define SHADER_TYPE ' + parameters.shaderType,
19923
19660
  '#define SHADER_NAME ' + parameters.shaderName,
19924
19661
 
@@ -20040,10 +19777,10 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20040
19777
 
20041
19778
  parameters.morphTargets ? '#define USE_MORPHTARGETS' : '',
20042
19779
  parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',
20043
- ( parameters.morphColors && parameters.isWebGL2 ) ? '#define USE_MORPHCOLORS' : '',
20044
- ( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE' : '',
20045
- ( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',
20046
- ( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',
19780
+ ( parameters.morphColors ) ? '#define USE_MORPHCOLORS' : '',
19781
+ ( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE' : '',
19782
+ ( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',
19783
+ ( parameters.morphTargetsCount > 0 ) ? '#define MORPHTARGETS_COUNT ' + parameters.morphTargetsCount : '',
20047
19784
  parameters.doubleSided ? '#define DOUBLE_SIDED' : '',
20048
19785
  parameters.flipSided ? '#define FLIP_SIDED' : '',
20049
19786
 
@@ -20057,7 +19794,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20057
19794
  parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
20058
19795
 
20059
19796
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
20060
- ( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
20061
19797
 
20062
19798
  'uniform mat4 modelMatrix;',
20063
19799
  'uniform mat4 modelViewMatrix;',
@@ -20161,8 +19897,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20161
19897
 
20162
19898
  prefixFragment = [
20163
19899
 
20164
- customExtensions,
20165
-
20166
19900
  generatePrecision( parameters ),
20167
19901
 
20168
19902
  '#define SHADER_TYPE ' + parameters.shaderType,
@@ -20250,7 +19984,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20250
19984
  parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
20251
19985
 
20252
19986
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
20253
- ( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
20254
19987
 
20255
19988
  'uniform mat4 viewMatrix;',
20256
19989
  'uniform vec3 cameraPosition;',
@@ -20285,7 +20018,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20285
20018
  vertexShader = unrollLoops( vertexShader );
20286
20019
  fragmentShader = unrollLoops( fragmentShader );
20287
20020
 
20288
- if ( parameters.isWebGL2 && parameters.isRawShaderMaterial !== true ) {
20021
+ if ( parameters.isRawShaderMaterial !== true ) {
20289
20022
 
20290
20023
  // GLSL 3.0 conversion for built-in materials and ShaderMaterial
20291
20024
 
@@ -20293,14 +20026,12 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20293
20026
 
20294
20027
  prefixVertex = [
20295
20028
  customVertexExtensions,
20296
- 'precision mediump sampler2DArray;',
20297
20029
  '#define attribute in',
20298
20030
  '#define varying out',
20299
20031
  '#define texture2D texture'
20300
20032
  ].join( '\n' ) + '\n' + prefixVertex;
20301
20033
 
20302
20034
  prefixFragment = [
20303
- 'precision mediump sampler2DArray;',
20304
20035
  '#define varying in',
20305
20036
  ( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',
20306
20037
  ( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',
@@ -20691,7 +20422,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20691
20422
  const _activeChannels = new Set();
20692
20423
  const programs = [];
20693
20424
 
20694
- const IS_WEBGL2 = capabilities.isWebGL2;
20695
20425
  const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
20696
20426
  const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;
20697
20427
 
@@ -20855,8 +20585,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20855
20585
 
20856
20586
  const parameters = {
20857
20587
 
20858
- isWebGL2: IS_WEBGL2,
20859
-
20860
20588
  shaderID: shaderID,
20861
20589
  shaderType: material.type,
20862
20590
  shaderName: material.name,
@@ -21031,16 +20759,9 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
21031
20759
 
21032
20760
  index0AttributeName: material.index0AttributeName,
21033
20761
 
21034
- extensionDerivatives: HAS_EXTENSIONS && material.extensions.derivatives === true,
21035
- extensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,
21036
- extensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,
21037
- extensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,
21038
20762
  extensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),
21039
20763
  extensionMultiDraw: HAS_EXTENSIONS && material.extensions.multiDraw === true && extensions.has( 'WEBGL_multi_draw' ),
21040
20764
 
21041
- rendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),
21042
- rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),
21043
- rendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has( 'EXT_shader_texture_lod' ),
21044
20765
  rendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),
21045
20766
 
21046
20767
  customProgramCacheKey: material.customProgramCacheKey()
@@ -21156,48 +20877,46 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
21156
20877
 
21157
20878
  _programLayers.disableAll();
21158
20879
 
21159
- if ( parameters.isWebGL2 )
21160
- _programLayers.enable( 0 );
21161
20880
  if ( parameters.supportsVertexTextures )
21162
- _programLayers.enable( 1 );
20881
+ _programLayers.enable( 0 );
21163
20882
  if ( parameters.instancing )
21164
- _programLayers.enable( 2 );
20883
+ _programLayers.enable( 1 );
21165
20884
  if ( parameters.instancingColor )
21166
- _programLayers.enable( 3 );
20885
+ _programLayers.enable( 2 );
21167
20886
  if ( parameters.instancingMorph )
21168
- _programLayers.enable( 4 );
20887
+ _programLayers.enable( 3 );
21169
20888
  if ( parameters.matcap )
21170
- _programLayers.enable( 5 );
20889
+ _programLayers.enable( 4 );
21171
20890
  if ( parameters.envMap )
21172
- _programLayers.enable( 6 );
20891
+ _programLayers.enable( 5 );
21173
20892
  if ( parameters.normalMapObjectSpace )
21174
- _programLayers.enable( 7 );
20893
+ _programLayers.enable( 6 );
21175
20894
  if ( parameters.normalMapTangentSpace )
21176
- _programLayers.enable( 8 );
20895
+ _programLayers.enable( 7 );
21177
20896
  if ( parameters.clearcoat )
21178
- _programLayers.enable( 9 );
20897
+ _programLayers.enable( 8 );
21179
20898
  if ( parameters.iridescence )
21180
- _programLayers.enable( 10 );
20899
+ _programLayers.enable( 9 );
21181
20900
  if ( parameters.alphaTest )
21182
- _programLayers.enable( 11 );
20901
+ _programLayers.enable( 10 );
21183
20902
  if ( parameters.vertexColors )
21184
- _programLayers.enable( 12 );
20903
+ _programLayers.enable( 11 );
21185
20904
  if ( parameters.vertexAlphas )
21186
- _programLayers.enable( 13 );
20905
+ _programLayers.enable( 12 );
21187
20906
  if ( parameters.vertexUv1s )
21188
- _programLayers.enable( 14 );
20907
+ _programLayers.enable( 13 );
21189
20908
  if ( parameters.vertexUv2s )
21190
- _programLayers.enable( 15 );
20909
+ _programLayers.enable( 14 );
21191
20910
  if ( parameters.vertexUv3s )
21192
- _programLayers.enable( 16 );
20911
+ _programLayers.enable( 15 );
21193
20912
  if ( parameters.vertexTangents )
21194
- _programLayers.enable( 17 );
20913
+ _programLayers.enable( 16 );
21195
20914
  if ( parameters.anisotropy )
21196
- _programLayers.enable( 18 );
20915
+ _programLayers.enable( 17 );
21197
20916
  if ( parameters.alphaHash )
21198
- _programLayers.enable( 19 );
20917
+ _programLayers.enable( 18 );
21199
20918
  if ( parameters.batching )
21200
- _programLayers.enable( 20 );
20919
+ _programLayers.enable( 19 );
21201
20920
 
21202
20921
  array.push( _programLayers.mask );
21203
20922
  _programLayers.disableAll();
@@ -21772,7 +21491,7 @@ function shadowCastingAndTexturingLightsFirst( lightA, lightB ) {
21772
21491
 
21773
21492
  }
21774
21493
 
21775
- function WebGLLights( extensions, capabilities ) {
21494
+ function WebGLLights( extensions ) {
21776
21495
 
21777
21496
  const cache = new UniformsCache();
21778
21497
 
@@ -22021,41 +21740,15 @@ function WebGLLights( extensions, capabilities ) {
22021
21740
 
22022
21741
  if ( rectAreaLength > 0 ) {
22023
21742
 
22024
- if ( capabilities.isWebGL2 ) {
21743
+ if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
22025
21744
 
22026
- // WebGL 2
22027
-
22028
- if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
22029
-
22030
- state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
22031
- state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
22032
-
22033
- } else {
22034
-
22035
- state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
22036
- state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
22037
-
22038
- }
21745
+ state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
21746
+ state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
22039
21747
 
22040
21748
  } else {
22041
21749
 
22042
- // WebGL 1
22043
-
22044
- if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
22045
-
22046
- state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
22047
- state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
22048
-
22049
- } else if ( extensions.has( 'OES_texture_half_float_linear' ) === true ) {
22050
-
22051
- state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
22052
- state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
22053
-
22054
- } else {
22055
-
22056
- console.error( 'THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.' );
22057
-
22058
- }
21750
+ state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
21751
+ state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
22059
21752
 
22060
21753
  }
22061
21754
 
@@ -22208,9 +21901,9 @@ function WebGLLights( extensions, capabilities ) {
22208
21901
 
22209
21902
  }
22210
21903
 
22211
- function WebGLRenderState( extensions, capabilities ) {
21904
+ function WebGLRenderState( extensions ) {
22212
21905
 
22213
- const lights = new WebGLLights( extensions, capabilities );
21906
+ const lights = new WebGLLights( extensions );
22214
21907
 
22215
21908
  const lightsArray = [];
22216
21909
  const shadowsArray = [];
@@ -22250,7 +21943,9 @@ function WebGLRenderState( extensions, capabilities ) {
22250
21943
  lightsArray: lightsArray,
22251
21944
  shadowsArray: shadowsArray,
22252
21945
 
22253
- lights: lights
21946
+ lights: lights,
21947
+
21948
+ transmissionRenderTarget: null
22254
21949
  };
22255
21950
 
22256
21951
  return {
@@ -22265,7 +21960,7 @@ function WebGLRenderState( extensions, capabilities ) {
22265
21960
 
22266
21961
  }
22267
21962
 
22268
- function WebGLRenderStates( extensions, capabilities ) {
21963
+ function WebGLRenderStates( extensions ) {
22269
21964
 
22270
21965
  let renderStates = new WeakMap();
22271
21966
 
@@ -22276,14 +21971,14 @@ function WebGLRenderStates( extensions, capabilities ) {
22276
21971
 
22277
21972
  if ( renderStateArray === undefined ) {
22278
21973
 
22279
- renderState = new WebGLRenderState( extensions, capabilities );
21974
+ renderState = new WebGLRenderState( extensions );
22280
21975
  renderStates.set( scene, [ renderState ] );
22281
21976
 
22282
21977
  } else {
22283
21978
 
22284
21979
  if ( renderCallDepth >= renderStateArray.length ) {
22285
21980
 
22286
- renderState = new WebGLRenderState( extensions, capabilities );
21981
+ renderState = new WebGLRenderState( extensions );
22287
21982
  renderStateArray.push( renderState );
22288
21983
 
22289
21984
  } else {
@@ -22813,9 +22508,7 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
22813
22508
 
22814
22509
  }
22815
22510
 
22816
- function WebGLState( gl, extensions, capabilities ) {
22817
-
22818
- const isWebGL2 = capabilities.isWebGL2;
22511
+ function WebGLState( gl ) {
22819
22512
 
22820
22513
  function ColorBuffer() {
22821
22514
 
@@ -23187,7 +22880,7 @@ function WebGLState( gl, extensions, capabilities ) {
23187
22880
 
23188
22881
  for ( let i = 0; i < count; i ++ ) {
23189
22882
 
23190
- if ( isWebGL2 && ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) ) {
22883
+ if ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) {
23191
22884
 
23192
22885
  gl.texImage3D( target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );
23193
22886
 
@@ -23206,13 +22899,8 @@ function WebGLState( gl, extensions, capabilities ) {
23206
22899
  const emptyTextures = {};
23207
22900
  emptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );
23208
22901
  emptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );
23209
-
23210
- if ( isWebGL2 ) {
23211
-
23212
- emptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );
23213
- emptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );
23214
-
23215
- }
22902
+ emptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );
22903
+ emptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );
23216
22904
 
23217
22905
  // init
23218
22906
 
@@ -23261,21 +22949,17 @@ function WebGLState( gl, extensions, capabilities ) {
23261
22949
 
23262
22950
  currentBoundFramebuffers[ target ] = framebuffer;
23263
22951
 
23264
- if ( isWebGL2 ) {
23265
-
23266
- // gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER
22952
+ // gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER
23267
22953
 
23268
- if ( target === gl.DRAW_FRAMEBUFFER ) {
22954
+ if ( target === gl.DRAW_FRAMEBUFFER ) {
23269
22955
 
23270
- currentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;
22956
+ currentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;
23271
22957
 
23272
- }
23273
-
23274
- if ( target === gl.FRAMEBUFFER ) {
22958
+ }
23275
22959
 
23276
- currentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;
22960
+ if ( target === gl.FRAMEBUFFER ) {
23277
22961
 
23278
- }
22962
+ currentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;
23279
22963
 
23280
22964
  }
23281
22965
 
@@ -23334,23 +23018,10 @@ function WebGLState( gl, extensions, capabilities ) {
23334
23018
 
23335
23019
  if ( needsUpdate ) {
23336
23020
 
23337
- if ( capabilities.isWebGL2 ) {
23338
-
23339
- gl.drawBuffers( drawBuffers );
23340
-
23341
- } else if ( extensions.has( 'WEBGL_draw_buffers' ) === true ) {
23342
-
23343
- extensions.get( 'WEBGL_draw_buffers' ).drawBuffersWEBGL( drawBuffers );
23344
-
23345
- } else {
23346
-
23347
- throw new Error( 'THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension' );
23348
-
23349
- }
23021
+ gl.drawBuffers( drawBuffers );
23350
23022
 
23351
23023
  }
23352
23024
 
23353
-
23354
23025
  }
23355
23026
 
23356
23027
  function useProgram( program ) {
@@ -23375,23 +23046,8 @@ function WebGLState( gl, extensions, capabilities ) {
23375
23046
  [ ReverseSubtractEquation ]: gl.FUNC_REVERSE_SUBTRACT
23376
23047
  };
23377
23048
 
23378
- if ( isWebGL2 ) {
23379
-
23380
- equationToGL[ MinEquation ] = gl.MIN;
23381
- equationToGL[ MaxEquation ] = gl.MAX;
23382
-
23383
- } else {
23384
-
23385
- const extension = extensions.get( 'EXT_blend_minmax' );
23386
-
23387
- if ( extension !== null ) {
23388
-
23389
- equationToGL[ MinEquation ] = extension.MIN_EXT;
23390
- equationToGL[ MaxEquation ] = extension.MAX_EXT;
23391
-
23392
- }
23393
-
23394
- }
23049
+ equationToGL[ MinEquation ] = gl.MIN;
23050
+ equationToGL[ MaxEquation ] = gl.MAX;
23395
23051
 
23396
23052
  const factorToGL = {
23397
23053
  [ ZeroFactor ]: gl.ZERO,
@@ -24015,13 +23671,8 @@ function WebGLState( gl, extensions, capabilities ) {
24015
23671
  gl.activeTexture( gl.TEXTURE0 );
24016
23672
 
24017
23673
  gl.bindFramebuffer( gl.FRAMEBUFFER, null );
24018
-
24019
- if ( isWebGL2 === true ) {
24020
-
24021
- gl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );
24022
- gl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );
24023
-
24024
- }
23674
+ gl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );
23675
+ gl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );
24025
23676
 
24026
23677
  gl.useProgram( null );
24027
23678
 
@@ -24128,7 +23779,6 @@ function WebGLState( gl, extensions, capabilities ) {
24128
23779
 
24129
23780
  function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
24130
23781
 
24131
- const isWebGL2 = capabilities.isWebGL2;
24132
23782
  const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
24133
23783
  const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
24134
23784
  const multiviewExt = extensions.has( 'OCULUS_multiview' ) ? extensions.get( 'OCULUS_multiview' ) : null;
@@ -24170,7 +23820,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24170
23820
 
24171
23821
  }
24172
23822
 
24173
- function resizeImage( image, needsPowerOfTwo, needsNewCanvas, maxSize ) {
23823
+ function resizeImage( image, needsNewCanvas, maxSize ) {
24174
23824
 
24175
23825
  let scale = 1;
24176
23826
 
@@ -24186,7 +23836,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24186
23836
 
24187
23837
  // only perform resize if necessary
24188
23838
 
24189
- if ( scale < 1 || needsPowerOfTwo === true ) {
23839
+ if ( scale < 1 ) {
24190
23840
 
24191
23841
  // only perform resize for certain image types
24192
23842
 
@@ -24195,10 +23845,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24195
23845
  ( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ||
24196
23846
  ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) ) {
24197
23847
 
24198
- const floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor;
24199
-
24200
- const width = floor( scale * dimensions.width );
24201
- const height = floor( scale * dimensions.height );
23848
+ const width = Math.floor( scale * dimensions.width );
23849
+ const height = Math.floor( scale * dimensions.height );
24202
23850
 
24203
23851
  if ( _canvas === undefined ) _canvas = createCanvas( width, height );
24204
23852
 
@@ -24234,27 +23882,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24234
23882
 
24235
23883
  }
24236
23884
 
24237
- function isPowerOfTwo$1( image ) {
24238
-
24239
- const dimensions = getDimensions( image );
24240
-
24241
- return isPowerOfTwo( dimensions.width ) && isPowerOfTwo( dimensions.height );
24242
-
24243
- }
24244
-
24245
- function textureNeedsPowerOfTwo( texture ) {
24246
-
24247
- if ( isWebGL2 ) return false;
23885
+ function textureNeedsGenerateMipmaps( texture ) {
24248
23886
 
24249
- return ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) ||
24250
- ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter );
24251
-
24252
- }
24253
-
24254
- function textureNeedsGenerateMipmaps( texture, supportsMips ) {
24255
-
24256
- return texture.generateMipmaps && supportsMips &&
24257
- texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
23887
+ return texture.generateMipmaps && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
24258
23888
 
24259
23889
  }
24260
23890
 
@@ -24266,8 +23896,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24266
23896
 
24267
23897
  function getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {
24268
23898
 
24269
- if ( isWebGL2 === false ) return glFormat;
24270
-
24271
23899
  if ( internalFormatName !== null ) {
24272
23900
 
24273
23901
  if ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];
@@ -24316,6 +23944,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24316
23944
 
24317
23945
  }
24318
23946
 
23947
+ if ( glFormat === _gl.RGB ) {
23948
+
23949
+ if ( glType === _gl.UNSIGNED_INT_5_9_9_9_REV ) internalFormat = _gl.RGB9_E5;
23950
+
23951
+ }
23952
+
24319
23953
  if ( glFormat === _gl.RGBA ) {
24320
23954
 
24321
23955
  const transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );
@@ -24340,9 +23974,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24340
23974
 
24341
23975
  }
24342
23976
 
24343
- function getMipLevels( texture, image, supportsMips ) {
23977
+ function getMipLevels( texture, image ) {
24344
23978
 
24345
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {
23979
+ if ( textureNeedsGenerateMipmaps( texture ) === true || ( texture.isFramebufferTexture && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) ) {
24346
23980
 
24347
23981
  return Math.log2( Math.max( image.width, image.height ) ) + 1;
24348
23982
 
@@ -24366,20 +24000,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24366
24000
 
24367
24001
  }
24368
24002
 
24369
- // Fallback filters for non-power-of-2 textures
24370
-
24371
- function filterFallback( f ) {
24372
-
24373
- if ( f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter ) {
24374
-
24375
- return _gl.NEAREST;
24376
-
24377
- }
24378
-
24379
- return _gl.LINEAR;
24380
-
24381
- }
24382
-
24383
24003
  //
24384
24004
 
24385
24005
  function onTextureDispose( event ) {
@@ -24697,7 +24317,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24697
24317
  [ NotEqualCompare ]: _gl.NOTEQUAL
24698
24318
  };
24699
24319
 
24700
- function setTextureParameters( textureType, texture, supportsMips ) {
24320
+ function setTextureParameters( textureType, texture ) {
24701
24321
 
24702
24322
  if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false &&
24703
24323
  ( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||
@@ -24707,48 +24327,18 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24707
24327
 
24708
24328
  }
24709
24329
 
24710
- if ( supportsMips ) {
24711
-
24712
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );
24713
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );
24714
-
24715
- if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
24716
-
24717
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );
24718
-
24719
- }
24720
-
24721
- _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );
24722
- _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );
24723
-
24724
- } else {
24725
-
24726
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );
24727
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );
24728
-
24729
- if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
24730
-
24731
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE );
24732
-
24733
- }
24734
-
24735
- if ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) {
24736
-
24737
- console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.' );
24738
-
24739
- }
24740
-
24741
- _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) );
24742
- _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterFallback( texture.minFilter ) );
24330
+ _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );
24331
+ _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );
24743
24332
 
24744
- if ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) {
24333
+ if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
24745
24334
 
24746
- console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.' );
24747
-
24748
- }
24335
+ _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );
24749
24336
 
24750
24337
  }
24751
24338
 
24339
+ _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );
24340
+ _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );
24341
+
24752
24342
  if ( texture.compareFunction ) {
24753
24343
 
24754
24344
  _gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE );
@@ -24760,8 +24350,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24760
24350
 
24761
24351
  if ( texture.magFilter === NearestFilter ) return;
24762
24352
  if ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;
24763
- if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension for WebGL 1 and WebGL 2
24764
- if ( isWebGL2 === false && ( texture.type === HalfFloatType && extensions.has( 'OES_texture_half_float_linear' ) === false ) ) return; // verify extension for WebGL 1 only
24353
+ if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension
24765
24354
 
24766
24355
  if ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {
24767
24356
 
@@ -24919,97 +24508,41 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24919
24508
  _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
24920
24509
  _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
24921
24510
 
24922
- const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;
24923
- let image = resizeImage( texture.image, needsPowerOfTwo, false, capabilities.maxTextureSize );
24511
+ let image = resizeImage( texture.image, false, capabilities.maxTextureSize );
24924
24512
  image = verifyColorSpace( texture, image );
24925
24513
 
24926
- const supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
24927
- glFormat = utils.convert( texture.format, texture.colorSpace );
24514
+ const glFormat = utils.convert( texture.format, texture.colorSpace );
24928
24515
 
24929
- let glType = utils.convert( texture.type ),
24930
- glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );
24516
+ const glType = utils.convert( texture.type );
24517
+ let glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );
24931
24518
 
24932
- setTextureParameters( textureType, texture, supportsMips );
24519
+ setTextureParameters( textureType, texture );
24933
24520
 
24934
24521
  let mipmap;
24935
24522
  const mipmaps = texture.mipmaps;
24936
24523
 
24937
- const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format );
24524
+ const useTexStorage = ( texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format );
24938
24525
  const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
24939
24526
  const dataReady = source.dataReady;
24940
- const levels = getMipLevels( texture, image, supportsMips );
24527
+ const levels = getMipLevels( texture, image );
24941
24528
 
24942
24529
  if ( texture.isDepthTexture ) {
24943
24530
 
24944
24531
  // populate depth texture with dummy data
24945
24532
 
24946
- glInternalFormat = _gl.DEPTH_COMPONENT;
24947
-
24948
- if ( isWebGL2 ) {
24949
-
24950
- if ( texture.type === FloatType ) {
24951
-
24952
- glInternalFormat = _gl.DEPTH_COMPONENT32F;
24953
-
24954
- } else if ( texture.type === UnsignedIntType ) {
24955
-
24956
- glInternalFormat = _gl.DEPTH_COMPONENT24;
24957
-
24958
- } else if ( texture.type === UnsignedInt248Type ) {
24959
-
24960
- glInternalFormat = _gl.DEPTH24_STENCIL8;
24961
-
24962
- } else {
24963
-
24964
- glInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D
24533
+ glInternalFormat = _gl.DEPTH_COMPONENT16;
24965
24534
 
24966
- }
24967
-
24968
- } else {
24969
-
24970
- if ( texture.type === FloatType ) {
24971
-
24972
- console.error( 'WebGLRenderer: Floating point depth texture requires WebGL2.' );
24973
-
24974
- }
24975
-
24976
- }
24977
-
24978
- // validation checks for WebGL 1
24979
-
24980
- if ( texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {
24981
-
24982
- // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
24983
- // DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT
24984
- // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
24985
- if ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {
24986
-
24987
- console.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );
24988
-
24989
- texture.type = UnsignedIntType;
24990
- glType = utils.convert( texture.type );
24991
-
24992
- }
24535
+ if ( texture.type === FloatType ) {
24993
24536
 
24994
- }
24995
-
24996
- if ( texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {
24997
-
24998
- // Depth stencil textures need the DEPTH_STENCIL internal format
24999
- // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
25000
- glInternalFormat = _gl.DEPTH_STENCIL;
24537
+ glInternalFormat = _gl.DEPTH_COMPONENT32F;
25001
24538
 
25002
- // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
25003
- // DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.
25004
- // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
25005
- if ( texture.type !== UnsignedInt248Type ) {
24539
+ } else if ( texture.type === UnsignedIntType ) {
25006
24540
 
25007
- console.warn( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' );
24541
+ glInternalFormat = _gl.DEPTH_COMPONENT24;
25008
24542
 
25009
- texture.type = UnsignedInt248Type;
25010
- glType = utils.convert( texture.type );
24543
+ } else if ( texture.type === UnsignedInt248Type ) {
25011
24544
 
25012
- }
24545
+ glInternalFormat = _gl.DEPTH24_STENCIL8;
25013
24546
 
25014
24547
  }
25015
24548
 
@@ -25035,7 +24568,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25035
24568
  // if there are no manual mipmaps
25036
24569
  // set 0 level mipmap and then use GL to generate other mipmap levels
25037
24570
 
25038
- if ( mipmaps.length > 0 && supportsMips ) {
24571
+ if ( mipmaps.length > 0 ) {
25039
24572
 
25040
24573
  if ( useTexStorage && allocateMemory ) {
25041
24574
 
@@ -25282,7 +24815,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25282
24815
  // if there are no manual mipmaps
25283
24816
  // set 0 level mipmap and then use GL to generate other mipmap levels
25284
24817
 
25285
- if ( mipmaps.length > 0 && supportsMips ) {
24818
+ if ( mipmaps.length > 0 ) {
25286
24819
 
25287
24820
  if ( useTexStorage && allocateMemory ) {
25288
24821
 
@@ -25342,7 +24875,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25342
24875
 
25343
24876
  }
25344
24877
 
25345
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
24878
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
25346
24879
 
25347
24880
  generateMipmap( textureType );
25348
24881
 
@@ -25392,7 +24925,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25392
24925
 
25393
24926
  if ( ! isCompressed && ! isDataTexture ) {
25394
24927
 
25395
- cubeImage[ i ] = resizeImage( texture.image[ i ], false, true, capabilities.maxCubemapSize );
24928
+ cubeImage[ i ] = resizeImage( texture.image[ i ], true, capabilities.maxCubemapSize );
25396
24929
 
25397
24930
  } else {
25398
24931
 
@@ -25405,17 +24938,16 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25405
24938
  }
25406
24939
 
25407
24940
  const image = cubeImage[ 0 ],
25408
- supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
25409
24941
  glFormat = utils.convert( texture.format, texture.colorSpace ),
25410
24942
  glType = utils.convert( texture.type ),
25411
24943
  glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
25412
24944
 
25413
- const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
24945
+ const useTexStorage = ( texture.isVideoTexture !== true );
25414
24946
  const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
25415
24947
  const dataReady = source.dataReady;
25416
- let levels = getMipLevels( texture, image, supportsMips );
24948
+ let levels = getMipLevels( texture, image );
25417
24949
 
25418
- setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );
24950
+ setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );
25419
24951
 
25420
24952
  let mipmaps;
25421
24953
 
@@ -25580,7 +25112,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25580
25112
 
25581
25113
  }
25582
25114
 
25583
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
25115
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
25584
25116
 
25585
25117
  // We assume images for cube map have the same size.
25586
25118
  generateMipmap( _gl.TEXTURE_CUBE_MAP );
@@ -25722,7 +25254,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25722
25254
 
25723
25255
  } else if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {
25724
25256
 
25725
- let glInternalFormat = ( isWebGL2 === true ) ? _gl.DEPTH_COMPONENT24 : _gl.DEPTH_COMPONENT16;
25257
+ let glInternalFormat = _gl.DEPTH_COMPONENT24;
25726
25258
 
25727
25259
  if ( isMultisample || useMultisampledRTT( renderTarget ) ) {
25728
25260
 
@@ -26001,7 +25533,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26001
25533
 
26002
25534
  const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
26003
25535
  const isMultipleRenderTargets = ( textures.length > 1 );
26004
- const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
26005
25536
 
26006
25537
  if ( ! isMultipleRenderTargets ) {
26007
25538
 
@@ -26024,7 +25555,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26024
25555
 
26025
25556
  for ( let i = 0; i < 6; i ++ ) {
26026
25557
 
26027
- if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
25558
+ if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
26028
25559
 
26029
25560
  renderTargetProperties.__webglFramebuffer[ i ] = [];
26030
25561
 
@@ -26044,7 +25575,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26044
25575
 
26045
25576
  } else {
26046
25577
 
26047
- if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
25578
+ if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
26048
25579
 
26049
25580
  renderTargetProperties.__webglFramebuffer = [];
26050
25581
 
@@ -26062,31 +25593,23 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26062
25593
 
26063
25594
  if ( isMultipleRenderTargets ) {
26064
25595
 
26065
- if ( capabilities.drawBuffers ) {
26066
-
26067
- for ( let i = 0, il = textures.length; i < il; i ++ ) {
26068
-
26069
- const attachmentProperties = properties.get( textures[ i ] );
25596
+ for ( let i = 0, il = textures.length; i < il; i ++ ) {
26070
25597
 
26071
- if ( attachmentProperties.__webglTexture === undefined ) {
25598
+ const attachmentProperties = properties.get( textures[ i ] );
26072
25599
 
26073
- attachmentProperties.__webglTexture = _gl.createTexture();
25600
+ if ( attachmentProperties.__webglTexture === undefined ) {
26074
25601
 
26075
- info.memory.textures ++;
25602
+ attachmentProperties.__webglTexture = _gl.createTexture();
26076
25603
 
26077
- }
25604
+ info.memory.textures ++;
26078
25605
 
26079
25606
  }
26080
25607
 
26081
- } else {
26082
-
26083
- console.warn( 'THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.' );
26084
-
26085
25608
  }
26086
25609
 
26087
25610
  }
26088
25611
 
26089
- if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
25612
+ if ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
26090
25613
 
26091
25614
  renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
26092
25615
  renderTargetProperties.__webglColorRenderbuffer = [];
@@ -26130,11 +25653,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26130
25653
  if ( isCube ) {
26131
25654
 
26132
25655
  state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );
26133
- setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );
25656
+ setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );
26134
25657
 
26135
25658
  for ( let i = 0; i < 6; i ++ ) {
26136
25659
 
26137
- if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
25660
+ if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
26138
25661
 
26139
25662
  for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
26140
25663
 
@@ -26150,7 +25673,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26150
25673
 
26151
25674
  }
26152
25675
 
26153
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
25676
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
26154
25677
 
26155
25678
  generateMipmap( _gl.TEXTURE_CUBE_MAP );
26156
25679
 
@@ -26166,10 +25689,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26166
25689
  const attachmentProperties = properties.get( attachment );
26167
25690
 
26168
25691
  state.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );
26169
- setTextureParameters( _gl.TEXTURE_2D, attachment, supportsMips );
25692
+ setTextureParameters( _gl.TEXTURE_2D, attachment );
26170
25693
  setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );
26171
25694
 
26172
- if ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {
25695
+ if ( textureNeedsGenerateMipmaps( attachment ) ) {
26173
25696
 
26174
25697
  generateMipmap( _gl.TEXTURE_2D );
26175
25698
 
@@ -26185,15 +25708,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26185
25708
 
26186
25709
  if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
26187
25710
 
26188
- if ( isWebGL2 ) {
26189
-
26190
- glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
26191
-
26192
- } else {
26193
-
26194
- console.error( 'THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.' );
26195
-
26196
- }
25711
+ glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
26197
25712
 
26198
25713
  }
26199
25714
 
@@ -26204,9 +25719,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26204
25719
  }
26205
25720
 
26206
25721
  state.bindTexture( glTextureType, textureProperties.__webglTexture );
26207
- setTextureParameters( glTextureType, texture, supportsMips );
25722
+ setTextureParameters( glTextureType, texture );
26208
25723
 
26209
- if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
25724
+ if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
26210
25725
 
26211
25726
  for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
26212
25727
 
@@ -26220,7 +25735,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26220
25735
 
26221
25736
  }
26222
25737
 
26223
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
25738
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
26224
25739
 
26225
25740
  generateMipmap( glTextureType );
26226
25741
 
@@ -26242,15 +25757,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26242
25757
 
26243
25758
  function updateRenderTargetMipmap( renderTarget ) {
26244
25759
 
26245
- const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
26246
-
26247
25760
  const textures = renderTarget.textures;
26248
25761
 
26249
25762
  for ( let i = 0, il = textures.length; i < il; i ++ ) {
26250
25763
 
26251
25764
  const texture = textures[ i ];
26252
25765
 
26253
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
25766
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
26254
25767
 
26255
25768
  const target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;
26256
25769
  const webglTexture = properties.get( texture ).__webglTexture;
@@ -26267,7 +25780,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26267
25780
 
26268
25781
  function updateMultisampleRenderTarget( renderTarget ) {
26269
25782
 
26270
- if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
25783
+ if ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
26271
25784
 
26272
25785
  const textures = renderTarget.textures;
26273
25786
  const width = renderTarget.width;
@@ -26311,7 +25824,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26311
25824
  if ( ignoreDepthValues === false ) {
26312
25825
 
26313
25826
  if ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;
26314
- if ( renderTarget.stencilBuffer ) mask |= _gl.STENCIL_BUFFER_BIT;
25827
+
25828
+ // resolving stencil is slow with a D3D backend. disable it for all transmission render targets (see #27799)
25829
+
25830
+ if ( renderTarget.stencilBuffer && renderTargetProperties.__isTransmissionRenderTarget !== true ) mask |= _gl.STENCIL_BUFFER_BIT;
26315
25831
 
26316
25832
  }
26317
25833
 
@@ -26382,7 +25898,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26382
25898
 
26383
25899
  const renderTargetProperties = properties.get( renderTarget );
26384
25900
 
26385
- return isWebGL2 && renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;
25901
+ return renderTarget.samples > 0 && extensions.has( 'WEBGL_multisampled_render_to_texture' ) === true && renderTargetProperties.__useRenderToTexture !== false;
26386
25902
 
26387
25903
  }
26388
25904
 
@@ -26407,7 +25923,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26407
25923
  const format = texture.format;
26408
25924
  const type = texture.type;
26409
25925
 
26410
- if ( texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat ) return image;
25926
+ if ( texture.isCompressedTexture === true || texture.isVideoTexture === true ) return image;
26411
25927
 
26412
25928
  if ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {
26413
25929
 
@@ -26415,36 +25931,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26415
25931
 
26416
25932
  if ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {
26417
25933
 
26418
- if ( isWebGL2 === false ) {
26419
-
26420
- // in WebGL 1, try to use EXT_sRGB extension and unsized formats
26421
-
26422
- if ( extensions.has( 'EXT_sRGB' ) === true && format === RGBAFormat ) {
26423
-
26424
- texture.format = _SRGBAFormat;
26425
-
26426
- // it's not possible to generate mips in WebGL 1 with this extension
26427
-
26428
- texture.minFilter = LinearFilter;
26429
- texture.generateMipmaps = false;
26430
-
26431
- } else {
26432
-
26433
- // slow fallback (CPU decode)
26434
-
26435
- image = ImageUtils.sRGBToLinear( image );
25934
+ // in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format
26436
25935
 
26437
- }
26438
-
26439
- } else {
26440
-
26441
- // in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format
26442
-
26443
- if ( format !== RGBAFormat || type !== UnsignedByteType ) {
25936
+ if ( format !== RGBAFormat || type !== UnsignedByteType ) {
26444
25937
 
26445
- console.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );
26446
-
26447
- }
25938
+ console.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );
26448
25939
 
26449
25940
  }
26450
25941
 
@@ -26508,9 +25999,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26508
25999
 
26509
26000
  }
26510
26001
 
26511
- function WebGLUtils( gl, extensions, capabilities ) {
26512
-
26513
- const isWebGL2 = capabilities.isWebGL2;
26002
+ function WebGLUtils( gl, extensions ) {
26514
26003
 
26515
26004
  function convert( p, colorSpace = NoColorSpace ) {
26516
26005
 
@@ -26521,6 +26010,7 @@ function WebGLUtils( gl, extensions, capabilities ) {
26521
26010
  if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
26522
26011
  if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
26523
26012
  if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
26013
+ if ( p === UnsignedInt5999Type ) return gl.UNSIGNED_INT_5_9_9_9_REV;
26524
26014
 
26525
26015
  if ( p === ByteType ) return gl.BYTE;
26526
26016
  if ( p === ShortType ) return gl.SHORT;
@@ -26528,50 +26018,16 @@ function WebGLUtils( gl, extensions, capabilities ) {
26528
26018
  if ( p === IntType ) return gl.INT;
26529
26019
  if ( p === UnsignedIntType ) return gl.UNSIGNED_INT;
26530
26020
  if ( p === FloatType ) return gl.FLOAT;
26531
-
26532
- if ( p === HalfFloatType ) {
26533
-
26534
- if ( isWebGL2 ) return gl.HALF_FLOAT;
26535
-
26536
- extension = extensions.get( 'OES_texture_half_float' );
26537
-
26538
- if ( extension !== null ) {
26539
-
26540
- return extension.HALF_FLOAT_OES;
26541
-
26542
- } else {
26543
-
26544
- return null;
26545
-
26546
- }
26547
-
26548
- }
26021
+ if ( p === HalfFloatType ) return gl.HALF_FLOAT;
26549
26022
 
26550
26023
  if ( p === AlphaFormat ) return gl.ALPHA;
26024
+ if ( p === RGBFormat ) return gl.RGB;
26551
26025
  if ( p === RGBAFormat ) return gl.RGBA;
26552
26026
  if ( p === LuminanceFormat ) return gl.LUMINANCE;
26553
26027
  if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;
26554
26028
  if ( p === DepthFormat ) return gl.DEPTH_COMPONENT;
26555
26029
  if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;
26556
26030
 
26557
- // WebGL 1 sRGB fallback
26558
-
26559
- if ( p === _SRGBAFormat ) {
26560
-
26561
- extension = extensions.get( 'EXT_sRGB' );
26562
-
26563
- if ( extension !== null ) {
26564
-
26565
- return extension.SRGB_ALPHA_EXT;
26566
-
26567
- } else {
26568
-
26569
- return null;
26570
-
26571
- }
26572
-
26573
- }
26574
-
26575
26031
  // WebGL2 formats.
26576
26032
 
26577
26033
  if ( p === RedFormat ) return gl.RED;
@@ -26758,23 +26214,7 @@ function WebGLUtils( gl, extensions, capabilities ) {
26758
26214
 
26759
26215
  //
26760
26216
 
26761
- if ( p === UnsignedInt248Type ) {
26762
-
26763
- if ( isWebGL2 ) return gl.UNSIGNED_INT_24_8;
26764
-
26765
- extension = extensions.get( 'WEBGL_depth_texture' );
26766
-
26767
- if ( extension !== null ) {
26768
-
26769
- return extension.UNSIGNED_INT_24_8_WEBGL;
26770
-
26771
- } else {
26772
-
26773
- return null;
26774
-
26775
- }
26776
-
26777
- }
26217
+ if ( p === UnsignedInt248Type ) return gl.UNSIGNED_INT_24_8;
26778
26218
 
26779
26219
  // if "p" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)
26780
26220
 
@@ -27750,11 +27190,11 @@ void main() {
27750
27190
 
27751
27191
  if ( coord.x >= 1.0 ) {
27752
27192
 
27753
- gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
27193
+ gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
27754
27194
 
27755
27195
  } else {
27756
27196
 
27757
- gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
27197
+ gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
27758
27198
 
27759
27199
  }
27760
27200
 
@@ -27802,7 +27242,6 @@ class WebXRDepthSensing {
27802
27242
 
27803
27243
  const viewport = cameraXR.cameras[ 0 ].viewport;
27804
27244
  const material = new ShaderMaterial( {
27805
- extensions: { fragDepth: true },
27806
27245
  vertexShader: _occlusion_vertex,
27807
27246
  fragmentShader: _occlusion_fragment,
27808
27247
  uniforms: {
@@ -28108,10 +27547,10 @@ class WebXRManager extends EventDispatcher {
28108
27547
  currentPixelRatio = renderer.getPixelRatio();
28109
27548
  renderer.getSize( currentSize );
28110
27549
 
28111
- if ( ( session.renderState.layers === undefined ) || ( renderer.capabilities.isWebGL2 === false ) ) {
27550
+ if ( session.renderState.layers === undefined ) {
28112
27551
 
28113
27552
  const layerInit = {
28114
- antialias: ( session.renderState.layers === undefined ) ? attributes.antialias : true,
27553
+ antialias: attributes.antialias,
28115
27554
  alpha: true,
28116
27555
  depth: attributes.depth,
28117
27556
  stencil: attributes.stencil,
@@ -29090,11 +28529,10 @@ function WebGLMaterials( renderer, properties ) {
29090
28529
 
29091
28530
  }
29092
28531
 
29093
- const envMap = properties.get( material ).envMap;
29094
-
29095
- if ( envMap ) {
28532
+ if ( material.envMap ) {
29096
28533
 
29097
28534
  //uniforms.envMap.value = material.envMap; // part of uniforms common
28535
+
29098
28536
  uniforms.envMapIntensity.value = material.envMapIntensity;
29099
28537
 
29100
28538
  }
@@ -29290,7 +28728,7 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
29290
28728
  let updateList = {};
29291
28729
  let allocatedBindingPoints = [];
29292
28730
 
29293
- const maxBindingPoints = ( capabilities.isWebGL2 ) ? gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ) : 0; // binding points are global whereas block indices are per shader program
28731
+ const maxBindingPoints = gl.getParameter( gl.MAX_UNIFORM_BUFFER_BINDINGS ); // binding points are global whereas block indices are per shader program
29294
28732
 
29295
28733
  function bind( uniformsGroup, program ) {
29296
28734
 
@@ -29682,7 +29120,7 @@ class WebGLRenderer {
29682
29120
  canvas = createCanvasElement(),
29683
29121
  context = null,
29684
29122
  depth = true,
29685
- stencil = true,
29123
+ stencil = false,
29686
29124
  alpha = false,
29687
29125
  antialias = false,
29688
29126
  premultipliedAlpha = true,
@@ -29698,6 +29136,12 @@ class WebGLRenderer {
29698
29136
 
29699
29137
  if ( context !== null ) {
29700
29138
 
29139
+ if ( typeof WebGLRenderingContext !== 'undefined' && context instanceof WebGLRenderingContext ) {
29140
+
29141
+ throw new Error( 'THREE.WebGLRenderer: WebGL 1 is not supported since r163.' );
29142
+
29143
+ }
29144
+
29701
29145
  _alpha = context.getContextAttributes().alpha;
29702
29146
 
29703
29147
  } else {
@@ -29810,10 +29254,6 @@ class WebGLRenderer {
29810
29254
  let _clippingEnabled = false;
29811
29255
  let _localClippingEnabled = false;
29812
29256
 
29813
- // transmission
29814
-
29815
- let _transmissionRenderTarget = null;
29816
-
29817
29257
  // camera matrices cache
29818
29258
 
29819
29259
  const _projScreenMatrix = new Matrix4();
@@ -29833,15 +29273,10 @@ class WebGLRenderer {
29833
29273
 
29834
29274
  let _gl = context;
29835
29275
 
29836
- function getContext( contextNames, contextAttributes ) {
29837
-
29838
- for ( let i = 0; i < contextNames.length; i ++ ) {
29276
+ function getContext( contextName, contextAttributes ) {
29839
29277
 
29840
- const contextName = contextNames[ i ];
29841
- const context = canvas.getContext( contextName, contextAttributes );
29842
- if ( context !== null ) return context;
29843
-
29844
- }
29278
+ const context = canvas.getContext( contextName, contextAttributes );
29279
+ if ( context !== null ) return context;
29845
29280
 
29846
29281
  return null;
29847
29282
 
@@ -29870,19 +29305,13 @@ class WebGLRenderer {
29870
29305
 
29871
29306
  if ( _gl === null ) {
29872
29307
 
29873
- const contextNames = [ 'webgl2', 'webgl', 'experimental-webgl' ];
29874
-
29875
- if ( _this.isWebGL1Renderer === true ) {
29876
-
29877
- contextNames.shift();
29878
-
29879
- }
29308
+ const contextName = 'webgl2';
29880
29309
 
29881
- _gl = getContext( contextNames, contextAttributes );
29310
+ _gl = getContext( contextName, contextAttributes );
29882
29311
 
29883
29312
  if ( _gl === null ) {
29884
29313
 
29885
- if ( getContext( contextNames ) ) {
29314
+ if ( getContext( contextName ) ) {
29886
29315
 
29887
29316
  throw new Error( 'Error creating WebGL context with your selected attributes.' );
29888
29317
 
@@ -29896,24 +29325,6 @@ class WebGLRenderer {
29896
29325
 
29897
29326
  }
29898
29327
 
29899
- if ( typeof WebGLRenderingContext !== 'undefined' && _gl instanceof WebGLRenderingContext ) { // @deprecated, r153
29900
-
29901
- console.warn( 'THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163.' );
29902
-
29903
- }
29904
-
29905
- // Some experimental-webgl implementations do not have getShaderPrecisionFormat
29906
-
29907
- if ( _gl.getShaderPrecisionFormat === undefined ) {
29908
-
29909
- _gl.getShaderPrecisionFormat = function () {
29910
-
29911
- return { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 };
29912
-
29913
- };
29914
-
29915
- }
29916
-
29917
29328
  } catch ( error ) {
29918
29329
 
29919
29330
  console.error( 'THREE.WebGLRenderer: ' + error.message );
@@ -29933,22 +29344,21 @@ class WebGLRenderer {
29933
29344
  function initGLContext() {
29934
29345
 
29935
29346
  extensions = new WebGLExtensions( _gl );
29347
+ extensions.init();
29936
29348
 
29937
29349
  capabilities = new WebGLCapabilities( _gl, extensions, parameters );
29938
29350
 
29939
- extensions.init( capabilities );
29940
-
29941
- utils = new WebGLUtils( _gl, extensions, capabilities );
29351
+ utils = new WebGLUtils( _gl, extensions );
29942
29352
 
29943
- state = new WebGLState( _gl, extensions, capabilities );
29353
+ state = new WebGLState( _gl );
29944
29354
 
29945
29355
  info = new WebGLInfo( _gl );
29946
29356
  properties = new WebGLProperties();
29947
29357
  textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
29948
29358
  cubemaps = new WebGLCubeMaps( _this );
29949
29359
  cubeuvmaps = new WebGLCubeUVMaps( _this );
29950
- attributes = new WebGLAttributes( _gl, capabilities );
29951
- bindingStates = new WebGLBindingStates( _gl, extensions, attributes, capabilities );
29360
+ attributes = new WebGLAttributes( _gl );
29361
+ bindingStates = new WebGLBindingStates( _gl, attributes );
29952
29362
  geometries = new WebGLGeometries( _gl, attributes, info, bindingStates );
29953
29363
  objects = new WebGLObjects( _gl, geometries, attributes, info );
29954
29364
  morphtargets = new WebGLMorphtargets( _gl, capabilities, textures );
@@ -29956,14 +29366,14 @@ class WebGLRenderer {
29956
29366
  programCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );
29957
29367
  materials = new WebGLMaterials( _this, properties );
29958
29368
  renderLists = new WebGLRenderLists();
29959
- renderStates = new WebGLRenderStates( extensions, capabilities );
29369
+ renderStates = new WebGLRenderStates( extensions );
29960
29370
  background = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );
29961
29371
  multiview = new WebGLMultiview( _this, extensions, _gl );
29962
29372
  shadowMap = new WebGLShadowMap( _this, objects, capabilities );
29963
29373
  uniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );
29964
29374
 
29965
- bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );
29966
- indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info, capabilities );
29375
+ bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info );
29376
+ indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info );
29967
29377
 
29968
29378
  info.programs = programCache.programs;
29969
29379
 
@@ -30295,13 +29705,6 @@ class WebGLRenderer {
30295
29705
  xr.removeEventListener( 'sessionstart', onXRSessionStart );
30296
29706
  xr.removeEventListener( 'sessionend', onXRSessionEnd );
30297
29707
 
30298
- if ( _transmissionRenderTarget ) {
30299
-
30300
- _transmissionRenderTarget.dispose();
30301
- _transmissionRenderTarget = null;
30302
-
30303
- }
30304
-
30305
29708
  animation.stop();
30306
29709
 
30307
29710
  };
@@ -31070,17 +30473,19 @@ class WebGLRenderer {
31070
30473
 
31071
30474
  }
31072
30475
 
31073
- const isWebGL2 = capabilities.isWebGL2;
30476
+ if ( currentRenderState.state.transmissionRenderTarget === null ) {
31074
30477
 
31075
- if ( _transmissionRenderTarget === null ) {
31076
-
31077
- _transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {
30478
+ currentRenderState.state.transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {
31078
30479
  generateMipmaps: true,
31079
- type: extensions.has( 'EXT_color_buffer_half_float' ) ? HalfFloatType : UnsignedByteType,
30480
+ type: ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) ) ? HalfFloatType : UnsignedByteType,
31080
30481
  minFilter: LinearMipmapLinearFilter,
31081
- samples: ( isWebGL2 ) ? 4 : 0
30482
+ samples: 4,
30483
+ stencilBuffer: stencil
31082
30484
  } );
31083
30485
 
30486
+ const renderTargetProperties = properties.get( currentRenderState.state.transmissionRenderTarget );
30487
+ renderTargetProperties.__isTransmissionRenderTarget = true;
30488
+
31084
30489
  // debug
31085
30490
 
31086
30491
  /*
@@ -31093,22 +30498,15 @@ class WebGLRenderer {
31093
30498
 
31094
30499
  }
31095
30500
 
31096
- _this.getDrawingBufferSize( _vector2 );
31097
-
31098
- if ( isWebGL2 ) {
31099
-
31100
- _transmissionRenderTarget.setSize( _vector2.x, _vector2.y );
31101
-
31102
- } else {
31103
-
31104
- _transmissionRenderTarget.setSize( floorPowerOfTwo( _vector2.x ), floorPowerOfTwo( _vector2.y ) );
30501
+ const transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget;
31105
30502
 
31106
- }
30503
+ _this.getDrawingBufferSize( _vector2 );
30504
+ transmissionRenderTarget.setSize( _vector2.x, _vector2.y );
31107
30505
 
31108
30506
  //
31109
30507
 
31110
30508
  const currentRenderTarget = _this.getRenderTarget();
31111
- _this.setRenderTarget( _transmissionRenderTarget );
30509
+ _this.setRenderTarget( transmissionRenderTarget );
31112
30510
 
31113
30511
  _this.getClearColor( _currentClearColor );
31114
30512
  _currentClearAlpha = _this.getClearAlpha();
@@ -31123,8 +30521,8 @@ class WebGLRenderer {
31123
30521
 
31124
30522
  renderObjects( opaqueObjects, scene, camera );
31125
30523
 
31126
- textures.updateMultisampleRenderTarget( _transmissionRenderTarget );
31127
- textures.updateRenderTargetMipmap( _transmissionRenderTarget );
30524
+ textures.updateMultisampleRenderTarget( transmissionRenderTarget );
30525
+ textures.updateRenderTargetMipmap( transmissionRenderTarget );
31128
30526
 
31129
30527
  let renderTargetNeedsUpdate = false;
31130
30528
 
@@ -31157,8 +30555,8 @@ class WebGLRenderer {
31157
30555
 
31158
30556
  if ( renderTargetNeedsUpdate === true ) {
31159
30557
 
31160
- textures.updateMultisampleRenderTarget( _transmissionRenderTarget );
31161
- textures.updateRenderTargetMipmap( _transmissionRenderTarget );
30558
+ textures.updateMultisampleRenderTarget( transmissionRenderTarget );
30559
+ textures.updateRenderTargetMipmap( transmissionRenderTarget );
31162
30560
 
31163
30561
  }
31164
30562
 
@@ -31518,7 +30916,7 @@ class WebGLRenderer {
31518
30916
 
31519
30917
  needsProgramChange = true;
31520
30918
 
31521
- } else if ( capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount ) {
30919
+ } else if ( materialProperties.morphTargetsCount !== morphTargetsCount ) {
31522
30920
 
31523
30921
  needsProgramChange = true;
31524
30922
 
@@ -31640,17 +31038,9 @@ class WebGLRenderer {
31640
31038
 
31641
31039
  if ( skeleton ) {
31642
31040
 
31643
- if ( capabilities.floatVertexTextures ) {
31644
-
31645
- if ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();
31646
-
31647
- p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );
31041
+ if ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();
31648
31042
 
31649
- } else {
31650
-
31651
- console.warn( 'THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required.' );
31652
-
31653
- }
31043
+ p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );
31654
31044
 
31655
31045
  }
31656
31046
 
@@ -31665,7 +31055,7 @@ class WebGLRenderer {
31665
31055
 
31666
31056
  const morphAttributes = geometry.morphAttributes;
31667
31057
 
31668
- if ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined && capabilities.isWebGL2 === true ) ) {
31058
+ if ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined ) ) {
31669
31059
 
31670
31060
  morphtargets.update( object, geometry, program );
31671
31061
 
@@ -31688,6 +31078,12 @@ class WebGLRenderer {
31688
31078
 
31689
31079
  }
31690
31080
 
31081
+ if ( material.isMeshStandardMaterial && material.envMap === null && scene.environment !== null ) {
31082
+
31083
+ m_uniforms.envMapIntensity.value = scene.environmentIntensity;
31084
+
31085
+ }
31086
+
31691
31087
  if ( refreshMaterial ) {
31692
31088
 
31693
31089
  p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );
@@ -31715,7 +31111,7 @@ class WebGLRenderer {
31715
31111
 
31716
31112
  }
31717
31113
 
31718
- materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget );
31114
+ materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget );
31719
31115
 
31720
31116
  WebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );
31721
31117
 
@@ -31757,18 +31153,10 @@ class WebGLRenderer {
31757
31153
 
31758
31154
  for ( let i = 0, l = groups.length; i < l; i ++ ) {
31759
31155
 
31760
- if ( capabilities.isWebGL2 ) {
31761
-
31762
- const group = groups[ i ];
31763
-
31764
- uniformsGroups.update( group, program );
31765
- uniformsGroups.bind( group, program );
31766
-
31767
- } else {
31768
-
31769
- console.warn( 'THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.' );
31156
+ const group = groups[ i ];
31770
31157
 
31771
- }
31158
+ uniformsGroups.update( group, program );
31159
+ uniformsGroups.bind( group, program );
31772
31160
 
31773
31161
  }
31774
31162
 
@@ -31937,7 +31325,7 @@ class WebGLRenderer {
31937
31325
 
31938
31326
  isCube = true;
31939
31327
 
31940
- } else if ( ( capabilities.isWebGL2 && renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {
31328
+ } else if ( ( renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {
31941
31329
 
31942
31330
  framebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;
31943
31331
 
@@ -31969,7 +31357,7 @@ class WebGLRenderer {
31969
31357
 
31970
31358
  const framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
31971
31359
 
31972
- if ( framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer ) {
31360
+ if ( framebufferBound && useDefaultFramebuffer ) {
31973
31361
 
31974
31362
  state.drawBuffers( renderTarget, framebuffer );
31975
31363
 
@@ -32030,11 +31418,10 @@ class WebGLRenderer {
32030
31418
 
32031
31419
  }
32032
31420
 
32033
- const halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || ( capabilities.isWebGL2 && extensions.has( 'EXT_color_buffer_float' ) ) );
31421
+ const halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || extensions.has( 'EXT_color_buffer_float' ) );
32034
31422
 
32035
31423
  if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)
32036
- ! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.has( 'OES_texture_float' ) || extensions.has( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox
32037
- ! halfFloatSupportedByExt ) {
31424
+ textureType !== FloatType && ! halfFloatSupportedByExt ) {
32038
31425
 
32039
31426
  console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );
32040
31427
  return;
@@ -32118,13 +31505,6 @@ class WebGLRenderer {
32118
31505
 
32119
31506
  this.copyTextureToTexture3D = function ( sourceBox, position, srcTexture, dstTexture, level = 0 ) {
32120
31507
 
32121
- if ( _this.isWebGL1Renderer ) {
32122
-
32123
- console.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.' );
32124
- return;
32125
-
32126
- }
32127
-
32128
31508
  const width = Math.round( sourceBox.max.x - sourceBox.min.x );
32129
31509
  const height = Math.round( sourceBox.max.y - sourceBox.min.y );
32130
31510
  const depth = sourceBox.max.z - sourceBox.min.z + 1;
@@ -32279,10 +31659,6 @@ class WebGLRenderer {
32279
31659
 
32280
31660
  }
32281
31661
 
32282
- class WebGL1Renderer extends WebGLRenderer {}
32283
-
32284
- WebGL1Renderer.prototype.isWebGL1Renderer = true;
32285
-
32286
31662
  class FogExp2 {
32287
31663
 
32288
31664
  constructor( color, density = 0.00025 ) {
@@ -32367,6 +31743,8 @@ class Scene extends Object3D {
32367
31743
  this.backgroundBlurriness = 0;
32368
31744
  this.backgroundIntensity = 1;
32369
31745
  this.backgroundRotation = new Euler();
31746
+
31747
+ this.environmentIntensity = 1;
32370
31748
  this.environmentRotation = new Euler();
32371
31749
 
32372
31750
  this.overrideMaterial = null;
@@ -32390,6 +31768,8 @@ class Scene extends Object3D {
32390
31768
  this.backgroundBlurriness = source.backgroundBlurriness;
32391
31769
  this.backgroundIntensity = source.backgroundIntensity;
32392
31770
  this.backgroundRotation.copy( source.backgroundRotation );
31771
+
31772
+ this.environmentIntensity = source.environmentIntensity;
32393
31773
  this.environmentRotation.copy( source.environmentRotation );
32394
31774
 
32395
31775
  if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();
@@ -32405,10 +31785,12 @@ class Scene extends Object3D {
32405
31785
  const data = super.toJSON( meta );
32406
31786
 
32407
31787
  if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
31788
+
32408
31789
  if ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;
32409
31790
  if ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;
32410
-
32411
31791
  data.object.backgroundRotation = this.backgroundRotation.toArray();
31792
+
31793
+ if ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;
32412
31794
  data.object.environmentRotation = this.environmentRotation.toArray();
32413
31795
 
32414
31796
  return data;
@@ -34037,6 +33419,7 @@ class InstancedMesh extends Mesh {
34037
33419
 
34038
33420
  this.instanceMatrix.copy( source.instanceMatrix );
34039
33421
 
33422
+ if ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();
34040
33423
  if ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();
34041
33424
 
34042
33425
  this.count = source.count;
@@ -34188,6 +33571,15 @@ class InstancedMesh extends Mesh {
34188
33571
 
34189
33572
  this.dispatchEvent( { type: 'dispose' } );
34190
33573
 
33574
+ if ( this.morphTexture !== null ) {
33575
+
33576
+ this.morphTexture.dispose();
33577
+ this.morphTexture = null;
33578
+
33579
+ }
33580
+
33581
+ return this;
33582
+
34191
33583
  }
34192
33584
 
34193
33585
  }
@@ -34377,8 +33769,7 @@ class BatchedMesh extends Mesh {
34377
33769
  const { array, itemSize, normalized } = srcAttribute;
34378
33770
 
34379
33771
  const dstArray = new array.constructor( maxVertexCount * itemSize );
34380
- const dstAttribute = new srcAttribute.constructor( dstArray, itemSize, normalized );
34381
- dstAttribute.setUsage( srcAttribute.usage );
33772
+ const dstAttribute = new BufferAttribute( dstArray, itemSize, normalized );
34382
33773
 
34383
33774
  geometry.setAttribute( attributeName, dstAttribute );
34384
33775
 
@@ -34405,7 +33796,7 @@ class BatchedMesh extends Mesh {
34405
33796
 
34406
33797
  }
34407
33798
 
34408
- // Make sure the geometry is compatible with the existing combined geometry atributes
33799
+ // Make sure the geometry is compatible with the existing combined geometry attributes
34409
33800
  _validateGeometry( geometry ) {
34410
33801
 
34411
33802
  // check that the geometry doesn't have a version of our reserved id attribute
@@ -34696,6 +34087,7 @@ class BatchedMesh extends Mesh {
34696
34087
  }
34697
34088
 
34698
34089
  dstAttribute.needsUpdate = true;
34090
+ dstAttribute.addUpdateRange( vertexStart * itemSize, vertexCount * itemSize );
34699
34091
 
34700
34092
  }
34701
34093
 
@@ -34719,6 +34111,7 @@ class BatchedMesh extends Mesh {
34719
34111
  }
34720
34112
 
34721
34113
  dstIndex.needsUpdate = true;
34114
+ dstIndex.addUpdateRange( indexStart, reservedRange.indexCount );
34722
34115
 
34723
34116
  }
34724
34117
 
@@ -44065,7 +43458,7 @@ VectorKeyframeTrack.prototype.ValueTypeName = 'vector';
44065
43458
 
44066
43459
  class AnimationClip {
44067
43460
 
44068
- constructor( name, duration = - 1, tracks, blendMode = NormalAnimationBlendMode ) {
43461
+ constructor( name = '', duration = - 1, tracks = [], blendMode = NormalAnimationBlendMode ) {
44069
43462
 
44070
43463
  this.name = name;
44071
43464
  this.tracks = tracks;
@@ -47818,6 +47211,8 @@ class ObjectLoader extends Loader {
47818
47211
  if ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;
47819
47212
  if ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;
47820
47213
  if ( data.backgroundRotation !== undefined ) object.backgroundRotation.fromArray( data.backgroundRotation );
47214
+
47215
+ if ( data.environmentIntensity !== undefined ) object.environmentIntensity = data.environmentIntensity;
47821
47216
  if ( data.environmentRotation !== undefined ) object.environmentRotation.fromArray( data.environmentRotation );
47822
47217
 
47823
47218
  break;
@@ -52449,11 +51844,9 @@ function intersect( object, raycaster, intersects, recursive ) {
52449
51844
  /**
52450
51845
  * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system
52451
51846
  *
52452
- * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.
52453
- * The azimuthal angle (theta) is measured from the positive z-axis.
51847
+ * phi (the polar angle) is measured from the positive y-axis. The positive y-axis is up.
51848
+ * theta (the azimuthal angle) is measured from the positive z-axis.
52454
51849
  */
52455
-
52456
-
52457
51850
  class Spherical {
52458
51851
 
52459
51852
  constructor( radius = 1, phi = 0, theta = 0 ) {
@@ -54463,4 +53856,4 @@ if ( typeof window !== 'undefined' ) {
54463
53856
 
54464
53857
  }
54465
53858
 
54466
- export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DisplayP3ColorSpace, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearDisplayP3ColorSpace, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, P3Primaries, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, Rec709Primaries, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoTexture, WebGL1Renderer, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, _SRGBAFormat, createCanvasElement };
53859
+ export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DisplayP3ColorSpace, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearDisplayP3ColorSpace, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, P3Primaries, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, Rec709Primaries, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, createCanvasElement };