super-three 0.158.0 → 0.160.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 (191) hide show
  1. package/build/three.cjs +1719 -379
  2. package/build/three.js +1719 -379
  3. package/build/three.min.js +1 -1
  4. package/build/three.module.js +1718 -380
  5. package/build/three.module.min.js +1 -1
  6. package/examples/jsm/Addons.js +2 -1
  7. package/examples/jsm/controls/OrbitControls.js +50 -40
  8. package/examples/jsm/csm/CSMShader.js +52 -47
  9. package/examples/jsm/exporters/GLTFExporter.js +79 -1
  10. package/examples/jsm/exporters/USDZExporter.js +27 -19
  11. package/examples/jsm/helpers/TextureHelper.js +237 -0
  12. package/examples/jsm/interactive/HTMLMesh.js +9 -2
  13. package/examples/jsm/lines/LineMaterial.js +16 -33
  14. package/examples/jsm/loaders/ColladaLoader.js +0 -6
  15. package/examples/jsm/loaders/DRACOLoader.js +4 -3
  16. package/examples/jsm/loaders/FBXLoader.js +294 -124
  17. package/examples/jsm/loaders/GLTFLoader.js +71 -3
  18. package/examples/jsm/loaders/MaterialXLoader.js +73 -54
  19. package/examples/jsm/loaders/NRRDLoader.js +0 -13
  20. package/examples/jsm/loaders/SVGLoader.js +4 -4
  21. package/examples/jsm/loaders/USDZLoader.js +3 -17
  22. package/examples/jsm/math/Octree.js +15 -4
  23. package/examples/jsm/misc/Timer.js +119 -0
  24. package/examples/jsm/misc/TubePainter.js +3 -6
  25. package/examples/jsm/modifiers/CurveModifier.js +20 -2
  26. package/examples/jsm/nodes/Nodes.js +11 -7
  27. package/examples/jsm/nodes/accessors/CameraNode.js +18 -2
  28. package/examples/jsm/nodes/accessors/CubeTextureNode.js +5 -73
  29. package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +11 -2
  30. package/examples/jsm/nodes/accessors/ModelNode.js +1 -1
  31. package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +12 -3
  32. package/examples/jsm/nodes/accessors/MorphNode.js +191 -16
  33. package/examples/jsm/nodes/accessors/ReferenceNode.js +25 -1
  34. package/examples/jsm/nodes/accessors/TextureNode.js +122 -36
  35. package/examples/jsm/nodes/code/CodeNode.js +3 -3
  36. package/examples/jsm/nodes/core/AttributeNode.js +7 -1
  37. package/examples/jsm/nodes/core/CacheNode.js +4 -1
  38. package/examples/jsm/nodes/core/ConstNode.js +1 -1
  39. package/examples/jsm/nodes/core/Node.js +6 -3
  40. package/examples/jsm/nodes/core/NodeBuilder.js +84 -27
  41. package/examples/jsm/nodes/core/NodeFrame.js +10 -8
  42. package/examples/jsm/nodes/core/NodeUniform.js +12 -0
  43. package/examples/jsm/nodes/core/NodeUtils.js +3 -7
  44. package/examples/jsm/nodes/core/OutputStructNode.js +3 -3
  45. package/examples/jsm/nodes/core/PropertyNode.js +17 -2
  46. package/examples/jsm/nodes/core/StructTypeNode.js +4 -4
  47. package/examples/jsm/nodes/core/UniformGroup.js +13 -0
  48. package/examples/jsm/nodes/core/UniformGroupNode.js +36 -0
  49. package/examples/jsm/nodes/core/UniformNode.js +17 -0
  50. package/examples/jsm/nodes/core/VarNode.js +2 -0
  51. package/examples/jsm/nodes/core/VaryingNode.js +1 -7
  52. package/examples/jsm/nodes/display/BumpMapNode.js +1 -1
  53. package/examples/jsm/nodes/display/ColorAdjustmentNode.js +6 -10
  54. package/examples/jsm/nodes/display/GaussianBlurNode.js +170 -0
  55. package/examples/jsm/nodes/display/PassNode.js +182 -0
  56. package/examples/jsm/nodes/display/ViewportDepthNode.js +31 -3
  57. package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +2 -2
  58. package/examples/jsm/nodes/display/ViewportNode.js +5 -8
  59. package/examples/jsm/nodes/functions/PhysicalLightingModel.js +1 -1
  60. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +52 -17
  61. package/examples/jsm/nodes/lighting/EnvironmentNode.js +8 -12
  62. package/examples/jsm/nodes/lighting/LightsNode.js +34 -32
  63. package/examples/jsm/nodes/materials/InstancedPointsNodeMaterial.js +1 -1
  64. package/examples/jsm/nodes/materials/Line2NodeMaterial.js +12 -12
  65. package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +1 -0
  66. package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +1 -1
  67. package/examples/jsm/nodes/materials/NodeMaterial.js +66 -41
  68. package/examples/jsm/nodes/materials/PointsNodeMaterial.js +0 -10
  69. package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +0 -7
  70. package/examples/jsm/nodes/materialx/MaterialXNodes.js +10 -10
  71. package/examples/jsm/nodes/materialx/lib/mx_hsv.js +128 -54
  72. package/examples/jsm/nodes/materialx/lib/mx_noise.js +1430 -618
  73. package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +24 -14
  74. package/examples/jsm/nodes/math/MathNode.js +2 -0
  75. package/examples/jsm/nodes/math/OperatorNode.js +19 -6
  76. package/examples/jsm/nodes/shadernode/ShaderNode.js +32 -3
  77. package/examples/jsm/nodes/utils/FunctionOverloadingNode.js +95 -0
  78. package/examples/jsm/nodes/utils/RemapNode.js +2 -2
  79. package/examples/jsm/nodes/utils/SplitNode.js +8 -2
  80. package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +3 -3
  81. package/examples/jsm/objects/QuadMesh.js +60 -0
  82. package/examples/jsm/postprocessing/GTAOPass.js +572 -0
  83. package/examples/jsm/postprocessing/OutputPass.js +2 -0
  84. package/examples/jsm/renderers/common/Animation.js +10 -21
  85. package/examples/jsm/renderers/common/Backend.js +19 -3
  86. package/examples/jsm/renderers/common/Background.js +20 -22
  87. package/examples/jsm/renderers/common/Bindings.js +30 -21
  88. package/examples/jsm/renderers/common/ChainMap.js +3 -3
  89. package/examples/jsm/renderers/common/Color4.js +37 -0
  90. package/examples/jsm/renderers/common/Geometries.js +4 -4
  91. package/examples/jsm/renderers/common/Info.js +12 -2
  92. package/examples/jsm/renderers/common/Pipelines.js +3 -51
  93. package/examples/jsm/renderers/common/PostProcessing.js +25 -0
  94. package/examples/jsm/renderers/common/RenderContext.js +1 -1
  95. package/examples/jsm/renderers/common/RenderContexts.js +1 -1
  96. package/examples/jsm/renderers/common/RenderObject.js +13 -1
  97. package/examples/jsm/renderers/common/RenderObjects.js +4 -2
  98. package/examples/jsm/renderers/common/Renderer.js +137 -37
  99. package/examples/jsm/renderers/common/StorageTexture.js +1 -0
  100. package/examples/jsm/renderers/common/Textures.js +4 -1
  101. package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +10 -2
  102. package/examples/jsm/renderers/common/nodes/NodeUniformsGroup.js +44 -0
  103. package/examples/jsm/renderers/common/nodes/Nodes.js +74 -7
  104. package/examples/jsm/renderers/webgl/WebGLBackend.js +91 -33
  105. package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +100 -31
  106. package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +57 -5
  107. package/examples/jsm/renderers/webgl/utils/WebGLCapabilities.js +36 -0
  108. package/examples/jsm/renderers/webgl/utils/WebGLExtensions.js +11 -1
  109. package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +71 -2
  110. package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +42 -0
  111. package/examples/jsm/renderers/webgl-legacy/nodes/SlotNode.js +1 -1
  112. package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodeBuilder.js +33 -3
  113. package/examples/jsm/renderers/webgl-legacy/nodes/WebGLNodes.js +4 -14
  114. package/examples/jsm/renderers/webgpu/WebGPUBackend.js +186 -137
  115. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +1 -1
  116. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +209 -90
  117. package/examples/jsm/renderers/webgpu/utils/WebGPUAttributeUtils.js +15 -10
  118. package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +11 -3
  119. package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +2 -3
  120. package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +88 -6
  121. package/examples/jsm/shaders/FXAAShader.js +133 -133
  122. package/examples/jsm/shaders/GTAOShader.js +424 -0
  123. package/examples/jsm/shaders/OutputShader.js +4 -0
  124. package/examples/jsm/shaders/PoissonDenoiseShader.js +226 -0
  125. package/examples/jsm/shaders/SAOShader.js +2 -3
  126. package/examples/jsm/shaders/SSAOShader.js +2 -3
  127. package/examples/jsm/transpiler/AST.js +40 -1
  128. package/examples/jsm/transpiler/GLSLDecoder.js +50 -8
  129. package/examples/jsm/transpiler/ShaderToyDecoder.js +4 -4
  130. package/examples/jsm/transpiler/TSLEncoder.js +124 -20
  131. package/examples/jsm/utils/SortUtils.js +158 -0
  132. package/examples/jsm/utils/TextureUtils.js +33 -21
  133. package/examples/jsm/webxr/ARButton.js +14 -0
  134. package/examples/jsm/webxr/VRButton.js +23 -8
  135. package/examples/jsm/webxr/XRButton.js +25 -11
  136. package/package.json +5 -6
  137. package/src/Three.js +1 -0
  138. package/src/constants.js +2 -1
  139. package/src/core/BufferAttribute.js +21 -2
  140. package/src/core/InterleavedBuffer.js +21 -1
  141. package/src/core/Object3D.js +60 -12
  142. package/src/core/UniformsGroup.js +7 -1
  143. package/src/extras/curves/LineCurve3.js +4 -0
  144. package/src/loaders/AudioLoader.js +1 -1
  145. package/src/loaders/BufferGeometryLoader.js +0 -7
  146. package/src/loaders/ImageBitmapLoader.js +25 -1
  147. package/src/loaders/ObjectLoader.js +49 -0
  148. package/src/materials/ShaderMaterial.js +2 -1
  149. package/src/math/ColorManagement.js +0 -16
  150. package/src/math/Quaternion.js +5 -4
  151. package/src/math/Sphere.js +2 -0
  152. package/src/math/Triangle.js +17 -5
  153. package/src/objects/BatchedMesh.js +1020 -0
  154. package/src/objects/Skeleton.js +1 -3
  155. package/src/renderers/WebGL3DRenderTarget.js +2 -2
  156. package/src/renderers/WebGLArrayRenderTarget.js +2 -2
  157. package/src/renderers/WebGLRenderer.js +23 -18
  158. package/src/renderers/shaders/ShaderChunk/batching_pars_vertex.glsl.js +19 -0
  159. package/src/renderers/shaders/ShaderChunk/batching_vertex.glsl.js +5 -0
  160. package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +0 -5
  161. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +31 -4
  162. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +9 -4
  163. package/src/renderers/shaders/ShaderChunk/project_vertex.glsl.js +6 -0
  164. package/src/renderers/shaders/ShaderChunk/skinning_pars_vertex.glsl.js +9 -17
  165. package/src/renderers/shaders/ShaderChunk/tonemapping_pars_fragment.glsl.js +84 -0
  166. package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +6 -0
  167. package/src/renderers/shaders/ShaderChunk.js +4 -0
  168. package/src/renderers/shaders/ShaderLib/depth.glsl.js +2 -0
  169. package/src/renderers/shaders/ShaderLib/distanceRGBA.glsl.js +2 -0
  170. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +2 -0
  171. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +2 -0
  172. package/src/renderers/shaders/ShaderLib/meshmatcap.glsl.js +3 -0
  173. package/src/renderers/shaders/ShaderLib/meshnormal.glsl.js +2 -0
  174. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +2 -0
  175. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +2 -0
  176. package/src/renderers/shaders/ShaderLib/meshtoon.glsl.js +2 -0
  177. package/src/renderers/shaders/ShaderLib/shadow.glsl.js +3 -0
  178. package/src/renderers/webgl/WebGLAttributes.js +39 -5
  179. package/src/renderers/webgl/WebGLBufferRenderer.js +31 -0
  180. package/src/renderers/webgl/WebGLCubeMaps.js +1 -1
  181. package/src/renderers/webgl/WebGLExtensions.js +1 -0
  182. package/src/renderers/webgl/WebGLIndexedBufferRenderer.js +31 -0
  183. package/src/renderers/webgl/WebGLLights.js +11 -2
  184. package/src/renderers/webgl/WebGLProgram.js +20 -1
  185. package/src/renderers/webgl/WebGLPrograms.js +5 -0
  186. package/src/renderers/webgl/WebGLShadowMap.js +35 -0
  187. package/src/renderers/webgl/WebGLTextures.js +7 -11
  188. package/src/renderers/webgl/WebGLUniforms.js +11 -1
  189. package/src/renderers/webgl/WebGLUniformsGroups.js +72 -93
  190. package/src/renderers/webxr/WebXRManager.js +16 -0
  191. package/examples/jsm/objects/BatchedMesh.js +0 -586
@@ -3,7 +3,7 @@
3
3
  * Copyright 2010-2023 Three.js Authors
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
- const REVISION = '158';
6
+ const REVISION = '160';
7
7
 
8
8
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
9
9
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
@@ -62,6 +62,7 @@ const ReinhardToneMapping = 2;
62
62
  const CineonToneMapping = 3;
63
63
  const ACESFilmicToneMapping = 4;
64
64
  const CustomToneMapping = 5;
65
+ const AgXToneMapping = 6;
65
66
  const AttachedBindMode = 'attached';
66
67
  const DetachedBindMode = 'detached';
67
68
 
