super-three 0.160.1 → 0.162.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 (225) hide show
  1. package/LICENSE +1 -1
  2. package/build/three.cjs +867 -499
  3. package/build/three.module.js +867 -496
  4. package/build/three.module.min.js +1 -1
  5. package/examples/jsm/Addons.js +5 -1
  6. package/examples/jsm/capabilities/WebGPU.js +13 -9
  7. package/examples/jsm/controls/DragControls.js +91 -30
  8. package/examples/jsm/controls/OrbitControls.js +130 -15
  9. package/examples/jsm/controls/TransformControls.js +6 -6
  10. package/examples/jsm/curves/NURBSUtils.js +59 -4
  11. package/examples/jsm/curves/NURBSVolume.js +62 -0
  12. package/examples/jsm/exporters/GLTFExporter.js +11 -1
  13. package/examples/jsm/exporters/USDZExporter.js +8 -7
  14. package/examples/jsm/helpers/TextureHelper.js +3 -3
  15. package/examples/jsm/interactive/InteractiveGroup.js +15 -25
  16. package/examples/jsm/libs/rhino3dm/rhino3dm.js +1 -8723
  17. package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +1 -8734
  18. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  19. package/examples/jsm/libs/tween.module.js +32 -14
  20. package/examples/jsm/loaders/3DMLoader.js +57 -64
  21. package/examples/jsm/loaders/DDSLoader.js +1 -0
  22. package/examples/jsm/loaders/KTX2Loader.js +20 -5
  23. package/examples/jsm/loaders/LUT3dlLoader.js +78 -46
  24. package/examples/jsm/loaders/LUTCubeLoader.js +81 -67
  25. package/examples/jsm/loaders/LUTImageLoader.js +3 -2
  26. package/examples/jsm/loaders/MaterialXLoader.js +115 -16
  27. package/examples/jsm/loaders/SVGLoader.js +4 -3
  28. package/examples/jsm/loaders/VOXLoader.js +9 -2
  29. package/examples/jsm/loaders/VRMLLoader.js +7 -3
  30. package/examples/jsm/materials/MeshPostProcessingMaterial.js +144 -0
  31. package/examples/jsm/misc/ProgressiveLightMap.js +1 -0
  32. package/examples/jsm/misc/Timer.js +13 -4
  33. package/examples/jsm/nodes/Nodes.js +24 -11
  34. package/examples/jsm/nodes/accessors/AccessorsUtils.js +10 -0
  35. package/examples/jsm/nodes/accessors/BufferAttributeNode.js +5 -3
  36. package/examples/jsm/nodes/accessors/CameraNode.js +9 -4
  37. package/examples/jsm/nodes/accessors/ClippingNode.js +144 -0
  38. package/examples/jsm/nodes/accessors/CubeTextureNode.js +12 -1
  39. package/examples/jsm/nodes/accessors/MaterialNode.js +2 -2
  40. package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +2 -12
  41. package/examples/jsm/nodes/accessors/MorphNode.js +8 -8
  42. package/examples/jsm/nodes/accessors/ReferenceNode.js +87 -29
  43. package/examples/jsm/nodes/accessors/SkinningNode.js +31 -10
  44. package/examples/jsm/nodes/accessors/StorageBufferNode.js +45 -0
  45. package/examples/jsm/nodes/accessors/TangentNode.js +8 -2
  46. package/examples/jsm/nodes/accessors/TextureNode.js +1 -1
  47. package/examples/jsm/nodes/accessors/TextureStoreNode.js +56 -3
  48. package/examples/jsm/nodes/accessors/UniformsNode.js +140 -0
  49. package/examples/jsm/nodes/accessors/VertexColorNode.js +70 -0
  50. package/examples/jsm/nodes/code/CodeNode.js +6 -0
  51. package/examples/jsm/nodes/core/AssignNode.js +68 -12
  52. package/examples/jsm/nodes/core/AttributeNode.js +1 -1
  53. package/examples/jsm/nodes/core/Node.js +14 -4
  54. package/examples/jsm/nodes/core/NodeBuilder.js +26 -27
  55. package/examples/jsm/nodes/core/NodeFrame.js +18 -10
  56. package/examples/jsm/nodes/core/TempNode.js +1 -1
  57. package/examples/jsm/nodes/core/constants.js +1 -0
  58. package/examples/jsm/nodes/display/AfterImageNode.js +148 -0
  59. package/examples/jsm/nodes/display/AnamorphicNode.js +148 -0
  60. package/examples/jsm/nodes/display/BlendModeNode.js +30 -1
  61. package/examples/jsm/nodes/display/ColorAdjustmentNode.js +3 -0
  62. package/examples/jsm/nodes/display/GaussianBlurNode.js +33 -13
  63. package/examples/jsm/nodes/display/NormalMapNode.js +3 -5
  64. package/examples/jsm/nodes/display/PassNode.js +3 -2
  65. package/examples/jsm/nodes/display/ToneMappingNode.js +46 -3
  66. package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +1 -4
  67. package/examples/jsm/nodes/display/ViewportNode.js +0 -2
  68. package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +4 -4
  69. package/examples/jsm/nodes/fog/FogNode.js +2 -1
  70. package/examples/jsm/nodes/lighting/AmbientLightNode.js +1 -1
  71. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +13 -5
  72. package/examples/jsm/nodes/lighting/LightingContextNode.js +1 -1
  73. package/examples/jsm/nodes/lighting/LightsNode.js +1 -1
  74. package/examples/jsm/nodes/materials/Line2NodeMaterial.js +18 -30
  75. package/examples/jsm/nodes/materials/Materials.js +1 -0
  76. package/examples/jsm/nodes/materials/MeshSSSNodeMaterial.js +84 -0
  77. package/examples/jsm/nodes/materials/NodeMaterial.js +43 -10
  78. package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +1 -7
  79. package/examples/jsm/nodes/math/CondNode.js +42 -7
  80. package/examples/jsm/nodes/math/MathNode.js +32 -2
  81. package/examples/jsm/nodes/math/MathUtils.js +15 -0
  82. package/examples/jsm/nodes/math/OperatorNode.js +13 -5
  83. package/examples/jsm/nodes/math/TriNoise3D.js +71 -0
  84. package/examples/jsm/nodes/shadernode/ShaderNode.js +10 -1
  85. package/examples/jsm/nodes/utils/JoinNode.js +2 -2
  86. package/examples/jsm/nodes/utils/LoopNode.js +5 -3
  87. package/examples/jsm/nodes/utils/ReflectorNode.js +227 -0
  88. package/examples/jsm/nodes/utils/RotateNode.js +68 -0
  89. package/examples/jsm/nodes/utils/RotateUVNode.js +1 -9
  90. package/examples/jsm/nodes/utils/SplitNode.js +4 -4
  91. package/examples/jsm/nodes/utils/StorageArrayElementNode.js +91 -0
  92. package/examples/jsm/objects/GroundedSkybox.js +50 -0
  93. package/examples/jsm/objects/QuadMesh.js +8 -2
  94. package/examples/jsm/objects/Water2.js +8 -8
  95. package/examples/jsm/postprocessing/GTAOPass.js +11 -1
  96. package/examples/jsm/postprocessing/OutputPass.js +2 -0
  97. package/examples/jsm/renderers/common/Backend.js +14 -0
  98. package/examples/jsm/renderers/common/Background.js +2 -2
  99. package/examples/jsm/renderers/common/Bindings.js +1 -1
  100. package/examples/jsm/renderers/common/ClippingContext.js +165 -0
  101. package/examples/jsm/renderers/common/DataMap.js +1 -1
  102. package/examples/jsm/renderers/common/Info.js +25 -1
  103. package/examples/jsm/renderers/common/Pipelines.js +8 -8
  104. package/examples/jsm/renderers/common/PostProcessing.js +2 -2
  105. package/examples/jsm/renderers/common/ProgrammableStage.js +3 -1
  106. package/examples/jsm/renderers/common/RenderContext.js +2 -0
  107. package/examples/jsm/renderers/common/RenderContexts.js +2 -13
  108. package/examples/jsm/renderers/common/RenderObject.js +46 -1
  109. package/examples/jsm/renderers/common/RenderObjects.js +3 -1
  110. package/examples/jsm/renderers/common/Renderer.js +290 -17
  111. package/examples/jsm/renderers/common/StorageBufferAttribute.js +17 -0
  112. package/examples/jsm/renderers/common/StorageInstancedBufferAttribute.js +17 -0
  113. package/examples/jsm/renderers/common/Textures.js +28 -18
  114. package/examples/jsm/renderers/common/UniformsGroup.js +6 -4
  115. package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +2 -1
  116. package/examples/jsm/renderers/common/nodes/NodeStorageBuffer.js +23 -0
  117. package/examples/jsm/renderers/common/nodes/NodeUniformBuffer.js +23 -0
  118. package/examples/jsm/renderers/common/nodes/Nodes.js +5 -2
  119. package/examples/jsm/renderers/webgl/WebGLBackend.js +653 -272
  120. package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +171 -39
  121. package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +95 -8
  122. package/examples/jsm/renderers/webgl/utils/WebGLConstants.js +11 -0
  123. package/examples/jsm/renderers/webgl/utils/WebGLState.js +197 -0
  124. package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +424 -11
  125. package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +3 -2
  126. package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +1 -21
  127. package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +2 -2
  128. package/examples/jsm/renderers/webgpu/WebGPUBackend.js +300 -112
  129. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +7 -2
  130. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +71 -79
  131. package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -1
  132. package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +38 -4
  133. package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +87 -14
  134. package/examples/jsm/shaders/OutputShader.js +4 -0
  135. package/examples/jsm/transpiler/AST.js +1 -1
  136. package/examples/jsm/transpiler/GLSLDecoder.js +1 -1
  137. package/examples/jsm/transpiler/ShaderToyDecoder.js +1 -1
  138. package/examples/jsm/transpiler/TSLEncoder.js +1 -1
  139. package/examples/jsm/utils/BufferGeometryUtils.js +23 -27
  140. package/examples/jsm/utils/SkeletonUtils.js +14 -3
  141. package/examples/jsm/utils/SortUtils.js +2 -0
  142. package/examples/jsm/webxr/ARButton.js +12 -2
  143. package/examples/jsm/webxr/VRButton.js +25 -7
  144. package/examples/jsm/webxr/XRButton.js +12 -3
  145. package/examples/jsm/webxr/XRControllerModelFactory.js +14 -1
  146. package/examples/jsm/webxr/XRHandMeshModel.js +3 -1
  147. package/package.json +5 -4
  148. package/src/Three.Legacy.js +20 -0
  149. package/src/Three.js +0 -1
  150. package/src/audio/Audio.js +1 -3
  151. package/src/cameras/PerspectiveCamera.js +35 -0
  152. package/src/constants.js +2 -6
  153. package/src/core/BufferAttribute.js +2 -12
  154. package/src/core/BufferGeometry.js +23 -29
  155. package/src/core/InterleavedBuffer.js +2 -1
  156. package/src/core/InterleavedBufferAttribute.js +20 -0
  157. package/src/core/Object3D.js +11 -0
  158. package/src/core/Raycaster.js +18 -4
  159. package/src/core/RenderTarget.js +44 -21
  160. package/src/extras/PMREMGenerator.js +2 -0
  161. package/src/extras/curves/EllipseCurve.js +2 -2
  162. package/src/helpers/SpotLightHelper.js +18 -1
  163. package/src/loaders/DataTextureLoader.js +0 -4
  164. package/src/loaders/MaterialLoader.js +1 -0
  165. package/src/loaders/ObjectLoader.js +2 -1
  166. package/src/materials/Material.js +2 -1
  167. package/src/materials/MeshBasicMaterial.js +3 -0
  168. package/src/materials/MeshLambertMaterial.js +3 -0
  169. package/src/materials/MeshPhongMaterial.js +3 -0
  170. package/src/materials/MeshStandardMaterial.js +3 -0
  171. package/src/materials/ShaderMaterial.js +2 -1
  172. package/src/math/Quaternion.js +13 -12
  173. package/src/math/Triangle.js +0 -30
  174. package/src/math/Vector3.js +7 -7
  175. package/src/objects/BatchedMesh.js +6 -7
  176. package/src/objects/InstancedMesh.js +53 -0
  177. package/src/objects/Mesh.js +0 -1
  178. package/src/objects/SkinnedMesh.js +0 -8
  179. package/src/renderers/WebGLCubeRenderTarget.js +1 -10
  180. package/src/renderers/WebGLRenderer.js +20 -23
  181. package/src/renderers/shaders/ShaderChunk/alphatest_fragment.glsl.js +9 -0
  182. package/src/renderers/shaders/ShaderChunk/clipping_planes_fragment.glsl.js +56 -11
  183. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +1 -0
  184. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
  185. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +2 -2
  186. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +1 -1
  187. package/src/renderers/shaders/ShaderChunk/morphinstance_vertex.glsl.js +14 -0
  188. package/src/renderers/shaders/ShaderChunk/morphtarget_pars_vertex.glsl.js +11 -2
  189. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +38 -7
  190. package/src/renderers/shaders/ShaderChunk.js +2 -0
  191. package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +3 -2
  192. package/src/renderers/shaders/ShaderLib/depth.glsl.js +3 -2
  193. package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +3 -2
  194. package/src/renderers/shaders/ShaderLib/linedashed.glsl.js +2 -1
  195. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +2 -2
  196. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -1
  197. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +2 -2
  198. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +4 -1
  199. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -1
  200. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +2 -1
  201. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +2 -1
  202. package/src/renderers/shaders/ShaderLib/points.glsl.js +2 -1
  203. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +1 -0
  204. package/src/renderers/shaders/ShaderLib/sprite.glsl.js +1 -1
  205. package/src/renderers/shaders/ShaderLib.js +2 -1
  206. package/src/renderers/shaders/UniformsLib.js +1 -0
  207. package/src/renderers/webgl/WebGLAttributes.js +2 -2
  208. package/src/renderers/webgl/WebGLBackground.js +18 -0
  209. package/src/renderers/webgl/WebGLCubeMaps.js +1 -1
  210. package/src/renderers/webgl/WebGLMaterials.js +24 -1
  211. package/src/renderers/webgl/WebGLMorphtargets.js +15 -8
  212. package/src/renderers/webgl/WebGLProgram.js +42 -4
  213. package/src/renderers/webgl/WebGLPrograms.js +38 -27
  214. package/src/renderers/webgl/WebGLState.js +11 -21
  215. package/src/renderers/webgl/WebGLTextures.js +170 -66
  216. package/src/renderers/webxr/WebXRDepthSensing.js +105 -0
  217. package/src/renderers/webxr/WebXRManager.js +46 -0
  218. package/src/scenes/Scene.js +8 -0
  219. package/src/textures/Source.js +1 -0
  220. package/src/textures/Texture.js +1 -29
  221. package/build/three.js +0 -54519
  222. package/build/three.min.js +0 -7
  223. package/examples/jsm/nodes/core/ArrayUniformNode.js +0 -26
  224. package/examples/jsm/objects/GroundProjectedSkybox.js +0 -172
  225. package/src/renderers/WebGLMultipleRenderTargets.js +0 -82
package/build/three.cjs CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
  'use strict';
7
7
 
8
- const REVISION = '160';
8
+ const REVISION = '162';
9
9
 
10
10
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
11
11
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
@@ -20,7 +20,6 @@ const VSMShadowMap = 3;
20
20
  const FrontSide = 0;
21
21
  const BackSide = 1;
22
22
  const DoubleSide = 2;
23
- const TwoPassDoubleSide = 2; // r149
24
23
  const NoBlending = 0;
25
24
  const NormalBlending = 1;
26
25
  const AdditiveBlending = 2;
@@ -65,6 +64,7 @@ const CineonToneMapping = 3;
65
64
  const ACESFilmicToneMapping = 4;
66
65
  const CustomToneMapping = 5;
67
66
  const AgXToneMapping = 6;
67
+ const NeutralToneMapping = 7;
68
68
  const AttachedBindMode = 'attached';
69
69
  const DetachedBindMode = 'detached';
70
70
 
@@ -156,10 +156,6 @@ const AdditiveAnimationBlendMode = 2501;
156
156
  const TrianglesDrawMode = 0;
157
157
  const TriangleStripDrawMode = 1;
158
158
  const TriangleFanDrawMode = 2;
159
- /** @deprecated Use LinearSRGBColorSpace or NoColorSpace in three.js r152+. */
160
- const LinearEncoding = 3000;
161
- /** @deprecated Use SRGBColorSpace in three.js r152+. */
162
- const sRGBEncoding = 3001;
163
159
  const BasicDepthPacking = 3200;
164
160
  const RGBADepthPacking = 3201;
165
161
  const TangentSpaceNormalMap = 0;
