super-three 0.133.5 → 0.135.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 (246) hide show
  1. package/build/three.js +617 -536
  2. package/build/three.min.js +1 -1
  3. package/build/three.module.js +760 -613
  4. package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff +0 -0
  5. package/examples/fonts/open-sans/open-sans-v15-cyrillic-ext_greek_greek-ext_cyrillic_latin_latin-ext_vietnamese-regular.woff2 +0 -0
  6. package/examples/fonts/open-sans/open-sans.css +9 -0
  7. package/examples/fonts/tabler-icons/fonts/tabler-icons.eot +0 -0
  8. package/examples/fonts/tabler-icons/fonts/tabler-icons.ttf +0 -0
  9. package/examples/fonts/tabler-icons/fonts/tabler-icons.woff +0 -0
  10. package/examples/fonts/tabler-icons/fonts/tabler-icons.woff2 +0 -0
  11. package/examples/fonts/tabler-icons/tabler-icons.min.css +4 -0
  12. package/examples/js/controls/ArcballControls.js +68 -27
  13. package/examples/js/controls/DragControls.js +7 -0
  14. package/examples/js/controls/OrbitControls.js +5 -36
  15. package/examples/js/controls/TrackballControls.js +3 -2
  16. package/examples/js/csm/CSM.js +2 -2
  17. package/examples/js/csm/CSMFrustum.js +133 -0
  18. package/examples/js/exporters/GLTFExporter.js +147 -63
  19. package/examples/js/exporters/USDZExporter.js +45 -26
  20. package/examples/js/lines/LineMaterial.js +58 -20
  21. package/examples/js/lines/LineSegments2.js +29 -24
  22. package/examples/js/loaders/3DMLoader.js +24 -11
  23. package/examples/js/loaders/3MFLoader.js +2 -2
  24. package/examples/js/loaders/ColladaLoader.js +61 -3
  25. package/examples/js/loaders/FBXLoader.js +1 -1
  26. package/examples/js/loaders/GLTFLoader.js +94 -31
  27. package/examples/js/loaders/KTX2Loader.js +12 -0
  28. package/examples/js/loaders/LWOLoader.js +8 -6
  29. package/examples/js/loaders/LogLuvLoader.js +766 -0
  30. package/examples/js/loaders/PLYLoader.js +32 -7
  31. package/examples/js/loaders/RGBELoader.js +2 -1
  32. package/examples/js/loaders/SVGLoader.js +7 -3
  33. package/examples/js/loaders/TDSLoader.js +237 -271
  34. package/examples/js/loaders/lwo/LWO2Parser.js +1 -0
  35. package/examples/js/loaders/lwo/LWO3Parser.js +4 -2
  36. package/examples/js/objects/MarchingCubes.js +42 -128
  37. package/examples/js/renderers/CSS2DRenderer.js +4 -4
  38. package/examples/js/renderers/CSS3DRenderer.js +4 -4
  39. package/examples/js/utils/RoughnessMipmapper.js +1 -0
  40. package/examples/jsm/controls/ArcballControls.js +61 -29
  41. package/examples/jsm/controls/DragControls.js +7 -0
  42. package/examples/jsm/controls/OrbitControls.js +9 -51
  43. package/examples/jsm/controls/TrackballControls.js +1 -1
  44. package/examples/jsm/csm/CSM.js +3 -3
  45. package/examples/jsm/csm/{Frustum.js → CSMFrustum.js} +3 -3
  46. package/examples/jsm/exporters/GLTFExporter.js +160 -74
  47. package/examples/jsm/exporters/USDZExporter.js +47 -26
  48. package/examples/jsm/libs/flow.module.js +3218 -0
  49. package/examples/jsm/libs/lil-gui.module.min.js +8 -0
  50. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  51. package/examples/jsm/lines/LineMaterial.js +59 -23
  52. package/examples/jsm/lines/LineSegments2.js +22 -18
  53. package/examples/jsm/loaders/3DMLoader.js +18 -12
  54. package/examples/jsm/loaders/3MFLoader.js +2 -2
  55. package/examples/jsm/loaders/ColladaLoader.js +61 -3
  56. package/examples/jsm/loaders/FBXLoader.js +1 -1
  57. package/examples/jsm/loaders/GLTFLoader.js +99 -35
  58. package/examples/jsm/loaders/KTX2Loader.js +19 -0
  59. package/examples/jsm/loaders/LWOLoader.js +8 -6
  60. package/examples/jsm/loaders/LogLuvLoader.js +606 -0
  61. package/examples/jsm/loaders/PLYLoader.js +33 -7
  62. package/examples/jsm/loaders/SVGLoader.js +7 -4
  63. package/examples/jsm/loaders/TDSLoader.js +225 -285
  64. package/examples/jsm/loaders/lwo/LWO2Parser.js +1 -0
  65. package/examples/jsm/loaders/lwo/LWO3Parser.js +2 -2
  66. package/examples/jsm/node-editor/NodeEditor.js +455 -0
  67. package/examples/jsm/node-editor/accessors/NormalEditor.js +30 -0
  68. package/examples/jsm/node-editor/accessors/PositionEditor.js +30 -0
  69. package/examples/jsm/node-editor/accessors/UVEditor.js +26 -0
  70. package/examples/jsm/node-editor/display/BlendEditor.js +43 -0
  71. package/examples/jsm/node-editor/examples/animate-uv.json +1 -0
  72. package/examples/jsm/node-editor/examples/fake-top-light.json +1 -0
  73. package/examples/jsm/node-editor/examples/oscillator-color.json +1 -0
  74. package/examples/jsm/node-editor/examples/rim.json +1 -0
  75. package/examples/jsm/node-editor/inputs/ColorEditor.js +91 -0
  76. package/examples/jsm/node-editor/inputs/FloatEditor.js +24 -0
  77. package/examples/jsm/node-editor/inputs/SliderEditor.js +68 -0
  78. package/examples/jsm/node-editor/inputs/Vector2Editor.js +28 -0
  79. package/examples/jsm/node-editor/inputs/Vector3Editor.js +30 -0
  80. package/examples/jsm/node-editor/inputs/Vector4Editor.js +37 -0
  81. package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +69 -0
  82. package/examples/jsm/node-editor/math/DotEditor.js +36 -0
  83. package/examples/jsm/node-editor/math/InvertEditor.js +38 -0
  84. package/examples/jsm/node-editor/math/LimiterEditor.js +48 -0
  85. package/examples/jsm/node-editor/math/NormalizeEditor.js +26 -0
  86. package/examples/jsm/node-editor/math/OperatorEditor.js +50 -0
  87. package/examples/jsm/node-editor/math/PowerEditor.js +34 -0
  88. package/examples/jsm/node-editor/math/TrigonometryEditor.js +39 -0
  89. package/examples/jsm/node-editor/procedural/CheckerEditor.js +26 -0
  90. package/examples/jsm/node-editor/utils/OscillatorEditor.js +42 -0
  91. package/examples/jsm/node-editor/utils/TimerEditor.js +57 -0
  92. package/examples/jsm/nodes/materials/StandardNodeMaterial.js +1 -1
  93. package/examples/jsm/nodes/materials/nodes/StandardNode.js +6 -6
  94. package/examples/jsm/nodes/utils/ColorSpaceNode.js +1 -49
  95. package/examples/jsm/objects/MarchingCubes.js +46 -152
  96. package/examples/jsm/postprocessing/AdaptiveToneMappingPass.js +1 -1
  97. package/examples/jsm/postprocessing/AfterimagePass.js +1 -1
  98. package/examples/jsm/postprocessing/BloomPass.js +1 -1
  99. package/examples/jsm/postprocessing/BokehPass.js +1 -1
  100. package/examples/jsm/postprocessing/ClearPass.js +1 -1
  101. package/examples/jsm/postprocessing/CubeTexturePass.js +1 -1
  102. package/examples/jsm/postprocessing/DotScreenPass.js +1 -1
  103. package/examples/jsm/postprocessing/EffectComposer.js +3 -3
  104. package/examples/jsm/postprocessing/FilmPass.js +1 -1
  105. package/examples/jsm/postprocessing/GlitchPass.js +1 -1
  106. package/examples/jsm/postprocessing/HalftonePass.js +1 -1
  107. package/examples/jsm/postprocessing/MaskPass.js +1 -1
  108. package/examples/jsm/postprocessing/OutlinePass.js +1 -1
  109. package/examples/jsm/postprocessing/RenderPass.js +1 -1
  110. package/examples/jsm/postprocessing/SAOPass.js +1 -1
  111. package/examples/jsm/postprocessing/SMAAPass.js +1 -1
  112. package/examples/jsm/postprocessing/SSAARenderPass.js +1 -1
  113. package/examples/jsm/postprocessing/SSAOPass.js +1 -1
  114. package/examples/jsm/postprocessing/SSRPass.js +1 -1
  115. package/examples/jsm/postprocessing/SSRrPass.js +1 -1
  116. package/examples/jsm/postprocessing/SavePass.js +1 -1
  117. package/examples/jsm/postprocessing/ShaderPass.js +1 -1
  118. package/examples/jsm/postprocessing/TAARenderPass.js +1 -1
  119. package/examples/jsm/postprocessing/TexturePass.js +1 -1
  120. package/examples/jsm/postprocessing/UnrealBloomPass.js +1 -1
  121. package/examples/jsm/renderers/CSS2DRenderer.js +5 -4
  122. package/examples/jsm/renderers/CSS3DRenderer.js +5 -4
  123. package/examples/jsm/renderers/nodes/Nodes.js +14 -13
  124. package/examples/jsm/renderers/nodes/ShaderNode.js +193 -41
  125. package/examples/jsm/renderers/nodes/accessors/MaterialNode.js +6 -6
  126. package/examples/jsm/renderers/nodes/accessors/ModelViewProjectionNode.js +5 -5
  127. package/examples/jsm/renderers/nodes/accessors/NormalNode.js +14 -3
  128. package/examples/jsm/renderers/nodes/accessors/PointUVNode.js +3 -3
  129. package/examples/jsm/renderers/nodes/accessors/PositionNode.js +15 -5
  130. package/examples/jsm/renderers/nodes/accessors/SkinningNode.js +107 -0
  131. package/examples/jsm/renderers/nodes/accessors/UVNode.js +7 -5
  132. package/examples/jsm/renderers/nodes/core/ArrayInputNode.js +3 -3
  133. package/examples/jsm/renderers/nodes/core/AttributeNode.js +6 -0
  134. package/examples/jsm/renderers/nodes/core/BypassNode.js +38 -0
  135. package/examples/jsm/renderers/nodes/core/CodeNode.js +3 -3
  136. package/examples/jsm/renderers/nodes/core/ContextNode.js +4 -19
  137. package/examples/jsm/renderers/nodes/core/ExpressionNode.js +13 -2
  138. package/examples/jsm/renderers/nodes/core/FunctionNode.js +19 -132
  139. package/examples/jsm/renderers/nodes/core/InputNode.js +13 -3
  140. package/examples/jsm/renderers/nodes/core/Node.js +32 -10
  141. package/examples/jsm/renderers/nodes/core/NodeBuilder.js +146 -128
  142. package/examples/jsm/renderers/nodes/core/NodeFunction.js +22 -0
  143. package/examples/jsm/renderers/nodes/core/NodeFunctionInput.js +4 -4
  144. package/examples/jsm/renderers/nodes/core/NodeKeywords.js +18 -179
  145. package/examples/jsm/renderers/nodes/core/NodeParser.js +11 -0
  146. package/examples/jsm/renderers/nodes/core/NodeVar.js +2 -2
  147. package/examples/jsm/renderers/nodes/core/PropertyNode.js +14 -2
  148. package/examples/jsm/renderers/nodes/core/TempNode.js +10 -13
  149. package/examples/jsm/renderers/nodes/core/VarNode.js +12 -7
  150. package/examples/jsm/renderers/nodes/core/VaryNode.js +23 -8
  151. package/examples/jsm/renderers/nodes/core/constants.js +2 -0
  152. package/examples/jsm/renderers/nodes/display/ColorSpaceNode.js +47 -25
  153. package/examples/jsm/renderers/nodes/display/NormalMapNode.js +21 -22
  154. package/examples/jsm/renderers/nodes/functions/BSDFs.js +64 -101
  155. package/examples/jsm/renderers/nodes/inputs/BufferNode.js +25 -0
  156. package/examples/jsm/renderers/nodes/inputs/IntNode.js +17 -0
  157. package/examples/jsm/renderers/nodes/inputs/TextureNode.js +10 -2
  158. package/examples/jsm/renderers/nodes/lights/LightContextNode.js +20 -14
  159. package/examples/jsm/renderers/nodes/lights/LightNode.js +32 -36
  160. package/examples/jsm/renderers/nodes/math/CondNode.js +60 -0
  161. package/examples/jsm/renderers/nodes/math/MathNode.js +87 -36
  162. package/examples/jsm/renderers/nodes/math/OperatorNode.js +124 -31
  163. package/examples/jsm/renderers/nodes/parsers/GLSLNodeFunction.js +137 -0
  164. package/examples/jsm/renderers/nodes/parsers/GLSLNodeParser.js +14 -0
  165. package/examples/jsm/renderers/nodes/parsers/WGSLNodeFunction.js +89 -0
  166. package/examples/jsm/renderers/nodes/parsers/WGSLNodeParser.js +14 -0
  167. package/examples/jsm/renderers/nodes/procedural/CheckerNode.js +7 -9
  168. package/examples/jsm/renderers/nodes/utils/ArrayElementNode.js +31 -0
  169. package/examples/jsm/renderers/nodes/utils/ConvertNode.js +33 -0
  170. package/examples/jsm/renderers/nodes/utils/JoinNode.js +7 -7
  171. package/examples/jsm/renderers/nodes/utils/OscNode.js +58 -0
  172. package/examples/jsm/renderers/nodes/utils/SplitNode.js +18 -8
  173. package/examples/jsm/renderers/nodes/utils/SpriteSheetUVNode.js +7 -7
  174. package/examples/jsm/renderers/webgl/nodes/SlotNode.js +22 -0
  175. package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +191 -94
  176. package/examples/jsm/renderers/webgl/nodes/WebGLNodes.js +2 -2
  177. package/examples/jsm/renderers/webgl/nodes/WebGLPhysicalContextNode.js +2 -2
  178. package/examples/jsm/renderers/webgpu/WebGPUBackground.js +1 -1
  179. package/examples/jsm/renderers/webgpu/WebGPUBindings.js +3 -3
  180. package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +2 -4
  181. package/examples/jsm/renderers/webgpu/WebGPUProgrammableStage.js +2 -4
  182. package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +15 -23
  183. package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +3 -5
  184. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +11 -27
  185. package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +62 -28
  186. package/examples/jsm/renderers/webgpu/WebGPUTextures.js +34 -27
  187. package/examples/jsm/renderers/webgpu/constants.js +2 -2
  188. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +430 -98
  189. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodes.js +1 -1
  190. package/examples/jsm/utils/RoughnessMipmapper.js +1 -0
  191. package/examples/jsm/webxr/OculusHandPointerModel.js +6 -6
  192. package/package.json +10 -10
  193. package/src/Three.Legacy.js +6 -0
  194. package/src/Three.js +0 -1
  195. package/src/cameras/StereoCamera.js +8 -7
  196. package/src/constants.js +1 -2
  197. package/src/core/Layers.js +7 -1
  198. package/src/core/Object3D.js +2 -0
  199. package/src/extras/PMREMGenerator.js +11 -6
  200. package/src/loaders/FileLoader.js +89 -152
  201. package/src/loaders/ImageLoader.js +9 -4
  202. package/src/loaders/LoaderUtils.js +26 -0
  203. package/src/loaders/MaterialLoader.js +7 -4
  204. package/src/loaders/ObjectLoader.js +2 -0
  205. package/src/materials/Material.js +4 -4
  206. package/src/materials/MeshPhysicalMaterial.js +20 -14
  207. package/src/math/MathUtils.js +5 -16
  208. package/src/renderers/WebGLMultisampleRenderTarget.js +7 -1
  209. package/src/renderers/WebGLRenderer.js +83 -117
  210. package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +2 -2
  211. package/src/renderers/shaders/ShaderChunk/encodings_pars_fragment.glsl.js +0 -27
  212. package/src/renderers/shaders/ShaderChunk/envmap_common_pars_fragment.glsl.js +0 -1
  213. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +19 -6
  214. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +2 -2
  215. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  216. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +1 -1
  217. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +13 -5
  218. package/src/renderers/shaders/ShaderLib/vsm.glsl.js +2 -1
  219. package/src/renderers/shaders/ShaderLib.js +6 -4
  220. package/src/renderers/shaders/UniformsLib.js +1 -2
  221. package/src/renderers/webgl/WebGLExtensions.js +1 -0
  222. package/src/renderers/webgl/WebGLMaterials.js +27 -15
  223. package/src/renderers/webgl/WebGLProgram.js +10 -6
  224. package/src/renderers/webgl/WebGLPrograms.js +17 -12
  225. package/src/renderers/webgl/WebGLShadowMap.js +14 -5
  226. package/src/renderers/webgl/WebGLState.js +31 -17
  227. package/src/renderers/webgl/WebGLTextures.js +188 -51
  228. package/src/renderers/webgl/WebGLUniforms.js +45 -1
  229. package/src/renderers/webxr/WebXRManager.js +68 -107
  230. package/src/textures/Texture.js +6 -0
  231. package/src/utils.js +37 -1
  232. package/examples/js/controls/DeviceOrientationControls.js +0 -147
  233. package/examples/js/libs/dat.gui.min.js +0 -14
  234. package/examples/jsm/controls/DeviceOrientationControls.js +0 -153
  235. package/examples/jsm/libs/dat.gui.module.js +0 -3575
  236. package/examples/jsm/libs/glslang.js +0 -78
  237. package/examples/jsm/libs/glslang.wasm +0 -0
  238. package/examples/jsm/renderers/nodes/consts/MathConsts.js +0 -7
  239. package/examples/jsm/renderers/nodes/core/ConstNode.js +0 -39
  240. package/examples/jsm/renderers/nodes/core/NodeSlot.js +0 -13
  241. package/examples/jsm/renderers/nodes/core/StructNode.js +0 -80
  242. package/examples/jsm/renderers/nodes/core/StructVarNode.js +0 -75
  243. package/examples/jsm/renderers/nodes/functions/EncodingFunctions.js +0 -99
  244. package/examples/jsm/renderers/nodes/functions/MathFunctions.js +0 -47
  245. package/examples/jsm/renderers/webgpu/nodes/ShaderLib.js +0 -152
  246. package/src/extras/objects/ImmediateRenderObject.js +0 -31
@@ -3,7 +3,7 @@
3
3
  * Copyright 2010-2021 Three.js Authors
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
- const REVISION = '133';
6
+ const REVISION = '135';
7
7
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
8
8
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
9
9
  const CullFaceNone = 0;
@@ -164,7 +164,6 @@ const LinearEncoding = 3000;
164
164
  const sRGBEncoding = 3001;
165
165
  const GammaEncoding = 3007;
166
166
  const RGBEEncoding = 3002;
167
- const LogLuvEncoding = 3003;
168
167
  const RGBM7Encoding = 3004;
169
168
  const RGBM16Encoding = 3005;
170
169
  const RGBDEncoding = 3006;
@@ -289,13 +288,6 @@ class EventDispatcher {
289
288
 
290
289
  }
291
290
 
