super-three 0.161.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 (206) hide show
  1. package/build/three.cjs +822 -1332
  2. package/build/three.module.js +820 -1328
  3. package/build/three.module.min.js +1 -1
  4. package/examples/jsm/controls/DragControls.js +91 -30
  5. package/examples/jsm/controls/OrbitControls.js +32 -6
  6. package/examples/jsm/controls/TransformControls.js +9 -9
  7. package/examples/jsm/exporters/GLTFExporter.js +30 -3
  8. package/examples/jsm/exporters/USDZExporter.js +15 -0
  9. package/examples/jsm/geometries/TextGeometry.js +10 -2
  10. package/examples/jsm/interactive/HTMLMesh.js +7 -9
  11. package/examples/jsm/interactive/InteractiveGroup.js +15 -25
  12. package/examples/jsm/libs/fflate.module.js +694 -496
  13. package/examples/jsm/libs/rhino3dm/rhino3dm.js +1 -8723
  14. package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +1 -8734
  15. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  16. package/examples/jsm/libs/tween.module.js +32 -14
  17. package/examples/jsm/lines/LineMaterial.js +0 -2
  18. package/examples/jsm/loaders/3DMLoader.js +13 -21
  19. package/examples/jsm/loaders/3MFLoader.js +2 -0
  20. package/examples/jsm/loaders/EXRLoader.js +89 -19
  21. package/examples/jsm/loaders/FBXLoader.js +1 -1
  22. package/examples/jsm/loaders/GLTFLoader.js +6 -0
  23. package/examples/jsm/loaders/KTX2Loader.js +2 -6
  24. package/examples/jsm/loaders/LUT3dlLoader.js +0 -15
  25. package/examples/jsm/loaders/LUTCubeLoader.js +0 -14
  26. package/examples/jsm/loaders/LUTImageLoader.js +0 -14
  27. package/examples/jsm/loaders/RGBMLoader.js +16 -0
  28. package/examples/jsm/loaders/VOXLoader.js +9 -2
  29. package/examples/jsm/loaders/VRMLLoader.js +6 -2
  30. package/examples/jsm/misc/GPUComputationRenderer.js +0 -6
  31. package/examples/jsm/misc/ProgressiveLightMap.js +1 -0
  32. package/examples/jsm/nodes/Nodes.js +15 -8
  33. package/examples/jsm/nodes/accessors/AccessorsUtils.js +10 -0
  34. package/examples/jsm/nodes/accessors/BatchNode.js +78 -0
  35. package/examples/jsm/nodes/accessors/ClippingNode.js +144 -0
  36. package/examples/jsm/nodes/accessors/InstanceNode.js +25 -2
  37. package/examples/jsm/nodes/accessors/MaterialNode.js +2 -2
  38. package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +2 -12
  39. package/examples/jsm/nodes/accessors/MorphNode.js +20 -10
  40. package/examples/jsm/nodes/accessors/NormalNode.js +12 -2
  41. package/examples/jsm/nodes/accessors/ReferenceNode.js +87 -29
  42. package/examples/jsm/nodes/accessors/RendererReferenceNode.js +29 -0
  43. package/examples/jsm/nodes/accessors/SkinningNode.js +31 -10
  44. package/examples/jsm/nodes/accessors/StorageBufferNode.js +18 -0
  45. package/examples/jsm/nodes/accessors/TangentNode.js +8 -2
  46. package/examples/jsm/nodes/accessors/TextureNode.js +30 -7
  47. package/examples/jsm/nodes/accessors/UniformsNode.js +140 -0
  48. package/examples/jsm/nodes/code/CodeNode.js +6 -0
  49. package/examples/jsm/nodes/core/AssignNode.js +68 -12
  50. package/examples/jsm/nodes/core/Node.js +67 -6
  51. package/examples/jsm/nodes/core/NodeBuilder.js +23 -24
  52. package/examples/jsm/nodes/core/NodeFrame.js +8 -8
  53. package/examples/jsm/nodes/core/NodeUtils.js +2 -2
  54. package/examples/jsm/nodes/core/TempNode.js +1 -1
  55. package/examples/jsm/nodes/core/UniformNode.js +20 -0
  56. package/examples/jsm/nodes/display/BlendModeNode.js +30 -1
  57. package/examples/jsm/nodes/display/NormalMapNode.js +3 -5
  58. package/examples/jsm/nodes/display/PassNode.js +17 -1
  59. package/examples/jsm/nodes/display/ToneMappingNode.js +8 -4
  60. package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +6 -0
  61. package/examples/jsm/nodes/fog/FogExp2Node.js +4 -5
  62. package/examples/jsm/nodes/fog/FogNode.js +13 -3
  63. package/examples/jsm/nodes/fog/FogRangeNode.js +4 -3
  64. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +1 -1
  65. package/examples/jsm/nodes/lighting/EnvironmentNode.js +12 -69
  66. package/examples/jsm/nodes/materials/NodeMaterial.js +70 -17
  67. package/examples/jsm/nodes/math/CondNode.js +42 -7
  68. package/examples/jsm/nodes/math/MathNode.js +20 -0
  69. package/examples/jsm/nodes/pmrem/PMREMNode.js +193 -0
  70. package/examples/jsm/nodes/pmrem/PMREMUtils.js +288 -0
  71. package/examples/jsm/nodes/shadernode/ShaderNode.js +1 -1
  72. package/examples/jsm/nodes/utils/ArrayElementNode.js +0 -6
  73. package/examples/jsm/nodes/utils/EquirectUVNode.js +1 -1
  74. package/examples/jsm/nodes/utils/LoopNode.js +2 -0
  75. package/examples/jsm/nodes/utils/StorageArrayElementNode.js +91 -0
  76. package/examples/jsm/objects/QuadMesh.js +7 -23
  77. package/examples/jsm/physics/RapierPhysics.js +4 -4
  78. package/examples/jsm/postprocessing/GlitchPass.js +0 -3
  79. package/examples/jsm/postprocessing/LUTPass.js +5 -71
  80. package/examples/jsm/postprocessing/OutputPass.js +2 -0
  81. package/examples/jsm/postprocessing/SAOPass.js +0 -1
  82. package/examples/jsm/postprocessing/SSAOPass.js +0 -3
  83. package/examples/jsm/renderers/common/Animation.js +3 -0
  84. package/examples/jsm/renderers/common/Background.js +3 -3
  85. package/examples/jsm/renderers/common/ClippingContext.js +165 -0
  86. package/examples/jsm/renderers/common/Info.js +11 -19
  87. package/examples/jsm/renderers/common/PostProcessing.js +12 -4
  88. package/examples/jsm/renderers/common/RenderContext.js +3 -1
  89. package/examples/jsm/renderers/common/RenderContexts.js +2 -13
  90. package/examples/jsm/renderers/common/RenderObject.js +46 -3
  91. package/examples/jsm/renderers/common/RenderObjects.js +2 -0
  92. package/examples/jsm/renderers/common/Renderer.js +113 -39
  93. package/examples/jsm/renderers/common/StorageBufferAttribute.js +2 -2
  94. package/examples/jsm/renderers/common/StorageInstancedBufferAttribute.js +17 -0
  95. package/examples/jsm/renderers/common/Textures.js +3 -13
  96. package/examples/jsm/renderers/common/UniformsGroup.js +6 -4
  97. package/examples/jsm/renderers/common/extras/PMREMGenerator.js +777 -0
  98. package/examples/jsm/renderers/common/nodes/NodeStorageBuffer.js +23 -0
  99. package/examples/jsm/renderers/common/nodes/NodeUniformBuffer.js +23 -0
  100. package/examples/jsm/renderers/common/nodes/Nodes.js +6 -18
  101. package/examples/jsm/renderers/webgl/WebGLBackend.js +174 -30
  102. package/examples/jsm/renderers/webgl/WebGLBufferRenderer.js +141 -0
  103. package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +136 -11
  104. package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +8 -2
  105. package/examples/jsm/renderers/webgl/utils/WebGLConstants.js +1 -0
  106. package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +90 -0
  107. package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +3 -1
  108. package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +0 -2
  109. package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +0 -2
  110. package/examples/jsm/renderers/webgpu/WebGPUBackend.js +67 -37
  111. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +20 -43
  112. package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +32 -1
  113. package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +18 -4
  114. package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +94 -20
  115. package/examples/jsm/shaders/OutputShader.js +4 -0
  116. package/examples/jsm/utils/GPUStatsPanel.js +10 -45
  117. package/examples/jsm/utils/SkeletonUtils.js +14 -3
  118. package/examples/jsm/utils/TextureUtils.js +1 -1
  119. package/examples/jsm/webxr/VRButton.js +13 -5
  120. package/examples/jsm/webxr/XRButton.js +0 -1
  121. package/examples/jsm/webxr/XRControllerModelFactory.js +8 -0
  122. package/package.json +4 -3
  123. package/src/Three.Legacy.js +20 -0
  124. package/src/Three.js +0 -2
  125. package/src/animation/AnimationClip.js +1 -1
  126. package/src/constants.js +4 -7
  127. package/src/core/BufferAttribute.js +0 -11
  128. package/src/core/BufferGeometry.js +23 -29
  129. package/src/core/Object3D.js +21 -7
  130. package/src/core/Raycaster.js +18 -4
  131. package/src/core/RenderTarget.js +44 -21
  132. package/src/extras/PMREMGenerator.js +11 -0
  133. package/src/extras/curves/EllipseCurve.js +2 -2
  134. package/src/helpers/SpotLightHelper.js +18 -1
  135. package/src/loaders/DataTextureLoader.js +0 -4
  136. package/src/loaders/MaterialLoader.js +1 -0
  137. package/src/loaders/ObjectLoader.js +4 -1
  138. package/src/materials/Material.js +2 -1
  139. package/src/materials/MeshBasicMaterial.js +3 -0
  140. package/src/materials/MeshLambertMaterial.js +3 -0
  141. package/src/materials/MeshPhongMaterial.js +3 -0
  142. package/src/materials/MeshStandardMaterial.js +3 -0
  143. package/src/materials/ShaderMaterial.js +0 -4
  144. package/src/math/Quaternion.js +13 -12
  145. package/src/math/Spherical.js +4 -5
  146. package/src/math/Vector3.js +7 -7
  147. package/src/objects/BatchedMesh.js +4 -3
  148. package/src/objects/InstancedMesh.js +63 -0
  149. package/src/objects/Mesh.js +0 -1
  150. package/src/renderers/WebGLCubeRenderTarget.js +1 -10
  151. package/src/renderers/WebGLRenderer.js +70 -136
  152. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -0
  153. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
  154. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +2 -2
  155. package/src/renderers/shaders/ShaderChunk/logdepthbuf_fragment.glsl.js +2 -2
  156. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_fragment.glsl.js +1 -1
  157. package/src/renderers/shaders/ShaderChunk/logdepthbuf_pars_vertex.glsl.js +2 -10
  158. package/src/renderers/shaders/ShaderChunk/logdepthbuf_vertex.glsl.js +2 -16
  159. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +1 -1
  160. package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +14 -0
  161. package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +11 -2
  162. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +32 -22
  163. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +23 -0
  164. package/src/renderers/shaders/ShaderChunk.js +2 -0
  165. package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +3 -2
  166. package/src/renderers/shaders/ShaderLib/depth.glsl.js +2 -0
  167. package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +2 -0
  168. package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +1 -0
  169. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +1 -0
  170. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +1 -0
  171. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +1 -0
  172. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +1 -0
  173. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +1 -0
  174. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +1 -0
  175. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +1 -0
  176. package/src/renderers/shaders/ShaderLib/points.glsl.js +1 -0
  177. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -0
  178. package/src/renderers/shaders/ShaderLib.js +3 -2
  179. package/src/renderers/shaders/UniformsLib.js +1 -0
  180. package/src/renderers/shaders/UniformsUtils.js +10 -1
  181. package/src/renderers/webgl/WebGLAttributes.js +6 -33
  182. package/src/renderers/webgl/WebGLBackground.js +18 -0
  183. package/src/renderers/webgl/WebGLBindingStates.js +14 -51
  184. package/src/renderers/webgl/WebGLBufferRenderer.js +3 -25
  185. package/src/renderers/webgl/WebGLCapabilities.js +2 -12
  186. package/src/renderers/webgl/WebGLCubeUVMaps.js +10 -6
  187. package/src/renderers/webgl/WebGLExtensions.js +4 -19
  188. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +3 -25
  189. package/src/renderers/webgl/WebGLLights.js +6 -32
  190. package/src/renderers/webgl/WebGLMaterials.js +26 -4
  191. package/src/renderers/webgl/WebGLMorphtargets.js +79 -210
  192. package/src/renderers/webgl/WebGLProgram.js +30 -48
  193. package/src/renderers/webgl/WebGLPrograms.js +5 -14
  194. package/src/renderers/webgl/WebGLRenderStates.js +8 -6
  195. package/src/renderers/webgl/WebGLState.js +21 -75
  196. package/src/renderers/webgl/WebGLTextures.js +143 -275
  197. package/src/renderers/webgl/WebGLUniformsGroups.js +1 -1
  198. package/src/renderers/webgl/WebGLUtils.js +6 -57
  199. package/src/renderers/webxr/WebXRDepthSensing.js +2 -3
  200. package/src/renderers/webxr/WebXRManager.js +2 -2
  201. package/src/scenes/Scene.js +14 -0
  202. package/src/textures/Texture.js +6 -24
  203. package/examples/jsm/nodes/core/ArrayUniformNode.js +0 -26
  204. package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +0 -37
  205. package/src/renderers/WebGL1Renderer.js +0 -7
  206. package/src/renderers/WebGLMultipleRenderTargets.js +0 -82
@@ -3,7 +3,7 @@
3
3
  * Copyright 2010-2023 Three.js Authors
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
- const REVISION = '161';
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 };
@@ -62,6 +62,7 @@ const CineonToneMapping = 3;
62
62
  const ACESFilmicToneMapping = 4;
63
63
  const CustomToneMapping = 5;
64
64
  const AgXToneMapping = 6;
65
+ const NeutralToneMapping = 7;
65
66
  const AttachedBindMode = 'attached';
66
67
  const DetachedBindMode = 'detached';
67
68
 
@@ -95,7 +96,9 @@ const HalfFloatType = 1016;
95
96
  const UnsignedShort4444Type = 1017;
96
97
  const UnsignedShort5551Type = 1018;
97
98
  const UnsignedInt248Type = 1020;
99
+ const UnsignedInt5999Type = 35902;
98
100
  const AlphaFormat = 1021;
101
+ const RGBFormat = 1022;
99
102
  const RGBAFormat = 1023;
100
103
  const LuminanceFormat = 1024;
101
104
  const LuminanceAlphaFormat = 1025;
@@ -153,10 +156,6 @@ const AdditiveAnimationBlendMode = 2501;
153
156
  const TrianglesDrawMode = 0;
154
157
  const TriangleStripDrawMode = 1;
155
158
  const TriangleFanDrawMode = 2;
156
- /** @deprecated Use LinearSRGBColorSpace or NoColorSpace in three.js r152+. */
157
- const LinearEncoding = 3000;
158
- /** @deprecated Use SRGBColorSpace in three.js r152+. */
159
- const sRGBEncoding = 3001;
160
159
  const BasicDepthPacking = 3200;
161
160
  const RGBADepthPacking = 3201;
162
161
  const TangentSpaceNormalMap = 0;
@@ -215,8 +214,6 @@ const StreamCopyUsage = 35042;
215
214
  const GLSL1 = '100';
216
215
  const GLSL3 = '300 es';
217
216
 
218
- const _SRGBAFormat = 1035; // fallback for WebGL 1
219
-
220
217
  const WebGLCoordinateSystem = 2000;
221
218
  const WebGPUCoordinateSystem = 2001;
222
219
 
@@ -1996,17 +1993,7 @@ class Texture extends EventDispatcher {
1996
1993
  this.flipY = true;
1997
1994
  this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)
1998
1995
 
1999
- if ( typeof colorSpace === 'string' ) {
2000
-
2001
- this.colorSpace = colorSpace;
2002
-
2003
- } else { // @deprecated, r152
2004
-
2005
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2006
- this.colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
2007
-
2008
- }
2009
-
1996
+ this.colorSpace = colorSpace;
2010
1997
 
2011
1998
  this.userData = {};
2012
1999
 
@@ -2014,7 +2001,7 @@ class Texture extends EventDispatcher {
2014
2001
  this.onUpdate = null;
2015
2002
 
2016
2003
  this.isRenderTargetTexture = false; // indicates whether a texture belongs to a render target or not
2017
- 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)
2018
2005
 
2019
2006
  }
2020
2007
 
@@ -2245,17 +2232,13 @@ class Texture extends EventDispatcher {
2245
2232
 
2246
2233
  }
2247
2234
 