@@ -1626,22 +1627,6 @@ const ColorManagement = {
1626
1627
 
1627
1628
  _workingColorSpace: LinearSRGBColorSpace,
1628
1629
 
1629
- get legacyMode() {
1630
-
1631
- console.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );
1632
-
1633
- return ! this.enabled;
1634
-
1635
- },
1636
-
1637
- set legacyMode( legacyMode ) {
1638
-
1639
- console.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );
1640
-
1641
- this.enabled = ! legacyMode;
1642
-
1643
- },
1644
-
1645
1630
  get workingColorSpace() {
1646
1631
 
1647
1632
  return this._workingColorSpace;
@@ -3083,9 +3068,9 @@ class DataArrayTexture extends Texture {
3083
3068
 
3084
3069
  class WebGLArrayRenderTarget extends WebGLRenderTarget {
3085
3070
 
3086
- constructor( width = 1, height = 1, depth = 1 ) {
3071
+ constructor( width = 1, height = 1, depth = 1, options = {} ) {
3087
3072
 
3088
- super( width, height );
3073
+ super( width, height, options );
3089
3074
 
3090
3075
  this.isWebGLArrayRenderTarget = true;
3091
3076
 
@@ -3132,9 +3117,9 @@ class Data3DTexture extends Texture {
3132
3117
 
3133
3118
  class WebGL3DRenderTarget extends WebGLRenderTarget {
3134
3119
 
3135
- constructor( width = 1, height = 1, depth = 1 ) {
3120
+ constructor( width = 1, height = 1, depth = 1, options = {} ) {
3136
3121
 
3137
- super( width, height );
3122
+ super( width, height, options );
3138
3123
 
3139
3124
  this.isWebGL3DRenderTarget = true;
3140
3125
 
@@ -3425,7 +3410,7 @@ class Quaternion {
3425
3410
 
3426
3411
  }
3427
3412
 
3428
- setFromEuler( euler, update ) {
3413
+ setFromEuler( euler, update = true ) {
3429
3414
 
3430
3415
  const x = euler._x, y = euler._y, z = euler._z, order = euler._order;
3431
3416
 
@@ -3493,7 +3478,7 @@ class Quaternion {
3493
3478
 
3494
3479
  }
3495
3480
 
3496
- if ( update !== false ) this._onChangeCallback();
3481
+ if ( update === true ) this._onChangeCallback();
3497
3482
 
3498
3483
  return this;
3499
3484
 
@@ -3788,8 +3773,7 @@ class Quaternion {
3788
3773
  this._y = s * y + t * this._y;
3789
3774
  this._z = s * z + t * this._z;
3790
3775
 
3791
- this.normalize();
3792
- this._onChangeCallback();
3776
+ this.normalize(); // normalize calls _onChangeCallback()
3793
3777
 
3794
3778
  return this;
3795
3779
 
@@ -3877,6 +3861,8 @@ class Quaternion {
3877
3861
  this._z = attribute.getZ( index );
3878
3862
  this._w = attribute.getW( index );
3879
3863
 
3864
+ this._onChangeCallback();
3865
+
3880
3866
  return this;
3881
3867
 
3882
3868
  }
@@ -4412,9 +4398,9 @@ class Vector3 {
4412
4398
 
4413
4399
  projectOnPlane( planeNormal ) {
4414
4400
 
4415
- _vector$b.copy( this ).projectOnVector( planeNormal );
4401
+ _vector$c.copy( this ).projectOnVector( planeNormal );
4416
4402
 
4417
- return this.sub( _vector$b );
4403
+ return this.sub( _vector$c );
4418
4404
 
4419
4405
  }
4420
4406
 
@@ -4423,7 +4409,7 @@ class Vector3 {
4423
4409
  // reflect incident vector off plane orthogonal to normal
4424
4410
  // normal is assumed to have unit length
4425
4411
 
4426
- return this.sub( _vector$b.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );
4412
+ return this.sub( _vector$c.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );
4427
4413
 
4428
4414
  }
4429
4415
 
@@ -4625,7 +4611,7 @@ class Vector3 {
4625
4611
 
4626
4612
  }
4627
4613
 
4628
- const _vector$b = /*@__PURE__*/ new Vector3();
4614
+ const _vector$c = /*@__PURE__*/ new Vector3();
4629
4615
  const _quaternion$4 = /*@__PURE__*/ new Quaternion();
4630
4616
 
4631
4617
  class Box3 {
@@ -4654,7 +4640,7 @@ class Box3 {
4654
4640
 
4655
4641
  for ( let i = 0, il = array.length; i < il; i += 3 ) {
4656
4642
 
4657
- this.expandByPoint( _vector$a.fromArray( array, i ) );
4643
+ this.expandByPoint( _vector$b.fromArray( array, i ) );
4658
4644
 
4659
4645
  }
4660
4646
 
@@ -4668,7 +4654,7 @@ class Box3 {
4668
4654
 
4669
4655
  for ( let i = 0, il = attribute.count; i < il; i ++ ) {
4670
4656
 
4671
- this.expandByPoint( _vector$a.fromBufferAttribute( attribute, i ) );
4657
+ this.expandByPoint( _vector$b.fromBufferAttribute( attribute, i ) );
4672
4658
 
4673
4659
  }
4674
4660
 
@@ -4692,7 +4678,7 @@ class Box3 {
4692
4678
 
4693
4679
  setFromCenterAndSize( center, size ) {
4694
4680
 
4695
- const halfSize = _vector$a.copy( size ).multiplyScalar( 0.5 );
4681
+ const halfSize = _vector$b.copy( size ).multiplyScalar( 0.5 );
4696
4682
 
4697
4683
  this.min.copy( center ).sub( halfSize );
4698
4684
  this.max.copy( center ).add( halfSize );
@@ -4802,16 +4788,16 @@ class Box3 {
4802
4788
 
4803
4789
  if ( object.isMesh === true ) {
4804
4790
 
4805
- object.getVertexPosition( i, _vector$a );
4791
+ object.getVertexPosition( i, _vector$b );
4806
4792
 
4807
4793
  } else {
4808
4794
 
4809
- _vector$a.fromBufferAttribute( positionAttribute, i );
4795
+ _vector$b.fromBufferAttribute( positionAttribute, i );
4810
4796
 
4811
4797
  }
4812
4798
 
4813
- _vector$a.applyMatrix4( object.matrixWorld );
4814
- this.expandByPoint( _vector$a );
4799
+ _vector$b.applyMatrix4( object.matrixWorld );
4800
+ this.expandByPoint( _vector$b );
4815
4801
 
4816
4802
  }
4817
4803
 
@@ -4827,7 +4813,7 @@ class Box3 {
4827
4813
 
4828
4814
  }
4829
4815
 
4830
- _box$3.copy( object.boundingBox );
4816
+ _box$4.copy( object.boundingBox );
4831
4817
 
4832
4818
 
4833
4819
  } else {
@@ -4840,13 +4826,13 @@ class Box3 {
4840
4826
 
4841
4827
  }
4842
4828
 
4843
- _box$3.copy( geometry.boundingBox );
4829
+ _box$4.copy( geometry.boundingBox );
4844
4830
 
4845
4831
  }
4846
4832
 
4847
- _box$3.applyMatrix4( object.matrixWorld );
4833
+ _box$4.applyMatrix4( object.matrixWorld );
4848
4834
 
4849
- this.union( _box$3 );
4835
+ this.union( _box$4 );
4850
4836
 
4851
4837
  }
4852
4838
 
@@ -4905,10 +4891,10 @@ class Box3 {
4905
4891
  intersectsSphere( sphere ) {
4906
4892
 
4907
4893
  // Find the point on the AABB closest to the sphere center.
4908
- this.clampPoint( sphere.center, _vector$a );
4894
+ this.clampPoint( sphere.center, _vector$b );
4909
4895
 
4910
4896
  // If that point is inside the sphere, the AABB and sphere intersect.
4911
- return _vector$a.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );
4897
+ return _vector$b.distanceToSquared( sphere.center ) <= ( sphere.radius * sphere.radius );
4912
4898
 
4913
4899
  }
4914
4900
 
@@ -5020,7 +5006,7 @@ class Box3 {
5020
5006
 
5021
5007
  distanceToPoint( point ) {
5022
5008
 
5023
- return this.clampPoint( point, _vector$a ).distanceTo( point );
5009
+ return this.clampPoint( point, _vector$b ).distanceTo( point );
5024
5010
 
5025
5011
  }
5026
5012
 
@@ -5034,7 +5020,7 @@ class Box3 {
5034
5020
 
5035
5021
  this.getCenter( target.center );
5036
5022
 
5037
- target.radius = this.getSize( _vector$a ).length() * 0.5;
5023
+ target.radius = this.getSize( _vector$b ).length() * 0.5;
5038
5024
 
5039
5025
  }
5040
5026
 
@@ -5112,9 +5098,9 @@ const _points = [
5112
5098
  /*@__PURE__*/ new Vector3()
5113
5099
  ];
5114
5100
 
5115
- const _vector$a = /*@__PURE__*/ new Vector3();
5101
+ const _vector$b = /*@__PURE__*/ new Vector3();
5116
5102
 
5117
- const _box$3 = /*@__PURE__*/ new Box3();
5103
+ const _box$4 = /*@__PURE__*/ new Box3();
5118
5104
 
5119
5105
  // triangle centered vertices
5120
5106
 
@@ -5159,7 +5145,7 @@ function satForAxes( axes, v0, v1, v2, extents ) {
5159
5145
 
5160
5146
  }
5161
5147
 
5162
- const _box$2 = /*@__PURE__*/ new Box3();
5148
+ const _box$3 = /*@__PURE__*/ new Box3();
5163
5149
  const _v1$6 = /*@__PURE__*/ new Vector3();
5164
5150
  const _v2$3 = /*@__PURE__*/ new Vector3();
5165
5151
 
@@ -5167,6 +5153,8 @@ class Sphere {
5167
5153
 
5168
5154
  constructor( center = new Vector3(), radius = - 1 ) {
5169
5155
 
5156
+ this.isSphere = true;
5157
+
5170
5158
  this.center = center;
5171
5159
  this.radius = radius;
5172
5160
 
@@ -5191,7 +5179,7 @@ class Sphere {
5191
5179
 
5192
5180
  } else {
5193
5181
 
5194
- _box$2.setFromPoints( points ).getCenter( center );
5182
+ _box$3.setFromPoints( points ).getCenter( center );
5195
5183
 
5196
5184
  }
5197
5185
 
@@ -5398,7 +5386,7 @@ class Sphere {
5398
5386
 
5399
5387
  }
5400
5388
 
5401
- const _vector$9 = /*@__PURE__*/ new Vector3();
5389
+ const _vector$a = /*@__PURE__*/ new Vector3();
5402
5390
  const _segCenter = /*@__PURE__*/ new Vector3();
5403
5391
  const _segDir = /*@__PURE__*/ new Vector3();
5404
5392
  const _diff = /*@__PURE__*/ new Vector3();
@@ -5450,7 +5438,7 @@ class Ray {
5450
5438
 
5451
5439
  recast( t ) {
5452
5440
 
5453
- this.origin.copy( this.at( t, _vector$9 ) );
5441
+ this.origin.copy( this.at( t, _vector$a ) );
5454
5442
 
5455
5443
  return this;
5456
5444
 
@@ -5480,7 +5468,7 @@ class Ray {
5480
5468
 
5481
5469
  distanceSqToPoint( point ) {
5482
5470
 
5483
- const directionDistance = _vector$9.subVectors( point, this.origin ).dot( this.direction );
5471
+ const directionDistance = _vector$a.subVectors( point, this.origin ).dot( this.direction );
5484
5472
 
5485
5473
  // point behind the ray
5486
5474
 
@@ -5490,9 +5478,9 @@ class Ray {
5490
5478
 
5491
5479
  }
5492
5480
 
5493
- _vector$9.copy( this.origin ).addScaledVector( this.direction, directionDistance );
5481
+ _vector$a.copy( this.origin ).addScaledVector( this.direction, directionDistance );
5494
5482
 
5495
- return _vector$9.distanceToSquared( point );
5483
+ return _vector$a.distanceToSquared( point );
5496
5484
 
5497
5485
  }
5498
5486
 
@@ -5617,9 +5605,9 @@ class Ray {
5617
5605
 
5618
5606
  intersectSphere( sphere, target ) {
5619
5607
 
5620
- _vector$9.subVectors( sphere.center, this.origin );
5621
- const tca = _vector$9.dot( this.direction );
5622
- const d2 = _vector$9.dot( _vector$9 ) - tca * tca;
5608
+ _vector$a.subVectors( sphere.center, this.origin );
5609
+ const tca = _vector$a.dot( this.direction );
5610
+ const d2 = _vector$a.dot( _vector$a ) - tca * tca;
5623
5611
  const radius2 = sphere.radius * sphere.radius;
5624
5612
 
5625
5613
  if ( d2 > radius2 ) return null;
@@ -5786,7 +5774,7 @@ class Ray {
5786
5774
 
5787
5775
  intersectsBox( box ) {
5788
5776
 
5789
- return this.intersectBox( box, _vector$9 ) !== null;
5777
+ return this.intersectBox( box, _vector$a ) !== null;
5790
5778
 
5791
5779
  }
5792
5780
 
@@ -6799,7 +6787,7 @@ const _x = /*@__PURE__*/ new Vector3();
6799
6787
  const _y = /*@__PURE__*/ new Vector3();
6800
6788
  const _z = /*@__PURE__*/ new Vector3();
6801
6789
 
6802
- const _matrix = /*@__PURE__*/ new Matrix4();
6790
+ const _matrix$1 = /*@__PURE__*/ new Matrix4();
6803
6791
  const _quaternion$3 = /*@__PURE__*/ new Quaternion();
6804
6792
 
6805
6793
  class Euler {
@@ -7034,9 +7022,9 @@ class Euler {
7034
7022
 
7035
7023
  setFromQuaternion( q, order, update ) {
7036
7024
 
7037
- _matrix.makeRotationFromQuaternion( q );
7025
+ _matrix$1.makeRotationFromQuaternion( q );
7038
7026
 
7039
- return this.setFromRotationMatrix( _matrix, order, update );
7027
+ return this.setFromRotationMatrix( _matrix$1, order, update );
7040
7028
 
7041
7029
  }
7042
7030
 
@@ -7258,9 +7246,9 @@ class Object3D extends EventDispatcher {
7258
7246
  this.matrixWorld = new Matrix4();
7259
7247
 
7260
7248
  this.matrixAutoUpdate = Object3D.DEFAULT_MATRIX_AUTO_UPDATE;
7261
- this.matrixWorldNeedsUpdate = false;
7262
7249
 
7263
7250
  this.matrixWorldAutoUpdate = Object3D.DEFAULT_MATRIX_WORLD_AUTO_UPDATE; // checked by the renderer
7251
+ this.matrixWorldNeedsUpdate = false;
7264
7252
 
7265
7253
  this.layers = new Layers();
7266
7254
  this.visible = true;
@@ -7277,6 +7265,10 @@ class Object3D extends EventDispatcher {
7277
7265
 
7278
7266
  }
7279
7267
 
7268
+ onBeforeShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}
7269
+
7270
+ onAfterShadow( /* renderer, object, camera, shadowCamera, geometry, depthMaterial, group */ ) {}
7271
+
7280
7272
  onBeforeRender( /* renderer, scene, camera, geometry, material, group */ ) {}
7281
7273
 
7282
7274
  onAfterRender( /* renderer, scene, camera, geometry, material, group */ ) {}
@@ -7617,21 +7609,15 @@ class Object3D extends EventDispatcher {
7617
7609
 
7618
7610
  }
7619
7611
 
7620
- getObjectsByProperty( name, value ) {
7621
-
7622
- let result = [];
7612
+ getObjectsByProperty( name, value, result = [] ) {
7623
7613
 
7624
7614
  if ( this[ name ] === value ) result.push( this );
7625
7615
 
7626
- for ( let i = 0, l = this.children.length; i < l; i ++ ) {
7627
-
7628
- const childResult = this.children[ i ].getObjectsByProperty( name, value );
7616
+ const children = this.children;
7629
7617
 
7630
- if ( childResult.length > 0 ) {
7618
+ for ( let i = 0, l = children.length; i < l; i ++ ) {
7631
7619
 
7632
- result = result.concat( childResult );
7633
-
7634
- }
7620
+ children[ i ].getObjectsByProperty( name, value, result );
7635
7621
 
7636
7622
  }
7637
7623
 
@@ -7879,6 +7865,56 @@ class Object3D extends EventDispatcher {
7879
7865
 
7880
7866
  }
7881
7867
 
7868
+ if ( this.isBatchedMesh ) {
7869
+
7870
+ object.type = 'BatchedMesh';
7871
+ object.perObjectFrustumCulled = this.perObjectFrustumCulled;
7872
+ object.sortObjects = this.sortObjects;
7873
+
7874
+ object.drawRanges = this._drawRanges;
7875
+ object.reservedRanges = this._reservedRanges;
7876
+
7877
+ object.visibility = this._visibility;
7878
+ object.active = this._active;
7879
+ object.bounds = this._bounds.map( bound => ( {
7880
+ boxInitialized: bound.boxInitialized,
7881
+ boxMin: bound.box.min.toArray(),
7882
+ boxMax: bound.box.max.toArray(),
7883
+
7884
+ sphereInitialized: bound.sphereInitialized,
7885
+ sphereRadius: bound.sphere.radius,
7886
+ sphereCenter: bound.sphere.center.toArray()
7887
+ } ) );
7888
+
7889
+ object.maxGeometryCount = this._maxGeometryCount;
7890
+ object.maxVertexCount = this._maxVertexCount;
7891
+ object.maxIndexCount = this._maxIndexCount;
7892
+
7893
+ object.geometryInitialized = this._geometryInitialized;
7894
+ object.geometryCount = this._geometryCount;
7895
+
7896
+ object.matricesTexture = this._matricesTexture.toJSON( meta );
7897
+
7898
+ if ( this.boundingSphere !== null ) {
7899
+
7900
+ object.boundingSphere = {
7901
+ center: object.boundingSphere.center.toArray(),
7902
+ radius: object.boundingSphere.radius
7903
+ };
7904
+
7905
+ }
7906
+
7907
+ if ( this.boundingBox !== null ) {
7908
+
7909
+ object.boundingBox = {
7910
+ min: object.boundingBox.min.toArray(),
7911
+ max: object.boundingBox.max.toArray()
7912
+ };
7913
+
7914
+ }
7915
+
7916
+ }
7917
+
7882
7918
  //
7883
7919
 
7884
7920
  function serialize( library, element ) {
@@ -8079,9 +8115,9 @@ class Object3D extends EventDispatcher {
8079
8115
  this.matrixWorld.copy( source.matrixWorld );
8080
8116
 
8081
8117
  this.matrixAutoUpdate = source.matrixAutoUpdate;
8082
- this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
8083
8118
 
8084
8119
  this.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;
8120
+ this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
8085
8121
 
8086
8122
  this.layers.mask = source.layers.mask;
8087
8123
  this.visible = source.visible;
@@ -8177,9 +8213,8 @@ class Triangle {
8177
8213
  // collinear or singular triangle
8178
8214
  if ( denom === 0 ) {
8179
8215
 
8180
- // arbitrary location outside of triangle?
8181
- // not sure if this is the best idea, maybe should be returning undefined
8182
- return target.set( - 2, - 1, - 1 );
8216
+ target.set( 0, 0, 0 );
8217
+ return null;
8183
8218
 
8184
8219
  }
8185
8220
 
@@ -8194,7 +8229,12 @@ class Triangle {
8194
8229
 
8195
8230
  static containsPoint( point, a, b, c ) {
8196
8231
 
8197
- this.getBarycoord( point, a, b, c, _v3$1 );
8232
+ // if the triangle is degenerate then we can't contain a point
8233
+ if ( this.getBarycoord( point, a, b, c, _v3$1 ) === null ) {
8234
+
8235
+ return false;
8236
+
8237
+ }
8198
8238
 
8199
8239
  return ( _v3$1.x >= 0 ) && ( _v3$1.y >= 0 ) && ( ( _v3$1.x + _v3$1.y ) <= 1 );
8200
8240
 
@@ -8216,7 +8256,15 @@ class Triangle {
8216
8256
 
8217
8257
  static getInterpolation( point, p1, p2, p3, v1, v2, v3, target ) {
8218
8258
 
8219
- this.getBarycoord( point, p1, p2, p3, _v3$1 );
8259
+ if ( this.getBarycoord( point, p1, p2, p3, _v3$1 ) === null ) {
8260
+
8261
+ target.x = 0;
8262
+ target.y = 0;
8263
+ if ( 'z' in target ) target.z = 0;
8264
+ if ( 'w' in target ) target.w = 0;
8265
+ return null;
8266
+
8267
+ }
8220
8268
 
8221
8269
  target.setScalar( 0 );
8222
8270
  target.addScaledVector( v1, _v3$1.x );
@@ -9822,7 +9870,7 @@ const DataUtils = {
9822
9870
  fromHalfFloat: fromHalfFloat,
9823
9871
  };
9824
9872
 
9825
- const _vector$8 = /*@__PURE__*/ new Vector3();
9873
+ const _vector$9 = /*@__PURE__*/ new Vector3();
9826
9874
  const _vector2$1 = /*@__PURE__*/ new Vector2();
9827
9875
 
9828
9876
  class BufferAttribute {
@@ -9845,7 +9893,8 @@ class BufferAttribute {
9845
9893
  this.normalized = normalized;
9846
9894
 
9847
9895
  this.usage = StaticDrawUsage;
9848
- this.updateRange = { offset: 0, count: - 1 };
9896
+ this._updateRange = { offset: 0, count: - 1 };
9897
+ this.updateRanges = [];
9849
9898
  this.gpuType = FloatType;
9850
9899
 
9851
9900
  this.version = 0;
@@ -9860,6 +9909,13 @@ class BufferAttribute {
9860
9909
 
9861
9910
  }
9862
9911
 
9912
+ get updateRange() {
9913
+
9914
+ console.warn( 'THREE.BufferAttribute: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
9915
+ return this._updateRange;
9916
+
9917
+ }
9918
+
9863
9919
  setUsage( value ) {
9864
9920
 
9865
9921
  this.usage = value;
@@ -9868,6 +9924,18 @@ class BufferAttribute {
9868
9924
 
9869
9925
  }
9870
9926
 
9927
+ addUpdateRange( start, count ) {
9928
+
9929
+ this.updateRanges.push( { start, count } );
9930
+
9931
+ }
9932
+
9933
+ clearUpdateRanges() {
9934
+
9935
+ this.updateRanges.length = 0;
9936
+
9937
+ }
9938
+
9871
9939
  copy( source ) {
9872
9940
 
9873
9941
  this.name = source.name;
@@ -9923,10 +9991,10 @@ class BufferAttribute {
9923
9991
 
9924
9992
  for ( let i = 0, l = this.count; i < l; i ++ ) {
9925
9993
 
9926
- _vector$8.fromBufferAttribute( this, i );
9927
- _vector$8.applyMatrix3( m );
9994
+ _vector$9.fromBufferAttribute( this, i );
9995
+ _vector$9.applyMatrix3( m );
9928
9996
 
9929
- this.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );
9997
+ this.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );
9930
9998
 
9931
9999
  }
9932
10000
 
@@ -9940,11 +10008,11 @@ class BufferAttribute {
9940
10008
 
9941
10009
  for ( let i = 0, l = this.count; i < l; i ++ ) {
9942
10010
 
9943
- _vector$8.fromBufferAttribute( this, i );
10011
+ _vector$9.fromBufferAttribute( this, i );
9944
10012
 
9945
- _vector$8.applyMatrix4( m );
10013
+ _vector$9.applyMatrix4( m );
9946
10014
 
9947
- this.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );
10015
+ this.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );
9948
10016
 
9949
10017
  }
9950
10018
 
@@ -9956,11 +10024,11 @@ class BufferAttribute {
9956
10024
 
9957
10025
  for ( let i = 0, l = this.count; i < l; i ++ ) {
9958
10026
 
9959
- _vector$8.fromBufferAttribute( this, i );
10027
+ _vector$9.fromBufferAttribute( this, i );
9960
10028
 
9961
- _vector$8.applyNormalMatrix( m );
10029
+ _vector$9.applyNormalMatrix( m );
9962
10030
 
9963
- this.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );
10031
+ this.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );
9964
10032
 
9965
10033
  }
9966
10034
 
@@ -9972,11 +10040,11 @@ class BufferAttribute {
9972
10040
 
9973
10041
  for ( let i = 0, l = this.count; i < l; i ++ ) {
9974
10042
 
9975
- _vector$8.fromBufferAttribute( this, i );
10043
+ _vector$9.fromBufferAttribute( this, i );
9976
10044
 
9977
- _vector$8.transformDirection( m );
10045
+ _vector$9.transformDirection( m );
9978
10046
 
9979
- this.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );
10047
+ this.setXYZ( i, _vector$9.x, _vector$9.y, _vector$9.z );
9980
10048
 
9981
10049
  }
9982
10050
 
@@ -10178,7 +10246,6 @@ class BufferAttribute {
10178
10246
 
10179
10247
  if ( this.name !== '' ) data.name = this.name;
10180
10248
  if ( this.usage !== StaticDrawUsage ) data.usage = this.usage;
10181
- if ( this.updateRange.offset !== 0 || this.updateRange.count !== - 1 ) data.updateRange = this.updateRange;
10182
10249
 
10183
10250
  return data;
10184
10251
 
@@ -10436,9 +10503,9 @@ let _id$2 = 0;
10436
10503
  const _m1 = /*@__PURE__*/ new Matrix4();
10437
10504
  const _obj = /*@__PURE__*/ new Object3D();
10438
10505
  const _offset = /*@__PURE__*/ new Vector3();
10439
- const _box$1 = /*@__PURE__*/ new Box3();
10506
+ const _box$2 = /*@__PURE__*/ new Box3();
10440
10507
  const _boxMorphTargets = /*@__PURE__*/ new Box3();
10441
- const _vector$7 = /*@__PURE__*/ new Vector3();
10508
+ const _vector$8 = /*@__PURE__*/ new Vector3();
10442
10509
 
10443
10510
  class BufferGeometry extends EventDispatcher {
10444
10511
 
@@ -10743,20 +10810,20 @@ class BufferGeometry extends EventDispatcher {
10743
10810
  for ( let i = 0, il = morphAttributesPosition.length; i < il; i ++ ) {
10744
10811
 
10745
10812
  const morphAttribute = morphAttributesPosition[ i ];
10746
- _box$1.setFromBufferAttribute( morphAttribute );
10813
+ _box$2.setFromBufferAttribute( morphAttribute );
10747
10814
 
10748
10815
  if ( this.morphTargetsRelative ) {
10749
10816
 
10750
- _vector$7.addVectors( this.boundingBox.min, _box$1.min );
10751
- this.boundingBox.expandByPoint( _vector$7 );
10817
+ _vector$8.addVectors( this.boundingBox.min, _box$2.min );
10818
+ this.boundingBox.expandByPoint( _vector$8 );
10752
10819
 
10753
- _vector$7.addVectors( this.boundingBox.max, _box$1.max );
10754
- this.boundingBox.expandByPoint( _vector$7 );
10820
+ _vector$8.addVectors( this.boundingBox.max, _box$2.max );
10821
+ this.boundingBox.expandByPoint( _vector$8 );
10755
10822
 
10756
10823
  } else {
10757
10824
 
10758
- this.boundingBox.expandByPoint( _box$1.min );
10759
- this.boundingBox.expandByPoint( _box$1.max );
10825
+ this.boundingBox.expandByPoint( _box$2.min );
10826
+ this.boundingBox.expandByPoint( _box$2.max );
10760
10827
 
10761
10828
  }
10762
10829
 
@@ -10805,7 +10872,7 @@ class BufferGeometry extends EventDispatcher {
10805
10872
 
10806
10873
  const center = this.boundingSphere.center;
10807
10874
 
10808
- _box$1.setFromBufferAttribute( position );
10875
+ _box$2.setFromBufferAttribute( position );
10809
10876
 
10810
10877
  // process morph attributes if present
10811
10878
 
@@ -10818,16 +10885,16 @@ class BufferGeometry extends EventDispatcher {
10818
10885
 
10819
10886
  if ( this.morphTargetsRelative ) {
10820
10887
 
10821
- _vector$7.addVectors( _box$1.min, _boxMorphTargets.min );
10822
- _box$1.expandByPoint( _vector$7 );
10888
+ _vector$8.addVectors( _box$2.min, _boxMorphTargets.min );
10889
+ _box$2.expandByPoint( _vector$8 );
10823
10890
 
10824
- _vector$7.addVectors( _box$1.max, _boxMorphTargets.max );
10825
- _box$1.expandByPoint( _vector$7 );
10891
+ _vector$8.addVectors( _box$2.max, _boxMorphTargets.max );
10892
+ _box$2.expandByPoint( _vector$8 );
10826
10893
 
10827
10894
  } else {
10828
10895
 
10829
- _box$1.expandByPoint( _boxMorphTargets.min );
10830
- _box$1.expandByPoint( _boxMorphTargets.max );
10896
+ _box$2.expandByPoint( _boxMorphTargets.min );
10897
+ _box$2.expandByPoint( _boxMorphTargets.max );
10831
10898
 
10832
10899
  }
10833
10900
 
@@ -10835,7 +10902,7 @@ class BufferGeometry extends EventDispatcher {
10835
10902
 
10836
10903
  }
10837
10904
 
10838
- _box$1.getCenter( center );
10905
+ _box$2.getCenter( center );
10839
10906
 
10840
10907
  // second, try to find a boundingSphere with a radius smaller than the
10841
10908
  // boundingSphere of the boundingBox: sqrt(3) smaller in the best case
@@ -10844,9 +10911,9 @@ class BufferGeometry extends EventDispatcher {
10844
10911
 
10845
10912
  for ( let i = 0, il = position.count; i < il; i ++ ) {
10846
10913
 
10847
- _vector$7.fromBufferAttribute( position, i );
10914
+ _vector$8.fromBufferAttribute( position, i );
10848
10915
 
10849
- maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$7 ) );
10916
+ maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );
10850
10917
 
10851
10918
  }
10852
10919
 
@@ -10861,16 +10928,16 @@ class BufferGeometry extends EventDispatcher {
10861
10928
 
10862
10929
  for ( let j = 0, jl = morphAttribute.count; j < jl; j ++ ) {
10863
10930
 
10864
- _vector$7.fromBufferAttribute( morphAttribute, j );
10931
+ _vector$8.fromBufferAttribute( morphAttribute, j );
10865
10932
 
10866
10933
  if ( morphTargetsRelative ) {
10867
10934
 
10868
10935
  _offset.fromBufferAttribute( position, j );
10869
- _vector$7.add( _offset );
10936
+ _vector$8.add( _offset );
10870
10937
 
10871
10938
  }
10872
10939
 
10873
- maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$7 ) );
10940
+ maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector$8 ) );
10874
10941
 
10875
10942
  }
10876
10943
 
@@ -11153,11 +11220,11 @@ class BufferGeometry extends EventDispatcher {
11153
11220
 
11154
11221
  for ( let i = 0, il = normals.count; i < il; i ++ ) {
11155
11222
 
11156
- _vector$7.fromBufferAttribute( normals, i );
11223
+ _vector$8.fromBufferAttribute( normals, i );
11157
11224
 
11158
- _vector$7.normalize();
11225
+ _vector$8.normalize();
11159
11226
 
11160
- normals.setXYZ( i, _vector$7.x, _vector$7.y, _vector$7.z );
11227
+ normals.setXYZ( i, _vector$8.x, _vector$8.y, _vector$8.z );
11161
11228
 
11162
11229
  }
11163
11230
 
@@ -11499,7 +11566,7 @@ class BufferGeometry extends EventDispatcher {
11499
11566
 
11500
11567
  const _inverseMatrix$3 = /*@__PURE__*/ new Matrix4();
11501
11568
  const _ray$3 = /*@__PURE__*/ new Ray();
11502
- const _sphere$5 = /*@__PURE__*/ new Sphere();
11569
+ const _sphere$6 = /*@__PURE__*/ new Sphere();
11503
11570
  const _sphereHitAt = /*@__PURE__*/ new Vector3();
11504
11571
 
11505
11572
  const _vA$1 = /*@__PURE__*/ new Vector3();
@@ -11647,16 +11714,16 @@ class Mesh extends Object3D {
11647
11714
 
11648
11715
  if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
11649
11716
 
11650
- _sphere$5.copy( geometry.boundingSphere );
11651
- _sphere$5.applyMatrix4( matrixWorld );
11717
+ _sphere$6.copy( geometry.boundingSphere );
11718
+ _sphere$6.applyMatrix4( matrixWorld );
11652
11719
 
11653
11720
  // check distance from ray origin to bounding sphere
11654
11721
 
11655
11722
  _ray$3.copy( raycaster.ray ).recast( raycaster.near );
11656
11723
 
11657
- if ( _sphere$5.containsPoint( _ray$3.origin ) === false ) {
11724
+ if ( _sphere$6.containsPoint( _ray$3.origin ) === false ) {
11658
11725
 
11659
- if ( _ray$3.intersectSphere( _sphere$5, _sphereHitAt ) === null ) return;
11726
+ if ( _ray$3.intersectSphere( _sphere$6, _sphereHitAt ) === null ) return;
11660
11727
 
11661
11728
  if ( _ray$3.origin.distanceToSquared( _sphereHitAt ) > ( raycaster.far - raycaster.near ) ** 2 ) return;
11662
11729
 
@@ -12226,7 +12293,8 @@ class ShaderMaterial extends Material {
12226
12293
  derivatives: false, // set to use derivatives
12227
12294
  fragDepth: false, // set to use fragment depth values
12228
12295
  drawBuffers: false, // set to use draw buffers
12229
- shaderTextureLOD: false // set to use shader texture LOD
12296
+ shaderTextureLOD: false, // set to use shader texture LOD
12297
+ clipCullDistance: false // set to use vertex shader clipping
12230
12298
  };
12231
12299
 
12232
12300
  // When rendered geometry doesn't include these attributes but the material does,
@@ -13209,8 +13277,8 @@ class Plane {
13209
13277
 
13210
13278
  }
13211
13279
 
13212
- const _sphere$4 = /*@__PURE__*/ new Sphere();
13213
- const _vector$6 = /*@__PURE__*/ new Vector3();
13280
+ const _sphere$5 = /*@__PURE__*/ new Sphere();
13281
+ const _vector$7 = /*@__PURE__*/ new Vector3();
13214
13282
 
13215
13283
  class Frustum {
13216
13284
 
@@ -13288,7 +13356,7 @@ class Frustum {
13288
13356
 
13289
13357
  if ( object.boundingSphere === null ) object.computeBoundingSphere();
13290
13358
 
13291
- _sphere$4.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld );
13359
+ _sphere$5.copy( object.boundingSphere ).applyMatrix4( object.matrixWorld );
13292
13360
 
13293
13361
  } else {
13294
13362
 
@@ -13296,21 +13364,21 @@ class Frustum {
13296
13364
 
13297
13365
  if ( geometry.boundingSphere === null ) geometry.computeBoundingSphere();
13298
13366
 
13299
- _sphere$4.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );
13367
+ _sphere$5.copy( geometry.boundingSphere ).applyMatrix4( object.matrixWorld );
13300
13368
 
13301
13369
  }
13302
13370
 
13303
- return this.intersectsSphere( _sphere$4 );
13371
+ return this.intersectsSphere( _sphere$5 );
13304
13372
 
13305
13373
  }
13306
13374
 
13307
13375
  intersectsSprite( sprite ) {
13308
13376
 
13309
- _sphere$4.center.set( 0, 0, 0 );
13310
- _sphere$4.radius = 0.7071067811865476;
13311
- _sphere$4.applyMatrix4( sprite.matrixWorld );
13377
+ _sphere$5.center.set( 0, 0, 0 );
13378
+ _sphere$5.radius = 0.7071067811865476;
13379
+ _sphere$5.applyMatrix4( sprite.matrixWorld );
13312
13380
 
13313
- return this.intersectsSphere( _sphere$4 );
13381
+ return this.intersectsSphere( _sphere$5 );
13314
13382
 
13315
13383
  }
13316
13384
 
@@ -13346,11 +13414,11 @@ class Frustum {
13346
13414
 
13347
13415
  // corner at max distance
13348
13416
 
13349
- _vector$6.x = plane.normal.x > 0 ? box.max.x : box.min.x;
13350
- _vector$6.y = plane.normal.y > 0 ? box.max.y : box.min.y;
13351
- _vector$6.z = plane.normal.z > 0 ? box.max.z : box.min.z;
13417
+ _vector$7.x = plane.normal.x > 0 ? box.max.x : box.min.x;
13418
+ _vector$7.y = plane.normal.y > 0 ? box.max.y : box.min.y;
13419
+ _vector$7.z = plane.normal.z > 0 ? box.max.z : box.min.z;
13352
13420
 
13353
- if ( plane.distanceToPoint( _vector$6 ) < 0 ) {
13421
+ if ( plane.distanceToPoint( _vector$7 ) < 0 ) {
13354
13422
 
13355
13423
  return false;
13356
13424
 
@@ -13450,6 +13518,7 @@ function WebGLAttributes( gl, capabilities ) {
13450
13518
 
13451
13519
  const array = attribute.array;
13452
13520
  const usage = attribute.usage;
13521
+ const size = array.byteLength;
13453
13522
 
13454
13523
  const buffer = gl.createBuffer();
13455
13524
 
@@ -13518,7 +13587,8 @@ function WebGLAttributes( gl, capabilities ) {
13518
13587
  buffer: buffer,
13519
13588
  type: type,
13520
13589
  bytesPerElement: array.BYTES_PER_ELEMENT,
13521
- version: attribute.version
13590
+ version: attribute.version,
13591
+ size: size
13522
13592
  };
13523
13593
 
13524
13594
  }
@@ -13526,17 +13596,43 @@ function WebGLAttributes( gl, capabilities ) {
13526
13596
  function updateBuffer( buffer, attribute, bufferType ) {
13527
13597
 
13528
13598
  const array = attribute.array;
13529
- const updateRange = attribute.updateRange;
13599
+ const updateRange = attribute._updateRange; // deprecated
13600
+ const updateRanges = attribute.updateRanges;
13530
13601
 
13531
13602
  gl.bindBuffer( bufferType, buffer );
13532
13603
 
13533
- if ( updateRange.count === - 1 ) {
13604
+ if ( updateRange.count === - 1 && updateRanges.length === 0 ) {
13534
13605
 
13535
13606
  // Not using update ranges
13536
-
13537
13607
  gl.bufferSubData( bufferType, 0, array );
13538
13608
 
13539
- } else {
13609
+ }
13610
+
13611
+ if ( updateRanges.length !== 0 ) {
13612
+
13613
+ for ( let i = 0, l = updateRanges.length; i < l; i ++ ) {
13614
+
13615
+ const range = updateRanges[ i ];
13616
+ if ( isWebGL2 ) {
13617
+
13618
+ gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
13619
+ array, range.start, range.count );
13620
+
13621
+ } else {
13622
+
13623
+ gl.bufferSubData( bufferType, range.start * array.BYTES_PER_ELEMENT,
13624
+ array.subarray( range.start, range.start + range.count ) );
13625
+
13626
+ }
13627
+
13628
+ }
13629
+
13630
+ attribute.clearUpdateRanges();
13631
+
13632
+ }
13633
+
13634
+ // deprecated
13635
+ if ( updateRange.count !== - 1 ) {
13540
13636
 
13541
13637
  if ( isWebGL2 ) {
13542
13638
 
@@ -13615,6 +13711,12 @@ function WebGLAttributes( gl, capabilities ) {
13615
13711
 
13616
13712
  } else if ( data.version < attribute.version ) {
13617
13713
 
13714
+ if ( data.size !== attribute.array.byteLength ) {
13715
+
13716
+ throw new Error( 'THREE.WebGLAttributes: The size of the buffer attribute\'s array buffer does not match the original size. Resizing buffer attributes is not supported.' );
13717
+
13718
+ }
13719
+
13618
13720
  updateBuffer( data.buffer, attribute, bufferType );
13619
13721
 
13620
13722
  data.version = attribute.version;
@@ -13743,6 +13845,10 @@ var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D(
13743
13845
 
13744
13846
  var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
13745
13847
 
13848
+ var batching_pars_vertex = "#ifdef USE_BATCHING\n\tattribute float batchId;\n\tuniform highp sampler2D batchingTexture;\n\tmat4 getBatchingMatrix( const in float i ) {\n\t\tint size = textureSize( batchingTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif";
13849
+
13850
+ var batching_vertex = "#ifdef USE_BATCHING\n\tmat4 batchingMatrix = getBatchingMatrix( batchId );\n#endif";
13851
+
13746
13852
  var begin_vertex = "vec3 transformed = vec3( position );\n#ifdef USE_ALPHAHASH\n\tvPosition = vec3( position );\n#endif";
13747
13853
 
13748
13854
  var beginnormal_vertex = "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";
@@ -13771,9 +13877,9 @@ var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#el
13771
13877
 
13772
13878
  var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated";
13773
13879
 
13774
- var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
13880
+ var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
13775
13881
 
13776
- var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";
13882
+ var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = objectTangent;\n#endif\n#ifdef USE_BATCHING\n\tmat3 bm = mat3( batchingMatrix );\n\ttransformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );\n\ttransformedNormal = bm * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = bm * transformedTangent;\n\t#endif\n#endif\n#ifdef USE_INSTANCING\n\tmat3 im = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );\n\ttransformedNormal = im * transformedNormal;\n\t#ifdef USE_TANGENT\n\t\ttransformedTangent = im * transformedTangent;\n\t#endif\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\ttransformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";
13777
13883
 
13778
13884
  var displacementmap_pars_vertex = "#ifdef USE_DISPLACEMENTMAP\n\tuniform sampler2D displacementMap;\n\tuniform float displacementScale;\n\tuniform float displacementBias;\n#endif";
13779
13885
 
@@ -13827,7 +13933,7 @@ var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor
13827
13933
 
13828
13934
  var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong";
13829
13935
 
13830
- var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif";
13936
+ var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tif( material.anisotropy == 0.0 ) {\n\t\tanisotropyV = vec2( 1.0, 0.0 );\n\t} else {\n\t\tanisotropyV /= material.anisotropy;\n\t\tmaterial.anisotropy = saturate( material.anisotropy );\n\t}\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;\n#endif";
13831
13937
 
13832
13938
  var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecularDirect = vec3( 0.0 );\nvec3 clearcoatSpecularIndirect = vec3( 0.0 );\nvec3 sheenSpecularDirect = vec3( 0.0 );\nvec3 sheenSpecularIndirect = vec3(0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
13833
13939
 
@@ -13891,7 +13997,7 @@ var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normaliz
13891
13997
 
13892
13998
  var premultiplied_alpha_fragment = "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif";
13893
13999
 
13894
- var project_vertex = "vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;";
14000
+ var project_vertex = "vec4 mvPosition = vec4( transformed, 1.0 );\n#ifdef USE_BATCHING\n\tmvPosition = batchingMatrix * mvPosition;\n#endif\n#ifdef USE_INSTANCING\n\tmvPosition = instanceMatrix * mvPosition;\n#endif\nmvPosition = modelViewMatrix * mvPosition;\ngl_Position = projectionMatrix * mvPosition;";
13895
14001
 
13896
14002
  var dithering_fragment = "#ifdef DITHERING\n\tgl_FragColor.rgb = dithering( gl_FragColor.rgb );\n#endif";
13897
14003
 
@@ -13911,7 +14017,7 @@ var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n
13911
14017
 
13912
14018
  var skinbase_vertex = "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif";
13913
14019
 
13914
- var skinning_pars_vertex = "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tuniform int boneTextureSize;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tfloat j = i * 4.0;\n\t\tfloat x = mod( j, float( boneTextureSize ) );\n\t\tfloat y = floor( j / float( boneTextureSize ) );\n\t\tfloat dx = 1.0 / float( boneTextureSize );\n\t\tfloat dy = 1.0 / float( boneTextureSize );\n\t\ty = dy * ( y + 0.5 );\n\t\tvec4 v1 = texture2D( boneTexture, vec2( dx * ( x + 0.5 ), y ) );\n\t\tvec4 v2 = texture2D( boneTexture, vec2( dx * ( x + 1.5 ), y ) );\n\t\tvec4 v3 = texture2D( boneTexture, vec2( dx * ( x + 2.5 ), y ) );\n\t\tvec4 v4 = texture2D( boneTexture, vec2( dx * ( x + 3.5 ), y ) );\n\t\tmat4 bone = mat4( v1, v2, v3, v4 );\n\t\treturn bone;\n\t}\n#endif";
14020
+ var skinning_pars_vertex = "#ifdef USE_SKINNING\n\tuniform mat4 bindMatrix;\n\tuniform mat4 bindMatrixInverse;\n\tuniform highp sampler2D boneTexture;\n\tmat4 getBoneMatrix( const in float i ) {\n\t\tint size = textureSize( boneTexture, 0 ).x;\n\t\tint j = int( i ) * 4;\n\t\tint x = j % size;\n\t\tint y = j / size;\n\t\tvec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );\n\t\tvec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );\n\t\tvec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );\n\t\tvec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );\n\t\treturn mat4( v1, v2, v3, v4 );\n\t}\n#endif";
13915
14021
 
13916
14022
  var skinning_vertex = "#ifdef USE_SKINNING\n\tvec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );\n\tvec4 skinned = vec4( 0.0 );\n\tskinned += boneMatX * skinVertex * skinWeight.x;\n\tskinned += boneMatY * skinVertex * skinWeight.y;\n\tskinned += boneMatZ * skinVertex * skinWeight.z;\n\tskinned += boneMatW * skinVertex * skinWeight.w;\n\ttransformed = ( bindMatrixInverse * skinned ).xyz;\n#endif";
13917
14023
 
@@ -13923,7 +14029,7 @@ var specularmap_pars_fragment = "#ifdef USE_SPECULARMAP\n\tuniform sampler2D spe
13923
14029
 
13924
14030
  var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = toneMapping( gl_FragColor.rgb );\n#endif";
13925
14031
 
13926
- 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}\nvec3 CustomToneMapping( vec3 color ) { return color; }";
14032
+ 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; }";
13927
14033
 
13928
14034
  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";
13929
14035
 
@@ -13935,7 +14041,7 @@ var uv_pars_vertex = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvary
13935
14041
 
13936
14042
  var uv_vertex = "#if defined( USE_UV ) || defined( USE_ANISOTROPY )\n\tvUv = vec3( uv, 1 ).xy;\n#endif\n#ifdef USE_MAP\n\tvMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ALPHAMAP\n\tvAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_LIGHTMAP\n\tvLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_AOMAP\n\tvAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_BUMPMAP\n\tvBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_NORMALMAP\n\tvNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_DISPLACEMENTMAP\n\tvDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_EMISSIVEMAP\n\tvEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_METALNESSMAP\n\tvMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ROUGHNESSMAP\n\tvRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_ANISOTROPYMAP\n\tvAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOATMAP\n\tvClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\tvClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\tvClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCEMAP\n\tvIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tvIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_COLORMAP\n\tvSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SHEEN_ROUGHNESSMAP\n\tvSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULARMAP\n\tvSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_COLORMAP\n\tvSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_SPECULAR_INTENSITYMAP\n\tvSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_TRANSMISSIONMAP\n\tvTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;\n#endif\n#ifdef USE_THICKNESSMAP\n\tvThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;\n#endif";
13937
14043
 
13938
- var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
14044
+ var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_BATCHING\n\t\tworldPosition = batchingMatrix * worldPosition;\n\t#endif\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
13939
14045
 
13940
14046
  const vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
13941
14047
 
@@ -13949,11 +14055,11 @@ const vertex$f = "varying vec3 vWorldDirection;\n#include <common>\nvoid main()
13949
14055
 
13950
14056
  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}";
13951
14057
 
13952
- const vertex$e = "#include <common>\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 <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}";
14058
+ 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}";
13953
14059
 
13954
14060
  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}";
13955
14061
 
13956
- const vertex$d = "#define DISTANCE\nvarying vec3 vWorldPosition;\n#include <common>\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 <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}";
14062
+ 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}";
13957
14063
 
13958
14064
  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}";
13959
14065
 
@@ -13965,31 +14071,31 @@ const vertex$b = "uniform float scale;\nattribute float lineDistance;\nvarying f
13965
14071
 
13966
14072
  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}";
13967
14073
 
13968
- const vertex$a = "#include <common>\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#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}";
14074
+ 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}";
13969
14075
 
13970
14076
  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}";
13971
14077
 
13972
- const vertex$9 = "#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\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 <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}";
14078
+ 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}";
13973
14079
 
13974
14080
  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}";
13975
14081
 
13976
- const vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\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 <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}";
14082
+ 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}";
13977
14083
 
13978
14084
  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}";
13979
14085
 
13980
- 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 <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 <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}";
14086
+ 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}";
13981
14087
 
13982
14088
  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}";
13983
14089
 
13984
- const vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\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 <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}";
14090
+ 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}";
13985
14091
 
13986
14092
  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}";
13987
14093
 
13988
- const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\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 <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}";
14094
+ 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}";
13989
14095
 
13990
14096
  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}";
13991
14097
 
13992
- const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\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 <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}";
14098
+ 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}";
13993
14099
 
13994
14100
  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}";
13995
14101
 
@@ -13997,7 +14103,7 @@ const vertex$3 = "uniform float size;\nuniform float scale;\n#include <common>\n
13997
14103
 
13998
14104
  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}";
13999
14105
 
14000
- const vertex$2 = "#include <common>\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 <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}";
14106
+ 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}";
14001
14107
 
14002
14108
  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}";
14003
14109
 
@@ -14014,6 +14120,8 @@ const ShaderChunk = {
14014
14120
  alphatest_pars_fragment: alphatest_pars_fragment,
14015
14121
  aomap_fragment: aomap_fragment,
14016
14122
  aomap_pars_fragment: aomap_pars_fragment,
14123
+ batching_pars_vertex: batching_pars_vertex,
14124
+ batching_vertex: batching_vertex,
14017
14125
  begin_vertex: begin_vertex,
14018
14126
  beginnormal_vertex: beginnormal_vertex,
14019
14127
  bsdfs: bsdfs,
@@ -15627,11 +15735,42 @@ function WebGLBufferRenderer( gl, extensions, info, capabilities ) {
15627
15735
 
15628
15736
  }
15629
15737
 
15738
+ function renderMultiDraw( starts, counts, drawCount ) {
15739
+
15740
+ if ( drawCount === 0 ) return;
15741
+
15742
+ const extension = extensions.get( 'WEBGL_multi_draw' );
15743
+ if ( extension === null ) {
15744
+
15745
+ for ( let i = 0; i < drawCount; i ++ ) {
15746
+
15747
+ this.render( starts[ i ], counts[ i ] );
15748
+
15749
+ }
15750
+
15751
+ } else {
15752
+
15753
+ extension.multiDrawArraysWEBGL( mode, starts, 0, counts, 0, drawCount );
15754
+
15755
+ let elementCount = 0;
15756
+ for ( let i = 0; i < drawCount; i ++ ) {
15757
+
15758
+ elementCount += counts[ i ];
15759
+
15760
+ }
15761
+
15762
+ info.update( elementCount, mode, 1 );
15763
+
15764
+ }
15765
+
15766
+ }
15767
+
15630
15768
  //
15631
15769
 
15632
15770
  this.setMode = setMode;
15633
15771
  this.render = render;
15634
15772
  this.renderInstances = renderInstances;
15773
+ this.renderMultiDraw = renderMultiDraw;
15635
15774
 
15636
15775
  }
15637
15776
 
@@ -15941,7 +16080,7 @@ function WebGLCubeMaps( renderer ) {
15941
16080
 
15942
16081
  function get( texture ) {
15943
16082
 
15944
- if ( texture && texture.isTexture && texture.isRenderTargetTexture === false ) {
16083
+ if ( texture && texture.isTexture ) {
15945
16084
 
15946
16085
  const mapping = texture.mapping;
15947
16086
 
@@ -17209,6 +17348,7 @@ function WebGLExtensions( gl ) {
17209
17348
  if ( capabilities.isWebGL2 ) {
17210
17349
 
17211
17350
  getExtension( 'EXT_color_buffer_float' );
17351
+ getExtension( 'WEBGL_clip_cull_distance' );
17212
17352
 
17213
17353
  } else {
17214
17354
 
@@ -17513,12 +17653,43 @@ function WebGLIndexedBufferRenderer( gl, extensions, info, capabilities ) {
17513
17653
 
17514
17654
  }
17515
17655
 
17656
+ function renderMultiDraw( starts, counts, drawCount ) {
17657
+
17658
+ if ( drawCount === 0 ) return;
17659
+
17660
+ const extension = extensions.get( 'WEBGL_multi_draw' );
17661
+ if ( extension === null ) {
17662
+
17663
+ for ( let i = 0; i < drawCount; i ++ ) {
17664
+
17665
+ this.render( starts[ i ] / bytesPerElement, counts[ i ] );
17666
+
17667
+ }
17668
+
17669
+ } else {
17670
+
17671
+ extension.multiDrawElementsWEBGL( mode, counts, 0, type, starts, 0, drawCount );
17672
+
17673
+ let elementCount = 0;
17674
+ for ( let i = 0; i < drawCount; i ++ ) {
17675
+
17676
+ elementCount += counts[ i ];
17677
+
17678
+ }
17679
+
17680
+ info.update( elementCount, mode, 1 );
17681
+
17682
+ }
17683
+
17684
+ }
17685
+
17516
17686
  //
17517
17687
 
17518
17688
  this.setMode = setMode;
17519
17689
  this.setIndex = setIndex;
17520
17690
  this.render = render;
17521
17691
  this.renderInstances = renderInstances;
17692
+ this.renderMultiDraw = renderMultiDraw;
17522
17693
 
17523
17694
  }
17524
17695
 
@@ -18071,6 +18242,60 @@ function WebGLObjects( gl, geometries, attributes, info ) {
18071
18242
 
18072
18243
  }
18073
18244
 
18245
+ class DepthTexture extends Texture {
18246
+
18247
+ constructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {
18248
+
18249
+ format = format !== undefined ? format : DepthFormat;
18250
+
18251
+ if ( format !== DepthFormat && format !== DepthStencilFormat ) {
18252
+
18253
+ throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
18254
+
18255
+ }
18256
+
18257
+ if ( type === undefined && format === DepthFormat ) type = UnsignedIntType;
18258
+ if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;
18259
+
18260
+ super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
18261
+
18262
+ this.isDepthTexture = true;
18263
+
18264
+ this.image = { width: width, height: height };
18265
+
18266
+ this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
18267
+ this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
18268
+
18269
+ this.flipY = false;
18270
+ this.generateMipmaps = false;
18271
+
18272
+ this.compareFunction = null;
18273
+
18274
+ }
18275
+
18276
+
18277
+ copy( source ) {
18278
+
18279
+ super.copy( source );
18280
+
18281
+ this.compareFunction = source.compareFunction;
18282
+
18283
+ return this;
18284
+
18285
+ }
18286
+
18287
+ toJSON( meta ) {
18288
+
18289
+ const data = super.toJSON( meta );
18290
+
18291
+ if ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;
18292
+
18293
+ return data;
18294
+
18295
+ }
18296
+
18297
+ }
18298
+
18074
18299
  /**
18075
18300
  * Uniforms of a program.
18076
18301
  * Those form a tree structure with a special top-level container for the root,
@@ -18116,6 +18341,10 @@ function WebGLObjects( gl, geometries, attributes, info ) {
18116
18341
 
18117
18342
 
18118
18343
  const emptyTexture = /*@__PURE__*/ new Texture();
18344
+
18345
+ const emptyShadowTexture = /*@__PURE__*/ new DepthTexture( 1, 1 );
18346
+ emptyShadowTexture.compareFunction = LessEqualCompare;
18347
+
18119
18348
  const emptyArrayTexture = /*@__PURE__*/ new DataArrayTexture();
18120
18349
  const empty3dTexture = /*@__PURE__*/ new Data3DTexture();
18121
18350
  const emptyCubeTexture = /*@__PURE__*/ new CubeTexture();
@@ -18632,7 +18861,9 @@ function setValueT1( gl, v, textures ) {
18632
18861
 
18633
18862
  }
18634
18863
 
18635
- textures.setTexture2D( v || emptyTexture, unit );
18864
+ const emptyTexture2D = ( this.type === gl.SAMPLER_2D_SHADOW ) ? emptyShadowTexture : emptyTexture;
18865
+
18866
+ textures.setTexture2D( v || emptyTexture2D, unit );
18636
18867
 
18637
18868
  }
18638
18869
 
@@ -19016,6 +19247,7 @@ class SingleUniform {
19016
19247
  this.id = id;
19017
19248
  this.addr = addr;
19018
19249
  this.cache = [];
19250
+ this.type = activeInfo.type;
19019
19251
  this.setValue = getSingularSetter( activeInfo.type );
19020
19252
 
19021
19253
  // this.path = activeInfo.name; // DEBUG
@@ -19031,6 +19263,7 @@ class PureArrayUniform {
19031
19263
  this.id = id;
19032
19264
  this.addr = addr;
19033
19265
  this.cache = [];
19266
+ this.type = activeInfo.type;
19034
19267
  this.size = activeInfo.size;
19035
19268
  this.setValue = getPureArraySetter( activeInfo.type );
19036
19269
 
@@ -19339,6 +19572,10 @@ function getToneMappingFunction( functionName, toneMapping ) {
19339
19572
  toneMappingName = 'ACESFilmic';
19340
19573
  break;
19341
19574
 
19575
+ case AgXToneMapping:
19576
+ toneMappingName = 'AgX';
19577
+ break;
19578
+
19342
19579
  case CustomToneMapping:
19343
19580
  toneMappingName = 'Custom';
19344
19581
  break;
@@ -19366,6 +19603,16 @@ function generateExtensions( parameters ) {
19366
19603
 
19367
19604
  }
19368
19605
 
19606
+ function generateVertexExtensions( parameters ) {
19607
+
19608
+ const chunks = [
19609
+ parameters.extensionClipCullDistance ? '#extension GL_ANGLE_clip_cull_distance : require' : ''
19610
+ ];
19611
+
19612
+ return chunks.filter( filterEmptyLine ).join( '\n' );
19613
+
19614
+ }
19615
+
19369
19616
  function generateDefines( defines ) {
19370
19617
 
19371
19618
  const chunks = [];
@@ -19670,6 +19917,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
19670
19917
 
19671
19918
  const customExtensions = parameters.isWebGL2 ? '' : generateExtensions( parameters );
19672
19919
 
19920
+ const customVertexExtensions = generateVertexExtensions( parameters );
19921
+
19673
19922
  const customDefines = generateDefines( defines );
19674
19923
 
19675
19924
  const program = gl.createProgram();
@@ -19724,6 +19973,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
19724
19973
 
19725
19974
  customDefines,
19726
19975
 
19976
+ parameters.extensionClipCullDistance ? '#define USE_CLIP_DISTANCE' : '',
19977
+ parameters.batching ? '#define USE_BATCHING' : '',
19727
19978
  parameters.instancing ? '#define USE_INSTANCING' : '',
19728
19979
  parameters.instancingColor ? '#define USE_INSTANCING_COLOR' : '',
19729
19980
 
@@ -20063,6 +20314,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
20063
20314
  versionString = '#version 300 es\n';
20064
20315
 
20065
20316
  prefixVertex = [
20317
+ customVertexExtensions,
20066
20318
  'precision mediump sampler2DArray;',
20067
20319
  '#define attribute in',
20068
20320
  '#define varying out',
@@ -20556,6 +20808,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20556
20808
  const numMultiviewViews = currentRenderTarget && currentRenderTarget.isWebGLMultiviewRenderTarget ? currentRenderTarget.numViews : 0;
20557
20809
 
20558
20810
  const IS_INSTANCEDMESH = object.isInstancedMesh === true;
20811
+ const IS_BATCHEDMESH = object.isBatchedMesh === true;
20559
20812
 
20560
20813
  const HAS_MAP = !! material.map;
20561
20814
  const HAS_MATCAP = !! material.matcap;
@@ -20641,6 +20894,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20641
20894
 
20642
20895
  precision: precision,
20643
20896
 
20897
+ batching: IS_BATCHEDMESH,
20644
20898
  instancing: IS_INSTANCEDMESH,
20645
20899
  instancingColor: IS_INSTANCEDMESH && object.instanceColor !== null,
20646
20900
 
@@ -20803,6 +21057,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20803
21057
  extensionFragDepth: HAS_EXTENSIONS && material.extensions.fragDepth === true,
20804
21058
  extensionDrawBuffers: HAS_EXTENSIONS && material.extensions.drawBuffers === true,
20805
21059
  extensionShaderTextureLOD: HAS_EXTENSIONS && material.extensions.shaderTextureLOD === true,
21060
+ extensionClipCullDistance: HAS_EXTENSIONS && material.extensions.clipCullDistance && extensions.has( 'WEBGL_clip_cull_distance' ),
20806
21061
 
20807
21062
  rendererExtensionFragDepth: IS_WEBGL2 || extensions.has( 'EXT_frag_depth' ),
20808
21063
  rendererExtensionDrawBuffers: IS_WEBGL2 || extensions.has( 'WEBGL_draw_buffers' ),
@@ -20952,6 +21207,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
20952
21207
  _programLayers.enable( 17 );
20953
21208
  if ( parameters.alphaHash )
20954
21209
  _programLayers.enable( 18 );
21210
+ if ( parameters.batching )
21211
+ _programLayers.enable( 19 );
20955
21212
 
20956
21213
  array.push( _programLayers.mask );
20957
21214
  _programLayers.disableAll();
@@ -21777,8 +22034,17 @@ function WebGLLights( extensions, capabilities ) {
21777
22034
 
21778
22035
  // WebGL 2
21779
22036
 
21780
- state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
21781
- state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
22037
+ if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
22038
+
22039
+ state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
22040
+ state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
22041
+
22042
+ } else {
22043
+
22044
+ state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
22045
+ state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
22046
+
22047
+ }
21782
22048
 
21783
22049
  } else {
21784
22050
 
@@ -22415,6 +22681,7 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
22415
22681
 
22416
22682
  cachedMaterial = result.clone();
22417
22683
  materialsForVariant[ keyB ] = cachedMaterial;
22684
+ material.addEventListener( 'dispose', onMaterialDispose );
22418
22685
 
22419
22686
  }
22420
22687
 
@@ -22491,8 +22758,12 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
22491
22758
 
22492
22759
  const depthMaterial = getDepthMaterial( object, groupMaterial, light, type );
22493
22760
 
22761
+ object.onBeforeShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, group );
22762
+
22494
22763
  _renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, group );
22495
22764
 
22765
+ object.onAfterShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, group );
22766
+
22496
22767
  }
22497
22768
 
22498
22769
  }
@@ -22501,8 +22772,12 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
22501
22772
 
22502
22773
  const depthMaterial = getDepthMaterial( object, material, light, type );
22503
22774
 
22775
+ object.onBeforeShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, null );
22776
+
22504
22777
  _renderer.renderBufferDirect( shadowCamera, null, geometry, depthMaterial, object, null );
22505
22778
 
22779
+ object.onAfterShadow( _renderer, object, camera, shadowCamera, geometry, depthMaterial, null );
22780
+
22506
22781
  }
22507
22782
 
22508
22783
  }
@@ -22519,6 +22794,32 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
22519
22794
 
22520
22795
  }
22521
22796
 
22797
+ function onMaterialDispose( event ) {
22798
+
22799
+ const material = event.target;
22800
+
22801
+ material.removeEventListener( 'dispose', onMaterialDispose );
22802
+
22803
+ // make sure to remove the unique distance/depth materials used for shadow map rendering
22804
+
22805
+ for ( const id in _materialCache ) {
22806
+
22807
+ const cache = _materialCache[ id ];
22808
+
22809
+ const uuid = event.target.uuid;
22810
+
22811
+ if ( uuid in cache ) {
22812
+
22813
+ const shadowMaterial = cache[ uuid ];
22814
+ shadowMaterial.dispose();
22815
+ delete cache[ uuid ];
22816
+
22817
+ }
22818
+
22819
+ }
22820
+
22821
+ }
22822
+
22522
22823
  }
22523
22824
 
22524
22825
  function WebGLState( gl, extensions, capabilities ) {
@@ -23847,10 +24148,6 @@ function WebGLState( gl, extensions, capabilities ) {
23847
24148
  function WebGLTextures( _gl, extensions, state, properties, capabilities, utils, info ) {
23848
24149
 
23849
24150
  const isWebGL2 = capabilities.isWebGL2;
23850
- const maxTextures = capabilities.maxTextures;
23851
- const maxCubemapSize = capabilities.maxCubemapSize;
23852
- const maxTextureSize = capabilities.maxTextureSize;
23853
- const maxSamples = capabilities.maxSamples;
23854
24151
  const multisampledRTTExt = extensions.has( 'WEBGL_multisampled_render_to_texture' ) ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : null;
23855
24152
  const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test( navigator.userAgent );
23856
24153
  const multiviewExt = extensions.has( 'OCULUS_multiview' ) ? extensions.get( 'OCULUS_multiview' ) : null;
@@ -24273,9 +24570,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24273
24570
 
24274
24571
  const textureUnit = textureUnits;
24275
24572
 
24276
- if ( textureUnit >= maxTextures ) {
24573
+ if ( textureUnit >= capabilities.maxTextures ) {
24277
24574
 
24278
- console.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + maxTextures );
24575
+ console.warn( 'THREE.WebGLTextures: Trying to use ' + textureUnit + ' texture units while this GPU supports only ' + capabilities.maxTextures );
24279
24576
 
24280
24577
  }
24281
24578
 
@@ -24632,7 +24929,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24632
24929
  _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
24633
24930
 
24634
24931
  const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;
24635
- let image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );
24932
+ let image = resizeImage( texture.image, needsPowerOfTwo, false, capabilities.maxTextureSize );
24636
24933
  image = verifyColorSpace( texture, image );
24637
24934
 
24638
24935
  const supportsMips = isPowerOfTwo$1( image ) || isWebGL2,
@@ -24646,7 +24943,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
24646
24943
  let mipmap;
24647
24944
  const mipmaps = texture.mipmaps;
24648
24945
 
24649
- const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
24946
+ const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true && glInternalFormat !== RGB_ETC1_Format );
24650
24947
  const allocateMemory = ( sourceProperties.__version === undefined ) || ( forceUpload === true );
24651
24948
  const levels = getMipLevels( texture, image, supportsMips );
24652
24949
 
@@ -25059,7 +25356,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
25059
25356
 
25060
25357
  if ( ! isCompressed && ! isDataTexture ) {
25061
25358
 
25062
- cubeImage[ i ] = resizeImage( texture.image[ i ], false, true, maxCubemapSize );
25359
+ cubeImage[ i ] = resizeImage( texture.image[ i ], false, true, capabilities.maxCubemapSize );
25063
25360
 
25064
25361
  } else {
25065
25362
 
@@ -26018,7 +26315,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
26018
26315
 
26019
26316
  function getRenderTargetSamples( renderTarget ) {
26020
26317
 
26021
- return Math.min( maxSamples, renderTarget.samples );
26318
+ return Math.min( capabilities.maxSamples, renderTarget.samples );
26022
26319
 
26023
26320
  }
26024
26321
 
@@ -27351,60 +27648,6 @@ class WebXRController {
27351
27648
 
27352
27649
  }
27353
27650
 
27354
- class DepthTexture extends Texture {
27355
-
27356
- constructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {
27357
-
27358
- format = format !== undefined ? format : DepthFormat;
27359
-
27360
- if ( format !== DepthFormat && format !== DepthStencilFormat ) {
27361
-
27362
- throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
27363
-
27364
- }
27365
-
27366
- if ( type === undefined && format === DepthFormat ) type = UnsignedIntType;
27367
- if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;
27368
-
27369
- super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
27370
-
27371
- this.isDepthTexture = true;
27372
-
27373
- this.image = { width: width, height: height };
27374
-
27375
- this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
27376
- this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
27377
-
27378
- this.flipY = false;
27379
- this.generateMipmaps = false;
27380
-
27381
- this.compareFunction = null;
27382
-
27383
- }
27384
-
27385
-
27386
- copy( source ) {
27387
-
27388
- super.copy( source );
27389
-
27390
- this.compareFunction = source.compareFunction;
27391
-
27392
- return this;
27393
-
27394
- }
27395
-
27396
- toJSON( meta ) {
27397
-
27398
- const data = super.toJSON( meta );
27399
-
27400
- if ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;
27401
-
27402
- return data;
27403
-
27404
- }
27405
-
27406
- }
27407
-
27408
27651
  class WebXRManager extends EventDispatcher {
27409
27652
 
27410
27653
  constructor( renderer, gl, extensions, useMultiview ) {
@@ -27438,6 +27681,9 @@ class WebXRManager extends EventDispatcher {
27438
27681
  const controllers = [];
27439
27682
  const controllerInputSources = [];
27440
27683
 
27684
+ const currentSize = new Vector2();
27685
+ let currentPixelRatio = null;
27686
+
27441
27687
  //
27442
27688
 
27443
27689
  const cameraL = new PerspectiveCamera();
@@ -27581,6 +27827,9 @@ class WebXRManager extends EventDispatcher {
27581
27827
 
27582
27828
  scope.isPresenting = false;
27583
27829
 
27830
+ renderer.setPixelRatio( currentPixelRatio );
27831
+ renderer.setSize( currentSize.width, currentSize.height, false );
27832
+
27584
27833
  scope.dispatchEvent( { type: 'sessionend' } );
27585
27834
 
27586
27835
  }
@@ -27668,6 +27917,9 @@ class WebXRManager extends EventDispatcher {
27668
27917
 
27669
27918
  }
27670
27919
 
27920
+ currentPixelRatio = renderer.getPixelRatio();
27921
+ renderer.getSize( currentSize );
27922
+
27671
27923
  if ( ( session.renderState.layers === undefined ) || ( renderer.capabilities.isWebGL2 === false ) ) {
27672
27924
 
27673
27925
  const layerInit = {
@@ -27682,6 +27934,9 @@ class WebXRManager extends EventDispatcher {
27682
27934
 
27683
27935
  session.updateRenderState( { baseLayer: glBaseLayer } );
27684
27936
 
27937
+ renderer.setPixelRatio( 1 );
27938
+ renderer.setSize( glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, false );
27939
+
27685
27940
  newRenderTarget = new WebGLRenderTarget(
27686
27941
  glBaseLayer.framebufferWidth,
27687
27942
  glBaseLayer.framebufferHeight,
@@ -27727,6 +27982,9 @@ class WebXRManager extends EventDispatcher {
27727
27982
 
27728
27983
  session.updateRenderState( { layers: [ glProjLayer ] } );
27729
27984
 
27985
+ renderer.setPixelRatio( 1 );
27986
+ renderer.setSize( glProjLayer.textureWidth, glProjLayer.textureHeight, false );
27987
+
27730
27988
  const renderTargetOptions = {
27731
27989
  format: RGBAFormat,
27732
27990
  type: UnsignedByteType,
@@ -28875,57 +29133,62 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
28875
29133
 
28876
29134
  for ( let i = 0, il = uniforms.length; i < il; i ++ ) {
28877
29135
 
28878
- const uniform = uniforms[ i ];
29136
+ const uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];
28879
29137
 
28880
- // partly update the buffer if necessary
29138
+ for ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {
28881
29139
 
28882
- if ( hasUniformChanged( uniform, i, cache ) === true ) {
29140
+ const uniform = uniformArray[ j ];
28883
29141
 
28884
- const offset = uniform.__offset;
29142
+ if ( hasUniformChanged( uniform, i, j, cache ) === true ) {
28885
29143
 
28886
- const values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];
29144
+ const offset = uniform.__offset;
28887
29145
 
28888
- let arrayOffset = 0;
29146
+ const values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];
28889
29147
 
28890
- for ( let i = 0; i < values.length; i ++ ) {
29148
+ let arrayOffset = 0;
28891
29149
 
28892
- const value = values[ i ];
29150
+ for ( let k = 0; k < values.length; k ++ ) {
28893
29151
 
28894
- const info = getUniformSize( value );
29152
+ const value = values[ k ];
28895
29153
 
28896
- if ( typeof value === 'number' ) {
29154
+ const info = getUniformSize( value );
28897
29155
 
28898
- uniform.__data[ 0 ] = value;
28899
- gl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );
29156
+ // TODO add integer and struct support
29157
+ if ( typeof value === 'number' || typeof value === 'boolean' ) {
28900
29158
 
28901
- } else if ( value.isMatrix3 ) {
29159
+ uniform.__data[ 0 ] = value;
29160
+ gl.bufferSubData( gl.UNIFORM_BUFFER, offset + arrayOffset, uniform.__data );
28902
29161
 
28903
- // manually converting 3x3 to 3x4
29162
+ } else if ( value.isMatrix3 ) {
28904
29163
 
28905
- uniform.__data[ 0 ] = value.elements[ 0 ];
28906
- uniform.__data[ 1 ] = value.elements[ 1 ];
28907
- uniform.__data[ 2 ] = value.elements[ 2 ];
28908
- uniform.__data[ 3 ] = value.elements[ 0 ];
28909
- uniform.__data[ 4 ] = value.elements[ 3 ];
28910
- uniform.__data[ 5 ] = value.elements[ 4 ];
28911
- uniform.__data[ 6 ] = value.elements[ 5 ];
28912
- uniform.__data[ 7 ] = value.elements[ 0 ];
28913
- uniform.__data[ 8 ] = value.elements[ 6 ];
28914
- uniform.__data[ 9 ] = value.elements[ 7 ];
28915
- uniform.__data[ 10 ] = value.elements[ 8 ];
28916
- uniform.__data[ 11 ] = value.elements[ 0 ];
29164
+ // manually converting 3x3 to 3x4
28917
29165
 
28918
- } else {
29166
+ uniform.__data[ 0 ] = value.elements[ 0 ];
29167
+ uniform.__data[ 1 ] = value.elements[ 1 ];
29168
+ uniform.__data[ 2 ] = value.elements[ 2 ];
29169
+ uniform.__data[ 3 ] = 0;
29170
+ uniform.__data[ 4 ] = value.elements[ 3 ];
29171
+ uniform.__data[ 5 ] = value.elements[ 4 ];
29172
+ uniform.__data[ 6 ] = value.elements[ 5 ];
29173
+ uniform.__data[ 7 ] = 0;
29174
+ uniform.__data[ 8 ] = value.elements[ 6 ];
29175
+ uniform.__data[ 9 ] = value.elements[ 7 ];
29176
+ uniform.__data[ 10 ] = value.elements[ 8 ];
29177
+ uniform.__data[ 11 ] = 0;
29178
+
29179
+ } else {
28919
29180
 
28920
- value.toArray( uniform.__data, arrayOffset );
29181
+ value.toArray( uniform.__data, arrayOffset );
28921
29182
 
28922
- arrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;
29183
+ arrayOffset += info.storage / Float32Array.BYTES_PER_ELEMENT;
29184
+
29185
+ }
28923
29186
 
28924
29187
  }
28925
29188
 
28926
- }
29189
+ gl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );
28927
29190
 
28928
- gl.bufferSubData( gl.UNIFORM_BUFFER, offset, uniform.__data );
29191
+ }
28929
29192
 
28930
29193
  }
28931
29194
 
@@ -28935,31 +29198,22 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
28935
29198
 
28936
29199
  }
28937
29200
 
28938
- function hasUniformChanged( uniform, index, cache ) {
29201
+ function hasUniformChanged( uniform, index, indexArray, cache ) {
28939
29202
 
28940
29203
  const value = uniform.value;
29204
+ const indexString = index + '_' + indexArray;
28941
29205
 
28942
- if ( cache[ index ] === undefined ) {
29206
+ if ( cache[ indexString ] === undefined ) {
28943
29207
 
28944
29208
  // cache entry does not exist so far
28945
29209
 
28946
- if ( typeof value === 'number' ) {
29210
+ if ( typeof value === 'number' || typeof value === 'boolean' ) {
28947
29211
 
28948
- cache[ index ] = value;
29212
+ cache[ indexString ] = value;
28949
29213
 
28950
29214
  } else {
28951
29215
 
28952
- const values = Array.isArray( value ) ? value : [ value ];
28953
-
28954
- const tempValues = [];
28955
-
28956
- for ( let i = 0; i < values.length; i ++ ) {
28957
-
28958
- tempValues.push( values[ i ].clone() );
28959
-
28960
- }
28961
-
28962
- cache[ index ] = tempValues;
29216
+ cache[ indexString ] = value.clone();
28963
29217
 
28964
29218
  }
28965
29219
 
@@ -28967,32 +29221,25 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
28967
29221
 
28968
29222
  } else {
28969
29223
 
29224
+ const cachedObject = cache[ indexString ];
29225
+
28970
29226
  // compare current value with cached entry
28971
29227
 
28972
- if ( typeof value === 'number' ) {
29228
+ if ( typeof value === 'number' || typeof value === 'boolean' ) {
28973
29229
 
28974
- if ( cache[ index ] !== value ) {
29230
+ if ( cachedObject !== value ) {
28975
29231
 
28976
- cache[ index ] = value;
29232
+ cache[ indexString ] = value;
28977
29233
  return true;
28978
29234
 
28979
29235
  }
28980
29236
 
28981
29237
  } else {
28982
29238
 
28983
- const cachedObjects = Array.isArray( cache[ index ] ) ? cache[ index ] : [ cache[ index ] ];
28984
- const values = Array.isArray( value ) ? value : [ value ];
28985
-
28986
- for ( let i = 0; i < cachedObjects.length; i ++ ) {
28987
-
28988
- const cachedObject = cachedObjects[ i ];
29239
+ if ( cachedObject.equals( value ) === false ) {
28989
29240
 
28990
- if ( cachedObject.equals( values[ i ] ) === false ) {
28991
-
28992
- cachedObject.copy( values[ i ] );
28993
- return true;
28994
-
28995
- }
29241
+ cachedObject.copy( value );
29242
+ return true;
28996
29243
 
28997
29244
  }
28998
29245
 
@@ -29013,63 +29260,53 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
29013
29260
 
29014
29261
  let offset = 0; // global buffer offset in bytes
29015
29262
  const chunkSize = 16; // size of a chunk in bytes
29016
- let chunkOffset = 0; // offset within a single chunk in bytes
29017
29263
 
29018
29264
  for ( let i = 0, l = uniforms.length; i < l; i ++ ) {
29019
29265
 
29020
- const uniform = uniforms[ i ];
29021
-
29022
- const infos = {
29023
- boundary: 0, // bytes
29024
- storage: 0 // bytes
29025
- };
29266
+ const uniformArray = Array.isArray( uniforms[ i ] ) ? uniforms[ i ] : [ uniforms[ i ] ];
29026
29267
 
29027
- const values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];
29268
+ for ( let j = 0, jl = uniformArray.length; j < jl; j ++ ) {
29028
29269
 
29029
- for ( let j = 0, jl = values.length; j < jl; j ++ ) {
29270
+ const uniform = uniformArray[ j ];
29030
29271
 
29031
- const value = values[ j ];
29272
+ const values = Array.isArray( uniform.value ) ? uniform.value : [ uniform.value ];
29032
29273
 
29033
- const info = getUniformSize( value );
29274
+ for ( let k = 0, kl = values.length; k < kl; k ++ ) {
29034
29275
 
29035
- infos.boundary += info.boundary;
29036
- infos.storage += info.storage;
29276
+ const value = values[ k ];
29037
29277
 
29038
- }
29039
-
29040
- // the following two properties will be used for partial buffer updates
29278
+ const info = getUniformSize( value );
29041
29279
 
29042
- uniform.__data = new Float32Array( infos.storage / Float32Array.BYTES_PER_ELEMENT );
29043
- uniform.__offset = offset;
29280
+ // Calculate the chunk offset
29281
+ const chunkOffsetUniform = offset % chunkSize;
29044
29282
 
29045
- //
29283
+ // Check for chunk overflow
29284
+ if ( chunkOffsetUniform !== 0 && ( chunkSize - chunkOffsetUniform ) < info.boundary ) {
29046
29285
 
29047
- if ( i > 0 ) {
29286
+ // Add padding and adjust offset
29287
+ offset += ( chunkSize - chunkOffsetUniform );
29048
29288
 
29049
- chunkOffset = offset % chunkSize;
29289
+ }
29050
29290
 
29051
- const remainingSizeInChunk = chunkSize - chunkOffset;
29291
+ // the following two properties will be used for partial buffer updates
29052
29292
 
29053
- // check for chunk overflow
29293
+ uniform.__data = new Float32Array( info.storage / Float32Array.BYTES_PER_ELEMENT );
29294
+ uniform.__offset = offset;
29054
29295
 
29055
- if ( chunkOffset !== 0 && ( remainingSizeInChunk - infos.boundary ) < 0 ) {
29056
29296
 
29057
- // add padding and adjust offset
29297
+ // Update the global offset
29298
+ offset += info.storage;
29058
29299
 
29059
- offset += ( chunkSize - chunkOffset );
29060
- uniform.__offset = offset;
29061
29300
 
29062
29301
  }
29063
29302
 
29064
29303
  }
29065
29304
 
29066
- offset += infos.storage;
29067
-
29068
29305
  }
29069
29306
 
29070
29307
  // ensure correct final padding
29071
29308
 
29072
- chunkOffset = offset % chunkSize;
29309
+ const chunkOffset = offset % chunkSize;
29073
29310
 
29074
29311
  if ( chunkOffset > 0 ) offset += ( chunkSize - chunkOffset );
29075
29312
 
@@ -29091,9 +29328,9 @@ function WebGLUniformsGroups( gl, info, capabilities, state ) {
29091
29328
 
29092
29329
  // determine sizes according to STD140
29093
29330
 
29094
- if ( typeof value === 'number' ) {
29331
+ if ( typeof value === 'number' || typeof value === 'boolean' ) {
29095
29332
 
29096
- // float/int
29333
+ // float/int/bool
29097
29334
 
29098
29335
  info.boundary = 4;
29099
29336
  info.storage = 4;
@@ -30024,7 +30261,11 @@ class WebGLRenderer {
30024
30261
 
30025
30262
  }
30026
30263
 
30027
- if ( object.isInstancedMesh ) {
30264
+ if ( object.isBatchedMesh ) {
30265
+
30266
+ renderer.renderMultiDraw( object._multiDrawStarts, object._multiDrawCounts, object._multiDrawCount );
30267
+
30268
+ } else if ( object.isInstancedMesh ) {
30028
30269
 
30029
30270
  renderer.renderInstances( drawStart, drawCount, object.count );
30030
30271
 
@@ -30860,6 +31101,7 @@ class WebGLRenderer {
30860
31101
  const materialProperties = properties.get( material );
30861
31102
 
30862
31103
  materialProperties.outputColorSpace = parameters.outputColorSpace;
31104
+ materialProperties.batching = parameters.batching;
30863
31105
  materialProperties.instancing = parameters.instancing;
30864
31106
  materialProperties.instancingColor = parameters.instancingColor;
30865
31107
  materialProperties.skinning = parameters.skinning;
@@ -30943,6 +31185,14 @@ class WebGLRenderer {
30943
31185
 
30944
31186
  needsProgramChange = true;
30945
31187
 
31188
+ } else if ( object.isBatchedMesh && materialProperties.batching === false ) {
31189
+
31190
+ needsProgramChange = true;
31191
+
31192
+ } else if ( ! object.isBatchedMesh && materialProperties.batching === true ) {
31193
+
31194
+ needsProgramChange = true;
31195
+
30946
31196
  } else if ( object.isInstancedMesh && materialProperties.instancing === false ) {
30947
31197
 
30948
31198
  needsProgramChange = true;
@@ -31132,7 +31382,6 @@ class WebGLRenderer {
31132
31382
  if ( skeleton.boneTexture === null ) skeleton.computeBoneTexture();
31133
31383
 
31134
31384
  p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture, textures );
31135
- p_uniforms.setValue( _gl, 'boneTextureSize', skeleton.boneTextureSize );
31136
31385
 
31137
31386
  } else {
31138
31387
 
@@ -31144,6 +31393,13 @@ class WebGLRenderer {
31144
31393
 
31145
31394
  }
31146
31395
 
31396
+ if ( object.isBatchedMesh ) {
31397
+
31398
+ p_uniforms.setOptional( _gl, object, 'batchingTexture' );
31399
+ p_uniforms.setValue( _gl, 'batchingTexture', object._matricesTexture, textures );
31400
+
31401
+ }
31402
+
31147
31403
  const morphAttributes = geometry.morphAttributes;
31148
31404
 
31149
31405
  if ( morphAttributes.position !== undefined || morphAttributes.normal !== undefined || ( morphAttributes.color !== undefined && capabilities.isWebGL2 === true ) ) {
@@ -31618,7 +31874,7 @@ class WebGLRenderer {
31618
31874
  textures.setTexture3D( dstTexture, 0 );
31619
31875
  glTarget = _gl.TEXTURE_3D;
31620
31876
 
31621
- } else if ( dstTexture.isDataArrayTexture ) {
31877
+ } else if ( dstTexture.isDataArrayTexture || dstTexture.isCompressedArrayTexture ) {
31622
31878
 
31623
31879
  textures.setTexture2DArray( dstTexture, 0 );
31624
31880
  glTarget = _gl.TEXTURE_2D_ARRAY;
@@ -31640,7 +31896,7 @@ class WebGLRenderer {
31640
31896
  const unpackSkipRows = _gl.getParameter( _gl.UNPACK_SKIP_ROWS );
31641
31897
  const unpackSkipImages = _gl.getParameter( _gl.UNPACK_SKIP_IMAGES );
31642
31898
 
31643
- const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ 0 ] : srcTexture.image;
31899
+ const image = srcTexture.isCompressedTexture ? srcTexture.mipmaps[ level ] : srcTexture.image;
31644
31900
 
31645
31901
  _gl.pixelStorei( _gl.UNPACK_ROW_LENGTH, image.width );
31646
31902
  _gl.pixelStorei( _gl.UNPACK_IMAGE_HEIGHT, image.height );
@@ -31745,20 +32001,6 @@ class WebGLRenderer {
31745
32001
 
31746
32002
  }
31747
32003
 
31748
- get physicallyCorrectLights() { // @deprecated, r150
31749
-
31750
- console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
31751
- return ! this.useLegacyLights;
31752
-
31753
- }
31754
-
31755
- set physicallyCorrectLights( value ) { // @deprecated, r150
31756
-
31757
- console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
31758
- this.useLegacyLights = ! value;
31759
-
31760
- }
31761
-
31762
32004
  get outputEncoding() { // @deprecated, r152
31763
32005
 
31764
32006
  console.warn( 'THREE.WebGLRenderer: Property .outputEncoding has been removed. Use .outputColorSpace instead.' );
@@ -31931,7 +32173,8 @@ class InterleavedBuffer {
31931
32173
  this.count = array !== undefined ? array.length / stride : 0;
31932
32174
 
31933
32175
  this.usage = StaticDrawUsage;
31934
- this.updateRange = { offset: 0, count: - 1 };
32176
+ this._updateRange = { offset: 0, count: - 1 };
32177
+ this.updateRanges = [];
31935
32178
 
31936
32179
  this.version = 0;
31937
32180
 
@@ -31947,6 +32190,13 @@ class InterleavedBuffer {
31947
32190
 
31948
32191
  }
31949
32192
 
32193
+ get updateRange() {
32194
+
32195
+ console.warn( 'THREE.InterleavedBuffer: updateRange() is deprecated and will be removed in r169. Use addUpdateRange() instead.' ); // @deprecated, r159
32196
+ return this._updateRange;
32197
+
32198
+ }
32199
+
31950
32200
  setUsage( value ) {
31951
32201
 
31952
32202
  this.usage = value;
@@ -31955,6 +32205,18 @@ class InterleavedBuffer {
31955
32205
 
31956
32206
  }
31957
32207
 
32208
+ addUpdateRange( start, count ) {
32209
+
32210
+ this.updateRanges.push( { start, count } );
32211
+
32212
+ }
32213
+
32214
+ clearUpdateRanges() {
32215
+
32216
+ this.updateRanges.length = 0;
32217
+
32218
+ }
32219
+
31958
32220
  copy( source ) {
31959
32221
 
31960
32222
  this.array = new source.array.constructor( source.array );
@@ -32061,7 +32323,7 @@ class InterleavedBuffer {
32061
32323
 
32062
32324
  }
32063
32325
 
32064
- const _vector$5 = /*@__PURE__*/ new Vector3();
32326
+ const _vector$6 = /*@__PURE__*/ new Vector3();
32065
32327
 
32066
32328
  class InterleavedBufferAttribute {
32067
32329
 
@@ -32101,11 +32363,11 @@ class InterleavedBufferAttribute {
32101
32363
 
32102
32364
  for ( let i = 0, l = this.data.count; i < l; i ++ ) {
32103
32365
 
32104
- _vector$5.fromBufferAttribute( this, i );
32366
+ _vector$6.fromBufferAttribute( this, i );
32105
32367
 
32106
- _vector$5.applyMatrix4( m );
32368
+ _vector$6.applyMatrix4( m );
32107
32369
 
32108
- this.setXYZ( i, _vector$5.x, _vector$5.y, _vector$5.z );
32370
+ this.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );
32109
32371
 
32110
32372
  }
32111
32373
 
@@ -32117,11 +32379,11 @@ class InterleavedBufferAttribute {
32117
32379
 
32118
32380
  for ( let i = 0, l = this.count; i < l; i ++ ) {
32119
32381
 
32120
- _vector$5.fromBufferAttribute( this, i );
32382
+ _vector$6.fromBufferAttribute( this, i );
32121
32383
 
32122
- _vector$5.applyNormalMatrix( m );
32384
+ _vector$6.applyNormalMatrix( m );
32123
32385
 
32124
- this.setXYZ( i, _vector$5.x, _vector$5.y, _vector$5.z );
32386
+ this.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );
32125
32387
 
32126
32388
  }
32127
32389
 
@@ -32133,11 +32395,11 @@ class InterleavedBufferAttribute {
32133
32395
 
32134
32396
  for ( let i = 0, l = this.count; i < l; i ++ ) {
32135
32397
 
32136
- _vector$5.fromBufferAttribute( this, i );
32398
+ _vector$6.fromBufferAttribute( this, i );
32137
32399
 
32138
- _vector$5.transformDirection( m );
32400
+ _vector$6.transformDirection( m );
32139
32401
 
32140
- this.setXYZ( i, _vector$5.x, _vector$5.y, _vector$5.z );
32402
+ this.setXYZ( i, _vector$6.x, _vector$6.y, _vector$6.z );
32141
32403
 
32142
32404
  }
32143
32405
 
@@ -32824,7 +33086,7 @@ const _vector3 = /*@__PURE__*/ new Vector3();
32824
33086
  const _matrix4 = /*@__PURE__*/ new Matrix4();
32825
33087
  const _vertex = /*@__PURE__*/ new Vector3();
32826
33088
 
32827
- const _sphere$3 = /*@__PURE__*/ new Sphere();
33089
+ const _sphere$4 = /*@__PURE__*/ new Sphere();
32828
33090
  const _inverseMatrix$2 = /*@__PURE__*/ new Matrix4();
32829
33091
  const _ray$2 = /*@__PURE__*/ new Ray();
32830
33092
 
@@ -32921,10 +33183,10 @@ class SkinnedMesh extends Mesh {
32921
33183
 
32922
33184
  if ( this.boundingSphere === null ) this.computeBoundingSphere();
32923
33185
 
32924
- _sphere$3.copy( this.boundingSphere );
32925
- _sphere$3.applyMatrix4( matrixWorld );
33186
+ _sphere$4.copy( this.boundingSphere );
33187
+ _sphere$4.applyMatrix4( matrixWorld );
32926
33188
 
32927
- if ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return;
33189
+ if ( raycaster.ray.intersectsSphere( _sphere$4 ) === false ) return;
32928
33190
 
32929
33191
  // convert ray to local space of skinned mesh
32930
33192
 
@@ -33103,7 +33365,7 @@ class DataTexture extends Texture {
33103
33365
  }
33104
33366
 
33105
33367
  const _offsetMatrix = /*@__PURE__*/ new Matrix4();
33106
- const _identityMatrix = /*@__PURE__*/ new Matrix4();
33368
+ const _identityMatrix$1 = /*@__PURE__*/ new Matrix4();
33107
33369
 
33108
33370
  class Skeleton {
33109
33371
 
@@ -33116,7 +33378,6 @@ class Skeleton {
33116
33378
  this.boneMatrices = null;
33117
33379
 
33118
33380
  this.boneTexture = null;
33119
- this.boneTextureSize = 0;
33120
33381
 
33121
33382
  this.init();
33122
33383
 
@@ -33233,7 +33494,7 @@ class Skeleton {
33233
33494
 
33234
33495
  // compute the offset between the current and the original transform
33235
33496
 
33236
- const matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix;
33497
+ const matrix = bones[ i ] ? bones[ i ].matrixWorld : _identityMatrix$1;
33237
33498
 
33238
33499
  _offsetMatrix.multiplyMatrices( matrix, boneInverses[ i ] );
33239
33500
  _offsetMatrix.toArray( boneMatrices, i * 16 );
@@ -33264,7 +33525,7 @@ class Skeleton {
33264
33525
  // 64x64 pixel texture max 1024 bones * 4 pixels = (64 * 64)
33265
33526
 
33266
33527
  let size = Math.sqrt( this.bones.length * 4 ); // 4 pixels needed for 1 matrix
33267
- size = ceilPowerOfTwo( size );
33528
+ size = Math.ceil( size / 4 ) * 4;
33268
33529
  size = Math.max( size, 4 );
33269
33530
 
33270
33531
  const boneMatrices = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel
@@ -33275,7 +33536,6 @@ class Skeleton {
33275
33536
 
33276
33537
  this.boneMatrices = boneMatrices;
33277
33538
  this.boneTexture = boneTexture;
33278
- this.boneTextureSize = size;
33279
33539
 
33280
33540
  return this;
33281
33541
 
@@ -33414,8 +33674,8 @@ const _instanceIntersects = [];
33414
33674
 
33415
33675
  const _box3 = /*@__PURE__*/ new Box3();
33416
33676
  const _identity = /*@__PURE__*/ new Matrix4();
33417
- const _mesh = /*@__PURE__*/ new Mesh();
33418
- const _sphere$2 = /*@__PURE__*/ new Sphere();
33677
+ const _mesh$1 = /*@__PURE__*/ new Mesh();
33678
+ const _sphere$3 = /*@__PURE__*/ new Sphere();
33419
33679
 
33420
33680
  class InstancedMesh extends Mesh {
33421
33681
 
@@ -33495,9 +33755,9 @@ class InstancedMesh extends Mesh {
33495
33755
 
33496
33756
  this.getMatrixAt( i, _instanceLocalMatrix );
33497
33757
 
33498
- _sphere$2.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix );
33758
+ _sphere$3.copy( geometry.boundingSphere ).applyMatrix4( _instanceLocalMatrix );
33499
33759
 
33500
- this.boundingSphere.union( _sphere$2 );
33760
+ this.boundingSphere.union( _sphere$3 );
33501
33761
 
33502
33762
  }
33503
33763
 
@@ -33537,19 +33797,19 @@ class InstancedMesh extends Mesh {
33537
33797
  const matrixWorld = this.matrixWorld;
33538
33798
  const raycastTimes = this.count;
33539
33799
 
33540
- _mesh.geometry = this.geometry;
33541
- _mesh.material = this.material;
33800
+ _mesh$1.geometry = this.geometry;
33801
+ _mesh$1.material = this.material;
33542
33802
 
33543
- if ( _mesh.material === undefined ) return;
33803
+ if ( _mesh$1.material === undefined ) return;
33544
33804
 
33545
33805
  // test with bounding sphere first
33546
33806
 
33547
33807
  if ( this.boundingSphere === null ) this.computeBoundingSphere();
33548
33808
 
33549
- _sphere$2.copy( this.boundingSphere );
33550
- _sphere$2.applyMatrix4( matrixWorld );
33809
+ _sphere$3.copy( this.boundingSphere );
33810
+ _sphere$3.applyMatrix4( matrixWorld );
33551
33811
 
33552
- if ( raycaster.ray.intersectsSphere( _sphere$2 ) === false ) return;
33812
+ if ( raycaster.ray.intersectsSphere( _sphere$3 ) === false ) return;
33553
33813
 
33554
33814
  // now test each instance
33555
33815
 
@@ -33563,9 +33823,9 @@ class InstancedMesh extends Mesh {
33563
33823
 
33564
33824
  // the mesh represents this single instance
33565
33825
 
33566
- _mesh.matrixWorld = _instanceWorldMatrix;
33826
+ _mesh$1.matrixWorld = _instanceWorldMatrix;
33567
33827
 
33568
- _mesh.raycast( raycaster, _instanceIntersects );
33828
+ _mesh$1.raycast( raycaster, _instanceIntersects );
33569
33829
 
33570
33830
  // process the result of raycast
33571
33831
 
@@ -33614,6 +33874,1011 @@ class InstancedMesh extends Mesh {
33614
33874
 
33615
33875
  }
33616
33876
 
33877
+ function sortOpaque( a, b ) {
33878
+
33879
+ return a.z - b.z;
33880
+
33881
+ }
33882
+
33883
+ function sortTransparent( a, b ) {
33884
+
33885
+ return b.z - a.z;
33886
+
33887
+ }
33888
+
33889
+ class MultiDrawRenderList {
33890
+
33891
+ constructor() {
33892
+
33893
+ this.index = 0;
33894
+ this.pool = [];
33895
+ this.list = [];
33896
+
33897
+ }
33898
+
33899
+ push( drawRange, z ) {
33900
+
33901
+ const pool = this.pool;
33902
+ const list = this.list;
33903
+ if ( this.index >= pool.length ) {
33904
+
33905
+ pool.push( {
33906
+
33907
+ start: - 1,
33908
+ count: - 1,
33909
+ z: - 1,
33910
+
33911
+ } );
33912
+
33913
+ }
33914
+
33915
+ const item = pool[ this.index ];
33916
+ list.push( item );
33917
+ this.index ++;
33918
+
33919
+ item.start = drawRange.start;
33920
+ item.count = drawRange.count;
33921
+ item.z = z;
33922
+
33923
+ }
33924
+
33925
+ reset() {
33926
+
33927
+ this.list.length = 0;
33928
+ this.index = 0;
33929
+
33930
+ }
33931
+
33932
+ }
33933
+
33934
+ const ID_ATTR_NAME = 'batchId';
33935
+ const _matrix = /*@__PURE__*/ new Matrix4();
33936
+ const _invMatrixWorld = /*@__PURE__*/ new Matrix4();
33937
+ const _identityMatrix = /*@__PURE__*/ new Matrix4();
33938
+ const _projScreenMatrix$2 = /*@__PURE__*/ new Matrix4();
33939
+ const _frustum = /*@__PURE__*/ new Frustum();
33940
+ const _box$1 = /*@__PURE__*/ new Box3();
33941
+ const _sphere$2 = /*@__PURE__*/ new Sphere();
33942
+ const _vector$5 = /*@__PURE__*/ new Vector3();
33943
+ const _renderList = /*@__PURE__*/ new MultiDrawRenderList();
33944
+ const _mesh = /*@__PURE__*/ new Mesh();
33945
+ const _batchIntersects = [];
33946
+
33947
+ // @TODO: SkinnedMesh support?
33948
+ // @TODO: geometry.groups support?
33949
+ // @TODO: geometry.drawRange support?
33950
+ // @TODO: geometry.morphAttributes support?
33951
+ // @TODO: Support uniform parameter per geometry
33952
+ // @TODO: Add an "optimize" function to pack geometry and remove data gaps
33953
+
33954
+ // copies data from attribute "src" into "target" starting at "targetOffset"
33955
+ function copyAttributeData( src, target, targetOffset = 0 ) {
33956
+
33957
+ const itemSize = target.itemSize;
33958
+ if ( src.isInterleavedBufferAttribute || src.array.constructor !== target.array.constructor ) {
33959
+
33960
+ // use the component getters and setters if the array data cannot
33961
+ // be copied directly
33962
+ const vertexCount = src.count;
33963
+ for ( let i = 0; i < vertexCount; i ++ ) {
33964
+
33965
+ for ( let c = 0; c < itemSize; c ++ ) {
33966
+
33967
+ target.setComponent( i + targetOffset, c, src.getComponent( i, c ) );
33968
+
33969
+ }
33970
+
33971
+ }
33972
+
33973
+ } else {
33974
+
33975
+ // faster copy approach using typed array set function
33976
+ target.array.set( src.array, targetOffset * itemSize );
33977
+
33978
+ }
33979
+
33980
+ target.needsUpdate = true;
33981
+
33982
+ }
33983
+
33984
+ class BatchedMesh extends Mesh {
33985
+
33986
+ get maxGeometryCount() {
33987
+
33988
+ return this._maxGeometryCount;
33989
+
33990
+ }
33991
+
33992
+ constructor( maxGeometryCount, maxVertexCount, maxIndexCount = maxVertexCount * 2, material ) {
33993
+
33994
+ super( new BufferGeometry(), material );
33995
+
33996
+ this.isBatchedMesh = true;
33997
+ this.perObjectFrustumCulled = true;
33998
+ this.sortObjects = true;
33999
+ this.boundingBox = null;
34000
+ this.boundingSphere = null;
34001
+ this.customSort = null;
34002
+
34003
+ this._drawRanges = [];
34004
+ this._reservedRanges = [];
34005
+
34006
+ this._visibility = [];
34007
+ this._active = [];
34008
+ this._bounds = [];
34009
+
34010
+ this._maxGeometryCount = maxGeometryCount;
34011
+ this._maxVertexCount = maxVertexCount;
34012
+ this._maxIndexCount = maxIndexCount;
34013
+
34014
+ this._geometryInitialized = false;
34015
+ this._geometryCount = 0;
34016
+ this._multiDrawCounts = new Int32Array( maxGeometryCount );
34017
+ this._multiDrawStarts = new Int32Array( maxGeometryCount );
34018
+ this._multiDrawCount = 0;
34019
+ this._visibilityChanged = true;
34020
+
34021
+ // Local matrix per geometry by using data texture
34022
+ this._matricesTexture = null;
34023
+
34024
+ this._initMatricesTexture();
34025
+
34026
+ }
34027
+
34028
+ _initMatricesTexture() {
34029
+
34030
+ // layout (1 matrix = 4 pixels)
34031
+ // RGBA RGBA RGBA RGBA (=> column1, column2, column3, column4)
34032
+ // with 8x8 pixel texture max 16 matrices * 4 pixels = (8 * 8)
34033
+ // 16x16 pixel texture max 64 matrices * 4 pixels = (16 * 16)
34034
+ // 32x32 pixel texture max 256 matrices * 4 pixels = (32 * 32)
34035
+ // 64x64 pixel texture max 1024 matrices * 4 pixels = (64 * 64)
34036
+
34037
+ let size = Math.sqrt( this._maxGeometryCount * 4 ); // 4 pixels needed for 1 matrix
34038
+ size = Math.ceil( size / 4 ) * 4;
34039
+ size = Math.max( size, 4 );
34040
+
34041
+ const matricesArray = new Float32Array( size * size * 4 ); // 4 floats per RGBA pixel
34042
+ const matricesTexture = new DataTexture( matricesArray, size, size, RGBAFormat, FloatType );
34043
+
34044
+ this._matricesTexture = matricesTexture;
34045
+
34046
+ }
34047
+
34048
+ _initializeGeometry( reference ) {
34049
+
34050
+ const geometry = this.geometry;
34051
+ const maxVertexCount = this._maxVertexCount;
34052
+ const maxGeometryCount = this._maxGeometryCount;
34053
+ const maxIndexCount = this._maxIndexCount;
34054
+ if ( this._geometryInitialized === false ) {
34055
+
34056
+ for ( const attributeName in reference.attributes ) {
34057
+
34058
+ const srcAttribute = reference.getAttribute( attributeName );
34059
+ const { array, itemSize, normalized } = srcAttribute;
34060
+
34061
+ const dstArray = new array.constructor( maxVertexCount * itemSize );
34062
+ const dstAttribute = new srcAttribute.constructor( dstArray, itemSize, normalized );
34063
+ dstAttribute.setUsage( srcAttribute.usage );
34064
+
34065
+ geometry.setAttribute( attributeName, dstAttribute );
34066
+
34067
+ }
34068
+
34069
+ if ( reference.getIndex() !== null ) {
34070
+
34071
+ const indexArray = maxVertexCount > 65536
34072
+ ? new Uint32Array( maxIndexCount )
34073
+ : new Uint16Array( maxIndexCount );
34074
+
34075
+ geometry.setIndex( new BufferAttribute( indexArray, 1 ) );
34076
+
34077
+ }
34078
+
34079
+ const idArray = maxGeometryCount > 65536
34080
+ ? new Uint32Array( maxVertexCount )
34081
+ : new Uint16Array( maxVertexCount );
34082
+ geometry.setAttribute( ID_ATTR_NAME, new BufferAttribute( idArray, 1 ) );
34083
+
34084
+ this._geometryInitialized = true;
34085
+
34086
+ }
34087
+
34088
+ }
34089
+
34090
+ // Make sure the geometry is compatible with the existing combined geometry atributes
34091
+ _validateGeometry( geometry ) {
34092
+
34093
+ // check that the geometry doesn't have a version of our reserved id attribute
34094
+ if ( geometry.getAttribute( ID_ATTR_NAME ) ) {
34095
+
34096
+ throw new Error( `BatchedMesh: Geometry cannot use attribute "${ ID_ATTR_NAME }"` );
34097
+
34098
+ }
34099
+
34100
+ // check to ensure the geometries are using consistent attributes and indices
34101
+ const batchGeometry = this.geometry;
34102
+ if ( Boolean( geometry.getIndex() ) !== Boolean( batchGeometry.getIndex() ) ) {
34103
+
34104
+ throw new Error( 'BatchedMesh: All geometries must consistently have "index".' );
34105
+
34106
+ }
34107
+
34108
+ for ( const attributeName in batchGeometry.attributes ) {
34109
+
34110
+ if ( attributeName === ID_ATTR_NAME ) {
34111
+
34112
+ continue;
34113
+
34114
+ }
34115
+
34116
+ if ( ! geometry.hasAttribute( attributeName ) ) {
34117
+
34118
+ throw new Error( `BatchedMesh: Added geometry missing "${ attributeName }". All geometries must have consistent attributes.` );
34119
+
34120
+ }
34121
+
34122
+ const srcAttribute = geometry.getAttribute( attributeName );
34123
+ const dstAttribute = batchGeometry.getAttribute( attributeName );
34124
+ if ( srcAttribute.itemSize !== dstAttribute.itemSize || srcAttribute.normalized !== dstAttribute.normalized ) {
34125
+
34126
+ throw new Error( 'BatchedMesh: All attributes must have a consistent itemSize and normalized value.' );
34127
+
34128
+ }
34129
+
34130
+ }
34131
+
34132
+ }
34133
+
34134
+ setCustomSort( func ) {
34135
+
34136
+ this.customSort = func;
34137
+ return this;
34138
+
34139
+ }
34140
+
34141
+ computeBoundingBox() {
34142
+
34143
+ if ( this.boundingBox === null ) {
34144
+
34145
+ this.boundingBox = new Box3();
34146
+
34147
+ }
34148
+
34149
+ const geometryCount = this._geometryCount;
34150
+ const boundingBox = this.boundingBox;
34151
+ const active = this._active;
34152
+
34153
+ boundingBox.makeEmpty();
34154
+ for ( let i = 0; i < geometryCount; i ++ ) {
34155
+
34156
+ if ( active[ i ] === false ) continue;
34157
+
34158
+ this.getMatrixAt( i, _matrix );
34159
+ this.getBoundingBoxAt( i, _box$1 ).applyMatrix4( _matrix );
34160
+ boundingBox.union( _box$1 );
34161
+
34162
+ }
34163
+
34164
+ }
34165
+
34166
+ computeBoundingSphere() {
34167
+
34168
+ if ( this.boundingSphere === null ) {
34169
+
34170
+ this.boundingSphere = new Sphere();
34171
+
34172
+ }
34173
+
34174
+ const geometryCount = this._geometryCount;
34175
+ const boundingSphere = this.boundingSphere;
34176
+ const active = this._active;
34177
+
34178
+ boundingSphere.makeEmpty();
34179
+ for ( let i = 0; i < geometryCount; i ++ ) {
34180
+
34181
+ if ( active[ i ] === false ) continue;
34182
+
34183
+ this.getMatrixAt( i, _matrix );
34184
+ this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );
34185
+ boundingSphere.union( _sphere$2 );
34186
+
34187
+ }
34188
+
34189
+ }
34190
+
34191
+ addGeometry( geometry, vertexCount = - 1, indexCount = - 1 ) {
34192
+
34193
+ this._initializeGeometry( geometry );
34194
+
34195
+ this._validateGeometry( geometry );
34196
+
34197
+ // ensure we're not over geometry
34198
+ if ( this._geometryCount >= this._maxGeometryCount ) {
34199
+
34200
+ throw new Error( 'BatchedMesh: Maximum geometry count reached.' );
34201
+
34202
+ }
34203
+
34204
+ // get the necessary range fo the geometry
34205
+ const reservedRange = {
34206
+ vertexStart: - 1,
34207
+ vertexCount: - 1,
34208
+ indexStart: - 1,
34209
+ indexCount: - 1,
34210
+ };
34211
+
34212
+ let lastRange = null;
34213
+ const reservedRanges = this._reservedRanges;
34214
+ const drawRanges = this._drawRanges;
34215
+ const bounds = this._bounds;
34216
+ if ( this._geometryCount !== 0 ) {
34217
+
34218
+ lastRange = reservedRanges[ reservedRanges.length - 1 ];
34219
+
34220
+ }
34221
+
34222
+ if ( vertexCount === - 1 ) {
34223
+
34224
+ reservedRange.vertexCount = geometry.getAttribute( 'position' ).count;
34225
+
34226
+ } else {
34227
+
34228
+ reservedRange.vertexCount = vertexCount;
34229
+
34230
+ }
34231
+
34232
+ if ( lastRange === null ) {
34233
+
34234
+ reservedRange.vertexStart = 0;
34235
+
34236
+ } else {
34237
+
34238
+ reservedRange.vertexStart = lastRange.vertexStart + lastRange.vertexCount;
34239
+
34240
+ }
34241
+
34242
+ const index = geometry.getIndex();
34243
+ const hasIndex = index !== null;
34244
+ if ( hasIndex ) {
34245
+
34246
+ if ( indexCount === - 1 ) {
34247
+
34248
+ reservedRange.indexCount = index.count;
34249
+
34250
+ } else {
34251
+
34252
+ reservedRange.indexCount = indexCount;
34253
+
34254
+ }
34255
+
34256
+ if ( lastRange === null ) {
34257
+
34258
+ reservedRange.indexStart = 0;
34259
+
34260
+ } else {
34261
+
34262
+ reservedRange.indexStart = lastRange.indexStart + lastRange.indexCount;
34263
+
34264
+ }
34265
+
34266
+ }
34267
+
34268
+ if (
34269
+ reservedRange.indexStart !== - 1 &&
34270
+ reservedRange.indexStart + reservedRange.indexCount > this._maxIndexCount ||
34271
+ reservedRange.vertexStart + reservedRange.vertexCount > this._maxVertexCount
34272
+ ) {
34273
+
34274
+ throw new Error( 'BatchedMesh: Reserved space request exceeds the maximum buffer size.' );
34275
+
34276
+ }
34277
+
34278
+ const visibility = this._visibility;
34279
+ const active = this._active;
34280
+ const matricesTexture = this._matricesTexture;
34281
+ const matricesArray = this._matricesTexture.image.data;
34282
+
34283
+ // push new visibility states
34284
+ visibility.push( true );
34285
+ active.push( true );
34286
+
34287
+ // update id
34288
+ const geometryId = this._geometryCount;
34289
+ this._geometryCount ++;
34290
+
34291
+ // initialize matrix information
34292
+ _identityMatrix.toArray( matricesArray, geometryId * 16 );
34293
+ matricesTexture.needsUpdate = true;
34294
+
34295
+ // add the reserved range and draw range objects
34296
+ reservedRanges.push( reservedRange );
34297
+ drawRanges.push( {
34298
+ start: hasIndex ? reservedRange.indexStart : reservedRange.vertexStart,
34299
+ count: - 1
34300
+ } );
34301
+ bounds.push( {
34302
+ boxInitialized: false,
34303
+ box: new Box3(),
34304
+
34305
+ sphereInitialized: false,
34306
+ sphere: new Sphere()
34307
+ } );
34308
+
34309
+ // set the id for the geometry
34310
+ const idAttribute = this.geometry.getAttribute( ID_ATTR_NAME );
34311
+ for ( let i = 0; i < reservedRange.vertexCount; i ++ ) {
34312
+
34313
+ idAttribute.setX( reservedRange.vertexStart + i, geometryId );
34314
+
34315
+ }
34316
+
34317
+ idAttribute.needsUpdate = true;
34318
+
34319
+ // update the geometry
34320
+ this.setGeometryAt( geometryId, geometry );
34321
+
34322
+ return geometryId;
34323
+
34324
+ }
34325
+
34326
+ setGeometryAt( id, geometry ) {
34327
+
34328
+ if ( id >= this._geometryCount ) {
34329
+
34330
+ throw new Error( 'BatchedMesh: Maximum geometry count reached.' );
34331
+
34332
+ }
34333
+
34334
+ this._validateGeometry( geometry );
34335
+
34336
+ const batchGeometry = this.geometry;
34337
+ const hasIndex = batchGeometry.getIndex() !== null;
34338
+ const dstIndex = batchGeometry.getIndex();
34339
+ const srcIndex = geometry.getIndex();
34340
+ const reservedRange = this._reservedRanges[ id ];
34341
+ if (
34342
+ hasIndex &&
34343
+ srcIndex.count > reservedRange.indexCount ||
34344
+ geometry.attributes.position.count > reservedRange.vertexCount
34345
+ ) {
34346
+
34347
+ throw new Error( 'BatchedMesh: Reserved space not large enough for provided geometry.' );
34348
+
34349
+ }
34350
+
34351
+ // copy geometry over
34352
+ const vertexStart = reservedRange.vertexStart;
34353
+ const vertexCount = reservedRange.vertexCount;
34354
+ for ( const attributeName in batchGeometry.attributes ) {
34355
+
34356
+ if ( attributeName === ID_ATTR_NAME ) {
34357
+
34358
+ continue;
34359
+
34360
+ }
34361
+
34362
+ // copy attribute data
34363
+ const srcAttribute = geometry.getAttribute( attributeName );
34364
+ const dstAttribute = batchGeometry.getAttribute( attributeName );
34365
+ copyAttributeData( srcAttribute, dstAttribute, vertexStart );
34366
+
34367
+ // fill the rest in with zeroes
34368
+ const itemSize = srcAttribute.itemSize;
34369
+ for ( let i = srcAttribute.count, l = vertexCount; i < l; i ++ ) {
34370
+
34371
+ const index = vertexStart + i;
34372
+ for ( let c = 0; c < itemSize; c ++ ) {
34373
+
34374
+ dstAttribute.setComponent( index, c, 0 );
34375
+
34376
+ }
34377
+
34378
+ }
34379
+
34380
+ dstAttribute.needsUpdate = true;
34381
+
34382
+ }
34383
+
34384
+ // copy index
34385
+ if ( hasIndex ) {
34386
+
34387
+ const indexStart = reservedRange.indexStart;
34388
+
34389
+ // copy index data over
34390
+ for ( let i = 0; i < srcIndex.count; i ++ ) {
34391
+
34392
+ dstIndex.setX( indexStart + i, vertexStart + srcIndex.getX( i ) );
34393
+
34394
+ }
34395
+
34396
+ // fill the rest in with zeroes
34397
+ for ( let i = srcIndex.count, l = reservedRange.indexCount; i < l; i ++ ) {
34398
+
34399
+ dstIndex.setX( indexStart + i, vertexStart );
34400
+
34401
+ }
34402
+
34403
+ dstIndex.needsUpdate = true;
34404
+
34405
+ }
34406
+
34407
+ // store the bounding boxes
34408
+ const bound = this._bounds[ id ];
34409
+ if ( geometry.boundingBox !== null ) {
34410
+
34411
+ bound.box.copy( geometry.boundingBox );
34412
+ bound.boxInitialized = true;
34413
+
34414
+ } else {
34415
+
34416
+ bound.boxInitialized = false;
34417
+
34418
+ }
34419
+
34420
+ if ( geometry.boundingSphere !== null ) {
34421
+
34422
+ bound.sphere.copy( geometry.boundingSphere );
34423
+ bound.sphereInitialized = true;
34424
+
34425
+ } else {
34426
+
34427
+ bound.sphereInitialized = false;
34428
+
34429
+ }
34430
+
34431
+ // set drawRange count
34432
+ const drawRange = this._drawRanges[ id ];
34433
+ const posAttr = geometry.getAttribute( 'position' );
34434
+ drawRange.count = hasIndex ? srcIndex.count : posAttr.count;
34435
+ this._visibilityChanged = true;
34436
+
34437
+ return id;
34438
+
34439
+ }
34440
+
34441
+ deleteGeometry( geometryId ) {
34442
+
34443
+ // Note: User needs to call optimize() afterward to pack the data.
34444
+
34445
+ const active = this._active;
34446
+ if ( geometryId >= active.length || active[ geometryId ] === false ) {
34447
+
34448
+ return this;
34449
+
34450
+ }
34451
+
34452
+ active[ geometryId ] = false;
34453
+ this._visibilityChanged = true;
34454
+
34455
+ return this;
34456
+
34457
+ }
34458
+
34459
+ // get bounding box and compute it if it doesn't exist
34460
+ getBoundingBoxAt( id, target ) {
34461
+
34462
+ const active = this._active;
34463
+ if ( active[ id ] === false ) {
34464
+
34465
+ return this;
34466
+
34467
+ }
34468
+
34469
+ // compute bounding box
34470
+ const bound = this._bounds[ id ];
34471
+ const box = bound.box;
34472
+ const geometry = this.geometry;
34473
+ if ( bound.boxInitialized === false ) {
34474
+
34475
+ box.makeEmpty();
34476
+
34477
+ const index = geometry.index;
34478
+ const position = geometry.attributes.position;
34479
+ const drawRange = this._drawRanges[ id ];
34480
+ for ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {
34481
+
34482
+ let iv = i;
34483
+ if ( index ) {
34484
+
34485
+ iv = index.getX( iv );
34486
+
34487
+ }
34488
+
34489
+ box.expandByPoint( _vector$5.fromBufferAttribute( position, iv ) );
34490
+
34491
+ }
34492
+
34493
+ bound.boxInitialized = true;
34494
+
34495
+ }
34496
+
34497
+ target.copy( box );
34498
+ return target;
34499
+
34500
+ }
34501
+
34502
+ // get bounding sphere and compute it if it doesn't exist
34503
+ getBoundingSphereAt( id, target ) {
34504
+
34505
+ const active = this._active;
34506
+ if ( active[ id ] === false ) {
34507
+
34508
+ return this;
34509
+
34510
+ }
34511
+
34512
+ // compute bounding sphere
34513
+ const bound = this._bounds[ id ];
34514
+ const sphere = bound.sphere;
34515
+ const geometry = this.geometry;
34516
+ if ( bound.sphereInitialized === false ) {
34517
+
34518
+ sphere.makeEmpty();
34519
+
34520
+ this.getBoundingBoxAt( id, _box$1 );
34521
+ _box$1.getCenter( sphere.center );
34522
+
34523
+ const index = geometry.index;
34524
+ const position = geometry.attributes.position;
34525
+ const drawRange = this._drawRanges[ id ];
34526
+
34527
+ let maxRadiusSq = 0;
34528
+ for ( let i = drawRange.start, l = drawRange.start + drawRange.count; i < l; i ++ ) {
34529
+
34530
+ let iv = i;
34531
+ if ( index ) {
34532
+
34533
+ iv = index.getX( iv );
34534
+
34535
+ }
34536
+
34537
+ _vector$5.fromBufferAttribute( position, iv );
34538
+ maxRadiusSq = Math.max( maxRadiusSq, sphere.center.distanceToSquared( _vector$5 ) );
34539
+
34540
+ }
34541
+
34542
+ sphere.radius = Math.sqrt( maxRadiusSq );
34543
+ bound.sphereInitialized = true;
34544
+
34545
+ }
34546
+
34547
+ target.copy( sphere );
34548
+ return target;
34549
+
34550
+ }
34551
+
34552
+ setMatrixAt( geometryId, matrix ) {
34553
+
34554
+ // @TODO: Map geometryId to index of the arrays because
34555
+ // optimize() can make geometryId mismatch the index
34556
+
34557
+ const active = this._active;
34558
+ const matricesTexture = this._matricesTexture;
34559
+ const matricesArray = this._matricesTexture.image.data;
34560
+ const geometryCount = this._geometryCount;
34561
+ if ( geometryId >= geometryCount || active[ geometryId ] === false ) {
34562
+
34563
+ return this;
34564
+
34565
+ }
34566
+
34567
+ matrix.toArray( matricesArray, geometryId * 16 );
34568
+ matricesTexture.needsUpdate = true;
34569
+
34570
+ return this;
34571
+
34572
+ }
34573
+
34574
+ getMatrixAt( geometryId, matrix ) {
34575
+
34576
+ const active = this._active;
34577
+ const matricesArray = this._matricesTexture.image.data;
34578
+ const geometryCount = this._geometryCount;
34579
+ if ( geometryId >= geometryCount || active[ geometryId ] === false ) {
34580
+
34581
+ return null;
34582
+
34583
+ }
34584
+
34585
+ return matrix.fromArray( matricesArray, geometryId * 16 );
34586
+
34587
+ }
34588
+
34589
+ setVisibleAt( geometryId, value ) {
34590
+
34591
+ const visibility = this._visibility;
34592
+ const active = this._active;
34593
+ const geometryCount = this._geometryCount;
34594
+
34595
+ // if the geometry is out of range, not active, or visibility state
34596
+ // does not change then return early
34597
+ if (
34598
+ geometryId >= geometryCount ||
34599
+ active[ geometryId ] === false ||
34600
+ visibility[ geometryId ] === value
34601
+ ) {
34602
+
34603
+ return this;
34604
+
34605
+ }
34606
+
34607
+ visibility[ geometryId ] = value;
34608
+ this._visibilityChanged = true;
34609
+
34610
+ return this;
34611
+
34612
+ }
34613
+
34614
+ getVisibleAt( geometryId ) {
34615
+
34616
+ const visibility = this._visibility;
34617
+ const active = this._active;
34618
+ const geometryCount = this._geometryCount;
34619
+
34620
+ // return early if the geometry is out of range or not active
34621
+ if ( geometryId >= geometryCount || active[ geometryId ] === false ) {
34622
+
34623
+ return false;
34624
+
34625
+ }
34626
+
34627
+ return visibility[ geometryId ];
34628
+
34629
+ }
34630
+
34631
+ raycast( raycaster, intersects ) {
34632
+
34633
+ const visibility = this._visibility;
34634
+ const active = this._active;
34635
+ const drawRanges = this._drawRanges;
34636
+ const geometryCount = this._geometryCount;
34637
+ const matrixWorld = this.matrixWorld;
34638
+ const batchGeometry = this.geometry;
34639
+
34640
+ // iterate over each geometry
34641
+ _mesh.material = this.material;
34642
+ _mesh.geometry.index = batchGeometry.index;
34643
+ _mesh.geometry.attributes = batchGeometry.attributes;
34644
+ if ( _mesh.geometry.boundingBox === null ) {
34645
+
34646
+ _mesh.geometry.boundingBox = new Box3();
34647
+
34648
+ }
34649
+
34650
+ if ( _mesh.geometry.boundingSphere === null ) {
34651
+
34652
+ _mesh.geometry.boundingSphere = new Sphere();
34653
+
34654
+ }
34655
+
34656
+ for ( let i = 0; i < geometryCount; i ++ ) {
34657
+
34658
+ if ( ! visibility[ i ] || ! active[ i ] ) {
34659
+
34660
+ continue;
34661
+
34662
+ }
34663
+
34664
+ const drawRange = drawRanges[ i ];
34665
+ _mesh.geometry.setDrawRange( drawRange.start, drawRange.count );
34666
+
34667
+ // ge the intersects
34668
+ this.getMatrixAt( i, _mesh.matrixWorld ).premultiply( matrixWorld );
34669
+ this.getBoundingBoxAt( i, _mesh.geometry.boundingBox );
34670
+ this.getBoundingSphereAt( i, _mesh.geometry.boundingSphere );
34671
+ _mesh.raycast( raycaster, _batchIntersects );
34672
+
34673
+ // add batch id to the intersects
34674
+ for ( let j = 0, l = _batchIntersects.length; j < l; j ++ ) {
34675
+
34676
+ const intersect = _batchIntersects[ j ];
34677
+ intersect.object = this;
34678
+ intersect.batchId = i;
34679
+ intersects.push( intersect );
34680
+
34681
+ }
34682
+
34683
+ _batchIntersects.length = 0;
34684
+
34685
+ }
34686
+
34687
+ _mesh.material = null;
34688
+ _mesh.geometry.index = null;
34689
+ _mesh.geometry.attributes = {};
34690
+ _mesh.geometry.setDrawRange( 0, Infinity );
34691
+
34692
+ }
34693
+
34694
+ copy( source ) {
34695
+
34696
+ super.copy( source );
34697
+
34698
+ this.geometry = source.geometry.clone();
34699
+ this.perObjectFrustumCulled = source.perObjectFrustumCulled;
34700
+ this.sortObjects = source.sortObjects;
34701
+ this.boundingBox = source.boundingBox !== null ? source.boundingBox.clone() : null;
34702
+ this.boundingSphere = source.boundingSphere !== null ? source.boundingSphere.clone() : null;
34703
+
34704
+ this._drawRanges = source._drawRanges.map( range => ( { ...range } ) );
34705
+ this._reservedRanges = source._reservedRanges.map( range => ( { ...range } ) );
34706
+
34707
+ this._visibility = source._visibility.slice();
34708
+ this._active = source._active.slice();
34709
+ this._bounds = source._bounds.map( bound => ( {
34710
+ boxInitialized: bound.boxInitialized,
34711
+ box: bound.box.clone(),
34712
+
34713
+ sphereInitialized: bound.sphereInitialized,
34714
+ sphere: bound.sphere.clone()
34715
+ } ) );
34716
+
34717
+ this._maxGeometryCount = source._maxGeometryCount;
34718
+ this._maxVertexCount = source._maxVertexCount;
34719
+ this._maxIndexCount = source._maxIndexCount;
34720
+
34721
+ this._geometryInitialized = source._geometryInitialized;
34722
+ this._geometryCount = source._geometryCount;
34723
+ this._multiDrawCounts = source._multiDrawCounts.slice();
34724
+ this._multiDrawStarts = source._multiDrawStarts.slice();
34725
+
34726
+ this._matricesTexture = source._matricesTexture.clone();
34727
+ this._matricesTexture.image.data = this._matricesTexture.image.slice();
34728
+
34729
+ return this;
34730
+
34731
+ }
34732
+
34733
+ dispose() {
34734
+
34735
+ // Assuming the geometry is not shared with other meshes
34736
+ this.geometry.dispose();
34737
+
34738
+ this._matricesTexture.dispose();
34739
+ this._matricesTexture = null;
34740
+ return this;
34741
+
34742
+ }
34743
+
34744
+ onBeforeRender( renderer, scene, camera, geometry, material/*, _group*/ ) {
34745
+
34746
+ // if visibility has not changed and frustum culling and object sorting is not required
34747
+ // then skip iterating over all items
34748
+ if ( ! this._visibilityChanged && ! this.perObjectFrustumCulled && ! this.sortObjects ) {
34749
+
34750
+ return;
34751
+
34752
+ }
34753
+
34754
+ // the indexed version of the multi draw function requires specifying the start
34755
+ // offset in bytes.
34756
+ const index = geometry.getIndex();
34757
+ const bytesPerElement = index === null ? 1 : index.array.BYTES_PER_ELEMENT;
34758
+
34759
+ const visibility = this._visibility;
34760
+ const multiDrawStarts = this._multiDrawStarts;
34761
+ const multiDrawCounts = this._multiDrawCounts;
34762
+ const drawRanges = this._drawRanges;
34763
+ const perObjectFrustumCulled = this.perObjectFrustumCulled;
34764
+
34765
+ // prepare the frustum in the local frame
34766
+ if ( perObjectFrustumCulled ) {
34767
+
34768
+ _projScreenMatrix$2
34769
+ .multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )
34770
+ .multiply( this.matrixWorld );
34771
+ _frustum.setFromProjectionMatrix(
34772
+ _projScreenMatrix$2,
34773
+ renderer.isWebGPURenderer ? WebGPUCoordinateSystem : WebGLCoordinateSystem
34774
+ );
34775
+
34776
+ }
34777
+
34778
+ let count = 0;
34779
+ if ( this.sortObjects ) {
34780
+
34781
+ // get the camera position in the local frame
34782
+ _invMatrixWorld.copy( this.matrixWorld ).invert();
34783
+ _vector$5.setFromMatrixPosition( camera.matrixWorld ).applyMatrix4( _invMatrixWorld );
34784
+
34785
+ for ( let i = 0, l = visibility.length; i < l; i ++ ) {
34786
+
34787
+ if ( visibility[ i ] ) {
34788
+
34789
+ // get the bounds in world space
34790
+ this.getMatrixAt( i, _matrix );
34791
+ this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );
34792
+
34793
+ // determine whether the batched geometry is within the frustum
34794
+ let culled = false;
34795
+ if ( perObjectFrustumCulled ) {
34796
+
34797
+ culled = ! _frustum.intersectsSphere( _sphere$2 );
34798
+
34799
+ }
34800
+
34801
+ if ( ! culled ) {
34802
+
34803
+ // get the distance from camera used for sorting
34804
+ const z = _vector$5.distanceTo( _sphere$2.center );
34805
+ _renderList.push( drawRanges[ i ], z );
34806
+
34807
+ }
34808
+
34809
+ }
34810
+
34811
+ }
34812
+
34813
+ // Sort the draw ranges and prep for rendering
34814
+ const list = _renderList.list;
34815
+ const customSort = this.customSort;
34816
+ if ( customSort === null ) {
34817
+
34818
+ list.sort( material.transparent ? sortTransparent : sortOpaque );
34819
+
34820
+ } else {
34821
+
34822
+ customSort.call( this, list, camera );
34823
+
34824
+ }
34825
+
34826
+ for ( let i = 0, l = list.length; i < l; i ++ ) {
34827
+
34828
+ const item = list[ i ];
34829
+ multiDrawStarts[ count ] = item.start * bytesPerElement;
34830
+ multiDrawCounts[ count ] = item.count;
34831
+ count ++;
34832
+
34833
+ }
34834
+
34835
+ _renderList.reset();
34836
+
34837
+ } else {
34838
+
34839
+ for ( let i = 0, l = visibility.length; i < l; i ++ ) {
34840
+
34841
+ if ( visibility[ i ] ) {
34842
+
34843
+ // determine whether the batched geometry is within the frustum
34844
+ let culled = false;
34845
+ if ( perObjectFrustumCulled ) {
34846
+
34847
+ // get the bounds in world space
34848
+ this.getMatrixAt( i, _matrix );
34849
+ this.getBoundingSphereAt( i, _sphere$2 ).applyMatrix4( _matrix );
34850
+ culled = ! _frustum.intersectsSphere( _sphere$2 );
34851
+
34852
+ }
34853
+
34854
+ if ( ! culled ) {
34855
+
34856
+ const range = drawRanges[ i ];
34857
+ multiDrawStarts[ count ] = range.start * bytesPerElement;
34858
+ multiDrawCounts[ count ] = range.count;
34859
+ count ++;
34860
+
34861
+ }
34862
+
34863
+ }
34864
+
34865
+ }
34866
+
34867
+ }
34868
+
34869
+ this._multiDrawCount = count;
34870
+ this._visibilityChanged = false;
34871
+
34872
+ }
34873
+
34874
+ onBeforeShadow( renderer, object, camera, shadowCamera, geometry, depthMaterial/* , group */ ) {
34875
+
34876
+ this.onBeforeRender( renderer, null, shadowCamera, geometry, depthMaterial );
34877
+
34878
+ }
34879
+
34880
+ }
34881
+
33617
34882
  class LineBasicMaterial extends Material {
33618
34883
 
33619
34884
  constructor( parameters ) {
@@ -35429,6 +36694,7 @@ class LineCurve3 extends Curve {
35429
36694
  this.v2 = v2;
35430
36695
 
35431
36696
  }
36697
+
35432
36698
  getPoint( t, optionalTarget = new Vector3() ) {
35433
36699
 
35434
36700
  const point = optionalTarget;
@@ -35447,6 +36713,7 @@ class LineCurve3 extends Curve {
35447
36713
  return point;
35448
36714
 
35449
36715
  }
36716
+
35450
36717
  // Line curve is linear, so we can overwrite default getPointAt
35451
36718
  getPointAt( u, optionalTarget ) {
35452
36719
 
@@ -35476,6 +36743,7 @@ class LineCurve3 extends Curve {
35476
36743
  return this;
35477
36744
 
35478
36745
  }
36746
+
35479
36747
  toJSON() {
35480
36748
 
35481
36749
  const data = super.toJSON();
@@ -35486,6 +36754,7 @@ class LineCurve3 extends Curve {
35486
36754
  return data;
35487
36755
 
35488
36756
  }
36757
+
35489
36758
  fromJSON( json ) {
35490
36759
 
35491
36760
  super.fromJSON( json );
@@ -45388,13 +46657,6 @@ class BufferGeometryLoader extends Loader {
45388
46657
  if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;
45389
46658
  if ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );
45390
46659
 
45391
- if ( attribute.updateRange !== undefined ) {
45392
-
45393
- bufferAttribute.updateRange.offset = attribute.updateRange.offset;
45394
- bufferAttribute.updateRange.count = attribute.updateRange.count;
45395
-
45396
- }
45397
-
45398
46660
  geometry.setAttribute( key, bufferAttribute );
45399
46661
 
45400
46662
  }
@@ -46336,6 +47598,52 @@ class ObjectLoader extends Loader {
46336
47598
 
46337
47599
  break;
46338
47600
 
47601
+ case 'BatchedMesh':
47602
+
47603
+ geometry = getGeometry( data.geometry );
47604
+ material = getMaterial( data.material );
47605
+
47606
+ object = new BatchedMesh( data.maxGeometryCount, data.maxVertexCount, data.maxIndexCount, material );
47607
+ object.geometry = geometry;
47608
+ object.perObjectFrustumCulled = data.perObjectFrustumCulled;
47609
+ object.sortObjects = data.sortObjects;
47610
+
47611
+ object._drawRanges = data.drawRanges;
47612
+ object._reservedRanges = data.reservedRanges;
47613
+
47614
+ object._visibility = data.visibility;
47615
+ object._active = data.active;
47616
+ object._bounds = data.bounds.map( bound => {
47617
+
47618
+ const box = new Box3();
47619
+ box.min.fromArray( bound.boxMin );
47620
+ box.max.fromArray( bound.boxMax );
47621
+
47622
+ const sphere = new Sphere();
47623
+ sphere.radius = bound.sphereRadius;
47624
+ sphere.center.fromArray( bound.sphereCenter );
47625
+
47626
+ return {
47627
+ boxInitialized: bound.boxInitialized,
47628
+ box: box,
47629
+
47630
+ sphereInitialized: bound.sphereInitialized,
47631
+ sphere: sphere
47632
+ };
47633
+
47634
+ } );
47635
+
47636
+ object._maxGeometryCount = data.maxGeometryCount;
47637
+ object._maxVertexCount = data.maxVertexCount;
47638
+ object._maxIndexCount = data.maxIndexCount;
47639
+
47640
+ object._geometryInitialized = data.geometryInitialized;
47641
+ object._geometryCount = data.geometryCount;
47642
+
47643
+ object._matricesTexture = getTexture( data.matricesTexture.uuid );
47644
+
47645
+ break;
47646
+
46339
47647
  case 'LOD':
46340
47648
 
46341
47649
  object = new LOD();
@@ -46583,6 +47891,25 @@ class ImageBitmapLoader extends Loader {
46583
47891
 
46584
47892
  scope.manager.itemStart( url );
46585
47893
 
47894
+ // If cached is a promise, wait for it to resolve
47895
+ if ( cached.then ) {
47896
+
47897
+ cached.then( imageBitmap => {
47898
+
47899
+ if ( onLoad ) onLoad( imageBitmap );
47900
+
47901
+ scope.manager.itemEnd( url );
47902
+
47903
+ } ).catch( e => {
47904
+
47905
+ if ( onError ) onError( e );
47906
+
47907
+ } );
47908
+ return;
47909
+
47910
+ }
47911
+
47912
+ // If cached is not a promise (i.e., it's already an imageBitmap)
46586
47913
  setTimeout( function () {
46587
47914
 
46588
47915
  if ( onLoad ) onLoad( cached );
@@ -46599,7 +47926,7 @@ class ImageBitmapLoader extends Loader {
46599
47926
  fetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';
46600
47927
  fetchOptions.headers = this.requestHeader;
46601
47928
 
46602
- fetch( url, fetchOptions ).then( function ( res ) {
47929
+ const promise = fetch( url, fetchOptions ).then( function ( res ) {
46603
47930
 
46604
47931
  return res.blob();
46605
47932
 
@@ -46615,15 +47942,20 @@ class ImageBitmapLoader extends Loader {
46615
47942
 
46616
47943
  scope.manager.itemEnd( url );
46617
47944
 
47945
+ return imageBitmap;
47946
+
46618
47947
  } ).catch( function ( e ) {
46619
47948
 
46620
47949
  if ( onError ) onError( e );
46621
47950
 
47951
+ Cache.remove( url );
47952
+
46622
47953
  scope.manager.itemError( url );
46623
47954
  scope.manager.itemEnd( url );
46624
47955
 
46625
47956
  } );
46626
47957
 
47958
+ Cache.add( url, promise );
46627
47959
  scope.manager.itemStart( url );
46628
47960
 
46629
47961
  }
@@ -46684,7 +48016,7 @@ class AudioLoader extends Loader {
46684
48016
 
46685
48017
  onLoad( audioBuffer );
46686
48018
 
46687
- }, handleError );
48019
+ } ).catch( handleError );
46688
48020
 
46689
48021
  } catch ( e ) {
46690
48022
 
@@ -50548,7 +51880,13 @@ class UniformsGroup extends EventDispatcher {
50548
51880
 
50549
51881
  for ( let i = 0, l = uniformsSource.length; i < l; i ++ ) {
50550
51882
 
50551
- this.uniforms.push( uniformsSource[ i ].clone() );
51883
+ const uniforms = Array.isArray( uniformsSource[ i ] ) ? uniformsSource[ i ] : [ uniformsSource[ i ] ];
51884
+
51885
+ for ( let j = 0; j < uniforms.length; j ++ ) {
51886
+
51887
+ this.uniforms.push( uniforms[ j ].clone() );
51888
+
51889
+ }
50552
51890
 
50553
51891
  }
50554
51892
 
@@ -52754,4 +54092,4 @@ if ( typeof window !== 'undefined' ) {
52754
54092
 
52755
54093
  }
52756
54094
 
52757
- export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DisplayP3ColorSpace, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, Float64BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearDisplayP3ColorSpace, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, P3Primaries, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, Rec709Primaries, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, TwoPassDoubleSide, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoTexture, WebGL1Renderer, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, _SRGBAFormat, createCanvasElement, sRGBEncoding };
54095
+ export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DisplayP3ColorSpace, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, Float64BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearDisplayP3ColorSpace, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, P3Primaries, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, Rec709Primaries, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, TwoPassDoubleSide, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoTexture, WebGL1Renderer, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLRenderTarget, WebGLRenderer, WebGLUtils, WebGPUCoordinateSystem, WireframeGeometry, WrapAroundEnding, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, _SRGBAFormat, createCanvasElement, sRGBEncoding };