292
- let _seed = 1234567;
293
-
294
- const DEG2RAD = Math.PI / 180;
295
- const RAD2DEG = 180 / Math.PI;
296
-
297
- //
298
-
299
291
  const _lut = [];
300
292
 
301
293
  for ( let i = 0; i < 256; i ++ ) {
@@ -304,18 +296,14 @@ for ( let i = 0; i < 256; i ++ ) {
304
296
 
305
297
  }
306
298
 
307
- const hasRandomUUID = typeof crypto !== 'undefined' && 'randomUUID' in crypto;
308
-
309
- function generateUUID() {
310
-
311
- if ( hasRandomUUID ) {
299
+ let _seed = 1234567;
312
300
 
313
- return crypto.randomUUID().toUpperCase();
314
301
 
315
- }
302
+ const DEG2RAD = Math.PI / 180;
303
+ const RAD2DEG = 180 / Math.PI;
316
304
 
317
- // TODO Remove this code when crypto.randomUUID() is available everywhere
318
- // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
305
+ // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
306
+ function generateUUID() {
319
307
 
320
308
  const d0 = Math.random() * 0xffffffff | 0;
321
309
  const d1 = Math.random() * 0xffffffff | 0;
@@ -1418,6 +1406,42 @@ function createElementNS( name ) {
1418
1406
 
1419
1407
  }
1420
1408
 
1409
+ /**
1410
+ * cyrb53 hash for string from: https://stackoverflow.com/a/52171480
1411
+ *
1412
+ * Public Domain, @bryc - https://stackoverflow.com/users/815680/bryc
1413
+ *
1414
+ * It is roughly similar to the well-known MurmurHash/xxHash algorithms. It uses a combination
1415
+ * of multiplication and Xorshift to generate the hash, but not as thorough. As a result it's
1416
+ * faster than either would be in JavaScript and significantly simpler to implement. Keep in
1417
+ * mind this is not a secure algorithm, if privacy/security is a concern, this is not for you.
1418
+ *
1419
+ * @param {string} str
1420
+ * @param {number} seed, default 0
1421
+ * @returns number
1422
+ */
1423
+ function hashString( str, seed = 0 ) {
1424
+
1425
+ let h1 = 0xdeadbeef ^ seed, h2 = 0x41c6ce57 ^ seed;
1426
+
1427
+ for ( let i = 0, ch; i < str.length; i ++ ) {
1428
+
1429
+ ch = str.charCodeAt( i );
1430
+
1431
+ h1 = Math.imul( h1 ^ ch, 2654435761 );
1432
+
1433
+ h2 = Math.imul( h2 ^ ch, 1597334677 );
1434
+
1435
+ }
1436
+
1437
+ h1 = Math.imul( h1 ^ ( h1 >>> 16 ), 2246822507 ) ^ Math.imul( h2 ^ ( h2 >>> 13 ), 3266489909 );
1438
+
1439
+ h2 = Math.imul( h2 ^ ( h2 >>> 16 ), 2246822507 ) ^ Math.imul( h1 ^ ( h1 >>> 13 ), 3266489909 );
1440
+
1441
+ return 4294967296 * ( 2097151 & h2 ) + ( h1 >>> 0 );
1442
+
1443
+ }
1444
+
1421
1445
  let _canvas;
1422
1446
 
1423
1447
  class ImageUtils {
@@ -1531,6 +1555,8 @@ class Texture extends EventDispatcher {
1531
1555
  // update. You need to explicitly call Material.needsUpdate to trigger it to recompile.
1532
1556
  this.encoding = encoding;
1533
1557
 
1558
+ this.userData = {};
1559
+
1534
1560
  this.version = 0;
1535
1561
  this.onUpdate = null;
1536
1562
 
@@ -1585,6 +1611,8 @@ class Texture extends EventDispatcher {
1585
1611
  this.unpackAlignment = source.unpackAlignment;
1586
1612
  this.encoding = source.encoding;
1587
1613
 
1614
+ this.userData = JSON.parse( JSON.stringify( source.userData ) );
1615
+
1588
1616
  return this;
1589
1617
 
1590
1618
  }
@@ -1691,6 +1719,8 @@ class Texture extends EventDispatcher {
1691
1719
 
1692
1720
  }
1693
1721
 
1722
+ if ( JSON.stringify( this.userData ) !== '{}' ) output.userData = this.userData;
1723
+
1694
1724
  if ( ! isRootObject ) {
1695
1725
 
1696
1726
  meta.textures[ this.uuid ] = output;
@@ -2678,12 +2708,16 @@ WebGLMultipleRenderTargets.prototype.isWebGLMultipleRenderTargets = true;
2678
2708
 
2679
2709
  class WebGLMultisampleRenderTarget extends WebGLRenderTarget {
2680
2710
 
2681
- constructor( width, height, options ) {
2711
+ constructor( width, height, options = {} ) {
2682
2712
 
2683
2713
  super( width, height, options );
2684
2714
 
2685
2715
  this.samples = 4;
2686
2716
 
2717
+ this.ignoreDepthForMultisampleCopy = options.ignoreDepth !== undefined ? options.ignoreDepth : true;
2718
+ this.useRenderToTexture = ( options.useRenderToTexture !== undefined ) ? options.useRenderToTexture : false;
2719
+ this.useRenderbuffer = this.useRenderToTexture === false;
2720
+
2687
2721
  }
2688
2722
 
2689
2723
  copy( source ) {
@@ -2691,6 +2725,8 @@ class WebGLMultisampleRenderTarget extends WebGLRenderTarget {
2691
2725
  super.copy.call( this, source );
2692
2726
 
2693
2727
  this.samples = source.samples;
2728
+ this.useRenderToTexture = source.useRenderToTexture;
2729
+ this.useRenderbuffer = source.useRenderbuffer;
2694
2730
 
2695
2731
  return this;
2696
2732
 
@@ -6558,7 +6594,7 @@ class Layers {
6558
6594
 
6559
6595
  set( channel ) {
6560
6596
 
6561
- this.mask = 1 << channel | 0;
6597
+ this.mask = ( 1 << channel | 0 ) >>> 0;
6562
6598
 
6563
6599
  }
6564
6600
 
@@ -6598,6 +6634,12 @@ class Layers {
6598
6634
 
6599
6635
  }
6600
6636
 
6637
+ isEnabled( channel ) {
6638
+
6639
+ return ( this.mask & ( 1 << channel | 0 ) ) !== 0;
6640
+
6641
+ }
6642
+
6601
6643
  }
6602
6644
 
6603
6645
  let _object3DId = 0;
@@ -6998,6 +7040,8 @@ class Object3D extends EventDispatcher {
6998
7040
 
6999
7041
  // adds object as a child of this, while maintaining the object's world transform
7000
7042
 
7043
+ // Note: This method does not support scene graphs having non-uniformly-scaled nodes(s)
7044
+
7001
7045
  this.updateWorldMatrix( true, false );
7002
7046
 
7003
7047
  _m1$1.copy( this.matrixWorld ).invert();
@@ -7998,14 +8042,14 @@ class Material extends EventDispatcher {
7998
8042
  if ( this.metalness !== undefined ) data.metalness = this.metalness;
7999
8043
 
8000
8044
  if ( this.sheen !== undefined ) data.sheen = this.sheen;
8001
- if ( this.sheenTint && this.sheenTint.isColor ) data.sheenTint = this.sheenTint.getHex();
8045
+ if ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();
8002
8046
  if ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;
8003
8047
  if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();
8004
8048
  if ( this.emissiveIntensity && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
8005
8049
 
8006
8050
  if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();
8007
8051
  if ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;
8008
- if ( this.specularTint && this.specularTint.isColor ) data.specularTint = this.specularTint.getHex();
8052
+ if ( this.specularColor && this.specularColor.isColor ) data.specularColor = this.specularColor.getHex();
8009
8053
  if ( this.shininess !== undefined ) data.shininess = this.shininess;
8010
8054
  if ( this.clearcoat !== undefined ) data.clearcoat = this.clearcoat;
8011
8055
  if ( this.clearcoatRoughness !== undefined ) data.clearcoatRoughness = this.clearcoatRoughness;
@@ -8076,7 +8120,7 @@ class Material extends EventDispatcher {
8076
8120
  if ( this.emissiveMap && this.emissiveMap.isTexture ) data.emissiveMap = this.emissiveMap.toJSON( meta ).uuid;
8077
8121
  if ( this.specularMap && this.specularMap.isTexture ) data.specularMap = this.specularMap.toJSON( meta ).uuid;
8078
8122
  if ( this.specularIntensityMap && this.specularIntensityMap.isTexture ) data.specularIntensityMap = this.specularIntensityMap.toJSON( meta ).uuid;
8079
- if ( this.specularTintMap && this.specularTintMap.isTexture ) data.specularTintMap = this.specularTintMap.toJSON( meta ).uuid;
8123
+ if ( this.specularColorMap && this.specularColorMap.isTexture ) data.specularColorMap = this.specularColorMap.toJSON( meta ).uuid;
8080
8124
 
8081
8125
  if ( this.envMap && this.envMap.isTexture ) {
8082
8126
 
@@ -8101,7 +8145,7 @@ class Material extends EventDispatcher {
8101
8145
  if ( this.thickness !== undefined ) data.thickness = this.thickness;
8102
8146
  if ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;
8103
8147
  if ( this.attenuationDistance !== undefined ) data.attenuationDistance = this.attenuationDistance;
8104
- if ( this.attenuationTint !== undefined ) data.attenuationTint = this.attenuationTint.getHex();
8148
+ if ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();
8105
8149
 
8106
8150
  if ( this.size !== undefined ) data.size = this.size;
8107
8151
  if ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;
@@ -12722,7 +12766,7 @@ var begin_vertex = "vec3 transformed = vec3( position );";
12722
12766
 
12723
12767
  var beginnormal_vertex = "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";
12724
12768
 
12725
- var bsdfs = "vec3 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 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}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float 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\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\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}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\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 sheenTint, 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 sheenTint * ( D * V );\n}\n#endif";
12769
+ var bsdfs = "vec3 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 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}\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float 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\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\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}\nfloat G_BlinnPhong_Implicit( ) {\n\treturn 0.25;\n}\nfloat D_BlinnPhong( const in float shininess, const in float dotNH ) {\n\treturn RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );\n}\nvec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( specularColor, 1.0, dotVH );\n\tfloat G = G_BlinnPhong_Implicit( );\n\tfloat D = D_BlinnPhong( shininess, dotNH );\n\treturn F * ( G * D );\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";
12726
12770
 
12727
12771
  var bumpmap_pars_fragment = "#ifdef USE_BUMPMAP\n\tuniform sampler2D bumpMap;\n\tuniform float bumpScale;\n\tvec2 dHdxy_fwd() {\n\t\tvec2 dSTdx = dFdx( vUv );\n\t\tvec2 dSTdy = dFdy( vUv );\n\t\tfloat Hll = bumpScale * texture2D( bumpMap, vUv ).x;\n\t\tfloat dBx = bumpScale * texture2D( bumpMap, vUv + dSTdx ).x - Hll;\n\t\tfloat dBy = bumpScale * texture2D( bumpMap, vUv + dSTdy ).x - Hll;\n\t\treturn vec2( dBx, dBy );\n\t}\n\tvec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {\n\t\tvec3 vSigmaX = vec3( dFdx( surf_pos.x ), dFdx( surf_pos.y ), dFdx( surf_pos.z ) );\n\t\tvec3 vSigmaY = vec3( dFdy( surf_pos.x ), dFdy( surf_pos.y ), dFdy( surf_pos.z ) );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif";
12728
12772
 
@@ -12758,11 +12802,11 @@ var emissivemap_pars_fragment = "#ifdef USE_EMISSIVEMAP\n\tuniform sampler2D emi
12758
12802
 
12759
12803
  var encodings_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
12760
12804
 
12761
- var encodings_pars_fragment = "\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}\nconst mat3 cLogLuvM = mat3( 0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969 );\nvec4 LinearToLogLuv( in vec4 value ) {\n\tvec3 Xp_Y_XYZp = cLogLuvM * value.rgb;\n\tXp_Y_XYZp = max( Xp_Y_XYZp, vec3( 1e-6, 1e-6, 1e-6 ) );\n\tvec4 vResult;\n\tvResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;\n\tfloat Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;\n\tvResult.w = fract( Le );\n\tvResult.z = ( Le - ( floor( vResult.w * 255.0 ) ) / 255.0 ) / 255.0;\n\treturn vResult;\n}\nconst mat3 cLogLuvInverseM = mat3( 6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268 );\nvec4 LogLuvToLinear( in vec4 value ) {\n\tfloat Le = value.z * 255.0 + value.w;\n\tvec3 Xp_Y_XYZp;\n\tXp_Y_XYZp.y = exp2( ( Le - 127.0 ) / 2.0 );\n\tXp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;\n\tXp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;\n\tvec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;\n\treturn vec4( max( vRGB, 0.0 ), 1.0 );\n}";
12805
+ var encodings_pars_fragment = "\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 GammaToLinear( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( gammaFactor ) ), value.a );\n}\nvec4 LinearToGamma( in vec4 value, in float gammaFactor ) {\n\treturn vec4( pow( value.rgb, vec3( 1.0 / gammaFactor ) ), value.a );\n}\nvec4 sRGBToLinear( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 RGBEToLinear( in vec4 value ) {\n\treturn vec4( value.rgb * exp2( value.a * 255.0 - 128.0 ), 1.0 );\n}\nvec4 LinearToRGBE( in vec4 value ) {\n\tfloat maxComponent = max( max( value.r, value.g ), value.b );\n\tfloat fExp = clamp( ceil( log2( maxComponent ) ), -128.0, 127.0 );\n\treturn vec4( value.rgb / exp2( fExp ), ( fExp + 128.0 ) / 255.0 );\n}\nvec4 RGBMToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * value.a * maxRange, 1.0 );\n}\nvec4 LinearToRGBM( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat M = clamp( maxRGB / maxRange, 0.0, 1.0 );\n\tM = ceil( M * 255.0 ) / 255.0;\n\treturn vec4( value.rgb / ( M * maxRange ), M );\n}\nvec4 RGBDToLinear( in vec4 value, in float maxRange ) {\n\treturn vec4( value.rgb * ( ( maxRange / 255.0 ) / value.a ), 1.0 );\n}\nvec4 LinearToRGBD( in vec4 value, in float maxRange ) {\n\tfloat maxRGB = max( value.r, max( value.g, value.b ) );\n\tfloat D = max( maxRange / maxRGB, 1.0 );\n\tD = clamp( floor( D ) / 255.0, 0.0, 1.0 );\n\treturn vec4( value.rgb * ( D * ( 255.0 / maxRange ) ), D );\n}";
12762
12806
 
12763
12807
  var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t\tenvColor = envMapTexelToLinear( envColor );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
12764
12808
 
12765
- var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\tuniform int maxMipLevel;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
12809
+ var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
12766
12810
 
12767
12811
  var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";
12768
12812
 
@@ -12798,9 +12842,9 @@ var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor
12798
12842
 
12799
12843
  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 GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, 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\n#define Material_LightProbeLOD( material )\t(0)";
12800
12844
 
12801
- var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\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\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularTintFactor = specularTint;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARTINTMAP\n\t\t\tspecularTintFactor *= specularTintMapTexelToLinear( texture2D( specularTintMap, vUv ) ).rgb;\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 specularTintFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( ior - 1.0 ) / ( ior + 1.0 ) ) * specularTintFactor, 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, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).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_SHEEN\n\tmaterial.sheenTint = sheenTint;\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n#endif";
12845
+ var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\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\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= specularColorMapTexelToLinear( texture2D( specularColorMap, vUv ) ).rgb;\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( ( ior - 1.0 ) / ( 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, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).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_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= sheenColorMapTexelToLinear( texture2D( sheenColorMap, vUv ) ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif";
12802
12846
 
12803
- 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_SHEEN\n\t\tvec3 sheenTint;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\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}\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\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenTint, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\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}";
12847
+ 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_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\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}\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\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\tvec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = specularColor + ( 1.0 - specularColor ) * 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometry.normal;\n\t\tvec3 viewDir = geometry.viewDir;\n\t\tvec3 position = geometry.position;\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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometry.clearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\treflectedLight.directSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in GeometricContext geometry, 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 GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometry.clearcoatNormal, geometry.viewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - ( singleScattering + multiScattering ) );\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}";
12804
12848
 
12805
12849
  var lights_fragment_begin = "\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\n#ifdef USE_CLEARCOAT\n\tgeometry.clearcoatNormal = clearcoatNormal;\n#endif\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointLightInfo( pointLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotLightInfo( spotLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\tspotLightShadow = spotLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLightShadow;\n\t#endif\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalLightInfo( directionalLight, geometry, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= all( bvec2( directLight.visible, receiveShadow ) ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 iblIrradiance = vec3( 0.0 );\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\tirradiance += getLightProbeIrradiance( lightProbe, geometry.normal );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t}\n\t\t#pragma unroll_loop_end\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearcoatRadiance = vec3( 0.0 );\n#endif";
12806
12850
 
@@ -12892,9 +12936,9 @@ var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = to
12892
12936
 
12893
12937
  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 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; }";
12894
12938
 
12895
- var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationTint, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif";
12939
+ var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tfloat transmissionAlpha = 1.0;\n\tfloat transmissionFactor = transmission;\n\tfloat thicknessFactor = thickness;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\ttransmissionFactor *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tthicknessFactor *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, roughnessFactor, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, ior, thicknessFactor,\n\t\tattenuationColor, attenuationDistance );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, transmissionFactor );\n\ttransmissionAlpha = mix( transmissionAlpha, transmission.a, transmissionFactor );\n#endif";
12896
12940
 
12897
- var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationTint;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( float roughness, float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 diffuseColor, vec3 specularColor, float specularF90,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif";
12941
+ var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( vec3 n, vec3 v, float thickness, float ior, mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( float roughness, float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( vec2 fragCoord, float roughness, float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef TEXTURE_LOD_EXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( vec3 radiance, float transmissionDistance, vec3 attenuationColor, float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( vec3 n, vec3 v, float roughness, vec3 diffuseColor, vec3 specularColor, float specularF90,\n\t\tvec3 position, mat4 modelMatrix, mat4 viewMatrix, mat4 projMatrix, float ior, float thickness,\n\t\tvec3 attenuationColor, float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif";
12898
12942
 
12899
12943
  var uv_pars_fragment = "#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif";
12900
12944
 
@@ -12956,7 +13000,7 @@ const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;
12956
13000
 
12957
13001
  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 <uv2_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 <uv2_vertex>\n\t#include <color_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}";
12958
13002
 
12959
- const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define 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 SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularTint;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARTINTMAP\n\t\tuniform sampler2D specularTintMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenTint;\n\tuniform float sheenRoughness;\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 <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\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 <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 <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_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - clearcoat * Fcc ) + clearcoatSpecular * clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
13003
+ const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define 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 SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULARINTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n\t#ifdef USE_SPECULARCOLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\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 <uv2_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <bsdfs>\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 <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 <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_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometry.clearcoatNormal, geometry.viewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <output_fragment>\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
12960
13004
 
12961
13005
  const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_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 <uv2_vertex>\n\t#include <color_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}";
12962
13006
 
@@ -13144,8 +13188,7 @@ const UniformsLib = {
13144
13188
  flipEnvMap: { value: - 1 },
13145
13189
  reflectivity: { value: 1.0 }, // basic, lambert, phong
13146
13190
  ior: { value: 1.5 }, // standard, physical
13147
- refractionRatio: { value: 0.98 },
13148
- maxMipLevel: { value: 0 }
13191
+ refractionRatio: { value: 0.98 }
13149
13192
 
13150
13193
  },
13151
13194
 
@@ -13616,8 +13659,10 @@ ShaderLib.physical = {
13616
13659
  clearcoatNormalScale: { value: new Vector2( 1, 1 ) },
13617
13660
  clearcoatNormalMap: { value: null },
13618
13661
  sheen: { value: 0 },
13619
- sheenTint: { value: new Color( 0x000000 ) },
13662
+ sheenColor: { value: new Color( 0x000000 ) },
13663
+ sheenColorMap: { value: null },
13620
13664
  sheenRoughness: { value: 0 },
13665
+ sheenRoughnessMap: { value: null },
13621
13666
  transmission: { value: 0 },
13622
13667
  transmissionMap: { value: null },
13623
13668
  transmissionSamplerSize: { value: new Vector2() },
@@ -13625,11 +13670,11 @@ ShaderLib.physical = {
13625
13670
  thickness: { value: 0 },
13626
13671
  thicknessMap: { value: null },
13627
13672
  attenuationDistance: { value: 0 },
13628
- attenuationTint: { value: new Color( 0x000000 ) },
13673
+ attenuationColor: { value: new Color( 0x000000 ) },
13629
13674
  specularIntensity: { value: 0 },
13630
13675
  specularIntensityMap: { value: null },
13631
- specularTint: { value: new Color( 1, 1, 1 ) },
13632
- specularTintMap: { value: null },
13676
+ specularColor: { value: new Color( 1, 1, 1 ) },
13677
+ specularColorMap: { value: null },
13633
13678
  }
13634
13679
  ] ),
13635
13680
 
@@ -15352,7 +15397,7 @@ class PMREMGenerator {
15352
15397
 
15353
15398
  _setEncoding( uniform, texture ) {
15354
15399
 
15355
- if ( this._renderer.capabilities.isWebGL2 === true && texture.format === RGBAFormat && texture.type === UnsignedByteType && texture.encoding === sRGBEncoding ) {
15400
+ /* if ( this._renderer.capabilities.isWebGL2 === true && texture.format === RGBAFormat && texture.type === UnsignedByteType && texture.encoding === sRGBEncoding ) {
15356
15401
 
15357
15402
  uniform.value = ENCODINGS[ LinearEncoding ];
15358
15403
 
@@ -15360,7 +15405,9 @@ class PMREMGenerator {
15360
15405
 
15361
15406
  uniform.value = ENCODINGS[ texture.encoding ];
15362
15407
 
15363
- }
15408
+ } */
15409
+
15410
+ uniform.value = ENCODINGS[ texture.encoding ];
15364
15411
 
15365
15412
  }
15366
15413
 
@@ -15368,7 +15415,9 @@ class PMREMGenerator {
15368
15415
 
15369
15416
  const renderer = this._renderer;
15370
15417
 
15371
- if ( texture.isCubeTexture ) {
15418
+ const isCubeTexture = ( texture.mapping === CubeReflectionMapping || texture.mapping === CubeRefractionMapping );
15419
+
15420
+ if ( isCubeTexture ) {
15372
15421
 
15373
15422
  if ( this._cubemapShader == null ) {
15374
15423
 
@@ -15386,14 +15435,14 @@ class PMREMGenerator {
15386
15435
 
15387
15436
  }
15388
15437
 
15389
- const material = texture.isCubeTexture ? this._cubemapShader : this._equirectShader;
15438
+ const material = isCubeTexture ? this._cubemapShader : this._equirectShader;
15390
15439
  const mesh = new Mesh( _lodPlanes[ 0 ], material );
15391
15440
 
15392
15441
  const uniforms = material.uniforms;
15393
15442
 
15394
15443
  uniforms[ 'envMap' ].value = texture;
15395
15444
 
15396
- if ( ! texture.isCubeTexture ) {
15445
+ if ( ! isCubeTexture ) {
15397
15446
 
15398
15447
  uniforms[ 'texelSize' ].value.set( 1.0 / texture.image.width, 1.0 / texture.image.height );
15399
15448
 
@@ -16194,6 +16243,7 @@ function WebGLExtensions( gl ) {
16194
16243
 
16195
16244
  getExtension( 'OES_texture_float_linear' );
16196
16245
  getExtension( 'EXT_color_buffer_half_float' );
16246
+ getExtension( 'WEBGL_multisampled_render_to_texture' );
16197
16247
 
16198
16248
  },
16199
16249
 
@@ -17635,7 +17685,7 @@ function setValueV4uiArray( gl, v ) {
17635
17685
  }
17636
17686
 
17637
17687
 
17638
- // Array of textures (2D / Cube)
17688
+ // Array of textures (2D / 3D / Cube / 2DArray)
17639
17689
 
17640
17690
  function setValueT1Array( gl, v, textures ) {
17641
17691
 
@@ -17653,6 +17703,22 @@ function setValueT1Array( gl, v, textures ) {
17653
17703
 
17654
17704
  }
17655
17705
 
17706
+ function setValueT3DArray( gl, v, textures ) {
17707
+
17708
+ const n = v.length;
17709
+
17710
+ const units = allocTexUnits( textures, n );
17711
+
17712
+ gl.uniform1iv( this.addr, units );
17713
+
17714
+ for ( let i = 0; i !== n; ++ i ) {
17715
+
17716
+ textures.setTexture3D( v[ i ] || emptyTexture3d, units[ i ] );
17717
+
17718
+ }
17719
+
17720
+ }
17721
+
17656
17722
  function setValueT6Array( gl, v, textures ) {
17657
17723
 
17658
17724
  const n = v.length;
@@ -17669,6 +17735,23 @@ function setValueT6Array( gl, v, textures ) {
17669
17735
 
17670
17736
  }
17671
17737
 
17738
+ function setValueT2DArrayArray( gl, v, textures ) {
17739
+
17740
+ const n = v.length;
17741
+
17742
+ const units = allocTexUnits( textures, n );
17743
+
17744
+ gl.uniform1iv( this.addr, units );
17745
+
17746
+ for ( let i = 0; i !== n; ++ i ) {
17747
+
17748
+ textures.setTexture2DArray( v[ i ] || emptyTexture2dArray, units[ i ] );
17749
+
17750
+ }
17751
+
17752
+ }
17753
+
17754
+
17672
17755
  // Helper to pick the right setter for a pure (bottom-level) array
17673
17756
 
17674
17757
  function getPureArraySetter( type ) {
@@ -17701,12 +17784,23 @@ function getPureArraySetter( type ) {
17701
17784
  case 0x8b62: // SAMPLER_2D_SHADOW
17702
17785
  return setValueT1Array;
17703
17786
 
17787
+ case 0x8b5f: // SAMPLER_3D
17788
+ case 0x8dcb: // INT_SAMPLER_3D
17789
+ case 0x8dd3: // UNSIGNED_INT_SAMPLER_3D
17790
+ return setValueT3DArray;
17791
+
17704
17792
  case 0x8b60: // SAMPLER_CUBE
17705
17793
  case 0x8dcc: // INT_SAMPLER_CUBE
17706
17794
  case 0x8dd4: // UNSIGNED_INT_SAMPLER_CUBE
17707
17795
  case 0x8dc5: // SAMPLER_CUBE_SHADOW
17708
17796
  return setValueT6Array;
17709
17797
 
17798
+ case 0x8dc1: // SAMPLER_2D_ARRAY
17799
+ case 0x8dcf: // INT_SAMPLER_2D_ARRAY
17800
+ case 0x8dd7: // UNSIGNED_INT_SAMPLER_2D_ARRAY
17801
+ case 0x8dc4: // SAMPLER_2D_ARRAY_SHADOW
17802
+ return setValueT2DArrayArray;
17803
+
17710
17804
  }
17711
17805
 
17712
17806
  }
@@ -17962,8 +18056,6 @@ function getEncodingComponents( encoding ) {
17962
18056
  return [ 'RGBD', '( value, 256.0 )' ];
17963
18057
  case GammaEncoding:
17964
18058
  return [ 'Gamma', '( value, float( GAMMA_FACTOR ) )' ];
17965
- case LogLuvEncoding:
17966
- return [ 'LogLuv', '( value )' ];
17967
18059
  default:
17968
18060
  console.warn( 'THREE.WebGLProgram: Unsupported encoding:', encoding );
17969
18061
  return [ 'Linear', '( value )' ];
@@ -18403,7 +18495,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
18403
18495
 
18404
18496
  parameters.specularMap ? '#define USE_SPECULARMAP' : '',
18405
18497
  parameters.specularIntensityMap ? '#define USE_SPECULARINTENSITYMAP' : '',
18406
- parameters.specularTintMap ? '#define USE_SPECULARTINTMAP' : '',
18498
+ parameters.specularColorMap ? '#define USE_SPECULARCOLORMAP' : '',
18407
18499
 
18408
18500
  parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',
18409
18501
  parameters.metalnessMap ? '#define USE_METALNESSMAP' : '',
@@ -18413,6 +18505,9 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
18413
18505
  parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',
18414
18506
  parameters.thicknessMap ? '#define USE_THICKNESSMAP' : '',
18415
18507
 
18508
+ parameters.sheenColorMap ? '#define USE_SHEENCOLORMAP' : '',
18509
+ parameters.sheenRoughnessMap ? '#define USE_SHEENROUGHNESSMAP' : '',
18510
+
18416
18511
  parameters.vertexTangents ? '#define USE_TANGENT' : '',
18417
18512
  parameters.vertexColors ? '#define USE_COLOR' : '',
18418
18513
  parameters.vertexAlphas ? '#define USE_COLOR_ALPHA' : '',
@@ -18551,7 +18646,7 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
18551
18646
 
18552
18647
  parameters.specularMap ? '#define USE_SPECULARMAP' : '',
18553
18648
  parameters.specularIntensityMap ? '#define USE_SPECULARINTENSITYMAP' : '',
18554
- parameters.specularTintMap ? '#define USE_SPECULARTINTMAP' : '',
18649
+ parameters.specularColorMap ? '#define USE_SPECULARCOLORMAP' : '',
18555
18650
  parameters.roughnessMap ? '#define USE_ROUGHNESSMAP' : '',
18556
18651
  parameters.metalnessMap ? '#define USE_METALNESSMAP' : '',
18557
18652
 
@@ -18559,6 +18654,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
18559
18654
  parameters.alphaTest ? '#define USE_ALPHATEST' : '',
18560
18655
 
18561
18656
  parameters.sheen ? '#define USE_SHEEN' : '',
18657
+ parameters.sheenColorMap ? '#define USE_SHEENCOLORMAP' : '',
18658
+ parameters.sheenRoughnessMap ? '#define USE_SHEENROUGHNESSMAP' : '',
18562
18659
 
18563
18660
  parameters.transmission ? '#define USE_TRANSMISSION' : '',
18564
18661
  parameters.transmissionMap ? '#define USE_TRANSMISSIONMAP' : '',
@@ -18605,7 +18702,8 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
18605
18702
  parameters.matcap ? getTexelDecodingFunction( 'matcapTexelToLinear', parameters.matcapEncoding ) : '',
18606
18703
  parameters.envMap ? getTexelDecodingFunction( 'envMapTexelToLinear', parameters.envMapEncoding ) : '',
18607
18704
  parameters.emissiveMap ? getTexelDecodingFunction( 'emissiveMapTexelToLinear', parameters.emissiveMapEncoding ) : '',
18608
- parameters.specularTintMap ? getTexelDecodingFunction( 'specularTintMapTexelToLinear', parameters.specularTintMapEncoding ) : '',
18705
+ parameters.specularColorMap ? getTexelDecodingFunction( 'specularColorMapTexelToLinear', parameters.specularColorMapEncoding ) : '',
18706
+ parameters.sheenColorMap ? getTexelDecodingFunction( 'sheenColorMapTexelToLinear', parameters.sheenColorMapEncoding ) : '',
18609
18707
  parameters.lightMap ? getTexelDecodingFunction( 'lightMapTexelToLinear', parameters.lightMapEncoding ) : '',
18610
18708
  getTexelEncodingFunction( 'linearToOutputTexel', parameters.outputEncoding ),
18611
18709
 
@@ -18851,8 +18949,7 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
18851
18949
  'lightMap', 'lightMapEncoding', 'aoMap', 'emissiveMap', 'emissiveMapEncoding', 'bumpMap', 'normalMap',
18852
18950
  'objectSpaceNormalMap', 'tangentSpaceNormalMap',
18853
18951
  'clearcoat', 'clearcoatMap', 'clearcoatRoughnessMap', 'clearcoatNormalMap',
18854
- 'displacementMap',
18855
- 'specularMap', 'specularIntensityMap', 'specularTintMap', 'specularTintMapEncoding', 'roughnessMap', 'metalnessMap', 'gradientMap',
18952
+ 'displacementMap', 'specularMap', , 'roughnessMap', 'metalnessMap', 'gradientMap',
18856
18953
  'alphaMap', 'alphaTest', 'combine', 'vertexColors', 'vertexAlphas', 'vertexTangents', 'vertexUvs', 'uvsVertexOnly', 'fog', 'useFog', 'fogExp2',
18857
18954
  'flatShading', 'sizeAttenuation', 'logarithmicDepthBuffer', 'skinning',
18858
18955
  'maxBones', 'useVertexTexture', 'morphTargets', 'morphNormals', 'morphTargetsCount', 'premultipliedAlpha',
@@ -18860,7 +18957,9 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
18860
18957
  'numDirLightShadows', 'numPointLightShadows', 'numSpotLightShadows',
18861
18958
  'shadowMapEnabled', 'shadowMapType', 'toneMapping', 'physicallyCorrectLights',
18862
18959
  'doubleSided', 'flipSided', 'numClippingPlanes', 'numClipIntersection', 'depthPacking', 'dithering', 'format',
18863
- 'sheen', 'transmission', 'transmissionMap', 'thicknessMap'
18960
+ 'specularIntensityMap', 'specularColorMap', 'specularColorMapEncoding',
18961
+ 'transmission', 'transmissionMap', 'thicknessMap',
18962
+ 'sheen', 'sheenColorMap', 'sheenColorMapEncoding', 'sheenRoughnessMap'
18864
18963
  ];
18865
18964
 
18866
18965
  function getMaxBones( object ) {
@@ -18918,11 +19017,11 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
18918
19017
 
18919
19018
  }
18920
19019
 
18921
- if ( isWebGL2 && map && map.isTexture && map.format === RGBAFormat && map.type === UnsignedByteType && map.encoding === sRGBEncoding ) {
19020
+ /* if ( isWebGL2 && map && map.isTexture && map.format === RGBAFormat && map.type === UnsignedByteType && map.encoding === sRGBEncoding ) {
18922
19021
 
18923
19022
  encoding = LinearEncoding; // disable inline decode for sRGB textures in WebGL 2
18924
19023
 
18925
- }
19024
+ } */
18926
19025
 
18927
19026
  return encoding;
18928
19027
 
@@ -19024,8 +19123,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
19024
19123
  metalnessMap: !! material.metalnessMap,
19025
19124
  specularMap: !! material.specularMap,
19026
19125
  specularIntensityMap: !! material.specularIntensityMap,
19027
- specularTintMap: !! material.specularTintMap,
19028
- specularTintMapEncoding: getTextureEncodingFromMap( material.specularTintMap ),
19126
+ specularColorMap: !! material.specularColorMap,
19127
+ specularColorMapEncoding: getTextureEncodingFromMap( material.specularColorMap ),
19029
19128
 
19030
19129
  alphaMap: !! material.alphaMap,
19031
19130
  alphaTest: useAlphaTest,
@@ -19033,6 +19132,9 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
19033
19132
  gradientMap: !! material.gradientMap,
19034
19133
 
19035
19134
  sheen: material.sheen > 0,
19135
+ sheenColorMap: !! material.sheenColorMap,
19136
+ sheenColorMapEncoding: getTextureEncodingFromMap( material.sheenColorMap ),
19137
+ sheenRoughnessMap: !! material.sheenRoughnessMap,
19036
19138
 
19037
19139
  transmission: material.transmission > 0,
19038
19140
  transmissionMap: !! material.transmissionMap,
@@ -19043,8 +19145,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
19043
19145
  vertexTangents: ( !! material.normalMap && !! object.geometry && !! object.geometry.attributes.tangent ),
19044
19146
  vertexColors: material.vertexColors,
19045
19147
  vertexAlphas: material.vertexColors === true && !! object.geometry && !! object.geometry.attributes.color && object.geometry.attributes.color.itemSize === 4,
19046
- vertexUvs: !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatMap || !! material.clearcoatRoughnessMap || !! material.clearcoatNormalMap || !! material.displacementMap || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularTintMap,
19047
- uvsVertexOnly: ! ( !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatNormalMap || material.transmission > 0 || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularTintMap ) && !! material.displacementMap,
19148
+ vertexUvs: !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatMap || !! material.clearcoatRoughnessMap || !! material.clearcoatNormalMap || !! material.displacementMap || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || !! material.sheenColorMap || material.sheenRoughnessMap,
19149
+ uvsVertexOnly: ! ( !! material.map || !! material.bumpMap || !! material.normalMap || !! material.specularMap || !! material.alphaMap || !! material.emissiveMap || !! material.roughnessMap || !! material.metalnessMap || !! material.clearcoatNormalMap || material.transmission > 0 || !! material.transmissionMap || !! material.thicknessMap || !! material.specularIntensityMap || !! material.specularColorMap || material.sheen > 0 || !! material.sheenColorMap || !! material.sheenRoughnessMap ) && !! material.displacementMap,
19048
19150
 
19049
19151
  fog: !! fog,
19050
19152
  useFog: material.fog,
@@ -19121,8 +19223,8 @@ function WebGLPrograms( renderer, cubemaps, cubeuvmaps, extensions, capabilities
19121
19223
 
19122
19224
  } else {
19123
19225
 
19124
- array.push( parameters.fragmentShader );
19125
- array.push( parameters.vertexShader );
19226
+ array.push( hashString( parameters.fragmentShader ) );
19227
+ array.push( hashString( parameters.vertexShader ) );
19126
19228
 
19127
19229
  }
19128
19230
 
@@ -20311,7 +20413,7 @@ MeshDistanceMaterial.prototype.isMeshDistanceMaterial = true;
20311
20413
 
20312
20414
  const vertex = "void main() {\n\tgl_Position = vec4( position, 1.0 );\n}";
20313
20415
 
20314
- const fragment = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\nuniform float samples;\n#include <packing>\nvoid main() {\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";
20416
+ const fragment = "uniform sampler2D shadow_pass;\nuniform vec2 resolution;\nuniform float radius;\n#include <packing>\nvoid main() {\n\tconst float samples = float( VSM_SAMPLES );\n\tfloat mean = 0.0;\n\tfloat squared_mean = 0.0;\n\tfloat uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );\n\tfloat uvStart = samples <= 1.0 ? 0.0 : - 1.0;\n\tfor ( float i = 0.0; i < samples; i ++ ) {\n\t\tfloat uvOffset = uvStart + i * uvStride;\n\t\t#ifdef HORIZONTAL_PASS\n\t\t\tvec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );\n\t\t\tmean += distribution.x;\n\t\t\tsquared_mean += distribution.y * distribution.y + distribution.x * distribution.x;\n\t\t#else\n\t\t\tfloat depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );\n\t\t\tmean += depth;\n\t\t\tsquared_mean += depth * depth;\n\t\t#endif\n\t}\n\tmean = mean / samples;\n\tsquared_mean = squared_mean / samples;\n\tfloat std_dev = sqrt( squared_mean - mean * mean );\n\tgl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );\n}";
20315
20417
 
20316
20418
  function WebGLShadowMap( _renderer, _objects, _capabilities ) {
20317
20419
 
@@ -20332,12 +20434,13 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
20332
20434
  const shadowSide = { 0: BackSide, 1: FrontSide, 2: DoubleSide };
20333
20435
 
20334
20436
  const shadowMaterialVertical = new ShaderMaterial( {
20335
-
20437
+ defines: {
20438
+ VSM_SAMPLES: 8
20439
+ },
20336
20440
  uniforms: {
20337
20441
  shadow_pass: { value: null },
20338
20442
  resolution: { value: new Vector2() },
20339
- radius: { value: 4.0 },
20340
- samples: { value: 8.0 }
20443
+ radius: { value: 4.0 }
20341
20444
  },
20342
20445
 
20343
20446
  vertexShader: vertex,
@@ -20503,12 +20606,21 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
20503
20606
 
20504
20607
  const geometry = _objects.update( fullScreenMesh );
20505
20608
 
20609
+ if ( shadowMaterialVertical.defines.VSM_SAMPLES !== shadow.blurSamples ) {
20610
+
20611
+ shadowMaterialVertical.defines.VSM_SAMPLES = shadow.blurSamples;
20612
+ shadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;
20613
+
20614
+ shadowMaterialVertical.needsUpdate = true;
20615
+ shadowMaterialHorizontal.needsUpdate = true;
20616
+
20617
+ }
20618
+
20506
20619
  // vertical pass
20507
20620
 
20508
20621
  shadowMaterialVertical.uniforms.shadow_pass.value = shadow.map.texture;
20509
20622
  shadowMaterialVertical.uniforms.resolution.value = shadow.mapSize;
20510
20623
  shadowMaterialVertical.uniforms.radius.value = shadow.radius;
20511
- shadowMaterialVertical.uniforms.samples.value = shadow.blurSamples;
20512
20624
  _renderer.setRenderTarget( shadow.mapPass );
20513
20625
  _renderer.clear();
20514
20626
  _renderer.renderBufferDirect( camera, null, geometry, shadowMaterialVertical, fullScreenMesh, null );
@@ -20518,7 +20630,6 @@ function WebGLShadowMap( _renderer, _objects, _capabilities ) {
20518
20630
  shadowMaterialHorizontal.uniforms.shadow_pass.value = shadow.mapPass.texture;
20519
20631
  shadowMaterialHorizontal.uniforms.resolution.value = shadow.mapSize;
20520
20632
  shadowMaterialHorizontal.uniforms.radius.value = shadow.radius;
20521
- shadowMaterialHorizontal.uniforms.samples.value = shadow.blurSamples;
20522
20633
  _renderer.setRenderTarget( shadow.map );
20523
20634
  _renderer.clear();
20524
20635
  _renderer.renderBufferDirect( camera, null, geometry, shadowMaterialHorizontal, fullScreenMesh, null );
@@ -20984,7 +21095,6 @@ function WebGLState( gl, extensions, capabilities ) {
20984
21095
 
20985
21096
  let enabledCapabilities = {};
20986
21097
 
20987
- let xrFramebuffer = null;
20988
21098
  let currentBoundFramebuffers = {};
20989
21099
 
20990
21100
  let currentProgram = null;
@@ -21096,22 +21206,8 @@ function WebGLState( gl, extensions, capabilities ) {
21096
21206
 
21097
21207
  }
21098
21208
 
21099
- function bindXRFramebuffer( framebuffer ) {
21100
-
21101
- if ( framebuffer !== xrFramebuffer ) {
21102
-
21103
- gl.bindFramebuffer( 36160, framebuffer );
21104
-
21105
- xrFramebuffer = framebuffer;
21106
-
21107
- }
21108
-
21109
- }
21110
-
21111
21209
  function bindFramebuffer( target, framebuffer ) {
21112
21210
 
21113
- if ( framebuffer === null && xrFramebuffer !== null ) framebuffer = xrFramebuffer; // use active XR framebuffer if available
21114
-
21115
21211
  if ( currentBoundFramebuffers[ target ] !== framebuffer ) {
21116
21212
 
21117
21213
  gl.bindFramebuffer( target, framebuffer );
@@ -21547,6 +21643,34 @@ function WebGLState( gl, extensions, capabilities ) {
21547
21643
 
21548
21644
  }
21549
21645
 
21646
+ function texSubImage2D() {
21647
+
21648
+ try {
21649
+
21650
+ gl.texSubImage2D.apply( gl, arguments );
21651
+
21652
+ } catch ( error ) {
21653
+
21654
+ console.error( 'THREE.WebGLState:', error );
21655
+
21656
+ }
21657
+
21658
+ }
21659
+
21660
+ function texStorage2D() {
21661
+
21662
+ try {
21663
+
21664
+ gl.texStorage2D.apply( gl, arguments );
21665
+
21666
+ } catch ( error ) {
21667
+
21668
+ console.error( 'THREE.WebGLState:', error );
21669
+
21670
+ }
21671
+
21672
+ }
21673
+
21550
21674
  function texImage2D() {
21551
21675
 
21552
21676
  try {
@@ -21659,7 +21783,6 @@ function WebGLState( gl, extensions, capabilities ) {
21659
21783
  currentTextureSlot = null;
21660
21784
  currentBoundTextures = {};
21661
21785
 
21662
- xrFramebuffer = null;
21663
21786
  currentBoundFramebuffers = {};
21664
21787
 
21665
21788
  currentProgram = null;
@@ -21703,7 +21826,6 @@ function WebGLState( gl, extensions, capabilities ) {
21703
21826
  disable: disable,
21704
21827
 
21705
21828
  bindFramebuffer: bindFramebuffer,
21706
- bindXRFramebuffer: bindXRFramebuffer,
21707
21829
 
21708
21830
  useProgram: useProgram,
21709
21831
 
@@ -21725,6 +21847,9 @@ function WebGLState( gl, extensions, capabilities ) {
21725
21847
  texImage2D: texImage2D,
21726
21848
  texImage3D: texImage3D,
21727
21849
 
21850
+ texStorage2D: texStorage2D,
21851
+ texSubImage2D: texSubImage2D,
21852
+
21728
21853
  scissor: scissor,
21729
21854
  viewport: viewport,
21730
21855
 
@@ -21741,6 +21866,8 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
21741
21866
  const maxCubemapSize = capabilities.maxCubemapSize;
21742
21867
  const maxTextureSize = capabilities.maxTextureSize;
21743
21868
  const maxSamples = capabilities.maxSamples;
21869
+ const hasMultisampledRenderToTexture = extensions.has( 'WEBGL_multisampled_render_to_texture' );
21870
+ const MultisampledRenderToTextureExtension = hasMultisampledRenderToTexture ? extensions.get( 'WEBGL_multisampled_render_to_texture' ) : undefined;
21744
21871
 
21745
21872
  const _videoTextures = new WeakMap();
21746
21873
  let _canvas;
@@ -21854,17 +21981,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
21854
21981
 
21855
21982
  }
21856
21983
 
21857
- function generateMipmap( target, texture, width, height, depth = 1 ) {
21984
+ function generateMipmap( target ) {
21858
21985
 
21859
21986
  _gl.generateMipmap( target );
21860
21987
 
21861
- const textureProperties = properties.get( texture );
21862
-
21863
- textureProperties.__maxMipLevel = Math.log2( Math.max( width, height, depth ) );
21864
-
21865
21988
  }
21866
21989
 
21867
- function getInternalFormat( internalFormatName, glFormat, glType, encoding ) {
21990
+ function getInternalFormat( internalFormatName, glFormat, glType/*, encoding*/ ) {
21868
21991
 
21869
21992
  if ( isWebGL2 === false ) return glFormat;
21870
21993
 
@@ -21898,7 +22021,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
21898
22021
 
21899
22022
  if ( glType === 5126 ) internalFormat = 34836;
21900
22023
  if ( glType === 5131 ) internalFormat = 34842;
21901
- if ( glType === 5121 ) internalFormat = ( encoding === sRGBEncoding ) ? 35907 : 32856;
22024
+ //if ( glType === 5121 ) internalFormat = ( encoding === sRGBEncoding ) ? 35907 : 32856;
22025
+ if ( glType === 5121 ) internalFormat = 32856;
22026
+
21902
22027
 
21903
22028
  }
21904
22029
 
@@ -21913,6 +22038,30 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
21913
22038
 
21914
22039
  }
21915
22040
 
22041
+ function getMipLevels( texture, image, supportsMips ) {
22042
+
22043
+ if ( textureNeedsGenerateMipmaps( texture, supportsMips ) === true ) {
22044
+
22045
+ // generated mipmaps via gl.generateMipmap()
22046
+
22047
+ return Math.log2( Math.max( image.width, image.height ) ) + 1;
22048
+
22049
+ } else if ( texture.mipmaps.length > 0 ) {
22050
+
22051
+ // user-defined mipmaps
22052
+
22053
+ return texture.mipmaps.length;
22054
+
22055
+ } else {
22056
+
22057
+ // texture without mipmaps (only base level)
22058
+
22059
+ return 1;
22060
+
22061
+ }
22062
+
22063
+ }
22064
+
21916
22065
  // Fallback filters for non-power-of-2 textures
21917
22066
 
21918
22067
  function filterFallback( f ) {
@@ -22365,12 +22514,10 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22365
22514
  }
22366
22515
 
22367
22516
  texture.generateMipmaps = false;
22368
- textureProperties.__maxMipLevel = mipmaps.length - 1;
22369
22517
 
22370
22518
  } else {
22371
22519
 
22372
22520
  state.texImage2D( 3553, 0, glInternalFormat, image.width, image.height, 0, glFormat, glType, image.data );
22373
- textureProperties.__maxMipLevel = 0;
22374
22521
 
22375
22522
  }
22376
22523
 
@@ -22400,17 +22547,13 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22400
22547
 
22401
22548
  }
22402
22549
 
22403
- textureProperties.__maxMipLevel = mipmaps.length - 1;
22404
-
22405
22550
  } else if ( texture.isDataTexture2DArray ) {
22406
22551
 
22407
22552
  state.texImage3D( 35866, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
22408
- textureProperties.__maxMipLevel = 0;
22409
22553
 
22410
22554
  } else if ( texture.isDataTexture3D ) {
22411
22555
 
22412
22556
  state.texImage3D( 32879, 0, glInternalFormat, image.width, image.height, image.depth, 0, glFormat, glType, image.data );
22413
- textureProperties.__maxMipLevel = 0;
22414
22557
 
22415
22558
  } else {
22416
22559
 
@@ -22420,22 +22563,53 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22420
22563
  // if there are no manual mipmaps
22421
22564
  // set 0 level mipmap and then use GL to generate other mipmap levels
22422
22565
 
22566
+ const levels = getMipLevels( texture, image, supportsMips );
22567
+ const useTexStorage = ( isWebGL2 && texture.isVideoTexture !== true );
22568
+ const allocateMemory = ( textureProperties.__version === undefined );
22569
+
22423
22570
  if ( mipmaps.length > 0 && supportsMips ) {
22424
22571
 
22572
+ if ( useTexStorage && allocateMemory ) {
22573
+
22574
+ state.texStorage2D( 3553, levels, glInternalFormat, mipmaps[ 0 ].width, mipmaps[ 0 ].height );
22575
+
22576
+ }
22577
+
22425
22578
  for ( let i = 0, il = mipmaps.length; i < il; i ++ ) {
22426
22579
 
22427
22580
  mipmap = mipmaps[ i ];
22428
- state.texImage2D( 3553, i, glInternalFormat, glFormat, glType, mipmap );
22581
+
22582
+ if ( useTexStorage ) {
22583
+
22584
+ state.texSubImage2D( 3553, i, 0, 0, glFormat, glType, mipmap );
22585
+
22586
+ } else {
22587
+
22588
+ state.texImage2D( 3553, i, glInternalFormat, glFormat, glType, mipmap );
22589
+
22590
+ }
22429
22591
 
22430
22592
  }
22431
22593
 
22432
22594
  texture.generateMipmaps = false;
22433
- textureProperties.__maxMipLevel = mipmaps.length - 1;
22434
22595
 
22435
22596
  } else {
22436
22597
 
22437
- state.texImage2D( 3553, 0, glInternalFormat, glFormat, glType, image );
22438
- textureProperties.__maxMipLevel = 0;
22598
+ if ( useTexStorage ) {
22599
+
22600
+ if ( allocateMemory ) {
22601
+
22602
+ state.texStorage2D( 3553, levels, glInternalFormat, image.width, image.height );
22603
+
22604
+ }
22605
+
22606
+ state.texSubImage2D( 3553, 0, 0, 0, glFormat, glType, image );
22607
+
22608
+ } else {
22609
+
22610
+ state.texImage2D( 3553, 0, glInternalFormat, glFormat, glType, image );
22611
+
22612
+ }
22439
22613
 
22440
22614
  }
22441
22615
 
@@ -22443,7 +22617,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22443
22617
 
22444
22618
  if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
22445
22619
 
22446
- generateMipmap( textureType, texture, image.width, image.height );
22620
+ generateMipmap( textureType );
22447
22621
 
22448
22622
  }
22449
22623
 
@@ -22528,8 +22702,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22528
22702
 
22529
22703
  }
22530
22704
 
22531
- textureProperties.__maxMipLevel = mipmaps.length - 1;
22532
-
22533
22705
  } else {
22534
22706
 
22535
22707
  mipmaps = texture.mipmaps;
@@ -22565,14 +22737,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22565
22737
 
22566
22738
  }
22567
22739
 
22568
- textureProperties.__maxMipLevel = mipmaps.length;
22569
-
22570
22740
  }
22571
22741
 
22572
22742
  if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
22573
22743
 
22574
22744
  // We assume images for cube map have the same size.
22575
- generateMipmap( 34067, texture, image.width, image.height );
22745
+ generateMipmap( 34067 );
22576
22746
 
22577
22747
  }
22578
22748
 
@@ -22590,23 +22760,38 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22590
22760
  const glFormat = utils.convert( texture.format );
22591
22761
  const glType = utils.convert( texture.type );
22592
22762
  const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
22763
+ const renderTargetProperties = properties.get( renderTarget );
22593
22764
 
22594
- if ( textureTarget === 32879 || textureTarget === 35866 ) {
22765
+ if ( ! renderTargetProperties.__hasExternalTextures ) {
22595
22766
 
22596
- state.texImage3D( textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.depth, 0, glFormat, glType, null );
22767
+ if ( textureTarget === 32879 || textureTarget === 35866 ) {
22597
22768
 
22598
- } else {
22769
+ state.texImage3D( textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, renderTarget.depth, 0, glFormat, glType, null );
22770
+
22771
+ } else {
22599
22772
 
22600
- state.texImage2D( textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null );
22773
+ state.texImage2D( textureTarget, 0, glInternalFormat, renderTarget.width, renderTarget.height, 0, glFormat, glType, null );
22774
+
22775
+ }
22601
22776
 
22602
22777
  }
22603
22778
 
22604
22779
  state.bindFramebuffer( 36160, framebuffer );
22605
- _gl.framebufferTexture2D( 36160, attachment, textureTarget, properties.get( texture ).__webglTexture, 0 );
22780
+ if ( renderTarget.useRenderToTexture ) {
22781
+
22782
+ MultisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT( 36160, attachment, textureTarget, properties.get( texture ).__webglTexture, 0, getRenderTargetSamples( renderTarget ) );
22783
+
22784
+ } else {
22785
+
22786
+ _gl.framebufferTexture2D( 36160, attachment, textureTarget, properties.get( texture ).__webglTexture, 0 );
22787
+
22788
+ }
22789
+
22606
22790
  state.bindFramebuffer( 36160, null );
22607
22791
 
22608
22792
  }
22609
22793
 
22794
+
22610
22795
  // Setup storage for internal depth/stencil buffers and bind to correct framebuffer
22611
22796
  function setupRenderBufferStorage( renderbuffer, renderTarget, isMultisample ) {
22612
22797
 
@@ -22616,7 +22801,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22616
22801
 
22617
22802
  let glInternalFormat = 33189;
22618
22803
 
22619
- if ( isMultisample ) {
22804
+ if ( isMultisample || renderTarget.useRenderToTexture ) {
22620
22805
 
22621
22806
  const depthTexture = renderTarget.depthTexture;
22622
22807
 
@@ -22636,7 +22821,15 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22636
22821
 
22637
22822
  const samples = getRenderTargetSamples( renderTarget );
22638
22823
 
22639
- _gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
22824
+ if ( renderTarget.useRenderToTexture ) {
22825
+
22826
+ MultisampledRenderToTextureExtension.renderbufferStorageMultisampleEXT( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
22827
+
22828
+ } else {
22829
+
22830
+ _gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
22831
+
22832
+ }
22640
22833
 
22641
22834
  } else {
22642
22835
 
@@ -22648,12 +22841,16 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22648
22841
 
22649
22842
  } else if ( renderTarget.depthBuffer && renderTarget.stencilBuffer ) {
22650
22843
 
22651
- if ( isMultisample ) {
22844
+ const samples = getRenderTargetSamples( renderTarget );
22652
22845
 
22653
- const samples = getRenderTargetSamples( renderTarget );
22846
+ if ( isMultisample && renderTarget.useRenderbuffer ) {
22654
22847
 
22655
22848
  _gl.renderbufferStorageMultisample( 36161, samples, 35056, renderTarget.width, renderTarget.height );
22656
22849
 
22850
+ } else if ( renderTarget.useRenderToTexture ) {
22851
+
22852
+ MultisampledRenderToTextureExtension.renderbufferStorageMultisampleEXT( 36161, samples, 35056, renderTarget.width, renderTarget.height );
22853
+
22657
22854
  } else {
22658
22855
 
22659
22856
  _gl.renderbufferStorage( 36161, 34041, renderTarget.width, renderTarget.height );
@@ -22671,13 +22868,16 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22671
22868
  const glFormat = utils.convert( texture.format );
22672
22869
  const glType = utils.convert( texture.type );
22673
22870
  const glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.encoding );
22871
+ const samples = getRenderTargetSamples( renderTarget );
22674
22872
 
22675
- if ( isMultisample ) {
22676
-
22677
- const samples = getRenderTargetSamples( renderTarget );
22873
+ if ( isMultisample && renderTarget.useRenderbuffer ) {
22678
22874
 
22679
22875
  _gl.renderbufferStorageMultisample( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
22680
22876
 
22877
+ } else if ( renderTarget.useRenderToTexture ) {
22878
+
22879
+ MultisampledRenderToTextureExtension.renderbufferStorageMultisampleEXT( 36161, samples, glInternalFormat, renderTarget.width, renderTarget.height );
22880
+
22681
22881
  } else {
22682
22882
 
22683
22883
  _gl.renderbufferStorage( 36161, glInternalFormat, renderTarget.width, renderTarget.height );
@@ -22718,14 +22918,31 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22718
22918
  setTexture2D( renderTarget.depthTexture, 0 );
22719
22919
 
22720
22920
  const webglDepthTexture = properties.get( renderTarget.depthTexture ).__webglTexture;
22921
+ const samples = getRenderTargetSamples( renderTarget );
22721
22922
 
22722
22923
  if ( renderTarget.depthTexture.format === DepthFormat ) {
22723
22924
 
22724
- _gl.framebufferTexture2D( 36160, 36096, 3553, webglDepthTexture, 0 );
22925
+ if ( renderTarget.useRenderToTexture ) {
22926
+
22927
+ MultisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT( 36160, 36096, 3553, webglDepthTexture, 0, samples );
22928
+
22929
+ } else {
22930
+
22931
+ _gl.framebufferTexture2D( 36160, 36096, 3553, webglDepthTexture, 0 );
22932
+
22933
+ }
22725
22934
 
22726
22935
  } else if ( renderTarget.depthTexture.format === DepthStencilFormat ) {
22727
22936
 
22728
- _gl.framebufferTexture2D( 36160, 33306, 3553, webglDepthTexture, 0 );
22937
+ if ( renderTarget.useRenderToTexture ) {
22938
+
22939
+ MultisampledRenderToTextureExtension.framebufferTexture2DMultisampleEXT( 36160, 33306, 3553, webglDepthTexture, 0, samples );
22940
+
22941
+ } else {
22942
+
22943
+ _gl.framebufferTexture2D( 36160, 33306, 3553, webglDepthTexture, 0 );
22944
+
22945
+ }
22729
22946
 
22730
22947
  } else {
22731
22948
 
@@ -22739,10 +22956,9 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22739
22956
  function setupDepthRenderbuffer( renderTarget ) {
22740
22957
 
22741
22958
  const renderTargetProperties = properties.get( renderTarget );
22742
-
22743
22959
  const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
22744
22960
 
22745
- if ( renderTarget.depthTexture ) {
22961
+ if ( renderTarget.depthTexture && ! renderTargetProperties.__autoAllocateDepthBuffer ) {
22746
22962
 
22747
22963
  if ( isCube ) throw new Error( 'target.depthTexture not supported in Cube render targets' );
22748
22964
 
@@ -22776,6 +22992,25 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22776
22992
 
22777
22993
  }
22778
22994
 
22995
+ // rebind framebuffer with external textures
22996
+ function rebindTextures( renderTarget, colorTexture, depthTexture ) {
22997
+
22998
+ const renderTargetProperties = properties.get( renderTarget );
22999
+
23000
+ if ( colorTexture !== undefined ) {
23001
+
23002
+ setupFrameBufferTexture( renderTargetProperties.__webglFramebuffer, renderTarget, renderTarget.texture, 36064, 3553 );
23003
+
23004
+ }
23005
+
23006
+ if ( depthTexture !== undefined ) {
23007
+
23008
+ setupDepthRenderbuffer( renderTarget );
23009
+
23010
+ }
23011
+
23012
+ }
23013
+
22779
23014
  // Set up GL resources for the render target
22780
23015
  function setupRenderTarget( renderTarget ) {
22781
23016
 
@@ -22788,7 +23023,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22788
23023
 
22789
23024
  if ( renderTarget.isWebGLMultipleRenderTargets !== true ) {
22790
23025
 
22791
- textureProperties.__webglTexture = _gl.createTexture();
23026
+ if ( textureProperties.__webglTexture === undefined ) {
23027
+
23028
+ textureProperties.__webglTexture = _gl.createTexture();
23029
+
23030
+ }
23031
+
22792
23032
  textureProperties.__version = texture.version;
22793
23033
  info.memory.textures ++;
22794
23034
 
@@ -22796,7 +23036,6 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22796
23036
 
22797
23037
  const isCube = ( renderTarget.isWebGLCubeRenderTarget === true );
22798
23038
  const isMultipleRenderTargets = ( renderTarget.isWebGLMultipleRenderTargets === true );
22799
- const isMultisample = ( renderTarget.isWebGLMultisampleRenderTarget === true );
22800
23039
  const isRenderTarget3D = texture.isDataTexture3D || texture.isDataTexture2DArray;
22801
23040
  const supportsMips = isPowerOfTwo$1( renderTarget ) || isWebGL2;
22802
23041
 
@@ -22852,7 +23091,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22852
23091
 
22853
23092
  }
22854
23093
 
22855
- } else if ( isMultisample ) {
23094
+ } else if ( renderTarget.useRenderbuffer ) {
22856
23095
 
22857
23096
  if ( isWebGL2 ) {
22858
23097
 
@@ -22906,7 +23145,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22906
23145
 
22907
23146
  if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
22908
23147
 
22909
- generateMipmap( 34067, texture, renderTarget.width, renderTarget.height );
23148
+ generateMipmap( 34067 );
22910
23149
 
22911
23150
  }
22912
23151
 
@@ -22927,7 +23166,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22927
23166
 
22928
23167
  if ( textureNeedsGenerateMipmaps( attachment, supportsMips ) ) {
22929
23168
 
22930
- generateMipmap( 3553, attachment, renderTarget.width, renderTarget.height );
23169
+ generateMipmap( 3553 );
22931
23170
 
22932
23171
  }
22933
23172
 
@@ -22962,7 +23201,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22962
23201
 
22963
23202
  if ( textureNeedsGenerateMipmaps( texture, supportsMips ) ) {
22964
23203
 
22965
- generateMipmap( glTextureType, texture, renderTarget.width, renderTarget.height, renderTarget.depth );
23204
+ generateMipmap( glTextureType );
22966
23205
 
22967
23206
  }
22968
23207
 
@@ -22996,7 +23235,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
22996
23235
  const webglTexture = properties.get( texture ).__webglTexture;
22997
23236
 
22998
23237
  state.bindTexture( target, webglTexture );
22999
- generateMipmap( target, texture, renderTarget.width, renderTarget.height );
23238
+ generateMipmap( target );
23000
23239
  state.unbindTexture();
23001
23240
 
23002
23241
  }
@@ -23007,23 +23246,43 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
23007
23246
 
23008
23247
  function updateMultisampleRenderTarget( renderTarget ) {
23009
23248
 
23010
- if ( renderTarget.isWebGLMultisampleRenderTarget ) {
23249
+ if ( renderTarget.useRenderbuffer ) {
23011
23250
 
23012
23251
  if ( isWebGL2 ) {
23013
23252
 
23014
23253
  const width = renderTarget.width;
23015
23254
  const height = renderTarget.height;
23016
23255
  let mask = 16384;
23256
+ const invalidationArray = [ 36064 ];
23257
+ const depthStyle = renderTarget.stencilBuffer ? 33306 : 36096;
23258
+
23259
+ if ( renderTarget.depthBuffer ) {
23260
+
23261
+ invalidationArray.push( depthStyle );
23262
+
23263
+ }
23017
23264
 
23018
- if ( renderTarget.depthBuffer ) mask |= 256;
23019
- if ( renderTarget.stencilBuffer ) mask |= 1024;
23265
+ if ( ! renderTarget.ignoreDepthForMultisampleCopy ) {
23266
+
23267
+ if ( renderTarget.depthBuffer ) mask |= 256;
23268
+ if ( renderTarget.stencilBuffer ) mask |= 1024;
23269
+
23270
+ }
23020
23271
 
23021
23272
  const renderTargetProperties = properties.get( renderTarget );
23022
23273
 
23023
23274
  state.bindFramebuffer( 36008, renderTargetProperties.__webglMultisampledFramebuffer );
23024
23275
  state.bindFramebuffer( 36009, renderTargetProperties.__webglFramebuffer );
23025
23276
 
23277
+ if ( renderTarget.ignoreDepthForMultisampleCopy ) {
23278
+
23279
+ _gl.invalidateFramebuffer( 36008, [ depthStyle ] );
23280
+ _gl.invalidateFramebuffer( 36009, [ depthStyle ] );
23281
+
23282
+ }
23283
+
23026
23284
  _gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, mask, 9728 );
23285
+ _gl.invalidateFramebuffer( 36008, invalidationArray );
23027
23286
 
23028
23287
  state.bindFramebuffer( 36008, null );
23029
23288
  state.bindFramebuffer( 36009, renderTargetProperties.__webglMultisampledFramebuffer );
@@ -23040,7 +23299,7 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
23040
23299
 
23041
23300
  function getRenderTargetSamples( renderTarget ) {
23042
23301
 
23043
- return ( isWebGL2 && renderTarget.isWebGLMultisampleRenderTarget ) ?
23302
+ return ( isWebGL2 && ( renderTarget.useRenderbuffer || renderTarget.useRenderToTexture ) ) ?
23044
23303
  Math.min( maxSamples, renderTarget.samples ) : 0;
23045
23304
 
23046
23305
  }
@@ -23113,9 +23372,12 @@ function WebGLTextures( _gl, extensions, state, properties, capabilities, utils,
23113
23372
  this.setTexture2DArray = setTexture2DArray;
23114
23373
  this.setTexture3D = setTexture3D;
23115
23374
  this.setTextureCube = setTextureCube;
23375
+ this.rebindTextures = rebindTextures;
23116
23376
  this.setupRenderTarget = setupRenderTarget;
23117
23377
  this.updateRenderTargetMipmap = updateRenderTargetMipmap;
23118
23378
  this.updateMultisampleRenderTarget = updateMultisampleRenderTarget;
23379
+ this.setupDepthRenderbuffer = setupDepthRenderbuffer;
23380
+ this.setupFrameBufferTexture = setupFrameBufferTexture;
23119
23381
 
23120
23382
  this.safeSetTexture2D = safeSetTexture2D;
23121
23383
  this.safeSetTextureCube = safeSetTextureCube;
@@ -24137,6 +24399,38 @@ class WebXRController {
24137
24399
 
24138
24400
  }
24139
24401
 
24402
+ class DepthTexture extends Texture {
24403
+
24404
+ constructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {
24405
+
24406
+ format = format !== undefined ? format : DepthFormat;
24407
+
24408
+ if ( format !== DepthFormat && format !== DepthStencilFormat ) {
24409
+
24410
+ throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
24411
+
24412
+ }
24413
+
24414
+ if ( type === undefined && format === DepthFormat ) type = UnsignedShortType;
24415
+ if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;
24416
+
24417
+ super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
24418
+
24419
+ this.image = { width: width, height: height };
24420
+
24421
+ this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
24422
+ this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
24423
+
24424
+ this.flipY = false;
24425
+ this.generateMipmaps = false;
24426
+
24427
+ }
24428
+
24429
+
24430
+ }
24431
+
24432
+ DepthTexture.prototype.isDepthTexture = true;
24433
+
24140
24434
  class WebXRManager extends EventDispatcher {
24141
24435
 
24142
24436
  constructor( renderer, gl ) {
@@ -24144,7 +24438,6 @@ class WebXRManager extends EventDispatcher {
24144
24438
  super();
24145
24439
 
24146
24440
  const scope = this;
24147
- const state = renderer.state;
24148
24441
 
24149
24442
  let session = null;
24150
24443
  let framebufferScaleFactor = 1.0;
@@ -24152,21 +24445,19 @@ class WebXRManager extends EventDispatcher {
24152
24445
 
24153
24446
  let referenceSpace = null;
24154
24447
  let referenceSpaceType = 'local-floor';
24448
+ const hasMultisampledRenderToTexture = renderer.extensions.has( 'WEBGL_multisampled_render_to_texture' );
24155
24449
 
24156
24450
  let pose = null;
24157
24451
  var layers = [];
24158
24452
 
24159
24453
  let glBinding = null;
24160
- let glFramebuffer = null;
24161
24454
  let glProjLayer = null;
24162
24455
  let glBaseLayer = null;
24163
24456
  let isMultisample = false;
24164
- let glMultisampledFramebuffer = null;
24165
- let glColorRenderbuffer = null;
24166
- let glDepthRenderbuffer = null;
24167
24457
  let xrFrame = null;
24168
- let depthStyle = null;
24169
- let clearStyle = null;
24458
+ const attributes = gl.getContextAttributes();
24459
+ let initialRenderTarget = null;
24460
+ let newRenderTarget = null;
24170
24461
 
24171
24462
  const controllers = [];
24172
24463
  const inputSourcesMap = new Map();
@@ -24277,21 +24568,13 @@ class WebXRManager extends EventDispatcher {
24277
24568
 
24278
24569
  // restore framebuffer/rendering state
24279
24570
 
24280
- state.bindXRFramebuffer( null );
24281
- renderer.setRenderTarget( renderer.getRenderTarget() );
24282
-
24283
- if ( glFramebuffer ) gl.deleteFramebuffer( glFramebuffer );
24284
- if ( glMultisampledFramebuffer ) gl.deleteFramebuffer( glMultisampledFramebuffer );
24285
- if ( glColorRenderbuffer ) gl.deleteRenderbuffer( glColorRenderbuffer );
24286
- if ( glDepthRenderbuffer ) gl.deleteRenderbuffer( glDepthRenderbuffer );
24287
- glFramebuffer = null;
24288
- glMultisampledFramebuffer = null;
24289
- glColorRenderbuffer = null;
24290
- glDepthRenderbuffer = null;
24571
+ renderer.setRenderTarget( initialRenderTarget );
24572
+
24291
24573
  glBaseLayer = null;
24292
24574
  glProjLayer = null;
24293
24575
  glBinding = null;
24294
24576
  session = null;
24577
+ newRenderTarget = null;
24295
24578
 
24296
24579
  //
24297
24580
 
@@ -24363,6 +24646,8 @@ class WebXRManager extends EventDispatcher {
24363
24646
 
24364
24647
  if ( session !== null ) {
24365
24648
 
24649
+ initialRenderTarget = renderer.getRenderTarget();
24650
+
24366
24651
  session.addEventListener( 'select', onSessionEvent );
24367
24652
  session.addEventListener( 'selectstart', onSessionEvent );
24368
24653
  session.addEventListener( 'selectend', onSessionEvent );
@@ -24372,18 +24657,16 @@ class WebXRManager extends EventDispatcher {
24372
24657
  session.addEventListener( 'end', onSessionEnd );
24373
24658
  session.addEventListener( 'inputsourceschange', onInputSourcesChange );
24374
24659
 
24375
- const attributes = gl.getContextAttributes();
24376
-
24377
24660
  if ( attributes.xrCompatible !== true ) {
24378
24661
 
24379
24662
  await gl.makeXRCompatible();
24380
24663
 
24381
24664
  }
24382
24665
 
24383
- if ( session.renderState.layers === undefined) {
24666
+ if ( ( session.renderState.layers === undefined ) || ( renderer.capabilities.isWebGL2 === false ) ) {
24384
24667
 
24385
24668
  const layerInit = {
24386
- antialias: attributes.antialias,
24669
+ antialias: ( session.renderState.layers === undefined ) ? attributes.antialias : true,
24387
24670
  alpha: attributes.alpha,
24388
24671
  depth: attributes.depth,
24389
24672
  stencil: attributes.stencil,
@@ -24394,43 +24677,29 @@ class WebXRManager extends EventDispatcher {
24394
24677
 
24395
24678
  session.updateRenderState( { baseLayer: glBaseLayer } );
24396
24679
 
24397
- } else if ( gl instanceof WebGLRenderingContext ) {
24398
-
24399
- // Use old style webgl layer because we can't use MSAA
24400
- // WebGL2 support.
24401
-
24402
- const layerInit = {
24403
- antialias: true,
24404
- alpha: attributes.alpha,
24405
- depth: attributes.depth,
24406
- stencil: attributes.stencil,
24407
- framebufferScaleFactor: framebufferScaleFactor
24408
- };
24409
-
24410
- glBaseLayer = new XRWebGLLayer( session, gl, layerInit );
24411
-
24412
- session.updateRenderState( { layers: [ glBaseLayer ] } );
24680
+ newRenderTarget = new WebGLRenderTarget(
24681
+ glBaseLayer.framebufferWidth,
24682
+ glBaseLayer.framebufferHeight
24683
+ );
24413
24684
 
24414
24685
  } else {
24415
24686
 
24416
24687
  isMultisample = attributes.antialias;
24417
24688
  let depthFormat = null;
24418
-
24689
+ let depthType = null;
24690
+ let glDepthFormat = null;
24419
24691
 
24420
24692
  if ( attributes.depth ) {
24421
24693
 
24422
- clearStyle = 256;
24423
-
24424
- if ( attributes.stencil ) clearStyle |= 1024;
24425
-
24426
- depthStyle = attributes.stencil ? 33306 : 36096;
24427
- depthFormat = attributes.stencil ? 35056 : 33190;
24694
+ glDepthFormat = attributes.stencil ? 35056 : 33189;
24695
+ depthFormat = attributes.stencil ? DepthStencilFormat : DepthFormat;
24696
+ depthType = attributes.stencil ? UnsignedInt248Type : UnsignedShortType;
24428
24697
 
24429
24698
  }
24430
24699
 
24431
24700
  const projectionlayerInit = {
24432
- colorFormat: attributes.alpha ? 32856 : 32849,
24433
- depthFormat: depthFormat,
24701
+ colorFormat: ( attributes.alpha || isMultisample ) ? 32856 : 32849,
24702
+ depthFormat: glDepthFormat,
24434
24703
  scaleFactor: framebufferScaleFactor
24435
24704
  };
24436
24705
 
@@ -24438,41 +24707,42 @@ class WebXRManager extends EventDispatcher {
24438
24707
 
24439
24708
  glProjLayer = glBinding.createProjectionLayer( projectionlayerInit );
24440
24709
 
24441
- glFramebuffer = gl.createFramebuffer();
24442
-
24443
24710
  session.updateRenderState( { layers: [ glProjLayer ] } );
24444
24711
 
24445
24712
  if ( isMultisample ) {
24446
24713
 
24447
- glMultisampledFramebuffer = gl.createFramebuffer();
24448
- glColorRenderbuffer = gl.createRenderbuffer();
24449
- gl.bindRenderbuffer( 36161, glColorRenderbuffer );
24450
- gl.renderbufferStorageMultisample(
24451
- 36161,
24452
- 4,
24453
- 32856,
24714
+ newRenderTarget = new WebGLMultisampleRenderTarget(
24454
24715
  glProjLayer.textureWidth,
24455
- glProjLayer.textureHeight );
24456
- state.bindFramebuffer( 36160, glMultisampledFramebuffer );
24457
- gl.framebufferRenderbuffer( 36160, 36064, 36161, glColorRenderbuffer );
24458
- gl.bindRenderbuffer( 36161, null );
24459
-
24460
- if ( depthFormat !== null ) {
24461
-
24462
- glDepthRenderbuffer = gl.createRenderbuffer();
24463
- gl.bindRenderbuffer( 36161, glDepthRenderbuffer );
24464
- gl.renderbufferStorageMultisample( 36161, 4, depthFormat, glProjLayer.textureWidth, glProjLayer.textureHeight );
24465
- gl.framebufferRenderbuffer( 36160, depthStyle, 36161, glDepthRenderbuffer );
24466
- gl.bindRenderbuffer( 36161, null );
24716
+ glProjLayer.textureHeight,
24717
+ {
24718
+ format: RGBAFormat,
24719
+ type: UnsignedByteType,
24720
+ depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
24721
+ stencilBuffer: attributes.stencil,
24722
+ ignoreDepth: glProjLayer.ignoreDepthValues,
24723
+ useRenderToTexture: hasMultisampledRenderToTexture,
24724
+ } );
24467
24725
 
24468
- }
24726
+ } else {
24469
24727
 
24470
- state.bindFramebuffer( 36160, null );
24728
+ newRenderTarget = new WebGLRenderTarget(
24729
+ glProjLayer.textureWidth,
24730
+ glProjLayer.textureHeight,
24731
+ {
24732
+ format: attributes.alpha ? RGBAFormat : RGBFormat,
24733
+ type: UnsignedByteType,
24734
+ depthTexture: new DepthTexture( glProjLayer.textureWidth, glProjLayer.textureHeight, depthType, undefined, undefined, undefined, undefined, undefined, undefined, depthFormat ),
24735
+ stencilBuffer: attributes.stencil,
24736
+ ignoreDepth: glProjLayer.ignoreDepthValues,
24737
+ } );
24471
24738
 
24472
24739
  }
24473
24740
 
24474
24741
  }
24475
24742
 
24743
+ // Set foveation to maximum.
24744
+ this.setFoveation( 0 );
24745
+
24476
24746
  referenceSpace = await session.requestReferenceSpace( referenceSpaceType );
24477
24747
 
24478
24748
  animation.setContext( session );
@@ -24758,7 +25028,8 @@ class WebXRManager extends EventDispatcher {
24758
25028
 
24759
25029
  if ( glBaseLayer !== null ) {
24760
25030
 
24761
- state.bindXRFramebuffer( glBaseLayer.framebuffer );
25031
+ renderer.setRenderTargetFramebuffer( newRenderTarget, glBaseLayer.framebuffer );
25032
+ renderer.setRenderTarget( newRenderTarget );
24762
25033
 
24763
25034
  }
24764
25035
 
@@ -24769,7 +25040,6 @@ class WebXRManager extends EventDispatcher {
24769
25040
  if ( views.length !== cameraVR.cameras.length ) {
24770
25041
 
24771
25042
  cameraVR.cameras.length = 0;
24772
-
24773
25043
  cameraVRNeedsUpdate = true;
24774
25044
 
24775
25045
  }
@@ -24787,19 +25057,20 @@ class WebXRManager extends EventDispatcher {
24787
25057
  } else {
24788
25058
 
24789
25059
  const glSubImage = glBinding.getViewSubImage( glProjLayer, view );
25060
+ viewport = glSubImage.viewport;
24790
25061
 
24791
- state.bindXRFramebuffer( glFramebuffer );
25062
+ // For side-by-side projection, we only produce a single texture for both eyes.
25063
+ if ( i === 0 ) {
24792
25064
 
24793
- if ( glSubImage.depthStencilTexture !== undefined ) {
25065
+ renderer.setRenderTargetTextures(
25066
+ newRenderTarget,
25067
+ glSubImage.colorTexture,
25068
+ glProjLayer.ignoreDepthValues ? undefined : glSubImage.depthStencilTexture );
24794
25069
 
24795
- gl.framebufferTexture2D( 36160, depthStyle, 3553, glSubImage.depthStencilTexture, 0 );
25070
+ renderer.setRenderTarget( newRenderTarget );
24796
25071
 
24797
25072
  }
24798
25073
 
24799
- gl.framebufferTexture2D( 36160, 36064, 3553, glSubImage.colorTexture, 0 );
24800
-
24801
- viewport = glSubImage.viewport;
24802
-
24803
25074
  }
24804
25075
 
24805
25076
  const camera = cameras[ i ];
@@ -24822,14 +25093,6 @@ class WebXRManager extends EventDispatcher {
24822
25093
 
24823
25094
  }
24824
25095
 
24825
- if ( isMultisample ) {
24826
-
24827
- state.bindXRFramebuffer( glMultisampledFramebuffer );
24828
-
24829
- if ( clearStyle !== null ) gl.clear( clearStyle );
24830
-
24831
- }
24832
-
24833
25096
  }
24834
25097
 
24835
25098
  //
@@ -24847,26 +25110,6 @@ class WebXRManager extends EventDispatcher {
24847
25110
 
24848
25111
  if ( onAnimationFrameCallback ) onAnimationFrameCallback( time, frame );
24849
25112
 
24850
- if ( isMultisample ) {
24851
-
24852
- const width = glProjLayer.textureWidth;
24853
- const height = glProjLayer.textureHeight;
24854
-
24855
- state.bindFramebuffer( 36008, glMultisampledFramebuffer );
24856
- state.bindFramebuffer( 36009, glFramebuffer );
24857
- // Invalidate the depth here to avoid flush of the depth data to main memory.
24858
- gl.invalidateFramebuffer( 36008, [ depthStyle ] );
24859
- gl.invalidateFramebuffer( 36009, [ depthStyle ] );
24860
- gl.blitFramebuffer( 0, 0, width, height, 0, 0, width, height, 16384, 9728 );
24861
- // Invalidate the MSAA buffer because it's not needed anymore.
24862
- gl.invalidateFramebuffer( 36008, [ 36064 ] );
24863
- state.bindFramebuffer( 36008, null );
24864
- state.bindFramebuffer( 36009, null );
24865
-
24866
- state.bindFramebuffer( 36160, glMultisampledFramebuffer );
24867
-
24868
- }
24869
-
24870
25113
  xrFrame = null;
24871
25114
 
24872
25115
  }
@@ -25044,14 +25287,6 @@ function WebGLMaterials( properties ) {
25044
25287
  uniforms.ior.value = material.ior;
25045
25288
  uniforms.refractionRatio.value = material.refractionRatio;
25046
25289
 
25047
- const maxMipLevel = properties.get( envMap ).__maxMipLevel;
25048
-
25049
- if ( maxMipLevel !== undefined ) {
25050
-
25051
- uniforms.maxMipLevel.value = maxMipLevel;
25052
-
25053
- }
25054
-
25055
25290
  }
25056
25291
 
25057
25292
  if ( material.lightMap ) {
@@ -25140,9 +25375,9 @@ function WebGLMaterials( properties ) {
25140
25375
 
25141
25376
  uvScaleMap = material.specularIntensityMap;
25142
25377
 
25143
- } else if ( material.specularTintMap ) {
25378
+ } else if ( material.specularColorMap ) {
25144
25379
 
25145
- uvScaleMap = material.specularTintMap;
25380
+ uvScaleMap = material.specularColorMap;
25146
25381
 
25147
25382
  } else if ( material.transmissionMap ) {
25148
25383
 
@@ -25152,6 +25387,14 @@ function WebGLMaterials( properties ) {
25152
25387
 
25153
25388
  uvScaleMap = material.thicknessMap;
25154
25389
 
25390
+ } else if ( material.sheenColorMap ) {
25391
+
25392
+ uvScaleMap = material.sheenColorMap;
25393
+
25394
+ } else if ( material.sheenRoughnessMap ) {
25395
+
25396
+ uvScaleMap = material.sheenRoughnessMap;
25397
+
25155
25398
  }
25156
25399
 
25157
25400
  if ( uvScaleMap !== undefined ) {
@@ -25487,10 +25730,22 @@ function WebGLMaterials( properties ) {
25487
25730
 
25488
25731
  if ( material.sheen > 0 ) {
25489
25732
 
25490
- uniforms.sheenTint.value.copy( material.sheenTint ).multiplyScalar( material.sheen );
25733
+ uniforms.sheenColor.value.copy( material.sheenColor ).multiplyScalar( material.sheen );
25491
25734
 
25492
25735
  uniforms.sheenRoughness.value = material.sheenRoughness;
25493
25736
 
25737
+ if ( material.sheenColorMap ) {
25738
+
25739
+ uniforms.sheenColorMap.value = material.sheenColorMap;
25740
+
25741
+ }
25742
+
25743
+ if ( material.sheenRoughnessMap ) {
25744
+
25745
+ uniforms.sheenRoughnessMap.value = material.sheenRoughnessMap;
25746
+
25747
+ }
25748
+
25494
25749
  }
25495
25750
 
25496
25751
  if ( material.clearcoat > 0 ) {
@@ -25546,12 +25801,12 @@ function WebGLMaterials( properties ) {
25546
25801
  }
25547
25802
 
25548
25803
  uniforms.attenuationDistance.value = material.attenuationDistance;
25549
- uniforms.attenuationTint.value.copy( material.attenuationTint );
25804
+ uniforms.attenuationColor.value.copy( material.attenuationColor );
25550
25805
 
25551
25806
  }
25552
25807
 
25553
25808
  uniforms.specularIntensity.value = material.specularIntensity;
25554
- uniforms.specularTint.value.copy( material.specularTint );
25809
+ uniforms.specularColor.value.copy( material.specularColor );
25555
25810
 
25556
25811
  if ( material.specularIntensityMap ) {
25557
25812
 
@@ -25559,9 +25814,9 @@ function WebGLMaterials( properties ) {
25559
25814
 
25560
25815
  }
25561
25816
 
25562
- if ( material.specularTintMap ) {
25817
+ if ( material.specularColorMap ) {
25563
25818
 
25564
- uniforms.specularTintMap.value = material.specularTintMap;
25819
+ uniforms.specularColorMap.value = material.specularColorMap;
25565
25820
 
25566
25821
  }
25567
25822
 
@@ -25833,8 +26088,10 @@ function WebGLRenderer( parameters = {} ) {
25833
26088
  failIfMajorPerformanceCaveat: _failIfMajorPerformanceCaveat
25834
26089
  };
25835
26090
 
25836
- // event listeners must be registered before WebGL context is created, see #12753
26091
+ // OffscreenCanvas does not have setAttribute, see #22811
26092
+ if ( 'setAttribute' in _canvas ) _canvas.setAttribute( 'data-engine', `three.js r${REVISION}` );
25837
26093
 
26094
+ // event listeners must be registered before WebGL context is created, see #12753
25838
26095
  _canvas.addEventListener( 'webglcontextlost', onContextLost, false );
25839
26096
  _canvas.addEventListener( 'webglcontextrestored', onContextRestore, false );
25840
26097
 
@@ -26276,77 +26533,6 @@ function WebGLRenderer( parameters = {} ) {
26276
26533
 
26277
26534
  // Buffer rendering
26278
26535
 
26279
- function renderObjectImmediate( object, program ) {
26280
-
26281
- object.render( function ( object ) {
26282
-
26283
- _this.renderBufferImmediate( object, program );
26284
-
26285
- } );
26286
-
26287
- }
26288
-
26289
- this.renderBufferImmediate = function ( object, program ) {
26290
-
26291
- bindingStates.initAttributes();
26292
-
26293
- const buffers = properties.get( object );
26294
-
26295
- if ( object.hasPositions && ! buffers.position ) buffers.position = _gl.createBuffer();
26296
- if ( object.hasNormals && ! buffers.normal ) buffers.normal = _gl.createBuffer();
26297
- if ( object.hasUvs && ! buffers.uv ) buffers.uv = _gl.createBuffer();
26298
- if ( object.hasColors && ! buffers.color ) buffers.color = _gl.createBuffer();
26299
-
26300
- const programAttributes = program.getAttributes();
26301
-
26302
- if ( object.hasPositions ) {
26303
-
26304
- _gl.bindBuffer( 34962, buffers.position );
26305
- _gl.bufferData( 34962, object.positionArray, 35048 );
26306
-
26307
- bindingStates.enableAttribute( programAttributes.position.location );
26308
- _gl.vertexAttribPointer( programAttributes.position.location, 3, 5126, false, 0, 0 );
26309
-
26310
- }
26311
-
26312
- if ( object.hasNormals ) {
26313
-
26314
- _gl.bindBuffer( 34962, buffers.normal );
26315
- _gl.bufferData( 34962, object.normalArray, 35048 );
26316
-
26317
- bindingStates.enableAttribute( programAttributes.normal.location );
26318
- _gl.vertexAttribPointer( programAttributes.normal.location, 3, 5126, false, 0, 0 );
26319
-
26320
- }
26321
-
26322
- if ( object.hasUvs ) {
26323
-
26324
- _gl.bindBuffer( 34962, buffers.uv );
26325
- _gl.bufferData( 34962, object.uvArray, 35048 );
26326
-
26327
- bindingStates.enableAttribute( programAttributes.uv.location );
26328
- _gl.vertexAttribPointer( programAttributes.uv.location, 2, 5126, false, 0, 0 );
26329
-
26330
- }
26331
-
26332
- if ( object.hasColors ) {
26333
-
26334
- _gl.bindBuffer( 34962, buffers.color );
26335
- _gl.bufferData( 34962, object.colorArray, 35048 );
26336
-
26337
- bindingStates.enableAttribute( programAttributes.color.location );
26338
- _gl.vertexAttribPointer( programAttributes.color.location, 3, 5126, false, 0, 0 );
26339
-
26340
- }
26341
-
26342
- bindingStates.disableUnusedAttributes();
26343
-
26344
- _gl.drawArrays( 4, 0, object.count );
26345
-
26346
- object.count = 0;
26347
-
26348
- };
26349
-
26350
26536
  this.renderBufferDirect = function ( camera, scene, geometry, material, object, group ) {
26351
26537
 
26352
26538
  if ( scene === null ) scene = _emptyScene; // renderBufferDirect second parameter used to be fog (could be null)
@@ -26788,17 +26974,6 @@ function WebGLRenderer( parameters = {} ) {
26788
26974
 
26789
26975
  }
26790
26976
 
26791
- } else if ( object.isImmediateRenderObject ) {
26792
-
26793
- if ( sortObjects ) {
26794
-
26795
- _vector3.setFromMatrixPosition( object.matrixWorld )
26796
- .applyMatrix4( _projScreenMatrix );
26797
-
26798
- }
26799
-
26800
- currentRenderList.push( object, null, object.material, groupOrder, _vector3.z, null );
26801
-
26802
26977
  } else if ( object.isMesh || object.isLine || object.isPoints ) {
26803
26978
 
26804
26979
  if ( object.isSkinnedMesh ) {
@@ -26896,7 +27071,8 @@ function WebGLRenderer( parameters = {} ) {
26896
27071
  minFilter: LinearMipmapLinearFilter,
26897
27072
  magFilter: NearestFilter,
26898
27073
  wrapS: ClampToEdgeWrapping,
26899
- wrapT: ClampToEdgeWrapping
27074
+ wrapT: ClampToEdgeWrapping,
27075
+ useRenderToTexture: extensions.has( 'WEBGL_multisampled_render_to_texture' )
26900
27076
  } );
26901
27077
 
26902
27078
  }
@@ -26953,35 +27129,21 @@ function WebGLRenderer( parameters = {} ) {
26953
27129
 
26954
27130
  material.onBeforeRender( _this, scene, camera, geometry, object, group );
26955
27131
 
26956
- if ( object.isImmediateRenderObject ) {
26957
-
26958
- const program = setProgram( camera, scene, geometry, material, object );
27132
+ if ( material.transparent === true && material.side === DoubleSide ) {
26959
27133
 
26960
- state.setMaterial( material );
27134
+ material.side = BackSide;
27135
+ material.needsUpdate = true;
27136
+ _this.renderBufferDirect( camera, scene, geometry, material, object, group );
26961
27137
 
26962
- bindingStates.reset();
27138
+ material.side = FrontSide;
27139
+ material.needsUpdate = true;
27140
+ _this.renderBufferDirect( camera, scene, geometry, material, object, group );
26963
27141
 
26964
- renderObjectImmediate( object, program );
27142
+ material.side = DoubleSide;
26965
27143
 
26966
27144
  } else {
26967
27145
 
26968
- if ( material.transparent === true && material.side === DoubleSide ) {
26969
-
26970
- material.side = BackSide;
26971
- material.needsUpdate = true;
26972
- _this.renderBufferDirect( camera, scene, geometry, material, object, group );
26973
-
26974
- material.side = FrontSide;
26975
- material.needsUpdate = true;
26976
- _this.renderBufferDirect( camera, scene, geometry, material, object, group );
26977
-
26978
- material.side = DoubleSide;
26979
-
26980
- } else {
26981
-
26982
- _this.renderBufferDirect( camera, scene, geometry, material, object, group );
26983
-
26984
- }
27146
+ _this.renderBufferDirect( camera, scene, geometry, material, object, group );
26985
27147
 
26986
27148
  }
26987
27149
 
@@ -27040,7 +27202,7 @@ function WebGLRenderer( parameters = {} ) {
27040
27202
 
27041
27203
  parameters.uniforms = programCache.getUniforms( material );
27042
27204
 
27043
- material.onBuild( parameters, _this );
27205
+ material.onBuild( object, parameters, _this );
27044
27206
 
27045
27207
  material.onBeforeCompile( parameters, _this );
27046
27208
 
@@ -27130,11 +27292,11 @@ function WebGLRenderer( parameters = {} ) {
27130
27292
  const environment = material.isMeshStandardMaterial ? scene.environment : null;
27131
27293
  const encoding = ( _currentRenderTarget === null ) ? _this.outputEncoding : _currentRenderTarget.texture.encoding;
27132
27294
  const envMap = ( material.isMeshStandardMaterial ? cubeuvmaps : cubemaps ).get( material.envMap || environment );
27133
- const vertexAlphas = material.vertexColors === true && !! geometry && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;
27134
- const vertexTangents = !! material.normalMap && !! geometry && !! geometry.attributes.tangent;
27135
- const morphTargets = !! geometry && !! geometry.morphAttributes.position;
27136
- const morphNormals = !! geometry && !! geometry.morphAttributes.normal;
27137
- const morphTargetsCount = ( !! geometry && !! geometry.morphAttributes.position ) ? geometry.morphAttributes.position.length : 0;
27295
+ const vertexAlphas = material.vertexColors === true && !! geometry.attributes.color && geometry.attributes.color.itemSize === 4;
27296
+ const vertexTangents = !! material.normalMap && !! geometry.attributes.tangent;
27297
+ const morphTargets = !! geometry.morphAttributes.position;
27298
+ const morphNormals = !! geometry.morphAttributes.normal;
27299
+ const morphTargetsCount = !! geometry.morphAttributes.position ? geometry.morphAttributes.position.length : 0;
27138
27300
 
27139
27301
  const materialProperties = properties.get( material );
27140
27302
  const lights = currentRenderState.state.lights;
@@ -27502,15 +27664,71 @@ function WebGLRenderer( parameters = {} ) {
27502
27664
 
27503
27665
  };
27504
27666
 
27667
+ this.setRenderTargetTextures = function ( renderTarget, colorTexture, depthTexture ) {
27668
+
27669
+ properties.get( renderTarget.texture ).__webglTexture = colorTexture;
27670
+ properties.get( renderTarget.depthTexture ).__webglTexture = depthTexture;
27671
+
27672
+ const renderTargetProperties = properties.get( renderTarget );
27673
+ renderTargetProperties.__hasExternalTextures = true;
27674
+
27675
+ if ( renderTargetProperties.__hasExternalTextures ) {
27676
+
27677
+ renderTargetProperties.__autoAllocateDepthBuffer = depthTexture === undefined;
27678
+
27679
+ if ( ! renderTargetProperties.__autoAllocateDepthBuffer ) {
27680
+
27681
+ // The multisample_render_to_texture extension doesn't work properly if there
27682
+ // are midframe flushes and an external depth buffer. Disable use of the extension.
27683
+ if ( renderTarget.useRenderToTexture ) {
27684
+
27685
+ console.warn( 'render-to-texture extension was disabled because an external texture was provided' );
27686
+ renderTarget.useRenderToTexture = false;
27687
+ renderTarget.useRenderbuffer = true;
27688
+
27689
+ }
27690
+
27691
+ }
27692
+
27693
+ }
27694
+
27695
+ };
27696
+
27697
+ this.setRenderTargetFramebuffer = function ( renderTarget, defaultFramebuffer ) {
27698
+
27699
+ const renderTargetProperties = properties.get( renderTarget );
27700
+ renderTargetProperties.__webglFramebuffer = defaultFramebuffer;
27701
+ renderTargetProperties.__useDefaultFramebuffer = defaultFramebuffer === undefined;
27702
+
27703
+ };
27704
+
27505
27705
  this.setRenderTarget = function ( renderTarget, activeCubeFace = 0, activeMipmapLevel = 0 ) {
27506
27706
 
27507
27707
  _currentRenderTarget = renderTarget;
27508
27708
  _currentActiveCubeFace = activeCubeFace;
27509
27709
  _currentActiveMipmapLevel = activeMipmapLevel;
27710
+ let useDefaultFramebuffer = true;
27711
+
27712
+ if ( renderTarget ) {
27713
+
27714
+ const renderTargetProperties = properties.get( renderTarget );
27715
+
27716
+ if ( renderTargetProperties.__useDefaultFramebuffer !== undefined ) {
27510
27717
 
27511
- if ( renderTarget && properties.get( renderTarget ).__webglFramebuffer === undefined ) {
27718
+ // We need to make sure to rebind the framebuffer.
27719
+ state.bindFramebuffer( 36160, null );
27720
+ useDefaultFramebuffer = false;
27512
27721
 
27513
- textures.setupRenderTarget( renderTarget );
27722
+ } else if ( renderTargetProperties.__webglFramebuffer === undefined ) {
27723
+
27724
+ textures.setupRenderTarget( renderTarget );
27725
+
27726
+ } else if ( renderTargetProperties.__hasExternalTextures ) {
27727
+
27728
+ // Color and depth texture must be rebound in order for the swapchain to update.
27729
+ textures.rebindTextures( renderTarget, properties.get( renderTarget.texture ).__webglTexture, properties.get( renderTarget.depthTexture ).__webglTexture );
27730
+
27731
+ }
27514
27732
 
27515
27733
  }
27516
27734
 
@@ -27535,7 +27753,7 @@ function WebGLRenderer( parameters = {} ) {
27535
27753
  framebuffer = __webglFramebuffer[ activeCubeFace ];
27536
27754
  isCube = true;
27537
27755
 
27538
- } else if ( renderTarget.isWebGLMultisampleRenderTarget ) {
27756
+ } else if ( renderTarget.useRenderbuffer ) {
27539
27757
 
27540
27758
  framebuffer = properties.get( renderTarget ).__webglMultisampledFramebuffer;
27541
27759
 
@@ -27559,7 +27777,7 @@ function WebGLRenderer( parameters = {} ) {
27559
27777
 
27560
27778
  const framebufferBound = state.bindFramebuffer( 36160, framebuffer );
27561
27779
 
27562
- if ( framebufferBound && capabilities.drawBuffers ) {
27780
+ if ( framebufferBound && capabilities.drawBuffers && useDefaultFramebuffer ) {
27563
27781
 
27564
27782
  let needsUpdate = false;
27565
27783
 
@@ -27896,6 +28114,8 @@ function WebGLRenderer( parameters = {} ) {
27896
28114
 
27897
28115
  }
27898
28116
 
28117
+ WebGLRenderer.prototype.isWebGLRenderer = true;
28118
+
27899
28119
  class WebGL1Renderer extends WebGLRenderer {}
27900
28120
 
27901
28121
  WebGL1Renderer.prototype.isWebGL1Renderer = true;
@@ -30170,38 +30390,6 @@ class CanvasTexture extends Texture {
30170
30390
 
30171
30391
  CanvasTexture.prototype.isCanvasTexture = true;
30172
30392
 
30173
- class DepthTexture extends Texture {
30174
-
30175
- constructor( width, height, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, format ) {
30176
-
30177
- format = format !== undefined ? format : DepthFormat;
30178
-
30179
- if ( format !== DepthFormat && format !== DepthStencilFormat ) {
30180
-
30181
- throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
30182
-
30183
- }
30184
-
30185
- if ( type === undefined && format === DepthFormat ) type = UnsignedShortType;
30186
- if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type;
30187
-
30188
- super( null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
30189
-
30190
- this.image = { width: width, height: height };
30191
-
30192
- this.magFilter = magFilter !== undefined ? magFilter : NearestFilter;
30193
- this.minFilter = minFilter !== undefined ? minFilter : NearestFilter;
30194
-
30195
- this.flipY = false;
30196
- this.generateMipmaps = false;
30197
-
30198
- }
30199
-
30200
-
30201
- }
30202
-
30203
- DepthTexture.prototype.isDepthTexture = true;
30204
-
30205
30393
  class CircleGeometry extends BufferGeometry {
30206
30394
 
30207
30395
  constructor( radius = 1, segments = 8, thetaStart = 0, thetaLength = Math.PI * 2 ) {
@@ -36222,8 +36410,10 @@ MeshStandardMaterial.prototype.isMeshStandardMaterial = true;
36222
36410
  * reflectivity: <float>,
36223
36411
  *
36224
36412
  * sheen: <float>,
36225
- * sheenTint: <Color>,
36413
+ * sheenColor: <Color>,
36414
+ * sheenColorMap: new THREE.Texture( <Image> ),
36226
36415
  * sheenRoughness: <float>,
36416
+ * sheenRoughnessMap: new THREE.Texture( <Image> ),
36227
36417
  *
36228
36418
  * transmission: <float>,
36229
36419
  * transmissionMap: new THREE.Texture( <Image> ),
@@ -36231,12 +36421,12 @@ MeshStandardMaterial.prototype.isMeshStandardMaterial = true;
36231
36421
  * thickness: <float>,
36232
36422
  * thicknessMap: new THREE.Texture( <Image> ),
36233
36423
  * attenuationDistance: <float>,
36234
- * attenuationTint: <Color>,
36424
+ * attenuationColor: <Color>,
36235
36425
  *
36236
36426
  * specularIntensity: <float>,
36237
- * specularIntensityhMap: new THREE.Texture( <Image> ),
36238
- * specularTint: <Color>,
36239
- * specularTintMap: new THREE.Texture( <Image> )
36427
+ * specularIntensityMap: new THREE.Texture( <Image> ),
36428
+ * specularColor: <Color>,
36429
+ * specularColorMap: new THREE.Texture( <Image> )
36240
36430
  * }
36241
36431
  */
36242
36432
 
@@ -36276,20 +36466,22 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
36276
36466
  }
36277
36467
  } );
36278
36468
 
36279
- this.sheenTint = new Color( 0x000000 );
36469
+ this.sheenColor = new Color( 0x000000 );
36470
+ this.sheenColorMap = null;
36280
36471
  this.sheenRoughness = 1.0;
36472
+ this.sheenRoughnessMap = null;
36281
36473
 
36282
36474
  this.transmissionMap = null;
36283
36475
 
36284
- this.thickness = 0.01;
36476
+ this.thickness = 0;
36285
36477
  this.thicknessMap = null;
36286
36478
  this.attenuationDistance = 0.0;
36287
- this.attenuationTint = new Color( 1, 1, 1 );
36479
+ this.attenuationColor = new Color( 1, 1, 1 );
36288
36480
 
36289
36481
  this.specularIntensity = 1.0;
36290
36482
  this.specularIntensityMap = null;
36291
- this.specularTint = new Color( 1, 1, 1 );
36292
- this.specularTintMap = null;
36483
+ this.specularColor = new Color( 1, 1, 1 );
36484
+ this.specularColorMap = null;
36293
36485
 
36294
36486
  this._sheen = 0.0;
36295
36487
  this._clearcoat = 0;
@@ -36374,8 +36566,10 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
36374
36566
  this.ior = source.ior;
36375
36567
 
36376
36568
  this.sheen = source.sheen;
36377
- this.sheenTint.copy( source.sheenTint );
36569
+ this.sheenColor.copy( source.sheenColor );
36570
+ this.sheenColorMap = source.sheenColorMap;
36378
36571
  this.sheenRoughness = source.sheenRoughness;
36572
+ this.sheenRoughnessMap = source.sheenRoughnessMap;
36379
36573
 
36380
36574
  this.transmission = source.transmission;
36381
36575
  this.transmissionMap = source.transmissionMap;
@@ -36383,12 +36577,12 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
36383
36577
  this.thickness = source.thickness;
36384
36578
  this.thicknessMap = source.thicknessMap;
36385
36579
  this.attenuationDistance = source.attenuationDistance;
36386
- this.attenuationTint.copy( source.attenuationTint );
36580
+ this.attenuationColor.copy( source.attenuationColor );
36387
36581
 
36388
36582
  this.specularIntensity = source.specularIntensity;
36389
36583
  this.specularIntensityMap = source.specularIntensityMap;
36390
- this.specularTint.copy( source.specularTint );
36391
- this.specularTintMap = source.specularTintMap;
36584
+ this.specularColor.copy( source.specularColor );
36585
+ this.specularColorMap = source.specularColorMap;
36392
36586
 
36393
36587
  return this;
36394
36588
 
@@ -39110,19 +39304,17 @@ class FileLoader extends Loader {
39110
39304
 
39111
39305
  url = this.manager.resolveURL( url );
39112
39306
 
39113
- const scope = this;
39114
-
39115
39307
  const cached = Cache.get( url );
39116
39308
 
39117
39309
  if ( cached !== undefined ) {
39118
39310
 
39119
- scope.manager.itemStart( url );
39311
+ this.manager.itemStart( url );
39120
39312
 
39121
- setTimeout( function () {
39313
+ setTimeout( () => {
39122
39314
 
39123
39315
  if ( onLoad ) onLoad( cached );
39124
39316
 
39125
- scope.manager.itemEnd( url );
39317
+ this.manager.itemEnd( url );
39126
39318
 
39127
39319
  }, 0 );
39128
39320
 
@@ -39146,225 +39338,164 @@ class FileLoader extends Loader {
39146
39338
 
39147
39339
  }
39148
39340
 
39149
- // Check for data: URI
39150
- const dataUriRegex = /^data:(.*?)(;base64)?,(.*)$/;
39151
- const dataUriRegexResult = url.match( dataUriRegex );
39152
- let request;
39153
-
39154
- // Safari can not handle Data URIs through XMLHttpRequest so process manually
39155
- if ( dataUriRegexResult ) {
39341
+ // Initialise array for duplicate requests
39342
+ loading[ url ] = [];
39156
39343
 
39157
- const mimeType = dataUriRegexResult[ 1 ];
39158
- const isBase64 = !! dataUriRegexResult[ 2 ];
39159
-
39160
- let data = dataUriRegexResult[ 3 ];
39161
- data = decodeURIComponent( data );
39162
-
39163
- if ( isBase64 ) data = atob( data );
39164
-
39165
- try {
39166
-
39167
- let response;
39168
- const responseType = ( this.responseType || '' ).toLowerCase();
39169
-
39170
- switch ( responseType ) {
39171
-
39172
- case 'arraybuffer':
39173
- case 'blob':
39174
-
39175
- const view = new Uint8Array( data.length );
39176
-
39177
- for ( let i = 0; i < data.length; i ++ ) {
39178
-
39179
- view[ i ] = data.charCodeAt( i );
39180
-
39181
- }
39182
-
39183
- if ( responseType === 'blob' ) {
39184
-
39185
- response = new Blob( [ view.buffer ], { type: mimeType } );
39186
-
39187
- } else {
39188
-
39189
- response = view.buffer;
39190
-
39191
- }
39192
-
39193
- break;
39194
-
39195
- case 'document':
39196
-
39197
- const parser = new DOMParser();
39198
- response = parser.parseFromString( data, mimeType );
39199
-
39200
- break;
39201
-
39202
- case 'json':
39203
-
39204
- response = JSON.parse( data );
39205
-
39206
- break;
39207
-
39208
- default: // 'text' or other
39209
-
39210
- response = data;
39344
+ loading[ url ].push( {
39345
+ onLoad: onLoad,
39346
+ onProgress: onProgress,
39347
+ onError: onError,
39348
+ } );
39211
39349
 
39212
- break;
39350
+ // create request
39351
+ const req = new Request( url, {
39352
+ headers: new Headers( this.requestHeader ),
39353
+ credentials: this.withCredentials ? 'include' : 'same-origin',
39354
+ // An abort controller could be added within a future PR
39355
+ } );
39213
39356
 
39214
- }
39357
+ // start the fetch
39358
+ fetch( req )
39359
+ .then( response => {
39215
39360
 
39216
- // Wait for next browser tick like standard XMLHttpRequest event dispatching does
39217
- setTimeout( function () {
39361
+ if ( response.status === 200 || response.status === 0 ) {
39218
39362
 
39219
- if ( onLoad ) onLoad( response );
39363
+ // Some browsers return HTTP Status 0 when using non-http protocol
39364
+ // e.g. 'file://' or 'data://'. Handle as success.
39220
39365
 
39221
- scope.manager.itemEnd( url );
39366
+ if ( response.status === 0 ) {
39222
39367
 
39223
- }, 0 );
39368
+ console.warn( 'THREE.FileLoader: HTTP Status 0 received.' );
39224
39369
 
39225
- } catch ( error ) {
39370
+ }
39226
39371
 
39227
- // Wait for next browser tick like standard XMLHttpRequest event dispatching does
39228
- setTimeout( function () {
39372
+ const callbacks = loading[ url ];
39373
+ const reader = response.body.getReader();
39374
+ const contentLength = response.headers.get( 'Content-Length' );
39375
+ const total = contentLength ? parseInt( contentLength ) : 0;
39376
+ const lengthComputable = total !== 0;
39377
+ let loaded = 0;
39229
39378
 
39230
- if ( onError ) onError( error );
39379
+ // periodically read data into the new stream tracking while download progress
39380
+ return new ReadableStream( {
39381
+ start( controller ) {
39231
39382
 
39232
- scope.manager.itemError( url );
39233
- scope.manager.itemEnd( url );
39383
+ readData();
39234
39384
 
39235
- }, 0 );
39385
+ function readData() {
39236
39386
 
39237
- }
39387
+ reader.read().then( ( { done, value } ) => {
39238
39388
 
39239
- } else {
39389
+ if ( done ) {
39240
39390
 
39241
- // Initialise array for duplicate requests
39391
+ controller.close();
39242
39392
 
39243
- loading[ url ] = [];
39393
+ } else {
39244
39394
 
39245
- loading[ url ].push( {
39395
+ loaded += value.byteLength;
39246
39396
 
39247
- onLoad: onLoad,
39248
- onProgress: onProgress,
39249
- onError: onError
39397
+ const event = new ProgressEvent( 'progress', { lengthComputable, loaded, total } );
39398
+ for ( let i = 0, il = callbacks.length; i < il; i ++ ) {
39250
39399
 
39251
- } );
39400
+ const callback = callbacks[ i ];
39401
+ if ( callback.onProgress ) callback.onProgress( event );
39252
39402
 
39253
- request = new XMLHttpRequest();
39403
+ }
39254
39404
 
39255
- request.open( 'GET', url, true );
39405
+ controller.enqueue( value );
39406
+ readData();
39256
39407
 
39257
- request.addEventListener( 'load', function ( event ) {
39408
+ }
39258
39409
 
39259
- const response = this.response;
39410
+ } );
39260
39411
 
39261
- const callbacks = loading[ url ];
39412
+ }
39262
39413
 
39263
- delete loading[ url ];
39414
+ }
39264
39415
 
39265
- if ( this.status === 200 || this.status === 0 ) {
39416
+ } );
39266
39417
 
39267
- // Some browsers return HTTP Status 0 when using non-http protocol
39268
- // e.g. 'file://' or 'data://'. Handle as success.
39418
+ } else {
39269
39419
 
39270
- if ( this.status === 0 ) console.warn( 'THREE.FileLoader: HTTP Status 0 received.' );
39420
+ throw Error( `fetch for "${response.url}" responded with ${response.status}: ${response.statusText}` );
39271
39421
 
39272
- // Add to cache only on HTTP success, so that we do not cache
39273
- // error response bodies as proper responses to requests.
39274
- Cache.add( url, response );
39422
+ }
39275
39423
 
39276
- for ( let i = 0, il = callbacks.length; i < il; i ++ ) {
39424
+ } )
39425
+ .then( stream => {
39277
39426
 
39278
- const callback = callbacks[ i ];
39279
- if ( callback.onLoad ) callback.onLoad( response );
39427
+ const response = new Response( stream );
39280
39428
 
39281
- }
39429
+ switch ( this.responseType ) {
39282
39430
 
39283
- scope.manager.itemEnd( url );
39431
+ case 'arraybuffer':
39284
39432
 
39285
- } else {
39433
+ return response.arrayBuffer();
39286
39434
 
39287
- for ( let i = 0, il = callbacks.length; i < il; i ++ ) {
39435
+ case 'blob':
39288
39436
 
39289
- const callback = callbacks[ i ];
39290
- if ( callback.onError ) callback.onError( event );
39437
+ return response.blob();
39291
39438
 
39292
- }
39439
+ case 'document':
39293
39440
 
39294
- scope.manager.itemError( url );
39295
- scope.manager.itemEnd( url );
39441
+ return response.text()
39442
+ .then( text => {
39296
39443
 
39297
- }
39444
+ const parser = new DOMParser();
39445
+ return parser.parseFromString( text, this.mimeType );
39298
39446
 
39299
- }, false );
39447
+ } );
39300
39448
 
39301
- request.addEventListener( 'progress', function ( event ) {
39449
+ case 'json':
39302
39450
 
39303
- const callbacks = loading[ url ];
39451
+ return response.json();
39304
39452
 
39305
- for ( let i = 0, il = callbacks.length; i < il; i ++ ) {
39453
+ default:
39306
39454
 
39307
- const callback = callbacks[ i ];
39308
- if ( callback.onProgress ) callback.onProgress( event );
39455
+ return response.text();
39309
39456
 
39310
39457
  }
39311
39458
 
39312
- }, false );
39459
+ } )
39460
+ .then( data => {
39313
39461
 
39314
- request.addEventListener( 'error', function ( event ) {
39462
+ // Add to cache only on HTTP success, so that we do not cache
39463
+ // error response bodies as proper responses to requests.
39464
+ Cache.add( url, data );
39315
39465
 
39316
39466
  const callbacks = loading[ url ];
39317
-
39318
39467
  delete loading[ url ];
39319
39468
 
39320
39469
  for ( let i = 0, il = callbacks.length; i < il; i ++ ) {
39321
39470
 
39322
39471
  const callback = callbacks[ i ];
39323
- if ( callback.onError ) callback.onError( event );
39472
+ if ( callback.onLoad ) callback.onLoad( data );
39324
39473
 
39325
39474
  }
39326
39475
 
39327
- scope.manager.itemError( url );
39328
- scope.manager.itemEnd( url );
39476
+ this.manager.itemEnd( url );
39329
39477
 
39330
- }, false );
39478
+ } )
39479
+ .catch( err => {
39331
39480
 
39332
- request.addEventListener( 'abort', function ( event ) {
39481
+ // Abort errors and other errors are handled the same
39333
39482
 
39334
39483
  const callbacks = loading[ url ];
39335
-
39336
39484
  delete loading[ url ];
39337
39485
 
39338
39486
  for ( let i = 0, il = callbacks.length; i < il; i ++ ) {
39339
39487
 
39340
39488
  const callback = callbacks[ i ];
39341
- if ( callback.onError ) callback.onError( event );
39489
+ if ( callback.onError ) callback.onError( err );
39342
39490
 
39343
39491
  }
39344
39492
 
39345
- scope.manager.itemError( url );
39346
- scope.manager.itemEnd( url );
39347
-
39348
- }, false );
39349
-
39350
- if ( this.responseType !== undefined ) request.responseType = this.responseType;
39351
- if ( this.withCredentials !== undefined ) request.withCredentials = this.withCredentials;
39352
-
39353
- if ( request.overrideMimeType ) request.overrideMimeType( this.mimeType !== undefined ? this.mimeType : 'text/plain' );
39354
-
39355
- for ( const header in this.requestHeader ) {
39356
-
39357
- request.setRequestHeader( header, this.requestHeader[ header ] );
39358
-
39359
- }
39360
-
39361
- request.send( null );
39362
-
39363
- }
39493
+ this.manager.itemError( url );
39494
+ this.manager.itemEnd( url );
39364
39495
 
39365
- scope.manager.itemStart( url );
39496
+ } );
39366
39497
 
39367
- return request;
39498
+ this.manager.itemStart( url );
39368
39499
 
39369
39500
  }
39370
39501
 
@@ -39609,8 +39740,7 @@ class ImageLoader extends Loader {
39609
39740
 
39610
39741
  function onImageLoad() {
39611
39742
 
39612
- image.removeEventListener( 'load', onImageLoad, false );
39613
- image.removeEventListener( 'error', onImageError, false );
39743
+ removeEventListeners();
39614
39744
 
39615
39745
  Cache.add( url, this );
39616
39746
 
@@ -39622,8 +39752,7 @@ class ImageLoader extends Loader {
39622
39752
 
39623
39753
  function onImageError( event ) {
39624
39754
 
39625
- image.removeEventListener( 'load', onImageLoad, false );
39626
- image.removeEventListener( 'error', onImageError, false );
39755
+ removeEventListeners();
39627
39756
 
39628
39757
  if ( onError ) onError( event );
39629
39758
 
@@ -39632,6 +39761,13 @@ class ImageLoader extends Loader {
39632
39761
 
39633
39762
  }
39634
39763
 
39764
+ function removeEventListeners() {
39765
+
39766
+ image.removeEventListener( 'load', onImageLoad, false );
39767
+ image.removeEventListener( 'error', onImageError, false );
39768
+
39769
+ }
39770
+
39635
39771
  image.addEventListener( 'load', onImageLoad, false );
39636
39772
  image.addEventListener( 'error', onImageError, false );
39637
39773
 
@@ -40784,19 +40920,19 @@ class MaterialLoader extends Loader {
40784
40920
  if ( json.roughness !== undefined ) material.roughness = json.roughness;
40785
40921
  if ( json.metalness !== undefined ) material.metalness = json.metalness;
40786
40922
  if ( json.sheen !== undefined ) material.sheen = json.sheen;
40787
- if ( json.sheenTint !== undefined ) material.sheenTint = new Color().setHex( json.sheenTint );
40923
+ if ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );
40788
40924
  if ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;
40789
40925
  if ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );
40790
40926
  if ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );
40791
40927
  if ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;
40792
- if ( json.specularTint !== undefined && material.specularTint !== undefined ) material.specularTint.setHex( json.specularTint );
40928
+ if ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );
40793
40929
  if ( json.shininess !== undefined ) material.shininess = json.shininess;
40794
40930
  if ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;
40795
40931
  if ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;
40796
40932
  if ( json.transmission !== undefined ) material.transmission = json.transmission;
40797
40933
  if ( json.thickness !== undefined ) material.thickness = json.thickness;
40798
40934
  if ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;
40799
- if ( json.attenuationTint !== undefined && material.attenuationTint !== undefined ) material.attenuationTint.setHex( json.attenuationTint );
40935
+ if ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );
40800
40936
  if ( json.fog !== undefined ) material.fog = json.fog;
40801
40937
  if ( json.flatShading !== undefined ) material.flatShading = json.flatShading;
40802
40938
  if ( json.blending !== undefined ) material.blending = json.blending;
@@ -40973,7 +41109,7 @@ class MaterialLoader extends Loader {
40973
41109
 
40974
41110
  if ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );
40975
41111
  if ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );
40976
- if ( json.specularTintMap !== undefined ) material.specularTintMap = getTexture( json.specularTintMap );
41112
+ if ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );
40977
41113
 
40978
41114
  if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );
40979
41115
  if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;
@@ -40997,6 +41133,9 @@ class MaterialLoader extends Loader {
40997
41133
  if ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );
40998
41134
  if ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );
40999
41135
 
41136
+ if ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );
41137
+ if ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );
41138
+
41000
41139
  return material;
41001
41140
 
41002
41141
  }
@@ -41056,6 +41195,32 @@ class LoaderUtils {
41056
41195
 
41057
41196
  }
41058
41197
 
41198
+ static resolveURL( url, path ) {
41199
+
41200
+ // Invalid URL
41201
+ if ( typeof url !== 'string' || url === '' ) return '';
41202
+
41203
+ // Host Relative URL
41204
+ if ( /^https?:\/\//i.test( path ) && /^\//.test( url ) ) {
41205
+
41206
+ path = path.replace( /(^https?:\/\/[^\/]+).*/i, '$1' );
41207
+
41208
+ }
41209
+
41210
+ // Absolute URL http://,https://,//
41211
+ if ( /^(https?:)?\/\//i.test( url ) ) return url;
41212
+
41213
+ // Data URI
41214
+ if ( /^data:.*,.*$/i.test( url ) ) return url;
41215
+
41216
+ // Blob URL
41217
+ if ( /^blob:.*$/i.test( url ) ) return url;
41218
+
41219
+ // Relative URL
41220
+ return path + url;
41221
+
41222
+ }
41223
+
41059
41224
  }
41060
41225
 
41061
41226
  class InstancedBufferGeometry extends BufferGeometry {
@@ -41958,6 +42123,8 @@ class ObjectLoader extends Loader {
41958
42123
  if ( data.premultiplyAlpha !== undefined ) texture.premultiplyAlpha = data.premultiplyAlpha;
41959
42124
  if ( data.unpackAlignment !== undefined ) texture.unpackAlignment = data.unpackAlignment;
41960
42125
 
42126
+ if ( data.userData !== undefined ) texture.userData = data.userData;
42127
+
41961
42128
  textures[ data.uuid ] = texture;
41962
42129
 
41963
42130
  }
@@ -42599,6 +42766,7 @@ AmbientLightProbe.prototype.isAmbientLightProbe = true;
42599
42766
 
42600
42767
  const _eyeRight = /*@__PURE__*/ new Matrix4();
42601
42768
  const _eyeLeft = /*@__PURE__*/ new Matrix4();
42769
+ const _projectionMatrix = /*@__PURE__*/ new Matrix4();
42602
42770
 
42603
42771
  class StereoCamera {
42604
42772
 
@@ -42651,7 +42819,7 @@ class StereoCamera {
42651
42819
  // Off-axis stereoscopic effect based on
42652
42820
  // http://paulbourke.net/stereographics/stereorender/
42653
42821
 
42654
- const projectionMatrix = camera.projectionMatrix.clone();
42822
+ _projectionMatrix.copy( camera.projectionMatrix );
42655
42823
  const eyeSepHalf = cache.eyeSep / 2;
42656
42824
  const eyeSepOnProjection = eyeSepHalf * cache.near / cache.focus;
42657
42825
  const ymax = ( cache.near * Math.tan( DEG2RAD * cache.fov * 0.5 ) ) / cache.zoom;
@@ -42667,20 +42835,20 @@ class StereoCamera {
42667
42835
  xmin = - ymax * cache.aspect + eyeSepOnProjection;
42668
42836
  xmax = ymax * cache.aspect + eyeSepOnProjection;
42669
42837
 
42670
- projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );
42671
- projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
42838
+ _projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );
42839
+ _projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
42672
42840
 
42673
- this.cameraL.projectionMatrix.copy( projectionMatrix );
42841
+ this.cameraL.projectionMatrix.copy( _projectionMatrix );
42674
42842
 
42675
42843
  // for right eye
42676
42844
 
42677
42845
  xmin = - ymax * cache.aspect - eyeSepOnProjection;
42678
42846
  xmax = ymax * cache.aspect - eyeSepOnProjection;
42679
42847
 
42680
- projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );
42681
- projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
42848
+ _projectionMatrix.elements[ 0 ] = 2 * cache.near / ( xmax - xmin );
42849
+ _projectionMatrix.elements[ 8 ] = ( xmax + xmin ) / ( xmax - xmin );
42682
42850
 
42683
- this.cameraR.projectionMatrix.copy( projectionMatrix );
42851
+ this.cameraR.projectionMatrix.copy( _projectionMatrix );
42684
42852
 
42685
42853
  }
42686
42854
 
@@ -46981,33 +47149,6 @@ class Line3 {
46981
47149
 
46982
47150
  }
46983
47151
 
46984
- class ImmediateRenderObject extends Object3D {
46985
-
46986
- constructor( material ) {
46987
-
46988
- super();
46989
-
46990
- this.material = material;
46991
- this.render = function ( /* renderCallback */ ) {};
46992
-
46993
- this.hasPositions = false;
46994
- this.hasNormals = false;
46995
- this.hasColors = false;
46996
- this.hasUvs = false;
46997
-
46998
- this.positionArray = null;
46999
- this.normalArray = null;
47000
- this.colorArray = null;
47001
- this.uvArray = null;
47002
-
47003
- this.count = 0;
47004
-
47005
- }
47006
-
47007
- }
47008
-
47009
- ImmediateRenderObject.prototype.isImmediateRenderObject = true;
47010
-
47011
47152
  const _vector$3 = /*@__PURE__*/ new Vector3();
47012
47153
 
47013
47154
  class SpotLightHelper extends Object3D {
@@ -50320,6 +50461,12 @@ function Font() {
50320
50461
 
50321
50462
  }
50322
50463
 
50464
+ function ImmediateRenderObject() {
50465
+
50466
+ console.error( 'THREE.ImmediateRenderObject has been removed.' );
50467
+
50468
+ }
50469
+
50323
50470
  if ( typeof __THREE_DEVTOOLS__ !== 'undefined' ) {
50324
50471
 
50325
50472
  /* eslint-disable no-undef */
@@ -50344,4 +50491,4 @@ if ( typeof window !== 'undefined' ) {
50344
50491
 
50345
50492
  }
50346
50493
 
50347
- export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AlphaFormat, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightProbe, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, AxisHelper, BackSide, BasicDepthPacking, BasicShadowMap, BinaryTextureLoader, Bone, BooleanKeyframeTrack, BoundingBoxHelper, Box2, Box3, Box3Helper, BoxGeometry as BoxBufferGeometry, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasRenderer, CanvasTexture, CatmullRomCurve3, CineonToneMapping, CircleGeometry as CircleBufferGeometry, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, CompressedTexture, CompressedTextureLoader, ConeGeometry as ConeBufferGeometry, ConeGeometry, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubeUVRefractionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry as CylinderBufferGeometry, CylinderGeometry, Cylindrical, DataTexture, DataTexture2DArray, DataTexture3D, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry as DodecahedronBufferGeometry, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicBufferAttribute, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EdgesHelper, EllipseCurve, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry as ExtrudeBufferGeometry, ExtrudeGeometry, FaceColors, FileLoader, FlatShading, Float16BufferAttribute, Float32Attribute, Float32BufferAttribute, Float64Attribute, Float64BufferAttribute, FloatType, Fog, FogExp2, Font, FontLoader, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GammaEncoding, GreaterDepth, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, HemisphereLightProbe, IcosahedronGeometry as IcosahedronBufferGeometry, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, ImmediateRenderObject, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16Attribute, Int16BufferAttribute, Int32Attribute, Int32BufferAttribute, Int8Attribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, JSONLoader, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry as LatheBufferGeometry, LatheGeometry, Layers, LensFlare, LessDepth, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LinePieces, LineSegments, LineStrip, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearToneMapping, Loader, LoaderUtils, LoadingManager, LogLuvEncoding, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils as Math, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshFaceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiMaterial, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverDepth, NeverStencilFunc, NoBlending, NoColors, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry as OctahedronBufferGeometry, OctahedronGeometry, OneFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, ParametricGeometry, Particle, ParticleBasicMaterial, ParticleSystem, ParticleSystemMaterial, Path, PerspectiveCamera, Plane, PlaneGeometry as PlaneBufferGeometry, PlaneGeometry, PlaneHelper, PointCloud, PointCloudMaterial, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry as PolyhedronBufferGeometry, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, 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, RGBDEncoding, RGBEEncoding, RGBEFormat, RGBFormat, RGBIntegerFormat, RGBM16Encoding, RGBM7Encoding, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry as RingBufferGeometry, RingGeometry, SRGB8_ALPHA8_ASTC_10x10_Format, SRGB8_ALPHA8_ASTC_10x5_Format, SRGB8_ALPHA8_ASTC_10x6_Format, SRGB8_ALPHA8_ASTC_10x8_Format, SRGB8_ALPHA8_ASTC_12x10_Format, SRGB8_ALPHA8_ASTC_12x12_Format, SRGB8_ALPHA8_ASTC_4x4_Format, SRGB8_ALPHA8_ASTC_5x4_Format, SRGB8_ALPHA8_ASTC_5x5_Format, SRGB8_ALPHA8_ASTC_6x5_Format, SRGB8_ALPHA8_ASTC_6x6_Format, SRGB8_ALPHA8_ASTC_8x5_Format, SRGB8_ALPHA8_ASTC_8x6_Format, SRGB8_ALPHA8_ASTC_8x8_Format, Scene, SceneUtils, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry as ShapeBufferGeometry, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, SmoothShading, Sphere, SphereGeometry as SphereBufferGeometry, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry as TetrahedronBufferGeometry, TetrahedronGeometry, TextGeometry, Texture, TextureLoader, TorusGeometry as TorusBufferGeometry, TorusGeometry, TorusKnotGeometry as TorusKnotBufferGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry as TubeBufferGeometry, TubeGeometry, UVMapping, Uint16Attribute, Uint16BufferAttribute, Uint32Attribute, Uint32BufferAttribute, Uint8Attribute, Uint8BufferAttribute, Uint8ClampedAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShort565Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, Vertex, VertexColors, VideoTexture, WebGL1Renderer, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLMultisampleRenderTarget, WebGLRenderTarget, WebGLRenderTargetCube, WebGLRenderer, WebGLUtils, WireframeGeometry, WireframeHelper, WrapAroundEnding, XHRLoader, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, sRGBEncoding };
50494
+ export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AlphaFormat, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AmbientLightProbe, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, AxisHelper, BackSide, BasicDepthPacking, BasicShadowMap, BinaryTextureLoader, Bone, BooleanKeyframeTrack, BoundingBoxHelper, Box2, Box3, Box3Helper, BoxGeometry as BoxBufferGeometry, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasRenderer, CanvasTexture, CatmullRomCurve3, CineonToneMapping, CircleGeometry as CircleBufferGeometry, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, CompressedTexture, CompressedTextureLoader, ConeGeometry as ConeBufferGeometry, ConeGeometry, CubeCamera, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubeUVRefractionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry as CylinderBufferGeometry, CylinderGeometry, Cylindrical, DataTexture, DataTexture2DArray, DataTexture3D, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry as DodecahedronBufferGeometry, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicBufferAttribute, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EdgesHelper, EllipseCurve, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExtrudeGeometry as ExtrudeBufferGeometry, ExtrudeGeometry, FaceColors, FileLoader, FlatShading, Float16BufferAttribute, Float32Attribute, Float32BufferAttribute, Float64Attribute, Float64BufferAttribute, FloatType, Fog, FogExp2, Font, FontLoader, FrontSide, Frustum, GLBufferAttribute, GLSL1, GLSL3, GammaEncoding, GreaterDepth, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HalfFloatType, HemisphereLight, HemisphereLightHelper, HemisphereLightProbe, IcosahedronGeometry as IcosahedronBufferGeometry, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, ImmediateRenderObject, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16Attribute, Int16BufferAttribute, Int32Attribute, Int32BufferAttribute, Int8Attribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InvertStencilOp, JSONLoader, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry as LatheBufferGeometry, LatheGeometry, Layers, LensFlare, LessDepth, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LinePieces, LineSegments, LineStrip, LinearEncoding, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearToneMapping, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, LuminanceAlphaFormat, LuminanceFormat, MOUSE, Material, MaterialLoader, MathUtils as Math, MathUtils, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshFaceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiMaterial, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeverDepth, NeverStencilFunc, NoBlending, NoColors, NoToneMapping, NormalAnimationBlendMode, NormalBlending, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry as OctahedronBufferGeometry, OctahedronGeometry, OneFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, PMREMGenerator, ParametricGeometry, Particle, ParticleBasicMaterial, ParticleSystem, ParticleSystemMaterial, Path, PerspectiveCamera, Plane, PlaneGeometry as PlaneBufferGeometry, PlaneGeometry, PlaneHelper, PointCloud, PointCloudMaterial, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry as PolyhedronBufferGeometry, PolyhedronGeometry, PositionalAudio, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, 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, RGBDEncoding, RGBEEncoding, RGBEFormat, RGBFormat, RGBIntegerFormat, RGBM16Encoding, RGBM7Encoding, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, RingGeometry as RingBufferGeometry, RingGeometry, SRGB8_ALPHA8_ASTC_10x10_Format, SRGB8_ALPHA8_ASTC_10x5_Format, SRGB8_ALPHA8_ASTC_10x6_Format, SRGB8_ALPHA8_ASTC_10x8_Format, SRGB8_ALPHA8_ASTC_12x10_Format, SRGB8_ALPHA8_ASTC_12x12_Format, SRGB8_ALPHA8_ASTC_4x4_Format, SRGB8_ALPHA8_ASTC_5x4_Format, SRGB8_ALPHA8_ASTC_5x5_Format, SRGB8_ALPHA8_ASTC_6x5_Format, SRGB8_ALPHA8_ASTC_6x6_Format, SRGB8_ALPHA8_ASTC_8x5_Format, SRGB8_ALPHA8_ASTC_8x6_Format, SRGB8_ALPHA8_ASTC_8x8_Format, Scene, SceneUtils, ShaderChunk, ShaderLib, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry as ShapeBufferGeometry, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, SmoothShading, Sphere, SphereGeometry as SphereBufferGeometry, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry as TetrahedronBufferGeometry, TetrahedronGeometry, TextGeometry, Texture, TextureLoader, TorusGeometry as TorusBufferGeometry, TorusGeometry, TorusKnotGeometry as TorusKnotBufferGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry as TubeBufferGeometry, TubeGeometry, UVMapping, Uint16Attribute, Uint16BufferAttribute, Uint32Attribute, Uint32BufferAttribute, Uint8Attribute, Uint8BufferAttribute, Uint8ClampedAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsLib, UniformsUtils, UnsignedByteType, UnsignedInt248Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShort565Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, Vertex, VertexColors, VideoTexture, WebGL1Renderer, WebGLCubeRenderTarget, WebGLMultipleRenderTargets, WebGLMultisampleRenderTarget, WebGLRenderTarget, WebGLRenderTargetCube, WebGLRenderer, WebGLUtils, WireframeGeometry, WireframeHelper, WrapAroundEnding, XHRLoader, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, sRGBEncoding };