@@ -1841,6 +1837,7 @@ class Source {
1841
1837
  this.uuid = generateUUID();
1842
1838
 
1843
1839
  this.data = data;
1840
+ this.dataReady = true;
1844
1841
 
1845
1842
  this.version = 0;
1846
1843
 
@@ -1998,17 +1995,7 @@ class Texture extends EventDispatcher {
1998
1995
  this.flipY = true;
1999
1996
  this.unpackAlignment = 4; // valid values: 1, 2, 4, 8 (see http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml)
2000
1997
 
2001
- if ( typeof colorSpace === 'string' ) {
2002
-
2003
- this.colorSpace = colorSpace;
2004
-
2005
- } else { // @deprecated, r152
2006
-
2007
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2008
- this.colorSpace = colorSpace === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
2009
-
2010
- }
2011
-
1998
+ this.colorSpace = colorSpace;
2012
1999
 
2013
2000
  this.userData = {};
2014
2001
 
@@ -2247,20 +2234,6 @@ class Texture extends EventDispatcher {
2247
2234
 
2248
2235
  }
2249
2236
 
2250
- get encoding() { // @deprecated, r152
2251
-
2252
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2253
- return this.colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
2254
-
2255
- }
2256
-
2257
- set encoding( encoding ) { // @deprecated, r152
2258
-
2259
- warnOnce( 'THREE.Texture: Property .encoding has been replaced by .colorSpace.' );
2260
- this.colorSpace = encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
2261
-
2262
- }
2263
-
2264
2237
  }
2265
2238
 
2266
2239
  Texture.DEFAULT_IMAGE = null;
@@ -2934,14 +2907,6 @@ class RenderTarget extends EventDispatcher {
2934
2907
 
2935
2908
  const image = { width: width, height: height, depth: 1 };
2936
2909
 
2937
- if ( options.encoding !== undefined ) {
2938
-
2939
- // @deprecated, r152
2940
- warnOnce( 'THREE.WebGLRenderTarget: option.encoding has been replaced by option.colorSpace.' );
2941
- options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
2942
-
2943
- }
2944
-
2945
2910
  options = Object.assign( {
2946
2911
  generateMipmaps: false,
2947
2912
  internalFormat: null,
@@ -2949,15 +2914,25 @@ class RenderTarget extends EventDispatcher {
2949
2914
  depthBuffer: true,
2950
2915
  stencilBuffer: false,
2951
2916
  depthTexture: null,
2952
- samples: 0
2917
+ samples: 0,
2918
+ count: 1
2953
2919
  }, options );
2954
2920
 
2955
- this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
2956
- this.texture.isRenderTargetTexture = true;
2921
+ const texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
2922
+
2923
+ texture.flipY = false;
2924
+ texture.generateMipmaps = options.generateMipmaps;
2925
+ texture.internalFormat = options.internalFormat;
2926
+
2927
+ this.textures = [];
2957
2928
 
2958
- this.texture.flipY = false;
2959
- this.texture.generateMipmaps = options.generateMipmaps;
2960
- this.texture.internalFormat = options.internalFormat;
2929
+ const count = options.count;
2930
+ for ( let i = 0; i < count; i ++ ) {
2931
+
2932
+ this.textures[ i ] = texture.clone();
2933
+ this.textures[ i ].isRenderTargetTexture = true;
2934
+
2935
+ }
2961
2936
 
2962
2937
  this.depthBuffer = options.depthBuffer;
2963
2938
  this.stencilBuffer = options.stencilBuffer;
@@ -2968,6 +2943,18 @@ class RenderTarget extends EventDispatcher {
2968
2943
 
2969
2944
  }
2970
2945
 
2946
+ get texture() {
2947
+
2948
+ return this.textures[ 0 ];
2949
+
2950
+ }
2951
+
2952
+ set texture( value ) {
2953
+
2954
+ this.textures[ 0 ] = value;
2955
+
2956
+ }
2957
+
2971
2958
  setSize( width, height, depth = 1 ) {
2972
2959
 
2973
2960
  if ( this.width !== width || this.height !== height || this.depth !== depth ) {
@@ -2976,9 +2963,13 @@ class RenderTarget extends EventDispatcher {
2976
2963
  this.height = height;
2977
2964
  this.depth = depth;
2978
2965
 
2979
- this.texture.image.width = width;
2980
- this.texture.image.height = height;
2981
- this.texture.image.depth = depth;
2966
+ for ( let i = 0, il = this.textures.length; i < il; i ++ ) {
2967
+
2968
+ this.textures[ i ].image.width = width;
2969
+ this.textures[ i ].image.height = height;
2970
+ this.textures[ i ].image.depth = depth;
2971
+
2972
+ }
2982
2973
 
2983
2974
  this.dispose();
2984
2975
 
@@ -3006,8 +2997,14 @@ class RenderTarget extends EventDispatcher {
3006
2997
 
3007
2998
  this.viewport.copy( source.viewport );
3008
2999
 
3009
- this.texture = source.texture.clone();
3010
- this.texture.isRenderTargetTexture = true;
3000
+ this.textures.length = 0;
3001
+
3002
+ for ( let i = 0, il = source.textures.length; i < il; i ++ ) {
3003
+
3004
+ this.textures[ i ] = source.textures[ i ].clone();
3005
+ this.textures[ i ].isRenderTargetTexture = true;
3006
+
3007
+ }
3011
3008
 
3012
3009
  // ensure image object is not shared, see #20328
3013
3010
 
@@ -3135,85 +3132,6 @@ class WebGL3DRenderTarget extends WebGLRenderTarget {
3135
3132
 
3136
3133
  }
3137
3134
 
3138
- class WebGLMultipleRenderTargets extends WebGLRenderTarget {
3139
-
3140
- constructor( width = 1, height = 1, count = 1, options = {} ) {
3141
-
3142
- super( width, height, options );
3143
-
3144
- this.isWebGLMultipleRenderTargets = true;
3145
-
3146
- const texture = this.texture;
3147
-
3148
- this.texture = [];
3149
-
3150
- for ( let i = 0; i < count; i ++ ) {
3151
-
3152
- this.texture[ i ] = texture.clone();
3153
- this.texture[ i ].isRenderTargetTexture = true;
3154
-
3155
- }
3156
-
3157
- }
3158
-
3159
- setSize( width, height, depth = 1 ) {
3160
-
3161
- if ( this.width !== width || this.height !== height || this.depth !== depth ) {
3162
-
3163
- this.width = width;
3164
- this.height = height;
3165
- this.depth = depth;
3166
-
3167
- for ( let i = 0, il = this.texture.length; i < il; i ++ ) {
3168
-
3169
- this.texture[ i ].image.width = width;
3170
- this.texture[ i ].image.height = height;
3171
- this.texture[ i ].image.depth = depth;
3172
-
3173
- }
3174
-
3175
- this.dispose();
3176
-
3177
- }
3178
-
3179
- this.viewport.set( 0, 0, width, height );
3180
- this.scissor.set( 0, 0, width, height );
3181
-
3182
- }
3183
-
3184
- copy( source ) {
3185
-
3186
- this.dispose();
3187
-
3188
- this.width = source.width;
3189
- this.height = source.height;
3190
- this.depth = source.depth;
3191
-
3192
- this.scissor.copy( source.scissor );
3193
- this.scissorTest = source.scissorTest;
3194
-
3195
- this.viewport.copy( source.viewport );
3196
-
3197
- this.depthBuffer = source.depthBuffer;
3198
- this.stencilBuffer = source.stencilBuffer;
3199
-
3200
- if ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();
3201
-
3202
- this.texture.length = 0;
3203
-
3204
- for ( let i = 0, il = source.texture.length; i < il; i ++ ) {
3205
-
3206
- this.texture[ i ] = source.texture[ i ].clone();
3207
- this.texture[ i ].isRenderTargetTexture = true;
3208
-
3209
- }
3210
-
3211
- return this;
3212
-
3213
- }
3214
-
3215
- }
3216
-
3217
3135
  class Quaternion {
3218
3136
 
3219
3137
  constructor( x = 0, y = 0, z = 0, w = 1 ) {
@@ -3805,23 +3723,24 @@ class Quaternion {
3805
3723
 
3806
3724
  random() {
3807
3725
 
3808
- // Derived from http://planning.cs.uiuc.edu/node198.html
3809
- // Note, this source uses w, x, y, z ordering,
3810
- // so we swap the order below.
3726
+ // sets this quaternion to a uniform random unit quaternnion
3811
3727
 
3812
- const u1 = Math.random();
3813
- const sqrt1u1 = Math.sqrt( 1 - u1 );
3814
- const sqrtu1 = Math.sqrt( u1 );
3728
+ // Ken Shoemake
3729
+ // Uniform random rotations
3730
+ // D. Kirk, editor, Graphics Gems III, pages 124-132. Academic Press, New York, 1992.
3815
3731
 
3816
- const u2 = 2 * Math.PI * Math.random();
3732
+ const theta1 = 2 * Math.PI * Math.random();
3733
+ const theta2 = 2 * Math.PI * Math.random();
3817
3734
 
3818
- const u3 = 2 * Math.PI * Math.random();
3735
+ const x0 = Math.random();
3736
+ const r1 = Math.sqrt( 1 - x0 );
3737
+ const r2 = Math.sqrt( x0 );
3819
3738
 
3820
3739
  return this.set(
3821
- sqrt1u1 * Math.cos( u2 ),
3822
- sqrtu1 * Math.sin( u3 ),
3823
- sqrtu1 * Math.cos( u3 ),
3824
- sqrt1u1 * Math.sin( u2 ),
3740
+ r1 * Math.sin( theta1 ),
3741
+ r1 * Math.cos( theta1 ),
3742
+ r2 * Math.sin( theta2 ),
3743
+ r2 * Math.cos( theta2 ),
3825
3744
  );
3826
3745
 
3827
3746
  }
@@ -4589,15 +4508,15 @@ class Vector3 {
4589
4508
 
4590
4509
  randomDirection() {
4591
4510
 
4592
- // Derived from https://mathworld.wolfram.com/SpherePointPicking.html
4511
+ // https://mathworld.wolfram.com/SpherePointPicking.html
4593
4512
 
4594
- const u = ( Math.random() - 0.5 ) * 2;
4595
- const t = Math.random() * Math.PI * 2;
4596
- const f = Math.sqrt( 1 - u ** 2 );
4513
+ const theta = Math.random() * Math.PI * 2;
4514
+ const u = Math.random() * 2 - 1;
4515
+ const c = Math.sqrt( 1 - u * u );
4597
4516
 
4598
- this.x = f * Math.cos( t );
4599
- this.y = f * Math.sin( t );
4600
- this.z = u;
4517
+ this.x = c * Math.cos( theta );
4518
+ this.y = u;
4519
+ this.z = c * Math.sin( theta );
4601
4520
 
4602
4521
  return this;
4603
4522
 
@@ -6623,25 +6542,25 @@ class Matrix4 {
6623
6542
  position.z = te[ 14 ];
6624
6543
 
6625
6544
  // scale the rotation part
6626
- _m1$2.copy( this );
6545
+ _m1$4.copy( this );
6627
6546
 
6628
6547
  const invSX = 1 / sx;
6629
6548
  const invSY = 1 / sy;
6630
6549
  const invSZ = 1 / sz;
6631
6550
 
6632
- _m1$2.elements[ 0 ] *= invSX;
6633
- _m1$2.elements[ 1 ] *= invSX;
6634
- _m1$2.elements[ 2 ] *= invSX;
6551
+ _m1$4.elements[ 0 ] *= invSX;
6552
+ _m1$4.elements[ 1 ] *= invSX;
6553
+ _m1$4.elements[ 2 ] *= invSX;
6635
6554
 
6636
- _m1$2.elements[ 4 ] *= invSY;
6637
- _m1$2.elements[ 5 ] *= invSY;
6638
- _m1$2.elements[ 6 ] *= invSY;
6555
+ _m1$4.elements[ 4 ] *= invSY;
6556
+ _m1$4.elements[ 5 ] *= invSY;
6557
+ _m1$4.elements[ 6 ] *= invSY;
6639
6558
 
6640
- _m1$2.elements[ 8 ] *= invSZ;
6641
- _m1$2.elements[ 9 ] *= invSZ;
6642
- _m1$2.elements[ 10 ] *= invSZ;
6559
+ _m1$4.elements[ 8 ] *= invSZ;
6560
+ _m1$4.elements[ 9 ] *= invSZ;
6561
+ _m1$4.elements[ 10 ] *= invSZ;
6643
6562
 
6644
- quaternion.setFromRotationMatrix( _m1$2 );
6563
+ quaternion.setFromRotationMatrix( _m1$4 );
6645
6564
 
6646
6565
  scale.x = sx;
6647
6566
  scale.y = sy;
@@ -6782,14 +6701,14 @@ class Matrix4 {
6782
6701
  }
6783
6702
 
6784
6703
  const _v1$5 = /*@__PURE__*/ new Vector3();
6785
- const _m1$2 = /*@__PURE__*/ new Matrix4();
6704
+ const _m1$4 = /*@__PURE__*/ new Matrix4();
6786
6705
  const _zero = /*@__PURE__*/ new Vector3( 0, 0, 0 );
6787
6706
  const _one = /*@__PURE__*/ new Vector3( 1, 1, 1 );
6788
6707
  const _x = /*@__PURE__*/ new Vector3();
6789
6708
  const _y = /*@__PURE__*/ new Vector3();
6790
6709
  const _z = /*@__PURE__*/ new Vector3();
6791
6710
 
6792
- const _matrix$1 = /*@__PURE__*/ new Matrix4();
6711
+ const _matrix$2 = /*@__PURE__*/ new Matrix4();
6793
6712
  const _quaternion$3 = /*@__PURE__*/ new Quaternion();
6794
6713
 
6795
6714
  class Euler {
@@ -7024,9 +6943,9 @@ class Euler {
7024
6943
 
7025
6944
  setFromQuaternion( q, order, update ) {
7026
6945
 
7027
- _matrix$1.makeRotationFromQuaternion( q );
6946
+ _matrix$2.makeRotationFromQuaternion( q );
7028
6947
 
7029
- return this.setFromRotationMatrix( _matrix$1, order, update );
6948
+ return this.setFromRotationMatrix( _matrix$2, order, update );
7030
6949
 
7031
6950
  }
7032
6951
 
@@ -7161,7 +7080,7 @@ let _object3DId = 0;
7161
7080
 
7162
7081
  const _v1$4 = /*@__PURE__*/ new Vector3();
7163
7082
  const _q1 = /*@__PURE__*/ new Quaternion();
7164
- const _m1$1 = /*@__PURE__*/ new Matrix4();
7083
+ const _m1$3 = /*@__PURE__*/ new Matrix4();
7165
7084
  const _target = /*@__PURE__*/ new Vector3();
7166
7085
 
7167
7086
  const _position$3 = /*@__PURE__*/ new Vector3();
@@ -7175,6 +7094,9 @@ const _zAxis = /*@__PURE__*/ new Vector3( 0, 0, 1 );
7175
7094
  const _addedEvent = { type: 'added' };
7176
7095
  const _removedEvent = { type: 'removed' };
7177
7096
 
7097
+ const _childaddedEvent = { type: 'childadded', child: null };
7098
+ const _childremovedEvent = { type: 'childremoved', child: null };
7099
+
7178
7100
  class Object3D extends EventDispatcher {
7179
7101
 
7180
7102
  constructor() {
@@ -7411,7 +7333,7 @@ class Object3D extends EventDispatcher {
7411
7333
 
7412
7334
  this.updateWorldMatrix( true, false );
7413
7335
 
7414
- return vector.applyMatrix4( _m1$1.copy( this.matrixWorld ).invert() );
7336
+ return vector.applyMatrix4( _m1$3.copy( this.matrixWorld ).invert() );
7415
7337
 
7416
7338
  }
7417
7339
 
@@ -7437,20 +7359,20 @@ class Object3D extends EventDispatcher {
7437
7359
 
7438
7360
  if ( this.isCamera || this.isLight ) {
7439
7361
 
7440
- _m1$1.lookAt( _position$3, _target, this.up );
7362
+ _m1$3.lookAt( _position$3, _target, this.up );
7441
7363
 
7442
7364
  } else {
7443
7365
 
7444
- _m1$1.lookAt( _target, _position$3, this.up );
7366
+ _m1$3.lookAt( _target, _position$3, this.up );
7445
7367
 
7446
7368
  }
7447
7369
 
7448
- this.quaternion.setFromRotationMatrix( _m1$1 );
7370
+ this.quaternion.setFromRotationMatrix( _m1$3 );
7449
7371
 
7450
7372
  if ( parent ) {
7451
7373
 
7452
- _m1$1.extractRotation( parent.matrixWorld );
7453
- _q1.setFromRotationMatrix( _m1$1 );
7374
+ _m1$3.extractRotation( parent.matrixWorld );
7375
+ _q1.setFromRotationMatrix( _m1$3 );
7454
7376
  this.quaternion.premultiply( _q1.invert() );
7455
7377
 
7456
7378
  }
@@ -7491,6 +7413,10 @@ class Object3D extends EventDispatcher {
7491
7413
 
7492
7414
  object.dispatchEvent( _addedEvent );
7493
7415
 
7416
+ _childaddedEvent.child = object;
7417
+ this.dispatchEvent( _childaddedEvent );
7418
+ _childaddedEvent.child = null;
7419
+
7494
7420
  } else {
7495
7421
 
7496
7422
  console.error( 'THREE.Object3D.add: object not an instance of THREE.Object3D.', object );
@@ -7524,6 +7450,10 @@ class Object3D extends EventDispatcher {
7524
7450
 
7525
7451
  object.dispatchEvent( _removedEvent );
7526
7452
 
7453
+ _childremovedEvent.child = object;
7454
+ this.dispatchEvent( _childremovedEvent );
7455
+ _childremovedEvent.child = null;
7456
+
7527
7457
  }
7528
7458
 
7529
7459
  return this;
@@ -7558,17 +7488,17 @@ class Object3D extends EventDispatcher {
7558
7488
 
7559
7489
  this.updateWorldMatrix( true, false );
7560
7490
 
7561
- _m1$1.copy( this.matrixWorld ).invert();
7491
+ _m1$3.copy( this.matrixWorld ).invert();
7562
7492
 
7563
7493
  if ( object.parent !== null ) {
7564
7494
 
7565
7495
  object.parent.updateWorldMatrix( true, false );
7566
7496
 
7567
- _m1$1.multiply( object.parent.matrixWorld );
7497
+ _m1$3.multiply( object.parent.matrixWorld );
7568
7498
 
7569
7499
  }
7570
7500
 
7571
- object.applyMatrix4( _m1$1 );
7501
+ object.applyMatrix4( _m1$3 );
7572
7502
 
7573
7503
  this.add( object );
7574
7504
 
@@ -8158,7 +8088,7 @@ Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true;
8158
8088
  const _v0$1 = /*@__PURE__*/ new Vector3();
8159
8089
  const _v1$3 = /*@__PURE__*/ new Vector3();
8160
8090
  const _v2$2 = /*@__PURE__*/ new Vector3();
8161
- const _v3$1 = /*@__PURE__*/ new Vector3();
8091
+ const _v3$2 = /*@__PURE__*/ new Vector3();
8162
8092
 
8163
8093
  const _vab = /*@__PURE__*/ new Vector3();
8164
8094
  const _vac = /*@__PURE__*/ new Vector3();
@@ -8167,8 +8097,6 @@ const _vap = /*@__PURE__*/ new Vector3();
8167
8097
  const _vbp = /*@__PURE__*/ new Vector3();
8168
8098
  const _vcp = /*@__PURE__*/ new Vector3();
8169
8099
 
8170
- let warnedGetUV = false;
8171
-
8172
8100
  class Triangle {
8173
8101
 
8174
8102
  constructor( a = new Vector3(), b = new Vector3(), c = new Vector3() ) {
@@ -8232,33 +8160,19 @@ class Triangle {
8232
8160
  static containsPoint( point, a, b, c ) {
8233
8161
 
8234
8162
  // if the triangle is degenerate then we can't contain a point
8235
- if ( this.getBarycoord( point, a, b, c, _v3$1 ) === null ) {
8163
+ if ( this.getBarycoord( point, a, b, c, _v3$2 ) === null ) {
8236
8164
 
8237
8165
  return false;
8238
8166
 
8239
8167
  }
8240
8168
 
8241
- return ( _v3$1.x >= 0 ) && ( _v3$1.y >= 0 ) && ( ( _v3$1.x + _v3$1.y ) <= 1 );
8242
-
8243
- }
8244
-
8245
- static getUV( point, p1, p2, p3, uv1, uv2, uv3, target ) { // @deprecated, r151
8246
-
8247
- if ( warnedGetUV === false ) {
8248
-
8249
- console.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );
8250
-
8251
- warnedGetUV = true;
8252
-
8253
- }
8254
-
8255
- return this.getInterpolation( point, p1, p2, p3, uv1, uv2, uv3, target );
8169
+ return ( _v3$2.x >= 0 ) && ( _v3$2.y >= 0 ) && ( ( _v3$2.x + _v3$2.y ) <= 1 );
8256
8170
 
8257
8171
  }
8258
8172
 
8259
8173
  static getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {
8260
8174
 
8261
- if ( this.getBarycoord( point, p1, p2, p3, _v3$1 ) === null ) {
8175
+ if ( this.getBarycoord( point, p1, p2, p3, _v3$2 ) === null ) {
8262
8176
 
8263
8177
  target.x = 0;
8264
8178
  target.y = 0;
@@ -8269,9 +8183,9 @@ class Triangle {
8269
8183
  }
8270
8184
 
8271
8185
  target.setScalar( 0 );
8272
- target.addScaledVector( v1, _v3$1.x );
8273
- target.addScaledVector( v2, _v3$1.y );
8274
- target.addScaledVector( v3, _v3$1.z );
8186
+ target.addScaledVector( v1, _v3$2.x );
8187
+ target.addScaledVector( v2, _v3$2.y );
8188
+ target.addScaledVector( v3, _v3$2.z );
8275
8189
 
8276
8190
  return target;
8277
8191
 
@@ -8366,20 +8280,6 @@ class Triangle {
8366
8280
 
8367
8281
  }
8368
8282
 
8369
- getUV( point, uv1, uv2, uv3, target ) { // @deprecated, r151
8370
-
8371
- if ( warnedGetUV === false ) {
8372
-
8373
- console.warn( 'THREE.Triangle.getUV() has been renamed to THREE.Triangle.getInterpolation().' );
8374
-
8375
- warnedGetUV = true;
8376
-
8377
- }
8378
-
8379
- return Triangle.getInterpolation( point, this.a, this.b, this.c, uv1, uv2, uv3, target );
8380
-
8381
- }
8382
-
8383
8283
  getInterpolation( point, v1, v2, v3, target ) {
8384
8284
 
8385
8285
  return Triangle.getInterpolation( point, this.a, this.b, this.c, v1, v2, v3, target );
@@ -9298,7 +9198,7 @@ class Material extends EventDispatcher {
9298
9198
  if ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();
9299
9199
  if ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;
9300
9200
  if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();
9301
- if ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
9201
+ if ( this.emissiveIntensity !== undefined && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
9302
9202
 
9303
9203
  if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();
9304
9204
  if ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;
@@ -9408,6 +9308,7 @@ class Material extends EventDispatcher {
9408
9308
 
9409
9309
  }
9410
9310
 
9311
+ if ( this.envMapRotation !== undefined ) data.envMapRotation = this.envMapRotation.toArray();
9411
9312
  if ( this.envMapIntensity !== undefined ) data.envMapIntensity = this.envMapIntensity;
9412
9313
  if ( this.reflectivity !== undefined ) data.reflectivity = this.reflectivity;
9413
9314
  if ( this.refractionRatio !== undefined ) data.refractionRatio = this.refractionRatio;
@@ -9652,6 +9553,7 @@ class MeshBasicMaterial extends Material {
9652
9553
  this.alphaMap = null;
9653
9554
 
9654
9555
  this.envMap = null;
9556
+ this.envMapRotation = new Euler();
9655
9557
  this.combine = MultiplyOperation;
9656
9558
  this.reflectivity = 1;
9657
9559
  this.refractionRatio = 0.98;
@@ -9686,6 +9588,7 @@ class MeshBasicMaterial extends Material {
9686
9588
  this.alphaMap = source.alphaMap;
9687
9589
 
9688
9590
  this.envMap = source.envMap;
9591
+ this.envMapRotation.copy( source.envMapRotation );
9689
9592
  this.combine = source.combine;
9690
9593
  this.reflectivity = source.reflectivity;
9691
9594
  this.refractionRatio = source.refractionRatio;
@@ -9913,7 +9816,7 @@ class BufferAttribute {
9913
9816
 
9914
9817
  get updateRange() {
9915
9818
 
9916
- console.warn( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
9819
+ warnOnce( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
9917
9820
  return this._updateRange;
9918
9821
 
9919
9822
  }
@@ -10490,19 +10393,9 @@ class Float32BufferAttribute extends BufferAttribute {
10490
10393
 
10491
10394
  }
10492
10395
 
10493
- class Float64BufferAttribute extends BufferAttribute {
10494
-
10495
- constructor( array, itemSize, normalized ) {
10496
-
10497
- super( new Float64Array( array ), itemSize, normalized );
10498
-
10499
- }
10500
-
10501
- }
10502
-
10503
10396
  let _id$2 = 0;
10504
10397
 
10505
- const _m1 = /*@__PURE__*/ new Matrix4();
10398
+ const _m1$2 = /*@__PURE__*/ new Matrix4();
10506
10399
  const _obj = /*@__PURE__*/ new Object3D();
10507
10400
  const _offset = /*@__PURE__*/ new Vector3();
10508
10401
  const _box$2 = /*@__PURE__*/ new Box3();
@@ -10668,9 +10561,9 @@ class BufferGeometry extends EventDispatcher {
10668
10561
 
10669
10562
  applyQuaternion( q ) {
10670
10563
 
10671
- _m1.makeRotationFromQuaternion( q );
10564
+ _m1$2.makeRotationFromQuaternion( q );
10672
10565
 
10673
- this.applyMatrix4( _m1 );
10566
+ this.applyMatrix4( _m1$2 );
10674
10567
 
10675
10568
  return this;
10676
10569
 
@@ -10680,9 +10573,9 @@ class BufferGeometry extends EventDispatcher {
10680
10573
 
10681
10574
  // rotate geometry around world x-axis
10682
10575
 
10683
- _m1.makeRotationX( angle );
10576
+ _m1$2.makeRotationX( angle );
10684
10577
 
10685
- this.applyMatrix4( _m1 );
10578
+ this.applyMatrix4( _m1$2 );
10686
10579
 
10687
10580
  return this;
10688
10581
 
@@ -10692,9 +10585,9 @@ class BufferGeometry extends EventDispatcher {
10692
10585
 
10693
10586
  // rotate geometry around world y-axis
10694
10587
 
10695
- _m1.makeRotationY( angle );
10588
+ _m1$2.makeRotationY( angle );
10696
10589
 
10697
- this.applyMatrix4( _m1 );
10590
+ this.applyMatrix4( _m1$2 );
10698
10591
 
10699
10592
  return this;
10700
10593
 
@@ -10704,9 +10597,9 @@ class BufferGeometry extends EventDispatcher {
10704
10597
 
10705
10598
  // rotate geometry around world z-axis
10706
10599
 
10707
- _m1.makeRotationZ( angle );
10600
+ _m1$2.makeRotationZ( angle );
10708
10601
 
10709
- this.applyMatrix4( _m1 );
10602
+ this.applyMatrix4( _m1$2 );
10710
10603
 
10711
10604
  return this;
10712
10605
 
@@ -10716,9 +10609,9 @@ class BufferGeometry extends EventDispatcher {
10716
10609
 
10717
10610
  // translate geometry
10718
10611
 
10719
- _m1.makeTranslation( x, y, z );
10612
+ _m1$2.makeTranslation( x, y, z );
10720
10613
 
10721
- this.applyMatrix4( _m1 );
10614
+ this.applyMatrix4( _m1$2 );
10722
10615
 
10723
10616
  return this;
10724
10617
 
@@ -10728,9 +10621,9 @@ class BufferGeometry extends EventDispatcher {
10728
10621
 
10729
10622
  // scale geometry
10730
10623
 
10731
- _m1.makeScale( x, y, z );
10624
+ _m1$2.makeScale( x, y, z );
10732
10625
 
10733
- this.applyMatrix4( _m1 );
10626
+ this.applyMatrix4( _m1$2 );
10734
10627
 
10735
10628
  return this;
10736
10629
 
@@ -10790,7 +10683,7 @@ class BufferGeometry extends EventDispatcher {
10790
10683
 
10791
10684
  if ( position && position.isGLBufferAttribute ) {
10792
10685
 
10793
- console.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box. Alternatively set "mesh.frustumCulled" to "false".', this );
10686
+ console.error( 'THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.', this );
10794
10687
 
10795
10688
  this.boundingBox.set(
10796
10689
  new Vector3( - Infinity, - Infinity, - Infinity ),
@@ -10860,7 +10753,7 @@ class BufferGeometry extends EventDispatcher {
10860
10753
 
10861
10754
  if ( position && position.isGLBufferAttribute ) {
10862
10755
 
10863
- console.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere. Alternatively set "mesh.frustumCulled" to "false".', this );
10756
+ console.error( 'THREE.BufferGeometry.computeBoundingSphere(): GLBufferAttribute requires a manual bounding sphere.', this );
10864
10757
 
10865
10758
  this.boundingSphere.set( new Vector3(), Infinity );
10866
10759
 
@@ -10977,24 +10870,21 @@ class BufferGeometry extends EventDispatcher {
10977
10870
 
10978
10871
  }
10979
10872
 
10980
- const indices = index.array;
10981
- const positions = attributes.position.array;
10982
- const normals = attributes.normal.array;
10983
- const uvs = attributes.uv.array;
10984
-
10985
- const nVertices = positions.length / 3;
10873
+ const positionAttribute = attributes.position;
10874
+ const normalAttribute = attributes.normal;
10875
+ const uvAttribute = attributes.uv;
10986
10876
 
10987
10877
  if ( this.hasAttribute( 'tangent' ) === false ) {
10988
10878
 
10989
- this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * nVertices ), 4 ) );
10879
+ this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 ) );
10990
10880
 
10991
10881
  }
10992
10882
 
10993
- const tangents = this.getAttribute( 'tangent' ).array;
10883
+ const tangentAttribute = this.getAttribute( 'tangent' );
10994
10884
 
10995
10885
  const tan1 = [], tan2 = [];
10996
10886
 
10997
- for ( let i = 0; i < nVertices; i ++ ) {
10887
+ for ( let i = 0; i < positionAttribute.count; i ++ ) {
10998
10888
 
10999
10889
  tan1[ i ] = new Vector3();
11000
10890
  tan2[ i ] = new Vector3();
@@ -11014,13 +10904,13 @@ class BufferGeometry extends EventDispatcher {
11014
10904
 
11015
10905
  function handleTriangle( a, b, c ) {
11016
10906
 
11017
- vA.fromArray( positions, a * 3 );
11018
- vB.fromArray( positions, b * 3 );
11019
- vC.fromArray( positions, c * 3 );
10907
+ vA.fromBufferAttribute( positionAttribute, a );
10908
+ vB.fromBufferAttribute( positionAttribute, b );
10909
+ vC.fromBufferAttribute( positionAttribute, c );
11020
10910
 
11021
- uvA.fromArray( uvs, a * 2 );
11022
- uvB.fromArray( uvs, b * 2 );
11023
- uvC.fromArray( uvs, c * 2 );
10911
+ uvA.fromBufferAttribute( uvAttribute, a );
10912
+ uvB.fromBufferAttribute( uvAttribute, b );
10913
+ uvC.fromBufferAttribute( uvAttribute, c );
11024
10914
 
11025
10915
  vB.sub( vA );
11026
10916
  vC.sub( vA );
@@ -11053,7 +10943,7 @@ class BufferGeometry extends EventDispatcher {
11053
10943
 
11054
10944
  groups = [ {
11055
10945
  start: 0,
11056
- count: indices.length
10946
+ count: index.count
11057
10947
  } ];
11058
10948
 
11059
10949
  }
@@ -11068,9 +10958,9 @@ class BufferGeometry extends EventDispatcher {
11068
10958
  for ( let j = start, jl = start + count; j < jl; j += 3 ) {
11069
10959
 
11070
10960
  handleTriangle(
11071
- indices[ j + 0 ],
11072
- indices[ j + 1 ],
11073
- indices[ j + 2 ]
10961
+ index.getX( j + 0 ),
10962
+ index.getX( j + 1 ),
10963
+ index.getX( j + 2 )
11074
10964
  );
11075
10965
 
11076
10966
  }
@@ -11082,7 +10972,7 @@ class BufferGeometry extends EventDispatcher {
11082
10972
 
11083
10973
  function handleVertex( v ) {
11084
10974
 
11085
- n.fromArray( normals, v * 3 );
10975
+ n.fromBufferAttribute( normalAttribute, v );
11086
10976
  n2.copy( n );
11087
10977
 
11088
10978
  const t = tan1[ v ];
@@ -11098,10 +10988,7 @@ class BufferGeometry extends EventDispatcher {
11098
10988
  const test = tmp2.dot( tan2[ v ] );
11099
10989
  const w = ( test < 0.0 ) ? - 1.0 : 1.0;
11100
10990
 
11101
- tangents[ v * 4 ] = tmp.x;
11102
- tangents[ v * 4 + 1 ] = tmp.y;
11103
- tangents[ v * 4 + 2 ] = tmp.z;
11104
- tangents[ v * 4 + 3 ] = w;
10991
+ tangentAttribute.setXYZW( v, tmp.x, tmp.y, tmp.z, w );
11105
10992
 
11106
10993
  }
11107
10994
 
@@ -11114,9 +11001,9 @@ class BufferGeometry extends EventDispatcher {
11114
11001
 
11115
11002
  for ( let j = start, jl = start + count; j < jl; j += 3 ) {
11116
11003
 
11117
- handleVertex( indices[ j + 0 ] );
11118
- handleVertex( indices[ j + 1 ] );
11119
- handleVertex( indices[ j + 2 ] );
11004
+ handleVertex( index.getX( j + 0 ) );
11005
+ handleVertex( index.getX( j + 1 ) );
11006
+ handleVertex( index.getX( j + 2 ) );
11120
11007
 
11121
11008
  }
11122
11009
 
@@ -11945,7 +11832,6 @@ function checkGeometryIntersection( object, material, raycaster, ray, uv, uv1, n
11945
11832
  _uvC$1.fromBufferAttribute( uv1, c );
11946
11833
 
11947
11834
  intersection.uv1 = Triangle.getInterpolation( _intersectionPoint, _vA$1, _vB$1, _vC$1, _uvA$1, _uvB$1, _uvC$1, new Vector2() );
11948
- intersection.uv2 = intersection.uv1; // @deprecated, r152
11949
11835
 
11950
11836
  }
11951
11837
 
@@ -12296,7 +12182,8 @@ class ShaderMaterial extends Material {
12296
12182
  fragDepth: false, // set to use fragment depth values
12297
12183
  drawBuffers: false, // set to use draw buffers
12298
12184
  shaderTextureLOD: false, // set to use shader texture LOD
12299
- clipCullDistance: false // set to use vertex shader clipping
12185
+ clipCullDistance: false, // set to use vertex shader clipping
12186
+ multiDraw: false // set to use vertex shader multi_draw / enable gl_DrawID
12300
12187
  };
12301
12188
 
12302
12189
  // When rendered geometry doesn't include these attributes but the material does,
@@ -12508,6 +12395,11 @@ class Camera extends Object3D {
12508
12395
 
12509
12396
  }
12510
12397
 
12398
+ const _v3$1 = /*@__PURE__*/ new Vector3();
12399
+ const _minTarget = /*@__PURE__*/ new Vector2();
12400
+ const _maxTarget = /*@__PURE__*/ new Vector2();
12401
+
12402
+
12511
12403
  class PerspectiveCamera extends Camera {
12512
12404
 
12513
12405
  constructor( fov = 50, aspect = 1, near = 0.1, far = 2000 ) {
@@ -12606,6 +12498,34 @@ class PerspectiveCamera extends Camera {
12606
12498
 
12607
12499
  }
12608
12500
 
12501
+ /**
12502
+ * Computes the 2D bounds of the camera's viewable rectangle at a given distance along the viewing direction.
12503
+ * Sets minTarget and maxTarget to the coordinates of the lower-left and upper-right corners of the view rectangle.
12504
+ */
12505
+ getViewBounds( distance, minTarget, maxTarget ) {
12506
+
12507
+ _v3$1.set( - 1, - 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );
12508
+
12509
+ minTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );
12510
+
12511
+ _v3$1.set( 1, 1, 0.5 ).applyMatrix4( this.projectionMatrixInverse );
12512
+
12513
+ maxTarget.set( _v3$1.x, _v3$1.y ).multiplyScalar( - distance / _v3$1.z );
12514
+
12515
+ }
12516
+
12517
+ /**
12518
+ * Computes the width and height of the camera's viewable rectangle at a given distance along the viewing direction.
12519
+ * Copies the result into the target Vector2, where x is width and y is height.
12520
+ */
12521
+ getViewSize( distance, target ) {
12522
+
12523
+ this.getViewBounds( distance, _minTarget, _maxTarget );
12524
+
12525
+ return target.subVectors( _maxTarget, _minTarget );
12526
+
12527
+ }
12528
+
12609
12529
  /**
12610
12530
  * Sets an offset in a larger frustum. This is useful for multi-window or
12611
12531
  * multi-monitor/multi-machine setups.
@@ -12945,14 +12865,6 @@ class WebGLCubeRenderTarget extends WebGLRenderTarget {
12945
12865
  const image = { width: size, height: size, depth: 1 };
12946
12866
  const images = [ image, image, image, image, image, image ];
12947
12867
 
12948
- if ( options.encoding !== undefined ) {
12949
-
12950
- // @deprecated, r152
12951
- warnOnce( 'THREE.WebGLCubeRenderTarget: option.encoding has been replaced by option.colorSpace.' );
12952
- options.colorSpace = options.encoding === sRGBEncoding ? SRGBColorSpace : NoColorSpace;
12953
-
12954
- }
12955
-
12956
12868
  this.texture = new CubeTexture( images, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
12957
12869
 
12958
12870
  // By convention -- likely based on the RenderMan spec from the 1990's -- cube maps are specified by WebGL (and three.js)
@@ -13598,7 +13510,7 @@ function WebGLAttributes( gl, capabilities ) {
13598
13510
  function updateBuffer( buffer, attribute, bufferType ) {
13599
13511
 
13600
13512
  const array = attribute.array;
13601
- const updateRange = attribute._updateRange; // deprecated
13513
+ const updateRange = attribute._updateRange; // @deprecated, r159
13602
13514
  const updateRanges = attribute.updateRanges;
13603
13515
 
13604
13516
  gl.bindBuffer( bufferType, buffer );
@@ -13633,7 +13545,7 @@ function WebGLAttributes( gl, capabilities ) {
13633
13545
 
13634
13546
  }
13635
13547
 
13636
- // deprecated
13548
+ // @deprecated, r159
13637
13549
  if ( updateRange.count !== - 1 ) {
13638
13550
 
13639
13551
  if ( isWebGL2 ) {
@@ -13839,7 +13751,7 @@ var alphamap_fragment = "#ifdef USE_ALPHAMAP\n\tdiffuseColor.a *= texture2D( alp
13839
13751
 
13840
13752
  var alphamap_pars_fragment = "#ifdef USE_ALPHAMAP\n\tuniform sampler2D alphaMap;\n#endif";
13841
13753
 
13842
- var alphatest_fragment = "#ifdef USE_ALPHATEST\n\tif ( diffuseColor.a < alphaTest ) discard;\n#endif";
13754
+ var alphatest_fragment = "#ifdef USE_ALPHATEST\n\t#ifdef ALPHA_TO_COVERAGE\n\tdiffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );\n\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\tif ( diffuseColor.a < alphaTest ) discard;\n\t#endif\n#endif";
13843
13755
 
13844
13756
  var alphatest_pars_fragment = "#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif";
13845
13757
 
@@ -13861,7 +13773,7 @@ var iridescence_fragment = "#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 =
13861
13773
 
13862
13774
  var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vBumpMapUv );\n\t\tvec2 dSTdy = dFdy( vBumpMapUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );\n\t\tvec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif";
13863
13775
 
13864
- var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif";
13776
+ var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#ifdef ALPHA_TO_COVERAGE\n\t\tfloat distanceToPlane, distanceGradient;\n\t\tfloat clipOpacity = 1.0;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\tclipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\tif ( clipOpacity == 0.0 ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tfloat unionClipOpacity = 1.0;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tdistanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;\n\t\t\t\tdistanceGradient = fwidth( distanceToPlane ) / 2.0;\n\t\t\t\tunionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tclipOpacity *= 1.0 - unionClipOpacity;\n\t\t#endif\n\t\tdiffuseColor.a *= clipOpacity;\n\t\tif ( diffuseColor.a == 0.0 ) discard;\n\t#else\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\t\tbool clipped = true;\n\t\t\t#pragma unroll_loop_start\n\t\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\t\tplane = clippingPlanes[ i ];\n\t\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t\t}\n\t\t\t#pragma unroll_loop_end\n\t\t\tif ( clipped ) discard;\n\t\t#endif\n\t#endif\n#endif";
13865
13777
 
13866
13778
  var clipping_planes_pars_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvarying vec3 vClipPosition;\n\tuniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];\n#endif";
13867
13779
 
@@ -13895,9 +13807,9 @@ var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
13895
13807
 
13896
13808
  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}";
13897
13809
 
13898
- 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";
13810
+ 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";
13899
13811
 
13900
- 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";
13812
+ 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";
13901
13813
 
13902
13814
  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";
13903
13815
 
@@ -13925,7 +13837,7 @@ var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertM
13925
13837
 
13926
13838
  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";
13927
13839
 
13928
- 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";
13840
+ 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";
13929
13841
 
13930
13842
  var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
13931
13843
 
@@ -13965,11 +13877,13 @@ var metalnessmap_fragment = "float metalnessFactor = metalness;\n#ifdef USE_META
13965
13877
 
13966
13878
  var metalnessmap_pars_fragment = "#ifdef USE_METALNESSMAP\n\tuniform sampler2D metalnessMap;\n#endif";
13967
13879
 
13880
+ 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";
13881
+
13968
13882
  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";
13969
13883
 
13970
13884
  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";
13971
13885
 
13972
- 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";
13886
+ 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";
13973
13887
 
13974
13888
  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";
13975
13889
 
@@ -14031,7 +13945,7 @@ var specularmap_pars_fragment = "#ifdef USE_SPECULARMAP\n\tuniform sampler2D spe
14031
13945
 
14032
13946
  var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
14033
13947
 
14034
- 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 = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor *= toneMappingExposure;\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\treturn color;\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
13948
+ var tonemapping_pars_fragment = "#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\nuniform float toneMappingExposure;\nvec3 LinearToneMapping( vec3 color ) {\n\treturn saturate( toneMappingExposure * color );\n}\nvec3 ReinhardToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\treturn saturate( color / ( vec3( 1.0 ) + color ) );\n}\nvec3 OptimizedCineonToneMapping( vec3 color ) {\n\tcolor *= toneMappingExposure;\n\tcolor = max( vec3( 0.0 ), color - 0.004 );\n\treturn pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );\n}\nvec3 RRTAndODTFit( vec3 v ) {\n\tvec3 a = v * ( v + 0.0245786 ) - 0.000090537;\n\tvec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;\n\treturn a / b;\n}\nvec3 ACESFilmicToneMapping( vec3 color ) {\n\tconst mat3 ACESInputMat = mat3(\n\t\tvec3( 0.59719, 0.07600, 0.02840 ),\t\tvec3( 0.35458, 0.90834, 0.13383 ),\n\t\tvec3( 0.04823, 0.01566, 0.83777 )\n\t);\n\tconst mat3 ACESOutputMat = mat3(\n\t\tvec3( 1.60475, -0.10208, -0.00327 ),\t\tvec3( -0.53108, 1.10813, -0.07276 ),\n\t\tvec3( -0.07367, -0.00605, 1.07602 )\n\t);\n\tcolor *= toneMappingExposure / 0.6;\n\tcolor = ACESInputMat * color;\n\tcolor = RRTAndODTFit( color );\n\tcolor = ACESOutputMat * color;\n\treturn saturate( color );\n}\nconst mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.6605, - 0.1246, - 0.0182 ),\n\tvec3( - 0.5876, 1.1329, - 0.1006 ),\n\tvec3( - 0.0728, - 0.0083, 1.1187 )\n);\nconst mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(\n\tvec3( 0.6274, 0.0691, 0.0164 ),\n\tvec3( 0.3293, 0.9195, 0.0880 ),\n\tvec3( 0.0433, 0.0113, 0.8956 )\n);\nvec3 agxDefaultContrastApprox( vec3 x ) {\n\tvec3 x2 = x * x;\n\tvec3 x4 = x2 * x2;\n\treturn + 15.5 * x4 * x2\n\t\t- 40.14 * x4 * x\n\t\t+ 31.96 * x4\n\t\t- 6.868 * x2 * x\n\t\t+ 0.4298 * x2\n\t\t+ 0.1191 * x\n\t\t- 0.00232;\n}\nvec3 AgXToneMapping( vec3 color ) {\n\tconst mat3 AgXInsetMatrix = mat3(\n\t\tvec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),\n\t\tvec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),\n\t\tvec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )\n\t);\n\tconst mat3 AgXOutsetMatrix = mat3(\n\t\tvec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),\n\t\tvec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),\n\t\tvec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )\n\t);\n\tconst float AgxMinEv = - 12.47393;\tconst float AgxMaxEv = 4.026069;\n\tcolor *= toneMappingExposure;\n\tcolor = LINEAR_SRGB_TO_LINEAR_REC2020 * color;\n\tcolor = AgXInsetMatrix * color;\n\tcolor = max( color, 1e-10 );\tcolor = log2( color );\n\tcolor = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );\n\tcolor = clamp( color, 0.0, 1.0 );\n\tcolor = agxDefaultContrastApprox( color );\n\tcolor = AgXOutsetMatrix * color;\n\tcolor = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );\n\tcolor = LINEAR_REC2020_TO_LINEAR_SRGB * color;\n\tcolor = clamp( color, 0.0, 1.0 );\n\treturn color;\n}\nvec3 NeutralToneMapping( vec3 color ) {\n\tfloat startCompression = 0.8 - 0.04;\n\tfloat desaturation = 0.15;\n\tcolor *= toneMappingExposure;\n\tfloat x = min(color.r, min(color.g, color.b));\n\tfloat offset = x < 0.08 ? x - 6.25 * x * x : 0.04;\n\tcolor -= offset;\n\tfloat peak = max(color.r, max(color.g, color.b));\n\tif (peak < startCompression) return color;\n\tfloat d = 1. - startCompression;\n\tfloat newPeak = 1. - d * d / (peak + d - startCompression);\n\tcolor *= newPeak / peak;\n\tfloat g = 1. - 1. / (desaturation * (peak - newPeak) + 1.);\n\treturn mix(color, vec3(1, 1, 1), g);\n}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
14035
13949
 
14036
13950
  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";
14037
13951
 
@@ -14051,67 +13965,67 @@ const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\n
14051
13965
 
14052
13966
  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}";
14053
13967
 
14054
- 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}";
13968
+ 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}";
14055
13969
 
14056
13970
  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}";
14057
13971
 
14058
13972
  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}";
14059
13973
 
14060
- 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}";
13974
+ 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}";
14061
13975
 
14062
- 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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\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}";
13976
+ 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}";
14063
13977
 
14064
- 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}";
13978
+ 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}";
14065
13979
 
14066
- 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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\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}";
13980
+ 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}";
14067
13981
 
14068
13982
  const vertex$c = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n}";
14069
13983
 
14070
13984
  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}";
14071
13985
 
14072
- 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}";
13986
+ 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}";
14073
13987
 
14074
- 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\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\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}";
13988
+ 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}";
14075
13989
 
14076
- 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}";
13990
+ 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}";
14077
13991
 
14078
- 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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\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}";
13992
+ 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}";
14079
13993
 
14080
- 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}";
13994
+ 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}";
14081
13995
 
14082
- 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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\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}";
13996
+ 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}";
14083
13997
 
14084
- 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}";
13998
+ 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}";
14085
13999
 
14086
- 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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\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}";
14000
+ 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}";
14087
14001
 
14088
- 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}";
14002
+ 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}";
14089
14003
 
14090
- 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\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 ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}";
14004
+ 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}";
14091
14005
 
14092
- 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}";
14006
+ 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}";
14093
14007
 
14094
- 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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\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}";
14008
+ 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}";
14095
14009
 
14096
- 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}";
14010
+ 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}";
14097
14011
 
14098
- 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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\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}";
14012
+ 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}";
14099
14013
 
14100
- 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}";
14014
+ 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}";
14101
14015
 
14102
- 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\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\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}";
14016
+ 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}";
14103
14017
 
14104
- 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}";
14018
+ 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}";
14105
14019
 
14106
- 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\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\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}";
14020
+ 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}";
14107
14021
 
14108
- 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}";
14022
+ 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}";
14109
14023
 
14110
14024
  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}";
14111
14025
 
14112
14026
  const vertex$1 = "uniform float rotation;\nuniform vec2 center;\n#include <common>\n#include <uv_pars_vertex>\n#include <fog_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\tvec4 mvPosition = modelViewMatrix * vec4( 0.0, 0.0, 0.0, 1.0 );\n\tvec2 scale;\n\tscale.x = length( vec3( modelMatrix[ 0 ].x, modelMatrix[ 0 ].y, modelMatrix[ 0 ].z ) );\n\tscale.y = length( vec3( modelMatrix[ 1 ].x, modelMatrix[ 1 ].y, modelMatrix[ 1 ].z ) );\n\t#ifndef USE_SIZEATTENUATION\n\t\tbool isPerspective = isPerspectiveMatrix( projectionMatrix );\n\t\tif ( isPerspective ) scale *= - mvPosition.z;\n\t#endif\n\tvec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;\n\tvec2 rotatedPosition;\n\trotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;\n\trotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;\n\tmvPosition.xy += rotatedPosition;\n\tgl_Position = projectionMatrix * mvPosition;\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n}";
14113
14027
 
14114
- const fragment$1 = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\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 <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <alphamap_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}";
14028
+ const fragment$1 = "uniform vec3 diffuse;\nuniform float opacity;\n#include <common>\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 <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_fragment>\n\t#include <alphamap_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}";
14115
14029
 
14116
14030
  const ShaderChunk = {
14117
14031
  alphahash_fragment: alphahash_fragment,
@@ -14181,6 +14095,7 @@ const ShaderChunk = {
14181
14095
  map_particle_pars_fragment: map_particle_pars_fragment,
14182
14096
  metalnessmap_fragment: metalnessmap_fragment,
14183
14097
  metalnessmap_pars_fragment: metalnessmap_pars_fragment,
14098
+ morphinstance_vertex: morphinstance_vertex,
14184
14099
  morphcolor_vertex: morphcolor_vertex,
14185
14100
  morphnormal_vertex: morphnormal_vertex,
14186
14101
  morphtarget_pars_vertex: morphtarget_pars_vertex,
@@ -14289,6 +14204,7 @@ const UniformsLib = {
14289
14204
  envmap: {
14290
14205
 
14291
14206
  envMap: { value: null },
14207
+ envMapRotation: { value: /*@__PURE__*/ new Matrix3() },
14292
14208
  flipEnvMap: { value: - 1 },
14293
14209
  reflectivity: { value: 1.0 }, // basic, lambert, phong
14294
14210
  ior: { value: 1.5 }, // physical
@@ -14709,7 +14625,8 @@ const ShaderLib = {
14709
14625
  envMap: { value: null },
14710
14626
  flipEnvMap: { value: - 1 },
14711
14627
  backgroundBlurriness: { value: 0 },
14712
- backgroundIntensity: { value: 1 }
14628
+ backgroundIntensity: { value: 1 },
14629
+ backgroundRotation: { value: /*@__PURE__*/ new Matrix3() }
14713
14630
  },
14714
14631
 
14715
14632
  vertexShader: ShaderChunk.backgroundCube_vert,
@@ -14833,6 +14750,8 @@ ShaderLib.physical = {
14833
14750
  };
14834
14751
 
14835
14752
  const _rgb = { r: 0, b: 0, g: 0 };
14753
+ const _e1$1 = /*@__PURE__*/ new Euler();
14754
+ const _m1$1 = /*@__PURE__*/ new Matrix4();
14836
14755
 
14837
14756
  function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha ) {
14838
14757
 
@@ -14929,10 +14848,24 @@ function WebGLBackground( renderer, cubemaps, cubeuvmaps, state, objects, alpha,
14929
14848
 
14930
14849
  }
14931
14850
 
14851
+ _e1$1.copy( scene.backgroundRotation );
14852
+
14853
+ // accommodate left-handed frame
14854
+ _e1$1.x *= - 1; _e1$1.y *= - 1; _e1$1.z *= - 1;
14855
+
14856
+ if ( background.isCubeTexture && background.isRenderTargetTexture === false ) {
14857
+
14858
+ // environment maps which are not cube render targets or PMREMs follow a different convention
14859
+ _e1$1.y *= - 1;
14860
+ _e1$1.z *= - 1;
14861
+
14862
+ }
14863
+
14932
14864
  boxMesh.material.uniforms.envMap.value = background;
14933
14865
  boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;
14934
14866
  boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
14935
14867
  boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
14868
+ boxMesh.material.uniforms.backgroundRotation.value.setFromMatrix4( _m1$1.makeRotationFromEuler( _e1$1 ) );
14936
14869
  boxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
14937
14870
 
14938
14871
  if ( currentBackground !== background ||
@@ -16099,7 +16032,7 @@ function WebGLCubeMaps( renderer ) {
16099
16032
 
16100
16033
  if ( image && image.height > 0 ) {
16101
16034
 
16102
- const renderTarget = new WebGLCubeRenderTarget( image.height / 2 );
16035
+ const renderTarget = new WebGLCubeRenderTarget( image.height );
16103
16036
  renderTarget.fromEquirectangularTexture( renderer, texture );
16104
16037
  cubemaps.set( texture, renderTarget );
16105
16038
 
@@ -16397,6 +16330,7 @@ class PMREMGenerator {
16397
16330
  * Generates a PMREM from an equirectangular texture, which can be either LDR
16398
16331
  * or HDR. The ideal input image size is 1k (1024 x 512),
16399
16332
  * as this matches best with the 256 x 256 cubemap output.
16333
+ * The smallest supported equirectangular image size is 64 x 32.
16400
16334
  */
16401
16335
  fromEquirectangular( equirectangular, renderTarget = null ) {
16402
16336
 
@@ -16408,6 +16342,7 @@ class PMREMGenerator {
16408
16342
  * Generates a PMREM from an cubemap texture, which can be either LDR
16409
16343
  * or HDR. The ideal input cube size is 256 x 256,
16410
16344
  * as this matches best with the 256 x 256 cubemap output.
16345
+ * The smallest supported cube size is 16 x 16.
16411
16346
  */
16412
16347
  fromCubemap( cubemap, renderTarget = null ) {
16413
16348
 
@@ -17915,24 +17850,31 @@ function WebGLMorphtargets( gl, capabilities, textures ) {
17915
17850
  }
17916
17851
 
17917
17852
  //
17853
+ if ( object.isInstancedMesh === true && object.morphTexture !== null ) {
17918
17854
 
17919
- let morphInfluencesSum = 0;
17855
+ program.getUniforms().setValue( gl, 'morphTexture', object.morphTexture, textures );
17920
17856
 
17921
- for ( let i = 0; i < objectInfluences.length; i ++ ) {
17857
+ } else {
17922
17858
 
17923
- morphInfluencesSum += objectInfluences[ i ];
17859
+ let morphInfluencesSum = 0;
17924
17860
 
17925
- }
17861
+ for ( let i = 0; i < objectInfluences.length; i ++ ) {
17926
17862
 
17927
- const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
17863
+ morphInfluencesSum += objectInfluences[ i ];
17864
+
17865
+ }
17866
+
17867
+ const morphBaseInfluence = geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
17928
17868
 
17929
- program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
17930
- program.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );
17869
+
17870
+ program.getUniforms().setValue( gl, 'morphTargetBaseInfluence', morphBaseInfluence );
17871
+ program.getUniforms().setValue( gl, 'morphTargetInfluences', objectInfluences );
17872
+
17873
+ }
17931
17874
 
17932
17875
  program.getUniforms().setValue( gl, 'morphTargetsTexture', entry.texture, textures );
17933
17876
  program.getUniforms().setValue( gl, 'morphTargetsTextureSize', entry.size );
17934
17877
 
17935
-
17936
17878
  } else {
17937
17879
 
17938
17880
  // When object doesn't have morph target influences defined, we treat it as a 0-length array
@@ -19578,6 +19520,10 @@ function getToneMappingFunction( functionName, toneMapping ) {
19578
19520
  toneMappingName = 'AgX';
19579
19521
  break;
19580
19522
 
19523
+ case NeutralToneMapping:
19524
+ toneMappingName = 'Neutral';
19525
+ break;
19526
+
19581
19527
  case CustomToneMapping:
19582
19528
  toneMappingName = 'Custom';
19583
19529
  break;
@@ -19595,7 +19541,7 @@ function getToneMappingFunction( functionName, toneMapping ) {
19595
19541
  function generateExtensions( parameters ) {
19596
19542
 
19597
19543
  const chunks = [
19598
- ( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',
19544
+ ( parameters.extensionDerivatives || !! parameters.envMapCubeUVHeight || parameters.bumpMap || parameters.normalMapTangentSpace || parameters.clearcoatNormalMap || parameters.flatShading || parameters.alphaToCoverage || parameters.shaderID === 'physical' ) ? '#extension GL_OES_standard_derivatives : enable' : '',
19599
19545
  ( parameters.extensionFragDepth || parameters.logarithmicDepthBuffer ) && parameters.rendererExtensionFragDepth ? '#extension GL_EXT_frag_depth : enable' : '',
19600
19546
  ( parameters.extensionDrawBuffers && parameters.rendererExtensionDrawBuffers ) ? '#extension GL_EXT_draw_buffers : require' : '',
19601
19547
  ( parameters.extensionShaderTextureLOD || parameters.envMap || parameters.transmission ) && parameters.rendererExtensionShaderTextureLod ? '#extension GL_EXT_shader_texture_lod : enable' : ''
@@ -19608,7 +19554,8 @@ function generateExtensions( parameters ) {
19608
19554
  function generateVertexExtensions( parameters ) {
19609
19555
 
19610
19556
  const chunks = [
19611
- parameters.extensionClipCullDistance ? '#extension GL_ANGLE_clip_cull_distance : require' : ''
19557
+ parameters.extensionClipCullDistance ? '#extension GL_ANGLE_clip_cull_distance : require' : '',
19558
+ parameters.extensionMultiDraw ? '#extension GL_ANGLE_multi_draw : require' : '',
19612
19559
  ];
19613
19560
 
19614
19561
  return chunks.filter( filterEmptyLine ).join( '\n' );
@@ -19767,7 +19714,30 @@ function loopReplacer( match, start, end, snippet ) {
19767
19714
 
19768
19715
  function generatePrecision( parameters ) {
19769
19716
 
19770
- let precisionstring = 'precision ' + parameters.precision + ' float;\nprecision ' + parameters.precision + ' int;';
19717
+ let precisionstring = `precision ${parameters.precision} float;
19718
+ precision ${parameters.precision} int;
19719
+ precision ${parameters.precision} sampler2D;
19720
+ precision ${parameters.precision} samplerCube;
19721
+ `;
19722
+
19723
+ if ( parameters.isWebGL2 ) {
19724
+
19725
+ precisionstring += `precision ${parameters.precision} sampler3D;
19726
+ precision ${parameters.precision} sampler2DArray;
19727
+ precision ${parameters.precision} sampler2DShadow;
19728
+ precision ${parameters.precision} samplerCubeShadow;
19729
+ precision ${parameters.precision} sampler2DArrayShadow;
19730
+ precision ${parameters.precision} isampler2D;
19731
+ precision ${parameters.precision} isampler3D;
19732
+ precision ${parameters.precision} isamplerCube;
19733
+ precision ${parameters.precision} isampler2DArray;
19734
+ precision ${parameters.precision} usampler2D;
19735
+ precision ${parameters.precision} usampler3D;
19736
+ precision ${parameters.precision} usamplerCube;
19737
+ precision ${parameters.precision} usampler2DArray;
19738
+ `;
19739
+
19740
+ }
19771
19741
 
19772
19742
  if ( parameters.precision === 'highp' ) {
19773
19743
 
@@ -19979,6 +19949,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
19979
19949
  parameters.batching ? '#define USE_BATCHING' : '',
19980
19950
  parameters.instancing ? '#define USE_INSTANCING' : '',
19981
19951
  parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',
19952
+ parameters.instancingMorph ? '#define USE_INSTANCING_MORPH' : '',
19982
19953
 
19983
19954
  parameters.useFog && parameters.fog ? '#define USE_FOG' : '',
19984
19955
  parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',
@@ -20110,6 +20081,12 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20110
20081
 
20111
20082
  '#endif',
20112
20083
 
20084
+ '#ifdef USE_INSTANCING_MORPH',
20085
+
20086
+ ' uniform sampler2D morphTexture;',
20087
+
20088
+ '#endif',
20089
+
20113
20090
  'attribute vec3 position;',
20114
20091
  'attribute vec3 normal;',
20115
20092
  'attribute vec2 uv;',
@@ -20198,6 +20175,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20198
20175
  parameters.useFog && parameters.fog ? '#define USE_FOG' : '',
20199
20176
  parameters.useFog && parameters.fogExp2 ? '#define FOG_EXP2' : '',
20200
20177
 
20178
+ parameters.alphaToCoverage ? '#define ALPHA_TO_COVERAGE' : '',
20201
20179
  parameters.map ? '#define USE_MAP' : '',
20202
20180
  parameters.matcap ? '#define USE_MATCAP' : '',
20203
20181
  parameters.envMap ? '#define USE_ENVMAP' : '',
@@ -20446,6 +20424,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20446
20424
  console.error(
20447
20425
  'THREE.WebGLProgram: Shader Error ' + gl.getError() + ' - ' +
20448
20426
  'VALIDATE_STATUS ' + gl.getProgramParameter( program, gl.VALIDATE_STATUS ) + '\n\n' +
20427
+ 'Material Name: ' + self.name + '\n' +
20428
+ 'Material Type: ' + self.type + '\n\n' +
20449
20429
  'Program Info Log: ' + programLog + '\n' +
20450
20430
  vertexErrors + '\n' +
20451
20431
  fragmentErrors
@@ -20710,6 +20690,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20710
20690
 
20711
20691
  const _programLayers = new Layers();
20712
20692
  const _customShaders = new WebGLShaderCache();
20693
+ const _activeChannels = new Set();
20713
20694
  const programs = [];
20714
20695
 
20715
20696
  const IS_WEBGL2 = capabilities.isWebGL2;
@@ -20738,6 +20719,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20738
20719
 
20739
20720
  function getChannel( value ) {
20740
20721
 
20722
+ _activeChannels.add( value );
20723
+
20741
20724
  if ( value === 0 ) return 'uv';
20742
20725
 
20743
20726
  return `uv${ value }`;
@@ -20860,10 +20843,6 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20860
20843
 
20861
20844
  const HAS_EXTENSIONS = !! material.extensions;
20862
20845
 
20863
- const HAS_ATTRIBUTE_UV1 = !! geometry.attributes.uv1;
20864
- const HAS_ATTRIBUTE_UV2 = !! geometry.attributes.uv2;
20865
- const HAS_ATTRIBUTE_UV3 = !! geometry.attributes.uv3;
20866
-
20867
20846
  let toneMapping = NoToneMapping;
20868
20847
 
20869
20848
  if ( material.toneMapped ) {
@@ -20899,10 +20878,12 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20899
20878
  batching: IS_BATCHEDMESH,
20900
20879
  instancing: IS_INSTANCEDMESH,
20901
20880
  instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
20881
+ instancingMorph: IS_INSTANCEDMESH && object.morphTexture !== null,
20902
20882
 
20903
20883
  supportsVertexTextures: SUPPORTS_VERTEX_TEXTURES,
20904
20884
  numMultiviewViews: numMultiviewViews,
20905
20885
  outputColorSpace: ( currentRenderTarget === null ) ? renderer.outputColorSpace : ( currentRenderTarget.isXRRenderTarget === true ? currentRenderTarget.texture.colorSpace : LinearSRGBColorSpace ),
20886
+ alphaToCoverage: !! material.alphaToCoverage,
20906
20887
 
20907
20888
  map: HAS_MAP,
20908
20889
  matcap: HAS_MATCAP,
@@ -20948,7 +20929,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20948
20929
 
20949
20930
  gradientMap: HAS_GRADIENTMAP,
20950
20931
 
20951
- opaque: material.transparent === false && material.blending === NormalBlending,
20932
+ opaque: material.transparent === false && material.blending === NormalBlending && material.alphaToCoverage === false,
20952
20933
 
20953
20934
  alphaMap: HAS_ALPHAMAP,
20954
20935
  alphaTest: HAS_ALPHATEST,
@@ -20995,15 +20976,12 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20995
20976
  vertexTangents: !! geometry.attributes.tangent && ( HAS_NORMALMAP || HAS_ANISOTROPY ),
20996
20977
  vertexColors: material.vertexColors,
20997
20978
  vertexAlphas: material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4,
20998
- vertexUv1s: HAS_ATTRIBUTE_UV1,
20999
- vertexUv2s: HAS_ATTRIBUTE_UV2,
21000
- vertexUv3s: HAS_ATTRIBUTE_UV3,
21001
20979
 
21002
20980
  pointsUvs: object.isPoints === true && !! geometry.attributes.uv && ( HAS_MAP || HAS_ALPHAMAP ),
21003
20981
 
21004
20982
  fog: !! fog,
21005
20983
  useFog: material.fog === true,
21006
- fogExp2: ( fog && fog.isFogExp2 ),
20984
+ fogExp2: ( !! fog && fog.isFogExp2 ),
21007
20985
 
21008
20986
  flatShading: material.flatShading === true,
21009
20987
 
@@ -21059,7 +21037,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
21059
21037
  extensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,
21060
21038
  extensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,
21061
21039
  extensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,
21062
- extensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance && extensions.has( 'WEBGL_clip_cull_distance' ),
21040
+ extensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance === true && extensions.has( 'WEBGL_clip_cull_distance' ),
21041
+ extensionMultiDraw: HAS_EXTENSIONS && material.extensions.multiDraw === true && extensions.has( 'WEBGL_multi_draw' ),
21063
21042
 
21064
21043
  rendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),
21065
21044
  rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),
@@ -21070,6 +21049,14 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
21070
21049
 
21071
21050
  };
21072
21051
 
21052
+ // the usage of getChannel() determines the active texture channels for this shader
21053
+
21054
+ parameters.vertexUv1s = _activeChannels.has( 1 );
21055
+ parameters.vertexUv2s = _activeChannels.has( 2 );
21056
+ parameters.vertexUv3s = _activeChannels.has( 3 );
21057
+
21058
+ _activeChannels.clear();
21059
+
21073
21060
  return parameters;
21074
21061
 
21075
21062
  }
@@ -21179,38 +21166,40 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
21179
21166
  _programLayers.enable( 2 );
21180
21167
  if ( parameters.instancingColor )
21181
21168
  _programLayers.enable( 3 );
21182
- if ( parameters.matcap )
21169
+ if ( parameters.instancingMorph )
21183
21170
  _programLayers.enable( 4 );
21184
- if ( parameters.envMap )
21171
+ if ( parameters.matcap )
21185
21172
  _programLayers.enable( 5 );
21186
- if ( parameters.normalMapObjectSpace )
21173
+ if ( parameters.envMap )
21187
21174
  _programLayers.enable( 6 );
21188
- if ( parameters.normalMapTangentSpace )
21175
+ if ( parameters.normalMapObjectSpace )
21189
21176
  _programLayers.enable( 7 );
21190
- if ( parameters.clearcoat )
21177
+ if ( parameters.normalMapTangentSpace )
21191
21178
  _programLayers.enable( 8 );
21192
- if ( parameters.iridescence )
21179
+ if ( parameters.clearcoat )
21193
21180
  _programLayers.enable( 9 );
21194
- if ( parameters.alphaTest )
21181
+ if ( parameters.iridescence )
21195
21182
  _programLayers.enable( 10 );
21196
- if ( parameters.vertexColors )
21183
+ if ( parameters.alphaTest )
21197
21184
  _programLayers.enable( 11 );
21198
- if ( parameters.vertexAlphas )
21185
+ if ( parameters.vertexColors )
21199
21186
  _programLayers.enable( 12 );
21200
- if ( parameters.vertexUv1s )
21187
+ if ( parameters.vertexAlphas )
21201
21188
  _programLayers.enable( 13 );
21202
- if ( parameters.vertexUv2s )
21189
+ if ( parameters.vertexUv1s )
21203
21190
  _programLayers.enable( 14 );
21204
- if ( parameters.vertexUv3s )
21191
+ if ( parameters.vertexUv2s )
21205
21192
  _programLayers.enable( 15 );
21206
- if ( parameters.vertexTangents )
21193
+ if ( parameters.vertexUv3s )
21207
21194
  _programLayers.enable( 16 );
21208
- if ( parameters.anisotropy )
21195
+ if ( parameters.vertexTangents )
21209
21196
  _programLayers.enable( 17 );
21210
- if ( parameters.alphaHash )
21197
+ if ( parameters.anisotropy )
21211
21198
  _programLayers.enable( 18 );
21212
- if ( parameters.batching )
21199
+ if ( parameters.alphaHash )
21213
21200
  _programLayers.enable( 19 );
21201
+ if ( parameters.batching )
21202
+ _programLayers.enable( 20 );
21214
21203
 
21215
21204
  array.push( _programLayers.mask );
21216
21205
  _programLayers.disableAll();
@@ -21255,8 +21244,10 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
21255
21244
  _programLayers.enable( 18 );
21256
21245
  if ( parameters.decodeVideoTexture )
21257
21246
  _programLayers.enable( 19 );
21258
- if ( parameters.numMultiviewViews )
21247
+ if ( parameters.alphaToCoverage )
21259
21248
  _programLayers.enable( 20 );
21249
+ if ( parameters.numMultiviewViews )
21250
+ _programLayers.enable( 21 );
21260
21251
 
21261
21252
  array.push( _programLayers.mask );
21262
21253
 
@@ -23315,33 +23306,19 @@ function WebGLState( gl, extensions, capabilities ) {
23315
23306
 
23316
23307
  }
23317
23308
 
23318
- if ( renderTarget.isWebGLMultipleRenderTargets ) {
23319
-
23320
- const textures = renderTarget.texture;
23309
+ const textures = renderTarget.textures;
23321
23310
 
23322
- if ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {
23311
+ if ( drawBuffers.length !== textures.length || drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {
23323
23312
 
23324
- for ( let i = 0, il = textures.length; i < il; i ++ ) {
23325
-
23326
- drawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;
23327
-
23328
- }
23313
+ for ( let i = 0, il = textures.length; i < il; i ++ ) {
23329
23314
 
23330
- drawBuffers.length = textures.length;
23331
-
23332
- needsUpdate = true;
23315
+ drawBuffers[ i ] = gl.COLOR_ATTACHMENT0 + i;
23333
23316
 
23334
23317
  }
23335
23318
 
23336
- } else {
23337
-
23338
- if ( drawBuffers[ 0 ] !== gl.COLOR_ATTACHMENT0 ) {
23339
-
23340
- drawBuffers[ 0 ] = gl.COLOR_ATTACHMENT0;
23319
+ drawBuffers.length = textures.length;
23341
23320
 
23342
- needsUpdate = true;
23343
-
23344
- }
23321
+ needsUpdate = true;
23345
23322
 
23346
23323
  }
23347
23324
 
@@ -23363,10 +23340,14 @@ function WebGLState( gl, extensions, capabilities ) {
23363
23340
 
23364
23341
  gl.drawBuffers( drawBuffers );
23365
23342
 
23366
- } else {
23343
+ } else if ( extensions.has( 'WEBGL_draw_buffers' ) === true ) {
23367
23344
 
23368
23345
  extensions.get( 'WEBGL_draw_buffers' ).drawBuffersWEBGL( drawBuffers );
23369
23346
 
23347
+ } else {
23348
+
23349
+ throw new Error( 'THREE.WebGLState: Usage of gl.drawBuffers() require WebGL2 or WEBGL_draw_buffers extension' );
23350
+
23370
23351
  }
23371
23352
 
23372
23353
  }
@@ -24154,6 +24135,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24154
24135
  const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
24155
24136
  const multiviewExt = extensions.has( 'OCULUS_multiview' ) ? extensions.get( 'OCULUS_multiview' ) : null;
24156
24137
 
24138
+ const _imageDimensions = new Vector2();
24157
24139
  const _videoTextures = new WeakMap();
24158
24140
  let _canvas;
24159
24141
 
@@ -24194,11 +24176,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24194
24176
 
24195
24177
  let scale = 1;
24196
24178
 
24179
+ const dimensions = getDimensions( image );
24180
+
24197
24181
  // handle case if texture exceeds max size
24198
24182
 
24199
- if ( image.width > maxSize || image.height > maxSize ) {
24183
+ if ( dimensions.width > maxSize || dimensions.height > maxSize ) {
24200
24184
 
24201
- scale = maxSize / Math.max( image.width, image.height );
24185
+ scale = maxSize / Math.max( dimensions.width, dimensions.height );
24202
24186
 
24203
24187
  }
24204
24188
 
@@ -24210,12 +24194,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24210
24194
 
24211
24195
  if ( ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) ||
24212
24196
  ( typeof HTMLCanvasElement !== 'undefined' && image instanceof HTMLCanvasElement ) ||
24213
- ( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ) {
24197
+ ( typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap ) ||
24198
+ ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) ) {
24214
24199
 
24215
24200
  const floor = needsPowerOfTwo ? floorPowerOfTwo : Math.floor;
24216
24201
 
24217
- const width = floor( scale * image.width );
24218
- const height = floor( scale * image.height );
24202
+ const width = floor( scale * dimensions.width );
24203
+ const height = floor( scale * dimensions.height );
24219
24204
 
24220
24205
  if ( _canvas === undefined ) _canvas = createCanvas( width, height );
24221
24206
 
@@ -24229,7 +24214,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24229
24214
  const context = canvas.getContext( '2d' );
24230
24215
  context.drawImage( image, 0, 0, width, height );
24231
24216
 
24232
- console.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + image.width + 'x' + image.height + ') to (' + width + 'x' + height + ').' );
24217
+ console.warn( 'THREE.WebGLRenderer: Texture has been resized from (' + dimensions.width + 'x' + dimensions.height + ') to (' + width + 'x' + height + ').' );
24233
24218
 
24234
24219
  return canvas;
24235
24220
 
@@ -24237,7 +24222,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24237
24222
 
24238
24223
  if ( 'data' in image ) {
24239
24224
 
24240
- console.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + image.width + 'x' + image.height + ').' );
24225
+ console.warn( 'THREE.WebGLRenderer: Image in DataTexture is too big (' + dimensions.width + 'x' + dimensions.height + ').' );
24241
24226
 
24242
24227
  }
24243
24228
 
@@ -24253,7 +24238,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24253
24238
 
24254
24239
  function isPowerOfTwo$1( image ) {
24255
24240
 
24256
- return isPowerOfTwo( image.width ) && isPowerOfTwo( image.height );
24241
+ const dimensions = getDimensions( image );
24242
+
24243
+ return isPowerOfTwo( dimensions.width ) && isPowerOfTwo( dimensions.height );
24257
24244
 
24258
24245
  }
24259
24246
 
@@ -24320,6 +24307,17 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24320
24307
 
24321
24308
  }
24322
24309
 
24310
+ if ( glFormat === _gl.RG_INTEGER ) {
24311
+
24312
+ if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = _gl.RG8UI;
24313
+ if ( glType === _gl.UNSIGNED_SHORT ) internalFormat = _gl.RG16UI;
24314
+ if ( glType === _gl.UNSIGNED_INT ) internalFormat = _gl.RG32UI;
24315
+ if ( glType === _gl.BYTE ) internalFormat = _gl.RG8I;
24316
+ if ( glType === _gl.SHORT ) internalFormat = _gl.RG16I;
24317
+ if ( glType === _gl.INT ) internalFormat = _gl.RG32I;
24318
+
24319
+ }
24320
+
24323
24321
  if ( glFormat === _gl.RGBA ) {
24324
24322
 
24325
24323
  const transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );
@@ -24467,18 +24465,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24467
24465
 
24468
24466
  function deallocateRenderTarget( renderTarget ) {
24469
24467
 
24470
- const texture = renderTarget.texture;
24471
-
24472
24468
  const renderTargetProperties = properties.get( renderTarget );
24473
- const textureProperties = properties.get( texture );
24474
-
24475
- if ( textureProperties.__webglTexture !== undefined ) {
24476
-
24477
- _gl.deleteTexture( textureProperties.__webglTexture );
24478
-
24479
- info.memory.textures --;
24480
-
24481
- }
24482
24469
 
24483
24470
  if ( renderTarget.depthTexture ) {
24484
24471
 
@@ -24533,27 +24520,24 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24533
24520
 
24534
24521
  }
24535
24522
 
24536
- if ( renderTarget.isWebGLMultipleRenderTargets ) {
24537
-
24538
- for ( let i = 0, il = texture.length; i < il; i ++ ) {
24539
-
24540
- const attachmentProperties = properties.get( texture[ i ] );
24523
+ const textures = renderTarget.textures;
24541
24524
 
24542
- if ( attachmentProperties.__webglTexture ) {
24525
+ for ( let i = 0, il = textures.length; i < il; i ++ ) {
24543
24526
 
24544
- _gl.deleteTexture( attachmentProperties.__webglTexture );
24527
+ const attachmentProperties = properties.get( textures[ i ] );
24545
24528
 
24546
- info.memory.textures --;
24529
+ if ( attachmentProperties.__webglTexture ) {
24547
24530
 
24548
- }
24531
+ _gl.deleteTexture( attachmentProperties.__webglTexture );
24549
24532
 
24550
- properties.remove( texture[ i ] );
24533
+ info.memory.textures --;
24551
24534
 
24552
24535
  }
24553
24536
 
24537
+ properties.remove( textures[ i ] );
24538
+
24554
24539
  }
24555
24540
 
24556
- properties.remove( texture );
24557
24541
  properties.remove( renderTarget );
24558
24542
 
24559
24543
  }
@@ -24717,6 +24701,14 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24717
24701
 
24718
24702
  function setTextureParameters( textureType, texture, supportsMips ) {
24719
24703
 
24704
+ if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false &&
24705
+ ( texture.magFilter === LinearFilter || texture.magFilter === LinearMipmapNearestFilter || texture.magFilter === NearestMipmapLinearFilter || texture.magFilter === LinearMipmapLinearFilter ||
24706
+ texture.minFilter === LinearFilter || texture.minFilter === LinearMipmapNearestFilter || texture.minFilter === NearestMipmapLinearFilter || texture.minFilter === LinearMipmapLinearFilter ) ) {
24707
+
24708
+ console.warn( 'THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.' );
24709
+
24710
+ }
24711
+
24720
24712
  if ( supportsMips ) {
24721
24713
 
24722
24714
  _gl.texParameteri( textureType, _gl.TEXTURE_WRAP_S, wrappingToGL[ texture.wrapS ] );
@@ -24768,8 +24760,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24768
24760
 
24769
24761
  if ( extensions.has( 'EXT_texture_filter_anisotropic' ) === true ) {
24770
24762
 
24771
- const extension = extensions.get( 'EXT_texture_filter_anisotropic' );
24772
-
24773
24763
  if ( texture.magFilter === NearestFilter ) return;
24774
24764
  if ( texture.minFilter !== NearestMipmapLinearFilter && texture.minFilter !== LinearMipmapLinearFilter ) return;
24775
24765
  if ( texture.type === FloatType && extensions.has( 'OES_texture_float_linear' ) === false ) return; // verify extension for WebGL 1 and WebGL 2
@@ -24777,6 +24767,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24777
24767
 
24778
24768
  if ( texture.anisotropy > 1 || properties.get( texture ).__currentAnisotropy ) {
24779
24769
 
24770
+ const extension = extensions.get( 'EXT_texture_filter_anisotropic' );
24780
24771
  _gl.texParameterf( textureType, extension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min( texture.anisotropy, capabilities.getMaxAnisotropy() ) );
24781
24772
  properties.get( texture ).__currentAnisotropy = texture.anisotropy;
24782
24773
 
@@ -24947,6 +24938,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24947
24938
 
24948
24939
  const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format );
24949
24940
  const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
24941
+ const dataReady = source.dataReady;
24950
24942
  const levels = getMipLevels( texture, image, supportsMips );
24951
24943
 
24952
24944
  if ( texture.isDepthTexture ) {
@@ -25059,7 +25051,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25059
25051
 
25060
25052
  if ( useTexStorage ) {
25061
25053
 
25062
- state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
25054
+ if ( dataReady ) {
25055
+
25056
+ state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
25057
+
25058
+ }
25063
25059
 
25064
25060
  } else {
25065
25061
 
@@ -25081,7 +25077,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25081
25077
 
25082
25078
  }
25083
25079
 
25084
- state.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );
25080
+ if ( dataReady ) {
25081
+
25082
+ state.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, image.width, image.height, glFormat, glType, image.data );
25083
+
25084
+ }
25085
25085
 
25086
25086
  } else {
25087
25087
 
@@ -25111,7 +25111,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25111
25111
 
25112
25112
  if ( useTexStorage ) {
25113
25113
 
25114
- state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );
25114
+ if ( dataReady ) {
25115
+
25116
+ state.compressedTexSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0 );
25117
+
25118
+ }
25115
25119
 
25116
25120
  } else {
25117
25121
 
@@ -25129,7 +25133,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25129
25133
 
25130
25134
  if ( useTexStorage ) {
25131
25135
 
25132
- state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data );
25136
+ if ( dataReady ) {
25137
+
25138
+ state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data );
25139
+
25140
+ }
25133
25141
 
25134
25142
  } else {
25135
25143
 
@@ -25159,7 +25167,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25159
25167
 
25160
25168
  if ( useTexStorage ) {
25161
25169
 
25162
- state.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
25170
+ if ( dataReady ) {
25171
+
25172
+ state.compressedTexSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
25173
+
25174
+ }
25163
25175
 
25164
25176
  } else {
25165
25177
 
@@ -25177,7 +25189,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25177
25189
 
25178
25190
  if ( useTexStorage ) {
25179
25191
 
25180
- state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
25192
+ if ( dataReady ) {
25193
+
25194
+ state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
25195
+
25196
+ }
25181
25197
 
25182
25198
  } else {
25183
25199
 
@@ -25201,7 +25217,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25201
25217
 
25202
25218
  }
25203
25219
 
25204
- state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
25220
+ if ( dataReady ) {
25221
+
25222
+ state.texSubImage3D( _gl.TEXTURE_2D_ARRAY, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
25223
+
25224
+ }
25205
25225
 
25206
25226
  } else {
25207
25227
 
@@ -25219,7 +25239,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25219
25239
 
25220
25240
  }
25221
25241
 
25222
- state.texSubImage3D( _gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
25242
+ if ( dataReady ) {
25243
+
25244
+ state.texSubImage3D( _gl.TEXTURE_3D, 0, 0, 0, 0, image.width, image.height, image.depth, glFormat, glType, image.data );
25245
+
25246
+ }
25223
25247
 
25224
25248
  } else {
25225
25249
 
@@ -25264,7 +25288,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25264
25288
 
25265
25289
  if ( useTexStorage && allocateMemory ) {
25266
25290
 
25267
- state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
25291
+ const dimensions = getDimensions( mipmaps[ 0 ] );
25292
+
25293
+ state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );
25268
25294
 
25269
25295
  }
25270
25296
 
@@ -25274,7 +25300,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25274
25300
 
25275
25301
  if ( useTexStorage ) {
25276
25302
 
25277
- state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap );
25303
+ if ( dataReady ) {
25304
+
25305
+ state.texSubImage2D( _gl.TEXTURE_2D, i, 0, 0, glFormat, glType, mipmap );
25306
+
25307
+ }
25278
25308
 
25279
25309
  } else {
25280
25310
 
@@ -25292,11 +25322,17 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25292
25322
 
25293
25323
  if ( allocateMemory ) {
25294
25324
 
25295
- state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, image.width, image.height );
25325
+ const dimensions = getDimensions( image );
25326
+
25327
+ state.texStorage2D( _gl.TEXTURE_2D, levels, glInternalFormat, dimensions.width, dimensions.height );
25296
25328
 
25297
25329
  }
25298
25330
 
25299
- state.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );
25331
+ if ( dataReady ) {
25332
+
25333
+ state.texSubImage2D( _gl.TEXTURE_2D, 0, 0, 0, glFormat, glType, image );
25334
+
25335
+ }
25300
25336
 
25301
25337
  } else {
25302
25338
 
@@ -25378,6 +25414,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25378
25414
 
25379
25415
  const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
25380
25416
  const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
25417
+ const dataReady = source.dataReady;
25381
25418
  let levels = getMipLevels( texture, image, supportsMips );
25382
25419
 
25383
25420
  setTextureParameters( _gl.TEXTURE_CUBE_MAP, texture, supportsMips );
@@ -25406,7 +25443,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25406
25443
 
25407
25444
  if ( useTexStorage ) {
25408
25445
 
25409
- state.compressedTexSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
25446
+ if ( dataReady ) {
25447
+
25448
+ state.compressedTexSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data );
25449
+
25450
+ }
25410
25451
 
25411
25452
  } else {
25412
25453
 
@@ -25424,7 +25465,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25424
25465
 
25425
25466
  if ( useTexStorage ) {
25426
25467
 
25427
- state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
25468
+ if ( dataReady ) {
25469
+
25470
+ state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data );
25471
+
25472
+ }
25428
25473
 
25429
25474
  } else {
25430
25475
 
@@ -25450,7 +25495,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25450
25495
 
25451
25496
  if ( mipmaps.length > 0 ) levels ++;
25452
25497
 
25453
- state.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, cubeImage[ 0 ].width, cubeImage[ 0 ].height );
25498
+ const dimensions = getDimensions( cubeImage[ 0 ] );
25499
+
25500
+ state.texStorage2D( _gl.TEXTURE_CUBE_MAP, levels, glInternalFormat, dimensions.width, dimensions.height );
25454
25501
 
25455
25502
  }
25456
25503
 
@@ -25460,7 +25507,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25460
25507
 
25461
25508
  if ( useTexStorage ) {
25462
25509
 
25463
- state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );
25510
+ if ( dataReady ) {
25511
+
25512
+ state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, cubeImage[ i ].width, cubeImage[ i ].height, glFormat, glType, cubeImage[ i ].data );
25513
+
25514
+ }
25464
25515
 
25465
25516
  } else {
25466
25517
 
@@ -25475,7 +25526,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25475
25526
 
25476
25527
  if ( useTexStorage ) {
25477
25528
 
25478
- state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );
25529
+ if ( dataReady ) {
25530
+
25531
+ state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, mipmapImage.width, mipmapImage.height, glFormat, glType, mipmapImage.data );
25532
+
25533
+ }
25479
25534
 
25480
25535
  } else {
25481
25536
 
@@ -25489,7 +25544,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25489
25544
 
25490
25545
  if ( useTexStorage ) {
25491
25546
 
25492
- state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );
25547
+ if ( dataReady ) {
25548
+
25549
+ state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, 0, 0, glFormat, glType, cubeImage[ i ] );
25550
+
25551
+ }
25493
25552
 
25494
25553
  } else {
25495
25554
 
@@ -25503,7 +25562,11 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25503
25562
 
25504
25563
  if ( useTexStorage ) {
25505
25564
 
25506
- state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );
25565
+ if ( dataReady ) {
25566
+
25567
+ state.texSubImage2D( _gl.TEXTURE_CUBE_MAP_POSITIVE_X + i, j + 1, 0, 0, glFormat, glType, mipmap.image[ i ] );
25568
+
25569
+ }
25507
25570
 
25508
25571
  } else {
25509
25572
 
@@ -25724,7 +25787,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25724
25787
 
25725
25788
  } else {
25726
25789
 
25727
- const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];
25790
+ const textures = renderTarget.textures;
25728
25791
 
25729
25792
  for ( let i = 0; i < textures.length; i ++ ) {
25730
25793
 
@@ -25936,7 +25999,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25936
25999
 
25937
26000
  renderTarget.addEventListener( 'dispose', onRenderTargetDispose );
25938
26001
 
25939
- if ( renderTarget.isWebGLMultipleRenderTargets !== true ) {
26002
+ const textures = renderTarget.textures;
26003
+
26004
+ const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
26005
+ const isMultipleRenderTargets = ( textures.length > 1 );
26006
+ const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
26007
+
26008
+ if ( ! isMultipleRenderTargets ) {
25940
26009
 
25941
26010
  if ( textureProperties.__webglTexture === undefined ) {
25942
26011
 
@@ -25949,10 +26018,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25949
26018
 
25950
26019
  }
25951
26020
 
25952
- const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
25953
- const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
25954
- const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
25955
-
25956
26021
  // Setup framebuffer
25957
26022
 
25958
26023
  if ( isCube ) {
@@ -26001,8 +26066,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26001
26066
 
26002
26067
  if ( capabilities.drawBuffers ) {
26003
26068
 
26004
- const textures = renderTarget.texture;
26005
-
26006
26069
  for ( let i = 0, il = textures.length; i < il; i ++ ) {
26007
26070
 
26008
26071
  const attachmentProperties = properties.get( textures[ i ] );
@@ -26027,8 +26090,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26027
26090
 
26028
26091
  if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
26029
26092
 
26030
- const textures = isMultipleRenderTargets ? texture : [ texture ];
26031
-
26032
26093
  renderTargetProperties.__webglMultisampledFramebuffer = _gl.createFramebuffer();
26033
26094
  renderTargetProperties.__webglColorRenderbuffer = [];
26034
26095
 
@@ -26101,8 +26162,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26101
26162
 
26102
26163
  } else if ( isMultipleRenderTargets ) {
26103
26164
 
26104
- const textures = renderTarget.texture;
26105
-
26106
26165
  for ( let i = 0, il = textures.length; i < il; i ++ ) {
26107
26166
 
26108
26167
  const attachment = textures[ i ];
@@ -26187,7 +26246,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26187
26246
 
26188
26247
  const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
26189
26248
 
26190
- const textures = renderTarget.isWebGLMultipleRenderTargets === true ? renderTarget.texture : [ renderTarget.texture ];
26249
+ const textures = renderTarget.textures;
26191
26250
 
26192
26251
  for ( let i = 0, il = textures.length; i < il; i ++ ) {
26193
26252
 
@@ -26212,14 +26271,14 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26212
26271
 
26213
26272
  if ( ( isWebGL2 && renderTarget.samples > 0 ) && useMultisampledRTT( renderTarget ) === false ) {
26214
26273
 
26215
- const textures = renderTarget.isWebGLMultipleRenderTargets ? renderTarget.texture : [ renderTarget.texture ];
26274
+ const textures = renderTarget.textures;
26216
26275
  const width = renderTarget.width;
26217
26276
  const height = renderTarget.height;
26218
26277
  let mask = _gl.COLOR_BUFFER_BIT;
26219
26278
  const invalidationArray = [];
26220
26279
  const depthStyle = renderTarget.stencilBuffer ? _gl.DEPTH_STENCIL_ATTACHMENT : _gl.DEPTH_ATTACHMENT;
26221
26280
  const renderTargetProperties = properties.get( renderTarget );
26222
- const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
26281
+ const isMultipleRenderTargets = ( textures.length > 1 );
26223
26282
 
26224
26283
  // If MRT we need to remove FBO attachments
26225
26284
  if ( isMultipleRenderTargets ) {
@@ -26403,6 +26462,31 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26403
26462
 
26404
26463
  }
26405
26464
 
26465
+ function getDimensions( image ) {
26466
+
26467
+ if ( typeof HTMLImageElement !== 'undefined' && image instanceof HTMLImageElement ) {
26468
+
26469
+ // if intrinsic data are not available, fallback to width/height
26470
+
26471
+ _imageDimensions.width = image.naturalWidth || image.width;
26472
+ _imageDimensions.height = image.naturalHeight || image.height;
26473
+
26474
+ } else if ( typeof VideoFrame !== 'undefined' && image instanceof VideoFrame ) {
26475
+
26476
+ _imageDimensions.width = image.displayWidth;
26477
+ _imageDimensions.height = image.displayHeight;
26478
+
26479
+ } else {
26480
+
26481
+ _imageDimensions.width = image.width;
26482
+ _imageDimensions.height = image.height;
26483
+
26484
+ }
26485
+
26486
+ return _imageDimensions;
26487
+
26488
+ }
26489
+
26406
26490
  //
26407
26491
 
26408
26492
  this.allocateTextureUnit = allocateTextureUnit;
@@ -27650,6 +27734,105 @@ class WebXRController {
27650
27734
 
27651
27735
  }
27652
27736
 
27737
+ const _occlusion_vertex = `
27738
+ void main() {
27739
+
27740
+ gl_Position = vec4( position, 1.0 );
27741
+
27742
+ }`;
27743
+
27744
+ const _occlusion_fragment = `
27745
+ uniform sampler2DArray depthColor;
27746
+ uniform float depthWidth;
27747
+ uniform float depthHeight;
27748
+
27749
+ void main() {
27750
+
27751
+ vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );
27752
+
27753
+ if ( coord.x >= 1.0 ) {
27754
+
27755
+ gl_FragDepthEXT = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;
27756
+
27757
+ } else {
27758
+
27759
+ gl_FragDepthEXT = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;
27760
+
27761
+ }
27762
+
27763
+ }`;
27764
+
27765
+ class WebXRDepthSensing {
27766
+
27767
+ constructor() {
27768
+
27769
+ this.texture = null;
27770
+ this.mesh = null;
27771
+
27772
+ this.depthNear = 0;
27773
+ this.depthFar = 0;
27774
+
27775
+ }
27776
+
27777
+ init( renderer, depthData, renderState ) {
27778
+
27779
+ if ( this.texture === null ) {
27780
+
27781
+ const texture = new Texture();
27782
+
27783
+ const texProps = renderer.properties.get( texture );
27784
+ texProps.__webglTexture = depthData.texture;
27785
+
27786
+ if ( ( depthData.depthNear != renderState.depthNear ) || ( depthData.depthFar != renderState.depthFar ) ) {
27787
+
27788
+ this.depthNear = depthData.depthNear;
27789
+ this.depthFar = depthData.depthFar;
27790
+
27791
+ }
27792
+
27793
+ this.texture = texture;
27794
+
27795
+ }
27796
+
27797
+ }
27798
+
27799
+ render( renderer, cameraXR ) {
27800
+
27801
+ if ( this.texture !== null ) {
27802
+
27803
+ if ( this.mesh === null ) {
27804
+
27805
+ const viewport = cameraXR.cameras[ 0 ].viewport;
27806
+ const material = new ShaderMaterial( {
27807
+ extensions: { fragDepth: true },
27808
+ vertexShader: _occlusion_vertex,
27809
+ fragmentShader: _occlusion_fragment,
27810
+ uniforms: {
27811
+ depthColor: { value: this.texture },
27812
+ depthWidth: { value: viewport.z },
27813
+ depthHeight: { value: viewport.w }
27814
+ }
27815
+ } );
27816
+
27817
+ this.mesh = new Mesh( new PlaneGeometry( 20, 20 ), material );
27818
+
27819
+ }
27820
+
27821
+ renderer.render( this.mesh, cameraXR );
27822
+
27823
+ }
27824
+
27825
+ }
27826
+
27827
+ reset() {
27828
+
27829
+ this.texture = null;
27830
+ this.mesh = null;
27831
+
27832
+ }
27833
+
27834
+ }
27835
+
27653
27836
  class WebXRManager extends EventDispatcher {
27654
27837
 
27655
27838
  constructor( renderer, gl, extensions, useMultiview ) {
@@ -27676,7 +27859,10 @@ class WebXRManager extends EventDispatcher {
27676
27859
  let glProjLayer = null;
27677
27860
  let glBaseLayer = null;
27678
27861
  let xrFrame = null;
27862
+
27863
+ const depthSensing = new WebXRDepthSensing();
27679
27864
  const attributes = gl.getContextAttributes();
27865
+
27680
27866
  let initialRenderTarget = null;
27681
27867
  let newRenderTarget = null;
27682
27868
 
@@ -27813,6 +27999,8 @@ class WebXRManager extends EventDispatcher {
27813
27999
  _currentDepthNear = null;
27814
28000
  _currentDepthFar = null;
27815
28001
 
28002
+ depthSensing.reset();
28003
+
27816
28004
  // restore framebuffer/rendering state
27817
28005
 
27818
28006
  renderer.setRenderTarget( initialRenderTarget );
@@ -28220,6 +28408,13 @@ class WebXRManager extends EventDispatcher {
28220
28408
 
28221
28409
  if ( session === null ) return;
28222
28410
 
28411
+ if ( depthSensing.texture !== null ) {
28412
+
28413
+ camera.near = depthSensing.depthNear;
28414
+ camera.far = depthSensing.depthFar;
28415
+
28416
+ }
28417
+
28223
28418
  cameraXR.near = cameraR.near = cameraL.near = camera.near;
28224
28419
  cameraXR.far = cameraR.far = cameraL.far = camera.far;
28225
28420
 
@@ -28235,6 +28430,15 @@ class WebXRManager extends EventDispatcher {
28235
28430
  _currentDepthNear = cameraXR.near;
28236
28431
  _currentDepthFar = cameraXR.far;
28237
28432
 
28433
+ cameraL.near = _currentDepthNear;
28434
+ cameraL.far = _currentDepthFar;
28435
+ cameraR.near = _currentDepthNear;
28436
+ cameraR.far = _currentDepthFar;
28437
+
28438
+ cameraL.updateProjectionMatrix();
28439
+ cameraR.updateProjectionMatrix();
28440
+ camera.updateProjectionMatrix();
28441
+
28238
28442
  }
28239
28443
 
28240
28444
  const cameras = cameraXR.cameras;
@@ -28337,6 +28541,12 @@ class WebXRManager extends EventDispatcher {
28337
28541
 
28338
28542
  };
28339
28543
 
28544
+ this.hasDepthSensing = function () {
28545
+
28546
+ return depthSensing.texture !== null;
28547
+
28548
+ };
28549
+
28340
28550
  // Animation Loop
28341
28551
 
28342
28552
  let onAnimationFrameCallback = null;
@@ -28429,6 +28639,22 @@ class WebXRManager extends EventDispatcher {
28429
28639
 
28430
28640
  }
28431
28641
 
28642
+ //
28643
+
28644
+ const enabledFeatures = session.enabledFeatures;
28645
+
28646
+ if ( enabledFeatures && enabledFeatures.includes( 'depth-sensing' ) ) {
28647
+
28648
+ const depthData = glBinding.getDepthInformation( views[ 0 ] );
28649
+
28650
+ if ( depthData && depthData.isValid && depthData.texture ) {
28651
+
28652
+ depthSensing.init( renderer, depthData, session.renderState );
28653
+
28654
+ }
28655
+
28656
+ }
28657
+
28432
28658
  }
28433
28659
 
28434
28660
  //
@@ -28446,6 +28672,8 @@ class WebXRManager extends EventDispatcher {
28446
28672
 
28447
28673
  }
28448
28674
 
28675
+ depthSensing.render( renderer, cameraXR );
28676
+
28449
28677
  if ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );
28450
28678
 
28451
28679
  if ( frame.detectedPlanes ) {
@@ -28474,6 +28702,9 @@ class WebXRManager extends EventDispatcher {
28474
28702
 
28475
28703
  }
28476
28704
 
28705
+ const _e1 = /*@__PURE__*/ new Euler();
28706
+ const _m1 = /*@__PURE__*/ new Matrix4();
28707
+
28477
28708
  function WebGLMaterials( renderer, properties ) {
28478
28709
 
28479
28710
  function refreshTransformUniform( map, uniform ) {
@@ -28682,12 +28913,30 @@ function WebGLMaterials( renderer, properties ) {
28682
28913
 
28683
28914
  }
28684
28915
 
28685
- const envMap = properties.get( material ).envMap;
28916
+ const materialProperties = properties.get( material );
28917
+
28918
+ const envMap = materialProperties.envMap;
28919
+ const envMapRotation = materialProperties.envMapRotation;
28686
28920
 
28687
28921
  if ( envMap ) {
28688
28922
 
28689
28923
  uniforms.envMap.value = envMap;
28690
28924
 
28925
+ _e1.copy( envMapRotation );
28926
+
28927
+ // accommodate left-handed frame
28928
+ _e1.x *= - 1; _e1.y *= - 1; _e1.z *= - 1;
28929
+
28930
+ if ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) {
28931
+
28932
+ // environment maps which are not cube render targets or PMREMs follow a different convention
28933
+ _e1.y *= - 1;
28934
+ _e1.z *= - 1;
28935
+
28936
+ }
28937
+
28938
+ uniforms.envMapRotation.value.setFromMatrix4( _m1.makeRotationFromEuler( _e1 ) );
28939
+
28691
28940
  uniforms.flipEnvMap.value = ( envMap.isCubeTexture && envMap.isRenderTargetTexture === false ) ? - 1 : 1;
28692
28941
 
28693
28942
  uniforms.reflectivity.value = material.reflectivity;
@@ -29858,7 +30107,7 @@ class WebGLRenderer {
29858
30107
 
29859
30108
  }
29860
30109
 
29861
- state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).floor() );
30110
+ state.viewport( _currentViewport.copy( _viewport ).multiplyScalar( _pixelRatio ).round() );
29862
30111
 
29863
30112
  };
29864
30113
 
@@ -29880,7 +30129,7 @@ class WebGLRenderer {
29880
30129
 
29881
30130
  }
29882
30131
 
29883
- state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).floor() );
30132
+ state.scissor( _currentScissor.copy( _scissor ).multiplyScalar( _pixelRatio ).round() );
29884
30133
 
29885
30134
  };
29886
30135
 
@@ -30576,7 +30825,11 @@ class WebGLRenderer {
30576
30825
 
30577
30826
  //
30578
30827
 
30579
- background.render( currentRenderList, scene );
30828
+ if ( xr.enabled === false || xr.isPresenting === false || xr.hasDepthSensing() === false ) {
30829
+
30830
+ background.render( currentRenderList, scene );
30831
+
30832
+ }
30580
30833
 
30581
30834
  // render scene
30582
30835
 
@@ -30994,6 +31247,7 @@ class WebGLRenderer {
30994
31247
  materialProperties.environment = material.isMeshStandardMaterial ? scene.environment : null;
30995
31248
  materialProperties.fog = scene.fog;
30996
31249
  materialProperties.envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || materialProperties.environment );
31250
+ materialProperties.envMapRotation = ( materialProperties.environment !== null && material.envMap === null ) ? scene.environmentRotation : material.envMapRotation;
30997
31251
 
30998
31252
  if ( programs === undefined ) {
30999
31253
 
@@ -31106,6 +31360,7 @@ class WebGLRenderer {
31106
31360
  materialProperties.batching = parameters.batching;
31107
31361
  materialProperties.instancing = parameters.instancing;
31108
31362
  materialProperties.instancingColor = parameters.instancingColor;
31363
+ materialProperties.instancingMorph = parameters.instancingMorph;
31109
31364
  materialProperties.skinning = parameters.skinning;
31110
31365
  materialProperties.morphTargets = parameters.morphTargets;
31111
31366
  materialProperties.morphNormals = parameters.morphNormals;
@@ -31219,6 +31474,14 @@ class WebGLRenderer {
31219
31474
 
31220
31475
  needsProgramChange = true;
31221
31476
 
31477
+ } else if ( object.isInstancedMesh && materialProperties.instancingMorph === true && object.morphTexture === null ) {
31478
+
31479
+ needsProgramChange = true;
31480
+
31481
+ } else if ( object.isInstancedMesh && materialProperties.instancingMorph === false && object.morphTexture !== null ) {
31482
+
31483
+ needsProgramChange = true;
31484
+
31222
31485
  } else if ( materialProperties.envMap !== envMap ) {
31223
31486
 
31224
31487
  needsProgramChange = true;
@@ -31864,8 +32127,8 @@ class WebGLRenderer {
31864
32127
 
31865
32128
  }
31866
32129
 
31867
- const width = sourceBox.max.x - sourceBox.min.x + 1;
31868
- const height = sourceBox.max.y - sourceBox.min.y + 1;
32130
+ const width = Math.round( sourceBox.max.x - sourceBox.min.x );
32131
+ const height = Math.round( sourceBox.max.y - sourceBox.min.y );
31869
32132
  const depth = sourceBox.max.z - sourceBox.min.z + 1;
31870
32133
  const glFormat = utils.convert( dstTexture.format );
31871
32134
  const glType = utils.convert( dstTexture.type );
@@ -31912,9 +32175,8 @@ class WebGLRenderer {
31912
32175
 
31913
32176
  } else {
31914
32177
 
31915
- if ( srcTexture.isCompressedArrayTexture ) {
32178
+ if ( dstTexture.isCompressedArrayTexture ) {
31916
32179
 
31917
- console.warn( 'THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.' );
31918
32180
  _gl.compressedTexSubImage3D( glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data );
31919
32181
 
31920
32182
  } else {
@@ -32003,20 +32265,6 @@ class WebGLRenderer {
32003
32265
 
32004
32266
  }
32005
32267
 
32006
- get outputEncoding() { // @deprecated, r152
32007
-
32008
- console.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
32009
- return this.outputColorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
32010
-
32011
- }
32012
-
32013
- set outputEncoding( encoding ) { // @deprecated, r152
32014
-
32015
- console.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
32016
- this.outputColorSpace = encoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
32017
-
32018
- }
32019
-
32020
32268
  get useLegacyLights() { // @deprecated, r155
32021
32269
 
32022
32270
  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.' );
@@ -32120,6 +32368,8 @@ class Scene extends Object3D {
32120
32368
 
32121
32369
  this.backgroundBlurriness = 0;
32122
32370
  this.backgroundIntensity = 1;
32371
+ this.backgroundRotation = new Euler();
32372
+ this.environmentRotation = new Euler();
32123
32373
 
32124
32374
  this.overrideMaterial = null;
32125
32375
 
@@ -32141,6 +32391,8 @@ class Scene extends Object3D {
32141
32391
 
32142
32392
  this.backgroundBlurriness = source.backgroundBlurriness;
32143
32393
  this.backgroundIntensity = source.backgroundIntensity;
32394
+ this.backgroundRotation.copy( source.backgroundRotation );
32395
+ this.environmentRotation.copy( source.environmentRotation );
32144
32396
 
32145
32397
  if ( source.overrideMaterial !== null ) this.overrideMaterial = source.overrideMaterial.clone();
32146
32398
 
@@ -32158,6 +32410,9 @@ class Scene extends Object3D {
32158
32410
  if ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;
32159
32411
  if ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;
32160
32412
 
32413
+ data.object.backgroundRotation = this.backgroundRotation.toArray();
32414
+ data.object.environmentRotation = this.environmentRotation.toArray();
32415
+
32161
32416
  return data;
32162
32417
 
32163
32418
  }
@@ -32194,7 +32449,7 @@ class InterleavedBuffer {
32194
32449
 
32195
32450
  get updateRange() {
32196
32451
 
32197
- console.warn( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
32452
+ warnOnce( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
32198
32453
  return this._updateRange;
32199
32454
 
32200
32455
  }
@@ -32409,6 +32664,26 @@ class InterleavedBufferAttribute {
32409
32664
 
32410
32665
  }
32411
32666
 
32667
+ getComponent( index, component ) {
32668
+
32669
+ let value = this.array[ index * this.data.stride + this.offset + component ];
32670
+
32671
+ if ( this.normalized ) value = denormalize( value, this.array );
32672
+
32673
+ return value;
32674
+
32675
+ }
32676
+
32677
+ setComponent( index, component, value ) {
32678
+
32679
+ if ( this.normalized ) value = normalize( value, this.array );
32680
+
32681
+ this.data.array[ index * this.data.stride + this.offset + component ] = value;
32682
+
32683
+ return this;
32684
+
32685
+ }
32686
+
32412
32687
  setX( index, x ) {
32413
32688
 
32414
32689
  if ( this.normalized ) x = normalize( x, this.array );
@@ -33324,14 +33599,6 @@ class SkinnedMesh extends Mesh {
33324
33599
 
33325
33600
  }
33326
33601
 
33327
- boneTransform( index, vector ) { // @deprecated, r151
33328
-
33329
- console.warn( 'THREE.SkinnedMesh: .boneTransform() was renamed to .applyBoneTransform() in r151.' );
33330
- return this.applyBoneTransform( index, vector );
33331
-
33332
- }
33333
-
33334
-
33335
33602
  }
33336
33603
 
33337
33604
  class Bone extends Object3D {
@@ -33689,6 +33956,7 @@ class InstancedMesh extends Mesh {
33689
33956
 
33690
33957
  this.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );
33691
33958
  this.instanceColor = null;
33959
+ this.morphTexture = null;
33692
33960
 
33693
33961
  this.count = count;
33694
33962
 
@@ -33794,6 +34062,24 @@ class InstancedMesh extends Mesh {
33794
34062
 
33795
34063
  }
33796
34064
 
34065
+ getMorphAt( index, object ) {
34066
+
34067
+ const objectInfluences = object.morphTargetInfluences;
34068
+
34069
+ const array = this.morphTexture.source.data.data;
34070
+
34071
+ const len = objectInfluences.length + 1; // All influences + the baseInfluenceSum
34072
+
34073
+ const dataIndex = index * len + 1; // Skip the baseInfluenceSum at the beginning
34074
+
34075
+ for ( let i = 0; i < objectInfluences.length; i ++ ) {
34076
+
34077
+ objectInfluences[ i ] = array[ dataIndex + i ];
34078
+
34079
+ }
34080
+
34081
+ }
34082
+
33797
34083
  raycast( raycaster, intersects ) {
33798
34084
 
33799
34085
  const matrixWorld = this.matrixWorld;
@@ -33864,6 +34150,38 @@ class InstancedMesh extends Mesh {
33864
34150
 
33865
34151
  }
33866
34152
 
34153
+ setMorphAt( index, object ) {
34154
+
34155
+ const objectInfluences = object.morphTargetInfluences;
34156
+
34157
+ const len = objectInfluences.length + 1; // morphBaseInfluence + all influences
34158
+
34159
+ if ( this.morphTexture === null ) {
34160
+
34161
+ this.morphTexture = new DataTexture( new Float32Array( len * this.count ), len, this.count, RedFormat, FloatType );
34162
+
34163
+ }
34164
+
34165
+ const array = this.morphTexture.source.data.data;
34166
+
34167
+ let morphInfluencesSum = 0;
34168
+
34169
+ for ( let i = 0; i < objectInfluences.length; i ++ ) {
34170
+
34171
+ morphInfluencesSum += objectInfluences[ i ];
34172
+
34173
+ }
34174
+
34175
+ const morphBaseInfluence = this.geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
34176
+
34177
+ const dataIndex = len * index;
34178
+
34179
+ array[ dataIndex ] = morphBaseInfluence;
34180
+
34181
+ array.set( objectInfluences, dataIndex + 1 );
34182
+
34183
+ }
34184
+
33867
34185
  updateMorphTargets() {
33868
34186
 
33869
34187
  }
@@ -33934,7 +34252,7 @@ class MultiDrawRenderList {
33934
34252
  }
33935
34253
 
33936
34254
  const ID_ATTR_NAME = 'batchId';
33937
- const _matrix = /*@__PURE__*/ new Matrix4();
34255
+ const _matrix$1 = /*@__PURE__*/ new Matrix4();
33938
34256
  const _invMatrixWorld = /*@__PURE__*/ new Matrix4();
33939
34257
  const _identityMatrix = /*@__PURE__*/ new Matrix4();
33940
34258
  const _projScreenMatrix$2 = /*@__PURE__*/ new Matrix4();
@@ -34157,8 +34475,8 @@ class BatchedMesh extends Mesh {
34157
34475
 
34158
34476
  if ( active[ i ] === false ) continue;
34159
34477
 
34160
- this.getMatrixAt( i, _matrix );
34161
- this.getBoundingBoxAt( i, _box$1 ).applyMatrix4( _matrix );
34478
+ this.getMatrixAt( i, _matrix$1 );
34479
+ this.getBoundingBoxAt( i, _box$1 ).applyMatrix4( _matrix$1 );
34162
34480
  boundingBox.union( _box$1 );
34163
34481
 
34164
34482
  }
@@ -34182,8 +34500,8 @@ class BatchedMesh extends Mesh {
34182
34500
 
34183
34501
  if ( active[ i ] === false ) continue;
34184
34502
 
34185
- this.getMatrixAt( i, _matrix );
34186
- this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );
34503
+ this.getMatrixAt( i, _matrix$1 );
34504
+ this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix$1 );
34187
34505
  boundingSphere.union( _sphere$2 );
34188
34506
 
34189
34507
  }
@@ -34464,7 +34782,7 @@ class BatchedMesh extends Mesh {
34464
34782
  const active = this._active;
34465
34783
  if ( active[ id ] === false ) {
34466
34784
 
34467
- return this;
34785
+ return null;
34468
34786
 
34469
34787
  }
34470
34788
 
@@ -34507,7 +34825,7 @@ class BatchedMesh extends Mesh {
34507
34825
  const active = this._active;
34508
34826
  if ( active[ id ] === false ) {
34509
34827
 
34510
- return this;
34828
+ return null;
34511
34829
 
34512
34830
  }
34513
34831
 
@@ -34758,6 +35076,7 @@ class BatchedMesh extends Mesh {
34758
35076
  const index = geometry.getIndex();
34759
35077
  const bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;
34760
35078
 
35079
+ const active = this._active;
34761
35080
  const visibility = this._visibility;
34762
35081
  const multiDrawStarts = this._multiDrawStarts;
34763
35082
  const multiDrawCounts = this._multiDrawCounts;
@@ -34772,7 +35091,7 @@ class BatchedMesh extends Mesh {
34772
35091
  .multiply( this.matrixWorld );
34773
35092
  _frustum.setFromProjectionMatrix(
34774
35093
  _projScreenMatrix$2,
34775
- renderer.isWebGPURenderer ? WebGPUCoordinateSystem : WebGLCoordinateSystem
35094
+ renderer.coordinateSystem
34776
35095
  );
34777
35096
 
34778
35097
  }
@@ -34786,11 +35105,11 @@ class BatchedMesh extends Mesh {
34786
35105
 
34787
35106
  for ( let i = 0, l = visibility.length; i < l; i ++ ) {
34788
35107
 
34789
- if ( visibility[ i ] ) {
35108
+ if ( visibility[ i ] && active[ i ] ) {
34790
35109
 
34791
35110
  // get the bounds in world space
34792
- this.getMatrixAt( i, _matrix );
34793
- this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );
35111
+ this.getMatrixAt( i, _matrix$1 );
35112
+ this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix$1 );
34794
35113
 
34795
35114
  // determine whether the batched geometry is within the frustum
34796
35115
  let culled = false;
@@ -34840,15 +35159,15 @@ class BatchedMesh extends Mesh {
34840
35159
 
34841
35160
  for ( let i = 0, l = visibility.length; i < l; i ++ ) {
34842
35161
 
34843
- if ( visibility[ i ] ) {
35162
+ if ( visibility[ i ] && active[ i ] ) {
34844
35163
 
34845
35164
  // determine whether the batched geometry is within the frustum
34846
35165
  let culled = false;
34847
35166
  if ( perObjectFrustumCulled ) {
34848
35167
 
34849
35168
  // get the bounds in world space
34850
- this.getMatrixAt( i, _matrix );
34851
- this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );
35169
+ this.getMatrixAt( i, _matrix$1 );
35170
+ this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix$1 );
34852
35171
  culled = ! _frustum.intersectsSphere( _sphere$2 );
34853
35172
 
34854
35173
  }
@@ -35977,9 +36296,9 @@ class EllipseCurve extends Curve {
35977
36296
 
35978
36297
  }
35979
36298
 
35980
- getPoint( t, optionalTarget ) {
36299
+ getPoint( t, optionalTarget = new Vector2() ) {
35981
36300
 
35982
- const point = optionalTarget || new Vector2();
36301
+ const point = optionalTarget;
35983
36302
 
35984
36303
  const twoPi = Math.PI * 2;
35985
36304
  let deltaAngle = this.aEndAngle - this.aStartAngle;
@@ -41636,6 +41955,7 @@ class MeshStandardMaterial extends Material {
41636
41955
  this.alphaMap = null;
41637
41956
 
41638
41957
  this.envMap = null;
41958
+ this.envMapRotation = new Euler();
41639
41959
  this.envMapIntensity = 1.0;
41640
41960
 
41641
41961
  this.wireframe = false;
@@ -41691,6 +42011,7 @@ class MeshStandardMaterial extends Material {
41691
42011
  this.alphaMap = source.alphaMap;
41692
42012
 
41693
42013
  this.envMap = source.envMap;
42014
+ this.envMapRotation.copy( source.envMapRotation );
41694
42015
  this.envMapIntensity = source.envMapIntensity;
41695
42016
 
41696
42017
  this.wireframe = source.wireframe;
@@ -41968,6 +42289,7 @@ class MeshPhongMaterial extends Material {
41968
42289
  this.alphaMap = null;
41969
42290
 
41970
42291
  this.envMap = null;
42292
+ this.envMapRotation = new Euler();
41971
42293
  this.combine = MultiplyOperation;
41972
42294
  this.reflectivity = 1;
41973
42295
  this.refractionRatio = 0.98;
@@ -42021,6 +42343,7 @@ class MeshPhongMaterial extends Material {
42021
42343
  this.alphaMap = source.alphaMap;
42022
42344
 
42023
42345
  this.envMap = source.envMap;
42346
+ this.envMapRotation.copy( source.envMapRotation );
42024
42347
  this.combine = source.combine;
42025
42348
  this.reflectivity = source.reflectivity;
42026
42349
  this.refractionRatio = source.refractionRatio;
@@ -42232,6 +42555,7 @@ class MeshLambertMaterial extends Material {
42232
42555
  this.alphaMap = null;
42233
42556
 
42234
42557
  this.envMap = null;
42558
+ this.envMapRotation = new Euler();
42235
42559
  this.combine = MultiplyOperation;
42236
42560
  this.reflectivity = 1;
42237
42561
  this.refractionRatio = 0.98;
@@ -42283,6 +42607,7 @@ class MeshLambertMaterial extends Material {
42283
42607
  this.alphaMap = source.alphaMap;
42284
42608
 
42285
42609
  this.envMap = source.envMap;
42610
+ this.envMapRotation.copy( source.envMapRotation );
42286
42611
  this.combine = source.combine;
42287
42612
  this.reflectivity = source.reflectivity;
42288
42613
  this.refractionRatio = source.refractionRatio;
@@ -45125,10 +45450,6 @@ class DataTextureLoader extends Loader {
45125
45450
 
45126
45451
  texture.colorSpace = texData.colorSpace;
45127
45452
 
45128
- } else if ( texData.encoding !== undefined ) { // @deprecated, r152
45129
-
45130
- texture.encoding = texData.encoding;
45131
-
45132
45453
  }
45133
45454
 
45134
45455
  if ( texData.flipY !== undefined ) {
@@ -46364,6 +46685,7 @@ class MaterialLoader extends Loader {
46364
46685
  if ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );
46365
46686
 
46366
46687
  if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );
46688
+ if ( json.envMapRotation !== undefined ) material.envMapRotation.fromArray( json.envMapRotation );
46367
46689
  if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;
46368
46690
 
46369
46691
  if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;
@@ -47359,7 +47681,6 @@ class ObjectLoader extends Loader {
47359
47681
  if ( data.internalFormat !== undefined ) texture.internalFormat = data.internalFormat;
47360
47682
  if ( data.type !== undefined ) texture.type = data.type;
47361
47683
  if ( data.colorSpace !== undefined ) texture.colorSpace = data.colorSpace;
47362
- if ( data.encoding !== undefined ) texture.encoding = data.encoding; // @deprecated, r152
47363
47684
 
47364
47685
  if ( data.minFilter !== undefined ) texture.minFilter = parseConstant( data.minFilter, TEXTURE_FILTER );
47365
47686
  if ( data.magFilter !== undefined ) texture.magFilter = parseConstant( data.magFilter, TEXTURE_FILTER );
@@ -47498,6 +47819,8 @@ class ObjectLoader extends Loader {
47498
47819
 
47499
47820
  if ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;
47500
47821
  if ( data.backgroundIntensity !== undefined ) object.backgroundIntensity = data.backgroundIntensity;
47822
+ if ( data.backgroundRotation !== undefined ) object.backgroundRotation.fromArray( data.backgroundRotation );
47823
+ if ( data.environmentRotation !== undefined ) object.environmentRotation.fromArray( data.environmentRotation );
47501
47824
 
47502
47825
  break;
47503
47826
 
@@ -48616,9 +48939,7 @@ class Audio extends Object3D {
48616
48939
 
48617
48940
  this.detune = value;
48618
48941
 
48619
- if ( this.source.detune === undefined ) return; // only set detune when available
48620
-
48621
- if ( this.isPlaying === true ) {
48942
+ if ( this.isPlaying === true && this.source.detune !== undefined ) {
48622
48943
 
48623
48944
  this.source.detune.setTargetAtTime( this.detune, this.context.currentTime, 0.01 );
48624
48945
 
@@ -52008,6 +52329,8 @@ class GLBufferAttribute {
52008
52329
 
52009
52330
  }
52010
52331
 
52332
+ const _matrix = /*@__PURE__*/ new Matrix4();
52333
+
52011
52334
  class Raycaster {
52012
52335
 
52013
52336
  constructor( origin, direction, near = 0, far = Infinity ) {
@@ -52060,9 +52383,20 @@ class Raycaster {
52060
52383
 
52061
52384
  }
52062
52385
 
52386
+ setFromXRController( controller ) {
52387
+
52388
+ _matrix.identity().extractRotation( controller.matrixWorld );
52389
+
52390
+ this.ray.origin.setFromMatrixPosition( controller.matrixWorld );
52391
+ this.ray.direction.set( 0, 0, - 1 ).applyMatrix4( _matrix );
52392
+
52393
+ return this;
52394
+
52395
+ }
52396
+
52063
52397
  intersectObject( object, recursive = true, intersects = [] ) {
52064
52398
 
52065
- intersectObject( object, this, intersects, recursive );
52399
+ intersect( object, this, intersects, recursive );
52066
52400
 
52067
52401
  intersects.sort( ascSort );
52068
52402
 
@@ -52074,7 +52408,7 @@ class Raycaster {
52074
52408
 
52075
52409
  for ( let i = 0, l = objects.length; i < l; i ++ ) {
52076
52410
 
52077
- intersectObject( objects[ i ], this, intersects, recursive );
52411
+ intersect( objects[ i ], this, intersects, recursive );
52078
52412
 
52079
52413
  }
52080
52414
 
@@ -52092,7 +52426,7 @@ function ascSort( a, b ) {
52092
52426
 
52093
52427
  }
52094
52428
 
52095
- function intersectObject( object, raycaster, intersects, recursive ) {
52429
+ function intersect( object, raycaster, intersects, recursive ) {
52096
52430
 
52097
52431
  if ( object.layers.test( raycaster.layers ) ) {
52098
52432
 
@@ -52106,7 +52440,7 @@ function intersectObject( object, raycaster, intersects, recursive ) {
52106
52440
 
52107
52441
  for ( let i = 0, l = children.length; i < l; i ++ ) {
52108
52442
 
52109
- intersectObject( children[ i ], raycaster, intersects, true );
52443
+ intersect( children[ i ], raycaster, intersects, true );
52110
52444
 
52111
52445
  }
52112
52446
 
@@ -52580,7 +52914,6 @@ class SpotLightHelper extends Object3D {
52580
52914
 
52581
52915
  this.light = light;
52582
52916
 
52583
- this.matrix = light.matrixWorld;
52584
52917
  this.matrixAutoUpdate = false;
52585
52918
 
52586
52919
  this.color = color;
@@ -52632,6 +52965,24 @@ class SpotLightHelper extends Object3D {
52632
52965
  this.light.updateWorldMatrix( true, false );
52633
52966
  this.light.target.updateWorldMatrix( true, false );
52634
52967
 
52968
+ // update the local matrix based on the parent and light target transforms
52969
+ if ( this.parent ) {
52970
+
52971
+ this.parent.updateWorldMatrix( true );
52972
+
52973
+ this.matrix
52974
+ .copy( this.parent.matrixWorld )
52975
+ .invert()
52976
+ .multiply( this.light.matrixWorld );
52977
+
52978
+ } else {
52979
+
52980
+ this.matrix.copy( this.light.matrixWorld );
52981
+
52982
+ }
52983
+
52984
+ this.matrixWorld.copy( this.light.matrixWorld );
52985
+
52635
52986
  const coneLength = this.light.distance ? this.light.distance : 1000;
52636
52987
  const coneWidth = coneLength * Math.tan( this.light.angle );
52637
52988
 
@@ -54072,6 +54423,26 @@ class ShapePath {
54072
54423
 
54073
54424
  }
54074
54425
 
54426
+ class WebGLMultipleRenderTargets extends WebGLRenderTarget { // @deprecated, r162
54427
+
54428
+ constructor( width = 1, height = 1, count = 1, options = {} ) {
54429
+
54430
+ console.warn( 'THREE.WebGLMultipleRenderTargets has been deprecated and will be removed in r172. Use THREE.WebGLRenderTarget and set the "count" parameter to enable MRT.' );
54431
+
54432
+ super( width, height, { ...options, count } );
54433
+
54434
+ this.isWebGLMultipleRenderTargets = true;
54435
+
54436
+ }
54437
+
54438
+ get texture() {
54439
+
54440
+ return this.textures;
54441
+
54442
+ }
54443
+
54444
+ }
54445
+
54075
54446
  if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
54076
54447
 
54077
54448
  __THREE_DEVTOOLS__.dispatchEvent( new CustomEvent( 'register', { detail: {
@@ -54211,7 +54582,6 @@ exports.ExtrudeGeometry = ExtrudeGeometry;
54211
54582
  exports.FileLoader = FileLoader;
54212
54583
  exports.Float16BufferAttribute = Float16BufferAttribute;
54213
54584
  exports.Float32BufferAttribute = Float32BufferAttribute;
54214
- exports.Float64BufferAttribute = Float64BufferAttribute;
54215
54585
  exports.FloatType = FloatType;
54216
54586
  exports.Fog = Fog;
54217
54587
  exports.FogExp2 = FogExp2;
@@ -54275,7 +54645,6 @@ exports.LineDashedMaterial = LineDashedMaterial;
54275
54645
  exports.LineLoop = LineLoop;
54276
54646
  exports.LineSegments = LineSegments;
54277
54647
  exports.LinearDisplayP3ColorSpace = LinearDisplayP3ColorSpace;
54278
- exports.LinearEncoding = LinearEncoding;
54279
54648
  exports.LinearFilter = LinearFilter;
54280
54649
  exports.LinearInterpolant = LinearInterpolant;
54281
54650
  exports.LinearMipMapLinearFilter = LinearMipMapLinearFilter;
@@ -54321,6 +54690,7 @@ exports.NearestMipMapLinearFilter = NearestMipMapLinearFilter;
54321
54690
  exports.NearestMipMapNearestFilter = NearestMipMapNearestFilter;
54322
54691
  exports.NearestMipmapLinearFilter = NearestMipmapLinearFilter;
54323
54692
  exports.NearestMipmapNearestFilter = NearestMipmapNearestFilter;
54693
+ exports.NeutralToneMapping = NeutralToneMapping;
54324
54694
  exports.NeverCompare = NeverCompare;
54325
54695
  exports.NeverDepth = NeverDepth;
54326
54696
  exports.NeverStencilFunc = NeverStencilFunc;
@@ -54469,7 +54839,6 @@ exports.TriangleFanDrawMode = TriangleFanDrawMode;
54469
54839
  exports.TriangleStripDrawMode = TriangleStripDrawMode;
54470
54840
  exports.TrianglesDrawMode = TrianglesDrawMode;
54471
54841
  exports.TubeGeometry = TubeGeometry;
54472
- exports.TwoPassDoubleSide = TwoPassDoubleSide;
54473
54842
  exports.UVMapping = UVMapping;
54474
54843
  exports.Uint16BufferAttribute = Uint16BufferAttribute;
54475
54844
  exports.Uint32BufferAttribute = Uint32BufferAttribute;
@@ -54509,4 +54878,3 @@ exports.ZeroSlopeEnding = ZeroSlopeEnding;
54509
54878
  exports.ZeroStencilOp = ZeroStencilOp;
54510
54879
  exports._SRGBAFormat = _SRGBAFormat;
54511
54880
  exports.createCanvasElement = createCanvasElement;
54512
- exports.sRGBEncoding = sRGBEncoding;