2248
- get encoding() { // @deprecated, r152
2235
+ set needsPMREMUpdate( value ) {
2249
2236
 
2250
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2251
- return this.colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
2252
-
2253
- }
2237
+ if ( value === true ) {
2254
2238
 
2255
- set encoding( encoding ) { // @deprecated, r152
2239
+ this.pmremVersion ++;
2256
2240
 
2257
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2258
- this.colorSpace = encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
2241
+ }
2259
2242
 
2260
2243
  }
2261
2244
 
@@ -2932,14 +2915,6 @@ class RenderTarget extends EventDispatcher {
2932
2915
 
2933
2916
  const image = { width: width, height: height, depth: 1 };
2934
2917
 
2935
- if ( options.encoding !== undefined ) {
2936
-
2937
- // @deprecated, r152
2938
- warnOnce( 'THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.' );
2939
- options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
2940
-
2941
- }
2942
-
2943
2918
  options = Object.assign( {
2944
2919
  generateMipmaps: false,
2945
2920
  internalFormat: null,
@@ -2947,15 +2922,25 @@ class RenderTarget extends EventDispatcher {
2947
2922
  depthBuffer: true,
2948
2923
  stencilBuffer: false,
2949
2924
  depthTexture: null,
2950
- samples: 0
2925
+ samples: 0,
2926
+ count: 1
2951
2927
  }, options );
2952
2928
 
2953
- this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
2954
- this.texture.isRenderTargetTexture = true;
2929
+ const texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
2930
+
2931
+ texture.flipY = false;
2932
+ texture.generateMipmaps = options.generateMipmaps;
2933
+ texture.internalFormat = options.internalFormat;
2955
2934
 
2956
- this.texture.flipY = false;
2957
- this.texture.generateMipmaps = options.generateMipmaps;
2958
- this.texture.internalFormat = options.internalFormat;
2935
+ this.textures = [];
2936
+
2937
+ const count = options.count;
2938
+ for ( let i = 0; i < count; i ++ ) {
2939
+
2940
+ this.textures[ i ] = texture.clone();
2941
+ this.textures[ i ].isRenderTargetTexture = true;
2942
+
2943
+ }
2959
2944
 
2960
2945
  this.depthBuffer = options.depthBuffer;
2961
2946
  this.stencilBuffer = options.stencilBuffer;
@@ -2966,6 +2951,18 @@ class RenderTarget extends EventDispatcher {
2966
2951
 
2967
2952
  }
2968
2953
 
2954
+ get texture() {
2955
+
2956
+ return this.textures[ 0 ];
2957
+
2958
+ }
2959
+
2960
+ set texture( value ) {
2961
+
2962
+ this.textures[ 0 ] = value;
2963
+
2964
+ }
2965
+
2969
2966
  setSize( width, height, depth = 1 ) {
2970
2967
 
2971
2968
  if ( this.width !== width || this.height !== height || this.depth !== depth ) {
@@ -2974,9 +2971,13 @@ class RenderTarget extends EventDispatcher {
2974
2971
  this.height = height;
2975
2972
  this.depth = depth;
2976
2973
 
2977
- this.texture.image.width = width;
2978
- this.texture.image.height = height;
2979
- this.texture.image.depth = depth;
2974
+ for ( let i = 0, il = this.textures.length; i < il; i ++ ) {
2975
+
2976
+ this.textures[ i ].image.width = width;
2977
+ this.textures[ i ].image.height = height;
2978
+ this.textures[ i ].image.depth = depth;
2979
+
2980
+ }
2980
2981
 
2981
2982
  this.dispose();
2982
2983
 
@@ -3004,8 +3005,14 @@ class RenderTarget extends EventDispatcher {
3004
3005
 
3005
3006
  this.viewport.copy( source.viewport );
3006
3007
 
3007
- this.texture = source.texture.clone();
3008
- this.texture.isRenderTargetTexture = true;
3008
+ this.textures.length = 0;
3009
+
3010
+ for ( let i = 0, il = source.textures.length; i < il; i ++ ) {
3011
+
3012
+ this.textures[ i ] = source.textures[ i ].clone();
3013
+ this.textures[ i ].isRenderTargetTexture = true;
3014
+
3015
+ }
3009
3016
 
3010
3017
  // ensure image object is not shared, see #20328
3011
3018
 
@@ -3133,85 +3140,6 @@ class WebGL3DRenderTarget extends WebGLRenderTarget {
3133
3140
 
3134
3141
  }
3135
3142
 
3136
- class WebGLMultipleRenderTargets extends WebGLRenderTarget {
3137
-
3138
- constructor( width = 1, height = 1, count = 1, options = {} ) {
3139
-
3140
- super( width, height, options );
3141
-
3142
- this.isWebGLMultipleRenderTargets = true;
3143
-
3144
- const texture = this.texture;
3145
-
3146
- this.texture = [];
3147
-
3148
- for ( let i = 0; i < count; i ++ ) {
3149
-
3150
- this.texture[ i ] = texture.clone();
3151
- this.texture[ i ].isRenderTargetTexture = true;
3152
-
3153
- }
3154
-
3155
- }
3156
-
3157
- setSize( width, height, depth = 1 ) {
3158
-
3159
- if ( this.width !== width || this.height !== height || this.depth !== depth ) {
3160
-
3161
- this.width = width;
3162
- this.height = height;
3163
- this.depth = depth;
3164
-
3165
- for ( let i = 0, il = this.texture.length; i < il; i ++ ) {
3166
-
3167
- this.texture[ i ].image.width = width;
3168
- this.texture[ i ].image.height = height;
3169
- this.texture[ i ].image.depth = depth;
3170
-
3171
- }
3172
-
3173
- this.dispose();
3174
-
3175
- }
3176
-
3177
- this.viewport.set( 0, 0, width, height );
3178
- this.scissor.set( 0, 0, width, height );
3179
-
3180
- }
3181
-
3182
- copy( source ) {
3183
-
3184
- this.dispose();
3185
-
3186
- this.width = source.width;
3187
- this.height = source.height;
3188
- this.depth = source.depth;
3189
-
3190
- this.scissor.copy( source.scissor );
3191
- this.scissorTest = source.scissorTest;
3192
-
3193
- this.viewport.copy( source.viewport );
3194
-
3195
- this.depthBuffer = source.depthBuffer;
3196
- this.stencilBuffer = source.stencilBuffer;
3197
-
3198
- if ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();
3199
-
3200
- this.texture.length = 0;
3201
-
3202
- for ( let i = 0, il = source.texture.length; i < il; i ++ ) {
3203
-
3204
- this.texture[ i ] = source.texture[ i ].clone();
3205
- this.texture[ i ].isRenderTargetTexture = true;
3206
-
3207
- }
3208
-
3209
- return this;
3210
-
3211
- }
3212
-
3213
- }
3214
-
3215
3143
  class Quaternion {
3216
3144
 
3217
3145
  constructor( x = 0, y = 0, z = 0, w = 1 ) {
@@ -3803,23 +3731,24 @@ class Quaternion {
3803
3731
 
3804
3732
  random() {
3805
3733
 
3806
- // Derived from http://planning.cs.uiuc.edu/node198.html
3807
- // Note, this source uses w, x, y, z ordering,
3808
- // so we swap the order below.
3734
+ // sets this quaternion to a uniform random unit quaternnion
3809
3735
 
3810
- const u1 = Math.random();
3811
- const sqrt1u1 = Math.sqrt( 1 - u1 );
3812
- const sqrtu1 = Math.sqrt( u1 );
3736
+ // Ken Shoemake
3737
+ // Uniform random rotations
3738
+ // D. Kirk, editor, Graphics Gems III, pages 124-132. Academic Press, New York, 1992.
3813
3739
 
3814
- const u2 = 2 * Math.PI * Math.random();
3740
+ const theta1 = 2 * Math.PI * Math.random();
3741
+ const theta2 = 2 * Math.PI * Math.random();
3815
3742
 
3816
- const u3 = 2 * Math.PI * Math.random();
3743
+ const x0 = Math.random();
3744
+ const r1 = Math.sqrt( 1 - x0 );
3745
+ const r2 = Math.sqrt( x0 );
3817
3746
 
3818
3747
  return this.set(
3819
- sqrt1u1 * Math.cos( u2 ),
3820
- sqrtu1 * Math.sin( u3 ),
3821
- sqrtu1 * Math.cos( u3 ),
3822
- sqrt1u1 * Math.sin( u2 ),
3748
+ r1 * Math.sin( theta1 ),
3749
+ r1 * Math.cos( theta1 ),
3750
+ r2 * Math.sin( theta2 ),
3751
+ r2 * Math.cos( theta2 ),
3823
3752
  );
3824
3753
 
3825
3754
  }
@@ -4587,15 +4516,15 @@ class Vector3 {
4587
4516
 
4588
4517
  randomDirection() {
4589
4518
 
4590
- // Derived from https://mathworld.wolfram.com/SpherePointPicking.html
4519
+ // https://mathworld.wolfram.com/SpherePointPicking.html
4591
4520
 
4592
- const u = ( Math.random() - 0.5 ) * 2;
4593
- const t = Math.random() * Math.PI * 2;
4594
- const f = Math.sqrt( 1 - u ** 2 );
4521
+ const theta = Math.random() * Math.PI * 2;
4522
+ const u = Math.random() * 2 - 1;
4523
+ const c = Math.sqrt( 1 - u * u );
4595
4524
 
4596
- this.x = f * Math.cos( t );
4597
- this.y = f * Math.sin( t );
4598
- this.z = u;
4525
+ this.x = c * Math.cos( theta );
4526
+ this.y = u;
4527
+ this.z = c * Math.sin( theta );
4599
4528
 
4600
4529
  return this;
4601
4530
 
@@ -6621,25 +6550,25 @@ class Matrix4 {
6621
6550
  position.z = te[ 14 ];
6622
6551
 
6623
6552
  // scale the rotation part
6624
- _m1$2.copy( this );
6553
+ _m1$4.copy( this );
6625
6554
 
6626
6555
  const invSX = 1 / sx;
6627
6556
  const invSY = 1 / sy;
6628
6557
  const invSZ = 1 / sz;
6629
6558
 
6630
- _m1$2.elements[ 0 ] *= invSX;
6631
- _m1$2.elements[ 1 ] *= invSX;
6632
- _m1$2.elements[ 2 ] *= invSX;
6559
+ _m1$4.elements[ 0 ] *= invSX;
6560
+ _m1$4.elements[ 1 ] *= invSX;
6561
+ _m1$4.elements[ 2 ] *= invSX;
6633
6562
 
6634
- _m1$2.elements[ 4 ] *= invSY;
6635
- _m1$2.elements[ 5 ] *= invSY;
6636
- _m1$2.elements[ 6 ] *= invSY;
6563
+ _m1$4.elements[ 4 ] *= invSY;
6564
+ _m1$4.elements[ 5 ] *= invSY;
6565
+ _m1$4.elements[ 6 ] *= invSY;
6637
6566
 
6638
- _m1$2.elements[ 8 ] *= invSZ;
6639
- _m1$2.elements[ 9 ] *= invSZ;
6640
- _m1$2.elements[ 10 ] *= invSZ;
6567
+ _m1$4.elements[ 8 ] *= invSZ;
6568
+ _m1$4.elements[ 9 ] *= invSZ;
6569
+ _m1$4.elements[ 10 ] *= invSZ;
6641
6570
 
6642
- quaternion.setFromRotationMatrix( _m1$2 );
6571
+ quaternion.setFromRotationMatrix( _m1$4 );
6643
6572
 
6644
6573
  scale.x = sx;
6645
6574
  scale.y = sy;
@@ -6780,14 +6709,14 @@ class Matrix4 {
6780
6709
  }
6781
6710
 
6782
6711
  const _v1$5 = /*@__PURE__*/ new Vector3();
6783
- const _m1$2 = /*@__PURE__*/ new Matrix4();
6712
+ const _m1$4 = /*@__PURE__*/ new Matrix4();
6784
6713
  const _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );
6785
6714
  const _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );
6786
6715
  const _x = /*@__PURE__*/ new Vector3();
6787
6716
  const _y = /*@__PURE__*/ new Vector3();
6788
6717
  const _z = /*@__PURE__*/ new Vector3();
6789
6718
 
6790
- const _matrix$1 = /*@__PURE__*/ new Matrix4();
6719
+ const _matrix$2 = /*@__PURE__*/ new Matrix4();
6791
6720
  const _quaternion$3 = /*@__PURE__*/ new Quaternion();
6792
6721
 
6793
6722
  class Euler {
@@ -7022,9 +6951,9 @@ class Euler {
7022
6951
 
7023
6952
  setFromQuaternion( q, order, update ) {
7024
6953
 
7025
- _matrix$1.makeRotationFromQuaternion( q );
6954
+ _matrix$2.makeRotationFromQuaternion( q );
7026
6955
 
7027
- return this.setFromRotationMatrix( _matrix$1, order, update );
6956
+ return this.setFromRotationMatrix( _matrix$2, order, update );
7028
6957
 
7029
6958
  }
7030
6959
 
@@ -7159,7 +7088,7 @@ let _object3DId = 0;
7159
7088
 
7160
7089
  const _v1$4 = /*@__PURE__*/ new Vector3();
7161
7090
  const _q1 = /*@__PURE__*/ new Quaternion();
7162
- const _m1$1 = /*@__PURE__*/ new Matrix4();
7091
+ const _m1$3 = /*@__PURE__*/ new Matrix4();
7163
7092
  const _target = /*@__PURE__*/ new Vector3();
7164
7093
 
7165
7094
  const _position$3 = /*@__PURE__*/ new Vector3();
@@ -7173,6 +7102,9 @@ const _zAxis = /*@__PURE__*/ new Vector3( 0, 0, 1 );
7173
7102
  const _addedEvent = { type: 'added' };
7174
7103
  const _removedEvent = { type: 'removed' };
7175
7104
 
7105
+ const _childaddedEvent = { type: 'childadded', child: null };
7106
+ const _childremovedEvent = { type: 'childremoved', child: null };
7107
+
7176
7108
  class Object3D extends EventDispatcher {
7177
7109
 
7178
7110
  constructor() {
@@ -7409,7 +7341,7 @@ class Object3D extends EventDispatcher {
7409
7341
 
7410
7342
  this.updateWorldMatrix( true, false );
7411
7343
 
7412
- return vector.applyMatrix4( _m1$1.copy( this.matrixWorld ).invert() );
7344
+ return vector.applyMatrix4( _m1$3.copy( this.matrixWorld ).invert() );
7413
7345
 
7414
7346
  }
7415
7347
 
@@ -7435,20 +7367,20 @@ class Object3D extends EventDispatcher {
7435
7367
 
7436
7368
  if ( this.isCamera || this.isLight ) {
7437
7369
 
7438
- _m1$1.lookAt( _position$3, _target, this.up );
7370
+ _m1$3.lookAt( _position$3, _target, this.up );
7439
7371
 
7440
7372
  } else {
7441
7373
 
7442
- _m1$1.lookAt( _target, _position$3, this.up );
7374
+ _m1$3.lookAt( _target, _position$3, this.up );
7443
7375
 
7444
7376
  }
7445
7377
 
7446
- this.quaternion.setFromRotationMatrix( _m1$1 );
7378
+ this.quaternion.setFromRotationMatrix( _m1$3 );
7447
7379
 
7448
7380
  if ( parent ) {
7449
7381
 
7450
- _m1$1.extractRotation( parent.matrixWorld );
7451
- _q1.setFromRotationMatrix( _m1$1 );
7382
+ _m1$3.extractRotation( parent.matrixWorld );
7383
+ _q1.setFromRotationMatrix( _m1$3 );
7452
7384
  this.quaternion.premultiply( _q1.invert() );
7453
7385
 
7454
7386
  }
@@ -7478,17 +7410,16 @@ class Object3D extends EventDispatcher {
7478
7410
 
7479
7411
  if ( object && object.isObject3D ) {
7480
7412
 
7481
- if ( object.parent !== null ) {
7482
-
7483
- object.parent.remove( object );
7484
-
7485
- }
7486
-
7413
+ object.removeFromParent();
7487
7414
  object.parent = this;
7488
7415
  this.children.push( object );
7489
7416
 
7490
7417
  object.dispatchEvent( _addedEvent );
7491
7418
 
7419
+ _childaddedEvent.child = object;
7420
+ this.dispatchEvent( _childaddedEvent );
7421
+ _childaddedEvent.child = null;
7422
+
7492
7423
  } else {
7493
7424
 
7494
7425
  console.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object );
@@ -7522,6 +7453,10 @@ class Object3D extends EventDispatcher {
7522
7453
 
7523
7454
  object.dispatchEvent( _removedEvent );
7524
7455
 
7456
+ _childremovedEvent.child = object;
7457
+ this.dispatchEvent( _childremovedEvent );
7458
+ _childremovedEvent.child = null;
7459
+
7525
7460
  }
7526
7461
 
7527
7462
  return this;
@@ -7556,22 +7491,30 @@ class Object3D extends EventDispatcher {
7556
7491
 
7557
7492
  this.updateWorldMatrix( true, false );
7558
7493
 
7559
- _m1$1.copy( this.matrixWorld ).invert();
7494
+ _m1$3.copy( this.matrixWorld ).invert();
7560
7495
 
7561
7496
  if ( object.parent !== null ) {
7562
7497
 
7563
7498
  object.parent.updateWorldMatrix( true, false );
7564
7499
 
7565
- _m1$1.multiply( object.parent.matrixWorld );
7500
+ _m1$3.multiply( object.parent.matrixWorld );
7566
7501
 
7567
7502
  }
7568
7503
 
7569
- object.applyMatrix4( _m1$1 );
7504
+ object.applyMatrix4( _m1$3 );
7570
7505
 
7571
- this.add( object );
7506
+ object.removeFromParent();
7507
+ object.parent = this;
7508
+ this.children.push( object );
7572
7509
 
7573
7510
  object.updateWorldMatrix( false, true );
7574
7511
 
7512
+ object.dispatchEvent( _addedEvent );
7513
+
7514
+ _childaddedEvent.child = object;
7515
+ this.dispatchEvent( _childaddedEvent );
7516
+ _childaddedEvent.child = null;
7517
+
7575
7518
  return this;
7576
7519
 
7577
7520
  }
@@ -9266,7 +9209,7 @@ class Material extends EventDispatcher {
9266
9209
  if ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();
9267
9210
  if ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;
9268
9211
  if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();
9269
- if ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
9212
+ if ( this.emissiveIntensity !== undefined && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
9270
9213
 
9271
9214
  if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();
9272
9215
  if ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;
@@ -9376,6 +9319,7 @@ class Material extends EventDispatcher {
9376
9319
 
9377
9320
  }
9378
9321
 
9322
+ if ( this.envMapRotation !== undefined ) data.envMapRotation = this.envMapRotation.toArray();
9379
9323
  if ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;
9380
9324
  if ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;
9381
9325
  if ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;
@@ -9620,6 +9564,7 @@ class MeshBasicMaterial extends Material {
9620
9564
  this.alphaMap = null;
9621
9565
 
9622
9566
  this.envMap = null;
9567
+ this.envMapRotation = new Euler();
9623
9568
  this.combine = MultiplyOperation;
9624
9569
  this.reflectivity = 1;
9625
9570
  this.refractionRatio = 0.98;
@@ -9654,6 +9599,7 @@ class MeshBasicMaterial extends Material {
9654
9599
  this.alphaMap = source.alphaMap;
9655
9600
 
9656
9601
  this.envMap = source.envMap;
9602
+ this.envMapRotation.copy( source.envMapRotation );
9657
9603
  this.combine = source.combine;
9658
9604
  this.reflectivity = source.reflectivity;
9659
9605
  this.refractionRatio = source.refractionRatio;
@@ -10458,19 +10404,9 @@ class Float32BufferAttribute extends BufferAttribute {
10458
10404
 
10459
10405
  }
10460
10406
 
10461
- class Float64BufferAttribute extends BufferAttribute {
10462
-
10463
- constructor( array, itemSize, normalized ) {
10464
-
10465
- super( new Float64Array( array ), itemSize, normalized );
10466
-
10467
- }
10468
-
10469
- }
10470
-
10471
10407
  let _id$2 = 0;
10472
10408
 
10473
- const _m1 = /*@__PURE__*/ new Matrix4();
10409
+ const _m1$2 = /*@__PURE__*/ new Matrix4();
10474
10410
  const _obj = /*@__PURE__*/ new Object3D();
10475
10411
  const _offset = /*@__PURE__*/ new Vector3();
10476
10412
  const _box$2 = /*@__PURE__*/ new Box3();
@@ -10636,9 +10572,9 @@ class BufferGeometry extends EventDispatcher {
10636
10572
 
10637
10573
  applyQuaternion( q ) {
10638
10574
 
10639
- _m1.makeRotationFromQuaternion( q );
10575
+ _m1$2.makeRotationFromQuaternion( q );
10640
10576
 
10641
- this.applyMatrix4( _m1 );
10577
+ this.applyMatrix4( _m1$2 );
10642
10578
 
10643
10579
  return this;
10644
10580
 
@@ -10648,9 +10584,9 @@ class BufferGeometry extends EventDispatcher {
10648
10584
 
10649
10585
  // rotate geometry around world x-axis
10650
10586
 
10651
- _m1.makeRotationX( angle );
10587
+ _m1$2.makeRotationX( angle );
10652
10588
 
10653
- this.applyMatrix4( _m1 );
10589
+ this.applyMatrix4( _m1$2 );
10654
10590
 
10655
10591
  return this;
10656
10592
 
@@ -10660,9 +10596,9 @@ class BufferGeometry extends EventDispatcher {
10660
10596
 
10661
10597
  // rotate geometry around world y-axis
10662
10598
 
10663
- _m1.makeRotationY( angle );
10599
+ _m1$2.makeRotationY( angle );
10664
10600
 
10665
- this.applyMatrix4( _m1 );
10601
+ this.applyMatrix4( _m1$2 );
10666
10602
 
10667
10603
  return this;
10668
10604
 
@@ -10672,9 +10608,9 @@ class BufferGeometry extends EventDispatcher {
10672
10608
 
10673
10609
  // rotate geometry around world z-axis
10674
10610
 
10675
- _m1.makeRotationZ( angle );
10611
+ _m1$2.makeRotationZ( angle );
10676
10612
 
10677
- this.applyMatrix4( _m1 );
10613
+ this.applyMatrix4( _m1$2 );
10678
10614
 
10679
10615
  return this;
10680
10616
 
@@ -10684,9 +10620,9 @@ class BufferGeometry extends EventDispatcher {
10684
10620
 
10685
10621
  // translate geometry
10686
10622
 
10687
- _m1.makeTranslation( x, y, z );
10623
+ _m1$2.makeTranslation( x, y, z );
10688
10624
 
10689
- this.applyMatrix4( _m1 );
10625
+ this.applyMatrix4( _m1$2 );
10690
10626
 
10691
10627
  return this;
10692
10628
 
@@ -10696,9 +10632,9 @@ class BufferGeometry extends EventDispatcher {
10696
10632
 
10697
10633
  // scale geometry
10698
10634
 
10699
- _m1.makeScale( x, y, z );
10635
+ _m1$2.makeScale( x, y, z );
10700
10636
 
10701
- this.applyMatrix4( _m1 );
10637
+ this.applyMatrix4( _m1$2 );
10702
10638
 
10703
10639
  return this;
10704
10640
 
@@ -10758,7 +10694,7 @@ class BufferGeometry extends EventDispatcher {
10758
10694
 
10759
10695
  if ( position && position.isGLBufferAttribute ) {
10760
10696
 
10761
- console.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this );
10697
+ console.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.', this );
10762
10698
 
10763
10699
  this.boundingBox.set(
10764
10700
  new Vector3( - Infinity, - Infinity, - Infinity ),
@@ -10828,7 +10764,7 @@ class BufferGeometry extends EventDispatcher {
10828
10764
 
10829
10765
  if ( position && position.isGLBufferAttribute ) {
10830
10766
 
10831
- console.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this );
10767
+ console.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.', this );
10832
10768
 
10833
10769
  this.boundingSphere.set( new Vector3(), Infinity );
10834
10770
 
@@ -10945,24 +10881,21 @@ class BufferGeometry extends EventDispatcher {
10945
10881
 
10946
10882
  }
10947
10883
 
10948
- const indices = index.array;
10949
- const positions = attributes.position.array;
10950
- const normals = attributes.normal.array;
10951
- const uvs = attributes.uv.array;
10952
-
10953
- const nVertices = positions.length / 3;
10884
+ const positionAttribute = attributes.position;
10885
+ const normalAttribute = attributes.normal;
10886
+ const uvAttribute = attributes.uv;
10954
10887
 
10955
10888
  if ( this.hasAttribute( 'tangent' ) === false ) {
10956
10889
 
10957
- this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
10890
+ this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 ) );
10958
10891
 
10959
10892
  }
10960
10893
 
10961
- const tangents = this.getAttribute( 'tangent' ).array;
10894
+ const tangentAttribute = this.getAttribute( 'tangent' );
10962
10895
 
10963
10896
  const tan1 = [], tan2 = [];
10964
10897
 
10965
- for ( let i = 0; i < nVertices; i ++ ) {
10898
+ for ( let i = 0; i < positionAttribute.count; i ++ ) {
10966
10899
 
10967
10900
  tan1[ i ] = new Vector3();
10968
10901
  tan2[ i ] = new Vector3();
@@ -10982,13 +10915,13 @@ class BufferGeometry extends EventDispatcher {
10982
10915
 
10983
10916
  function handleTriangle( a, b, c ) {
10984
10917
 
10985
- vA.fromArray( positions, a * 3 );
10986
- vB.fromArray( positions, b * 3 );
10987
- vC.fromArray( positions, c * 3 );
10918
+ vA.fromBufferAttribute( positionAttribute, a );
10919
+ vB.fromBufferAttribute( positionAttribute, b );
10920
+ vC.fromBufferAttribute( positionAttribute, c );
10988
10921
 
10989
- uvA.fromArray( uvs, a * 2 );
10990
- uvB.fromArray( uvs, b * 2 );
10991
- uvC.fromArray( uvs, c * 2 );
10922
+ uvA.fromBufferAttribute( uvAttribute, a );
10923
+ uvB.fromBufferAttribute( uvAttribute, b );
10924
+ uvC.fromBufferAttribute( uvAttribute, c );
10992
10925
 
10993
10926
  vB.sub( vA );
10994
10927
  vC.sub( vA );
@@ -11021,7 +10954,7 @@ class BufferGeometry extends EventDispatcher {
11021
10954
 
11022
10955
  groups = [ {
11023
10956
  start: 0,
11024
- count: indices.length
10957
+ count: index.count
11025
10958
  } ];
11026
10959
 
11027
10960
  }
@@ -11036,9 +10969,9 @@ class BufferGeometry extends EventDispatcher {
11036
10969
  for ( let j = start, jl = start + count; j < jl; j += 3 ) {
11037
10970
 
11038
10971
  handleTriangle(
11039
- indices[ j + 0 ],
11040
- indices[ j + 1 ],
11041
- indices[ j + 2 ]
10972
+ index.getX( j + 0 ),
10973
+ index.getX( j + 1 ),
10974
+ index.getX( j + 2 )
11042
10975
  );
11043
10976
 
11044
10977
  }
@@ -11050,7 +10983,7 @@ class BufferGeometry extends EventDispatcher {
11050
10983
 
11051
10984
  function handleVertex( v ) {
11052
10985
 
11053
- n.fromArray( normals, v * 3 );
10986
+ n.fromBufferAttribute( normalAttribute, v );
11054
10987
  n2.copy( n );
11055
10988
 
11056
10989
  const t = tan1[ v ];
@@ -11066,10 +10999,7 @@ class BufferGeometry extends EventDispatcher {
11066
10999
  const test = tmp2.dot( tan2[ v ] );
11067
11000
  const w = ( test < 0.0 ) ? - 1.0 : 1.0;
11068
11001
 
11069
- tangents[ v * 4 ] = tmp.x;
11070
- tangents[ v * 4 + 1 ] = tmp.y;
11071
- tangents[ v * 4 + 2 ] = tmp.z;
11072
- tangents[ v * 4 + 3 ] = w;
11002
+ tangentAttribute.setXYZW( v, tmp.x, tmp.y, tmp.z, w );
11073
11003
 
11074
11004
  }
11075
11005
 
@@ -11082,9 +11012,9 @@ class BufferGeometry extends EventDispatcher {
11082
11012
 
11083
11013
  for ( let j = start, jl = start + count; j < jl; j += 3 ) {
11084
11014
 
11085
- handleVertex( indices[ j + 0 ] );
11086
- handleVertex( indices[ j + 1 ] );
11087
- handleVertex( indices[ j + 2 ] );
11015
+ handleVertex( index.getX( j + 0 ) );
11016
+ handleVertex( index.getX( j + 1 ) );
11017
+ handleVertex( index.getX( j + 2 ) );
11088
11018
 
11089
11019
  }
11090
11020
 
@@ -11913,7 +11843,6 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
11913
11843
  _uvC$1.fromBufferAttribute( uv1, c );
11914
11844
 
11915
11845
  intersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );
11916
- intersection.uv2 = intersection.uv1; // @deprecated, r152
11917
11846
 
11918
11847
  }
11919
11848
 
@@ -12212,13 +12141,22 @@ function cloneUniformsGroups( src ) {
12212
12141
 
12213
12142
  function getUnlitUniformColorSpace( renderer ) {
12214
12143
 
12215
- if ( renderer.getRenderTarget() === null ) {
12144
+ const currentRenderTarget = renderer.getRenderTarget();
12145
+
12146
+ if ( currentRenderTarget === null ) {
12216
12147
 
12217
12148
  // https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398
12218
12149
  return renderer.outputColorSpace;
12219
12150
 
12220
12151
  }
12221
12152
 
12153
+ // https://github.com/mrdoob/three.js/issues/27868
12154
+ if ( currentRenderTarget.isXRRenderTarget === true ) {
12155
+
12156
+ return currentRenderTarget.texture.colorSpace;
12157
+
12158
+ }
12159
+
12222
12160
  return ColorManagement.workingColorSpace;
12223
12161
 
12224
12162
  }
@@ -12260,10 +12198,6 @@ class ShaderMaterial extends Material {
12260
12198
  this.forceSinglePass = true;
12261
12199
 
12262
12200
  this.extensions = {
12263
- derivatives: false, // set to use derivatives
12264
- fragDepth: false, // set to use fragment depth values
12265
- drawBuffers: false, // set to use draw buffers
12266
- shaderTextureLOD: false, // set to use shader texture LOD
12267
12201
  clipCullDistance: false, // set to use vertex shader clipping
12268
12202
  multiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID
12269
12203
  };
@@ -12947,14 +12881,6 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget {
12947
12881
  const image = { width: size, height: size, depth: 1 };
12948
12882
  const images = [ image, image, image, image, image, image ];
12949
12883
 
12950
- if ( options.encoding !== undefined ) {
12951
-
12952
- // @deprecated, r152
12953
- warnOnce( 'THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace.' );
12954
- options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
12955
-
12956
- }
12957
-
12958
12884
  this.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
12959
12885
 
12960
12886
  // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
@@ -13512,9 +13438,7 @@ function WebGLAnimation() {
13512
13438
 
13513
13439
  }
13514
13440
 
13515
- function WebGLAttributes( gl, capabilities ) {
13516
-
13517
- const isWebGL2 = capabilities.isWebGL2;
13441
+ function WebGLAttributes( gl ) {
13518
13442
 
13519
13443
  const buffers = new WeakMap();
13520
13444
 
@@ -13541,15 +13465,7 @@ function WebGLAttributes( gl, capabilities ) {
13541
13465
 
13542
13466
  if ( attribute.isFloat16BufferAttribute ) {
13543
13467
 
13544
- if ( isWebGL2 ) {
13545
-
13546
- type = gl.HALF_FLOAT;
13547
-
13548
- } else {
13549
-
13550
- throw new Error( 'THREE.WebGLAttributes: Usage of Float16BufferAttribute requires WebGL2.' );
13551
-
13552
- }
13468
+ type = gl.HALF_FLOAT;
13553
13469
 
13554
13470
  } else {
13555
13471
 
@@ -13617,17 +13533,9 @@ function WebGLAttributes( gl, capabilities ) {
13617
13533
  for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
13618
13534
 
13619
13535
  const range = updateRanges[ i ];
13620
- if ( isWebGL2 ) {
13621
-
13622
- gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
13623
- array, range.start, range.count );
13624
-
13625
- } else {
13626
-
13627
- gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
13628
- array.subarray( range.start, range.start + range.count ) );
13629
13536
 
13630
- }
13537
+ gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
13538
+ array, range.start, range.count );
13631
13539
 
13632
13540
  }
13633
13541
 
@@ -13638,17 +13546,8 @@ function WebGLAttributes( gl, capabilities ) {
13638
13546
  // @deprecated, r159
13639
13547
  if ( updateRange.count !== - 1 ) {
13640
13548
 
13641
- if ( isWebGL2 ) {
13642
-
13643
- gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
13644
- array, updateRange.offset, updateRange.count );
13645
-
13646
- } else {
13647
-
13648
- gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
13649
- array.subarray( updateRange.offset, updateRange.offset + updateRange.count ) );
13650
-
13651
- }
13549
+ gl.bufferSubData( bufferType, updateRange.offset * array.BYTES_PER_ELEMENT,
13550
+ array, updateRange.offset, updateRange.count );
13652
13551
 
13653
13552
  updateRange.count = - 1; // reset range
13654
13553
 
@@ -13897,9 +13796,9 @@ var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
13897
13796
 
13898
13797
  var colorspace_pars_fragment = "\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}";
13899
13798
 
13900
- var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
13799
+ var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
13901
13800
 
13902
- var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
13801
+ var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform mat3 envMapRotation;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
13903
13802
 
13904
13803
  var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";
13905
13804
 
@@ -13927,7 +13826,7 @@ var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertM
13927
13826
 
13928
13827
  var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";
13929
13828
 
13930
- var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif";
13829
+ var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif";
13931
13830
 
13932
13831
  var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
13933
13832
 
@@ -13947,13 +13846,13 @@ var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGH
13947
13846
 
13948
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";
13949
13848
 
13950
- 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";
13951
13850
 
13952
- 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";
13953
13852
 
13954
- 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";
13955
13854
 
13956
- 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";
13957
13856
 
13958
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";
13959
13858
 
@@ -13967,11 +13866,13 @@ var metalnessmap_fragment = "float metalnessFactor = metalness;\n#ifdef USE_META
13967
13866
 
13968
13867
  var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";
13969
13868
 
13869
+ var morphinstance_vertex = "#ifdef USE_INSTANCING_MORPH\n\tfloat morphTargetInfluences[MORPHTARGETS_COUNT];\n\tfloat morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\tmorphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;\n\t}\n#endif";
13870
+
13970
13871
  var morphcolor_vertex = "#if defined( USE_MORPHCOLORS ) && defined( MORPHTARGETS_TEXTURE )\n\tvColor *= morphTargetBaseInfluence;\n\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t#if defined( USE_COLOR_ALPHA )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];\n\t\t#elif defined( USE_COLOR )\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];\n\t\t#endif\n\t}\n#endif";
13971
13872
 
13972
13873
  var morphnormal_vertex = "#ifdef USE_MORPHNORMALS\n\tobjectNormal *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\tobjectNormal += morphNormal0 * morphTargetInfluences[ 0 ];\n\t\tobjectNormal += morphNormal1 * morphTargetInfluences[ 1 ];\n\t\tobjectNormal += morphNormal2 * morphTargetInfluences[ 2 ];\n\t\tobjectNormal += morphNormal3 * morphTargetInfluences[ 3 ];\n\t#endif\n#endif";
13973
13874
 
13974
- var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\tuniform float morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif";
13875
+ var morphtarget_pars_vertex = "#ifdef USE_MORPHTARGETS\n\t#ifndef USE_INSTANCING_MORPH\n\t\tuniform float morphTargetBaseInfluence;\n\t#endif\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\t#ifndef USE_INSTANCING_MORPH\n\t\t\tuniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];\n\t\t#endif\n\t\tuniform sampler2DArray morphTargetsTexture;\n\t\tuniform ivec2 morphTargetsTextureSize;\n\t\tvec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {\n\t\t\tint texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;\n\t\t\tint y = texelIndex / morphTargetsTextureSize.x;\n\t\t\tint x = texelIndex - y * morphTargetsTextureSize.x;\n\t\t\tivec3 morphUV = ivec3( x, y, morphTargetIndex );\n\t\t\treturn texelFetch( morphTargetsTexture, morphUV, 0 );\n\t\t}\n\t#else\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\tuniform float morphTargetInfluences[ 8 ];\n\t\t#else\n\t\t\tuniform float morphTargetInfluences[ 4 ];\n\t\t#endif\n\t#endif\n#endif";
13975
13876
 
13976
13877
  var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif";
13977
13878
 
@@ -14011,7 +13912,7 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
14011
13912
 
14012
13913
  var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
14013
13914
 
14014
- 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";
14015
13916
 
14016
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";
14017
13918
 
@@ -14033,7 +13934,7 @@ var specularmap_pars_fragment = "#ifdef USE_SPECULARMAP\n\tuniform sampler2D spe
14033
13934
 
14034
13935
  var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
14035
13936
 
14036
- 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 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; }";
14037
13938
 
14038
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";
14039
13940
 
@@ -14053,17 +13954,17 @@ const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\n
14053
13954
 
14054
13955
  const vertex$g = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
14055
13956
 
14056
- const fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
13957
+ const fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nuniform mat3 backgroundRotation;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
14057
13958
 
14058
13959
  const vertex$f = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
14059
13960
 
14060
13961
  const fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
14061
13962
 
14062
- const vertex$e = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
13963
+ const vertex$e = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
14063
13964
 
14064
13965
  const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}";
14065
13966
 
14066
- const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
13967
+ const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <skinbase_vertex>\n\t#include <morphinstance_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <worldpos_vertex>\n\t#include <clipping_planes_vertex>\n\tvWorldPosition = worldPosition.xyz;\n}";
14067
13968
 
14068
13969
  const fragment$d = "#define DISTANCE\nuniform vec3 referencePosition;\nuniform float nearDistance;\nuniform float farDistance;\nvarying vec3 vWorldPosition;\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main () {\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#include <clipping_planes_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\tfloat dist = length( vWorldPosition - referencePosition );\n\tdist = ( dist - nearDistance ) / ( farDistance - nearDistance );\n\tdist = saturate( dist );\n\tgl_FragColor = packDepthToRGBA( dist );\n}";
14069
13970
 
@@ -14071,43 +13972,43 @@ const vertex$c = "varying vec3 vWorldDirection;\n#include <common>\nvoid main()
14071
13972
 
14072
13973
  const fragment$c = "uniform sampler2D tEquirect;\nvarying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvec3 direction = normalize( vWorldDirection );\n\tvec2 sampleUV = equirectUv( direction );\n\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
14073
13974
 
14074
- const vertex$b = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
13975
+ const vertex$b = "uniform float scale;\nattribute float lineDistance;\nvarying float vLineDistance;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\tvLineDistance = scale * lineDistance;\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
14075
13976
 
14076
13977
  const fragment$b = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";
14077
13978
 
14078
- const vertex$a = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";
13979
+ const vertex$a = "#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";
14079
13980
 
14080
13981
  const fragment$a = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
14081
13982
 
14082
- const vertex$9 = "#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13983
+ const vertex$9 = "#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
14083
13984
 
14084
13985
  const fragment$9 = "#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
14085
13986
 
14086
- const vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
13987
+ const vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
14087
13988
 
14088
13989
  const fragment$8 = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
14089
13990
 
14090
- const vertex$7 = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";
13991
+ const vertex$7 = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvViewPosition = - mvPosition.xyz;\n#endif\n}";
14091
13992
 
14092
13993
  const fragment$7 = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}";
14093
13994
 
14094
- const vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13995
+ const vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
14095
13996
 
14096
13997
  const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
14097
13998
 
14098
- const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
13999
+ const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
14099
14000
 
14100
14001
  const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
14101
14002
 
14102
- const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
14003
+ const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
14103
14004
 
14104
14005
  const fragment$4 = "#define TOON\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <gradientmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_toon_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_toon_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
14105
14006
 
14106
- const vertex$3 = "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}";
14007
+ const vertex$3 = "uniform float size;\nuniform float scale;\n#include <common>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n#ifdef USE_POINTS_UV\n\tvarying vec2 vUv;\n\tuniform mat3 uvTransform;\n#endif\nvoid main() {\n\t#ifdef USE_POINTS_UV\n\t\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\t#endif\n\t#include <color_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphcolor_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <project_vertex>\n\tgl_PointSize = size;\n\t#ifdef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );\n\t#endif\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <fog_vertex>\n}";
14107
14008
 
14108
14009
  const fragment$3 = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\n#include <color_pars_fragment>\n#include <map_particle_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\t#include <logdepthbuf_fragment>\n\t#include <map_particle_fragment>\n\t#include <color_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\toutgoingLight = diffuseColor.rgb;\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n}";
14109
14010
 
14110
- const vertex$2 = "#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
14011
+ const vertex$2 = "#include <common>\n#include <batching_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <shadowmap_pars_vertex>\nvoid main() {\n\t#include <batching_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphinstance_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
14111
14012
 
14112
14013
  const fragment$2 = "uniform vec3 color;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <logdepthbuf_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\nvoid main() {\n\t#include <logdepthbuf_fragment>\n\tgl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n}";
14113
14014
 
@@ -14183,6 +14084,7 @@ const ShaderChunk = {
14183
14084
  map_particle_pars_fragment: map_particle_pars_fragment,
14184
14085
  metalnessmap_fragment: metalnessmap_fragment,
14185
14086
  metalnessmap_pars_fragment: metalnessmap_pars_fragment,
14087
+ morphinstance_vertex: morphinstance_vertex,
14186
14088
  morphcolor_vertex: morphcolor_vertex,
14187
14089
  morphnormal_vertex: morphnormal_vertex,
14188
14090
  morphtarget_pars_vertex: morphtarget_pars_vertex,
@@ -14291,6 +14193,7 @@ const UniformsLib = {
14291
14193
  envmap: {
14292
14194
 
14293
14195
  envMap: { value: null },
14196
+ envMapRotation: { value: /*@__PURE__*/ new Matrix3() },
14294
14197
  flipEnvMap: { value: - 1 },
14295
14198
  reflectivity: { value: 1.0 }, // basic, lambert, phong
14296
14199
  ior: { value: 1.5 }, // physical
@@ -14572,7 +14475,7 @@ const ShaderLib = {
14572
14475
  emissive: { value: /*@__PURE__*/ new Color( 0x000000 ) },
14573
14476
  roughness: { value: 1.0 },
14574
14477
  metalness: { value: 0.0 },
14575
- envMapIntensity: { value: 1 } // temporary
14478
+ envMapIntensity: { value: 1 }
14576
14479
  }
14577
14480
  ] ),
14578
14481
 
@@ -14711,7 +14614,8 @@ const ShaderLib = {
14711
14614
  envMap: { value: null },
14712
14615
  flipEnvMap: { value: - 1 },
14713
14616
  backgroundBlurriness: { value: 0 },
14714
- backgroundIntensity: { value: 1 }
14617
+ backgroundIntensity: { value: 1 },
14618
+ backgroundRotation: { value: /*@__PURE__*/ new Matrix3() }
14715
14619
  },
14716
14620
 
14717
14621
  vertexShader: ShaderChunk.backgroundCube_vert,
@@ -14835,6 +14739,8 @@ ShaderLib.physical = {
14835
14739
  };
14836
14740
 
14837
14741
  const _rgb = { r: 0, b: 0, g: 0 };
14742
+ const _e1$1 = /*@__PURE__*/ new Euler();
14743
+ const _m1$1 = /*@__PURE__*/ new Matrix4();
14838
14744
 
14839
14745
  function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha ) {
14840
14746
 
@@ -14931,10 +14837,24 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
14931
14837
 
14932
14838
  }
14933
14839
 
14840
+ _e1$1.copy( scene.backgroundRotation );
14841
+
14842
+ // accommodate left-handed frame
14843
+ _e1$1.x *= - 1; _e1$1.y *= - 1; _e1$1.z *= - 1;
14844
+
14845
+ if ( background.isCubeTexture && background.isRenderTargetTexture === false ) {
14846
+
14847
+ // environment maps which are not cube render targets or PMREMs follow a different convention
14848
+ _e1$1.y *= - 1;
14849
+ _e1$1.z *= - 1;
14850
+
14851
+ }
14852
+
14934
14853
  boxMesh.material.uniforms.envMap.value = background;
14935
14854
  boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;
14936
14855
  boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
14937
14856
  boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
14857
+ boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( _e1$1 ) );
14938
14858
  boxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
14939
14859
 
14940
14860
  if ( currentBackground !== background ||
@@ -15061,13 +14981,10 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
15061
14981
 
15062
14982
  }
15063
14983
 
15064
- function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
14984
+ function WebGLBindingStates( gl, attributes ) {
15065
14985
 
15066
14986
  const maxVertexAttributes = gl.getParameter( gl.MAX_VERTEX_ATTRIBS );
15067
14987
 
15068
- const extension = capabilities.isWebGL2 ? null : extensions.get( 'OES_vertex_array_object' );
15069
- const vaoAvailable = capabilities.isWebGL2 || extension !== null;
15070
-
15071
14988
  const bindingStates = {};
15072
14989
 
15073
14990
  const defaultState = createBindingState( null );
@@ -15078,38 +14995,18 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
15078
14995
 
15079
14996
  let updateBuffers = false;
15080
14997
 
15081
- if ( vaoAvailable ) {
14998
+ const state = getBindingState( geometry, program, material );
15082
14999
 
15083
- const state = getBindingState( geometry, program, material );
15000
+ if ( currentState !== state ) {
15084
15001
 
15085
- if ( currentState !== state ) {
15002
+ currentState = state;
15003
+ bindVertexArrayObject( currentState.object );
15086
15004
 
15087
- currentState = state;
15088
- bindVertexArrayObject( currentState.object );
15089
-
15090
- }
15091
-
15092
- updateBuffers = needsUpdate( object, geometry, program, index );
15093
-
15094
- if ( updateBuffers ) saveCache( object, geometry, program, index );
15095
-
15096
- } else {
15097
-
15098
- const wireframe = ( material.wireframe === true );
15099
-
15100
- if ( currentState.geometry !== geometry.id ||
15101
- currentState.program !== program.id ||
15102
- currentState.wireframe !== wireframe ) {
15103
-
15104
- currentState.geometry = geometry.id;
15105
- currentState.program = program.id;
15106
- currentState.wireframe = wireframe;
15005
+ }
15107
15006
 
15108
- updateBuffers = true;
15007
+ updateBuffers = needsUpdate( object, geometry, program, index );
15109
15008
 
15110
- }
15111
-
15112
- }
15009
+ if ( updateBuffers ) saveCache( object, geometry, program, index );
15113
15010
 
15114
15011
  if ( index !== null ) {
15115
15012
 
@@ -15135,25 +15032,19 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
15135
15032
 
15136
15033
  function createVertexArrayObject() {
15137
15034
 
15138
- if ( capabilities.isWebGL2 ) return gl.createVertexArray();
15139
-
15140
- return extension.createVertexArrayOES();
15035
+ return gl.createVertexArray();
15141
15036
 
15142
15037
  }
15143
15038
 
15144
15039
  function bindVertexArrayObject( vao ) {
15145
15040
 
15146
- if ( capabilities.isWebGL2 ) return gl.bindVertexArray( vao );
15147
-
15148
- return extension.bindVertexArrayOES( vao );
15041
+ return gl.bindVertexArray( vao );
15149
15042
 
15150
15043
  }
15151
15044
 
15152
15045
  function deleteVertexArrayObject( vao ) {
15153
15046
 
15154
- if ( capabilities.isWebGL2 ) return gl.deleteVertexArray( vao );
15155
-
15156
- return extension.deleteVertexArrayOES( vao );
15047
+ return gl.deleteVertexArray( vao );
15157
15048
 
15158
15049
  }
15159
15050
 
@@ -15351,9 +15242,7 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
15351
15242
 
15352
15243
  if ( attributeDivisors[ attribute ] !== meshPerAttribute ) {
15353
15244
 
15354
- const extension = capabilities.isWebGL2 ? gl : extensions.get( 'ANGLE_instanced_arrays' );
15355
-
15356
- extension[ capabilities.isWebGL2 ? 'vertexAttribDivisor' : 'vertexAttribDivisorANGLE' ]( attribute, meshPerAttribute );
15245
+ gl.vertexAttribDivisor( attribute, meshPerAttribute );
15357
15246
  attributeDivisors[ attribute ] = meshPerAttribute;
15358
15247
 
15359
15248
  }
@@ -15394,12 +15283,6 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
15394
15283
 
15395
15284
  function setupVertexAttributes( object, material, program, geometry ) {
15396
15285
 
15397
- if ( capabilities.isWebGL2 === false && ( object.isInstancedMesh || geometry.isInstancedBufferGeometry ) ) {
15398
-
15399
- if ( extensions.get( 'ANGLE_instanced_arrays' ) === null ) return;
15400
-
15401
- }
15402
-
15403
15286
  initAttributes();
15404
15287
 
15405
15288
  const geometryAttributes = geometry.attributes;
@@ -15438,9 +15321,9 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
15438
15321
  const type = attribute.type;
15439
15322
  const bytesPerElement = attribute.bytesPerElement;
15440
15323
 
15441
- // check for integer attributes (WebGL 2 only)
15324
+ // check for integer attributes
15442
15325
 
15443
- 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 );
15444
15327
 
15445
15328
  if ( geometryAttribute.isInterleavedBufferAttribute ) {
15446
15329
 
@@ -15688,9 +15571,7 @@ function WebGLBindingStates( gl, extensions, attributes, capabilities ) {
15688
15571
 
15689
15572
  }
15690
15573
 
15691
- function WebGLBufferRenderer( gl, extensions, info, capabilities ) {
15692
-
15693
- const isWebGL2 = capabilities.isWebGL2;
15574
+ function WebGLBufferRenderer( gl, extensions, info ) {
15694
15575
 
15695
15576
  let mode;
15696
15577
 
@@ -15712,28 +15593,7 @@ function WebGLBufferRenderer( gl, extensions, info, capabilities ) {
15712
15593
 
15713
15594
  if ( primcount === 0 ) return;
15714
15595
 
15715
- let extension, methodName;
15716
-
15717
- if ( isWebGL2 ) {
15718
-
15719
- extension = gl;
15720
- methodName = 'drawArraysInstanced';
15721
-
15722
- } else {
15723
-
15724
- extension = extensions.get( 'ANGLE_instanced_arrays' );
15725
- methodName = 'drawArraysInstancedANGLE';
15726
-
15727
- if ( extension === null ) {
15728
-
15729
- console.error( 'THREE.WebGLBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );
15730
- return;
15731
-
15732
- }
15733
-
15734
- }
15735
-
15736
- extension[ methodName ]( mode, start, count, primcount );
15596
+ gl.drawArraysInstanced( mode, start, count, primcount );
15737
15597
 
15738
15598
  info.update( count, mode, primcount );
15739
15599
 
@@ -15744,6 +15604,7 @@ function WebGLBufferRenderer( gl, extensions, info, capabilities ) {
15744
15604
  if ( drawCount === 0 ) return;
15745
15605
 
15746
15606
  const extension = extensions.get( 'WEBGL_multi_draw' );
15607
+
15747
15608
  if ( extension === null ) {
15748
15609
 
15749
15610
  for ( let i = 0; i < drawCount; i ++ ) {
@@ -15832,8 +15693,6 @@ function WebGLCapabilities( gl, extensions, parameters ) {
15832
15693
 
15833
15694
  }
15834
15695
 
15835
- const isWebGL2 = typeof WebGL2RenderingContext !== 'undefined' && gl.constructor.name === 'WebGL2RenderingContext';
15836
-
15837
15696
  let precision = parameters.precision !== undefined ? parameters.precision : 'highp';
15838
15697
  const maxPrecision = getMaxPrecision( precision );
15839
15698
 
@@ -15844,8 +15703,6 @@ function WebGLCapabilities( gl, extensions, parameters ) {
15844
15703
 
15845
15704
  }
15846
15705
 
15847
- const drawBuffers = isWebGL2 || extensions.has( 'WEBGL_draw_buffers' );
15848
-
15849
15706
  const logarithmicDepthBuffer = parameters.logarithmicDepthBuffer === true;
15850
15707
 
15851
15708
  const maxTextures = gl.getParameter( gl.MAX_TEXTURE_IMAGE_UNITS );
@@ -15859,16 +15716,12 @@ function WebGLCapabilities( gl, extensions, parameters ) {
15859
15716
  const maxFragmentUniforms = gl.getParameter( gl.MAX_FRAGMENT_UNIFORM_VECTORS );
15860
15717
 
15861
15718
  const vertexTextures = maxVertexTextures > 0;
15862
- const floatFragmentTextures = isWebGL2 || extensions.has( 'OES_texture_float' );
15863
- const floatVertexTextures = vertexTextures && floatFragmentTextures;
15864
15719
 
15865
- const maxSamples = isWebGL2 ? gl.getParameter( gl.MAX_SAMPLES ) : 0;
15720
+ const maxSamples = gl.getParameter( gl.MAX_SAMPLES );
15866
15721
 
15867
15722
  return {
15868
15723
 
15869
- isWebGL2: isWebGL2,
15870
-
15871
- drawBuffers: drawBuffers,
15724
+ isWebGL2: true, // keeping this for backwards compatibility
15872
15725
 
15873
15726
  getMaxAnisotropy: getMaxAnisotropy,
15874
15727
  getMaxPrecision: getMaxPrecision,
@@ -15887,8 +15740,6 @@ function WebGLCapabilities( gl, extensions, parameters ) {
15887
15740
  maxFragmentUniforms: maxFragmentUniforms,
15888
15741
 
15889
15742
  vertexTextures: vertexTextures,
15890
- floatFragmentTextures: floatFragmentTextures,
15891
- floatVertexTextures: floatVertexTextures,
15892
15743
 
15893
15744
  maxSamples: maxSamples
15894
15745
 
@@ -16307,6 +16158,7 @@ const _clearColor = /*@__PURE__*/ new Color();
16307
16158
  let _oldTarget = null;
16308
16159
  let _oldActiveCubeFace = 0;
16309
16160
  let _oldActiveMipmapLevel = 0;
16161
+ let _oldXrEnabled = false;
16310
16162
 
16311
16163
  // Golden Ratio
16312
16164
  const PHI = ( 1 + Math.sqrt( 5 ) ) / 2;
@@ -16374,6 +16226,9 @@ class PMREMGenerator {
16374
16226
  _oldTarget = this._renderer.getRenderTarget();
16375
16227
  _oldActiveCubeFace = this._renderer.getActiveCubeFace();
16376
16228
  _oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
16229
+ _oldXrEnabled = this._renderer.xr.enabled;
16230
+
16231
+ this._renderer.xr.enabled = false;
16377
16232
 
16378
16233
  this._setSize( 256 );
16379
16234
 
@@ -16399,6 +16254,7 @@ class PMREMGenerator {
16399
16254
  * Generates a PMREM from an equirectangular texture, which can be either LDR
16400
16255
  * or HDR. The ideal input image size is 1k (1024 x 512),
16401
16256
  * as this matches best with the 256 x 256 cubemap output.
16257
+ * The smallest supported equirectangular image size is 64 x 32.
16402
16258
  */
16403
16259
  fromEquirectangular( equirectangular, renderTarget = null ) {
16404
16260
 
@@ -16410,6 +16266,7 @@ class PMREMGenerator {
16410
16266
  * Generates a PMREM from an cubemap texture, which can be either LDR
16411
16267
  * or HDR. The ideal input cube size is 256 x 256,
16412
16268
  * as this matches best with the 256 x 256 cubemap output.
16269
+ * The smallest supported cube size is 16 x 16.
16413
16270
  */
16414
16271
  fromCubemap( cubemap, renderTarget = null ) {
16415
16272
 
@@ -16487,6 +16344,8 @@ class PMREMGenerator {
16487
16344
  _cleanup( outputTarget ) {
16488
16345
 
16489
16346
  this._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );
16347
+ this._renderer.xr.enabled = _oldXrEnabled;
16348
+
16490
16349
  outputTarget.scissorTest = false;
16491
16350
  _setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );
16492
16351
 
@@ -16507,6 +16366,9 @@ class PMREMGenerator {
16507
16366
  _oldTarget = this._renderer.getRenderTarget();
16508
16367
  _oldActiveCubeFace = this._renderer.getActiveCubeFace();
16509
16368
  _oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();
16369
+ _oldXrEnabled = this._renderer.xr.enabled;
16370
+
16371
+ this._renderer.xr.enabled = false;
16510
16372
 
16511
16373
  const cubeUVRenderTarget = renderTarget || this._allocateTargets();
16512
16374
  this._textureToCubeUV( texture, cubeUVRenderTarget );
@@ -17189,24 +17051,26 @@ function WebGLCubeUVMaps( renderer ) {
17189
17051
 
17190
17052
  if ( isEquirectMap || isCubeMap ) {
17191
17053
 
17192
- if ( texture.isRenderTargetTexture && texture.needsPMREMUpdate === true ) {
17054
+ let renderTarget = cubeUVmaps.get( texture );
17193
17055
 
17194
- texture.needsPMREMUpdate = false;
17056
+ const currentPMREMVersion = renderTarget !== undefined ? renderTarget.texture.pmremVersion : 0;
17195
17057
 
17196
- let renderTarget = cubeUVmaps.get( texture );
17058
+ if ( texture.isRenderTargetTexture && texture.pmremVersion !== currentPMREMVersion ) {
17197
17059
 
17198
17060
  if ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );
17199
17061
 
17200
17062
  renderTarget = isEquirectMap ? pmremGenerator.fromEquirectangular( texture, renderTarget ) : pmremGenerator.fromCubemap( texture, renderTarget );
17063
+ renderTarget.texture.pmremVersion = texture.pmremVersion;
17064
+
17201
17065
  cubeUVmaps.set( texture, renderTarget );
17202
17066
 
17203
17067
  return renderTarget.texture;
17204
17068
 
17205
17069
  } else {
17206
17070
 
17207
- if ( cubeUVmaps.has( texture ) ) {
17071
+ if ( renderTarget !== undefined ) {
17208
17072
 
17209
- return cubeUVmaps.get( texture ).texture;
17073
+ return renderTarget.texture;
17210
17074
 
17211
17075
  } else {
17212
17076
 
@@ -17216,7 +17080,9 @@ function WebGLCubeUVMaps( renderer ) {
17216
17080
 
17217
17081
  if ( pmremGenerator === null ) pmremGenerator = new PMREMGenerator( renderer );
17218
17082
 
17219
- 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
+
17220
17086
  cubeUVmaps.set( texture, renderTarget );
17221
17087
 
17222
17088
  texture.addEventListener( 'dispose', onTextureDispose );
@@ -17347,29 +17213,14 @@ function WebGLExtensions( gl ) {
17347
17213
 
17348
17214
  },
17349
17215
 
17350
- init: function ( capabilities ) {
17351
-
17352
- if ( capabilities.isWebGL2 ) {
17353
-
17354
- getExtension( 'EXT_color_buffer_float' );
17355
- getExtension( 'WEBGL_clip_cull_distance' );
17356
-
17357
- } else {
17358
-
17359
- getExtension( 'WEBGL_depth_texture' );
17360
- getExtension( 'OES_texture_float' );
17361
- getExtension( 'OES_texture_half_float' );
17362
- getExtension( 'OES_texture_half_float_linear' );
17363
- getExtension( 'OES_standard_derivatives' );
17364
- getExtension( 'OES_element_index_uint' );
17365
- getExtension( 'OES_vertex_array_object' );
17366
- getExtension( 'ANGLE_instanced_arrays' );
17367
-
17368
- }
17216
+ init: function () {
17369
17217
 
17218
+ getExtension( 'EXT_color_buffer_float' );
17219
+ getExtension( 'WEBGL_clip_cull_distance' );
17370
17220
  getExtension( 'OES_texture_float_linear' );
17371
17221
  getExtension( 'EXT_color_buffer_half_float' );
17372
17222
  getExtension( 'WEBGL_multisampled_render_to_texture' );
17223
+ getExtension( 'WEBGL_render_shared_exponent' );
17373
17224
 
17374
17225
  },
17375
17226
 
@@ -17597,9 +17448,7 @@ function WebGLGeometries( gl, attributes, info, bindingStates ) {
17597
17448
 
17598
17449
  }
17599
17450
 
17600
- function WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {
17601
-
17602
- const isWebGL2 = capabilities.isWebGL2;
17451
+ function WebGLIndexedBufferRenderer( gl, extensions, info ) {
17603
17452
 
17604
17453
  let mode;
17605
17454
 
@@ -17630,28 +17479,7 @@ function WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {
17630
17479
 
17631
17480
  if ( primcount === 0 ) return;
17632
17481
 
17633
- let extension, methodName;
17634
-
17635
- if ( isWebGL2 ) {
17636
-
17637
- extension = gl;
17638
- methodName = 'drawElementsInstanced';
17639
-
17640
- } else {
17641
-
17642
- extension = extensions.get( 'ANGLE_instanced_arrays' );
17643
- methodName = 'drawElementsInstancedANGLE';
17644
-
17645
- if ( extension === null ) {
17646
-
17647
- console.error( 'THREE.WebGLIndexedBufferRenderer: using THREE.InstancedBufferGeometry but hardware does not support extension ANGLE_instanced_arrays.' );
17648
- return;
17649
-
17650
- }
17651
-
17652
- }
17653
-
17654
- extension[ methodName ]( mode, count, type, start * bytesPerElement, primcount );
17482
+ gl.drawElementsInstanced( mode, count, type, start * bytesPerElement, primcount );
17655
17483
 
17656
17484
  info.update( count, mode, primcount );
17657
17485
 
@@ -17662,6 +17490,7 @@ function WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {
17662
17490
  if ( drawCount === 0 ) return;
17663
17491
 
17664
17492
  const extension = extensions.get( 'WEBGL_multi_draw' );
17493
+
17665
17494
  if ( extension === null ) {
17666
17495
 
17667
17496
  for ( let i = 0; i < drawCount; i ++ ) {
@@ -17766,289 +17595,158 @@ function WebGLInfo( gl ) {
17766
17595
 
17767
17596
  }
17768
17597
 
17769
- function numericalSort( a, b ) {
17770
-
17771
- return a[ 0 ] - b[ 0 ];
17772
-
17773
- }
17774
-
17775
- function absNumericalSort( a, b ) {
17776
-
17777
- return Math.abs( b[ 1 ] ) - Math.abs( a[ 1 ] );
17778
-
17779
- }
17780
-
17781
17598
  function WebGLMorphtargets( gl, capabilities, textures ) {
17782
17599
 
17783
- const influencesList = {};
17784
- const morphInfluences = new Float32Array( 8 );
17785
17600
  const morphTextures = new WeakMap();
17786
17601
  const morph = new Vector4();
17787
17602
 
17788
- const workInfluences = [];
17789
-
17790
- for ( let i = 0; i < 8; i ++ ) {
17791
-
17792
- workInfluences[ i ] = [ i, 0 ];
17793
-
17794
- }
17795
-
17796
17603
  function update( object, geometry, program ) {
17797
17604
 
17798
17605
  const objectInfluences = object.morphTargetInfluences;
17799
17606
 
17800
- if ( capabilities.isWebGL2 === true ) {
17801
-
17802
- // instead of using attributes, the WebGL 2 code path encodes morph targets
17803
- // into an array of data textures. Each layer represents a single morph target.
17804
-
17805
- const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
17806
- const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
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.
17807
17609
 
17808
- let entry = morphTextures.get( geometry );
17809
-
17810
- if ( entry === undefined || entry.count !== morphTargetsCount ) {
17811
-
17812
- if ( entry !== undefined ) entry.texture.dispose();
17813
-
17814
- const hasMorphPosition = geometry.morphAttributes.position !== undefined;
17815
- const hasMorphNormals = geometry.morphAttributes.normal !== undefined;
17816
- const hasMorphColors = geometry.morphAttributes.color !== undefined;
17817
-
17818
- const morphTargets = geometry.morphAttributes.position || [];
17819
- const morphNormals = geometry.morphAttributes.normal || [];
17820
- const morphColors = geometry.morphAttributes.color || [];
17610
+ const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
17611
+ const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;
17821
17612
 
17822
- let vertexDataCount = 0;
17613
+ let entry = morphTextures.get( geometry );
17823
17614
 
17824
- if ( hasMorphPosition === true ) vertexDataCount = 1;
17825
- if ( hasMorphNormals === true ) vertexDataCount = 2;
17826
- if ( hasMorphColors === true ) vertexDataCount = 3;
17615
+ if ( entry === undefined || entry.count !== morphTargetsCount ) {
17827
17616
 
17828
- let width = geometry.attributes.position.count * vertexDataCount;
17829
- let height = 1;
17617
+ if ( entry !== undefined ) entry.texture.dispose();
17830
17618
 
17831
- if ( width > capabilities.maxTextureSize ) {
17619
+ const hasMorphPosition = geometry.morphAttributes.position !== undefined;
17620
+ const hasMorphNormals = geometry.morphAttributes.normal !== undefined;
17621
+ const hasMorphColors = geometry.morphAttributes.color !== undefined;
17832
17622
 
17833
- height = Math.ceil( width / capabilities.maxTextureSize );
17834
- width = capabilities.maxTextureSize;
17623
+ const morphTargets = geometry.morphAttributes.position || [];
17624
+ const morphNormals = geometry.morphAttributes.normal || [];
17625
+ const morphColors = geometry.morphAttributes.color || [];
17835
17626
 
17836
- }
17627
+ let vertexDataCount = 0;
17837
17628
 
17838
- const buffer = new Float32Array( width * height * 4 * morphTargetsCount );
17629
+ if ( hasMorphPosition === true ) vertexDataCount = 1;
17630
+ if ( hasMorphNormals === true ) vertexDataCount = 2;
17631
+ if ( hasMorphColors === true ) vertexDataCount = 3;
17839
17632
 
17840
- const texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );
17841
- texture.type = FloatType;
17842
- texture.needsUpdate = true;
17633
+ let width = geometry.attributes.position.count * vertexDataCount;
17634
+ let height = 1;
17843
17635
 
17844
- // fill buffer
17636
+ if ( width > capabilities.maxTextureSize ) {
17845
17637
 
17846
- const vertexDataStride = vertexDataCount * 4;
17638
+ height = Math.ceil( width / capabilities.maxTextureSize );
17639
+ width = capabilities.maxTextureSize;
17847
17640
 
17848
- for ( let i = 0; i < morphTargetsCount; i ++ ) {
17641
+ }
17849
17642
 
17850
- const morphTarget = morphTargets[ i ];
17851
- const morphNormal = morphNormals[ i ];
17852
- const morphColor = morphColors[ i ];
17643
+ const buffer = new Float32Array( width * height * 4 * morphTargetsCount );
17853
17644
 
17854
- const offset = width * height * 4 * i;
17645
+ const texture = new DataArrayTexture( buffer, width, height, morphTargetsCount );
17646
+ texture.type = FloatType;
17647
+ texture.needsUpdate = true;
17855
17648
 
17856
- for ( let j = 0; j < morphTarget.count; j ++ ) {
17649
+ // fill buffer
17857
17650
 
17858
- const stride = j * vertexDataStride;
17651
+ const vertexDataStride = vertexDataCount * 4;
17859
17652
 
17860
- if ( hasMorphPosition === true ) {
17653
+ for ( let i = 0; i < morphTargetsCount; i ++ ) {
17861
17654
 
17862
- morph.fromBufferAttribute( morphTarget, j );
17655
+ const morphTarget = morphTargets[ i ];
17656
+ const morphNormal = morphNormals[ i ];
17657
+ const morphColor = morphColors[ i ];
17863
17658
 
17864
- buffer[ offset + stride + 0 ] = morph.x;
17865
- buffer[ offset + stride + 1 ] = morph.y;
17866
- buffer[ offset + stride + 2 ] = morph.z;
17867
- buffer[ offset + stride + 3 ] = 0;
17659
+ const offset = width * height * 4 * i;
17868
17660
 
17869
- }
17661
+ for ( let j = 0; j < morphTarget.count; j ++ ) {
17870
17662
 
17871
- if ( hasMorphNormals === true ) {
17663
+ const stride = j * vertexDataStride;
17872
17664
 
17873
- morph.fromBufferAttribute( morphNormal, j );
17665
+ if ( hasMorphPosition === true ) {
17874
17666
 
17875
- buffer[ offset + stride + 4 ] = morph.x;
17876
- buffer[ offset + stride + 5 ] = morph.y;
17877
- buffer[ offset + stride + 6 ] = morph.z;
17878
- buffer[ offset + stride + 7 ] = 0;
17667
+ morph.fromBufferAttribute( morphTarget, j );
17879
17668
 
17880
- }
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;
17881
17673
 
17882
- if ( hasMorphColors === true ) {
17674
+ }
17883
17675
 
17884
- morph.fromBufferAttribute( morphColor, j );
17676
+ if ( hasMorphNormals === true ) {
17885
17677
 
17886
- buffer[ offset + stride + 8 ] = morph.x;
17887
- buffer[ offset + stride + 9 ] = morph.y;
17888
- buffer[ offset + stride + 10 ] = morph.z;
17889
- buffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morph.w : 1;
17678
+ morph.fromBufferAttribute( morphNormal, j );
17890
17679
 
17891
- }
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;
17892
17684
 
17893
17685
  }
17894
17686
 
17895
- }
17896
-
17897
- entry = {
17898
- count: morphTargetsCount,
17899
- texture: texture,
17900
- size: new Vector2( width, height )
17901
- };
17902
-
17903
- morphTextures.set( geometry, entry );
17904
-
17905
- function disposeTexture() {
17687
+ if ( hasMorphColors === true ) {
17906
17688
 
17907
- texture.dispose();
17689
+ morph.fromBufferAttribute( morphColor, j );
17908
17690
 
17909
- morphTextures.delete( geometry );
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;
17910
17695
 
17911
- geometry.removeEventListener( 'dispose', disposeTexture );
17696
+ }
17912
17697
 
17913
17698
  }
17914
17699
 
17915
- geometry.addEventListener( 'dispose', disposeTexture );
17916
-
17917
17700
  }
17918
17701
 
17919
- //
17920
-
17921
- let morphInfluencesSum = 0;
17922
-
17923
- for ( let i = 0; i < objectInfluences.length; i ++ ) {
17924
-
17925
- morphInfluencesSum += objectInfluences[ i ];
17926
-
17927
- }
17928
-
17929
- const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
17930
-
17931
- program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
17932
- program.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );
17933
-
17934
- program.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );
17935
- program.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );
17936
-
17937
-
17938
- } else {
17939
-
17940
- // When object doesn't have morph target influences defined, we treat it as a 0-length array
17941
- // This is important to make sure we set up morphTargetBaseInfluence / morphTargetInfluences
17942
-
17943
- const length = objectInfluences === undefined ? 0 : objectInfluences.length;
17944
-
17945
- let influences = influencesList[ geometry.id ];
17946
-
17947
- if ( influences === undefined || influences.length !== length ) {
17948
-
17949
- // initialise list
17950
-
17951
- influences = [];
17952
-
17953
- for ( let i = 0; i < length; i ++ ) {
17954
-
17955
- influences[ i ] = [ i, 0 ];
17956
-
17957
- }
17958
-
17959
- influencesList[ geometry.id ] = influences;
17702
+ entry = {
17703
+ count: morphTargetsCount,
17704
+ texture: texture,
17705
+ size: new Vector2( width, height )
17706
+ };
17960
17707
 
17961
- }
17708
+ morphTextures.set( geometry, entry );
17962
17709
 
17963
- // Collect influences
17710
+ function disposeTexture() {
17964
17711
 
17965
- for ( let i = 0; i < length; i ++ ) {
17712
+ texture.dispose();
17966
17713
 
17967
- const influence = influences[ i ];
17714
+ morphTextures.delete( geometry );
17968
17715
 
17969
- influence[ 0 ] = i;
17970
- influence[ 1 ] = objectInfluences[ i ];
17716
+ geometry.removeEventListener( 'dispose', disposeTexture );
17971
17717
 
17972
17718
  }
17973
17719
 
17974
- influences.sort( absNumericalSort );
17975
-
17976
- for ( let i = 0; i < 8; i ++ ) {
17977
-
17978
- if ( i < length && influences[ i ][ 1 ] ) {
17979
-
17980
- workInfluences[ i ][ 0 ] = influences[ i ][ 0 ];
17981
- workInfluences[ i ][ 1 ] = influences[ i ][ 1 ];
17720
+ geometry.addEventListener( 'dispose', disposeTexture );
17982
17721
 
17983
- } else {
17984
-
17985
- workInfluences[ i ][ 0 ] = Number.MAX_SAFE_INTEGER;
17986
- workInfluences[ i ][ 1 ] = 0;
17987
-
17988
- }
17722
+ }
17989
17723
 
17990
- }
17724
+ //
17725
+ if ( object.isInstancedMesh === true && object.morphTexture !== null ) {
17991
17726
 
17992
- workInfluences.sort( numericalSort );
17727
+ program.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );
17993
17728
 
17994
- const morphTargets = geometry.morphAttributes.position;
17995
- const morphNormals = geometry.morphAttributes.normal;
17729
+ } else {
17996
17730
 
17997
17731
  let morphInfluencesSum = 0;
17998
17732
 
17999
- for ( let i = 0; i < 8; i ++ ) {
18000
-
18001
- const influence = workInfluences[ i ];
18002
- const index = influence[ 0 ];
18003
- const value = influence[ 1 ];
18004
-
18005
- if ( index !== Number.MAX_SAFE_INTEGER && value ) {
18006
-
18007
- if ( morphTargets && geometry.getAttribute( 'morphTarget' + i ) !== morphTargets[ index ] ) {
18008
-
18009
- geometry.setAttribute( 'morphTarget' + i, morphTargets[ index ] );
18010
-
18011
- }
18012
-
18013
- if ( morphNormals && geometry.getAttribute( 'morphNormal' + i ) !== morphNormals[ index ] ) {
18014
-
18015
- geometry.setAttribute( 'morphNormal' + i, morphNormals[ index ] );
18016
-
18017
- }
18018
-
18019
- morphInfluences[ i ] = value;
18020
- morphInfluencesSum += value;
18021
-
18022
- } else {
18023
-
18024
- if ( morphTargets && geometry.hasAttribute( 'morphTarget' + i ) === true ) {
18025
-
18026
- geometry.deleteAttribute( 'morphTarget' + i );
18027
-
18028
- }
18029
-
18030
- if ( morphNormals && geometry.hasAttribute( 'morphNormal' + i ) === true ) {
18031
-
18032
- geometry.deleteAttribute( 'morphNormal' + i );
18033
-
18034
- }
18035
-
18036
- morphInfluences[ i ] = 0;
17733
+ for ( let i = 0; i < objectInfluences.length; i ++ ) {
18037
17734
 
18038
- }
17735
+ morphInfluencesSum += objectInfluences[ i ];
18039
17736
 
18040
17737
  }
18041
17738
 
18042
- // GLSL shader uses formula baseinfluence * base + sum(target * influence)
18043
- // This allows us to switch between absolute morphs and relative morphs without changing shader code
18044
- // When baseinfluence = 1 - sum(influence), the above is equivalent to sum((target - base) * influence)
18045
17739
  const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
18046
17740
 
17741
+
18047
17742
  program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
18048
- program.getUniforms().setValue( gl, 'morphTargetInfluences', morphInfluences );
17743
+ program.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );
18049
17744
 
18050
17745
  }
18051
17746
 
17747
+ program.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );
17748
+ program.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );
17749
+
18052
17750
  }
18053
17751
 
18054
17752
  return {
@@ -19580,6 +19278,10 @@ function getToneMappingFunction( functionName, toneMapping ) {
19580
19278
  toneMappingName = 'AgX';
19581
19279
  break;
19582
19280
 
19281
+ case NeutralToneMapping:
19282
+ toneMappingName = 'Neutral';
19283
+ break;
19284
+
19583
19285
  case CustomToneMapping:
19584
19286
  toneMappingName = 'Custom';
19585
19287
  break;
@@ -19594,19 +19296,6 @@ function getToneMappingFunction( functionName, toneMapping ) {
19594
19296
 
19595
19297
  }
19596
19298
 
19597
- function generateExtensions( parameters ) {
19598
-
19599
- const chunks = [
19600
- ( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.alphaToCoverage || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',
19601
- ( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',
19602
- ( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',
19603
- ( parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''
19604
- ];
19605
-
19606
- return chunks.filter( filterEmptyLine ).join( '\n' );
19607
-
19608
- }
19609
-
19610
19299
  function generateVertexExtensions( parameters ) {
19611
19300
 
19612
19301
  const chunks = [
@@ -19774,27 +19463,21 @@ function generatePrecision( parameters ) {
19774
19463
  precision ${parameters.precision} int;
19775
19464
  precision ${parameters.precision} sampler2D;
19776
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;
19777
19479
  `;
19778
19480
 
19779
- if ( parameters.isWebGL2 ) {
19780
-
19781
- precisionstring += `precision ${parameters.precision} sampler3D;
19782
- precision ${parameters.precision} sampler2DArray;
19783
- precision ${parameters.precision} sampler2DShadow;
19784
- precision ${parameters.precision} samplerCubeShadow;
19785
- precision ${parameters.precision} sampler2DArrayShadow;
19786
- precision ${parameters.precision} isampler2D;
19787
- precision ${parameters.precision} isampler3D;
19788
- precision ${parameters.precision} isamplerCube;
19789
- precision ${parameters.precision} isampler2DArray;
19790
- precision ${parameters.precision} usampler2D;
19791
- precision ${parameters.precision} usampler3D;
19792
- precision ${parameters.precision} usamplerCube;
19793
- precision ${parameters.precision} usampler2DArray;
19794
- `;
19795
-
19796
- }
19797
-
19798
19481
  if ( parameters.precision === 'highp' ) {
19799
19482
 
19800
19483
  precisionstring += '\n#define HIGH_PRECISION';
@@ -19943,8 +19626,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
19943
19626
  const envMapBlendingDefine = generateEnvMapBlendingDefine( parameters );
19944
19627
  const envMapCubeUVSize = generateCubeUVSize( parameters );
19945
19628
 
19946
- const customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );
19947
-
19948
19629
  const customVertexExtensions = generateVertexExtensions( parameters );
19949
19630
 
19950
19631
  const customDefines = generateDefines( defines );
@@ -19975,8 +19656,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
19975
19656
 
19976
19657
  prefixFragment = [
19977
19658
 
19978
- customExtensions,
19979
-
19980
19659
  '#define SHADER_TYPE ' + parameters.shaderType,
19981
19660
  '#define SHADER_NAME ' + parameters.shaderName,
19982
19661
 
@@ -20005,6 +19684,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20005
19684
  parameters.batching ? '#define USE_BATCHING' : '',
20006
19685
  parameters.instancing ? '#define USE_INSTANCING' : '',
20007
19686
  parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',
19687
+ parameters.instancingMorph ? '#define USE_INSTANCING_MORPH' : '',
20008
19688
 
20009
19689
  parameters.useFog && parameters.fog ? '#define USE_FOG' : '',
20010
19690
  parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',
@@ -20097,10 +19777,10 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20097
19777
 
20098
19778
  parameters.morphTargets ? '#define USE_MORPHTARGETS' : '',
20099
19779
  parameters.morphNormals && parameters.flatShading === false ? '#define USE_MORPHNORMALS' : '',
20100
- ( parameters.morphColors && parameters.isWebGL2 ) ? '#define USE_MORPHCOLORS' : '',
20101
- ( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE' : '',
20102
- ( parameters.morphTargetsCount > 0 && parameters.isWebGL2 ) ? '#define MORPHTARGETS_TEXTURE_STRIDE ' + parameters.morphTextureStride : '',
20103
- ( 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 : '',
20104
19784
  parameters.doubleSided ? '#define DOUBLE_SIDED' : '',
20105
19785
  parameters.flipSided ? '#define FLIP_SIDED' : '',
20106
19786
 
@@ -20114,7 +19794,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20114
19794
  parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
20115
19795
 
20116
19796
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
20117
- ( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
20118
19797
 
20119
19798
  'uniform mat4 modelMatrix;',
20120
19799
  'uniform mat4 modelViewMatrix;',
@@ -20136,6 +19815,12 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20136
19815
 
20137
19816
  '#endif',
20138
19817
 
19818
+ '#ifdef USE_INSTANCING_MORPH',
19819
+
19820
+ ' uniform sampler2D morphTexture;',
19821
+
19822
+ '#endif',
19823
+
20139
19824
  'attribute vec3 position;',
20140
19825
  'attribute vec3 normal;',
20141
19826
  'attribute vec2 uv;',
@@ -20212,8 +19897,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20212
19897
 
20213
19898
  prefixFragment = [
20214
19899
 
20215
- customExtensions,
20216
-
20217
19900
  generatePrecision( parameters ),
20218
19901
 
20219
19902
  '#define SHADER_TYPE ' + parameters.shaderType,
@@ -20301,7 +19984,6 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20301
19984
  parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
20302
19985
 
20303
19986
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
20304
- ( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
20305
19987
 
20306
19988
  'uniform mat4 viewMatrix;',
20307
19989
  'uniform vec3 cameraPosition;',
@@ -20336,7 +20018,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20336
20018
  vertexShader = unrollLoops( vertexShader );
20337
20019
  fragmentShader = unrollLoops( fragmentShader );
20338
20020
 
20339
- if ( parameters.isWebGL2 && parameters.isRawShaderMaterial !== true ) {
20021
+ if ( parameters.isRawShaderMaterial !== true ) {
20340
20022
 
20341
20023
  // GLSL 3.0 conversion for built-in materials and ShaderMaterial
20342
20024
 
@@ -20344,14 +20026,12 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20344
20026
 
20345
20027
  prefixVertex = [
20346
20028
  customVertexExtensions,
20347
- 'precision mediump sampler2DArray;',
20348
20029
  '#define attribute in',
20349
20030
  '#define varying out',
20350
20031
  '#define texture2D texture'
20351
20032
  ].join( '\n' ) + '\n' + prefixVertex;
20352
20033
 
20353
20034
  prefixFragment = [
20354
- 'precision mediump sampler2DArray;',
20355
20035
  '#define varying in',
20356
20036
  ( parameters.glslVersion === GLSL3 ) ? '' : 'layout(location = 0) out highp vec4 pc_fragColor;',
20357
20037
  ( parameters.glslVersion === GLSL3 ) ? '' : '#define gl_FragColor pc_fragColor',
@@ -20742,7 +20422,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20742
20422
  const _activeChannels = new Set();
20743
20423
  const programs = [];
20744
20424
 
20745
- const IS_WEBGL2 = capabilities.isWebGL2;
20746
20425
  const logarithmicDepthBuffer = capabilities.logarithmicDepthBuffer;
20747
20426
  const SUPPORTS_VERTEX_TEXTURES = capabilities.vertexTextures;
20748
20427
 
@@ -20906,8 +20585,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20906
20585
 
20907
20586
  const parameters = {
20908
20587
 
20909
- isWebGL2: IS_WEBGL2,
20910
-
20911
20588
  shaderID: shaderID,
20912
20589
  shaderType: material.type,
20913
20590
  shaderName: material.name,
@@ -20927,6 +20604,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20927
20604
  batching: IS_BATCHEDMESH,
20928
20605
  instancing: IS_INSTANCEDMESH,
20929
20606
  instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
20607
+ instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
20930
20608
 
20931
20609
  supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,
20932
20610
  numMultiviewViews: numMultiviewViews,
@@ -21081,16 +20759,9 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
21081
20759
 
21082
20760
  index0AttributeName: material.index0AttributeName,
21083
20761
 
21084
- extensionDerivatives: HAS_EXTENSIONS && material.extensions.derivatives === true,
21085
- extensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,
21086
- extensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,
21087
- extensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,
21088
20762
  extensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),
21089
20763
  extensionMultiDraw: HAS_EXTENSIONS && material.extensions.multiDraw === true && extensions.has( 'WEBGL_multi_draw' ),
21090
20764
 
21091
- rendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),
21092
- rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),
21093
- rendererExtensionShaderTextureLod: IS_WEBGL2 || extensions.has( 'EXT_shader_texture_lod' ),
21094
20765
  rendererExtensionParallelShaderCompile: extensions.has( 'KHR_parallel_shader_compile' ),
21095
20766
 
21096
20767
  customProgramCacheKey: material.customProgramCacheKey()
@@ -21206,13 +20877,13 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
21206
20877
 
21207
20878
  _programLayers.disableAll();
21208
20879
 
21209
- if ( parameters.isWebGL2 )
21210
- _programLayers.enable( 0 );
21211
20880
  if ( parameters.supportsVertexTextures )
21212
- _programLayers.enable( 1 );
20881
+ _programLayers.enable( 0 );
21213
20882
  if ( parameters.instancing )
21214
- _programLayers.enable( 2 );
20883
+ _programLayers.enable( 1 );
21215
20884
  if ( parameters.instancingColor )
20885
+ _programLayers.enable( 2 );
20886
+ if ( parameters.instancingMorph )
21216
20887
  _programLayers.enable( 3 );
21217
20888
  if ( parameters.matcap )
21218
20889
  _programLayers.enable( 4 );
@@ -21820,7 +21491,7 @@ function shadowCastingAndTexturingLightsFirst( lightA, lightB ) {
21820
21491
 
21821
21492
  }
21822
21493
 
21823
- function WebGLLights( extensions, capabilities ) {
21494
+ function WebGLLights( extensions ) {
21824
21495
 
21825
21496
  const cache = new UniformsCache();
21826
21497
 
@@ -22069,41 +21740,15 @@ function WebGLLights( extensions, capabilities ) {
22069
21740
 
22070
21741
  if ( rectAreaLength > 0 ) {
22071
21742
 
22072
- if ( capabilities.isWebGL2 ) {
22073
-
22074
- // WebGL 2
22075
-
22076
- if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
22077
-
22078
- state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
22079
- state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
21743
+ if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
22080
21744
 
22081
- } else {
22082
-
22083
- state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
22084
- state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
22085
-
22086
- }
21745
+ state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
21746
+ state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
22087
21747
 
22088
21748
  } else {
22089
21749
 
22090
- // WebGL 1
22091
-
22092
- if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
22093
-
22094
- state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
22095
- state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
22096
-
22097
- } else if ( extensions.has( 'OES_texture_half_float_linear' ) === true ) {
22098
-
22099
- state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
22100
- state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
22101
-
22102
- } else {
22103
-
22104
- console.error( 'THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.' );
22105
-
22106
- }
21750
+ state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
21751
+ state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
22107
21752
 
22108
21753
  }
22109
21754
 
@@ -22256,9 +21901,9 @@ function WebGLLights( extensions, capabilities ) {
22256
21901
 
22257
21902
  }
22258
21903
 
22259
- function WebGLRenderState( extensions, capabilities ) {
21904
+ function WebGLRenderState( extensions ) {
22260
21905
 
22261
- const lights = new WebGLLights( extensions, capabilities );
21906
+ const lights = new WebGLLights( extensions );
22262
21907
 
22263
21908
  const lightsArray = [];
22264
21909
  const shadowsArray = [];
@@ -22298,7 +21943,9 @@ function WebGLRenderState( extensions, capabilities ) {
22298
21943
  lightsArray: lightsArray,
22299
21944
  shadowsArray: shadowsArray,
22300
21945
 
22301
- lights: lights
21946
+ lights: lights,
21947
+
21948
+ transmissionRenderTarget: null
22302
21949
  };
22303
21950
 
22304
21951
  return {
@@ -22313,7 +21960,7 @@ function WebGLRenderState( extensions, capabilities ) {
22313
21960
 
22314
21961
  }
22315
21962
 
22316
- function WebGLRenderStates( extensions, capabilities ) {
21963
+ function WebGLRenderStates( extensions ) {
22317
21964
 
22318
21965
  let renderStates = new WeakMap();
22319
21966
 
@@ -22324,14 +21971,14 @@ function WebGLRenderStates( extensions, capabilities ) {
22324
21971
 
22325
21972
  if ( renderStateArray === undefined ) {
22326
21973
 
22327
- renderState = new WebGLRenderState( extensions, capabilities );
21974
+ renderState = new WebGLRenderState( extensions );
22328
21975
  renderStates.set( scene, [ renderState ] );
22329
21976
 
22330
21977
  } else {
22331
21978
 
22332
21979
  if ( renderCallDepth >= renderStateArray.length ) {
22333
21980
 
22334
- renderState = new WebGLRenderState( extensions, capabilities );
21981
+ renderState = new WebGLRenderState( extensions );
22335
21982
  renderStateArray.push( renderState );
22336
21983
 
22337
21984
  } else {
@@ -22861,9 +22508,7 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
22861
22508
 
22862
22509
  }
22863
22510
 
22864
- function WebGLState( gl, extensions, capabilities ) {
22865
-
22866
- const isWebGL2 = capabilities.isWebGL2;
22511
+ function WebGLState( gl ) {
22867
22512
 
22868
22513
  function ColorBuffer() {
22869
22514
 
@@ -23235,7 +22880,7 @@ function WebGLState( gl, extensions, capabilities ) {
23235
22880
 
23236
22881
  for ( let i = 0; i < count; i ++ ) {
23237
22882
 
23238
- if ( isWebGL2 && ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) ) {
22883
+ if ( type === gl.TEXTURE_3D || type === gl.TEXTURE_2D_ARRAY ) {
23239
22884
 
23240
22885
  gl.texImage3D( target, 0, gl.RGBA, 1, 1, dimensions, 0, gl.RGBA, gl.UNSIGNED_BYTE, data );
23241
22886
 
@@ -23254,13 +22899,8 @@ function WebGLState( gl, extensions, capabilities ) {
23254
22899
  const emptyTextures = {};
23255
22900
  emptyTextures[ gl.TEXTURE_2D ] = createTexture( gl.TEXTURE_2D, gl.TEXTURE_2D, 1 );
23256
22901
  emptyTextures[ gl.TEXTURE_CUBE_MAP ] = createTexture( gl.TEXTURE_CUBE_MAP, gl.TEXTURE_CUBE_MAP_POSITIVE_X, 6 );
23257
-
23258
- if ( isWebGL2 ) {
23259
-
23260
- emptyTextures[ gl.TEXTURE_2D_ARRAY ] = createTexture( gl.TEXTURE_2D_ARRAY, gl.TEXTURE_2D_ARRAY, 1, 1 );
23261
- emptyTextures[ gl.TEXTURE_3D ] = createTexture( gl.TEXTURE_3D, gl.TEXTURE_3D, 1, 1 );
23262
-
23263
- }
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 );
23264
22904
 
23265
22905
  // init
23266
22906
 
@@ -23309,21 +22949,17 @@ function WebGLState( gl, extensions, capabilities ) {
23309
22949
 
23310
22950
  currentBoundFramebuffers[ target ] = framebuffer;
23311
22951
 
23312
- if ( isWebGL2 ) {
23313
-
23314
- // gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER
22952
+ // gl.DRAW_FRAMEBUFFER is equivalent to gl.FRAMEBUFFER
23315
22953
 
23316
- if ( target === gl.DRAW_FRAMEBUFFER ) {
22954
+ if ( target === gl.DRAW_FRAMEBUFFER ) {
23317
22955
 
23318
- currentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;
22956
+ currentBoundFramebuffers[ gl.FRAMEBUFFER ] = framebuffer;
23319
22957
 
23320
- }
23321
-
23322
- if ( target === gl.FRAMEBUFFER ) {
22958
+ }
23323
22959
 
23324
- currentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;
22960
+ if ( target === gl.FRAMEBUFFER ) {
23325
22961
 
23326
- }
22962
+ currentBoundFramebuffers[ gl.DRAW_FRAMEBUFFER ] = framebuffer;
23327
22963
 
23328
22964
  }
23329
22965
 
@@ -23352,33 +22988,19 @@ function WebGLState( gl, extensions, capabilities ) {
23352
22988
 
23353
22989
  }
23354
22990
 
23355
- if ( renderTarget.isWebGLMultipleRenderTargets ) {
23356
-
23357
- const textures = renderTarget.texture;
23358
-
23359
- if ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {
23360
-
23361
- for ( let i = 0, il = textures.length; i < il; i ++ ) {
23362
-
23363
- drawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;
22991
+ const textures = renderTarget.textures;
23364
22992
 
23365
- }
22993
+ if ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {
23366
22994
 
23367
- drawBuffers.length = textures.length;
22995
+ for ( let i = 0, il = textures.length; i < il; i ++ ) {
23368
22996
 
23369
- needsUpdate = true;
22997
+ drawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;
23370
22998
 
23371
22999
  }
23372
23000
 
23373
- } else {
23374
-
23375
- if ( drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {
23376
-
23377
- drawBuffers[ 0 ] = gl.COLOR_ATTACHMENT0;
23378
-
23379
- needsUpdate = true;
23001
+ drawBuffers.length = textures.length;
23380
23002
 
23381
- }
23003
+ needsUpdate = true;
23382
23004
 
23383
23005
  }
23384
23006
 
@@ -23396,19 +23018,10 @@ function WebGLState( gl, extensions, capabilities ) {
23396
23018
 
23397
23019
  if ( needsUpdate ) {
23398
23020
 
23399
- if ( capabilities.isWebGL2 ) {
23400
-
23401
- gl.drawBuffers( drawBuffers );
23402
-
23403
- } else {
23404
-
23405
- extensions.get( 'WEBGL_draw_buffers' ).drawBuffersWEBGL( drawBuffers );
23406
-
23407
- }
23021
+ gl.drawBuffers( drawBuffers );
23408
23022
 
23409
23023
  }
23410
23024
 
23411
-
23412
23025
  }
23413
23026
 
23414
23027
  function useProgram( program ) {
@@ -23433,23 +23046,8 @@ function WebGLState( gl, extensions, capabilities ) {
23433
23046
  [ ReverseSubtractEquation ]: gl.FUNC_REVERSE_SUBTRACT
23434
23047
  };
23435
23048
 
23436
- if ( isWebGL2 ) {
23437
-
23438
- equationToGL[ MinEquation ] = gl.MIN;
23439
- equationToGL[ MaxEquation ] = gl.MAX;
23440
-
23441
- } else {
23442
-
23443
- const extension = extensions.get( 'EXT_blend_minmax' );
23444
-
23445
- if ( extension !== null ) {
23446
-
23447
- equationToGL[ MinEquation ] = extension.MIN_EXT;
23448
- equationToGL[ MaxEquation ] = extension.MAX_EXT;
23449
-
23450
- }
23451
-
23452
- }
23049
+ equationToGL[ MinEquation ] = gl.MIN;
23050
+ equationToGL[ MaxEquation ] = gl.MAX;
23453
23051
 
23454
23052
  const factorToGL = {
23455
23053
  [ ZeroFactor ]: gl.ZERO,
@@ -24073,13 +23671,8 @@ function WebGLState( gl, extensions, capabilities ) {
24073
23671
  gl.activeTexture( gl.TEXTURE0 );
24074
23672
 
24075
23673
  gl.bindFramebuffer( gl.FRAMEBUFFER, null );
24076
-
24077
- if ( isWebGL2 === true ) {
24078
-
24079
- gl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );
24080
- gl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );
24081
-
24082
- }
23674
+ gl.bindFramebuffer( gl.DRAW_FRAMEBUFFER, null );
23675
+ gl.bindFramebuffer( gl.READ_FRAMEBUFFER, null );
24083
23676
 
24084
23677
  gl.useProgram( null );
24085
23678
 
@@ -24186,11 +23779,11 @@ function WebGLState( gl, extensions, capabilities ) {
24186
23779
 
24187
23780
  function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
24188
23781
 
24189
- const isWebGL2 = capabilities.isWebGL2;
24190
23782
  const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
24191
23783
  const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
24192
23784
  const multiviewExt = extensions.has( 'OCULUS_multiview' ) ? extensions.get( 'OCULUS_multiview' ) : null;
24193
23785
 
23786
+ const _imageDimensions = new Vector2();
24194
23787
  const _videoTextures = new WeakMap();
24195
23788
  let _canvas;
24196
23789
 
@@ -24227,32 +23820,33 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24227
23820
 
24228
23821
  }
24229
23822
 
24230
- function resizeImage( image, needsPowerOfTwo, needsNewCanvas, maxSize ) {
23823
+ function resizeImage( image, needsNewCanvas, maxSize ) {
24231
23824
 
24232
23825
  let scale = 1;
24233
23826
 
23827
+ const dimensions = getDimensions( image );
23828
+
24234
23829
  // handle case if texture exceeds max size
24235
23830
 
24236
- if ( image.width > maxSize || image.height > maxSize ) {
23831
+ if ( dimensions.width > maxSize || dimensions.height > maxSize ) {
24237
23832
 
24238
- scale = maxSize / Math.max( image.width, image.height );
23833
+ scale = maxSize / Math.max( dimensions.width, dimensions.height );
24239
23834
 
24240
23835
  }
24241
23836
 
24242
23837
  // only perform resize if necessary
24243
23838
 
24244
- if ( scale < 1 || needsPowerOfTwo === true ) {
23839
+ if ( scale < 1 ) {
24245
23840
 
24246
23841
  // only perform resize for certain image types
24247
23842
 
24248
23843
  if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||
24249
23844
  ( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||
24250
- ( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {
24251
-
24252
- const floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor;
23845
+ ( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ||
23846
+ ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) ) {
24253
23847
 
24254
- const width = floor( scale * image.width );
24255
- const height = floor( scale * image.height );
23848
+ const width = Math.floor( scale * dimensions.width );
23849
+ const height = Math.floor( scale * dimensions.height );
24256
23850
 
24257
23851
  if ( _canvas === undefined ) _canvas = createCanvas( width, height );
24258
23852
 
@@ -24266,7 +23860,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24266
23860
  const context = canvas.getContext( '2d' );
24267
23861
  context.drawImage( image, 0, 0, width, height );
24268
23862
 
24269
- console.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').' );
23863
+ console.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + dimensions.width + 'x' + dimensions.height + ') to (' + width + 'x' + height + ').' );
24270
23864
 
24271
23865
  return canvas;
24272
23866
 
@@ -24274,7 +23868,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24274
23868
 
24275
23869
  if ( 'data' in image ) {
24276
23870
 
24277
- console.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').' );
23871
+ console.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + dimensions.width + 'x' + dimensions.height + ').' );
24278
23872
 
24279
23873
  }
24280
23874
 
@@ -24288,25 +23882,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24288
23882
 
24289
23883
  }
24290
23884
 
24291
- function isPowerOfTwo$1( image ) {
23885
+ function textureNeedsGenerateMipmaps( texture ) {
24292
23886
 
24293
- return isPowerOfTwo( image.width ) && isPowerOfTwo( image.height );
24294
-
24295
- }
24296
-
24297
- function textureNeedsPowerOfTwo( texture ) {
24298
-
24299
- if ( isWebGL2 ) return false;
24300
-
24301
- return ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) ||
24302
- ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter );
24303
-
24304
- }
24305
-
24306
- function textureNeedsGenerateMipmaps( texture, supportsMips ) {
24307
-
24308
- return texture.generateMipmaps && supportsMips &&
24309
- texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
23887
+ return texture.generateMipmaps && texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter;
24310
23888
 
24311
23889
  }
24312
23890
 
@@ -24318,8 +23896,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24318
23896
 
24319
23897
  function getInternalFormat( internalFormatName, glFormat, glType, colorSpace, forceLinearTransfer = false ) {
24320
23898
 
24321
- if ( isWebGL2 === false ) return glFormat;
24322
-
24323
23899
  if ( internalFormatName !== null ) {
24324
23900
 
24325
23901
  if ( _gl[ internalFormatName ] !== undefined ) return _gl[ internalFormatName ];
@@ -24357,6 +23933,23 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24357
23933
 
24358
23934
  }
24359
23935
 
23936
+ if ( glFormat === _gl.RG_INTEGER ) {
23937
+
23938
+ if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8UI;
23939
+ if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RG16UI;
23940
+ if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RG32UI;
23941
+ if ( glType === _gl.BYTE ) internalFormat = _gl.RG8I;
23942
+ if ( glType === _gl.SHORT ) internalFormat = _gl.RG16I;
23943
+ if ( glType === _gl.INT ) internalFormat = _gl.RG32I;
23944
+
23945
+ }
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
+
24360
23953
  if ( glFormat === _gl.RGBA ) {
24361
23954
 
24362
23955
  const transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );
@@ -24381,9 +23974,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24381
23974
 
24382
23975
  }
24383
23976
 
24384
- function getMipLevels( texture, image, supportsMips ) {
23977
+ function getMipLevels( texture, image ) {
24385
23978
 
24386
- 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 ) ) {
24387
23980
 
24388
23981
  return Math.log2( Math.max( image.width, image.height ) ) + 1;
24389
23982
 
@@ -24407,20 +24000,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24407
24000
 
24408
24001
  }
24409
24002
 
24410
- // Fallback filters for non-power-of-2 textures
24411
-
24412
- function filterFallback( f ) {
24413
-
24414
- if ( f === NearestFilter || f === NearestMipmapNearestFilter || f === NearestMipmapLinearFilter ) {
24415
-
24416
- return _gl.NEAREST;
24417
-
24418
- }
24419
-
24420
- return _gl.LINEAR;
24421
-
24422
- }
24423
-
24424
24003
  //
24425
24004
 
24426
24005
  function onTextureDispose( event ) {
@@ -24504,18 +24083,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24504
24083
 
24505
24084
  function deallocateRenderTarget( renderTarget ) {
24506
24085
 
24507
- const texture = renderTarget.texture;
24508
-
24509
24086
  const renderTargetProperties = properties.get( renderTarget );
24510
- const textureProperties = properties.get( texture );
24511
-
24512
- if ( textureProperties.__webglTexture !== undefined ) {
24513
-
24514
- _gl.deleteTexture( textureProperties.__webglTexture );
24515
-
24516
- info.memory.textures --;
24517
-
24518
- }
24519
24087
 
24520
24088
  if ( renderTarget.depthTexture ) {
24521
24089
 
@@ -24570,27 +24138,24 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24570
24138
 
24571
24139
  }
24572
24140
 
24573
- if ( renderTarget.isWebGLMultipleRenderTargets ) {
24574
-
24575
- for ( let i = 0, il = texture.length; i < il; i ++ ) {
24576
-
24577
- const attachmentProperties = properties.get( texture[ i ] );
24141
+ const textures = renderTarget.textures;
24578
24142
 
24579
- if ( attachmentProperties.__webglTexture ) {
24143
+ for ( let i = 0, il = textures.length; i < il; i ++ ) {
24580
24144
 
24581
- _gl.deleteTexture( attachmentProperties.__webglTexture );
24145
+ const attachmentProperties = properties.get( textures[ i ] );
24582
24146
 
24583
- info.memory.textures --;
24147
+ if ( attachmentProperties.__webglTexture ) {
24584
24148
 
24585
- }
24149
+ _gl.deleteTexture( attachmentProperties.__webglTexture );
24586
24150
 
24587
- properties.remove( texture[ i ] );
24151
+ info.memory.textures --;
24588
24152
 
24589
24153
  }
24590
24154
 
24155
+ properties.remove( textures[ i ] );
24156
+
24591
24157
  }
24592
24158
 
24593
- properties.remove( texture );
24594
24159
  properties.remove( renderTarget );
24595
24160
 
24596
24161
  }
@@ -24752,7 +24317,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24752
24317
  [ NotEqualCompare ]: _gl.NOTEQUAL
24753
24318
  };
24754
24319
 
24755
- function setTextureParameters( textureType, texture, supportsMips ) {
24320
+ function setTextureParameters( textureType, texture ) {
24756
24321
 
24757
24322
  if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false &&
24758
24323
  ( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||
@@ -24762,48 +24327,18 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24762
24327
 
24763
24328
  }
24764
24329
 
24765
- if ( supportsMips ) {
24766
-
24767
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );
24768
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, wrappingToGL[ texture.wrapT ] );
24769
-
24770
- if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
24771
-
24772
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );
24773
-
24774
- }
24775
-
24776
- _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );
24777
- _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );
24778
-
24779
- } else {
24780
-
24781
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, _gl.CLAMP_TO_EDGE );
24782
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_T, _gl.CLAMP_TO_EDGE );
24783
-
24784
- if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
24785
-
24786
- _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, _gl.CLAMP_TO_EDGE );
24787
-
24788
- }
24789
-
24790
- if ( texture.wrapS !== ClampToEdgeWrapping || texture.wrapT !== ClampToEdgeWrapping ) {
24791
-
24792
- console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.wrapS and Texture.wrapT should be set to THREE.ClampToEdgeWrapping.' );
24793
-
24794
- }
24795
-
24796
- _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterFallback( texture.magFilter ) );
24797
- _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 ] );
24798
24332
 
24799
- if ( texture.minFilter !== NearestFilter && texture.minFilter !== LinearFilter ) {
24333
+ if ( textureType === _gl.TEXTURE_3D || textureType === _gl.TEXTURE_2D_ARRAY ) {
24800
24334
 
24801
- console.warn( 'THREE.WebGLRenderer: Texture is not power of two. Texture.minFilter should be set to THREE.NearestFilter or THREE.LinearFilter.' );
24802
-
24803
- }
24335
+ _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_R, wrappingToGL[ texture.wrapR ] );
24804
24336
 
24805
24337
  }
24806
24338
 
24339
+ _gl.texParameteri( textureType, _gl.TEXTURE_MAG_FILTER, filterToGL[ texture.magFilter ] );
24340
+ _gl.texParameteri( textureType, _gl.TEXTURE_MIN_FILTER, filterToGL[ texture.minFilter ] );
24341
+
24807
24342
  if ( texture.compareFunction ) {
24808
24343
 
24809
24344
  _gl.texParameteri( textureType, _gl.TEXTURE_COMPARE_MODE, _gl.COMPARE_REF_TO_TEXTURE );
@@ -24813,15 +24348,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24813
24348
 
24814
24349
  if ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {
24815
24350
 
24816
- const extension = extensions.get( 'EXT_texture_filter_anisotropic' );
24817
-
24818
24351
  if ( texture.magFilter === NearestFilter ) return;
24819
24352
  if ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;
24820
- if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension for WebGL 1 and WebGL 2
24821
- 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
24822
24354
 
24823
24355
  if ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {
24824
24356
 
24357
+ const extension = extensions.get( 'EXT_texture_filter_anisotropic' );
24825
24358
  _gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );
24826
24359
  properties.get( texture ).__currentAnisotropy = texture.anisotropy;
24827
24360
 
@@ -24975,97 +24508,41 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24975
24508
  _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
24976
24509
  _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
24977
24510
 
24978
- const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;
24979
- let image = resizeImage( texture.image, needsPowerOfTwo, false, capabilities.maxTextureSize );
24511
+ let image = resizeImage( texture.image, false, capabilities.maxTextureSize );
24980
24512
  image = verifyColorSpace( texture, image );
24981
24513
 
24982
- const supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
24983
- glFormat = utils.convert( texture.format, texture.colorSpace );
24514
+ const glFormat = utils.convert( texture.format, texture.colorSpace );
24984
24515
 
24985
- let glType = utils.convert( texture.type ),
24986
- 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 );
24987
24518
 
24988
- setTextureParameters( textureType, texture, supportsMips );
24519
+ setTextureParameters( textureType, texture );
24989
24520
 
24990
24521
  let mipmap;
24991
24522
  const mipmaps = texture.mipmaps;
24992
24523
 
24993
- const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format );
24524
+ const useTexStorage = ( texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format );
24994
24525
  const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
24995
24526
  const dataReady = source.dataReady;
24996
- const levels = getMipLevels( texture, image, supportsMips );
24527
+ const levels = getMipLevels( texture, image );
24997
24528
 
24998
24529
  if ( texture.isDepthTexture ) {
24999
24530
 
25000
24531
  // populate depth texture with dummy data
25001
24532
 
25002
- glInternalFormat = _gl.DEPTH_COMPONENT;
25003
-
25004
- if ( isWebGL2 ) {
25005
-
25006
- if ( texture.type === FloatType ) {
25007
-
25008
- glInternalFormat = _gl.DEPTH_COMPONENT32F;
25009
-
25010
- } else if ( texture.type === UnsignedIntType ) {
25011
-
25012
- glInternalFormat = _gl.DEPTH_COMPONENT24;
24533
+ glInternalFormat = _gl.DEPTH_COMPONENT16;
25013
24534
 
25014
- } else if ( texture.type === UnsignedInt248Type ) {
24535
+ if ( texture.type === FloatType ) {
25015
24536
 
25016
- glInternalFormat = _gl.DEPTH24_STENCIL8;
25017
-
25018
- } else {
25019
-
25020
- glInternalFormat = _gl.DEPTH_COMPONENT16; // WebGL2 requires sized internalformat for glTexImage2D
25021
-
25022
- }
25023
-
25024
- } else {
25025
-
25026
- if ( texture.type === FloatType ) {
25027
-
25028
- console.error( 'WebGLRenderer: Floating point depth texture requires WebGL2.' );
25029
-
25030
- }
25031
-
25032
- }
25033
-
25034
- // validation checks for WebGL 1
25035
-
25036
- if ( texture.format === DepthFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {
25037
-
25038
- // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
25039
- // DEPTH_COMPONENT and type is not UNSIGNED_SHORT or UNSIGNED_INT
25040
- // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
25041
- if ( texture.type !== UnsignedShortType && texture.type !== UnsignedIntType ) {
25042
-
25043
- console.warn( 'THREE.WebGLRenderer: Use UnsignedShortType or UnsignedIntType for DepthFormat DepthTexture.' );
25044
-
25045
- texture.type = UnsignedIntType;
25046
- glType = utils.convert( texture.type );
25047
-
25048
- }
25049
-
25050
- }
25051
-
25052
- if ( texture.format === DepthStencilFormat && glInternalFormat === _gl.DEPTH_COMPONENT ) {
25053
-
25054
- // Depth stencil textures need the DEPTH_STENCIL internal format
25055
- // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
25056
- glInternalFormat = _gl.DEPTH_STENCIL;
24537
+ glInternalFormat = _gl.DEPTH_COMPONENT32F;
25057
24538
 
25058
- // The error INVALID_OPERATION is generated by texImage2D if format and internalformat are
25059
- // DEPTH_STENCIL and type is not UNSIGNED_INT_24_8_WEBGL.
25060
- // (https://www.khronos.org/registry/webgl/extensions/WEBGL_depth_texture/)
25061
- if ( texture.type !== UnsignedInt248Type ) {
24539
+ } else if ( texture.type === UnsignedIntType ) {
25062
24540
 
25063
- console.warn( 'THREE.WebGLRenderer: Use UnsignedInt248Type for DepthStencilFormat DepthTexture.' );
24541
+ glInternalFormat = _gl.DEPTH_COMPONENT24;
25064
24542
 
25065
- texture.type = UnsignedInt248Type;
25066
- glType = utils.convert( texture.type );
24543
+ } else if ( texture.type === UnsignedInt248Type ) {
25067
24544
 
25068
- }
24545
+ glInternalFormat = _gl.DEPTH24_STENCIL8;
25069
24546
 
25070
24547
  }
25071
24548
 
@@ -25091,7 +24568,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25091
24568
  // if there are no manual mipmaps
25092
24569
  // set 0 level mipmap and then use GL to generate other mipmap levels
25093
24570
 
25094
- if ( mipmaps.length > 0 && supportsMips ) {
24571
+ if ( mipmaps.length > 0 ) {
25095
24572
 
25096
24573
  if ( useTexStorage && allocateMemory ) {
25097
24574
 
@@ -25338,11 +24815,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25338
24815
  // if there are no manual mipmaps
25339
24816
  // set 0 level mipmap and then use GL to generate other mipmap levels
25340
24817
 
25341
- if ( mipmaps.length > 0 && supportsMips ) {
24818
+ if ( mipmaps.length > 0 ) {
25342
24819
 
25343
24820
  if ( useTexStorage && allocateMemory ) {
25344
24821
 
25345
- state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
24822
+ const dimensions = getDimensions( mipmaps[ 0 ] );
24823
+
24824
+ state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );
25346
24825
 
25347
24826
  }
25348
24827
 
@@ -25374,7 +24853,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25374
24853
 
25375
24854
  if ( allocateMemory ) {
25376
24855
 
25377
- state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );
24856
+ const dimensions = getDimensions( image );
24857
+
24858
+ state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );
25378
24859
 
25379
24860
  }
25380
24861
 
@@ -25394,7 +24875,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25394
24875
 
25395
24876
  }
25396
24877
 
25397
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
24878
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
25398
24879
 
25399
24880
  generateMipmap( textureType );
25400
24881
 
@@ -25444,7 +24925,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25444
24925
 
25445
24926
  if ( ! isCompressed && ! isDataTexture ) {
25446
24927
 
25447
- cubeImage[ i ] = resizeImage( texture.image[ i ], false, true, capabilities.maxCubemapSize );
24928
+ cubeImage[ i ] = resizeImage( texture.image[ i ], true, capabilities.maxCubemapSize );
25448
24929
 
25449
24930
  } else {
25450
24931
 
@@ -25457,17 +24938,16 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25457
24938
  }
25458
24939
 
25459
24940
  const image = cubeImage[ 0 ],
25460
- supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
25461
24941
  glFormat = utils.convert( texture.format, texture.colorSpace ),
25462
24942
  glType = utils.convert( texture.type ),
25463
24943
  glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
25464
24944
 
25465
- const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
24945
+ const useTexStorage = ( texture.isVideoTexture !== true );
25466
24946
  const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
25467
24947
  const dataReady = source.dataReady;
25468
- let levels = getMipLevels( texture, image, supportsMips );
24948
+ let levels = getMipLevels( texture, image );
25469
24949
 
25470
- setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );
24950
+ setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );
25471
24951
 
25472
24952
  let mipmaps;
25473
24953
 
@@ -25545,7 +25025,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25545
25025
 
25546
25026
  if ( mipmaps.length > 0 ) levels ++;
25547
25027
 
25548
- state.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, cubeImage[ 0 ].width, cubeImage[ 0 ].height );
25028
+ const dimensions = getDimensions( cubeImage[ 0 ] );
25029
+
25030
+ state.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, dimensions.width, dimensions.height );
25549
25031
 
25550
25032
  }
25551
25033
 
@@ -25630,7 +25112,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25630
25112
 
25631
25113
  }
25632
25114
 
25633
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
25115
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
25634
25116
 
25635
25117
  // We assume images for cube map have the same size.
25636
25118
  generateMipmap( _gl.TEXTURE_CUBE_MAP );
@@ -25772,7 +25254,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25772
25254
 
25773
25255
  } else if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {
25774
25256
 
25775
- let glInternalFormat = ( isWebGL2 === true ) ? _gl.DEPTH_COMPONENT24 : _gl.DEPTH_COMPONENT16;
25257
+ let glInternalFormat = _gl.DEPTH_COMPONENT24;
25776
25258
 
25777
25259
  if ( isMultisample || useMultisampledRTT( renderTarget ) ) {
25778
25260
 
@@ -25835,7 +25317,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25835
25317
 
25836
25318
  } else {
25837
25319
 
25838
- const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];
25320
+ const textures = renderTarget.textures;
25839
25321
 
25840
25322
  for ( let i = 0; i < textures.length; i ++ ) {
25841
25323
 
@@ -26047,7 +25529,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26047
25529
 
26048
25530
  renderTarget.addEventListener( 'dispose', onRenderTargetDispose );
26049
25531
 
26050
- if ( renderTarget.isWebGLMultipleRenderTargets !== true ) {
25532
+ const textures = renderTarget.textures;
25533
+
25534
+ const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
25535
+ const isMultipleRenderTargets = ( textures.length > 1 );
25536
+
25537
+ if ( ! isMultipleRenderTargets ) {
26051
25538
 
26052
25539
  if ( textureProperties.__webglTexture === undefined ) {
26053
25540
 
@@ -26060,10 +25547,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26060
25547
 
26061
25548
  }
26062
25549
 
26063
- const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
26064
- const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
26065
- const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
26066
-
26067
25550
  // Setup framebuffer
26068
25551
 
26069
25552
  if ( isCube ) {
@@ -26072,7 +25555,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26072
25555
 
26073
25556
  for ( let i = 0; i < 6; i ++ ) {
26074
25557
 
26075
- if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
25558
+ if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
26076
25559
 
26077
25560
  renderTargetProperties.__webglFramebuffer[ i ] = [];
26078
25561
 
@@ -26092,7 +25575,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26092
25575
 
26093
25576
  } else {
26094
25577
 
26095
- if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
25578
+ if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
26096
25579
 
26097
25580
  renderTargetProperties.__webglFramebuffer = [];
26098
25581
 
@@ -26110,35 +25593,23 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26110
25593
 
26111
25594
  if ( isMultipleRenderTargets ) {
26112
25595
 
26113
- if ( capabilities.drawBuffers ) {
25596
+ for ( let i = 0, il = textures.length; i < il; i ++ ) {
26114
25597
 
26115
- const textures = renderTarget.texture;
25598
+ const attachmentProperties = properties.get( textures[ i ] );
26116
25599
 
26117
- for ( let i = 0, il = textures.length; i < il; i ++ ) {
25600
+ if ( attachmentProperties.__webglTexture === undefined ) {
26118
25601
 
26119
- const attachmentProperties = properties.get( textures[ i ] );
25602
+ attachmentProperties.__webglTexture = _gl.createTexture();
26120
25603
 
26121
- if ( attachmentProperties.__webglTexture === undefined ) {
26122
-
26123
- attachmentProperties.__webglTexture = _gl.createTexture();
26124
-
26125
- info.memory.textures ++;
26126
-
26127
- }
25604
+ info.memory.textures ++;
26128
25605
 
26129
25606
  }
26130
25607
 
26131
- } else {
26132
-
26133
- console.warn( 'THREE.WebGLRenderer: WebGLMultipleRenderTargets can only be used with WebGL2 or WEBGL_draw_buffers extension.' );
26134
-
26135
25608
  }
26136
25609
 
26137
25610
  }
26138
25611
 
26139
- if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
26140
-
26141
- const textures = isMultipleRenderTargets ? texture : [ texture ];
25612
+ if ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
26142
25613
 
26143
25614
  renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
26144
25615
  renderTargetProperties.__webglColorRenderbuffer = [];
@@ -26182,11 +25653,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26182
25653
  if ( isCube ) {
26183
25654
 
26184
25655
  state.bindTexture( _gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture );
26185
- setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );
25656
+ setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture );
26186
25657
 
26187
25658
  for ( let i = 0; i < 6; i ++ ) {
26188
25659
 
26189
- if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
25660
+ if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
26190
25661
 
26191
25662
  for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
26192
25663
 
@@ -26202,7 +25673,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26202
25673
 
26203
25674
  }
26204
25675
 
26205
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
25676
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
26206
25677
 
26207
25678
  generateMipmap( _gl.TEXTURE_CUBE_MAP );
26208
25679
 
@@ -26212,18 +25683,16 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26212
25683
 
26213
25684
  } else if ( isMultipleRenderTargets ) {
26214
25685
 
26215
- const textures = renderTarget.texture;
26216
-
26217
25686
  for ( let i = 0, il = textures.length; i < il; i ++ ) {
26218
25687
 
26219
25688
  const attachment = textures[ i ];
26220
25689
  const attachmentProperties = properties.get( attachment );
26221
25690
 
26222
25691
  state.bindTexture( _gl.TEXTURE_2D, attachmentProperties.__webglTexture );
26223
- setTextureParameters( _gl.TEXTURE_2D, attachment, supportsMips );
25692
+ setTextureParameters( _gl.TEXTURE_2D, attachment );
26224
25693
  setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, attachment, _gl.COLOR_ATTACHMENT0 + i, _gl.TEXTURE_2D, 0 );
26225
25694
 
26226
- if ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {
25695
+ if ( textureNeedsGenerateMipmaps( attachment ) ) {
26227
25696
 
26228
25697
  generateMipmap( _gl.TEXTURE_2D );
26229
25698
 
@@ -26239,15 +25708,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26239
25708
 
26240
25709
  if ( renderTarget.isWebGL3DRenderTarget || renderTarget.isWebGLArrayRenderTarget ) {
26241
25710
 
26242
- if ( isWebGL2 ) {
26243
-
26244
- glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
26245
-
26246
- } else {
26247
-
26248
- console.error( 'THREE.WebGLTextures: THREE.Data3DTexture and THREE.DataArrayTexture only supported with WebGL2.' );
26249
-
26250
- }
25711
+ glTextureType = renderTarget.isWebGL3DRenderTarget ? _gl.TEXTURE_3D : _gl.TEXTURE_2D_ARRAY;
26251
25712
 
26252
25713
  }
26253
25714
 
@@ -26258,9 +25719,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26258
25719
  }
26259
25720
 
26260
25721
  state.bindTexture( glTextureType, textureProperties.__webglTexture );
26261
- setTextureParameters( glTextureType, texture, supportsMips );
25722
+ setTextureParameters( glTextureType, texture );
26262
25723
 
26263
- if ( isWebGL2 && texture.mipmaps && texture.mipmaps.length > 0 ) {
25724
+ if ( texture.mipmaps && texture.mipmaps.length > 0 ) {
26264
25725
 
26265
25726
  for ( let level = 0; level < texture.mipmaps.length; level ++ ) {
26266
25727
 
@@ -26274,7 +25735,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26274
25735
 
26275
25736
  }
26276
25737
 
26277
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
25738
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
26278
25739
 
26279
25740
  generateMipmap( glTextureType );
26280
25741
 
@@ -26296,15 +25757,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26296
25757
 
26297
25758
  function updateRenderTargetMipmap( renderTarget ) {
26298
25759
 
26299
- const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
26300
-
26301
- const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];
25760
+ const textures = renderTarget.textures;
26302
25761
 
26303
25762
  for ( let i = 0, il = textures.length; i < il; i ++ ) {
26304
25763
 
26305
25764
  const texture = textures[ i ];
26306
25765
 
26307
- if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
25766
+ if ( textureNeedsGenerateMipmaps( texture ) ) {
26308
25767
 
26309
25768
  const target = renderTarget.isWebGLCubeRenderTarget ? _gl.TEXTURE_CUBE_MAP : _gl.TEXTURE_2D;
26310
25769
  const webglTexture = properties.get( texture ).__webglTexture;
@@ -26321,16 +25780,16 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26321
25780
 
26322
25781
  function updateMultisampleRenderTarget( renderTarget ) {
26323
25782
 
26324
- if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
25783
+ if ( ( renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
26325
25784
 
26326
- const textures = renderTarget.isWebGLMultipleRenderTargets ? renderTarget.texture : [ renderTarget.texture ];
25785
+ const textures = renderTarget.textures;
26327
25786
  const width = renderTarget.width;
26328
25787
  const height = renderTarget.height;
26329
25788
  let mask = _gl.COLOR_BUFFER_BIT;
26330
25789
  const invalidationArray = [];
26331
25790
  const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
26332
25791
  const renderTargetProperties = properties.get( renderTarget );
26333
- const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
25792
+ const isMultipleRenderTargets = ( textures.length > 1 );
26334
25793
 
26335
25794
  // If MRT we need to remove FBO attachments
26336
25795
  if ( isMultipleRenderTargets ) {
@@ -26365,7 +25824,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26365
25824
  if ( ignoreDepthValues === false ) {
26366
25825
 
26367
25826
  if ( renderTarget.depthBuffer ) mask |= _gl.DEPTH_BUFFER_BIT;
26368
- 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;
26369
25831
 
26370
25832
  }
26371
25833
 
@@ -26436,7 +25898,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26436
25898
 
26437
25899
  const renderTargetProperties = properties.get( renderTarget );
26438
25900
 
26439
- 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;
26440
25902
 
26441
25903
  }
26442
25904
 
@@ -26461,7 +25923,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26461
25923
  const format = texture.format;
26462
25924
  const type = texture.type;
26463
25925
 
26464
- if ( texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat ) return image;
25926
+ if ( texture.isCompressedTexture === true || texture.isVideoTexture === true ) return image;
26465
25927
 
26466
25928
  if ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {
26467
25929
 
@@ -26469,48 +25931,48 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26469
25931
 
26470
25932
  if ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {
26471
25933
 
26472
- if ( isWebGL2 === false ) {
25934
+ // in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format
26473
25935
 
26474
- // in WebGL 1, try to use EXT_sRGB extension and unsized formats
25936
+ if ( format !== RGBAFormat || type !== UnsignedByteType ) {
26475
25937
 
26476
- if ( extensions.has( 'EXT_sRGB' ) === true && format === RGBAFormat ) {
25938
+ console.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );
26477
25939
 
26478
- texture.format = _SRGBAFormat;
26479
-
26480
- // it's not possible to generate mips in WebGL 1 with this extension
25940
+ }
26481
25941
 
26482
- texture.minFilter = LinearFilter;
26483
- texture.generateMipmaps = false;
25942
+ } else {
26484
25943
 
26485
- } else {
25944
+ console.error( 'THREE.WebGLTextures: Unsupported texture color space:', colorSpace );
26486
25945
 
26487
- // slow fallback (CPU decode)
25946
+ }
26488
25947
 
26489
- image = ImageUtils.sRGBToLinear( image );
25948
+ }
26490
25949
 
26491
- }
25950
+ return image;
26492
25951
 
26493
- } else {
25952
+ }
26494
25953
 
26495
- // in WebGL 2 uncompressed textures can only be sRGB encoded if they have the RGBA8 format
25954
+ function getDimensions( image ) {
26496
25955
 
26497
- if ( format !== RGBAFormat || type !== UnsignedByteType ) {
25956
+ if ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) {
26498
25957
 
26499
- console.warn( 'THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.' );
25958
+ // if intrinsic data are not available, fallback to width/height
26500
25959
 
26501
- }
25960
+ _imageDimensions.width = image.naturalWidth || image.width;
25961
+ _imageDimensions.height = image.naturalHeight || image.height;
26502
25962
 
26503
- }
25963
+ } else if ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) {
26504
25964
 
26505
- } else {
25965
+ _imageDimensions.width = image.displayWidth;
25966
+ _imageDimensions.height = image.displayHeight;
26506
25967
 
26507
- console.error( 'THREE.WebGLTextures: Unsupported texture color space:', colorSpace );
25968
+ } else {
26508
25969
 
26509
- }
25970
+ _imageDimensions.width = image.width;
25971
+ _imageDimensions.height = image.height;
26510
25972
 
26511
25973
  }
26512
25974
 
26513
- return image;
25975
+ return _imageDimensions;
26514
25976
 
26515
25977
  }
26516
25978
 
@@ -26537,9 +25999,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26537
25999
 
26538
26000
  }
26539
26001
 
26540
- function WebGLUtils( gl, extensions, capabilities ) {
26541
-
26542
- const isWebGL2 = capabilities.isWebGL2;
26002
+ function WebGLUtils( gl, extensions ) {
26543
26003
 
26544
26004
  function convert( p, colorSpace = NoColorSpace ) {
26545
26005
 
@@ -26550,6 +26010,7 @@ function WebGLUtils( gl, extensions, capabilities ) {
26550
26010
  if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
26551
26011
  if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
26552
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;
26553
26014
 
26554
26015
  if ( p === ByteType ) return gl.BYTE;
26555
26016
  if ( p === ShortType ) return gl.SHORT;
@@ -26557,50 +26018,16 @@ function WebGLUtils( gl, extensions, capabilities ) {
26557
26018
  if ( p === IntType ) return gl.INT;
26558
26019
  if ( p === UnsignedIntType ) return gl.UNSIGNED_INT;
26559
26020
  if ( p === FloatType ) return gl.FLOAT;
26560
-
26561
- if ( p === HalfFloatType ) {
26562
-
26563
- if ( isWebGL2 ) return gl.HALF_FLOAT;
26564
-
26565
- extension = extensions.get( 'OES_texture_half_float' );
26566
-
26567
- if ( extension !== null ) {
26568
-
26569
- return extension.HALF_FLOAT_OES;
26570
-
26571
- } else {
26572
-
26573
- return null;
26574
-
26575
- }
26576
-
26577
- }
26021
+ if ( p === HalfFloatType ) return gl.HALF_FLOAT;
26578
26022
 
26579
26023
  if ( p === AlphaFormat ) return gl.ALPHA;
26024
+ if ( p === RGBFormat ) return gl.RGB;
26580
26025
  if ( p === RGBAFormat ) return gl.RGBA;
26581
26026
  if ( p === LuminanceFormat ) return gl.LUMINANCE;
26582
26027
  if ( p === LuminanceAlphaFormat ) return gl.LUMINANCE_ALPHA;
26583
26028
  if ( p === DepthFormat ) return gl.DEPTH_COMPONENT;
26584
26029
  if ( p === DepthStencilFormat ) return gl.DEPTH_STENCIL;
26585
26030
 
26586
- // WebGL 1 sRGB fallback
26587
-
26588
- if ( p === _SRGBAFormat ) {
26589
-
26590
- extension = extensions.get( 'EXT_sRGB' );
26591
-
26592
- if ( extension !== null ) {
26593
-
26594
- return extension.SRGB_ALPHA_EXT;
26595
-
26596
- } else {
26597
-
26598
- return null;
26599
-
26600
- }
26601
-
26602
- }
26603
-
26604
26031
  // WebGL2 formats.
26605
26032
 
26606
26033
  if ( p === RedFormat ) return gl.RED;
@@ -26787,23 +26214,7 @@ function WebGLUtils( gl, extensions, capabilities ) {
26787
26214
 
26788
26215
  //
26789
26216
 
26790
- if ( p === UnsignedInt248Type ) {
26791
-
26792
- if ( isWebGL2 ) return gl.UNSIGNED_INT_24_8;
26793
-
26794
- extension = extensions.get( 'WEBGL_depth_texture' );
26795
-
26796
- if ( extension !== null ) {
26797
-
26798
- return extension.UNSIGNED_INT_24_8_WEBGL;
26799
-
26800
- } else {
26801
-
26802
- return null;
26803
-
26804
- }
26805
-
26806
- }
26217
+ if ( p === UnsignedInt248Type ) return gl.UNSIGNED_INT_24_8;
26807
26218
 
26808
26219
  // if "p" can't be resolved, assume the user defines a WebGL constant as a string (fallback/workaround for packed RGB formats)
26809
26220
 
@@ -27779,11 +27190,11 @@ void main() {
27779
27190
 
27780
27191
  if ( coord.x >= 1.0 ) {
27781
27192
 
27782
- 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;
27783
27194
 
27784
27195
  } else {
27785
27196
 
27786
- gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
27197
+ gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
27787
27198
 
27788
27199
  }
27789
27200
 
@@ -27831,7 +27242,6 @@ class WebXRDepthSensing {
27831
27242
 
27832
27243
  const viewport = cameraXR.cameras[ 0 ].viewport;
27833
27244
  const material = new ShaderMaterial( {
27834
- extensions: { fragDepth: true },
27835
27245
  vertexShader: _occlusion_vertex,
27836
27246
  fragmentShader: _occlusion_fragment,
27837
27247
  uniforms: {
@@ -28137,10 +27547,10 @@ class WebXRManager extends EventDispatcher {
28137
27547
  currentPixelRatio = renderer.getPixelRatio();
28138
27548
  renderer.getSize( currentSize );
28139
27549
 
28140
- if ( ( session.renderState.layers === undefined ) || ( renderer.capabilities.isWebGL2 === false ) ) {
27550
+ if ( session.renderState.layers === undefined ) {
28141
27551
 
28142
27552
  const layerInit = {
28143
- antialias: ( session.renderState.layers === undefined ) ? attributes.antialias : true,
27553
+ antialias: attributes.antialias,
28144
27554
  alpha: true,
28145
27555
  depth: attributes.depth,
28146
27556
  stencil: attributes.stencil,
@@ -28729,6 +28139,9 @@ class WebXRManager extends EventDispatcher {
28729
28139
 
28730
28140
  }
28731
28141
 
28142
+ const _e1 = /*@__PURE__*/ new Euler();
28143
+ const _m1 = /*@__PURE__*/ new Matrix4();
28144
+
28732
28145
  function WebGLMaterials( renderer, properties ) {
28733
28146
 
28734
28147
  function refreshTransformUniform( map, uniform ) {
@@ -28937,12 +28350,30 @@ function WebGLMaterials( renderer, properties ) {
28937
28350
 
28938
28351
  }
28939
28352
 
28940
- const envMap = properties.get( material ).envMap;
28353
+ const materialProperties = properties.get( material );
28354
+
28355
+ const envMap = materialProperties.envMap;
28356
+ const envMapRotation = materialProperties.envMapRotation;
28941
28357
 
28942
28358
  if ( envMap ) {
28943
28359
 
28944
28360
  uniforms.envMap.value = envMap;
28945
28361
 
28362
+ _e1.copy( envMapRotation );
28363
+
28364
+ // accommodate left-handed frame
28365
+ _e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;
28366
+
28367
+ if ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {
28368
+
28369
+ // environment maps which are not cube render targets or PMREMs follow a different convention
28370
+ _e1.y *= - 1;
28371
+ _e1.z *= - 1;
28372
+
28373
+ }
28374
+
28375
+ uniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( _e1 ) );
28376
+
28946
28377
  uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;
28947
28378
 
28948
28379
  uniforms.reflectivity.value = material.reflectivity;
@@ -29098,11 +28529,10 @@ function WebGLMaterials( renderer, properties ) {
29098
28529
 
29099
28530
  }
29100
28531
 
29101
- const envMap = properties.get( material ).envMap;
29102
-
29103
- if ( envMap ) {
28532
+ if ( material.envMap ) {
29104
28533
 
29105
28534
  //uniforms.envMap.value = material.envMap; // part of uniforms common
28535
+
29106
28536
  uniforms.envMapIntensity.value = material.envMapIntensity;
29107
28537
 
29108
28538
  }
@@ -29298,7 +28728,7 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
29298
28728
  let updateList = {};
29299
28729
  let allocatedBindingPoints = [];
29300
28730
 
29301
- 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
29302
28732
 
29303
28733
  function bind( uniformsGroup, program ) {
29304
28734
 
@@ -29690,7 +29120,7 @@ class WebGLRenderer {
29690
29120
  canvas = createCanvasElement(),
29691
29121
  context = null,
29692
29122
  depth = true,
29693
- stencil = true,
29123
+ stencil = false,
29694
29124
  alpha = false,
29695
29125
  antialias = false,
29696
29126
  premultipliedAlpha = true,
@@ -29706,6 +29136,12 @@ class WebGLRenderer {
29706
29136
 
29707
29137
  if ( context !== null ) {
29708
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
+
29709
29145
  _alpha = context.getContextAttributes().alpha;
29710
29146
 
29711
29147
  } else {
@@ -29818,10 +29254,6 @@ class WebGLRenderer {
29818
29254
  let _clippingEnabled = false;
29819
29255
  let _localClippingEnabled = false;
29820
29256
 
29821
- // transmission
29822
-
29823
- let _transmissionRenderTarget = null;
29824
-
29825
29257
  // camera matrices cache
29826
29258
 
29827
29259
  const _projScreenMatrix = new Matrix4();
@@ -29841,15 +29273,10 @@ class WebGLRenderer {
29841
29273
 
29842
29274
  let _gl = context;
29843
29275
 
29844
- function getContext( contextNames, contextAttributes ) {
29276
+ function getContext( contextName, contextAttributes ) {
29845
29277
 
29846
- for ( let i = 0; i < contextNames.length; i ++ ) {
29847
-
29848
- const contextName = contextNames[ i ];
29849
- const context = canvas.getContext( contextName, contextAttributes );
29850
- if ( context !== null ) return context;
29851
-
29852
- }
29278
+ const context = canvas.getContext( contextName, contextAttributes );
29279
+ if ( context !== null ) return context;
29853
29280
 
29854
29281
  return null;
29855
29282
 
@@ -29878,19 +29305,13 @@ class WebGLRenderer {
29878
29305
 
29879
29306
  if ( _gl === null ) {
29880
29307
 
29881
- const contextNames = [ 'webgl2', 'webgl', 'experimental-webgl' ];
29882
-
29883
- if ( _this.isWebGL1Renderer === true ) {
29308
+ const contextName = 'webgl2';
29884
29309
 
29885
- contextNames.shift();
29886
-
29887
- }
29888
-
29889
- _gl = getContext( contextNames, contextAttributes );
29310
+ _gl = getContext( contextName, contextAttributes );
29890
29311
 
29891
29312
  if ( _gl === null ) {
29892
29313
 
29893
- if ( getContext( contextNames ) ) {
29314
+ if ( getContext( contextName ) ) {
29894
29315
 
29895
29316
  throw new Error( 'Error creating WebGL context with your selected attributes.' );
29896
29317
 
@@ -29904,24 +29325,6 @@ class WebGLRenderer {
29904
29325
 
29905
29326
  }
29906
29327
 
29907
- if ( typeof WebGLRenderingContext !== 'undefined' && _gl instanceof WebGLRenderingContext ) { // @deprecated, r153
29908
-
29909
- console.warn( 'THREE.WebGLRenderer: WebGL 1 support was deprecated in r153 and will be removed in r163.' );
29910
-
29911
- }
29912
-
29913
- // Some experimental-webgl implementations do not have getShaderPrecisionFormat
29914
-
29915
- if ( _gl.getShaderPrecisionFormat === undefined ) {
29916
-
29917
- _gl.getShaderPrecisionFormat = function () {
29918
-
29919
- return { 'rangeMin': 1, 'rangeMax': 1, 'precision': 1 };
29920
-
29921
- };
29922
-
29923
- }
29924
-
29925
29328
  } catch ( error ) {
29926
29329
 
29927
29330
  console.error( 'THREE.WebGLRenderer: ' + error.message );
@@ -29941,22 +29344,21 @@ class WebGLRenderer {
29941
29344
  function initGLContext() {
29942
29345
 
29943
29346
  extensions = new WebGLExtensions( _gl );
29347
+ extensions.init();
29944
29348
 
29945
29349
  capabilities = new WebGLCapabilities( _gl, extensions, parameters );
29946
29350
 
29947
- extensions.init( capabilities );
29948
-
29949
- utils = new WebGLUtils( _gl, extensions, capabilities );
29351
+ utils = new WebGLUtils( _gl, extensions );
29950
29352
 
29951
- state = new WebGLState( _gl, extensions, capabilities );
29353
+ state = new WebGLState( _gl );
29952
29354
 
29953
29355
  info = new WebGLInfo( _gl );
29954
29356
  properties = new WebGLProperties();
29955
29357
  textures = new WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info );
29956
29358
  cubemaps = new WebGLCubeMaps( _this );
29957
29359
  cubeuvmaps = new WebGLCubeUVMaps( _this );
29958
- attributes = new WebGLAttributes( _gl, capabilities );
29959
- bindingStates = new WebGLBindingStates( _gl, extensions, attributes, capabilities );
29360
+ attributes = new WebGLAttributes( _gl );
29361
+ bindingStates = new WebGLBindingStates( _gl, attributes );
29960
29362
  geometries = new WebGLGeometries( _gl, attributes, info, bindingStates );
29961
29363
  objects = new WebGLObjects( _gl, geometries, attributes, info );
29962
29364
  morphtargets = new WebGLMorphtargets( _gl, capabilities, textures );
@@ -29964,14 +29366,14 @@ class WebGLRenderer {
29964
29366
  programCache = new WebGLPrograms( _this, cubemaps, cubeuvmaps, extensions, capabilities, bindingStates, clipping );
29965
29367
  materials = new WebGLMaterials( _this, properties );
29966
29368
  renderLists = new WebGLRenderLists();
29967
- renderStates = new WebGLRenderStates( extensions, capabilities );
29369
+ renderStates = new WebGLRenderStates( extensions );
29968
29370
  background = new WebGLBackground( _this, cubemaps, cubeuvmaps, state, objects, _alpha, premultipliedAlpha );
29969
29371
  multiview = new WebGLMultiview( _this, extensions, _gl );
29970
29372
  shadowMap = new WebGLShadowMap( _this, objects, capabilities );
29971
29373
  uniformsGroups = new WebGLUniformsGroups( _gl, info, capabilities, state );
29972
29374
 
29973
- bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );
29974
- indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info, capabilities );
29375
+ bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info );
29376
+ indexedBufferRenderer = new WebGLIndexedBufferRenderer( _gl, extensions, info );
29975
29377
 
29976
29378
  info.programs = programCache.programs;
29977
29379
 
@@ -30113,7 +29515,7 @@ class WebGLRenderer {
30113
29515
 
30114
29516
  }
30115
29517
 
30116
- state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() );
29518
+ state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).round() );
30117
29519
 
30118
29520
  };
30119
29521
 
@@ -30135,7 +29537,7 @@ class WebGLRenderer {
30135
29537
 
30136
29538
  }
30137
29539
 
30138
- state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() );
29540
+ state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).round() );
30139
29541
 
30140
29542
  };
30141
29543
 
@@ -30303,13 +29705,6 @@ class WebGLRenderer {
30303
29705
  xr.removeEventListener( 'sessionstart', onXRSessionStart );
30304
29706
  xr.removeEventListener( 'sessionend', onXRSessionEnd );
30305
29707
 
30306
- if ( _transmissionRenderTarget ) {
30307
-
30308
- _transmissionRenderTarget.dispose();
30309
- _transmissionRenderTarget = null;
30310
-
30311
- }
30312
-
30313
29708
  animation.stop();
30314
29709
 
30315
29710
  };
@@ -31078,17 +30473,19 @@ class WebGLRenderer {
31078
30473
 
31079
30474
  }
31080
30475
 
31081
- const isWebGL2 = capabilities.isWebGL2;
30476
+ if ( currentRenderState.state.transmissionRenderTarget === null ) {
31082
30477
 
31083
- if ( _transmissionRenderTarget === null ) {
31084
-
31085
- _transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {
30478
+ currentRenderState.state.transmissionRenderTarget = new WebGLRenderTarget( 1, 1, {
31086
30479
  generateMipmaps: true,
31087
- 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,
31088
30481
  minFilter: LinearMipmapLinearFilter,
31089
- samples: ( isWebGL2 ) ? 4 : 0
30482
+ samples: 4,
30483
+ stencilBuffer: stencil
31090
30484
  } );
31091
30485
 
30486
+ const renderTargetProperties = properties.get( currentRenderState.state.transmissionRenderTarget );
30487
+ renderTargetProperties.__isTransmissionRenderTarget = true;
30488
+
31092
30489
  // debug
31093
30490
 
31094
30491
  /*
@@ -31101,22 +30498,15 @@ class WebGLRenderer {
31101
30498
 
31102
30499
  }
31103
30500
 
31104
- _this.getDrawingBufferSize( _vector2 );
31105
-
31106
- if ( isWebGL2 ) {
30501
+ const transmissionRenderTarget = currentRenderState.state.transmissionRenderTarget;
31107
30502
 
31108
- _transmissionRenderTarget.setSize( _vector2.x, _vector2.y );
31109
-
31110
- } else {
31111
-
31112
- _transmissionRenderTarget.setSize( floorPowerOfTwo( _vector2.x ), floorPowerOfTwo( _vector2.y ) );
31113
-
31114
- }
30503
+ _this.getDrawingBufferSize( _vector2 );
30504
+ transmissionRenderTarget.setSize( _vector2.x, _vector2.y );
31115
30505
 
31116
30506
  //
31117
30507
 
31118
30508
  const currentRenderTarget = _this.getRenderTarget();
31119
- _this.setRenderTarget( _transmissionRenderTarget );
30509
+ _this.setRenderTarget( transmissionRenderTarget );
31120
30510
 
31121
30511
  _this.getClearColor( _currentClearColor );
31122
30512
  _currentClearAlpha = _this.getClearAlpha();
@@ -31131,8 +30521,8 @@ class WebGLRenderer {
31131
30521
 
31132
30522
  renderObjects( opaqueObjects, scene, camera );
31133
30523
 
31134
- textures.updateMultisampleRenderTarget( _transmissionRenderTarget );
31135
- textures.updateRenderTargetMipmap( _transmissionRenderTarget );
30524
+ textures.updateMultisampleRenderTarget( transmissionRenderTarget );
30525
+ textures.updateRenderTargetMipmap( transmissionRenderTarget );
31136
30526
 
31137
30527
  let renderTargetNeedsUpdate = false;
31138
30528
 
@@ -31165,8 +30555,8 @@ class WebGLRenderer {
31165
30555
 
31166
30556
  if ( renderTargetNeedsUpdate === true ) {
31167
30557
 
31168
- textures.updateMultisampleRenderTarget( _transmissionRenderTarget );
31169
- textures.updateRenderTargetMipmap( _transmissionRenderTarget );
30558
+ textures.updateMultisampleRenderTarget( transmissionRenderTarget );
30559
+ textures.updateRenderTargetMipmap( transmissionRenderTarget );
31170
30560
 
31171
30561
  }
31172
30562
 
@@ -31253,6 +30643,7 @@ class WebGLRenderer {
31253
30643
  materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;
31254
30644
  materialProperties.fog = scene.fog;
31255
30645
  materialProperties.envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || materialProperties.environment );
30646
+ materialProperties.envMapRotation = ( materialProperties.environment !== null && material.envMap === null ) ? scene.environmentRotation : material.envMapRotation;
31256
30647
 
31257
30648
  if ( programs === undefined ) {
31258
30649
 
@@ -31365,6 +30756,7 @@ class WebGLRenderer {
31365
30756
  materialProperties.batching = parameters.batching;
31366
30757
  materialProperties.instancing = parameters.instancing;
31367
30758
  materialProperties.instancingColor = parameters.instancingColor;
30759
+ materialProperties.instancingMorph = parameters.instancingMorph;
31368
30760
  materialProperties.skinning = parameters.skinning;
31369
30761
  materialProperties.morphTargets = parameters.morphTargets;
31370
30762
  materialProperties.morphNormals = parameters.morphNormals;
@@ -31478,6 +30870,14 @@ class WebGLRenderer {
31478
30870
 
31479
30871
  needsProgramChange = true;
31480
30872
 
30873
+ } else if ( object.isInstancedMesh && materialProperties.instancingMorph === true && object.morphTexture === null ) {
30874
+
30875
+ needsProgramChange = true;
30876
+
30877
+ } else if ( object.isInstancedMesh && materialProperties.instancingMorph === false && object.morphTexture !== null ) {
30878
+
30879
+ needsProgramChange = true;
30880
+
31481
30881
  } else if ( materialProperties.envMap !== envMap ) {
31482
30882
 
31483
30883
  needsProgramChange = true;
@@ -31516,7 +30916,7 @@ class WebGLRenderer {
31516
30916
 
31517
30917
  needsProgramChange = true;
31518
30918
 
31519
- } else if ( capabilities.isWebGL2 === true && materialProperties.morphTargetsCount !== morphTargetsCount ) {
30919
+ } else if ( materialProperties.morphTargetsCount !== morphTargetsCount ) {
31520
30920
 
31521
30921
  needsProgramChange = true;
31522
30922
 
@@ -31638,17 +31038,9 @@ class WebGLRenderer {
31638
31038
 
31639
31039
  if ( skeleton ) {
31640
31040
 
31641
- if ( capabilities.floatVertexTextures ) {
31642
-
31643
- if ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();
31041
+ if ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();
31644
31042
 
31645
- p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );
31646
-
31647
- } else {
31648
-
31649
- console.warn( 'THREE.WebGLRenderer: SkinnedMesh can only be used with WebGL 2. With WebGL 1 OES_texture_float and vertex textures support is required.' );
31650
-
31651
- }
31043
+ p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );
31652
31044
 
31653
31045
  }
31654
31046
 
@@ -31663,7 +31055,7 @@ class WebGLRenderer {
31663
31055
 
31664
31056
  const morphAttributes = geometry.morphAttributes;
31665
31057
 
31666
- if ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined && capabilities.isWebGL2 === true ) ) {
31058
+ if ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined ) ) {
31667
31059
 
31668
31060
  morphtargets.update( object, geometry, program );
31669
31061
 
@@ -31686,6 +31078,12 @@ class WebGLRenderer {
31686
31078
 
31687
31079
  }
31688
31080
 
31081
+ if ( material.isMeshStandardMaterial && material.envMap === null && scene.environment !== null ) {
31082
+
31083
+ m_uniforms.envMapIntensity.value = scene.environmentIntensity;
31084
+
31085
+ }
31086
+
31689
31087
  if ( refreshMaterial ) {
31690
31088
 
31691
31089
  p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );
@@ -31713,7 +31111,7 @@ class WebGLRenderer {
31713
31111
 
31714
31112
  }
31715
31113
 
31716
- materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, _transmissionRenderTarget );
31114
+ materials.refreshMaterialUniforms( m_uniforms, material, _pixelRatio, _height, currentRenderState.state.transmissionRenderTarget );
31717
31115
 
31718
31116
  WebGLUniforms.upload( _gl, getUniformList( materialProperties ), m_uniforms, textures );
31719
31117
 
@@ -31755,18 +31153,10 @@ class WebGLRenderer {
31755
31153
 
31756
31154
  for ( let i = 0, l = groups.length; i < l; i ++ ) {
31757
31155
 
31758
- if ( capabilities.isWebGL2 ) {
31759
-
31760
- const group = groups[ i ];
31761
-
31762
- uniformsGroups.update( group, program );
31763
- uniformsGroups.bind( group, program );
31764
-
31765
- } else {
31766
-
31767
- console.warn( 'THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.' );
31156
+ const group = groups[ i ];
31768
31157
 
31769
- }
31158
+ uniformsGroups.update( group, program );
31159
+ uniformsGroups.bind( group, program );
31770
31160
 
31771
31161
  }
31772
31162
 
@@ -31935,7 +31325,7 @@ class WebGLRenderer {
31935
31325
 
31936
31326
  isCube = true;
31937
31327
 
31938
- } else if ( ( capabilities.isWebGL2 && renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {
31328
+ } else if ( ( renderTarget.samples > 0 ) && textures.useMultisampledRTT( renderTarget ) === false ) {
31939
31329
 
31940
31330
  framebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;
31941
31331
 
@@ -31967,7 +31357,7 @@ class WebGLRenderer {
31967
31357
 
31968
31358
  const framebufferBound = state.bindFramebuffer( _gl.FRAMEBUFFER, framebuffer );
31969
31359
 
31970
- if ( framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer ) {
31360
+ if ( framebufferBound && useDefaultFramebuffer ) {
31971
31361
 
31972
31362
  state.drawBuffers( renderTarget, framebuffer );
31973
31363
 
@@ -32028,11 +31418,10 @@ class WebGLRenderer {
32028
31418
 
32029
31419
  }
32030
31420
 
32031
- 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' ) );
32032
31422
 
32033
31423
  if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( _gl.IMPLEMENTATION_COLOR_READ_TYPE ) && // Edge and Chrome Mac < 52 (#9513)
32034
- ! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.has( 'OES_texture_float' ) || extensions.has( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox
32035
- ! halfFloatSupportedByExt ) {
31424
+ textureType !== FloatType && ! halfFloatSupportedByExt ) {
32036
31425
 
32037
31426
  console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );
32038
31427
  return;
@@ -32116,15 +31505,8 @@ class WebGLRenderer {
32116
31505
 
32117
31506
  this.copyTextureToTexture3D = function ( sourceBox, position, srcTexture, dstTexture, level = 0 ) {
32118
31507
 
32119
- if ( _this.isWebGL1Renderer ) {
32120
-
32121
- console.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: can only be used with WebGL2.' );
32122
- return;
32123
-
32124
- }
32125
-
32126
- const width = sourceBox.max.x - sourceBox.min.x + 1;
32127
- const height = sourceBox.max.y - sourceBox.min.y + 1;
31508
+ const width = Math.round( sourceBox.max.x - sourceBox.min.x );
31509
+ const height = Math.round( sourceBox.max.y - sourceBox.min.y );
32128
31510
  const depth = sourceBox.max.z - sourceBox.min.z + 1;
32129
31511
  const glFormat = utils.convert( dstTexture.format );
32130
31512
  const glType = utils.convert( dstTexture.type );
@@ -32171,9 +31553,8 @@ class WebGLRenderer {
32171
31553
 
32172
31554
  } else {
32173
31555
 
32174
- if ( srcTexture.isCompressedArrayTexture ) {
31556
+ if ( dstTexture.isCompressedArrayTexture ) {
32175
31557
 
32176
- console.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.' );
32177
31558
  _gl.compressedTexSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data );
32178
31559
 
32179
31560
  } else {
@@ -32262,20 +31643,6 @@ class WebGLRenderer {
32262
31643
 
32263
31644
  }
32264
31645
 
32265
- get outputEncoding() { // @deprecated, r152
32266
-
32267
- console.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
32268
- return this.outputColorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
32269
-
32270
- }
32271
-
32272
- set outputEncoding( encoding ) { // @deprecated, r152
32273
-
32274
- console.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
32275
- this.outputColorSpace = encoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
32276
-
32277
- }
32278
-
32279
31646
  get useLegacyLights() { // @deprecated, r155
32280
31647
 
32281
31648
  console.warn( 'THREE.WebGLRenderer: The property .useLegacyLights has been deprecated. Migrate your lighting according to the following guide: https://discourse.threejs.org/t/updates-to-lighting-in-three-js-r155/53733.' );
@@ -32292,10 +31659,6 @@ class WebGLRenderer {
32292
31659
 
32293
31660
  }
32294
31661
 
32295
- class WebGL1Renderer extends WebGLRenderer {}
32296
-
32297
- WebGL1Renderer.prototype.isWebGL1Renderer = true;
32298
-
32299
31662
  class FogExp2 {
32300
31663
 
32301
31664
  constructor( color, density = 0.00025 ) {
@@ -32379,6 +31742,10 @@ class Scene extends Object3D {
32379
31742
 
32380
31743
  this.backgroundBlurriness = 0;
32381
31744
  this.backgroundIntensity = 1;
31745
+ this.backgroundRotation = new Euler();
31746
+
31747
+ this.environmentIntensity = 1;
31748
+ this.environmentRotation = new Euler();
32382
31749
 
32383
31750
  this.overrideMaterial = null;
32384
31751
 
@@ -32400,6 +31767,10 @@ class Scene extends Object3D {
32400
31767
 
32401
31768
  this.backgroundBlurriness = source.backgroundBlurriness;
32402
31769
  this.backgroundIntensity = source.backgroundIntensity;
31770
+ this.backgroundRotation.copy( source.backgroundRotation );
31771
+
31772
+ this.environmentIntensity = source.environmentIntensity;
31773
+ this.environmentRotation.copy( source.environmentRotation );
32403
31774
 
32404
31775
  if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();
32405
31776
 
@@ -32414,8 +31785,13 @@ class Scene extends Object3D {
32414
31785
  const data = super.toJSON( meta );
32415
31786
 
32416
31787
  if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
31788
+
32417
31789
  if ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;
32418
31790
  if ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;
31791
+ data.object.backgroundRotation = this.backgroundRotation.toArray();
31792
+
31793
+ if ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;
31794
+ data.object.environmentRotation = this.environmentRotation.toArray();
32419
31795
 
32420
31796
  return data;
32421
31797
 
@@ -33960,6 +33336,7 @@ class InstancedMesh extends Mesh {
33960
33336
 
33961
33337
  this.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );
33962
33338
  this.instanceColor = null;
33339
+ this.morphTexture = null;
33963
33340
 
33964
33341
  this.count = count;
33965
33342
 
@@ -34042,6 +33419,7 @@ class InstancedMesh extends Mesh {
34042
33419
 
34043
33420
  this.instanceMatrix.copy( source.instanceMatrix );
34044
33421
 
33422
+ if ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();
34045
33423
  if ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();
34046
33424
 
34047
33425
  this.count = source.count;
@@ -34065,6 +33443,24 @@ class InstancedMesh extends Mesh {
34065
33443
 
34066
33444
  }
34067
33445
 
33446
+ getMorphAt( index, object ) {
33447
+
33448
+ const objectInfluences = object.morphTargetInfluences;
33449
+
33450
+ const array = this.morphTexture.source.data.data;
33451
+
33452
+ const len = objectInfluences.length + 1; // All influences + the baseInfluenceSum
33453
+
33454
+ const dataIndex = index * len + 1; // Skip the baseInfluenceSum at the beginning
33455
+
33456
+ for ( let i = 0; i < objectInfluences.length; i ++ ) {
33457
+
33458
+ objectInfluences[ i ] = array[ dataIndex + i ];
33459
+
33460
+ }
33461
+
33462
+ }
33463
+
34068
33464
  raycast( raycaster, intersects ) {
34069
33465
 
34070
33466
  const matrixWorld = this.matrixWorld;
@@ -34135,6 +33531,38 @@ class InstancedMesh extends Mesh {
34135
33531
 
34136
33532
  }
34137
33533
 
33534
+ setMorphAt( index, object ) {
33535
+
33536
+ const objectInfluences = object.morphTargetInfluences;
33537
+
33538
+ const len = objectInfluences.length + 1; // morphBaseInfluence + all influences
33539
+
33540
+ if ( this.morphTexture === null ) {
33541
+
33542
+ this.morphTexture = new DataTexture( new Float32Array( len * this.count ), len, this.count, RedFormat, FloatType );
33543
+
33544
+ }
33545
+
33546
+ const array = this.morphTexture.source.data.data;
33547
+
33548
+ let morphInfluencesSum = 0;
33549
+
33550
+ for ( let i = 0; i < objectInfluences.length; i ++ ) {
33551
+
33552
+ morphInfluencesSum += objectInfluences[ i ];
33553
+
33554
+ }
33555
+
33556
+ const morphBaseInfluence = this.geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
33557
+
33558
+ const dataIndex = len * index;
33559
+
33560
+ array[ dataIndex ] = morphBaseInfluence;
33561
+
33562
+ array.set( objectInfluences, dataIndex + 1 );
33563
+
33564
+ }
33565
+
34138
33566
  updateMorphTargets() {
34139
33567
 
34140
33568
  }
@@ -34143,6 +33571,15 @@ class InstancedMesh extends Mesh {
34143
33571
 
34144
33572
  this.dispatchEvent( { type: 'dispose' } );
34145
33573
 
33574
+ if ( this.morphTexture !== null ) {
33575
+
33576
+ this.morphTexture.dispose();
33577
+ this.morphTexture = null;
33578
+
33579
+ }
33580
+
33581
+ return this;
33582
+
34146
33583
  }
34147
33584
 
34148
33585
  }
@@ -34205,7 +33642,7 @@ class MultiDrawRenderList {
34205
33642
  }
34206
33643
 
34207
33644
  const ID_ATTR_NAME = 'batchId';
34208
- const _matrix = /*@__PURE__*/ new Matrix4();
33645
+ const _matrix$1 = /*@__PURE__*/ new Matrix4();
34209
33646
  const _invMatrixWorld = /*@__PURE__*/ new Matrix4();
34210
33647
  const _identityMatrix = /*@__PURE__*/ new Matrix4();
34211
33648
  const _projScreenMatrix$2 = /*@__PURE__*/ new Matrix4();
@@ -34332,8 +33769,7 @@ class BatchedMesh extends Mesh {
34332
33769
  const { array, itemSize, normalized } = srcAttribute;
34333
33770
 
34334
33771
  const dstArray = new array.constructor( maxVertexCount * itemSize );
34335
- const dstAttribute = new srcAttribute.constructor( dstArray, itemSize, normalized );
34336
- dstAttribute.setUsage( srcAttribute.usage );
33772
+ const dstAttribute = new BufferAttribute( dstArray, itemSize, normalized );
34337
33773
 
34338
33774
  geometry.setAttribute( attributeName, dstAttribute );
34339
33775
 
@@ -34360,7 +33796,7 @@ class BatchedMesh extends Mesh {
34360
33796
 
34361
33797
  }
34362
33798
 
34363
- // 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
34364
33800
  _validateGeometry( geometry ) {
34365
33801
 
34366
33802
  // check that the geometry doesn't have a version of our reserved id attribute
@@ -34428,8 +33864,8 @@ class BatchedMesh extends Mesh {
34428
33864
 
34429
33865
  if ( active[ i ] === false ) continue;
34430
33866
 
34431
- this.getMatrixAt( i, _matrix );
34432
- this.getBoundingBoxAt( i, _box$1 ).applyMatrix4( _matrix );
33867
+ this.getMatrixAt( i, _matrix$1 );
33868
+ this.getBoundingBoxAt( i, _box$1 ).applyMatrix4( _matrix$1 );
34433
33869
  boundingBox.union( _box$1 );
34434
33870
 
34435
33871
  }
@@ -34453,8 +33889,8 @@ class BatchedMesh extends Mesh {
34453
33889
 
34454
33890
  if ( active[ i ] === false ) continue;
34455
33891
 
34456
- this.getMatrixAt( i, _matrix );
34457
- this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );
33892
+ this.getMatrixAt( i, _matrix$1 );
33893
+ this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix$1 );
34458
33894
  boundingSphere.union( _sphere$2 );
34459
33895
 
34460
33896
  }
@@ -34651,6 +34087,7 @@ class BatchedMesh extends Mesh {
34651
34087
  }
34652
34088
 
34653
34089
  dstAttribute.needsUpdate = true;
34090
+ dstAttribute.addUpdateRange( vertexStart * itemSize, vertexCount * itemSize );
34654
34091
 
34655
34092
  }
34656
34093
 
@@ -34674,6 +34111,7 @@ class BatchedMesh extends Mesh {
34674
34111
  }
34675
34112
 
34676
34113
  dstIndex.needsUpdate = true;
34114
+ dstIndex.addUpdateRange( indexStart, reservedRange.indexCount );
34677
34115
 
34678
34116
  }
34679
34117
 
@@ -35061,8 +34499,8 @@ class BatchedMesh extends Mesh {
35061
34499
  if ( visibility[ i ] && active[ i ] ) {
35062
34500
 
35063
34501
  // get the bounds in world space
35064
- this.getMatrixAt( i, _matrix );
35065
- this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );
34502
+ this.getMatrixAt( i, _matrix$1 );
34503
+ this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix$1 );
35066
34504
 
35067
34505
  // determine whether the batched geometry is within the frustum
35068
34506
  let culled = false;
@@ -35119,8 +34557,8 @@ class BatchedMesh extends Mesh {
35119
34557
  if ( perObjectFrustumCulled ) {
35120
34558
 
35121
34559
  // get the bounds in world space
35122
- this.getMatrixAt( i, _matrix );
35123
- this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );
34560
+ this.getMatrixAt( i, _matrix$1 );
34561
+ this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix$1 );
35124
34562
  culled = ! _frustum.intersectsSphere( _sphere$2 );
35125
34563
 
35126
34564
  }
@@ -36249,9 +35687,9 @@ class EllipseCurve extends Curve {
36249
35687
 
36250
35688
  }
36251
35689
 
36252
- getPoint( t, optionalTarget ) {
35690
+ getPoint( t, optionalTarget = new Vector2() ) {
36253
35691
 
36254
- const point = optionalTarget || new Vector2();
35692
+ const point = optionalTarget;
36255
35693
 
36256
35694
  const twoPi = Math.PI * 2;
36257
35695
  let deltaAngle = this.aEndAngle - this.aStartAngle;
@@ -41908,6 +41346,7 @@ class MeshStandardMaterial extends Material {
41908
41346
  this.alphaMap = null;
41909
41347
 
41910
41348
  this.envMap = null;
41349
+ this.envMapRotation = new Euler();
41911
41350
  this.envMapIntensity = 1.0;
41912
41351
 
41913
41352
  this.wireframe = false;
@@ -41963,6 +41402,7 @@ class MeshStandardMaterial extends Material {
41963
41402
  this.alphaMap = source.alphaMap;
41964
41403
 
41965
41404
  this.envMap = source.envMap;
41405
+ this.envMapRotation.copy( source.envMapRotation );
41966
41406
  this.envMapIntensity = source.envMapIntensity;
41967
41407
 
41968
41408
  this.wireframe = source.wireframe;
@@ -42240,6 +41680,7 @@ class MeshPhongMaterial extends Material {
42240
41680
  this.alphaMap = null;
42241
41681
 
42242
41682
  this.envMap = null;
41683
+ this.envMapRotation = new Euler();
42243
41684
  this.combine = MultiplyOperation;
42244
41685
  this.reflectivity = 1;
42245
41686
  this.refractionRatio = 0.98;
@@ -42293,6 +41734,7 @@ class MeshPhongMaterial extends Material {
42293
41734
  this.alphaMap = source.alphaMap;
42294
41735
 
42295
41736
  this.envMap = source.envMap;
41737
+ this.envMapRotation.copy( source.envMapRotation );
42296
41738
  this.combine = source.combine;
42297
41739
  this.reflectivity = source.reflectivity;
42298
41740
  this.refractionRatio = source.refractionRatio;
@@ -42504,6 +41946,7 @@ class MeshLambertMaterial extends Material {
42504
41946
  this.alphaMap = null;
42505
41947
 
42506
41948
  this.envMap = null;
41949
+ this.envMapRotation = new Euler();
42507
41950
  this.combine = MultiplyOperation;
42508
41951
  this.reflectivity = 1;
42509
41952
  this.refractionRatio = 0.98;
@@ -42555,6 +41998,7 @@ class MeshLambertMaterial extends Material {
42555
41998
  this.alphaMap = source.alphaMap;
42556
41999
 
42557
42000
  this.envMap = source.envMap;
42001
+ this.envMapRotation.copy( source.envMapRotation );
42558
42002
  this.combine = source.combine;
42559
42003
  this.reflectivity = source.reflectivity;
42560
42004
  this.refractionRatio = source.refractionRatio;
@@ -44014,7 +43458,7 @@ VectorKeyframeTrack.prototype.ValueTypeName = 'vector';
44014
43458
 
44015
43459
  class AnimationClip {
44016
43460
 
44017
- constructor( name, duration = - 1, tracks, blendMode = NormalAnimationBlendMode ) {
43461
+ constructor( name = '', duration = - 1, tracks = [], blendMode = NormalAnimationBlendMode ) {
44018
43462
 
44019
43463
  this.name = name;
44020
43464
  this.tracks = tracks;
@@ -45397,10 +44841,6 @@ class DataTextureLoader extends Loader {
45397
44841
 
45398
44842
  texture.colorSpace = texData.colorSpace;
45399
44843
 
45400
- } else if ( texData.encoding !== undefined ) { // @deprecated, r152
45401
-
45402
- texture.encoding = texData.encoding;
45403
-
45404
44844
  }
45405
44845
 
45406
44846
  if ( texData.flipY !== undefined ) {
@@ -46636,6 +46076,7 @@ class MaterialLoader extends Loader {
46636
46076
  if ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );
46637
46077
 
46638
46078
  if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );
46079
+ if ( json.envMapRotation !== undefined ) material.envMapRotation.fromArray( json.envMapRotation );
46639
46080
  if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;
46640
46081
 
46641
46082
  if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;
@@ -47631,7 +47072,6 @@ class ObjectLoader extends Loader {
47631
47072
  if ( data.internalFormat !== undefined ) texture.internalFormat = data.internalFormat;
47632
47073
  if ( data.type !== undefined ) texture.type = data.type;
47633
47074
  if ( data.colorSpace !== undefined ) texture.colorSpace = data.colorSpace;
47634
- if ( data.encoding !== undefined ) texture.encoding = data.encoding; // @deprecated, r152
47635
47075
 
47636
47076
  if ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );
47637
47077
  if ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );
@@ -47770,6 +47210,10 @@ class ObjectLoader extends Loader {
47770
47210
 
47771
47211
  if ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;
47772
47212
  if ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;
47213
+ if ( data.backgroundRotation !== undefined ) object.backgroundRotation.fromArray( data.backgroundRotation );
47214
+
47215
+ if ( data.environmentIntensity !== undefined ) object.environmentIntensity = data.environmentIntensity;
47216
+ if ( data.environmentRotation !== undefined ) object.environmentRotation.fromArray( data.environmentRotation );
47773
47217
 
47774
47218
  break;
47775
47219
 
@@ -52278,6 +51722,8 @@ class GLBufferAttribute {
52278
51722
 
52279
51723
  }
52280
51724
 
51725
+ const _matrix = /*@__PURE__*/ new Matrix4();
51726
+
52281
51727
  class Raycaster {
52282
51728
 
52283
51729
  constructor( origin, direction, near = 0, far = Infinity ) {
@@ -52330,9 +51776,20 @@ class Raycaster {
52330
51776
 
52331
51777
  }
52332
51778
 
51779
+ setFromXRController( controller ) {
51780
+
51781
+ _matrix.identity().extractRotation( controller.matrixWorld );
51782
+
51783
+ this.ray.origin.setFromMatrixPosition( controller.matrixWorld );
51784
+ this.ray.direction.set( 0, 0, - 1 ).applyMatrix4( _matrix );
51785
+
51786
+ return this;
51787
+
51788
+ }
51789
+
52333
51790
  intersectObject( object, recursive = true, intersects = [] ) {
52334
51791
 
52335
- intersectObject( object, this, intersects, recursive );
51792
+ intersect( object, this, intersects, recursive );
52336
51793
 
52337
51794
  intersects.sort( ascSort );
52338
51795
 
@@ -52344,7 +51801,7 @@ class Raycaster {
52344
51801
 
52345
51802
  for ( let i = 0, l = objects.length; i < l; i ++ ) {
52346
51803
 
52347
- intersectObject( objects[ i ], this, intersects, recursive );
51804
+ intersect( objects[ i ], this, intersects, recursive );
52348
51805
 
52349
51806
  }
52350
51807
 
@@ -52362,7 +51819,7 @@ function ascSort( a, b ) {
52362
51819
 
52363
51820
  }
52364
51821
 
52365
- function intersectObject( object, raycaster, intersects, recursive ) {
51822
+ function intersect( object, raycaster, intersects, recursive ) {
52366
51823
 
52367
51824
  if ( object.layers.test( raycaster.layers ) ) {
52368
51825
 
@@ -52376,7 +51833,7 @@ function intersectObject( object, raycaster, intersects, recursive ) {
52376
51833
 
52377
51834
  for ( let i = 0, l = children.length; i < l; i ++ ) {
52378
51835
 
52379
- intersectObject( children[ i ], raycaster, intersects, true );
51836
+ intersect( children[ i ], raycaster, intersects, true );
52380
51837
 
52381
51838
  }
52382
51839
 
@@ -52387,11 +51844,9 @@ function intersectObject( object, raycaster, intersects, recursive ) {
52387
51844
  /**
52388
51845
  * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system
52389
51846
  *
52390
- * The polar angle (phi) is measured from the positive y-axis. The positive y-axis is up.
52391
- * 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.
52392
51849
  */
52393
-
52394
-
52395
51850
  class Spherical {
52396
51851
 
52397
51852
  constructor( radius = 1, phi = 0, theta = 0 ) {
@@ -52850,7 +52305,6 @@ class SpotLightHelper extends Object3D {
52850
52305
 
52851
52306
  this.light = light;
52852
52307
 
52853
- this.matrix = light.matrixWorld;
52854
52308
  this.matrixAutoUpdate = false;
52855
52309
 
52856
52310
  this.color = color;
@@ -52902,6 +52356,24 @@ class SpotLightHelper extends Object3D {
52902
52356
  this.light.updateWorldMatrix( true, false );
52903
52357
  this.light.target.updateWorldMatrix( true, false );
52904
52358
 
52359
+ // update the local matrix based on the parent and light target transforms
52360
+ if ( this.parent ) {
52361
+
52362
+ this.parent.updateWorldMatrix( true );
52363
+
52364
+ this.matrix
52365
+ .copy( this.parent.matrixWorld )
52366
+ .invert()
52367
+ .multiply( this.light.matrixWorld );
52368
+
52369
+ } else {
52370
+
52371
+ this.matrix.copy( this.light.matrixWorld );
52372
+
52373
+ }
52374
+
52375
+ this.matrixWorld.copy( this.light.matrixWorld );
52376
+
52905
52377
  const coneLength = this.light.distance ? this.light.distance : 1000;
52906
52378
  const coneWidth = coneLength * Math.tan( this.light.angle );
52907
52379
 
@@ -54342,6 +53814,26 @@ class ShapePath {
54342
53814
 
54343
53815
  }
54344
53816
 
53817
+ class WebGLMultipleRenderTargets extends WebGLRenderTarget { // @deprecated, r162
53818
+
53819
+ constructor( width = 1, height = 1, count = 1, options = {} ) {
53820
+
53821
+ console.warn( 'THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.' );
53822
+
53823
+ super( width, height, { ...options, count } );
53824
+
53825
+ this.isWebGLMultipleRenderTargets = true;
53826
+
53827
+ }
53828
+
53829
+ get texture() {
53830
+
53831
+ return this.textures;
53832
+
53833
+ }
53834
+
53835
+ }
53836
+
54345
53837
  if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
54346
53838
 
54347
53839
  __THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {
@@ -54364,4 +53856,4 @@ if ( typeof window !== 'undefined' ) {
54364
53856
 
54365
53857
  }
54366
53858
 
54367
- 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, Float64BufferAttribute, 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, LinearEncoding, 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, 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, sRGBEncoding };
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 };