super-three 0.141.0 → 0.144.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 (353) hide show
  1. package/README.md +8 -8
  2. package/build/three.cjs +1558 -1034
  3. package/build/three.js +1558 -1034
  4. package/build/three.min.js +1 -1
  5. package/build/three.module.js +2012 -1243
  6. package/examples/js/animation/MMDPhysics.js +1 -16
  7. package/examples/js/controls/ArcballControls.js +16 -3
  8. package/examples/js/controls/FirstPersonControls.js +0 -7
  9. package/examples/js/controls/FlyControls.js +0 -8
  10. package/examples/js/controls/OrbitControls.js +0 -4
  11. package/examples/js/controls/PointerLockControls.js +0 -8
  12. package/examples/js/controls/TrackballControls.js +0 -2
  13. package/examples/js/controls/TransformControls.js +20 -16
  14. package/examples/js/effects/AnaglyphEffect.js +2 -2
  15. package/examples/js/effects/OutlineEffect.js +4 -24
  16. package/examples/js/effects/ParallaxBarrierEffect.js +2 -2
  17. package/examples/js/effects/PeppersGhostEffect.js +2 -2
  18. package/examples/js/effects/StereoEffect.js +2 -2
  19. package/examples/js/environments/RoomEnvironment.js +22 -0
  20. package/examples/js/exporters/ColladaExporter.js +4 -13
  21. package/examples/js/exporters/DRACOExporter.js +0 -12
  22. package/examples/js/exporters/GLTFExporter.js +28 -29
  23. package/examples/js/exporters/OBJExporter.js +2 -23
  24. package/examples/js/exporters/PLYExporter.js +12 -24
  25. package/examples/js/exporters/STLExporter.js +0 -7
  26. package/examples/js/exporters/USDZExporter.js +6 -0
  27. package/examples/js/geometries/ConvexGeometry.js +1 -1
  28. package/examples/js/geometries/ParametricGeometry.js +1 -8
  29. package/examples/js/interactive/SelectionHelper.js +2 -0
  30. package/examples/js/libs/ktx-parse.umd.js +1 -0
  31. package/examples/js/libs/meshopt_decoder.js +98 -32
  32. package/examples/js/loaders/ColladaLoader.js +1 -0
  33. package/examples/js/loaders/DRACOLoader.js +2 -25
  34. package/examples/js/loaders/EXRLoader.js +2 -13
  35. package/examples/js/loaders/FBXLoader.js +10 -3
  36. package/examples/js/loaders/FontLoader.js +3 -16
  37. package/examples/js/loaders/GLTFLoader.js +52 -36
  38. package/examples/js/loaders/HDRCubeTextureLoader.js +0 -11
  39. package/examples/js/loaders/LDrawLoader.js +139 -74
  40. package/examples/js/loaders/OBJLoader.js +7 -13
  41. package/examples/js/loaders/PCDLoader.js +59 -14
  42. package/examples/js/loaders/PLYLoader.js +3 -3
  43. package/examples/js/loaders/SVGLoader.js +4 -3
  44. package/examples/js/loaders/TIFFLoader.js +31 -0
  45. package/examples/js/loaders/VRMLLoader.js +33 -24
  46. package/examples/js/loaders/VTKLoader.js +1 -1
  47. package/examples/js/loaders/lwo/LWO2Parser.js +8 -7
  48. package/examples/js/loaders/lwo/LWO3Parser.js +8 -7
  49. package/examples/js/materials/MeshGouraudMaterial.js +385 -0
  50. package/examples/js/math/ColorConverter.js +0 -50
  51. package/examples/js/misc/GPUComputationRenderer.js +23 -0
  52. package/examples/js/misc/Volume.js +198 -190
  53. package/examples/js/misc/VolumeSlice.js +90 -88
  54. package/examples/js/modifiers/SimplifyModifier.js +1 -1
  55. package/examples/js/objects/GroundProjectedEnv.js +193 -0
  56. package/examples/js/objects/Reflector.js +9 -2
  57. package/examples/js/objects/ReflectorForSSRPass.js +3 -4
  58. package/examples/js/objects/Refractor.js +10 -4
  59. package/examples/js/objects/ShadowMesh.js +5 -1
  60. package/examples/js/postprocessing/OutlinePass.js +5 -3
  61. package/examples/js/renderers/CSS2DRenderer.js +2 -2
  62. package/examples/js/renderers/CSS3DRenderer.js +2 -2
  63. package/examples/js/renderers/Projector.js +2 -23
  64. package/examples/js/shaders/LuminosityShader.js +1 -1
  65. package/examples/js/shaders/MMDToonShader.js +6 -2
  66. package/examples/js/shaders/ToneMapShader.js +1 -1
  67. package/examples/js/utils/BufferGeometryUtils.js +1 -1
  68. package/examples/js/utils/GeometryUtils.js +2 -18
  69. package/examples/js/utils/PackedPhongMaterial.js +1 -1
  70. package/examples/js/utils/SceneUtils.js +0 -16
  71. package/examples/jsm/animation/MMDPhysics.js +3 -22
  72. package/examples/jsm/controls/ArcballControls.js +17 -2
  73. package/examples/jsm/controls/FirstPersonControls.js +0 -7
  74. package/examples/jsm/controls/FlyControls.js +0 -7
  75. package/examples/jsm/controls/OrbitControls.js +0 -5
  76. package/examples/jsm/controls/PointerLockControls.js +0 -7
  77. package/examples/jsm/controls/TrackballControls.js +0 -3
  78. package/examples/jsm/controls/TransformControls.js +18 -16
  79. package/examples/jsm/effects/AnaglyphEffect.js +2 -2
  80. package/examples/jsm/effects/OutlineEffect.js +4 -25
  81. package/examples/jsm/effects/ParallaxBarrierEffect.js +2 -2
  82. package/examples/jsm/effects/PeppersGhostEffect.js +2 -2
  83. package/examples/jsm/effects/StereoEffect.js +2 -2
  84. package/examples/jsm/environments/RoomEnvironment.js +23 -0
  85. package/examples/jsm/exporters/ColladaExporter.js +4 -13
  86. package/examples/jsm/exporters/DRACOExporter.js +0 -13
  87. package/examples/jsm/exporters/GLTFExporter.js +29 -31
  88. package/examples/jsm/exporters/KTX2Exporter.js +29 -29
  89. package/examples/jsm/exporters/OBJExporter.js +0 -18
  90. package/examples/jsm/exporters/PLYExporter.js +14 -22
  91. package/examples/jsm/exporters/STLExporter.js +1 -9
  92. package/examples/jsm/exporters/USDZExporter.js +14 -3
  93. package/examples/jsm/geometries/ConvexGeometry.js +1 -1
  94. package/examples/jsm/geometries/ParametricGeometry.js +0 -6
  95. package/examples/jsm/interactive/HTMLMesh.js +9 -9
  96. package/examples/jsm/interactive/SelectionHelper.js +5 -3
  97. package/examples/jsm/libs/meshopt_decoder.module.js +97 -32
  98. package/examples/jsm/libs/utif.module.js +1579 -0
  99. package/examples/jsm/libs/zstddec.module.js +1 -0
  100. package/examples/jsm/loaders/ColladaLoader.js +1 -0
  101. package/examples/jsm/loaders/DRACOLoader.js +2 -28
  102. package/examples/jsm/loaders/EXRLoader.js +3 -13
  103. package/examples/jsm/loaders/FBXLoader.js +10 -3
  104. package/examples/jsm/loaders/FontLoader.js +3 -16
  105. package/examples/jsm/loaders/GLTFLoader.js +52 -36
  106. package/examples/jsm/loaders/HDRCubeTextureLoader.js +0 -13
  107. package/examples/jsm/loaders/KTX2Loader.js +192 -30
  108. package/examples/jsm/loaders/LDrawLoader.js +135 -74
  109. package/examples/jsm/loaders/OBJLoader.js +6 -14
  110. package/examples/jsm/loaders/PCDLoader.js +59 -13
  111. package/examples/jsm/loaders/PLYLoader.js +3 -3
  112. package/examples/jsm/loaders/RGBELoader.js +1 -1
  113. package/examples/jsm/loaders/SVGLoader.js +4 -3
  114. package/examples/jsm/loaders/TIFFLoader.js +36 -0
  115. package/examples/jsm/loaders/USDZLoader.js +393 -0
  116. package/examples/jsm/loaders/VRMLLoader.js +23 -25
  117. package/examples/jsm/loaders/VTKLoader.js +1 -1
  118. package/examples/jsm/loaders/lwo/LWO2Parser.js +6 -8
  119. package/examples/jsm/loaders/lwo/LWO3Parser.js +6 -8
  120. package/examples/jsm/materials/MeshGouraudMaterial.js +423 -0
  121. package/examples/jsm/math/ColorConverter.js +1 -49
  122. package/examples/jsm/misc/GPUComputationRenderer.js +43 -0
  123. package/examples/jsm/misc/Volume.js +169 -171
  124. package/examples/jsm/misc/VolumeSlice.js +78 -80
  125. package/examples/jsm/modifiers/SimplifyModifier.js +1 -1
  126. package/examples/jsm/node-editor/accessors/MatcapUVEditor.js +1 -1
  127. package/examples/jsm/node-editor/accessors/NormalEditor.js +1 -1
  128. package/examples/jsm/node-editor/accessors/PositionEditor.js +1 -1
  129. package/examples/jsm/node-editor/accessors/UVEditor.js +1 -1
  130. package/examples/jsm/node-editor/display/BlendEditor.js +1 -1
  131. package/examples/jsm/node-editor/display/NormalMapEditor.js +1 -1
  132. package/examples/jsm/node-editor/inputs/ColorEditor.js +1 -1
  133. package/examples/jsm/node-editor/inputs/FloatEditor.js +1 -1
  134. package/examples/jsm/node-editor/inputs/SliderEditor.js +1 -1
  135. package/examples/jsm/node-editor/inputs/TextureEditor.js +1 -1
  136. package/examples/jsm/node-editor/inputs/Vector2Editor.js +1 -1
  137. package/examples/jsm/node-editor/inputs/Vector3Editor.js +1 -1
  138. package/examples/jsm/node-editor/inputs/Vector4Editor.js +1 -1
  139. package/examples/jsm/node-editor/materials/BasicMaterialEditor.js +1 -1
  140. package/examples/jsm/node-editor/materials/PointsMaterialEditor.js +1 -1
  141. package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +1 -1
  142. package/examples/jsm/node-editor/math/AngleEditor.js +1 -1
  143. package/examples/jsm/node-editor/math/DotEditor.js +1 -1
  144. package/examples/jsm/node-editor/math/InvertEditor.js +1 -1
  145. package/examples/jsm/node-editor/math/LimiterEditor.js +1 -1
  146. package/examples/jsm/node-editor/math/NormalizeEditor.js +1 -1
  147. package/examples/jsm/node-editor/math/OperatorEditor.js +1 -1
  148. package/examples/jsm/node-editor/math/PowerEditor.js +1 -1
  149. package/examples/jsm/node-editor/math/TrigonometryEditor.js +1 -1
  150. package/examples/jsm/node-editor/procedural/CheckerEditor.js +1 -1
  151. package/examples/jsm/node-editor/utils/JoinEditor.js +1 -1
  152. package/examples/jsm/node-editor/utils/OscillatorEditor.js +1 -1
  153. package/examples/jsm/node-editor/utils/PreviewEditor.js +3 -3
  154. package/examples/jsm/node-editor/utils/SplitEditor.js +1 -1
  155. package/examples/jsm/node-editor/utils/TimerEditor.js +1 -1
  156. package/examples/jsm/nodes/Nodes.js +43 -13
  157. package/examples/jsm/nodes/accessors/CubeTextureNode.js +9 -5
  158. package/examples/jsm/nodes/accessors/NormalNode.js +4 -4
  159. package/examples/jsm/nodes/accessors/PositionNode.js +5 -5
  160. package/examples/jsm/nodes/accessors/ReflectVectorNode.js +31 -0
  161. package/examples/jsm/nodes/core/AttributeNode.js +3 -3
  162. package/examples/jsm/nodes/core/CodeNode.js +3 -3
  163. package/examples/jsm/nodes/core/FunctionCallNode.js +20 -5
  164. package/examples/jsm/nodes/core/FunctionNode.js +2 -2
  165. package/examples/jsm/nodes/core/Node.js +14 -12
  166. package/examples/jsm/nodes/core/NodeBuilder.js +12 -12
  167. package/examples/jsm/nodes/core/NodeUtils.js +23 -1
  168. package/examples/jsm/nodes/core/{NodeVary.js → NodeVarying.js} +3 -3
  169. package/examples/jsm/nodes/core/{VaryNode.js → VaryingNode.js} +7 -7
  170. package/examples/jsm/nodes/display/ColorAdjustmentNode.js +94 -0
  171. package/examples/jsm/nodes/geometry/RangeNode.js +109 -0
  172. package/examples/jsm/nodes/gpgpu/ComputeNode.js +2 -0
  173. package/examples/jsm/nodes/lighting/EnvironmentNode.js +8 -7
  174. package/examples/jsm/nodes/lighting/LightingContextNode.js +4 -4
  175. package/examples/jsm/nodes/loaders/NodeLoader.js +2 -2
  176. package/examples/jsm/nodes/loaders/NodeMaterialLoader.js +31 -0
  177. package/examples/jsm/nodes/materials/Materials.js +13 -25
  178. package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +70 -0
  179. package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +4 -7
  180. package/examples/jsm/nodes/materials/NodeMaterial.js +2 -2
  181. package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +28 -17
  182. package/examples/jsm/nodes/materialx/Disclaimer.md +199 -0
  183. package/examples/jsm/nodes/materialx/functions/lib/mx_hsv.js +56 -0
  184. package/examples/jsm/nodes/materialx/functions/lib/mx_noise.js +607 -0
  185. package/examples/jsm/nodes/math/MathNode.js +2 -12
  186. package/examples/jsm/nodes/parsers/GLSLNodeFunction.js +21 -6
  187. package/examples/jsm/nodes/procedural/CheckerNode.js +2 -2
  188. package/examples/jsm/nodes/shadernode/ShaderNode.js +5 -5
  189. package/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.js +8 -5
  190. package/examples/jsm/nodes/shadernode/ShaderNodeElements.js +20 -6
  191. package/examples/jsm/nodes/utils/ConvertNode.js +8 -3
  192. package/examples/jsm/nodes/utils/JoinNode.js +7 -7
  193. package/examples/jsm/nodes/utils/MaxMipLevelNode.js +2 -1
  194. package/examples/jsm/nodes/utils/RotateUVNode.js +32 -0
  195. package/examples/jsm/nodes/utils/SplitNode.js +21 -5
  196. package/examples/jsm/nodes/utils/TimerNode.js +2 -2
  197. package/examples/jsm/objects/GroundProjectedEnv.js +186 -0
  198. package/examples/jsm/objects/Reflector.js +12 -5
  199. package/examples/jsm/objects/ReflectorForSSRPass.js +3 -5
  200. package/examples/jsm/objects/Refractor.js +12 -6
  201. package/examples/jsm/objects/ShadowMesh.js +8 -2
  202. package/examples/jsm/postprocessing/OutlinePass.js +5 -3
  203. package/examples/jsm/renderers/CSS2DRenderer.js +2 -2
  204. package/examples/jsm/renderers/CSS3DRenderer.js +2 -2
  205. package/examples/jsm/renderers/Projector.js +2 -24
  206. package/examples/jsm/renderers/webgl/nodes/SlotNode.js +9 -5
  207. package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +329 -218
  208. package/examples/jsm/renderers/webgl/nodes/WebGLNodes.js +7 -3
  209. package/examples/jsm/renderers/webgpu/WebGPUBackground.js +39 -3
  210. package/examples/jsm/renderers/webgpu/WebGPUComputePipelines.js +6 -0
  211. package/examples/jsm/renderers/webgpu/WebGPUGeometries.js +6 -0
  212. package/examples/jsm/renderers/webgpu/WebGPUObjects.js +1 -1
  213. package/examples/jsm/renderers/webgpu/WebGPURenderPipeline.js +17 -19
  214. package/examples/jsm/renderers/webgpu/WebGPURenderPipelines.js +16 -14
  215. package/examples/jsm/renderers/webgpu/WebGPURenderStates.js +2 -2
  216. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +66 -81
  217. package/examples/jsm/renderers/webgpu/WebGPUTextureUtils.js +5 -3
  218. package/examples/jsm/renderers/webgpu/WebGPUTextures.js +2 -2
  219. package/examples/jsm/renderers/webgpu/WebGPUUtils.js +81 -0
  220. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +25 -30
  221. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodes.js +1 -1
  222. package/examples/jsm/shaders/LuminosityShader.js +1 -1
  223. package/examples/jsm/shaders/MMDToonShader.js +2 -2
  224. package/examples/jsm/shaders/ToneMapShader.js +1 -1
  225. package/examples/jsm/utils/BufferGeometryUtils.js +2 -1
  226. package/examples/jsm/utils/GeometryUtils.js +17 -25
  227. package/examples/jsm/utils/PackedPhongMaterial.js +0 -1
  228. package/examples/jsm/utils/SceneUtils.js +1 -21
  229. package/examples/jsm/webxr/OculusHandPointerModel.js +6 -1
  230. package/examples/jsm/webxr/VRButton.js +1 -7
  231. package/package.json +18 -14
  232. package/src/Three.Legacy.js +262 -36
  233. package/src/Three.js +3 -2
  234. package/src/animation/AnimationAction.js +6 -5
  235. package/src/animation/AnimationClip.js +1 -1
  236. package/src/animation/AnimationMixer.js +1 -1
  237. package/src/animation/AnimationUtils.js +204 -199
  238. package/src/animation/KeyframeTrack.js +1 -1
  239. package/src/animation/PropertyBinding.js +24 -5
  240. package/src/cameras/CubeCamera.js +0 -7
  241. package/src/constants.js +2 -4
  242. package/src/core/BufferAttribute.js +81 -111
  243. package/src/core/BufferGeometry.js +3 -41
  244. package/src/core/InstancedBufferAttribute.js +0 -10
  245. package/src/core/InterleavedBuffer.js +1 -1
  246. package/src/core/InterleavedBufferAttribute.js +56 -7
  247. package/src/core/Object3D.js +22 -5
  248. package/src/core/Uniform.js +0 -7
  249. package/src/core/UniformsGroup.js +92 -0
  250. package/src/extras/DataUtils.js +104 -88
  251. package/src/extras/core/Path.js +1 -0
  252. package/src/extras/core/ShapePath.js +1 -4
  253. package/src/extras/curves/CatmullRomCurve3.js +4 -2
  254. package/src/geometries/BoxGeometry.js +1 -1
  255. package/src/geometries/CapsuleGeometry.js +1 -1
  256. package/src/geometries/CircleGeometry.js +1 -1
  257. package/src/geometries/ConeGeometry.js +1 -1
  258. package/src/geometries/CylinderGeometry.js +2 -1
  259. package/src/geometries/DodecahedronGeometry.js +1 -1
  260. package/src/geometries/EdgesGeometry.js +5 -4
  261. package/src/geometries/ExtrudeGeometry.js +2 -11
  262. package/src/geometries/IcosahedronGeometry.js +1 -1
  263. package/src/geometries/LatheGeometry.js +2 -2
  264. package/src/geometries/OctahedronGeometry.js +1 -1
  265. package/src/geometries/PlaneGeometry.js +2 -1
  266. package/src/geometries/PolyhedronGeometry.js +1 -1
  267. package/src/geometries/RingGeometry.js +1 -1
  268. package/src/geometries/ShapeGeometry.js +2 -1
  269. package/src/geometries/SphereGeometry.js +2 -1
  270. package/src/geometries/TetrahedronGeometry.js +1 -1
  271. package/src/geometries/TorusGeometry.js +2 -1
  272. package/src/geometries/TorusKnotGeometry.js +2 -1
  273. package/src/geometries/TubeGeometry.js +2 -1
  274. package/src/geometries/WireframeGeometry.js +1 -0
  275. package/src/helpers/CameraHelper.js +97 -38
  276. package/src/helpers/DirectionalLightHelper.js +1 -0
  277. package/src/helpers/HemisphereLightHelper.js +1 -0
  278. package/src/helpers/PlaneHelper.js +6 -9
  279. package/src/helpers/PolarGridHelper.js +18 -14
  280. package/src/helpers/SpotLightHelper.js +1 -0
  281. package/src/lights/SpotLight.js +2 -0
  282. package/src/loaders/FileLoader.js +12 -1
  283. package/src/loaders/LoadingManager.js +1 -1
  284. package/src/loaders/MaterialLoader.js +49 -7
  285. package/src/loaders/ObjectLoader.js +4 -41
  286. package/src/materials/Material.js +1 -33
  287. package/src/materials/Materials.js +0 -27
  288. package/src/materials/MeshLambertMaterial.js +28 -1
  289. package/src/materials/ShaderMaterial.js +3 -7
  290. package/src/math/Color.js +3 -13
  291. package/src/math/MathUtils.js +1 -7
  292. package/src/math/Matrix3.js +1 -7
  293. package/src/math/Matrix4.js +3 -27
  294. package/src/math/Quaternion.js +1 -21
  295. package/src/math/Vector2.js +4 -24
  296. package/src/math/Vector3.js +7 -46
  297. package/src/math/Vector4.js +4 -24
  298. package/src/renderers/WebGLRenderer.js +84 -8
  299. package/src/renderers/shaders/ShaderChunk/bsdfs.glsl.js +12 -12
  300. package/src/renderers/shaders/ShaderChunk/bumpmap_pars_fragment.glsl.js +3 -5
  301. package/src/renderers/shaders/ShaderChunk/common.glsl.js +6 -5
  302. package/src/renderers/shaders/ShaderChunk/cube_uv_reflection_fragment.glsl.js +24 -24
  303. package/src/renderers/shaders/ShaderChunk/envmap_pars_fragment.glsl.js +1 -1
  304. package/src/renderers/shaders/ShaderChunk/envmap_pars_vertex.glsl.js +1 -1
  305. package/src/renderers/shaders/ShaderChunk/gradientmap_pars_fragment.glsl.js +2 -1
  306. package/src/renderers/shaders/ShaderChunk/iridescence_fragment.glsl.js +113 -99
  307. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +34 -12
  308. package/src/renderers/shaders/ShaderChunk/lights_lambert_fragment.glsl.js +5 -0
  309. package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +30 -0
  310. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +3 -1
  311. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +13 -1
  312. package/src/renderers/shaders/ShaderChunk/normalmap_pars_fragment.glsl.js +2 -4
  313. package/src/renderers/shaders/ShaderChunk/output_fragment.glsl.js +1 -1
  314. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +18 -7
  315. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +8 -3
  316. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +9 -6
  317. package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +1 -1
  318. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +14 -10
  319. package/src/renderers/shaders/ShaderChunk/worldpos_vertex.glsl.js +1 -1
  320. package/src/renderers/shaders/ShaderChunk.js +4 -2
  321. package/src/renderers/shaders/ShaderLib/meshbasic.glsl.js +0 -1
  322. package/src/renderers/shaders/ShaderLib/meshlambert.glsl.js +22 -50
  323. package/src/renderers/shaders/ShaderLib/meshphong.glsl.js +0 -1
  324. package/src/renderers/shaders/ShaderLib.js +31 -31
  325. package/src/renderers/shaders/UniformsLib.js +12 -11
  326. package/src/renderers/shaders/UniformsUtils.js +14 -0
  327. package/src/renderers/webgl/WebGLBackground.js +2 -2
  328. package/src/renderers/webgl/WebGLLights.js +37 -13
  329. package/src/renderers/webgl/WebGLMorphtargets.js +0 -20
  330. package/src/renderers/webgl/WebGLProgram.js +6 -11
  331. package/src/renderers/webgl/WebGLPrograms.js +30 -26
  332. package/src/renderers/webgl/WebGLRenderLists.js +5 -4
  333. package/src/renderers/webgl/WebGLRenderStates.js +5 -4
  334. package/src/renderers/webgl/WebGLShaderCache.js +9 -6
  335. package/src/renderers/webgl/WebGLShadowMap.js +10 -15
  336. package/src/renderers/webgl/WebGLState.js +47 -0
  337. package/src/renderers/webgl/WebGLUniforms.js +4 -4
  338. package/src/renderers/webgl/WebGLUniformsGroups.js +372 -0
  339. package/src/renderers/webgl/WebGLUtils.js +2 -0
  340. package/src/renderers/webvr/WebVRManager.js +42 -9
  341. package/src/renderers/webvr/WebVRUtils.js +1 -1
  342. package/src/renderers/webxr/WebXRController.js +45 -37
  343. package/src/renderers/webxr/WebXRManager.js +58 -33
  344. package/src/scenes/Scene.js +16 -3
  345. package/src/textures/Source.js +1 -1
  346. package/src/utils.js +1 -1
  347. package/examples/js/controls/experimental/CameraControls.js +0 -1048
  348. package/examples/js/loaders/KTX2Loader.js +0 -558
  349. package/examples/jsm/controls/experimental/CameraControls.js +0 -1248
  350. package/examples/jsm/nodes/accessors/ReflectNode.js +0 -70
  351. package/examples/jsm/package.json +0 -3
  352. package/examples/jsm/renderers/webgl/nodes/WebGLPhysicalContextNode.js +0 -45
  353. package/src/renderers/shaders/ShaderChunk/lights_lambert_vertex.glsl.js +0 -122
package/build/three.cjs CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  Object.defineProperty(exports, '__esModule', { value: true });
9
9
 
10
- const REVISION = '141';
10
+ const REVISION = '144';
11
11
  const MOUSE = {
12
12
  LEFT: 0,
13
13
  MIDDLE: 1,
@@ -33,8 +33,6 @@ const VSMShadowMap = 3;
33
33
  const FrontSide = 0;
34
34
  const BackSide = 1;
35
35
  const DoubleSide = 2;
36
- const FlatShading = 1;
37
- const SmoothShading = 2;
38
36
  const NoBlending = 0;
39
37
  const NormalBlending = 1;
40
38
  const AdditiveBlending = 2;
@@ -105,7 +103,8 @@ const UnsignedShort4444Type = 1017;
105
103
  const UnsignedShort5551Type = 1018;
106
104
  const UnsignedInt248Type = 1020;
107
105
  const AlphaFormat = 1021;
108
- const RGBFormat = 1022;
106
+ const RGBFormat = 1022; // @deprecated since r137
107
+
109
108
  const RGBAFormat = 1023;
110
109
  const LuminanceFormat = 1024;
111
110
  const LuminanceAlphaFormat = 1025;
@@ -252,12 +251,7 @@ class EventDispatcher {
252
251
 
253
252
  }
254
253
 
255
- const _lut = [];
256
-
257
- for (let i = 0; i < 256; i++) {
258
- _lut[i] = (i < 16 ? '0' : '') + i.toString(16);
259
- }
260
-
254
+ const _lut = ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '0a', '0b', '0c', '0d', '0e', '0f', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '1a', '1b', '1c', '1d', '1e', '1f', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '2a', '2b', '2c', '2d', '2e', '2f', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '3a', '3b', '3c', '3d', '3e', '3f', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '4a', '4b', '4c', '4d', '4e', '4f', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '5a', '5b', '5c', '5d', '5e', '5f', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '6a', '6b', '6c', '6d', '6e', '6f', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '7a', '7b', '7c', '7d', '7e', '7f', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '8a', '8b', '8c', '8d', '8e', '8f', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '9a', '9b', '9c', '9d', '9e', '9f', 'a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'aa', 'ab', 'ac', 'ad', 'ae', 'af', 'b0', 'b1', 'b2', 'b3', 'b4', 'b5', 'b6', 'b7', 'b8', 'b9', 'ba', 'bb', 'bc', 'bd', 'be', 'bf', 'c0', 'c1', 'c2', 'c3', 'c4', 'c5', 'c6', 'c7', 'c8', 'c9', 'ca', 'cb', 'cc', 'cd', 'ce', 'cf', 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6', 'd7', 'd8', 'd9', 'da', 'db', 'dc', 'dd', 'de', 'df', 'e0', 'e1', 'e2', 'e3', 'e4', 'e5', 'e6', 'e7', 'e8', 'e9', 'ea', 'eb', 'ec', 'ed', 'ee', 'ef', 'f0', 'f1', 'f2', 'f3', 'f4', 'f5', 'f6', 'f7', 'f8', 'f9', 'fa', 'fb', 'fc', 'fd', 'fe', 'ff'];
261
255
  let _seed = 1234567;
262
256
  const DEG2RAD = Math.PI / 180;
263
257
  const RAD2DEG = 180 / Math.PI; // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
@@ -417,7 +411,7 @@ function setQuaternionFromProperEuler(q, a, b, c, order) {
417
411
  }
418
412
  }
419
413
 
420
- function denormalize$1(value, array) {
414
+ function denormalize(value, array) {
421
415
  switch (array.constructor) {
422
416
  case Float32Array:
423
417
  return value;
@@ -486,12 +480,12 @@ var MathUtils = /*#__PURE__*/Object.freeze({
486
480
  floorPowerOfTwo: floorPowerOfTwo,
487
481
  setQuaternionFromProperEuler: setQuaternionFromProperEuler,
488
482
  normalize: normalize,
489
- denormalize: denormalize$1
483
+ denormalize: denormalize
490
484
  });
491
485
 
492
486
  class Vector2 {
493
487
  constructor(x = 0, y = 0) {
494
- this.isVector2 = true;
488
+ Vector2.prototype.isVector2 = true;
495
489
  this.x = x;
496
490
  this.y = y;
497
491
  }
@@ -574,12 +568,7 @@ class Vector2 {
574
568
  return this;
575
569
  }
576
570
 
577
- add(v, w) {
578
- if (w !== undefined) {
579
- console.warn('THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.');
580
- return this.addVectors(v, w);
581
- }
582
-
571
+ add(v) {
583
572
  this.x += v.x;
584
573
  this.y += v.y;
585
574
  return this;
@@ -603,12 +592,7 @@ class Vector2 {
603
592
  return this;
604
593
  }
605
594
 
606
- sub(v, w) {
607
- if (w !== undefined) {
608
- console.warn('THREE.Vector2: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.');
609
- return this.subVectors(v, w);
610
- }
611
-
595
+ sub(v) {
612
596
  this.x -= v.x;
613
597
  this.y -= v.y;
614
598
  return this;
@@ -793,11 +777,7 @@ class Vector2 {
793
777
  return array;
794
778
  }
795
779
 
796
- fromBufferAttribute(attribute, index, offset) {
797
- if (offset !== undefined) {
798
- console.warn('THREE.Vector2: offset has been removed from .fromBufferAttribute().');
799
- }
800
-
780
+ fromBufferAttribute(attribute, index) {
801
781
  this.x = attribute.getX(index);
802
782
  this.y = attribute.getY(index);
803
783
  return this;
@@ -828,12 +808,8 @@ class Vector2 {
828
808
 
829
809
  class Matrix3 {
830
810
  constructor() {
831
- this.isMatrix3 = true;
811
+ Matrix3.prototype.isMatrix3 = true;
832
812
  this.elements = [1, 0, 0, 0, 1, 0, 0, 0, 1];
833
-
834
- if (arguments.length > 0) {
835
- console.error('THREE.Matrix3: the constructor no longer reads arguments. use .set() instead.');
836
- }
837
813
  }
838
814
 
839
815
  set(n11, n12, n13, n21, n22, n23, n31, n32, n33) {
@@ -1105,7 +1081,7 @@ class Matrix3 {
1105
1081
  function arrayNeedsUint32(array) {
1106
1082
  // assumes larger values usually on last
1107
1083
  for (let i = array.length - 1; i >= 0; --i) {
1108
- if (array[i] > 65535) return true;
1084
+ if (array[i] >= 65535) return true; // account for PRIMITIVE_RESTART_FIXED_INDEX, #24565
1109
1085
  }
1110
1086
 
1111
1087
  return false;
@@ -1478,11 +1454,11 @@ class Color {
1478
1454
 
1479
1455
  case 'hsl':
1480
1456
  case 'hsla':
1481
- if (color = /^\s*(\d*\.?\d+)\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) {
1457
+ if (color = /^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(components)) {
1482
1458
  // hsl(120,50%,50%) hsla(120,50%,50%,0.5)
1483
1459
  const h = parseFloat(color[1]) / 360;
1484
- const s = parseInt(color[2], 10) / 100;
1485
- const l = parseInt(color[3], 10) / 100;
1460
+ const s = parseFloat(color[2]) / 100;
1461
+ const l = parseFloat(color[3]) / 100;
1486
1462
  handleAlpha(color[4]);
1487
1463
  return this.setHSL(h, s, l, colorSpace);
1488
1464
  }
@@ -1734,14 +1710,6 @@ class Color {
1734
1710
  this.r = attribute.getX(index);
1735
1711
  this.g = attribute.getY(index);
1736
1712
  this.b = attribute.getZ(index);
1737
-
1738
- if (attribute.normalized === true) {
1739
- // assuming Uint8Array
1740
- this.r /= 255;
1741
- this.g /= 255;
1742
- this.b /= 255;
1743
- }
1744
-
1745
1713
  return this;
1746
1714
  }
1747
1715
 
@@ -1904,7 +1872,7 @@ function serializeImage(image) {
1904
1872
  if (image.data) {
1905
1873
  // images of DataTexture
1906
1874
  return {
1907
- data: Array.prototype.slice.call(image.data),
1875
+ data: Array.from(image.data),
1908
1876
  width: image.width,
1909
1877
  height: image.height,
1910
1878
  type: image.data.constructor.name
@@ -2121,7 +2089,7 @@ Texture.DEFAULT_MAPPING = UVMapping;
2121
2089
 
2122
2090
  class Vector4 {
2123
2091
  constructor(x = 0, y = 0, z = 0, w = 1) {
2124
- this.isVector4 = true;
2092
+ Vector4.prototype.isVector4 = true;
2125
2093
  this.x = x;
2126
2094
  this.y = y;
2127
2095
  this.z = z;
@@ -2236,12 +2204,7 @@ class Vector4 {
2236
2204
  return this;
2237
2205
  }
2238
2206
 
2239
- add(v, w) {
2240
- if (w !== undefined) {
2241
- console.warn('THREE.Vector4: .add() now only accepts one argument. Use .addVectors( a, b ) instead.');
2242
- return this.addVectors(v, w);
2243
- }
2244
-
2207
+ add(v) {
2245
2208
  this.x += v.x;
2246
2209
  this.y += v.y;
2247
2210
  this.z += v.z;
@@ -2273,12 +2236,7 @@ class Vector4 {
2273
2236
  return this;
2274
2237
  }
2275
2238
 
2276
- sub(v, w) {
2277
- if (w !== undefined) {
2278
- console.warn('THREE.Vector4: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.');
2279
- return this.subVectors(v, w);
2280
- }
2281
-
2239
+ sub(v) {
2282
2240
  this.x -= v.x;
2283
2241
  this.y -= v.y;
2284
2242
  this.z -= v.z;
@@ -2583,11 +2541,7 @@ class Vector4 {
2583
2541
  return array;
2584
2542
  }
2585
2543
 
2586
- fromBufferAttribute(attribute, index, offset) {
2587
- if (offset !== undefined) {
2588
- console.warn('THREE.Vector4: offset has been removed from .fromBufferAttribute().');
2589
- }
2590
-
2544
+ fromBufferAttribute(attribute, index) {
2591
2545
  this.x = attribute.getX(index);
2592
2546
  this.y = attribute.getY(index);
2593
2547
  this.z = attribute.getZ(index);
@@ -2822,11 +2776,6 @@ class Quaternion {
2822
2776
  this._w = w;
2823
2777
  }
2824
2778
 
2825
- static slerp(qa, qb, qm, t) {
2826
- console.warn('THREE.Quaternion: Static .slerp() has been deprecated. Use qm.slerpQuaternions( qa, qb, t ) instead.');
2827
- return qm.slerpQuaternions(qa, qb, t);
2828
- }
2829
-
2830
2779
  static slerpFlat(dst, dstOffset, src0, srcOffset0, src1, srcOffset1, t) {
2831
2780
  // fuzz-free, array-based Quaternion SLERP operation
2832
2781
  let x0 = src0[srcOffset0 + 0],
@@ -2971,10 +2920,6 @@ class Quaternion {
2971
2920
  }
2972
2921
 
2973
2922
  setFromEuler(euler, update) {
2974
- if (!(euler && euler.isEuler)) {
2975
- throw new Error('THREE.Quaternion: .setFromEuler() now expects an Euler rotation rather than a Vector3 and order.');
2976
- }
2977
-
2978
2923
  const x = euler._x,
2979
2924
  y = euler._y,
2980
2925
  z = euler._z,
@@ -3197,12 +3142,7 @@ class Quaternion {
3197
3142
  return this;
3198
3143
  }
3199
3144
 
3200
- multiply(q, p) {
3201
- if (p !== undefined) {
3202
- console.warn('THREE.Quaternion: .multiply() now only accepts one argument. Use .multiplyQuaternions( a, b ) instead.');
3203
- return this.multiplyQuaternions(q, p);
3204
- }
3205
-
3145
+ multiply(q) {
3206
3146
  return this.multiplyQuaternions(this, q);
3207
3147
  }
3208
3148
 
@@ -3352,7 +3292,7 @@ class Quaternion {
3352
3292
 
3353
3293
  class Vector3 {
3354
3294
  constructor(x = 0, y = 0, z = 0) {
3355
- this.isVector3 = true;
3295
+ Vector3.prototype.isVector3 = true;
3356
3296
  this.x = x;
3357
3297
  this.y = y;
3358
3298
  this.z = z;
@@ -3437,12 +3377,7 @@ class Vector3 {
3437
3377
  return this;
3438
3378
  }
3439
3379
 
3440
- add(v, w) {
3441
- if (w !== undefined) {
3442
- console.warn('THREE.Vector3: .add() now only accepts one argument. Use .addVectors( a, b ) instead.');
3443
- return this.addVectors(v, w);
3444
- }
3445
-
3380
+ add(v) {
3446
3381
  this.x += v.x;
3447
3382
  this.y += v.y;
3448
3383
  this.z += v.z;
@@ -3470,12 +3405,7 @@ class Vector3 {
3470
3405
  return this;
3471
3406
  }
3472
3407
 
3473
- sub(v, w) {
3474
- if (w !== undefined) {
3475
- console.warn('THREE.Vector3: .sub() now only accepts one argument. Use .subVectors( a, b ) instead.');
3476
- return this.subVectors(v, w);
3477
- }
3478
-
3408
+ sub(v) {
3479
3409
  this.x -= v.x;
3480
3410
  this.y -= v.y;
3481
3411
  this.z -= v.z;
@@ -3496,12 +3426,7 @@ class Vector3 {
3496
3426
  return this;
3497
3427
  }
3498
3428
 
3499
- multiply(v, w) {
3500
- if (w !== undefined) {
3501
- console.warn('THREE.Vector3: .multiply() now only accepts one argument. Use .multiplyVectors( a, b ) instead.');
3502
- return this.multiplyVectors(v, w);
3503
- }
3504
-
3429
+ multiply(v) {
3505
3430
  this.x *= v.x;
3506
3431
  this.y *= v.y;
3507
3432
  this.z *= v.z;
@@ -3523,10 +3448,6 @@ class Vector3 {
3523
3448
  }
3524
3449
 
3525
3450
  applyEuler(euler) {
3526
- if (!(euler && euler.isEuler)) {
3527
- console.error('THREE.Vector3: .applyEuler() now expects an Euler rotation rather than a Vector3 and order.');
3528
- }
3529
-
3530
3451
  return this.applyQuaternion(_quaternion$4.setFromEuler(euler));
3531
3452
  }
3532
3453
 
@@ -3721,12 +3642,7 @@ class Vector3 {
3721
3642
  return this;
3722
3643
  }
3723
3644
 
3724
- cross(v, w) {
3725
- if (w !== undefined) {
3726
- console.warn('THREE.Vector3: .cross() now only accepts one argument. Use .crossVectors( a, b ) instead.');
3727
- return this.crossVectors(v, w);
3728
- }
3729
-
3645
+ cross(v) {
3730
3646
  return this.crossVectors(this, v);
3731
3647
  }
3732
3648
 
@@ -3859,11 +3775,7 @@ class Vector3 {
3859
3775
  return array;
3860
3776
  }
3861
3777
 
3862
- fromBufferAttribute(attribute, index, offset) {
3863
- if (offset !== undefined) {
3864
- console.warn('THREE.Vector3: offset has been removed from .fromBufferAttribute().');
3865
- }
3866
-
3778
+ fromBufferAttribute(attribute, index) {
3867
3779
  this.x = attribute.getX(index);
3868
3780
  this.y = attribute.getY(index);
3869
3781
  this.z = attribute.getZ(index);
@@ -4815,12 +4727,8 @@ class Ray {
4815
4727
 
4816
4728
  class Matrix4 {
4817
4729
  constructor() {
4818
- this.isMatrix4 = true;
4730
+ Matrix4.prototype.isMatrix4 = true;
4819
4731
  this.elements = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
4820
-
4821
- if (arguments.length > 0) {
4822
- console.error('THREE.Matrix4: the constructor no longer reads arguments. use .set() instead.');
4823
- }
4824
4732
  }
4825
4733
 
4826
4734
  set(n11, n12, n13, n14, n21, n22, n23, n24, n31, n32, n33, n34, n41, n42, n43, n44) {
@@ -4933,10 +4841,6 @@ class Matrix4 {
4933
4841
  }
4934
4842
 
4935
4843
  makeRotationFromEuler(euler) {
4936
- if (!(euler && euler.isEuler)) {
4937
- console.error('THREE.Matrix4: .makeRotationFromEuler() now expects a Euler rotation rather than a Vector3 and order.');
4938
- }
4939
-
4940
4844
  const te = this.elements;
4941
4845
  const x = euler.x,
4942
4846
  y = euler.y,
@@ -5093,12 +4997,7 @@ class Matrix4 {
5093
4997
  return this;
5094
4998
  }
5095
4999
 
5096
- multiply(m, n) {
5097
- if (n !== undefined) {
5098
- console.warn('THREE.Matrix4: .multiply() now only accepts one argument. Use .multiplyMatrices( a, b ) instead.');
5099
- return this.multiplyMatrices(m, n);
5100
- }
5101
-
5000
+ multiply(m) {
5102
5001
  return this.multiplyMatrices(this, m);
5103
5002
  }
5104
5003
 
@@ -5446,10 +5345,6 @@ class Matrix4 {
5446
5345
  }
5447
5346
 
5448
5347
  makePerspective(left, right, top, bottom, near, far) {
5449
- if (far === undefined) {
5450
- console.warn('THREE.Matrix4: .makePerspective() has been redefined and has a new signature. Please check the docs.');
5451
- }
5452
-
5453
5348
  const te = this.elements;
5454
5349
  const x = 2 * near / (right - left);
5455
5350
  const y = 2 * near / (top - bottom);
@@ -5933,6 +5828,8 @@ class Object3D extends EventDispatcher {
5933
5828
  this.matrixWorld = new Matrix4();
5934
5829
  this.matrixAutoUpdate = Object3D.DefaultMatrixAutoUpdate;
5935
5830
  this.matrixWorldNeedsUpdate = false;
5831
+ this.matrixWorldAutoUpdate = Object3D.DefaultMatrixWorldAutoUpdate; // checked by the renderer
5832
+
5936
5833
  this.layers = new Layers();
5937
5834
  this.visible = true;
5938
5835
  this.castShadow = false;
@@ -6255,14 +6152,18 @@ class Object3D extends EventDispatcher {
6255
6152
  const children = this.children;
6256
6153
 
6257
6154
  for (let i = 0, l = children.length; i < l; i++) {
6258
- children[i].updateMatrixWorld(force);
6155
+ const child = children[i];
6156
+
6157
+ if (child.matrixWorldAutoUpdate === true || force === true) {
6158
+ child.updateMatrixWorld(force);
6159
+ }
6259
6160
  }
6260
6161
  }
6261
6162
 
6262
6163
  updateWorldMatrix(updateParents, updateChildren) {
6263
6164
  const parent = this.parent;
6264
6165
 
6265
- if (updateParents === true && parent !== null) {
6166
+ if (updateParents === true && parent !== null && parent.matrixWorldAutoUpdate === true) {
6266
6167
  parent.updateWorldMatrix(true, false);
6267
6168
  }
6268
6169
 
@@ -6279,7 +6180,11 @@ class Object3D extends EventDispatcher {
6279
6180
  const children = this.children;
6280
6181
 
6281
6182
  for (let i = 0, l = children.length; i < l; i++) {
6282
- children[i].updateWorldMatrix(false, true);
6183
+ const child = children[i];
6184
+
6185
+ if (child.matrixWorldAutoUpdate === true) {
6186
+ child.updateWorldMatrix(false, true);
6187
+ }
6283
6188
  }
6284
6189
  }
6285
6190
  }
@@ -6350,7 +6255,7 @@ class Object3D extends EventDispatcher {
6350
6255
  }
6351
6256
  }
6352
6257
 
6353
- if (this.environment && this.environment.isTexture) {
6258
+ if (this.environment && this.environment.isTexture && this.environment.isRenderTargetTexture !== true) {
6354
6259
  object.environment = this.environment.toJSON(meta).uuid;
6355
6260
  }
6356
6261
  } else if (this.isMesh || this.isLine || this.isPoints) {
@@ -6466,6 +6371,7 @@ class Object3D extends EventDispatcher {
6466
6371
  this.matrixWorld.copy(source.matrixWorld);
6467
6372
  this.matrixAutoUpdate = source.matrixAutoUpdate;
6468
6373
  this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
6374
+ this.matrixWorldAutoUpdate = source.matrixWorldAutoUpdate;
6469
6375
  this.layers.mask = source.layers.mask;
6470
6376
  this.visible = source.visible;
6471
6377
  this.castShadow = source.castShadow;
@@ -6486,8 +6392,9 @@ class Object3D extends EventDispatcher {
6486
6392
 
6487
6393
  }
6488
6394
 
6489
- Object3D.DefaultUp = new Vector3(0, 1, 0);
6395
+ Object3D.DefaultUp = /*@__PURE__*/new Vector3(0, 1, 0);
6490
6396
  Object3D.DefaultMatrixAutoUpdate = true;
6397
+ Object3D.DefaultMatrixWorldAutoUpdate = true;
6491
6398
 
6492
6399
  const _v0$1 = /*@__PURE__*/new Vector3();
6493
6400
 
@@ -6832,13 +6739,6 @@ class Material extends EventDispatcher {
6832
6739
  if (newValue === undefined) {
6833
6740
  console.warn('THREE.Material: \'' + key + '\' parameter is undefined.');
6834
6741
  continue;
6835
- } // for backward compatibility if shading is set in the constructor
6836
-
6837
-
6838
- if (key === 'shading') {
6839
- console.warn('THREE.' + this.type + ': .shading has been removed. Use the boolean .flatShading instead.');
6840
- this.flatShading = newValue === FlatShading ? true : false;
6841
- continue;
6842
6742
  }
6843
6743
 
6844
6744
  const currentValue = this[key];
@@ -7108,27 +7008,10 @@ class Material extends EventDispatcher {
7108
7008
 
7109
7009
  set needsUpdate(value) {
7110
7010
  if (value === true) this.version++;
7111
- } // @deprecated since r131, f5803c62cc4a29d90744e9dc7811d086e354c1d8
7112
-
7113
-
7114
- get vertexTangents() {
7115
- console.warn('THREE.' + this.type + ': .vertexTangents has been removed.');
7116
- return false;
7117
- }
7118
-
7119
- set vertexTangents(value) {
7120
- console.warn('THREE.' + this.type + ': .vertexTangents has been removed.');
7121
7011
  }
7122
7012
 
7123
7013
  }
7124
7014
 
7125
- Material.fromType = function
7126
- /*type*/
7127
- () {
7128
- // TODO: Behavior added in Materials.js
7129
- return null;
7130
- };
7131
-
7132
7015
  class MeshBasicMaterial extends Material {
7133
7016
  constructor(parameters) {
7134
7017
  super();
@@ -7240,86 +7123,6 @@ class BufferAttribute {
7240
7123
  return this;
7241
7124
  }
7242
7125
 
7243
- copyColorsArray(colors) {
7244
- const array = this.array;
7245
- let offset = 0;
7246
-
7247
- for (let i = 0, l = colors.length; i < l; i++) {
7248
- let color = colors[i];
7249
-
7250
- if (color === undefined) {
7251
- console.warn('THREE.BufferAttribute.copyColorsArray(): color is undefined', i);
7252
- color = new Color();
7253
- }
7254
-
7255
- array[offset++] = color.r;
7256
- array[offset++] = color.g;
7257
- array[offset++] = color.b;
7258
- }
7259
-
7260
- return this;
7261
- }
7262
-
7263
- copyVector2sArray(vectors) {
7264
- const array = this.array;
7265
- let offset = 0;
7266
-
7267
- for (let i = 0, l = vectors.length; i < l; i++) {
7268
- let vector = vectors[i];
7269
-
7270
- if (vector === undefined) {
7271
- console.warn('THREE.BufferAttribute.copyVector2sArray(): vector is undefined', i);
7272
- vector = new Vector2();
7273
- }
7274
-
7275
- array[offset++] = vector.x;
7276
- array[offset++] = vector.y;
7277
- }
7278
-
7279
- return this;
7280
- }
7281
-
7282
- copyVector3sArray(vectors) {
7283
- const array = this.array;
7284
- let offset = 0;
7285
-
7286
- for (let i = 0, l = vectors.length; i < l; i++) {
7287
- let vector = vectors[i];
7288
-
7289
- if (vector === undefined) {
7290
- console.warn('THREE.BufferAttribute.copyVector3sArray(): vector is undefined', i);
7291
- vector = new Vector3();
7292
- }
7293
-
7294
- array[offset++] = vector.x;
7295
- array[offset++] = vector.y;
7296
- array[offset++] = vector.z;
7297
- }
7298
-
7299
- return this;
7300
- }
7301
-
7302
- copyVector4sArray(vectors) {
7303
- const array = this.array;
7304
- let offset = 0;
7305
-
7306
- for (let i = 0, l = vectors.length; i < l; i++) {
7307
- let vector = vectors[i];
7308
-
7309
- if (vector === undefined) {
7310
- console.warn('THREE.BufferAttribute.copyVector4sArray(): vector is undefined', i);
7311
- vector = new Vector4();
7312
- }
7313
-
7314
- array[offset++] = vector.x;
7315
- array[offset++] = vector.y;
7316
- array[offset++] = vector.z;
7317
- array[offset++] = vector.w;
7318
- }
7319
-
7320
- return this;
7321
- }
7322
-
7323
7126
  applyMatrix3(m) {
7324
7127
  if (this.itemSize === 2) {
7325
7128
  for (let i = 0, l = this.count; i < l; i++) {
@@ -7379,48 +7182,67 @@ class BufferAttribute {
7379
7182
  }
7380
7183
 
7381
7184
  set(value, offset = 0) {
7185
+ // Matching BufferAttribute constructor, do not normalize the array.
7382
7186
  this.array.set(value, offset);
7383
7187
  return this;
7384
7188
  }
7385
7189
 
7386
7190
  getX(index) {
7387
- return this.array[index * this.itemSize];
7191
+ let x = this.array[index * this.itemSize];
7192
+ if (this.normalized) x = denormalize(x, this.array);
7193
+ return x;
7388
7194
  }
7389
7195
 
7390
7196
  setX(index, x) {
7197
+ if (this.normalized) x = normalize(x, this.array);
7391
7198
  this.array[index * this.itemSize] = x;
7392
7199
  return this;
7393
7200
  }
7394
7201
 
7395
7202
  getY(index) {
7396
- return this.array[index * this.itemSize + 1];
7203
+ let y = this.array[index * this.itemSize + 1];
7204
+ if (this.normalized) y = denormalize(y, this.array);
7205
+ return y;
7397
7206
  }
7398
7207
 
7399
7208
  setY(index, y) {
7209
+ if (this.normalized) y = normalize(y, this.array);
7400
7210
  this.array[index * this.itemSize + 1] = y;
7401
7211
  return this;
7402
7212
  }
7403
7213
 
7404
7214
  getZ(index) {
7405
- return this.array[index * this.itemSize + 2];
7215
+ let z = this.array[index * this.itemSize + 2];
7216
+ if (this.normalized) z = denormalize(z, this.array);
7217
+ return z;
7406
7218
  }
7407
7219
 
7408
7220
  setZ(index, z) {
7221
+ if (this.normalized) z = normalize(z, this.array);
7409
7222
  this.array[index * this.itemSize + 2] = z;
7410
7223
  return this;
7411
7224
  }
7412
7225
 
7413
7226
  getW(index) {
7414
- return this.array[index * this.itemSize + 3];
7227
+ let w = this.array[index * this.itemSize + 3];
7228
+ if (this.normalized) w = denormalize(w, this.array);
7229
+ return w;
7415
7230
  }
7416
7231
 
7417
7232
  setW(index, w) {
7233
+ if (this.normalized) w = normalize(w, this.array);
7418
7234
  this.array[index * this.itemSize + 3] = w;
7419
7235
  return this;
7420
7236
  }
7421
7237
 
7422
7238
  setXY(index, x, y) {
7423
7239
  index *= this.itemSize;
7240
+
7241
+ if (this.normalized) {
7242
+ x = normalize(x, this.array);
7243
+ y = normalize(y, this.array);
7244
+ }
7245
+
7424
7246
  this.array[index + 0] = x;
7425
7247
  this.array[index + 1] = y;
7426
7248
  return this;
@@ -7428,6 +7250,13 @@ class BufferAttribute {
7428
7250
 
7429
7251
  setXYZ(index, x, y, z) {
7430
7252
  index *= this.itemSize;
7253
+
7254
+ if (this.normalized) {
7255
+ x = normalize(x, this.array);
7256
+ y = normalize(y, this.array);
7257
+ z = normalize(z, this.array);
7258
+ }
7259
+
7431
7260
  this.array[index + 0] = x;
7432
7261
  this.array[index + 1] = y;
7433
7262
  this.array[index + 2] = z;
@@ -7436,6 +7265,14 @@ class BufferAttribute {
7436
7265
 
7437
7266
  setXYZW(index, x, y, z, w) {
7438
7267
  index *= this.itemSize;
7268
+
7269
+ if (this.normalized) {
7270
+ x = normalize(x, this.array);
7271
+ y = normalize(y, this.array);
7272
+ z = normalize(z, this.array);
7273
+ w = normalize(w, this.array);
7274
+ }
7275
+
7439
7276
  this.array[index + 0] = x;
7440
7277
  this.array[index + 1] = y;
7441
7278
  this.array[index + 2] = z;
@@ -7456,13 +7293,30 @@ class BufferAttribute {
7456
7293
  const data = {
7457
7294
  itemSize: this.itemSize,
7458
7295
  type: this.array.constructor.name,
7459
- array: Array.prototype.slice.call(this.array),
7296
+ array: Array.from(this.array),
7460
7297
  normalized: this.normalized
7461
7298
  };
7462
7299
  if (this.name !== '') data.name = this.name;
7463
7300
  if (this.usage !== StaticDrawUsage) data.usage = this.usage;
7464
7301
  if (this.updateRange.offset !== 0 || this.updateRange.count !== -1) data.updateRange = this.updateRange;
7465
7302
  return data;
7303
+ } // @deprecated
7304
+
7305
+
7306
+ copyColorsArray() {
7307
+ console.error('THREE.BufferAttribute: copyColorsArray() was removed in r144.');
7308
+ }
7309
+
7310
+ copyVector2sArray() {
7311
+ console.error('THREE.BufferAttribute: copyVector2sArray() was removed in r144.');
7312
+ }
7313
+
7314
+ copyVector3sArray() {
7315
+ console.error('THREE.BufferAttribute: copyVector3sArray() was removed in r144.');
7316
+ }
7317
+
7318
+ copyVector4sArray() {
7319
+ console.error('THREE.BufferAttribute: copyVector4sArray() was removed in r144.');
7466
7320
  }
7467
7321
 
7468
7322
  } //
@@ -8045,35 +7899,11 @@ class BufferGeometry extends EventDispatcher {
8045
7899
  this.normalizeNormals();
8046
7900
  normalAttribute.needsUpdate = true;
8047
7901
  }
8048
- }
8049
-
8050
- merge(geometry, offset) {
8051
- if (!(geometry && geometry.isBufferGeometry)) {
8052
- console.error('THREE.BufferGeometry.merge(): geometry not an instance of THREE.BufferGeometry.', geometry);
8053
- return;
8054
- }
8055
-
8056
- if (offset === undefined) {
8057
- offset = 0;
8058
- console.warn('THREE.BufferGeometry.merge(): Overwriting original geometry, starting at offset=0. ' + 'Use BufferGeometryUtils.mergeBufferGeometries() for lossless merge.');
8059
- }
8060
-
8061
- const attributes = this.attributes;
8062
-
8063
- for (const key in attributes) {
8064
- if (geometry.attributes[key] === undefined) continue;
8065
- const attribute1 = attributes[key];
8066
- const attributeArray1 = attribute1.array;
8067
- const attribute2 = geometry.attributes[key];
8068
- const attributeArray2 = attribute2.array;
8069
- const attributeOffset = attribute2.itemSize * offset;
8070
- const length = Math.min(attributeArray2.length, attributeArray1.length - attributeOffset);
7902
+ } // @deprecated since r144
8071
7903
 
8072
- for (let i = 0, j = attributeOffset; i < length; i++, j++) {
8073
- attributeArray1[j] = attributeArray2[i];
8074
- }
8075
- }
8076
7904
 
7905
+ merge() {
7906
+ console.error('THREE.BufferGeometry.merge() has been removed. Use THREE.BufferGeometryUtils.mergeBufferGeometries() instead.');
8077
7907
  return this;
8078
7908
  }
8079
7909
 
@@ -8793,6 +8623,15 @@ function mergeUniforms(uniforms) {
8793
8623
  }
8794
8624
 
8795
8625
  return merged;
8626
+ }
8627
+ function cloneUniformsGroups(src) {
8628
+ const dst = [];
8629
+
8630
+ for (let u = 0; u < src.length; u++) {
8631
+ dst.push(src[u].clone());
8632
+ }
8633
+
8634
+ return dst;
8796
8635
  } // Legacy
8797
8636
 
8798
8637
  const UniformsUtils = {
@@ -8811,6 +8650,7 @@ class ShaderMaterial extends Material {
8811
8650
  this.type = 'ShaderMaterial';
8812
8651
  this.defines = {};
8813
8652
  this.uniforms = {};
8653
+ this.uniformsGroups = [];
8814
8654
  this.vertexShader = default_vertex;
8815
8655
  this.fragmentShader = default_fragment;
8816
8656
  this.linewidth = 1;
@@ -8844,10 +8684,6 @@ class ShaderMaterial extends Material {
8844
8684
  this.glslVersion = null;
8845
8685
 
8846
8686
  if (parameters !== undefined) {
8847
- if (parameters.attributes !== undefined) {
8848
- console.error('THREE.ShaderMaterial: attributes should now be defined in THREE.BufferGeometry instead.');
8849
- }
8850
-
8851
8687
  this.setValues(parameters);
8852
8688
  }
8853
8689
  }
@@ -8857,6 +8693,7 @@ class ShaderMaterial extends Material {
8857
8693
  this.fragmentShader = source.fragmentShader;
8858
8694
  this.vertexShader = source.vertexShader;
8859
8695
  this.uniforms = cloneUniforms(source.uniforms);
8696
+ this.uniformsGroups = cloneUniformsGroups(source.uniformsGroups);
8860
8697
  this.defines = Object.assign({}, source.defines);
8861
8698
  this.wireframe = source.wireframe;
8862
8699
  this.wireframeLinewidth = source.wireframeLinewidth;
@@ -9161,12 +8998,6 @@ class CubeCamera extends Object3D {
9161
8998
  constructor(near, far, renderTarget) {
9162
8999
  super();
9163
9000
  this.type = 'CubeCamera';
9164
-
9165
- if (renderTarget.isWebGLCubeRenderTarget !== true) {
9166
- console.error('THREE.CubeCamera: The constructor now expects an instance of WebGLCubeRenderTarget as third parameter.');
9167
- return;
9168
- }
9169
-
9170
9001
  this.renderTarget = renderTarget;
9171
9002
  const cameraPX = new PerspectiveCamera(fov, aspect, near, far);
9172
9003
  cameraPX.layers = this.layers;
@@ -9853,11 +9684,11 @@ var begin_vertex = "vec3 transformed = vec3( position );";
9853
9684
 
9854
9685
  var beginnormal_vertex = "vec3 objectNormal = vec3( normal );\n#ifdef USE_TANGENT\n\tvec3 objectTangent = vec3( tangent.xyz );\n#endif";
9855
9686
 
9856
- 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 F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\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}\n#ifdef USE_IRIDESCENCE\nvec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, 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 = mix(F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence);\n\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\tfloat D = D_GGX( alpha, dotNH );\n\treturn F * ( V * D );\n}\n#endif\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";
9687
+ 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 F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\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}\n#ifdef USE_IRIDESCENCE\n\tvec3 BRDF_GGX_Iridescence( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float iridescence, const in vec3 iridescenceFresnel, const in float roughness ) {\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = mix( F_Schlick( f0, f90, dotVH ), iridescenceFresnel, iridescence );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\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";
9857
9688
 
9858
- var iridescence_fragment = "#ifdef USE_IRIDESCENCE\nconst mat3 XYZ_TO_REC709 = mat3(\n 3.2404542, -0.9692660, 0.0556434,\n -1.5371385, 1.8760108, -0.2040259,\n -0.4985314, 0.0415560, 1.0572252\n);\nvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n vec3 sqrtF0 = sqrt( fresnel0 );\n return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n}\nvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n}\nfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n}\nvec3 evalSensitivity( float OPD, vec3 shift ) {\n float phase = 2.0 * PI * OPD * 1.0e-9;\n vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( -pow2( phase ) * var );\n xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[0] ) * exp( -4.5282e+09 * pow2( phase ) );\n xyz /= 1.0685e-7;\n vec3 srgb = XYZ_TO_REC709 * xyz;\n return srgb;\n}\nvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n vec3 I;\n float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n float cosTheta2Sq = 1.0 - sinTheta2Sq;\n if ( cosTheta2Sq < 0.0 ) {\n return vec3( 1.0 );\n }\n float cosTheta2 = sqrt( cosTheta2Sq );\n float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n float R12 = F_Schlick( R0, 1.0, cosTheta1 );\n float R21 = R12;\n float T121 = 1.0 - R12;\n float phi12 = 0.0;\n if ( iridescenceIOR < outsideIOR ) phi12 = PI;\n float phi21 = PI - phi12;\n vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) ); vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n vec3 phi23 = vec3( 0.0 );\n if ( baseIOR[0] < iridescenceIOR ) phi23[0] = PI;\n if ( baseIOR[1] < iridescenceIOR ) phi23[1] = PI;\n if ( baseIOR[2] < iridescenceIOR ) phi23[2] = PI;\n float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n vec3 phi = vec3( phi21 ) + phi23;\n vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n vec3 r123 = sqrt( R123 );\n vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n vec3 C0 = R12 + Rs;\n I = C0;\n vec3 Cm = Rs - T121;\n for ( int m = 1; m <= 2; ++m ) {\n Cm *= r123;\n vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n I += Cm * Sm;\n }\n return max( I, vec3( 0.0 ) );\n}\n#endif";
9689
+ var iridescence_fragment = "#ifdef USE_IRIDESCENCE\n\tconst mat3 XYZ_TO_REC709 = mat3(\n\t\t 3.2404542, -0.9692660, 0.0556434,\n\t\t-1.5371385, 1.8760108, -0.2040259,\n\t\t-0.4985314, 0.0415560, 1.0572252\n\t);\n\tvec3 Fresnel0ToIor( vec3 fresnel0 ) {\n\t\tvec3 sqrtF0 = sqrt( fresnel0 );\n\t\treturn ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );\n\t}\n\tvec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );\n\t}\n\tfloat IorToFresnel0( float transmittedIor, float incidentIor ) {\n\t\treturn pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));\n\t}\n\tvec3 evalSensitivity( float OPD, vec3 shift ) {\n\t\tfloat phase = 2.0 * PI * OPD * 1.0e-9;\n\t\tvec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );\n\t\tvec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );\n\t\tvec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );\n\t\tvec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );\n\t\txyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );\n\t\txyz /= 1.0685e-7;\n\t\tvec3 rgb = XYZ_TO_REC709 * xyz;\n\t\treturn rgb;\n\t}\n\tvec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {\n\t\tvec3 I;\n\t\tfloat iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );\n\t\tfloat sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );\n\t\tfloat cosTheta2Sq = 1.0 - sinTheta2Sq;\n\t\tif ( cosTheta2Sq < 0.0 ) {\n\t\t\t return vec3( 1.0 );\n\t\t}\n\t\tfloat cosTheta2 = sqrt( cosTheta2Sq );\n\t\tfloat R0 = IorToFresnel0( iridescenceIOR, outsideIOR );\n\t\tfloat R12 = F_Schlick( R0, 1.0, cosTheta1 );\n\t\tfloat R21 = R12;\n\t\tfloat T121 = 1.0 - R12;\n\t\tfloat phi12 = 0.0;\n\t\tif ( iridescenceIOR < outsideIOR ) phi12 = PI;\n\t\tfloat phi21 = PI - phi12;\n\t\tvec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );\t\tvec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );\n\t\tvec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );\n\t\tvec3 phi23 = vec3( 0.0 );\n\t\tif ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;\n\t\tif ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;\n\t\tif ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;\n\t\tfloat OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;\n\t\tvec3 phi = vec3( phi21 ) + phi23;\n\t\tvec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );\n\t\tvec3 r123 = sqrt( R123 );\n\t\tvec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );\n\t\tvec3 C0 = R12 + Rs;\n\t\tI = C0;\n\t\tvec3 Cm = Rs - T121;\n\t\tfor ( int m = 1; m <= 2; ++ m ) {\n\t\t\tCm *= r123;\n\t\t\tvec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );\n\t\t\tI += Cm * Sm;\n\t\t}\n\t\treturn max( I, vec3( 0.0 ) );\n\t}\n#endif";
9859
9690
 
9860
- 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";
9691
+ 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 = dFdx( surf_pos.xyz );\n\t\tvec3 vSigmaY = dFdy( surf_pos.xyz );\n\t\tvec3 vN = surf_norm;\n\t\tvec3 R1 = cross( vSigmaY, vN );\n\t\tvec3 R2 = cross( vN, vSigmaX );\n\t\tfloat fDet = dot( vSigmaX, R1 ) * faceDirection;\n\t\tvec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );\n\t\treturn normalize( abs( fDet ) * surf_norm - vGrad );\n\t}\n#endif";
9861
9692
 
9862
9693
  var clipping_planes_fragment = "#if NUM_CLIPPING_PLANES > 0\n\tvec4 plane;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {\n\t\tplane = clippingPlanes[ i ];\n\t\tif ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;\n\t}\n\t#pragma unroll_loop_end\n\t#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES\n\t\tbool clipped = true;\n\t\t#pragma unroll_loop_start\n\t\tfor ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {\n\t\t\tplane = clippingPlanes[ i ];\n\t\t\tclipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;\n\t\t}\n\t\t#pragma unroll_loop_end\n\t\tif ( clipped ) discard;\n\t#endif\n#endif";
9863
9694
 
@@ -9875,9 +9706,9 @@ var color_pars_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvarying vec4 vColor;\
9875
9706
 
9876
9707
  var color_vertex = "#if defined( USE_COLOR_ALPHA )\n\tvColor = vec4( 1.0 );\n#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR )\n\tvColor = vec3( 1.0 );\n#endif\n#ifdef USE_COLOR\n\tvColor *= color;\n#endif\n#ifdef USE_INSTANCING_COLOR\n\tvColor.xyz *= instanceColor.xyz;\n#endif";
9877
9708
 
9878
- var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 color ) { return dot( color, vec3( 0.3333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat linearToRelativeLuminance( const in vec3 color ) {\n\tvec3 weights = vec3( 0.2126, 0.7152, 0.0722 );\n\treturn dot( weights, color.rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}";
9709
+ var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\nstruct GeometricContext {\n\tvec3 position;\n\tvec3 normal;\n\tvec3 viewDir;\n#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal;\n#endif\n};\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}";
9879
9710
 
9880
- var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define r0 1.0\n\t#define v0 0.339\n\t#define m0 - 2.0\n\t#define r1 0.8\n\t#define v1 0.276\n\t#define m1 - 1.0\n\t#define r4 0.4\n\t#define v4 0.046\n\t#define m4 2.0\n\t#define r5 0.305\n\t#define v5 0.016\n\t#define m5 3.0\n\t#define r6 0.21\n\t#define v6 0.0038\n\t#define m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= r1 ) {\n\t\t\tmip = ( r0 - roughness ) * ( m1 - m0 ) / ( r0 - r1 ) + m0;\n\t\t} else if ( roughness >= r4 ) {\n\t\t\tmip = ( r1 - roughness ) * ( m4 - m1 ) / ( r1 - r4 ) + m1;\n\t\t} else if ( roughness >= r5 ) {\n\t\t\tmip = ( r4 - roughness ) * ( m5 - m4 ) / ( r4 - r5 ) + m4;\n\t\t} else if ( roughness >= r6 ) {\n\t\t\tmip = ( r5 - roughness ) * ( m6 - m5 ) / ( r5 - r6 ) + m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
9711
+ var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\tvec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
9881
9712
 
9882
9713
  var defaultnormal_vertex = "vec3 transformedNormal = objectNormal;\n#ifdef USE_INSTANCING\n\tmat3 m = mat3( instanceMatrix );\n\ttransformedNormal /= vec3( dot( m[ 0 ], m[ 0 ] ), dot( m[ 1 ], m[ 1 ] ), dot( m[ 2 ], m[ 2 ] ) );\n\ttransformedNormal = m * transformedNormal;\n#endif\ntransformedNormal = normalMatrix * transformedNormal;\n#ifdef FLIP_SIDED\n\ttransformedNormal = - transformedNormal;\n#endif\n#ifdef USE_TANGENT\n\tvec3 transformedTangent = ( modelViewMatrix * vec4( objectTangent, 0.0 ) ).xyz;\n\t#ifdef FLIP_SIDED\n\t\ttransformedTangent = - transformedTangent;\n\t#endif\n#endif";
9883
9714
 
@@ -9897,9 +9728,9 @@ var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 camera
9897
9728
 
9898
9729
  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";
9899
9730
 
9900
- 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";
9731
+ var envmap_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float reflectivity;\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\tvarying vec3 vWorldPosition;\n\t\tuniform float refractionRatio;\n\t#else\n\t\tvarying vec3 vReflect;\n\t#endif\n#endif";
9901
9732
 
9902
- var envmap_pars_vertex = "#ifdef USE_ENVMAP\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\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif";
9733
+ var envmap_pars_vertex = "#ifdef USE_ENVMAP\n\t#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )\n\t\t#define ENV_WORLDPOS\n\t#endif\n\t#ifdef ENV_WORLDPOS\n\t\t\n\t\tvarying vec3 vWorldPosition;\n\t#else\n\t\tvarying vec3 vReflect;\n\t\tuniform float refractionRatio;\n\t#endif\n#endif";
9903
9734
 
9904
9735
  var envmap_vertex = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvWorldPosition = worldPosition.xyz;\n\t#else\n\t\tvec3 cameraToVertex;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToVertex = normalize( worldPosition.xyz - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvReflect = reflect( cameraToVertex, worldNormal );\n\t\t#else\n\t\t\tvReflect = refract( cameraToVertex, worldNormal, refractionRatio );\n\t\t#endif\n\t#endif\n#endif";
9905
9736
 
@@ -9911,13 +9742,15 @@ var fog_fragment = "#ifdef USE_FOG\n\t#ifdef FOG_EXP2\n\t\tfloat fogFactor = 1.0
9911
9742
 
9912
9743
  var fog_pars_fragment = "#ifdef USE_FOG\n\tuniform vec3 fogColor;\n\tvarying float vFogDepth;\n\t#ifdef FOG_EXP2\n\t\tuniform float fogDensity;\n\t#else\n\t\tuniform float fogNear;\n\t\tuniform float fogFar;\n\t#endif\n#endif";
9913
9744
 
9914
- var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\treturn ( coord.x < 0.7 ) ? vec3( 0.7 ) : vec3( 1.0 );\n\t#endif\n}";
9745
+ var gradientmap_pars_fragment = "#ifdef USE_GRADIENTMAP\n\tuniform sampler2D gradientMap;\n#endif\nvec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {\n\tfloat dotNL = dot( normal, lightDirection );\n\tvec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );\n\t#ifdef USE_GRADIENTMAP\n\t\treturn vec3( texture2D( gradientMap, coord ).r );\n\t#else\n\t\tvec2 fw = fwidth( coord ) * 0.5;\n\t\treturn mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );\n\t#endif\n}";
9915
9746
 
9916
9747
  var lightmap_fragment = "#ifdef USE_LIGHTMAP\n\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\treflectedLight.indirectDiffuse += lightMapIrradiance;\n#endif";
9917
9748
 
9918
9749
  var lightmap_pars_fragment = "#ifdef USE_LIGHTMAP\n\tuniform sampler2D lightMap;\n\tuniform float lightMapIntensity;\n#endif";
9919
9750
 
9920
- var lights_lambert_vertex = "vec3 diffuse = vec3( 1.0 );\nGeometricContext geometry;\ngeometry.position = mvPosition.xyz;\ngeometry.normal = normalize( transformedNormal );\ngeometry.viewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( -mvPosition.xyz );\nGeometricContext backGeometry;\nbackGeometry.position = geometry.position;\nbackGeometry.normal = -geometry.normal;\nbackGeometry.viewDir = geometry.viewDir;\nvLightFront = vec3( 0.0 );\nvIndirectFront = vec3( 0.0 );\n#ifdef DOUBLE_SIDED\n\tvLightBack = vec3( 0.0 );\n\tvIndirectBack = vec3( 0.0 );\n#endif\nIncidentLight directLight;\nfloat dotNL;\nvec3 directLightColor_Diffuse;\nvIndirectFront += getAmbientLightIrradiance( ambientLightColor );\nvIndirectFront += getLightProbeIrradiance( lightProbe, geometry.normal );\n#ifdef DOUBLE_SIDED\n\tvIndirectBack += getAmbientLightIrradiance( ambientLightColor );\n\tvIndirectBack += getLightProbeIrradiance( lightProbe, backGeometry.normal );\n#endif\n#if NUM_POINT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tgetPointLightInfo( pointLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tgetSpotLightInfo( spotLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_DIR_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tgetDirectionalLightInfo( directionalLights[ i ], geometry, directLight );\n\t\tdotNL = dot( geometry.normal, directLight.direction );\n\t\tdirectLightColor_Diffuse = directLight.color;\n\t\tvLightFront += saturate( dotNL ) * directLightColor_Diffuse;\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvLightBack += saturate( - dotNL ) * directLightColor_Diffuse;\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\tvIndirectFront += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry.normal );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\tvIndirectBack += getHemisphereLightIrradiance( hemisphereLights[ i ], backGeometry.normal );\n\t\t#endif\n\t}\n\t#pragma unroll_loop_end\n#endif";
9751
+ var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
9752
+
9753
+ var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial 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}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert\n#define Material_LightProbeLOD( material )\t(0)";
9921
9754
 
9922
9755
  var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";
9923
9756
 
@@ -9931,11 +9764,11 @@ var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor
9931
9764
 
9932
9765
  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)";
9933
9766
 
9934
- 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 *= 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_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= 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";
9767
+ 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\tmaterial.ior = 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 *= 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( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, 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_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= 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";
9935
9768
 
9936
- var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in 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\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\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\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
9769
+ var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in 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\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometry.viewDir, geometry.normal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX_Iridescence( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness );\n\t#else\n\t\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness );\n\t#endif\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\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometry.normal, geometry.viewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
9937
9770
 
9938
- 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\n#ifdef USE_IRIDESCENCE\nfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\nif ( material.iridescenceThickness == 0.0 ) {\n\tmaterial.iridescence = 0.0;\n} else {\n\tmaterial.iridescence = saturate( material.iridescence );\n}\nif ( material.iridescence > 0.0 ) {\n\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n}\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";
9771
+ 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\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometry.viewDir ) );\n\tif ( material.iridescenceThickness == 0.0 ) {\n\t\tmaterial.iridescence = 0.0;\n\t} else {\n\t\tmaterial.iridescence = saturate( material.iridescence );\n\t}\n\tif ( material.iridescence > 0.0 ) {\n\t\tmaterial.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );\n\t\tmaterial.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );\n\t}\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\tvec4 spotColor;\n\tvec3 spotLightCoord;\n\tbool inSpotLightMap;\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 ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX\n\t\t#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS\n\t\t#else\n\t\t#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )\n\t\t#endif\n\t\t#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )\n\t\t\tspotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;\n\t\t\tinSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );\n\t\t\tspotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );\n\t\t\tdirectLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;\n\t\t#endif\n\t\t#undef SPOT_LIGHT_MAP_INDEX\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, vSpotLightCoord[ 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";
9939
9772
 
9940
9773
  var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\tvec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;\n\t\tirradiance += lightMapIrradiance;\n\t#endif\n\t#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )\n\t\tiblIrradiance += getIBLIrradiance( geometry.normal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
9941
9774
 
@@ -9979,7 +9812,7 @@ var normal_pars_vertex = "#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n\t#ifdef
9979
9812
 
9980
9813
  var normal_vertex = "#ifndef FLAT_SHADED\n\tvNormal = normalize( transformedNormal );\n\t#ifdef USE_TANGENT\n\t\tvTangent = normalize( transformedTangent );\n\t\tvBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );\n\t#endif\n#endif";
9981
9814
 
9982
- var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = vec3( dFdx( eye_pos.x ), dFdx( eye_pos.y ), dFdx( eye_pos.z ) );\n\t\tvec3 q1 = vec3( dFdy( eye_pos.x ), dFdy( eye_pos.y ), dFdy( eye_pos.z ) );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif";
9815
+ var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( TANGENTSPACE_NORMALMAP ) || defined ( USE_CLEARCOAT_NORMALMAP ) )\n\tvec3 perturbNormal2Arb( vec3 eye_pos, vec3 surf_norm, vec3 mapN, float faceDirection ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( vUv.st );\n\t\tvec2 st1 = dFdy( vUv.st );\n\t\tvec3 N = surf_norm;\n\t\tvec3 q1perp = cross( q1, N );\n\t\tvec3 q0perp = cross( N, q0 );\n\t\tvec3 T = q1perp * st0.x + q0perp * st1.x;\n\t\tvec3 B = q1perp * st0.y + q0perp * st1.y;\n\t\tfloat det = max( dot( T, T ), dot( B, B ) );\n\t\tfloat scale = ( det == 0.0 ) ? 0.0 : faceDirection * inversesqrt( det );\n\t\treturn normalize( T * ( mapN.x * scale ) + B * ( mapN.y * scale ) + N * mapN.z );\n\t}\n#endif";
9983
9816
 
9984
9817
  var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif";
9985
9818
 
@@ -9989,7 +9822,7 @@ var clearcoat_pars_fragment = "#ifdef USE_CLEARCOATMAP\n\tuniform sampler2D clea
9989
9822
 
9990
9823
  var iridescence_pars_fragment = "#ifdef USE_IRIDESCENCEMAP\n\tuniform sampler2D iridescenceMap;\n#endif\n#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\tuniform sampler2D iridescenceThicknessMap;\n#endif";
9991
9824
 
9992
- var output_fragment = "#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );";
9825
+ var output_fragment = "#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );";
9993
9826
 
9994
9827
  var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}";
9995
9828
 
@@ -10005,13 +9838,13 @@ var roughnessmap_fragment = "float roughnessFactor = roughness;\n#ifdef USE_ROUG
10005
9838
 
10006
9839
  var roughnessmap_pars_fragment = "#ifdef USE_ROUGHNESSMAP\n\tuniform sampler2D roughnessMap;\n#endif";
10007
9840
 
10008
- var shadowmap_pars_fragment = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), \n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif";
9841
+ var shadowmap_pars_fragment = "#if NUM_SPOT_LIGHT_COORDS > 0\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#if NUM_SPOT_LIGHT_MAPS > 0\n uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n\tfloat texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n\t\treturn step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n\t}\n\tvec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {\n\t\treturn unpackRGBATo2Half( texture2D( shadow, uv ) );\n\t}\n\tfloat VSMShadow (sampler2D shadow, vec2 uv, float compare ){\n\t\tfloat occlusion = 1.0;\n\t\tvec2 distribution = texture2DDistribution( shadow, uv );\n\t\tfloat hard_shadow = step( compare , distribution.x );\n\t\tif (hard_shadow != 1.0 ) {\n\t\t\tfloat distance = compare - distribution.x ;\n\t\t\tfloat variance = max( 0.00000, distribution.y * distribution.y );\n\t\t\tfloat softness_probability = variance / (variance + distance * distance );\t\t\tsoftness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );\t\t\tocclusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );\n\t\t}\n\t\treturn occlusion;\n\t}\n\tfloat getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord ) {\n\t\tfloat shadow = 1.0;\n\t\tshadowCoord.xyz /= shadowCoord.w;\n\t\tshadowCoord.z += shadowBias;\n\t\tbvec4 inFrustumVec = bvec4 ( shadowCoord.x >= 0.0, shadowCoord.x <= 1.0, shadowCoord.y >= 0.0, shadowCoord.y <= 1.0 );\n\t\tbool inFrustum = all( inFrustumVec );\n\t\tbvec2 frustumTestVec = bvec2( inFrustum, shadowCoord.z <= 1.0 );\n\t\tbool frustumTest = all( frustumTestVec );\n\t\tif ( frustumTest ) {\n\t\t#if defined( SHADOWMAP_TYPE_PCF )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx0 = - texelSize.x * shadowRadius;\n\t\t\tfloat dy0 = - texelSize.y * shadowRadius;\n\t\t\tfloat dx1 = + texelSize.x * shadowRadius;\n\t\t\tfloat dy1 = + texelSize.y * shadowRadius;\n\t\t\tfloat dx2 = dx0 / 2.0;\n\t\t\tfloat dy2 = dy0 / 2.0;\n\t\t\tfloat dx3 = dx1 / 2.0;\n\t\t\tfloat dy3 = dy1 / 2.0;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )\n\t\t\t) * ( 1.0 / 17.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_PCF_SOFT )\n\t\t\tvec2 texelSize = vec2( 1.0 ) / shadowMapSize;\n\t\t\tfloat dx = texelSize.x;\n\t\t\tfloat dy = texelSize.y;\n\t\t\tvec2 uv = shadowCoord.xy;\n\t\t\tvec2 f = fract( uv * shadowMapSize + 0.5 );\n\t\t\tuv -= f * texelSize;\n\t\t\tshadow = (\n\t\t\t\ttexture2DCompare( shadowMap, uv, shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +\n\t\t\t\ttexture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),\n\t\t\t\t\t f.x ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t f.y ) +\n\t\t\t\tmix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),\n\t\t\t\t\t\t f.x ),\n\t\t\t\t\t f.y )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#elif defined( SHADOWMAP_TYPE_VSM )\n\t\t\tshadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#else\n\t\t\tshadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );\n\t\t#endif\n\t\t}\n\t\treturn shadow;\n\t}\n\tvec2 cubeToUV( vec3 v, float texelSizeY ) {\n\t\tvec3 absV = abs( v );\n\t\tfloat scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );\n\t\tabsV *= scaleToCube;\n\t\tv *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );\n\t\tvec2 planar = v.xy;\n\t\tfloat almostATexel = 1.5 * texelSizeY;\n\t\tfloat almostOne = 1.0 - almostATexel;\n\t\tif ( absV.z >= almostOne ) {\n\t\t\tif ( v.z > 0.0 )\n\t\t\t\tplanar.x = 4.0 - v.x;\n\t\t} else if ( absV.x >= almostOne ) {\n\t\t\tfloat signX = sign( v.x );\n\t\t\tplanar.x = v.z * signX + 2.0 * signX;\n\t\t} else if ( absV.y >= almostOne ) {\n\t\t\tfloat signY = sign( v.y );\n\t\t\tplanar.x = v.x + 2.0 * signY + 2.0;\n\t\t\tplanar.y = v.z * signY - 2.0;\n\t\t}\n\t\treturn vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );\n\t}\n\tfloat getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {\n\t\tvec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );\n\t\tvec3 lightToPosition = shadowCoord.xyz;\n\t\tfloat dp = ( length( lightToPosition ) - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );\t\tdp += shadowBias;\n\t\tvec3 bd3D = normalize( lightToPosition );\n\t\t#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )\n\t\t\tvec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;\n\t\t\treturn (\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +\n\t\t\t\ttexture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )\n\t\t\t) * ( 1.0 / 9.0 );\n\t\t#else\n\t\t\treturn texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );\n\t\t#endif\n\t}\n#endif";
10009
9842
 
10010
- var shadowmap_pars_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 spotShadowMatrix[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vSpotShadowCoord[ NUM_SPOT_LIGHT_SHADOWS ];\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
9843
+ var shadowmap_pars_vertex = "#if NUM_SPOT_LIGHT_COORDS > 0\n uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];\n varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];\n#endif\n#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t\tuniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tvarying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];\n\t\tstruct DirectionalLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t\tstruct SpotLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t};\n\t\tuniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t\tuniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tvarying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];\n\t\tstruct PointLightShadow {\n\t\t\tfloat shadowBias;\n\t\t\tfloat shadowNormalBias;\n\t\t\tfloat shadowRadius;\n\t\t\tvec2 shadowMapSize;\n\t\t\tfloat shadowCameraNear;\n\t\t\tfloat shadowCameraFar;\n\t\t};\n\t\tuniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];\n\t#endif\n#endif";
10011
9844
 
10012
- var shadowmap_vertex = "#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvSpotShadowCoord[ i ] = spotShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif";
9845
+ var shadowmap_vertex = "#if defined( USE_SHADOWMAP ) || ( NUM_SPOT_LIGHT_COORDS > 0 )\n\t#if NUM_DIR_LIGHT_SHADOWS > 0 || NUM_SPOT_LIGHT_COORDS > 0 || NUM_POINT_LIGHT_SHADOWS > 0\n\t\tvec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );\n\t\tvec4 shadowWorldPosition;\n\t#endif\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_COORDS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition;\n\t\t#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )\n\t\t\tshadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;\n\t\t#endif\n\t\tvSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tshadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );\n\t\tvPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n#endif";
10013
9846
 
10014
- var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}";
9847
+ var shadowmask_pars_fragment = "float getShadowMask() {\n\tfloat shadow = 1.0;\n\t#ifdef USE_SHADOWMAP\n\t#if NUM_DIR_LIGHT_SHADOWS > 0\n\tDirectionalLightShadow directionalLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {\n\t\tdirectionalLight = directionalLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_SPOT_LIGHT_SHADOWS > 0\n\tSpotLightShadow spotLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {\n\t\tspotLight = spotLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#if NUM_POINT_LIGHT_SHADOWS > 0\n\tPointLightShadow pointLight;\n\t#pragma unroll_loop_start\n\tfor ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {\n\t\tpointLight = pointLightShadows[ i ];\n\t\tshadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t}\n\t#pragma unroll_loop_end\n\t#endif\n\t#endif\n\treturn shadow;\n}";
10015
9848
 
10016
9849
  var skinbase_vertex = "#ifdef USE_SKINNING\n\tmat4 boneMatX = getBoneMatrix( skinIndex.x );\n\tmat4 boneMatY = getBoneMatrix( skinIndex.y );\n\tmat4 boneMatZ = getBoneMatrix( skinIndex.z );\n\tmat4 boneMatW = getBoneMatrix( skinIndex.w );\n#endif";
10017
9850
 
@@ -10029,7 +9862,7 @@ var tonemapping_fragment = "#if defined( TONE_MAPPING )\n\tgl_FragColor.rgb = to
10029
9862
 
10030
9863
  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; }";
10031
9864
 
10032
- 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";
9865
+ var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= 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, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif";
10033
9866
 
10034
9867
  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( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in 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( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\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( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in 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( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in 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";
10035
9868
 
@@ -10045,7 +9878,7 @@ var uv2_pars_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tat
10045
9878
 
10046
9879
  var uv2_vertex = "#if defined( USE_LIGHTMAP ) || defined( USE_AOMAP )\n\tvUv2 = ( uv2Transform * vec3( uv2, 1 ) ).xy;\n#endif";
10047
9880
 
10048
- var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION )\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
9881
+ var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
10049
9882
 
10050
9883
  const vertex$g = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
10051
9884
  const fragment$g = "uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
@@ -10066,10 +9899,10 @@ const vertex$b = "uniform float scale;\nattribute float lineDistance;\nvarying f
10066
9899
  const fragment$b = "uniform vec3 diffuse;\nuniform float opacity;\nuniform float dashSize;\nuniform float totalSize;\nvarying float vLineDistance;\n#include <common>\n#include <color_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tif ( mod( vLineDistance, totalSize ) > dashSize ) {\n\t\tdiscard;\n\t}\n\tvec3 outgoingLight = vec3( 0.0 );\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <color_fragment>\n\toutgoingLight = diffuseColor.rgb;\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}";
10067
9900
 
10068
9901
  const vertex$a = "#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinbase_vertex>\n\t\t#include <skinnormal_vertex>\n\t\t#include <defaultnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <fog_vertex>\n}";
10069
- const fragment$a = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <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}";
9902
+ const fragment$a = "uniform vec3 diffuse;\nuniform float opacity;\n#ifndef FLAT_SHADED\n\tvarying vec3 vNormal;\n#endif\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vUv2 );\n\t\treflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;\n\t#else\n\t\treflectedLight.indirectDiffuse += vec3( 1.0 );\n\t#endif\n\t#include <aomap_fragment>\n\treflectedLight.indirectDiffuse *= diffuseColor.rgb;\n\tvec3 outgoingLight = reflectedLight.indirectDiffuse;\n\t#include <envmap_fragment>\n\t#include <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}";
10070
9903
 
10071
- const vertex$9 = "#define LAMBERT\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <envmap_pars_vertex>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <color_pars_vertex>\n#include <fog_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 <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <lights_lambert_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
10072
- const fragment$9 = "uniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nvarying vec3 vLightFront;\nvarying vec3 vIndirectFront;\n#ifdef DOUBLE_SIDED\n\tvarying vec3 vLightBack;\n\tvarying vec3 vIndirectBack;\n#endif\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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <fog_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <shadowmask_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <emissivemap_fragment>\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.indirectDiffuse += ( gl_FrontFacing ) ? vIndirectFront : vIndirectBack;\n\t#else\n\t\treflectedLight.indirectDiffuse += vIndirectFront;\n\t#endif\n\t#include <lightmap_fragment>\n\treflectedLight.indirectDiffuse *= BRDF_Lambert( diffuseColor.rgb );\n\t#ifdef DOUBLE_SIDED\n\t\treflectedLight.directDiffuse = ( gl_FrontFacing ) ? vLightFront : vLightBack;\n\t#else\n\t\treflectedLight.directDiffuse = vLightFront;\n\t#endif\n\treflectedLight.directDiffuse *= BRDF_Lambert( diffuseColor.rgb ) * getShadowMask();\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\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}";
9904
+ const vertex$9 = "#define LAMBERT\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
9905
+ const fragment$9 = "#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_lambert_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <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}";
10073
9906
 
10074
9907
  const vertex$8 = "#define MATCAP\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\t#include <fog_vertex>\n\tvViewPosition = - mvPosition.xyz;\n}";
10075
9908
  const fragment$8 = "#define MATCAP\nuniform vec3 diffuse;\nuniform float opacity;\nuniform sampler2D matcap;\nvarying vec3 vViewPosition;\n#include <common>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <fog_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tvec3 viewDir = normalize( vViewPosition );\n\tvec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );\n\tvec3 y = cross( viewDir, x );\n\tvec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;\n\t#ifdef USE_MATCAP\n\t\tvec4 matcapColor = texture2D( matcap, uv );\n\t#else\n\t\tvec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );\n\t#endif\n\tvec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;\n\t#include <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}";
@@ -10078,7 +9911,7 @@ const vertex$7 = "#define NORMAL\n#if defined( FLAT_SHADED ) || defined( USE_BUM
10078
9911
  const fragment$7 = "#define NORMAL\nuniform float opacity;\n#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( TANGENTSPACE_NORMALMAP )\n\tvarying vec3 vViewPosition;\n#endif\n#include <packing>\n#include <uv_pars_fragment>\n#include <normal_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\t#include <logdepthbuf_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\tgl_FragColor = vec4( packNormalToRGB( normal ), opacity );\n\t#ifdef OPAQUE\n\t\tgl_FragColor.a = 1.0;\n\t#endif\n}";
10079
9912
 
10080
9913
  const vertex$6 = "#define PHONG\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <uv2_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <uv2_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <envmap_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
10081
- const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <cube_uv_reflection_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <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}";
9914
+ const fragment$6 = "#define PHONG\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform vec3 specular;\nuniform float shininess;\nuniform float opacity;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <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 <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_phong_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <specularmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_phong_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;\n\t#include <envmap_fragment>\n\t#include <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}";
10082
9915
 
10083
9916
  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 <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
10084
9917
  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_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_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 <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\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}";
@@ -10137,7 +9970,8 @@ const ShaderChunk = {
10137
9970
  gradientmap_pars_fragment: gradientmap_pars_fragment,
10138
9971
  lightmap_fragment: lightmap_fragment,
10139
9972
  lightmap_pars_fragment: lightmap_pars_fragment,
10140
- lights_lambert_vertex: lights_lambert_vertex,
9973
+ lights_lambert_fragment: lights_lambert_fragment,
9974
+ lights_lambert_pars_fragment: lights_lambert_pars_fragment,
10141
9975
  lights_pars_begin: lights_pars_begin,
10142
9976
  lights_toon_fragment: lights_toon_fragment,
10143
9977
  lights_toon_pars_fragment: lights_toon_pars_fragment,
@@ -10242,7 +10076,7 @@ const ShaderChunk = {
10242
10076
  const UniformsLib = {
10243
10077
  common: {
10244
10078
  diffuse: {
10245
- value: new Color(0xffffff)
10079
+ value: /*@__PURE__*/new Color(0xffffff)
10246
10080
  },
10247
10081
  opacity: {
10248
10082
  value: 1.0
@@ -10251,10 +10085,10 @@ const UniformsLib = {
10251
10085
  value: null
10252
10086
  },
10253
10087
  uvTransform: {
10254
- value: new Matrix3()
10088
+ value: /*@__PURE__*/new Matrix3()
10255
10089
  },
10256
10090
  uv2Transform: {
10257
- value: new Matrix3()
10091
+ value: /*@__PURE__*/new Matrix3()
10258
10092
  },
10259
10093
  alphaMap: {
10260
10094
  value: null
@@ -10322,7 +10156,7 @@ const UniformsLib = {
10322
10156
  value: null
10323
10157
  },
10324
10158
  normalScale: {
10325
- value: new Vector2(1, 1)
10159
+ value: /*@__PURE__*/new Vector2(1, 1)
10326
10160
  }
10327
10161
  },
10328
10162
  displacementmap: {
@@ -10362,7 +10196,7 @@ const UniformsLib = {
10362
10196
  value: 2000
10363
10197
  },
10364
10198
  fogColor: {
10365
- value: new Color(0xffffff)
10199
+ value: /*@__PURE__*/new Color(0xffffff)
10366
10200
  }
10367
10201
  },
10368
10202
  lights: {
@@ -10415,10 +10249,13 @@ const UniformsLib = {
10415
10249
  shadowMapSize: {}
10416
10250
  }
10417
10251
  },
10252
+ spotLightMap: {
10253
+ value: []
10254
+ },
10418
10255
  spotShadowMap: {
10419
10256
  value: []
10420
10257
  },
10421
- spotShadowMatrix: {
10258
+ spotLightMatrix: {
10422
10259
  value: []
10423
10260
  },
10424
10261
  pointLights: {
@@ -10474,7 +10311,7 @@ const UniformsLib = {
10474
10311
  },
10475
10312
  points: {
10476
10313
  diffuse: {
10477
- value: new Color(0xffffff)
10314
+ value: /*@__PURE__*/new Color(0xffffff)
10478
10315
  },
10479
10316
  opacity: {
10480
10317
  value: 1.0
@@ -10495,18 +10332,18 @@ const UniformsLib = {
10495
10332
  value: 0
10496
10333
  },
10497
10334
  uvTransform: {
10498
- value: new Matrix3()
10335
+ value: /*@__PURE__*/new Matrix3()
10499
10336
  }
10500
10337
  },
10501
10338
  sprite: {
10502
10339
  diffuse: {
10503
- value: new Color(0xffffff)
10340
+ value: /*@__PURE__*/new Color(0xffffff)
10504
10341
  },
10505
10342
  opacity: {
10506
10343
  value: 1.0
10507
10344
  },
10508
10345
  center: {
10509
- value: new Vector2(0.5, 0.5)
10346
+ value: /*@__PURE__*/new Vector2(0.5, 0.5)
10510
10347
  },
10511
10348
  rotation: {
10512
10349
  value: 0.0
@@ -10521,33 +10358,33 @@ const UniformsLib = {
10521
10358
  value: 0
10522
10359
  },
10523
10360
  uvTransform: {
10524
- value: new Matrix3()
10361
+ value: /*@__PURE__*/new Matrix3()
10525
10362
  }
10526
10363
  }
10527
10364
  };
10528
10365
 
10529
10366
  const ShaderLib = {
10530
10367
  basic: {
10531
- uniforms: mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.fog]),
10368
+ uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.fog]),
10532
10369
  vertexShader: ShaderChunk.meshbasic_vert,
10533
10370
  fragmentShader: ShaderChunk.meshbasic_frag
10534
10371
  },
10535
10372
  lambert: {
10536
- uniforms: mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.fog, UniformsLib.lights, {
10373
+ uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, UniformsLib.lights, {
10537
10374
  emissive: {
10538
- value: new Color(0x000000)
10375
+ value: /*@__PURE__*/new Color(0x000000)
10539
10376
  }
10540
10377
  }]),
10541
10378
  vertexShader: ShaderChunk.meshlambert_vert,
10542
10379
  fragmentShader: ShaderChunk.meshlambert_frag
10543
10380
  },
10544
10381
  phong: {
10545
- uniforms: mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, UniformsLib.lights, {
10382
+ uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.specularmap, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, UniformsLib.lights, {
10546
10383
  emissive: {
10547
- value: new Color(0x000000)
10384
+ value: /*@__PURE__*/new Color(0x000000)
10548
10385
  },
10549
10386
  specular: {
10550
- value: new Color(0x111111)
10387
+ value: /*@__PURE__*/new Color(0x111111)
10551
10388
  },
10552
10389
  shininess: {
10553
10390
  value: 30
@@ -10557,9 +10394,9 @@ const ShaderLib = {
10557
10394
  fragmentShader: ShaderChunk.meshphong_frag
10558
10395
  },
10559
10396
  standard: {
10560
- uniforms: mergeUniforms([UniformsLib.common, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.roughnessmap, UniformsLib.metalnessmap, UniformsLib.fog, UniformsLib.lights, {
10397
+ uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.envmap, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.roughnessmap, UniformsLib.metalnessmap, UniformsLib.fog, UniformsLib.lights, {
10561
10398
  emissive: {
10562
- value: new Color(0x000000)
10399
+ value: /*@__PURE__*/new Color(0x000000)
10563
10400
  },
10564
10401
  roughness: {
10565
10402
  value: 1.0
@@ -10576,16 +10413,16 @@ const ShaderLib = {
10576
10413
  fragmentShader: ShaderChunk.meshphysical_frag
10577
10414
  },
10578
10415
  toon: {
10579
- uniforms: mergeUniforms([UniformsLib.common, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.gradientmap, UniformsLib.fog, UniformsLib.lights, {
10416
+ uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.aomap, UniformsLib.lightmap, UniformsLib.emissivemap, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.gradientmap, UniformsLib.fog, UniformsLib.lights, {
10580
10417
  emissive: {
10581
- value: new Color(0x000000)
10418
+ value: /*@__PURE__*/new Color(0x000000)
10582
10419
  }
10583
10420
  }]),
10584
10421
  vertexShader: ShaderChunk.meshtoon_vert,
10585
10422
  fragmentShader: ShaderChunk.meshtoon_frag
10586
10423
  },
10587
10424
  matcap: {
10588
- uniforms: mergeUniforms([UniformsLib.common, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, {
10425
+ uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, UniformsLib.fog, {
10589
10426
  matcap: {
10590
10427
  value: null
10591
10428
  }
@@ -10594,12 +10431,12 @@ const ShaderLib = {
10594
10431
  fragmentShader: ShaderChunk.meshmatcap_frag
10595
10432
  },
10596
10433
  points: {
10597
- uniforms: mergeUniforms([UniformsLib.points, UniformsLib.fog]),
10434
+ uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.points, UniformsLib.fog]),
10598
10435
  vertexShader: ShaderChunk.points_vert,
10599
10436
  fragmentShader: ShaderChunk.points_frag
10600
10437
  },
10601
10438
  dashed: {
10602
- uniforms: mergeUniforms([UniformsLib.common, UniformsLib.fog, {
10439
+ uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.fog, {
10603
10440
  scale: {
10604
10441
  value: 1
10605
10442
  },
@@ -10614,12 +10451,12 @@ const ShaderLib = {
10614
10451
  fragmentShader: ShaderChunk.linedashed_frag
10615
10452
  },
10616
10453
  depth: {
10617
- uniforms: mergeUniforms([UniformsLib.common, UniformsLib.displacementmap]),
10454
+ uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.displacementmap]),
10618
10455
  vertexShader: ShaderChunk.depth_vert,
10619
10456
  fragmentShader: ShaderChunk.depth_frag
10620
10457
  },
10621
10458
  normal: {
10622
- uniforms: mergeUniforms([UniformsLib.common, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, {
10459
+ uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.bumpmap, UniformsLib.normalmap, UniformsLib.displacementmap, {
10623
10460
  opacity: {
10624
10461
  value: 1.0
10625
10462
  }
@@ -10628,14 +10465,14 @@ const ShaderLib = {
10628
10465
  fragmentShader: ShaderChunk.meshnormal_frag
10629
10466
  },
10630
10467
  sprite: {
10631
- uniforms: mergeUniforms([UniformsLib.sprite, UniformsLib.fog]),
10468
+ uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.sprite, UniformsLib.fog]),
10632
10469
  vertexShader: ShaderChunk.sprite_vert,
10633
10470
  fragmentShader: ShaderChunk.sprite_frag
10634
10471
  },
10635
10472
  background: {
10636
10473
  uniforms: {
10637
10474
  uvTransform: {
10638
- value: new Matrix3()
10475
+ value: /*@__PURE__*/new Matrix3()
10639
10476
  },
10640
10477
  t2D: {
10641
10478
  value: null
@@ -10644,12 +10481,8 @@ const ShaderLib = {
10644
10481
  vertexShader: ShaderChunk.background_vert,
10645
10482
  fragmentShader: ShaderChunk.background_frag
10646
10483
  },
10647
-
10648
- /* -------------------------------------------------------------------------
10649
- // Cube map shader
10650
- ------------------------------------------------------------------------- */
10651
10484
  cube: {
10652
- uniforms: mergeUniforms([UniformsLib.envmap, {
10485
+ uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.envmap, {
10653
10486
  opacity: {
10654
10487
  value: 1.0
10655
10488
  }
@@ -10667,9 +10500,9 @@ const ShaderLib = {
10667
10500
  fragmentShader: ShaderChunk.equirect_frag
10668
10501
  },
10669
10502
  distanceRGBA: {
10670
- uniforms: mergeUniforms([UniformsLib.common, UniformsLib.displacementmap, {
10503
+ uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.common, UniformsLib.displacementmap, {
10671
10504
  referencePosition: {
10672
- value: new Vector3()
10505
+ value: /*@__PURE__*/new Vector3()
10673
10506
  },
10674
10507
  nearDistance: {
10675
10508
  value: 1
@@ -10682,9 +10515,9 @@ const ShaderLib = {
10682
10515
  fragmentShader: ShaderChunk.distanceRGBA_frag
10683
10516
  },
10684
10517
  shadow: {
10685
- uniforms: mergeUniforms([UniformsLib.lights, UniformsLib.fog, {
10518
+ uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.lights, UniformsLib.fog, {
10686
10519
  color: {
10687
- value: new Color(0x00000)
10520
+ value: /*@__PURE__*/new Color(0x00000)
10688
10521
  },
10689
10522
  opacity: {
10690
10523
  value: 1.0
@@ -10695,7 +10528,7 @@ const ShaderLib = {
10695
10528
  }
10696
10529
  };
10697
10530
  ShaderLib.physical = {
10698
- uniforms: mergeUniforms([ShaderLib.standard.uniforms, {
10531
+ uniforms: /*@__PURE__*/mergeUniforms([ShaderLib.standard.uniforms, {
10699
10532
  clearcoat: {
10700
10533
  value: 0
10701
10534
  },
@@ -10709,7 +10542,7 @@ ShaderLib.physical = {
10709
10542
  value: null
10710
10543
  },
10711
10544
  clearcoatNormalScale: {
10712
- value: new Vector2(1, 1)
10545
+ value: /*@__PURE__*/new Vector2(1, 1)
10713
10546
  },
10714
10547
  clearcoatNormalMap: {
10715
10548
  value: null
@@ -10736,7 +10569,7 @@ ShaderLib.physical = {
10736
10569
  value: 0
10737
10570
  },
10738
10571
  sheenColor: {
10739
- value: new Color(0x000000)
10572
+ value: /*@__PURE__*/new Color(0x000000)
10740
10573
  },
10741
10574
  sheenColorMap: {
10742
10575
  value: null
@@ -10754,7 +10587,7 @@ ShaderLib.physical = {
10754
10587
  value: null
10755
10588
  },
10756
10589
  transmissionSamplerSize: {
10757
- value: new Vector2()
10590
+ value: /*@__PURE__*/new Vector2()
10758
10591
  },
10759
10592
  transmissionSamplerMap: {
10760
10593
  value: null
@@ -10769,7 +10602,7 @@ ShaderLib.physical = {
10769
10602
  value: 0
10770
10603
  },
10771
10604
  attenuationColor: {
10772
- value: new Color(0x000000)
10605
+ value: /*@__PURE__*/new Color(0x000000)
10773
10606
  },
10774
10607
  specularIntensity: {
10775
10608
  value: 1
@@ -10778,7 +10611,7 @@ ShaderLib.physical = {
10778
10611
  value: null
10779
10612
  },
10780
10613
  specularColor: {
10781
- value: new Color(1, 1, 1)
10614
+ value: /*@__PURE__*/new Color(1, 1, 1)
10782
10615
  },
10783
10616
  specularColorMap: {
10784
10617
  value: null
@@ -10842,7 +10675,7 @@ function WebGLBackground(renderer, cubemaps, state, objects, alpha, premultiplie
10842
10675
 
10843
10676
  boxMesh.onBeforeRender = function (renderer, scene, camera) {
10844
10677
  this.matrixWorld.copyPosition(camera.matrixWorld);
10845
- }; // enable code injection for non-built-in material
10678
+ }; // add "envMap" material property so the renderer can evaluate it like for built-in materials
10846
10679
 
10847
10680
 
10848
10681
  Object.defineProperty(boxMesh.material, 'envMap', {
@@ -10878,7 +10711,7 @@ function WebGLBackground(renderer, cubemaps, state, objects, alpha, premultiplie
10878
10711
  depthWrite: false,
10879
10712
  fog: false
10880
10713
  }));
10881
- planeMesh.geometry.deleteAttribute('normal'); // enable code injection for non-built-in material
10714
+ planeMesh.geometry.deleteAttribute('normal'); // add "map" material property so the renderer can evaluate it like for built-in materials
10882
10715
 
10883
10716
  Object.defineProperty(planeMesh.material, 'map', {
10884
10717
  get: function () {
@@ -12858,13 +12691,6 @@ function absNumericalSort(a, b) {
12858
12691
  return Math.abs(b[1]) - Math.abs(a[1]);
12859
12692
  }
12860
12693
 
12861
- function denormalize(morph, attribute) {
12862
- let denominator = 1;
12863
- const array = attribute.isInterleavedBufferAttribute ? attribute.data.array : attribute.array;
12864
- if (array instanceof Int8Array) denominator = 127;else if (array instanceof Int16Array) denominator = 32767;else if (array instanceof Int32Array) denominator = 2147483647;else console.error('THREE.WebGLMorphtargets: Unsupported morph attribute data type: ', array);
12865
- morph.divideScalar(denominator);
12866
- }
12867
-
12868
12694
  function WebGLMorphtargets(gl, capabilities, textures) {
12869
12695
  const influencesList = {};
12870
12696
  const morphInfluences = new Float32Array(8);
@@ -12924,7 +12750,6 @@ function WebGLMorphtargets(gl, capabilities, textures) {
12924
12750
 
12925
12751
  if (hasMorphPosition === true) {
12926
12752
  morph.fromBufferAttribute(morphTarget, j);
12927
- if (morphTarget.normalized === true) denormalize(morph, morphTarget);
12928
12753
  buffer[offset + stride + 0] = morph.x;
12929
12754
  buffer[offset + stride + 1] = morph.y;
12930
12755
  buffer[offset + stride + 2] = morph.z;
@@ -12933,7 +12758,6 @@ function WebGLMorphtargets(gl, capabilities, textures) {
12933
12758
 
12934
12759
  if (hasMorphNormals === true) {
12935
12760
  morph.fromBufferAttribute(morphNormal, j);
12936
- if (morphNormal.normalized === true) denormalize(morph, morphNormal);
12937
12761
  buffer[offset + stride + 4] = morph.x;
12938
12762
  buffer[offset + stride + 5] = morph.y;
12939
12763
  buffer[offset + stride + 6] = morph.z;
@@ -12942,7 +12766,6 @@ function WebGLMorphtargets(gl, capabilities, textures) {
12942
12766
 
12943
12767
  if (hasMorphColors === true) {
12944
12768
  morph.fromBufferAttribute(morphColor, j);
12945
- if (morphColor.normalized === true) denormalize(morph, morphColor);
12946
12769
  buffer[offset + stride + 8] = morph.x;
12947
12770
  buffer[offset + stride + 9] = morph.y;
12948
12771
  buffer[offset + stride + 10] = morph.z;
@@ -13150,10 +12973,10 @@ function WebGLObjects(gl, geometries, attributes, info) {
13150
12973
  * like .set for an optional property of the object
13151
12974
  *
13152
12975
  */
13153
- const emptyTexture = new Texture();
13154
- const emptyArrayTexture = new DataArrayTexture();
13155
- const empty3dTexture = new Data3DTexture();
13156
- const emptyCubeTexture = new CubeTexture(); // --- Utilities ---
12976
+ const emptyTexture = /*@__PURE__*/new Texture();
12977
+ const emptyArrayTexture = /*@__PURE__*/new DataArrayTexture();
12978
+ const empty3dTexture = /*@__PURE__*/new Data3DTexture();
12979
+ const emptyCubeTexture = /*@__PURE__*/new CubeTexture(); // --- Utilities ---
13157
12980
  // Array Caches (provide typed arrays for temporary by size)
13158
12981
 
13159
12982
  const arrayCacheF32 = [];
@@ -14052,7 +13875,8 @@ function filterEmptyLine(string) {
14052
13875
  }
14053
13876
 
14054
13877
  function replaceLightNums(string, parameters) {
14055
- return string.replace(/NUM_DIR_LIGHTS/g, parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g, parameters.numSpotLights).replace(/NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g, parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows);
13878
+ const numSpotLightCoords = parameters.numSpotLightShadows + parameters.numSpotLightMaps - parameters.numSpotLightShadowsWithMaps;
13879
+ return string.replace(/NUM_DIR_LIGHTS/g, parameters.numDirLights).replace(/NUM_SPOT_LIGHTS/g, parameters.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g, parameters.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g, numSpotLightCoords).replace(/NUM_RECT_AREA_LIGHTS/g, parameters.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g, parameters.numPointLights).replace(/NUM_HEMI_LIGHTS/g, parameters.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g, parameters.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g, parameters.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g, parameters.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g, parameters.numPointLightShadows);
14056
13880
  }
14057
13881
 
14058
13882
  function replaceClippingPlaneNums(string, parameters) {
@@ -14077,16 +13901,10 @@ function includeReplacer(match, include) {
14077
13901
  } // Unroll Loops
14078
13902
 
14079
13903
 
14080
- const deprecatedUnrollLoopPattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;
14081
13904
  const unrollLoopPattern = /#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;
14082
13905
 
14083
13906
  function unrollLoops(string) {
14084
- return string.replace(unrollLoopPattern, loopReplacer).replace(deprecatedUnrollLoopPattern, deprecatedLoopReplacer);
14085
- }
14086
-
14087
- function deprecatedLoopReplacer(match, start, end, snippet) {
14088
- console.warn('WebGLProgram: #pragma unroll_loop shader syntax is deprecated. Please use #pragma unroll_loop_start syntax instead.');
14089
- return loopReplacer(match, start, end, snippet);
13907
+ return string.replace(unrollLoopPattern, loopReplacer);
14090
13908
  }
14091
13909
 
14092
13910
  function loopReplacer(match, start, end, snippet) {
@@ -14405,23 +14223,26 @@ class WebGLShaderCache {
14405
14223
 
14406
14224
  _getShaderCacheForMaterial(material) {
14407
14225
  const cache = this.materialCache;
14226
+ let set = cache.get(material);
14408
14227
 
14409
- if (cache.has(material) === false) {
14410
- cache.set(material, new Set());
14228
+ if (set === undefined) {
14229
+ set = new Set();
14230
+ cache.set(material, set);
14411
14231
  }
14412
14232
 
14413
- return cache.get(material);
14233
+ return set;
14414
14234
  }
14415
14235
 
14416
14236
  _getShaderStage(code) {
14417
14237
  const cache = this.shaderCache;
14238
+ let stage = cache.get(code);
14418
14239
 
14419
- if (cache.has(code) === false) {
14420
- const stage = new WebGLShaderStage(code);
14240
+ if (stage === undefined) {
14241
+ stage = new WebGLShaderStage(code);
14421
14242
  cache.set(code, stage);
14422
14243
  }
14423
14244
 
14424
- return cache.get(code);
14245
+ return stage;
14425
14246
  }
14426
14247
 
14427
14248
  }
@@ -14582,11 +14403,13 @@ function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities,
14582
14403
  numDirLights: lights.directional.length,
14583
14404
  numPointLights: lights.point.length,
14584
14405
  numSpotLights: lights.spot.length,
14406
+ numSpotLightMaps: lights.spotLightMap.length,
14585
14407
  numRectAreaLights: lights.rectArea.length,
14586
14408
  numHemiLights: lights.hemi.length,
14587
14409
  numDirLightShadows: lights.directionalShadowMap.length,
14588
14410
  numPointLightShadows: lights.pointShadowMap.length,
14589
14411
  numSpotLightShadows: lights.spotShadowMap.length,
14412
+ numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,
14590
14413
  numClippingPlanes: clipping.numPlanes,
14591
14414
  numClipIntersection: clipping.numIntersection,
14592
14415
  dithering: material.dithering,
@@ -14653,11 +14476,13 @@ function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities,
14653
14476
  array.push(parameters.numDirLights);
14654
14477
  array.push(parameters.numPointLights);
14655
14478
  array.push(parameters.numSpotLights);
14479
+ array.push(parameters.numSpotLightMaps);
14656
14480
  array.push(parameters.numHemiLights);
14657
14481
  array.push(parameters.numRectAreaLights);
14658
14482
  array.push(parameters.numDirLightShadows);
14659
14483
  array.push(parameters.numPointLightShadows);
14660
14484
  array.push(parameters.numSpotLightShadows);
14485
+ array.push(parameters.numSpotLightShadowsWithMaps);
14661
14486
  array.push(parameters.shadowMapType);
14662
14487
  array.push(parameters.toneMapping);
14663
14488
  array.push(parameters.numClippingPlanes);
@@ -14701,35 +14526,35 @@ function WebGLPrograms(renderer, cubemaps, cubeuvmaps, extensions, capabilities,
14701
14526
  if (parameters.vertexUvs) _programLayers.enable(30);
14702
14527
  if (parameters.vertexTangents) _programLayers.enable(31);
14703
14528
  if (parameters.uvsVertexOnly) _programLayers.enable(32);
14704
- if (parameters.fog) _programLayers.enable(33);
14705
14529
  array.push(_programLayers.mask);
14706
14530
 
14707
14531
  _programLayers.disableAll();
14708
14532
 
14709
- if (parameters.useFog) _programLayers.enable(0);
14710
- if (parameters.flatShading) _programLayers.enable(1);
14711
- if (parameters.logarithmicDepthBuffer) _programLayers.enable(2);
14712
- if (parameters.skinning) _programLayers.enable(3);
14713
- if (parameters.morphTargets) _programLayers.enable(4);
14714
- if (parameters.morphNormals) _programLayers.enable(5);
14715
- if (parameters.morphColors) _programLayers.enable(6);
14716
- if (parameters.premultipliedAlpha) _programLayers.enable(7);
14717
- if (parameters.shadowMapEnabled) _programLayers.enable(8);
14718
- if (parameters.physicallyCorrectLights) _programLayers.enable(9);
14719
- if (parameters.doubleSided) _programLayers.enable(10);
14720
- if (parameters.flipSided) _programLayers.enable(11);
14721
- if (parameters.useDepthPacking) _programLayers.enable(12);
14722
- if (parameters.dithering) _programLayers.enable(13);
14723
- if (parameters.specularIntensityMap) _programLayers.enable(14);
14724
- if (parameters.specularColorMap) _programLayers.enable(15);
14725
- if (parameters.transmission) _programLayers.enable(16);
14726
- if (parameters.transmissionMap) _programLayers.enable(17);
14727
- if (parameters.thicknessMap) _programLayers.enable(18);
14728
- if (parameters.sheen) _programLayers.enable(19);
14729
- if (parameters.sheenColorMap) _programLayers.enable(20);
14730
- if (parameters.sheenRoughnessMap) _programLayers.enable(21);
14731
- if (parameters.decodeVideoTexture) _programLayers.enable(22);
14732
- if (parameters.opaque) _programLayers.enable(23);
14533
+ if (parameters.fog) _programLayers.enable(0);
14534
+ if (parameters.useFog) _programLayers.enable(1);
14535
+ if (parameters.flatShading) _programLayers.enable(2);
14536
+ if (parameters.logarithmicDepthBuffer) _programLayers.enable(3);
14537
+ if (parameters.skinning) _programLayers.enable(4);
14538
+ if (parameters.morphTargets) _programLayers.enable(5);
14539
+ if (parameters.morphNormals) _programLayers.enable(6);
14540
+ if (parameters.morphColors) _programLayers.enable(7);
14541
+ if (parameters.premultipliedAlpha) _programLayers.enable(8);
14542
+ if (parameters.shadowMapEnabled) _programLayers.enable(9);
14543
+ if (parameters.physicallyCorrectLights) _programLayers.enable(10);
14544
+ if (parameters.doubleSided) _programLayers.enable(11);
14545
+ if (parameters.flipSided) _programLayers.enable(12);
14546
+ if (parameters.useDepthPacking) _programLayers.enable(13);
14547
+ if (parameters.dithering) _programLayers.enable(14);
14548
+ if (parameters.specularIntensityMap) _programLayers.enable(15);
14549
+ if (parameters.specularColorMap) _programLayers.enable(16);
14550
+ if (parameters.transmission) _programLayers.enable(17);
14551
+ if (parameters.transmissionMap) _programLayers.enable(18);
14552
+ if (parameters.thicknessMap) _programLayers.enable(19);
14553
+ if (parameters.sheen) _programLayers.enable(20);
14554
+ if (parameters.sheenColorMap) _programLayers.enable(21);
14555
+ if (parameters.sheenRoughnessMap) _programLayers.enable(22);
14556
+ if (parameters.decodeVideoTexture) _programLayers.enable(23);
14557
+ if (parameters.opaque) _programLayers.enable(24);
14733
14558
  array.push(_programLayers.mask);
14734
14559
  }
14735
14560
 
@@ -14963,17 +14788,18 @@ function WebGLRenderLists() {
14963
14788
  let lists = new WeakMap();
14964
14789
 
14965
14790
  function get(scene, renderCallDepth) {
14791
+ const listArray = lists.get(scene);
14966
14792
  let list;
14967
14793
 
14968
- if (lists.has(scene) === false) {
14794
+ if (listArray === undefined) {
14969
14795
  list = new WebGLRenderList();
14970
14796
  lists.set(scene, [list]);
14971
14797
  } else {
14972
- if (renderCallDepth >= lists.get(scene).length) {
14798
+ if (renderCallDepth >= listArray.length) {
14973
14799
  list = new WebGLRenderList();
14974
- lists.get(scene).push(list);
14800
+ listArray.push(list);
14975
14801
  } else {
14976
- list = lists.get(scene)[renderCallDepth];
14802
+ list = listArray[renderCallDepth];
14977
14803
  }
14978
14804
  }
14979
14805
 
@@ -15103,8 +14929,8 @@ function ShadowUniformsCache() {
15103
14929
 
15104
14930
  let nextVersion = 0;
15105
14931
 
15106
- function shadowCastingLightsFirst(lightA, lightB) {
15107
- return (lightB.castShadow ? 1 : 0) - (lightA.castShadow ? 1 : 0);
14932
+ function shadowCastingAndTexturingLightsFirst(lightA, lightB) {
14933
+ return (lightB.castShadow ? 2 : 0) - (lightA.castShadow ? 2 : 0) + (lightB.map ? 1 : 0) - (lightA.map ? 1 : 0);
15108
14934
  }
15109
14935
 
15110
14936
  function WebGLLights(extensions, capabilities) {
@@ -15120,7 +14946,8 @@ function WebGLLights(extensions, capabilities) {
15120
14946
  hemiLength: -1,
15121
14947
  numDirectionalShadows: -1,
15122
14948
  numPointShadows: -1,
15123
- numSpotShadows: -1
14949
+ numSpotShadows: -1,
14950
+ numSpotMaps: -1
15124
14951
  },
15125
14952
  ambient: [0, 0, 0],
15126
14953
  probe: [],
@@ -15129,9 +14956,10 @@ function WebGLLights(extensions, capabilities) {
15129
14956
  directionalShadowMap: [],
15130
14957
  directionalShadowMatrix: [],
15131
14958
  spot: [],
14959
+ spotLightMap: [],
15132
14960
  spotShadow: [],
15133
14961
  spotShadowMap: [],
15134
- spotShadowMatrix: [],
14962
+ spotLightMatrix: [],
15135
14963
  rectArea: [],
15136
14964
  rectAreaLTC1: null,
15137
14965
  rectAreaLTC2: null,
@@ -15139,7 +14967,8 @@ function WebGLLights(extensions, capabilities) {
15139
14967
  pointShadow: [],
15140
14968
  pointShadowMap: [],
15141
14969
  pointShadowMatrix: [],
15142
- hemi: []
14970
+ hemi: [],
14971
+ numSpotLightShadowsWithMaps: 0
15143
14972
  };
15144
14973
 
15145
14974
  for (let i = 0; i < 9; i++) state.probe.push(new Vector3());
@@ -15163,7 +14992,10 @@ function WebGLLights(extensions, capabilities) {
15163
14992
  let numDirectionalShadows = 0;
15164
14993
  let numPointShadows = 0;
15165
14994
  let numSpotShadows = 0;
15166
- lights.sort(shadowCastingLightsFirst); // artist-friendly light intensity scaling factor
14995
+ let numSpotMaps = 0;
14996
+ let numSpotShadowsWithMaps = 0; // ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]
14997
+
14998
+ lights.sort(shadowCastingAndTexturingLightsFirst); // artist-friendly light intensity scaling factor
15167
14999
 
15168
15000
  const scaleFactor = physicallyCorrectLights !== true ? Math.PI : 1;
15169
15001
 
@@ -15209,9 +15041,21 @@ function WebGLLights(extensions, capabilities) {
15209
15041
  uniforms.coneCos = Math.cos(light.angle);
15210
15042
  uniforms.penumbraCos = Math.cos(light.angle * (1 - light.penumbra));
15211
15043
  uniforms.decay = light.decay;
15044
+ state.spot[spotLength] = uniforms;
15045
+ const shadow = light.shadow;
15046
+
15047
+ if (light.map) {
15048
+ state.spotLightMap[numSpotMaps] = light.map;
15049
+ numSpotMaps++; // make sure the lightMatrix is up to date
15050
+ // TODO : do it if required only
15051
+
15052
+ shadow.updateMatrices(light);
15053
+ if (light.castShadow) numSpotShadowsWithMaps++;
15054
+ }
15055
+
15056
+ state.spotLightMatrix[spotLength] = shadow.matrix;
15212
15057
 
15213
15058
  if (light.castShadow) {
15214
- const shadow = light.shadow;
15215
15059
  const shadowUniforms = shadowCache.get(light);
15216
15060
  shadowUniforms.shadowBias = shadow.bias;
15217
15061
  shadowUniforms.shadowNormalBias = shadow.normalBias;
@@ -15219,11 +15063,9 @@ function WebGLLights(extensions, capabilities) {
15219
15063
  shadowUniforms.shadowMapSize = shadow.mapSize;
15220
15064
  state.spotShadow[spotLength] = shadowUniforms;
15221
15065
  state.spotShadowMap[spotLength] = shadowMap;
15222
- state.spotShadowMatrix[spotLength] = light.shadow.matrix;
15223
15066
  numSpotShadows++;
15224
15067
  }
15225
15068
 
15226
- state.spot[spotLength] = uniforms;
15227
15069
  spotLength++;
15228
15070
  } else if (light.isRectAreaLight) {
15229
15071
  const uniforms = cache.get(light); // (a) intensity is the total visible light emitted
@@ -15291,7 +15133,7 @@ function WebGLLights(extensions, capabilities) {
15291
15133
  state.ambient[2] = b;
15292
15134
  const hash = state.hash;
15293
15135
 
15294
- if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows) {
15136
+ if (hash.directionalLength !== directionalLength || hash.pointLength !== pointLength || hash.spotLength !== spotLength || hash.rectAreaLength !== rectAreaLength || hash.hemiLength !== hemiLength || hash.numDirectionalShadows !== numDirectionalShadows || hash.numPointShadows !== numPointShadows || hash.numSpotShadows !== numSpotShadows || hash.numSpotMaps !== numSpotMaps) {
15295
15137
  state.directional.length = directionalLength;
15296
15138
  state.spot.length = spotLength;
15297
15139
  state.rectArea.length = rectAreaLength;
@@ -15305,7 +15147,9 @@ function WebGLLights(extensions, capabilities) {
15305
15147
  state.spotShadowMap.length = numSpotShadows;
15306
15148
  state.directionalShadowMatrix.length = numDirectionalShadows;
15307
15149
  state.pointShadowMatrix.length = numPointShadows;
15308
- state.spotShadowMatrix.length = numSpotShadows;
15150
+ state.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;
15151
+ state.spotLightMap.length = numSpotMaps;
15152
+ state.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;
15309
15153
  hash.directionalLength = directionalLength;
15310
15154
  hash.pointLength = pointLength;
15311
15155
  hash.spotLength = spotLength;
@@ -15314,6 +15158,7 @@ function WebGLLights(extensions, capabilities) {
15314
15158
  hash.numDirectionalShadows = numDirectionalShadows;
15315
15159
  hash.numPointShadows = numPointShadows;
15316
15160
  hash.numSpotShadows = numSpotShadows;
15161
+ hash.numSpotMaps = numSpotMaps;
15317
15162
  state.version = nextVersion++;
15318
15163
  }
15319
15164
  }
@@ -15425,17 +15270,18 @@ function WebGLRenderStates(extensions, capabilities) {
15425
15270
  let renderStates = new WeakMap();
15426
15271
 
15427
15272
  function get(scene, renderCallDepth = 0) {
15273
+ const renderStateArray = renderStates.get(scene);
15428
15274
  let renderState;
15429
15275
 
15430
- if (renderStates.has(scene) === false) {
15276
+ if (renderStateArray === undefined) {
15431
15277
  renderState = new WebGLRenderState(extensions, capabilities);
15432
15278
  renderStates.set(scene, [renderState]);
15433
15279
  } else {
15434
- if (renderCallDepth >= renderStates.get(scene).length) {
15280
+ if (renderCallDepth >= renderStateArray.length) {
15435
15281
  renderState = new WebGLRenderState(extensions, capabilities);
15436
- renderStates.get(scene).push(renderState);
15282
+ renderStateArray.push(renderState);
15437
15283
  } else {
15438
- renderState = renderStates.get(scene)[renderCallDepth];
15284
+ renderState = renderStateArray[renderCallDepth];
15439
15285
  }
15440
15286
  }
15441
15287
 
@@ -15619,19 +15465,11 @@ function WebGLShadowMap(_renderer, _objects, _capabilities) {
15619
15465
  }
15620
15466
  }
15621
15467
 
15622
- if (shadow.map === null && !shadow.isPointLightShadow && this.type === VSMShadowMap) {
15623
- shadow.map = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y);
15624
- shadow.map.texture.name = light.name + '.shadowMap';
15625
- shadow.mapPass = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y);
15626
- shadow.camera.updateProjectionMatrix();
15627
- }
15628
-
15629
15468
  if (shadow.map === null) {
15630
- const pars = {
15469
+ const pars = this.type !== VSMShadowMap ? {
15631
15470
  minFilter: NearestFilter,
15632
- magFilter: NearestFilter,
15633
- format: RGBAFormat
15634
- };
15471
+ magFilter: NearestFilter
15472
+ } : {};
15635
15473
  shadow.map = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y, pars);
15636
15474
  shadow.map.texture.name = light.name + '.shadowMap';
15637
15475
  shadow.camera.updateProjectionMatrix();
@@ -15656,7 +15494,7 @@ function WebGLShadowMap(_renderer, _objects, _capabilities) {
15656
15494
  } // do blur pass for VSM
15657
15495
 
15658
15496
 
15659
- if (!shadow.isPointLightShadow && this.type === VSMShadowMap) {
15497
+ if (shadow.isPointLightShadow !== true && this.type === VSMShadowMap) {
15660
15498
  VSMPass(shadow, camera);
15661
15499
  }
15662
15500
 
@@ -15676,6 +15514,10 @@ function WebGLShadowMap(_renderer, _objects, _capabilities) {
15676
15514
  shadowMaterialHorizontal.defines.VSM_SAMPLES = shadow.blurSamples;
15677
15515
  shadowMaterialVertical.needsUpdate = true;
15678
15516
  shadowMaterialHorizontal.needsUpdate = true;
15517
+ }
15518
+
15519
+ if (shadow.mapPass === null) {
15520
+ shadow.mapPass = new WebGLRenderTarget(_shadowMapSize.x, _shadowMapSize.y);
15679
15521
  } // vertical pass
15680
15522
 
15681
15523
 
@@ -15711,7 +15553,7 @@ function WebGLShadowMap(_renderer, _objects, _capabilities) {
15711
15553
  result = light.isPointLight === true ? _distanceMaterial : _depthMaterial;
15712
15554
  }
15713
15555
 
15714
- if (_renderer.localClippingEnabled && material.clipShadows === true && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0) {
15556
+ if (_renderer.localClippingEnabled && material.clipShadows === true && Array.isArray(material.clippingPlanes) && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0) {
15715
15557
  // in this case we need a unique material instance reflecting the
15716
15558
  // appropriate state
15717
15559
  const keyA = result.uuid,
@@ -15995,6 +15837,8 @@ function WebGLState(gl, extensions, capabilities) {
15995
15837
  const colorBuffer = new ColorBuffer();
15996
15838
  const depthBuffer = new DepthBuffer();
15997
15839
  const stencilBuffer = new StencilBuffer();
15840
+ const uboBindings = new WeakMap();
15841
+ const uboProgamMap = new WeakMap();
15998
15842
  let enabledCapabilities = {};
15999
15843
  let currentBoundFramebuffers = {};
16000
15844
  let currentDrawbuffers = new WeakMap();
@@ -16493,6 +16337,33 @@ function WebGLState(gl, extensions, capabilities) {
16493
16337
  gl.viewport(viewport.x, viewport.y, viewport.z, viewport.w);
16494
16338
  currentViewport.copy(viewport);
16495
16339
  }
16340
+ }
16341
+
16342
+ function updateUBOMapping(uniformsGroup, program) {
16343
+ let mapping = uboProgamMap.get(program);
16344
+
16345
+ if (mapping === undefined) {
16346
+ mapping = new WeakMap();
16347
+ uboProgamMap.set(program, mapping);
16348
+ }
16349
+
16350
+ let blockIndex = mapping.get(uniformsGroup);
16351
+
16352
+ if (blockIndex === undefined) {
16353
+ blockIndex = gl.getUniformBlockIndex(program, uniformsGroup.name);
16354
+ mapping.set(uniformsGroup, blockIndex);
16355
+ }
16356
+ }
16357
+
16358
+ function uniformBlockBinding(uniformsGroup, program) {
16359
+ const mapping = uboProgamMap.get(program);
16360
+ const blockIndex = mapping.get(uniformsGroup);
16361
+
16362
+ if (uboBindings.get(uniformsGroup) !== blockIndex) {
16363
+ // bind shader specific block index to global block point
16364
+ gl.uniformBlockBinding(program, blockIndex, uniformsGroup.__bindingPointIndex);
16365
+ uboBindings.set(uniformsGroup, blockIndex);
16366
+ }
16496
16367
  } //
16497
16368
 
16498
16369
 
@@ -16585,6 +16456,8 @@ function WebGLState(gl, extensions, capabilities) {
16585
16456
  compressedTexImage2D: compressedTexImage2D,
16586
16457
  texImage2D: texImage2D,
16587
16458
  texImage3D: texImage3D,
16459
+ updateUBOMapping: updateUBOMapping,
16460
+ uniformBlockBinding: uniformBlockBinding,
16588
16461
  texStorage2D: texStorage2D,
16589
16462
  texStorage3D: texStorage3D,
16590
16463
  texSubImage2D: texSubImage2D,
@@ -17933,7 +17806,7 @@ function WebGLUtils(gl, extensions, capabilities) {
17933
17806
  if (p === LuminanceAlphaFormat) return gl.LUMINANCE_ALPHA;
17934
17807
  if (p === DepthFormat) return gl.DEPTH_COMPONENT;
17935
17808
  if (p === DepthStencilFormat) return gl.DEPTH_STENCIL;
17936
- if (p === RedFormat) return gl.RED;
17809
+ if (p === RedFormat) return gl.RED; // @deprecated since r137
17937
17810
 
17938
17811
  if (p === RGBFormat) {
17939
17812
  console.warn('THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228');
@@ -18133,7 +18006,7 @@ function setProjectionFromUnion(camera, cameraL, cameraR) {
18133
18006
  camera.translateX(xOffset);
18134
18007
  camera.translateZ(zOffset);
18135
18008
  camera.matrixWorld.compose(camera.position, camera.quaternion, camera.scale);
18136
- camera.matrixWorldInverse.getInverse(camera.matrixWorld); // Find the union of the frustum values of the cameras and scale
18009
+ camera.matrixWorldInverse.copy(camera.matrixWorld).invert(); // Find the union of the frustum values of the cameras and scale
18137
18010
  // the values so that the near plane's position does not change in world space,
18138
18011
  // although must now be relative to the new union camera.
18139
18012
 
@@ -18335,9 +18208,12 @@ function WebVRManager(renderer) {
18335
18208
 
18336
18209
  this.setPoseTarget = function (object) {
18337
18210
  if (object !== undefined) poseTarget = object;
18338
- };
18211
+ }; //
18339
18212
 
18340
- this.getCamera = function (camera) {
18213
+
18214
+ this.cameraAutoUpdate = true;
18215
+
18216
+ this.updateCamera = function (camera) {
18341
18217
  var userHeight = referenceSpaceType === 'local-floor' ? 1.6 : 0;
18342
18218
  device.depthNear = camera.near;
18343
18219
  device.depthFar = camera.far;
@@ -18386,7 +18262,7 @@ function WebVRManager(renderer) {
18386
18262
  cameraL.matrixWorldInverse.fromArray(frameData.leftViewMatrix);
18387
18263
  cameraR.matrixWorldInverse.fromArray(frameData.rightViewMatrix); // TODO (mrdoob) Double check this code
18388
18264
 
18389
- standingMatrixInverse.getInverse(standingMatrix);
18265
+ standingMatrixInverse.copy(standingMatrix).invert();
18390
18266
 
18391
18267
  if (referenceSpaceType === 'local-floor') {
18392
18268
  cameraL.matrixWorldInverse.multiply(standingMatrixInverse);
@@ -18396,14 +18272,14 @@ function WebVRManager(renderer) {
18396
18272
  var parent = poseObject.parent;
18397
18273
 
18398
18274
  if (parent !== null) {
18399
- matrixWorldInverse.getInverse(parent.matrixWorld);
18275
+ matrixWorldInverse.copy(parent.matrixWorld).invert();
18400
18276
  cameraL.matrixWorldInverse.multiply(matrixWorldInverse);
18401
18277
  cameraR.matrixWorldInverse.multiply(matrixWorldInverse);
18402
18278
  } // envMap and Mirror needs camera.matrixWorld
18403
18279
 
18404
18280
 
18405
- cameraL.matrixWorld.getInverse(cameraL.matrixWorldInverse);
18406
- cameraR.matrixWorld.getInverse(cameraR.matrixWorldInverse);
18281
+ cameraL.matrixWorld.copy(cameraL.matrixWorldInverse).invert();
18282
+ cameraR.matrixWorld.copy(cameraR.matrixWorldInverse).invert();
18407
18283
  cameraL.projectionMatrix.fromArray(frameData.leftProjectionMatrix);
18408
18284
  cameraR.projectionMatrix.fromArray(frameData.rightProjectionMatrix);
18409
18285
  setProjectionFromUnion(cameraVR, cameraL, cameraR); //
@@ -18420,6 +18296,22 @@ function WebVRManager(renderer) {
18420
18296
  return cameraVR;
18421
18297
  };
18422
18298
 
18299
+ this.getCamera = function () {
18300
+ return cameraVR;
18301
+ }; // Dummy getFoveation/setFoveation to have the same API as WebXR
18302
+
18303
+
18304
+ this.getFoveation = function () {
18305
+ return 1;
18306
+ };
18307
+
18308
+ this.setFoveation = function (foveation) {
18309
+ if (foveation !== 1) {
18310
+ console.warn('THREE.WebVRManager: setFoveation() not used in WebVR.');
18311
+ }
18312
+ }; //
18313
+
18314
+
18423
18315
  this.getStandingMatrix = function () {
18424
18316
  return standingMatrix;
18425
18317
  };
@@ -18447,13 +18339,14 @@ function WebVRManager(renderer) {
18447
18339
  this.setFrameOfReferenceType = function () {
18448
18340
  console.warn('THREE.WebVRManager: setFrameOfReferenceType() has been deprecated.');
18449
18341
  };
18450
-
18451
- this.addEventListener = function () {
18452
- /* Stub */
18453
- };
18454
18342
  }
18455
18343
 
18456
- Object.assign(WebVRManager.prototype, EventDispatcher.prototype);
18344
+ Object.assign(WebVRManager.prototype, {
18345
+ addEventListener: EventDispatcher.prototype.addEventListener,
18346
+ hasEventListener: EventDispatcher.prototype.hasEventListener,
18347
+ removeEventListener: EventDispatcher.prototype.removeEventListener,
18348
+ dispatchEvent: EventDispatcher.prototype.dispatchEvent
18349
+ });
18457
18350
 
18458
18351
  const _moveEvent = {
18459
18352
  type: 'move'
@@ -18554,31 +18447,6 @@ class WebXRController {
18554
18447
  const hand = this._hand;
18555
18448
 
18556
18449
  if (inputSource && frame.session.visibilityState !== 'visible-blurred') {
18557
- if (targetRay !== null) {
18558
- inputPose = frame.getPose(inputSource.targetRaySpace, referenceSpace);
18559
-
18560
- if (inputPose !== null) {
18561
- targetRay.matrix.fromArray(inputPose.transform.matrix);
18562
- targetRay.matrix.decompose(targetRay.position, targetRay.rotation, targetRay.scale);
18563
-
18564
- if (inputPose.linearVelocity) {
18565
- targetRay.hasLinearVelocity = true;
18566
- targetRay.linearVelocity.copy(inputPose.linearVelocity);
18567
- } else {
18568
- targetRay.hasLinearVelocity = false;
18569
- }
18570
-
18571
- if (inputPose.angularVelocity) {
18572
- targetRay.hasAngularVelocity = true;
18573
- targetRay.angularVelocity.copy(inputPose.angularVelocity);
18574
- } else {
18575
- targetRay.hasAngularVelocity = false;
18576
- }
18577
-
18578
- this.dispatchEvent(_moveEvent);
18579
- }
18580
- }
18581
-
18582
18450
  if (hand && inputSource.hand) {
18583
18451
  handPose = true;
18584
18452
 
@@ -18654,6 +18522,35 @@ class WebXRController {
18654
18522
  }
18655
18523
  }
18656
18524
  }
18525
+
18526
+ if (targetRay !== null) {
18527
+ inputPose = frame.getPose(inputSource.targetRaySpace, referenceSpace); // Some runtimes (namely Vive Cosmos with Vive OpenXR Runtime) have only grip space and ray space is equal to it
18528
+
18529
+ if (inputPose === null && gripPose !== null) {
18530
+ inputPose = gripPose;
18531
+ }
18532
+
18533
+ if (inputPose !== null) {
18534
+ targetRay.matrix.fromArray(inputPose.transform.matrix);
18535
+ targetRay.matrix.decompose(targetRay.position, targetRay.rotation, targetRay.scale);
18536
+
18537
+ if (inputPose.linearVelocity) {
18538
+ targetRay.hasLinearVelocity = true;
18539
+ targetRay.linearVelocity.copy(inputPose.linearVelocity);
18540
+ } else {
18541
+ targetRay.hasLinearVelocity = false;
18542
+ }
18543
+
18544
+ if (inputPose.angularVelocity) {
18545
+ targetRay.hasAngularVelocity = true;
18546
+ targetRay.angularVelocity.copy(inputPose.angularVelocity);
18547
+ } else {
18548
+ targetRay.hasAngularVelocity = false;
18549
+ }
18550
+
18551
+ this.dispatchEvent(_moveEvent);
18552
+ }
18553
+ }
18657
18554
  }
18658
18555
 
18659
18556
  if (targetRay !== null) {
@@ -18717,7 +18614,7 @@ class WebXRManager extends EventDispatcher {
18717
18614
  let initialRenderTarget = null;
18718
18615
  let newRenderTarget = null;
18719
18616
  const controllers = [];
18720
- const inputSourcesMap = new Map(); //
18617
+ const controllerInputSources = []; //
18721
18618
 
18722
18619
  const cameraL = new PerspectiveCamera();
18723
18620
  cameraL.layers.enable(1);
@@ -18776,7 +18673,13 @@ class WebXRManager extends EventDispatcher {
18776
18673
 
18777
18674
 
18778
18675
  function onSessionEvent(event) {
18779
- const controller = inputSourcesMap.get(event.inputSource);
18676
+ const controllerIndex = controllerInputSources.indexOf(event.inputSource);
18677
+
18678
+ if (controllerIndex === -1) {
18679
+ return;
18680
+ }
18681
+
18682
+ const controller = controllers[controllerIndex];
18780
18683
 
18781
18684
  if (controller !== undefined) {
18782
18685
  controller.dispatchEvent({
@@ -18795,12 +18698,14 @@ class WebXRManager extends EventDispatcher {
18795
18698
  session.removeEventListener('squeezeend', onSessionEvent);
18796
18699
  session.removeEventListener('end', onSessionEnd);
18797
18700
  session.removeEventListener('inputsourceschange', onInputSourcesChange);
18798
- inputSourcesMap.forEach(function (controller, inputSource) {
18799
- if (controller !== undefined) {
18800
- controller.disconnect(inputSource);
18801
- }
18802
- });
18803
- inputSourcesMap.clear();
18701
+
18702
+ for (let i = 0; i < controllers.length; i++) {
18703
+ const inputSource = controllerInputSources[i];
18704
+ if (inputSource === null) continue;
18705
+ controllerInputSources[i] = null;
18706
+ controllers[i].disconnect(inputSource);
18707
+ }
18708
+
18804
18709
  _currentDepthNear = null;
18805
18710
  _currentDepthFar = null; // restore framebuffer/rendering state
18806
18711
 
@@ -18891,7 +18796,8 @@ class WebXRManager extends EventDispatcher {
18891
18796
  newRenderTarget = new WebGLRenderTarget(glBaseLayer.framebufferWidth, glBaseLayer.framebufferHeight, {
18892
18797
  format: RGBAFormat,
18893
18798
  type: UnsignedByteType,
18894
- encoding: renderer.outputEncoding
18799
+ encoding: renderer.outputEncoding,
18800
+ stencilBuffer: attributes.stencil
18895
18801
  });
18896
18802
  } else {
18897
18803
  let depthFormat = null;
@@ -18905,7 +18811,7 @@ class WebXRManager extends EventDispatcher {
18905
18811
  }
18906
18812
 
18907
18813
  const projectionlayerInit = {
18908
- colorFormat: renderer.outputEncoding === sRGBEncoding ? gl.SRGB8_ALPHA8 : gl.RGBA8,
18814
+ colorFormat: gl.RGBA8,
18909
18815
  depthFormat: glDepthFormat,
18910
18816
  scaleFactor: framebufferScaleFactor
18911
18817
  };
@@ -18970,31 +18876,44 @@ class WebXRManager extends EventDispatcher {
18970
18876
  };
18971
18877
 
18972
18878
  function onInputSourcesChange(event) {
18973
- const inputSources = session.inputSources; // Assign controllers to available inputSources
18974
-
18975
- for (let i = 0; i < inputSources.length; i++) {
18976
- const index = inputSources[i].handedness === 'right' ? 1 : 0;
18977
- inputSourcesMap.set(inputSources[i], controllers[index]);
18978
- } // Notify disconnected
18979
-
18980
-
18879
+ // Notify disconnected
18981
18880
  for (let i = 0; i < event.removed.length; i++) {
18982
18881
  const inputSource = event.removed[i];
18983
- const controller = inputSourcesMap.get(inputSource);
18882
+ const index = controllerInputSources.indexOf(inputSource);
18984
18883
 
18985
- if (controller) {
18986
- controller.dispatchEvent({
18884
+ if (index >= 0) {
18885
+ controllerInputSources[index] = null;
18886
+ controllers[index].dispatchEvent({
18987
18887
  type: 'disconnected',
18988
18888
  data: inputSource
18989
18889
  });
18990
- inputSourcesMap.delete(inputSource);
18991
18890
  }
18992
18891
  } // Notify connected
18993
18892
 
18994
18893
 
18995
18894
  for (let i = 0; i < event.added.length; i++) {
18996
18895
  const inputSource = event.added[i];
18997
- const controller = inputSourcesMap.get(inputSource);
18896
+ let controllerIndex = controllerInputSources.indexOf(inputSource);
18897
+
18898
+ if (controllerIndex === -1) {
18899
+ // Assign input source a controller that currently has no input source
18900
+ for (let i = 0; i < controllers.length; i++) {
18901
+ if (i >= controllerInputSources.length) {
18902
+ controllerInputSources.push(inputSource);
18903
+ controllerIndex = i;
18904
+ break;
18905
+ } else if (controllerInputSources[i] === null) {
18906
+ controllerInputSources[i] = inputSource;
18907
+ controllerIndex = i;
18908
+ break;
18909
+ }
18910
+ } // If all controllers do currently receive input we ignore new ones
18911
+
18912
+
18913
+ if (controllerIndex === -1) break;
18914
+ }
18915
+
18916
+ const controller = controllers[controllerIndex];
18998
18917
 
18999
18918
  if (controller) {
19000
18919
  controller.dispatchEvent({
@@ -19202,13 +19121,11 @@ class WebXRManager extends EventDispatcher {
19202
19121
  } //
19203
19122
 
19204
19123
 
19205
- const inputSources = session.inputSources;
19206
-
19207
19124
  for (let i = 0; i < controllers.length; i++) {
19208
- const inputSource = inputSources[i];
19209
- const controller = inputSourcesMap.get(inputSource);
19125
+ const inputSource = controllerInputSources[i];
19126
+ const controller = controllers[i];
19210
19127
 
19211
- if (controller !== undefined) {
19128
+ if (inputSource !== null && controller !== undefined) {
19212
19129
  controller.update(inputSource, frame, customReferenceSpace || referenceSpace);
19213
19130
  }
19214
19131
  }
@@ -19678,6 +19595,249 @@ function WebGLMaterials(renderer, properties) {
19678
19595
  };
19679
19596
  }
19680
19597
 
19598
+ function WebGLUniformsGroups(gl, info, capabilities, state) {
19599
+ let buffers = {};
19600
+ let updateList = {};
19601
+ let allocatedBindingPoints = [];
19602
+ const maxBindingPoints = capabilities.isWebGL2 ? gl.getParameter(gl.MAX_UNIFORM_BUFFER_BINDINGS) : 0; // binding points are global whereas block indices are per shader program
19603
+
19604
+ function bind(uniformsGroup, program) {
19605
+ const webglProgram = program.program;
19606
+ state.uniformBlockBinding(uniformsGroup, webglProgram);
19607
+ }
19608
+
19609
+ function update(uniformsGroup, program) {
19610
+ let buffer = buffers[uniformsGroup.id];
19611
+
19612
+ if (buffer === undefined) {
19613
+ prepareUniformsGroup(uniformsGroup);
19614
+ buffer = createBuffer(uniformsGroup);
19615
+ buffers[uniformsGroup.id] = buffer;
19616
+ uniformsGroup.addEventListener('dispose', onUniformsGroupsDispose);
19617
+ } // ensure to update the binding points/block indices mapping for this program
19618
+
19619
+
19620
+ const webglProgram = program.program;
19621
+ state.updateUBOMapping(uniformsGroup, webglProgram); // update UBO once per frame
19622
+
19623
+ const frame = info.render.frame;
19624
+
19625
+ if (updateList[uniformsGroup.id] !== frame) {
19626
+ updateBufferData(uniformsGroup);
19627
+ updateList[uniformsGroup.id] = frame;
19628
+ }
19629
+ }
19630
+
19631
+ function createBuffer(uniformsGroup) {
19632
+ // the setup of an UBO is independent of a particular shader program but global
19633
+ const bindingPointIndex = allocateBindingPointIndex();
19634
+ uniformsGroup.__bindingPointIndex = bindingPointIndex;
19635
+ const buffer = gl.createBuffer();
19636
+ const size = uniformsGroup.__size;
19637
+ const usage = uniformsGroup.usage;
19638
+ gl.bindBuffer(gl.UNIFORM_BUFFER, buffer);
19639
+ gl.bufferData(gl.UNIFORM_BUFFER, size, usage);
19640
+ gl.bindBuffer(gl.UNIFORM_BUFFER, null);
19641
+ gl.bindBufferBase(gl.UNIFORM_BUFFER, bindingPointIndex, buffer);
19642
+ return buffer;
19643
+ }
19644
+
19645
+ function allocateBindingPointIndex() {
19646
+ for (let i = 0; i < maxBindingPoints; i++) {
19647
+ if (allocatedBindingPoints.indexOf(i) === -1) {
19648
+ allocatedBindingPoints.push(i);
19649
+ return i;
19650
+ }
19651
+ }
19652
+
19653
+ console.error('THREE.WebGLRenderer: Maximum number of simultaneously usable uniforms groups reached.');
19654
+ return 0;
19655
+ }
19656
+
19657
+ function updateBufferData(uniformsGroup) {
19658
+ const buffer = buffers[uniformsGroup.id];
19659
+ const uniforms = uniformsGroup.uniforms;
19660
+ const cache = uniformsGroup.__cache;
19661
+ gl.bindBuffer(gl.UNIFORM_BUFFER, buffer);
19662
+
19663
+ for (let i = 0, il = uniforms.length; i < il; i++) {
19664
+ const uniform = uniforms[i]; // partly update the buffer if necessary
19665
+
19666
+ if (hasUniformChanged(uniform, i, cache) === true) {
19667
+ const value = uniform.value;
19668
+ const offset = uniform.__offset;
19669
+
19670
+ if (typeof value === 'number') {
19671
+ uniform.__data[0] = value;
19672
+ gl.bufferSubData(gl.UNIFORM_BUFFER, offset, uniform.__data);
19673
+ } else {
19674
+ if (uniform.value.isMatrix3) {
19675
+ // manually converting 3x3 to 3x4
19676
+ uniform.__data[0] = uniform.value.elements[0];
19677
+ uniform.__data[1] = uniform.value.elements[1];
19678
+ uniform.__data[2] = uniform.value.elements[2];
19679
+ uniform.__data[3] = uniform.value.elements[0];
19680
+ uniform.__data[4] = uniform.value.elements[3];
19681
+ uniform.__data[5] = uniform.value.elements[4];
19682
+ uniform.__data[6] = uniform.value.elements[5];
19683
+ uniform.__data[7] = uniform.value.elements[0];
19684
+ uniform.__data[8] = uniform.value.elements[6];
19685
+ uniform.__data[9] = uniform.value.elements[7];
19686
+ uniform.__data[10] = uniform.value.elements[8];
19687
+ uniform.__data[11] = uniform.value.elements[0];
19688
+ } else {
19689
+ value.toArray(uniform.__data);
19690
+ }
19691
+
19692
+ gl.bufferSubData(gl.UNIFORM_BUFFER, offset, uniform.__data);
19693
+ }
19694
+ }
19695
+ }
19696
+
19697
+ gl.bindBuffer(gl.UNIFORM_BUFFER, null);
19698
+ }
19699
+
19700
+ function hasUniformChanged(uniform, index, cache) {
19701
+ const value = uniform.value;
19702
+
19703
+ if (cache[index] === undefined) {
19704
+ // cache entry does not exist so far
19705
+ if (typeof value === 'number') {
19706
+ cache[index] = value;
19707
+ } else {
19708
+ cache[index] = value.clone();
19709
+ }
19710
+
19711
+ return true;
19712
+ } else {
19713
+ // compare current value with cached entry
19714
+ if (typeof value === 'number') {
19715
+ if (cache[index] !== value) {
19716
+ cache[index] = value;
19717
+ return true;
19718
+ }
19719
+ } else {
19720
+ const cachedObject = cache[index];
19721
+
19722
+ if (cachedObject.equals(value) === false) {
19723
+ cachedObject.copy(value);
19724
+ return true;
19725
+ }
19726
+ }
19727
+ }
19728
+
19729
+ return false;
19730
+ }
19731
+
19732
+ function prepareUniformsGroup(uniformsGroup) {
19733
+ // determine total buffer size according to the STD140 layout
19734
+ // Hint: STD140 is the only supported layout in WebGL 2
19735
+ const uniforms = uniformsGroup.uniforms;
19736
+ let offset = 0; // global buffer offset in bytes
19737
+
19738
+ const chunkSize = 16; // size of a chunk in bytes
19739
+
19740
+ let chunkOffset = 0; // offset within a single chunk in bytes
19741
+
19742
+ for (let i = 0, l = uniforms.length; i < l; i++) {
19743
+ const uniform = uniforms[i];
19744
+ const info = getUniformSize(uniform); // the following two properties will be used for partial buffer updates
19745
+
19746
+ uniform.__data = new Float32Array(info.storage / Float32Array.BYTES_PER_ELEMENT);
19747
+ uniform.__offset = offset; //
19748
+
19749
+ if (i > 0) {
19750
+ chunkOffset = offset % chunkSize;
19751
+ const remainingSizeInChunk = chunkSize - chunkOffset; // check for chunk overflow
19752
+
19753
+ if (chunkOffset !== 0 && remainingSizeInChunk - info.boundary < 0) {
19754
+ // add padding and adjust offset
19755
+ offset += chunkSize - chunkOffset;
19756
+ uniform.__offset = offset;
19757
+ }
19758
+ }
19759
+
19760
+ offset += info.storage;
19761
+ } // ensure correct final padding
19762
+
19763
+
19764
+ chunkOffset = offset % chunkSize;
19765
+ if (chunkOffset > 0) offset += chunkSize - chunkOffset; //
19766
+
19767
+ uniformsGroup.__size = offset;
19768
+ uniformsGroup.__cache = {};
19769
+ return this;
19770
+ }
19771
+
19772
+ function getUniformSize(uniform) {
19773
+ const value = uniform.value;
19774
+ const info = {
19775
+ boundary: 0,
19776
+ // bytes
19777
+ storage: 0 // bytes
19778
+
19779
+ }; // determine sizes according to STD140
19780
+
19781
+ if (typeof value === 'number') {
19782
+ // float/int
19783
+ info.boundary = 4;
19784
+ info.storage = 4;
19785
+ } else if (value.isVector2) {
19786
+ // vec2
19787
+ info.boundary = 8;
19788
+ info.storage = 8;
19789
+ } else if (value.isVector3 || value.isColor) {
19790
+ // vec3
19791
+ info.boundary = 16;
19792
+ info.storage = 12; // evil: vec3 must start on a 16-byte boundary but it only consumes 12 bytes
19793
+ } else if (value.isVector4) {
19794
+ // vec4
19795
+ info.boundary = 16;
19796
+ info.storage = 16;
19797
+ } else if (value.isMatrix3) {
19798
+ // mat3 (in STD140 a 3x3 matrix is represented as 3x4)
19799
+ info.boundary = 48;
19800
+ info.storage = 48;
19801
+ } else if (value.isMatrix4) {
19802
+ // mat4
19803
+ info.boundary = 64;
19804
+ info.storage = 64;
19805
+ } else if (value.isTexture) {
19806
+ console.warn('THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.');
19807
+ } else {
19808
+ console.warn('THREE.WebGLRenderer: Unsupported uniform value type.', value);
19809
+ }
19810
+
19811
+ return info;
19812
+ }
19813
+
19814
+ function onUniformsGroupsDispose(event) {
19815
+ const uniformsGroup = event.target;
19816
+ uniformsGroup.removeEventListener('dispose', onUniformsGroupsDispose);
19817
+ const index = allocatedBindingPoints.indexOf(uniformsGroup.__bindingPointIndex);
19818
+ allocatedBindingPoints.splice(index, 1);
19819
+ gl.deleteBuffer(buffers[uniformsGroup.id]);
19820
+ delete buffers[uniformsGroup.id];
19821
+ delete updateList[uniformsGroup.id];
19822
+ }
19823
+
19824
+ function dispose() {
19825
+ for (const id in buffers) {
19826
+ gl.deleteBuffer(buffers[id]);
19827
+ }
19828
+
19829
+ allocatedBindingPoints = [];
19830
+ buffers = {};
19831
+ updateList = {};
19832
+ }
19833
+
19834
+ return {
19835
+ bind: bind,
19836
+ update: update,
19837
+ dispose: dispose
19838
+ };
19839
+ }
19840
+
19681
19841
  function createCanvasElement() {
19682
19842
  const canvas = createElementNS('canvas');
19683
19843
  canvas.style.display = 'block';
@@ -19880,7 +20040,7 @@ function WebGLRenderer(parameters = {}) {
19880
20040
  let properties, textures, cubemaps, cubeuvmaps, attributes, geometries, objects;
19881
20041
  let programCache, materials, renderLists, renderStates, clipping, shadowMap;
19882
20042
  let background, morphtargets, bufferRenderer, indexedBufferRenderer;
19883
- let utils, bindingStates;
20043
+ let utils, bindingStates, uniformsGroups;
19884
20044
 
19885
20045
  function initGLContext() {
19886
20046
  extensions = new WebGLExtensions(_gl);
@@ -19905,6 +20065,7 @@ function WebGLRenderer(parameters = {}) {
19905
20065
  renderStates = new WebGLRenderStates(extensions, capabilities);
19906
20066
  background = new WebGLBackground(_this, cubemaps, state, objects, _alpha, _premultipliedAlpha);
19907
20067
  shadowMap = new WebGLShadowMap(_this, objects, capabilities);
20068
+ uniformsGroups = new WebGLUniformsGroups(_gl, info, capabilities, state);
19908
20069
  bufferRenderer = new WebGLBufferRenderer(_gl, extensions, info, capabilities);
19909
20070
  indexedBufferRenderer = new WebGLIndexedBufferRenderer(_gl, extensions, info, capabilities);
19910
20071
  info.programs = programCache.programs;
@@ -20086,6 +20247,7 @@ function WebGLRenderer(parameters = {}) {
20086
20247
  cubeuvmaps.dispose();
20087
20248
  objects.dispose();
20088
20249
  bindingStates.dispose();
20250
+ uniformsGroups.dispose();
20089
20251
  programCache.dispose();
20090
20252
  xr.dispose();
20091
20253
  xr.removeEventListener('sessionstart', onXRSessionStart);
@@ -20239,6 +20401,20 @@ function WebGLRenderer(parameters = {}) {
20239
20401
 
20240
20402
 
20241
20403
  this.compile = function (scene, camera) {
20404
+ function prepare(material, scene, object) {
20405
+ if (material.transparent === true && material.side === DoubleSide) {
20406
+ material.side = BackSide;
20407
+ material.needsUpdate = true;
20408
+ getProgram(material, scene, object);
20409
+ material.side = FrontSide;
20410
+ material.needsUpdate = true;
20411
+ getProgram(material, scene, object);
20412
+ material.side = DoubleSide;
20413
+ } else {
20414
+ getProgram(material, scene, object);
20415
+ }
20416
+ }
20417
+
20242
20418
  currentRenderState = renderStates.get(scene);
20243
20419
  currentRenderState.init();
20244
20420
  renderStateStack.push(currentRenderState);
@@ -20259,10 +20435,10 @@ function WebGLRenderer(parameters = {}) {
20259
20435
  if (Array.isArray(material)) {
20260
20436
  for (let i = 0; i < material.length; i++) {
20261
20437
  const material2 = material[i];
20262
- getProgram(material2, scene, object);
20438
+ prepare(material2, scene, object);
20263
20439
  }
20264
20440
  } else {
20265
- getProgram(material, scene, object);
20441
+ prepare(material, scene, object);
20266
20442
  }
20267
20443
  }
20268
20444
  });
@@ -20306,9 +20482,9 @@ function WebGLRenderer(parameters = {}) {
20306
20482
 
20307
20483
  if (_isContextLost === true) return; // update scene graph
20308
20484
 
20309
- if (scene.autoUpdate === true) scene.updateMatrixWorld(); // update camera matrices and frustum
20485
+ if (scene.matrixWorldAutoUpdate === true) scene.updateMatrixWorld(); // update camera matrices and frustum
20310
20486
 
20311
- if (camera.parent === null) camera.updateMatrixWorld();
20487
+ if (camera.parent === null && camera.matrixWorldAutoUpdate === true) camera.updateMatrixWorld();
20312
20488
 
20313
20489
  if (xr.enabled === true && xr.isPresenting === true) {
20314
20490
  if (xr.cameraAutoUpdate === true) xr.updateCamera(camera);
@@ -20630,7 +20806,8 @@ function WebGLRenderer(parameters = {}) {
20630
20806
  uniforms.directionalShadowMap.value = lights.state.directionalShadowMap;
20631
20807
  uniforms.directionalShadowMatrix.value = lights.state.directionalShadowMatrix;
20632
20808
  uniforms.spotShadowMap.value = lights.state.spotShadowMap;
20633
- uniforms.spotShadowMatrix.value = lights.state.spotShadowMatrix;
20809
+ uniforms.spotLightMatrix.value = lights.state.spotLightMatrix;
20810
+ uniforms.spotLightMap.value = lights.state.spotLightMap;
20634
20811
  uniforms.pointShadowMap.value = lights.state.pointShadowMap;
20635
20812
  uniforms.pointShadowMatrix.value = lights.state.pointShadowMatrix; // TODO (abelnation): add area lights shadow info to uniforms
20636
20813
  }
@@ -20817,6 +20994,12 @@ function WebGLRenderer(parameters = {}) {
20817
20994
  if (refreshMaterial || materialProperties.receiveShadow !== object.receiveShadow) {
20818
20995
  materialProperties.receiveShadow = object.receiveShadow;
20819
20996
  p_uniforms.setValue(_gl, 'receiveShadow', object.receiveShadow);
20997
+ } // https://github.com/mrdoob/three.js/pull/24467#issuecomment-1209031512
20998
+
20999
+
21000
+ if (material.isMeshGouraudMaterial && material.envMap !== null) {
21001
+ m_uniforms.envMap.value = envMap;
21002
+ m_uniforms.flipEnvMap.value = envMap.isCubeTexture && envMap.isRenderTargetTexture === false ? -1 : 1;
20820
21003
  }
20821
21004
 
20822
21005
  if (refreshMaterial) {
@@ -20854,7 +21037,22 @@ function WebGLRenderer(parameters = {}) {
20854
21037
 
20855
21038
  p_uniforms.setValue(_gl, 'modelViewMatrix', object.modelViewMatrix);
20856
21039
  p_uniforms.setValue(_gl, 'normalMatrix', object.normalMatrix);
20857
- p_uniforms.setValue(_gl, 'modelMatrix', object.matrixWorld);
21040
+ p_uniforms.setValue(_gl, 'modelMatrix', object.matrixWorld); // UBOs
21041
+
21042
+ if (material.isShaderMaterial || material.isRawShaderMaterial) {
21043
+ const groups = material.uniformsGroups;
21044
+
21045
+ for (let i = 0, l = groups.length; i < l; i++) {
21046
+ if (capabilities.isWebGL2) {
21047
+ const group = groups[i];
21048
+ uniformsGroups.update(group, program);
21049
+ uniformsGroups.bind(group, program);
21050
+ } else {
21051
+ console.warn('THREE.WebGLRenderer: Uniform Buffer Objects can only be used with WebGL 2.');
21052
+ }
21053
+ }
21054
+ }
21055
+
20858
21056
  return program;
20859
21057
  } // If uniforms are marked as clean, they don't need to be loaded to the GPU.
20860
21058
 
@@ -21177,7 +21375,16 @@ function WebGLRenderer(parameters = {}) {
21177
21375
  };
21178
21376
 
21179
21377
  this.initTexture = function (texture) {
21180
- textures.setTexture2D(texture, 0);
21378
+ if (texture.isCubeTexture) {
21379
+ textures.setTextureCube(texture, 0);
21380
+ } else if (texture.isData3DTexture) {
21381
+ textures.setTexture3D(texture, 0);
21382
+ } else if (texture.isDataArrayTexture) {
21383
+ textures.setTexture2DArray(texture, 0);
21384
+ } else {
21385
+ textures.setTexture2D(texture, 0);
21386
+ }
21387
+
21181
21388
  state.unbindTexture();
21182
21389
  };
21183
21390
 
@@ -21255,7 +21462,6 @@ class Scene extends Object3D {
21255
21462
  this.environment = null;
21256
21463
  this.fog = null;
21257
21464
  this.overrideMaterial = null;
21258
- this.autoUpdate = true; // checked by the renderer
21259
21465
 
21260
21466
  if (typeof __THREE_DEVTOOLS__ !== 'undefined') {
21261
21467
  __THREE_DEVTOOLS__.dispatchEvent(new CustomEvent('observe', {
@@ -21270,7 +21476,6 @@ class Scene extends Object3D {
21270
21476
  if (source.environment !== null) this.environment = source.environment.clone();
21271
21477
  if (source.fog !== null) this.fog = source.fog.clone();
21272
21478
  if (source.overrideMaterial !== null) this.overrideMaterial = source.overrideMaterial.clone();
21273
- this.autoUpdate = source.autoUpdate;
21274
21479
  this.matrixAutoUpdate = source.matrixAutoUpdate;
21275
21480
  return this;
21276
21481
  }
@@ -21279,6 +21484,17 @@ class Scene extends Object3D {
21279
21484
  const data = super.toJSON(meta);
21280
21485
  if (this.fog !== null) data.object.fog = this.fog.toJSON();
21281
21486
  return data;
21487
+ } // @deprecated
21488
+
21489
+
21490
+ get autoUpdate() {
21491
+ console.warn('THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144.');
21492
+ return this.matrixWorldAutoUpdate;
21493
+ }
21494
+
21495
+ set autoUpdate(value) {
21496
+ console.warn('THREE.Scene: autoUpdate was renamed to matrixWorldAutoUpdate in r144.');
21497
+ this.matrixWorldAutoUpdate = value;
21282
21498
  }
21283
21499
 
21284
21500
  }
@@ -21368,7 +21584,7 @@ class InterleavedBuffer {
21368
21584
  }
21369
21585
 
21370
21586
  if (data.arrayBuffers[this.array.buffer._uuid] === undefined) {
21371
- data.arrayBuffers[this.array.buffer._uuid] = Array.prototype.slice.call(new Uint32Array(this.array.buffer));
21587
+ data.arrayBuffers[this.array.buffer._uuid] = Array.from(new Uint32Array(this.array.buffer));
21372
21588
  } //
21373
21589
 
21374
21590
 
@@ -21443,43 +21659,61 @@ class InterleavedBufferAttribute {
21443
21659
  }
21444
21660
 
21445
21661
  setX(index, x) {
21662
+ if (this.normalized) x = normalize(x, this.array);
21446
21663
  this.data.array[index * this.data.stride + this.offset] = x;
21447
21664
  return this;
21448
21665
  }
21449
21666
 
21450
21667
  setY(index, y) {
21668
+ if (this.normalized) y = normalize(y, this.array);
21451
21669
  this.data.array[index * this.data.stride + this.offset + 1] = y;
21452
21670
  return this;
21453
21671
  }
21454
21672
 
21455
21673
  setZ(index, z) {
21674
+ if (this.normalized) z = normalize(z, this.array);
21456
21675
  this.data.array[index * this.data.stride + this.offset + 2] = z;
21457
21676
  return this;
21458
21677
  }
21459
21678
 
21460
21679
  setW(index, w) {
21680
+ if (this.normalized) w = normalize(w, this.array);
21461
21681
  this.data.array[index * this.data.stride + this.offset + 3] = w;
21462
21682
  return this;
21463
21683
  }
21464
21684
 
21465
21685
  getX(index) {
21466
- return this.data.array[index * this.data.stride + this.offset];
21686
+ let x = this.data.array[index * this.data.stride + this.offset];
21687
+ if (this.normalized) x = denormalize(x, this.array);
21688
+ return x;
21467
21689
  }
21468
21690
 
21469
21691
  getY(index) {
21470
- return this.data.array[index * this.data.stride + this.offset + 1];
21692
+ let y = this.data.array[index * this.data.stride + this.offset + 1];
21693
+ if (this.normalized) y = denormalize(y, this.array);
21694
+ return y;
21471
21695
  }
21472
21696
 
21473
21697
  getZ(index) {
21474
- return this.data.array[index * this.data.stride + this.offset + 2];
21698
+ let z = this.data.array[index * this.data.stride + this.offset + 2];
21699
+ if (this.normalized) z = denormalize(z, this.array);
21700
+ return z;
21475
21701
  }
21476
21702
 
21477
21703
  getW(index) {
21478
- return this.data.array[index * this.data.stride + this.offset + 3];
21704
+ let w = this.data.array[index * this.data.stride + this.offset + 3];
21705
+ if (this.normalized) w = denormalize(w, this.array);
21706
+ return w;
21479
21707
  }
21480
21708
 
21481
21709
  setXY(index, x, y) {
21482
21710
  index = index * this.data.stride + this.offset;
21711
+
21712
+ if (this.normalized) {
21713
+ x = normalize(x, this.array);
21714
+ y = normalize(y, this.array);
21715
+ }
21716
+
21483
21717
  this.data.array[index + 0] = x;
21484
21718
  this.data.array[index + 1] = y;
21485
21719
  return this;
@@ -21487,6 +21721,13 @@ class InterleavedBufferAttribute {
21487
21721
 
21488
21722
  setXYZ(index, x, y, z) {
21489
21723
  index = index * this.data.stride + this.offset;
21724
+
21725
+ if (this.normalized) {
21726
+ x = normalize(x, this.array);
21727
+ y = normalize(y, this.array);
21728
+ z = normalize(z, this.array);
21729
+ }
21730
+
21490
21731
  this.data.array[index + 0] = x;
21491
21732
  this.data.array[index + 1] = y;
21492
21733
  this.data.array[index + 2] = z;
@@ -21495,6 +21736,14 @@ class InterleavedBufferAttribute {
21495
21736
 
21496
21737
  setXYZW(index, x, y, z, w) {
21497
21738
  index = index * this.data.stride + this.offset;
21739
+
21740
+ if (this.normalized) {
21741
+ x = normalize(x, this.array);
21742
+ y = normalize(y, this.array);
21743
+ z = normalize(z, this.array);
21744
+ w = normalize(w, this.array);
21745
+ }
21746
+
21498
21747
  this.data.array[index + 0] = x;
21499
21748
  this.data.array[index + 1] = y;
21500
21749
  this.data.array[index + 2] = z;
@@ -21504,7 +21753,7 @@ class InterleavedBufferAttribute {
21504
21753
 
21505
21754
  clone(data) {
21506
21755
  if (data === undefined) {
21507
- console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interlaved buffer attribute will deinterleave buffer data.');
21756
+ console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.');
21508
21757
  const array = [];
21509
21758
 
21510
21759
  for (let i = 0; i < this.count; i++) {
@@ -21531,7 +21780,7 @@ class InterleavedBufferAttribute {
21531
21780
 
21532
21781
  toJSON(data) {
21533
21782
  if (data === undefined) {
21534
- console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interlaved buffer attribute will deinterleave buffer data.');
21783
+ console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.');
21535
21784
  const array = [];
21536
21785
 
21537
21786
  for (let i = 0; i < this.count; i++) {
@@ -21550,7 +21799,7 @@ class InterleavedBufferAttribute {
21550
21799
  normalized: this.normalized
21551
21800
  };
21552
21801
  } else {
21553
- // save as true interlaved attribtue
21802
+ // save as true interleaved attribtue
21554
21803
  if (data.interleavedBuffers === undefined) {
21555
21804
  data.interleavedBuffers = {};
21556
21805
  }
@@ -22194,12 +22443,6 @@ class Skeleton {
22194
22443
 
22195
22444
  class InstancedBufferAttribute extends BufferAttribute {
22196
22445
  constructor(array, itemSize, normalized, meshPerAttribute = 1) {
22197
- if (typeof normalized === 'number') {
22198
- meshPerAttribute = normalized;
22199
- normalized = false;
22200
- console.error('THREE.InstancedBufferAttribute: The constructor now expects normalized as the third argument.');
22201
- }
22202
-
22203
22446
  super(array, itemSize, normalized);
22204
22447
  this.isInstancedBufferAttribute = true;
22205
22448
  this.meshPerAttribute = meshPerAttribute;
@@ -23219,10 +23462,10 @@ function CubicPoly() {
23219
23462
  } //
23220
23463
 
23221
23464
 
23222
- const tmp = new Vector3();
23223
- const px = new CubicPoly(),
23224
- py = new CubicPoly(),
23225
- pz = new CubicPoly();
23465
+ const tmp = /*@__PURE__*/new Vector3();
23466
+ const px = /*@__PURE__*/new CubicPoly();
23467
+ const py = /*@__PURE__*/new CubicPoly();
23468
+ const pz = /*@__PURE__*/new CubicPoly();
23226
23469
 
23227
23470
  class CatmullRomCurve3 extends Curve {
23228
23471
  constructor(points = [], closed = false, curveType = 'centripetal', tension = 0.5) {
@@ -24051,7 +24294,7 @@ class Path extends CurvePath {
24051
24294
  }
24052
24295
 
24053
24296
  class LatheGeometry extends BufferGeometry {
24054
- constructor(points = [new Vector2(0, 0.5), new Vector2(0.5, 0), new Vector2(0, -0.5)], segments = 12, phiStart = 0, phiLength = Math.PI * 2) {
24297
+ constructor(points = [new Vector2(0, -0.5), new Vector2(0.5, 0), new Vector2(0, 0.5)], segments = 12, phiStart = 0, phiLength = Math.PI * 2) {
24055
24298
  super();
24056
24299
  this.type = 'LatheGeometry';
24057
24300
  this.parameters = {
@@ -24655,13 +24898,13 @@ class DodecahedronGeometry extends PolyhedronGeometry {
24655
24898
 
24656
24899
  }
24657
24900
 
24658
- const _v0 = new Vector3();
24901
+ const _v0 = /*@__PURE__*/new Vector3();
24659
24902
 
24660
- const _v1$1 = new Vector3();
24903
+ const _v1$1 = /*@__PURE__*/new Vector3();
24661
24904
 
24662
- const _normal = new Vector3();
24905
+ const _normal = /*@__PURE__*/new Vector3();
24663
24906
 
24664
- const _triangle = new Triangle();
24907
+ const _triangle = /*@__PURE__*/new Triangle();
24665
24908
 
24666
24909
  class EdgesGeometry extends BufferGeometry {
24667
24910
  constructor(geometry = null, thresholdAngle = 1) {
@@ -25535,20 +25778,14 @@ class ExtrudeGeometry extends BufferGeometry {
25535
25778
 
25536
25779
  const curveSegments = options.curveSegments !== undefined ? options.curveSegments : 12;
25537
25780
  const steps = options.steps !== undefined ? options.steps : 1;
25538
- let depth = options.depth !== undefined ? options.depth : 1;
25781
+ const depth = options.depth !== undefined ? options.depth : 1;
25539
25782
  let bevelEnabled = options.bevelEnabled !== undefined ? options.bevelEnabled : true;
25540
25783
  let bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 0.2;
25541
25784
  let bevelSize = options.bevelSize !== undefined ? options.bevelSize : bevelThickness - 0.1;
25542
25785
  let bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;
25543
25786
  let bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;
25544
25787
  const extrudePath = options.extrudePath;
25545
- const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator; // deprecated options
25546
-
25547
- if (options.amount !== undefined) {
25548
- console.warn('THREE.ExtrudeBufferGeometry: amount has been renamed to depth.');
25549
- depth = options.amount;
25550
- } //
25551
-
25788
+ const uvgen = options.UVGenerator !== undefined ? options.UVGenerator : WorldUVGenerator; //
25552
25789
 
25553
25790
  let extrudePts,
25554
25791
  extrudeByPath = false;
@@ -26715,44 +26952,25 @@ function isUniqueEdge(start, end, edges) {
26715
26952
  var Geometries = /*#__PURE__*/Object.freeze({
26716
26953
  __proto__: null,
26717
26954
  BoxGeometry: BoxGeometry,
26718
- BoxBufferGeometry: BoxGeometry,
26719
26955
  CapsuleGeometry: CapsuleGeometry,
26720
- CapsuleBufferGeometry: CapsuleGeometry,
26721
26956
  CircleGeometry: CircleGeometry,
26722
- CircleBufferGeometry: CircleGeometry,
26723
26957
  ConeGeometry: ConeGeometry,
26724
- ConeBufferGeometry: ConeGeometry,
26725
26958
  CylinderGeometry: CylinderGeometry,
26726
- CylinderBufferGeometry: CylinderGeometry,
26727
26959
  DodecahedronGeometry: DodecahedronGeometry,
26728
- DodecahedronBufferGeometry: DodecahedronGeometry,
26729
26960
  EdgesGeometry: EdgesGeometry,
26730
26961
  ExtrudeGeometry: ExtrudeGeometry,
26731
- ExtrudeBufferGeometry: ExtrudeGeometry,
26732
26962
  IcosahedronGeometry: IcosahedronGeometry,
26733
- IcosahedronBufferGeometry: IcosahedronGeometry,
26734
26963
  LatheGeometry: LatheGeometry,
26735
- LatheBufferGeometry: LatheGeometry,
26736
26964
  OctahedronGeometry: OctahedronGeometry,
26737
- OctahedronBufferGeometry: OctahedronGeometry,
26738
26965
  PlaneGeometry: PlaneGeometry,
26739
- PlaneBufferGeometry: PlaneGeometry,
26740
26966
  PolyhedronGeometry: PolyhedronGeometry,
26741
- PolyhedronBufferGeometry: PolyhedronGeometry,
26742
26967
  RingGeometry: RingGeometry,
26743
- RingBufferGeometry: RingGeometry,
26744
26968
  ShapeGeometry: ShapeGeometry,
26745
- ShapeBufferGeometry: ShapeGeometry,
26746
26969
  SphereGeometry: SphereGeometry,
26747
- SphereBufferGeometry: SphereGeometry,
26748
26970
  TetrahedronGeometry: TetrahedronGeometry,
26749
- TetrahedronBufferGeometry: TetrahedronGeometry,
26750
26971
  TorusGeometry: TorusGeometry,
26751
- TorusBufferGeometry: TorusGeometry,
26752
26972
  TorusKnotGeometry: TorusKnotGeometry,
26753
- TorusKnotBufferGeometry: TorusKnotGeometry,
26754
26973
  TubeGeometry: TubeGeometry,
26755
- TubeBufferGeometry: TubeGeometry,
26756
26974
  WireframeGeometry: WireframeGeometry
26757
26975
  });
26758
26976
 
@@ -27196,6 +27414,14 @@ class MeshLambertMaterial extends Material {
27196
27414
  this.emissive = new Color(0x000000);
27197
27415
  this.emissiveIntensity = 1.0;
27198
27416
  this.emissiveMap = null;
27417
+ this.bumpMap = null;
27418
+ this.bumpScale = 1;
27419
+ this.normalMap = null;
27420
+ this.normalMapType = TangentSpaceNormalMap;
27421
+ this.normalScale = new Vector2(1, 1);
27422
+ this.displacementMap = null;
27423
+ this.displacementScale = 1;
27424
+ this.displacementBias = 0;
27199
27425
  this.specularMap = null;
27200
27426
  this.alphaMap = null;
27201
27427
  this.envMap = null;
@@ -27206,6 +27432,7 @@ class MeshLambertMaterial extends Material {
27206
27432
  this.wireframeLinewidth = 1;
27207
27433
  this.wireframeLinecap = 'round';
27208
27434
  this.wireframeLinejoin = 'round';
27435
+ this.flatShading = false;
27209
27436
  this.fog = true;
27210
27437
  this.setValues(parameters);
27211
27438
  }
@@ -27221,6 +27448,14 @@ class MeshLambertMaterial extends Material {
27221
27448
  this.emissive.copy(source.emissive);
27222
27449
  this.emissiveMap = source.emissiveMap;
27223
27450
  this.emissiveIntensity = source.emissiveIntensity;
27451
+ this.bumpMap = source.bumpMap;
27452
+ this.bumpScale = source.bumpScale;
27453
+ this.normalMap = source.normalMap;
27454
+ this.normalMapType = source.normalMapType;
27455
+ this.normalScale.copy(source.normalScale);
27456
+ this.displacementMap = source.displacementMap;
27457
+ this.displacementScale = source.displacementScale;
27458
+ this.displacementBias = source.displacementBias;
27224
27459
  this.specularMap = source.specularMap;
27225
27460
  this.alphaMap = source.alphaMap;
27226
27461
  this.envMap = source.envMap;
@@ -27231,6 +27466,7 @@ class MeshLambertMaterial extends Material {
27231
27466
  this.wireframeLinewidth = source.wireframeLinewidth;
27232
27467
  this.wireframeLinecap = source.wireframeLinecap;
27233
27468
  this.wireframeLinejoin = source.wireframeLinejoin;
27469
+ this.flatShading = source.flatShading;
27234
27470
  this.fog = source.fog;
27235
27471
  return this;
27236
27472
  }
@@ -27308,261 +27544,252 @@ class LineDashedMaterial extends LineBasicMaterial {
27308
27544
 
27309
27545
  }
27310
27546
 
27311
- const materialLib = {
27312
- ShadowMaterial,
27313
- SpriteMaterial,
27314
- RawShaderMaterial,
27315
- ShaderMaterial,
27316
- PointsMaterial,
27317
- MeshPhysicalMaterial,
27318
- MeshStandardMaterial,
27319
- MeshPhongMaterial,
27320
- MeshToonMaterial,
27321
- MeshNormalMaterial,
27322
- MeshLambertMaterial,
27323
- MeshDepthMaterial,
27324
- MeshDistanceMaterial,
27325
- MeshBasicMaterial,
27326
- MeshMatcapMaterial,
27327
- LineDashedMaterial,
27328
- LineBasicMaterial,
27329
- Material
27330
- };
27547
+ function arraySlice(array, from, to) {
27548
+ if (isTypedArray(array)) {
27549
+ // in ios9 array.subarray(from, undefined) will return empty array
27550
+ // but array.subarray(from) or array.subarray(from, len) is correct
27551
+ return new array.constructor(array.subarray(from, to !== undefined ? to : array.length));
27552
+ }
27331
27553
 
27332
- Material.fromType = function (type) {
27333
- return new materialLib[type]();
27334
- };
27554
+ return array.slice(from, to);
27555
+ } // converts an array to a specific type
27335
27556
 
27336
- const AnimationUtils = {
27337
- // same as Array.prototype.slice, but also works on typed arrays
27338
- arraySlice: function (array, from, to) {
27339
- if (AnimationUtils.isTypedArray(array)) {
27340
- // in ios9 array.subarray(from, undefined) will return empty array
27341
- // but array.subarray(from) or array.subarray(from, len) is correct
27342
- return new array.constructor(array.subarray(from, to !== undefined ? to : array.length));
27343
- }
27344
27557
 
27345
- return array.slice(from, to);
27346
- },
27347
- // converts an array to a specific type
27348
- convertArray: function (array, type, forceClone) {
27349
- if (!array || // let 'undefined' and 'null' pass
27350
- !forceClone && array.constructor === type) return array;
27558
+ function convertArray(array, type, forceClone) {
27559
+ if (!array || // let 'undefined' and 'null' pass
27560
+ !forceClone && array.constructor === type) return array;
27351
27561
 
27352
- if (typeof type.BYTES_PER_ELEMENT === 'number') {
27353
- return new type(array); // create typed array
27354
- }
27562
+ if (typeof type.BYTES_PER_ELEMENT === 'number') {
27563
+ return new type(array); // create typed array
27564
+ }
27355
27565
 
27356
- return Array.prototype.slice.call(array); // create Array
27357
- },
27358
- isTypedArray: function (object) {
27359
- return ArrayBuffer.isView(object) && !(object instanceof DataView);
27360
- },
27361
- // returns an array by which times and values can be sorted
27362
- getKeyframeOrder: function (times) {
27363
- function compareTime(i, j) {
27364
- return times[i] - times[j];
27365
- }
27566
+ return Array.prototype.slice.call(array); // create Array
27567
+ }
27366
27568
 
27367
- const n = times.length;
27368
- const result = new Array(n);
27569
+ function isTypedArray(object) {
27570
+ return ArrayBuffer.isView(object) && !(object instanceof DataView);
27571
+ } // returns an array by which times and values can be sorted
27369
27572
 
27370
- for (let i = 0; i !== n; ++i) result[i] = i;
27371
27573
 
27372
- result.sort(compareTime);
27373
- return result;
27374
- },
27375
- // uses the array previously returned by 'getKeyframeOrder' to sort data
27376
- sortedArray: function (values, stride, order) {
27377
- const nValues = values.length;
27378
- const result = new values.constructor(nValues);
27574
+ function getKeyframeOrder(times) {
27575
+ function compareTime(i, j) {
27576
+ return times[i] - times[j];
27577
+ }
27379
27578
 
27380
- for (let i = 0, dstOffset = 0; dstOffset !== nValues; ++i) {
27381
- const srcOffset = order[i] * stride;
27579
+ const n = times.length;
27580
+ const result = new Array(n);
27382
27581
 
27383
- for (let j = 0; j !== stride; ++j) {
27384
- result[dstOffset++] = values[srcOffset + j];
27385
- }
27386
- }
27582
+ for (let i = 0; i !== n; ++i) result[i] = i;
27387
27583
 
27388
- return result;
27389
- },
27390
- // function for parsing AOS keyframe formats
27391
- flattenJSON: function (jsonKeys, times, values, valuePropertyName) {
27392
- let i = 1,
27393
- key = jsonKeys[0];
27584
+ result.sort(compareTime);
27585
+ return result;
27586
+ } // uses the array previously returned by 'getKeyframeOrder' to sort data
27394
27587
 
27395
- while (key !== undefined && key[valuePropertyName] === undefined) {
27396
- key = jsonKeys[i++];
27588
+
27589
+ function sortedArray(values, stride, order) {
27590
+ const nValues = values.length;
27591
+ const result = new values.constructor(nValues);
27592
+
27593
+ for (let i = 0, dstOffset = 0; dstOffset !== nValues; ++i) {
27594
+ const srcOffset = order[i] * stride;
27595
+
27596
+ for (let j = 0; j !== stride; ++j) {
27597
+ result[dstOffset++] = values[srcOffset + j];
27397
27598
  }
27599
+ }
27398
27600
 
27399
- if (key === undefined) return; // no data
27601
+ return result;
27602
+ } // function for parsing AOS keyframe formats
27400
27603
 
27401
- let value = key[valuePropertyName];
27402
- if (value === undefined) return; // no data
27403
27604
 
27404
- if (Array.isArray(value)) {
27405
- do {
27406
- value = key[valuePropertyName];
27605
+ function flattenJSON(jsonKeys, times, values, valuePropertyName) {
27606
+ let i = 1,
27607
+ key = jsonKeys[0];
27407
27608
 
27408
- if (value !== undefined) {
27409
- times.push(key.time);
27410
- values.push.apply(values, value); // push all elements
27411
- }
27609
+ while (key !== undefined && key[valuePropertyName] === undefined) {
27610
+ key = jsonKeys[i++];
27611
+ }
27412
27612
 
27413
- key = jsonKeys[i++];
27414
- } while (key !== undefined);
27415
- } else if (value.toArray !== undefined) {
27416
- // ...assume THREE.Math-ish
27417
- do {
27418
- value = key[valuePropertyName];
27613
+ if (key === undefined) return; // no data
27419
27614
 
27420
- if (value !== undefined) {
27421
- times.push(key.time);
27422
- value.toArray(values, values.length);
27423
- }
27615
+ let value = key[valuePropertyName];
27616
+ if (value === undefined) return; // no data
27424
27617
 
27425
- key = jsonKeys[i++];
27426
- } while (key !== undefined);
27427
- } else {
27428
- // otherwise push as-is
27429
- do {
27430
- value = key[valuePropertyName];
27618
+ if (Array.isArray(value)) {
27619
+ do {
27620
+ value = key[valuePropertyName];
27431
27621
 
27432
- if (value !== undefined) {
27433
- times.push(key.time);
27434
- values.push(value);
27435
- }
27622
+ if (value !== undefined) {
27623
+ times.push(key.time);
27624
+ values.push.apply(values, value); // push all elements
27625
+ }
27436
27626
 
27437
- key = jsonKeys[i++];
27438
- } while (key !== undefined);
27439
- }
27440
- },
27441
- subclip: function (sourceClip, name, startFrame, endFrame, fps = 30) {
27442
- const clip = sourceClip.clone();
27443
- clip.name = name;
27444
- const tracks = [];
27627
+ key = jsonKeys[i++];
27628
+ } while (key !== undefined);
27629
+ } else if (value.toArray !== undefined) {
27630
+ // ...assume THREE.Math-ish
27631
+ do {
27632
+ value = key[valuePropertyName];
27445
27633
 
27446
- for (let i = 0; i < clip.tracks.length; ++i) {
27447
- const track = clip.tracks[i];
27448
- const valueSize = track.getValueSize();
27449
- const times = [];
27450
- const values = [];
27634
+ if (value !== undefined) {
27635
+ times.push(key.time);
27636
+ value.toArray(values, values.length);
27637
+ }
27451
27638
 
27452
- for (let j = 0; j < track.times.length; ++j) {
27453
- const frame = track.times[j] * fps;
27454
- if (frame < startFrame || frame >= endFrame) continue;
27455
- times.push(track.times[j]);
27639
+ key = jsonKeys[i++];
27640
+ } while (key !== undefined);
27641
+ } else {
27642
+ // otherwise push as-is
27643
+ do {
27644
+ value = key[valuePropertyName];
27456
27645
 
27457
- for (let k = 0; k < valueSize; ++k) {
27458
- values.push(track.values[j * valueSize + k]);
27459
- }
27646
+ if (value !== undefined) {
27647
+ times.push(key.time);
27648
+ values.push(value);
27460
27649
  }
27461
27650
 
27462
- if (times.length === 0) continue;
27463
- track.times = AnimationUtils.convertArray(times, track.times.constructor);
27464
- track.values = AnimationUtils.convertArray(values, track.values.constructor);
27465
- tracks.push(track);
27466
- }
27651
+ key = jsonKeys[i++];
27652
+ } while (key !== undefined);
27653
+ }
27654
+ }
27467
27655
 
27468
- clip.tracks = tracks; // find minimum .times value across all tracks in the trimmed clip
27656
+ function subclip(sourceClip, name, startFrame, endFrame, fps = 30) {
27657
+ const clip = sourceClip.clone();
27658
+ clip.name = name;
27659
+ const tracks = [];
27469
27660
 
27470
- let minStartTime = Infinity;
27661
+ for (let i = 0; i < clip.tracks.length; ++i) {
27662
+ const track = clip.tracks[i];
27663
+ const valueSize = track.getValueSize();
27664
+ const times = [];
27665
+ const values = [];
27471
27666
 
27472
- for (let i = 0; i < clip.tracks.length; ++i) {
27473
- if (minStartTime > clip.tracks[i].times[0]) {
27474
- minStartTime = clip.tracks[i].times[0];
27667
+ for (let j = 0; j < track.times.length; ++j) {
27668
+ const frame = track.times[j] * fps;
27669
+ if (frame < startFrame || frame >= endFrame) continue;
27670
+ times.push(track.times[j]);
27671
+
27672
+ for (let k = 0; k < valueSize; ++k) {
27673
+ values.push(track.values[j * valueSize + k]);
27475
27674
  }
27476
- } // shift all tracks such that clip begins at t=0
27675
+ }
27477
27676
 
27677
+ if (times.length === 0) continue;
27678
+ track.times = convertArray(times, track.times.constructor);
27679
+ track.values = convertArray(values, track.values.constructor);
27680
+ tracks.push(track);
27681
+ }
27478
27682
 
27479
- for (let i = 0; i < clip.tracks.length; ++i) {
27480
- clip.tracks[i].shift(-1 * minStartTime);
27683
+ clip.tracks = tracks; // find minimum .times value across all tracks in the trimmed clip
27684
+
27685
+ let minStartTime = Infinity;
27686
+
27687
+ for (let i = 0; i < clip.tracks.length; ++i) {
27688
+ if (minStartTime > clip.tracks[i].times[0]) {
27689
+ minStartTime = clip.tracks[i].times[0];
27481
27690
  }
27691
+ } // shift all tracks such that clip begins at t=0
27482
27692
 
27483
- clip.resetDuration();
27484
- return clip;
27485
- },
27486
- makeClipAdditive: function (targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30) {
27487
- if (fps <= 0) fps = 30;
27488
- const numTracks = referenceClip.tracks.length;
27489
- const referenceTime = referenceFrame / fps; // Make each track's values relative to the values at the reference frame
27490
27693
 
27491
- for (let i = 0; i < numTracks; ++i) {
27492
- const referenceTrack = referenceClip.tracks[i];
27493
- const referenceTrackType = referenceTrack.ValueTypeName; // Skip this track if it's non-numeric
27694
+ for (let i = 0; i < clip.tracks.length; ++i) {
27695
+ clip.tracks[i].shift(-1 * minStartTime);
27696
+ }
27494
27697
 
27495
- if (referenceTrackType === 'bool' || referenceTrackType === 'string') continue; // Find the track in the target clip whose name and type matches the reference track
27698
+ clip.resetDuration();
27699
+ return clip;
27700
+ }
27496
27701
 
27497
- const targetTrack = targetClip.tracks.find(function (track) {
27498
- return track.name === referenceTrack.name && track.ValueTypeName === referenceTrackType;
27499
- });
27500
- if (targetTrack === undefined) continue;
27501
- let referenceOffset = 0;
27502
- const referenceValueSize = referenceTrack.getValueSize();
27702
+ function makeClipAdditive(targetClip, referenceFrame = 0, referenceClip = targetClip, fps = 30) {
27703
+ if (fps <= 0) fps = 30;
27704
+ const numTracks = referenceClip.tracks.length;
27705
+ const referenceTime = referenceFrame / fps; // Make each track's values relative to the values at the reference frame
27503
27706
 
27504
- if (referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {
27505
- referenceOffset = referenceValueSize / 3;
27506
- }
27707
+ for (let i = 0; i < numTracks; ++i) {
27708
+ const referenceTrack = referenceClip.tracks[i];
27709
+ const referenceTrackType = referenceTrack.ValueTypeName; // Skip this track if it's non-numeric
27507
27710
 
27508
- let targetOffset = 0;
27509
- const targetValueSize = targetTrack.getValueSize();
27711
+ if (referenceTrackType === 'bool' || referenceTrackType === 'string') continue; // Find the track in the target clip whose name and type matches the reference track
27510
27712
 
27511
- if (targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {
27512
- targetOffset = targetValueSize / 3;
27513
- }
27713
+ const targetTrack = targetClip.tracks.find(function (track) {
27714
+ return track.name === referenceTrack.name && track.ValueTypeName === referenceTrackType;
27715
+ });
27716
+ if (targetTrack === undefined) continue;
27717
+ let referenceOffset = 0;
27718
+ const referenceValueSize = referenceTrack.getValueSize();
27514
27719
 
27515
- const lastIndex = referenceTrack.times.length - 1;
27516
- let referenceValue; // Find the value to subtract out of the track
27720
+ if (referenceTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {
27721
+ referenceOffset = referenceValueSize / 3;
27722
+ }
27517
27723
 
27518
- if (referenceTime <= referenceTrack.times[0]) {
27519
- // Reference frame is earlier than the first keyframe, so just use the first keyframe
27520
- const startIndex = referenceOffset;
27521
- const endIndex = referenceValueSize - referenceOffset;
27522
- referenceValue = AnimationUtils.arraySlice(referenceTrack.values, startIndex, endIndex);
27523
- } else if (referenceTime >= referenceTrack.times[lastIndex]) {
27524
- // Reference frame is after the last keyframe, so just use the last keyframe
27525
- const startIndex = lastIndex * referenceValueSize + referenceOffset;
27526
- const endIndex = startIndex + referenceValueSize - referenceOffset;
27527
- referenceValue = AnimationUtils.arraySlice(referenceTrack.values, startIndex, endIndex);
27528
- } else {
27529
- // Interpolate to the reference value
27530
- const interpolant = referenceTrack.createInterpolant();
27531
- const startIndex = referenceOffset;
27532
- const endIndex = referenceValueSize - referenceOffset;
27533
- interpolant.evaluate(referenceTime);
27534
- referenceValue = AnimationUtils.arraySlice(interpolant.resultBuffer, startIndex, endIndex);
27535
- } // Conjugate the quaternion
27724
+ let targetOffset = 0;
27725
+ const targetValueSize = targetTrack.getValueSize();
27726
+
27727
+ if (targetTrack.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline) {
27728
+ targetOffset = targetValueSize / 3;
27729
+ }
27536
27730
 
27731
+ const lastIndex = referenceTrack.times.length - 1;
27732
+ let referenceValue; // Find the value to subtract out of the track
27537
27733
 
27538
- if (referenceTrackType === 'quaternion') {
27539
- const referenceQuat = new Quaternion().fromArray(referenceValue).normalize().conjugate();
27540
- referenceQuat.toArray(referenceValue);
27541
- } // Subtract the reference value from all of the track values
27734
+ if (referenceTime <= referenceTrack.times[0]) {
27735
+ // Reference frame is earlier than the first keyframe, so just use the first keyframe
27736
+ const startIndex = referenceOffset;
27737
+ const endIndex = referenceValueSize - referenceOffset;
27738
+ referenceValue = arraySlice(referenceTrack.values, startIndex, endIndex);
27739
+ } else if (referenceTime >= referenceTrack.times[lastIndex]) {
27740
+ // Reference frame is after the last keyframe, so just use the last keyframe
27741
+ const startIndex = lastIndex * referenceValueSize + referenceOffset;
27742
+ const endIndex = startIndex + referenceValueSize - referenceOffset;
27743
+ referenceValue = arraySlice(referenceTrack.values, startIndex, endIndex);
27744
+ } else {
27745
+ // Interpolate to the reference value
27746
+ const interpolant = referenceTrack.createInterpolant();
27747
+ const startIndex = referenceOffset;
27748
+ const endIndex = referenceValueSize - referenceOffset;
27749
+ interpolant.evaluate(referenceTime);
27750
+ referenceValue = arraySlice(interpolant.resultBuffer, startIndex, endIndex);
27751
+ } // Conjugate the quaternion
27542
27752
 
27543
27753
 
27544
- const numTimes = targetTrack.times.length;
27754
+ if (referenceTrackType === 'quaternion') {
27755
+ const referenceQuat = new Quaternion().fromArray(referenceValue).normalize().conjugate();
27756
+ referenceQuat.toArray(referenceValue);
27757
+ } // Subtract the reference value from all of the track values
27545
27758
 
27546
- for (let j = 0; j < numTimes; ++j) {
27547
- const valueStart = j * targetValueSize + targetOffset;
27548
27759
 
27549
- if (referenceTrackType === 'quaternion') {
27550
- // Multiply the conjugate for quaternion track types
27551
- Quaternion.multiplyQuaternionsFlat(targetTrack.values, valueStart, referenceValue, 0, targetTrack.values, valueStart);
27552
- } else {
27553
- const valueEnd = targetValueSize - targetOffset * 2; // Subtract each value for all other numeric track types
27760
+ const numTimes = targetTrack.times.length;
27554
27761
 
27555
- for (let k = 0; k < valueEnd; ++k) {
27556
- targetTrack.values[valueStart + k] -= referenceValue[k];
27557
- }
27762
+ for (let j = 0; j < numTimes; ++j) {
27763
+ const valueStart = j * targetValueSize + targetOffset;
27764
+
27765
+ if (referenceTrackType === 'quaternion') {
27766
+ // Multiply the conjugate for quaternion track types
27767
+ Quaternion.multiplyQuaternionsFlat(targetTrack.values, valueStart, referenceValue, 0, targetTrack.values, valueStart);
27768
+ } else {
27769
+ const valueEnd = targetValueSize - targetOffset * 2; // Subtract each value for all other numeric track types
27770
+
27771
+ for (let k = 0; k < valueEnd; ++k) {
27772
+ targetTrack.values[valueStart + k] -= referenceValue[k];
27558
27773
  }
27559
27774
  }
27560
27775
  }
27561
-
27562
- targetClip.blendMode = AdditiveAnimationBlendMode;
27563
- return targetClip;
27564
27776
  }
27565
- };
27777
+
27778
+ targetClip.blendMode = AdditiveAnimationBlendMode;
27779
+ return targetClip;
27780
+ }
27781
+
27782
+ var AnimationUtils = /*#__PURE__*/Object.freeze({
27783
+ __proto__: null,
27784
+ arraySlice: arraySlice,
27785
+ convertArray: convertArray,
27786
+ isTypedArray: isTypedArray,
27787
+ getKeyframeOrder: getKeyframeOrder,
27788
+ sortedArray: sortedArray,
27789
+ flattenJSON: flattenJSON,
27790
+ subclip: subclip,
27791
+ makeClipAdditive: makeClipAdditive
27792
+ });
27566
27793
 
27567
27794
  /**
27568
27795
  * Abstract base class of interpolants over parametric samples.
@@ -27896,8 +28123,8 @@ class KeyframeTrack {
27896
28123
  if (name === undefined) throw new Error('THREE.KeyframeTrack: track name is undefined');
27897
28124
  if (times === undefined || times.length === 0) throw new Error('THREE.KeyframeTrack: no keyframes in track named ' + name);
27898
28125
  this.name = name;
27899
- this.times = AnimationUtils.convertArray(times, this.TimeBufferType);
27900
- this.values = AnimationUtils.convertArray(values, this.ValueBufferType);
28126
+ this.times = convertArray(times, this.TimeBufferType);
28127
+ this.values = convertArray(values, this.ValueBufferType);
27901
28128
  this.setInterpolation(interpolation || this.DefaultInterpolation);
27902
28129
  } // Serialization (in static context, because of constructor invocation
27903
28130
  // and automatic invocation of .toJSON):
@@ -27913,8 +28140,8 @@ class KeyframeTrack {
27913
28140
  // by default, we assume the data can be serialized as-is
27914
28141
  json = {
27915
28142
  'name': track.name,
27916
- 'times': AnimationUtils.convertArray(track.times, Array),
27917
- 'values': AnimationUtils.convertArray(track.values, Array)
28143
+ 'times': convertArray(track.times, Array),
28144
+ 'values': convertArray(track.values, Array)
27918
28145
  };
27919
28146
  const interpolation = track.getInterpolation();
27920
28147
 
@@ -28046,8 +28273,8 @@ class KeyframeTrack {
28046
28273
  }
28047
28274
 
28048
28275
  const stride = this.getValueSize();
28049
- this.times = AnimationUtils.arraySlice(times, from, to);
28050
- this.values = AnimationUtils.arraySlice(this.values, from * stride, to * stride);
28276
+ this.times = arraySlice(times, from, to);
28277
+ this.values = arraySlice(this.values, from * stride, to * stride);
28051
28278
  }
28052
28279
 
28053
28280
  return this;
@@ -28093,7 +28320,7 @@ class KeyframeTrack {
28093
28320
  }
28094
28321
 
28095
28322
  if (values !== undefined) {
28096
- if (AnimationUtils.isTypedArray(values)) {
28323
+ if (isTypedArray(values)) {
28097
28324
  for (let i = 0, n = values.length; i !== n; ++i) {
28098
28325
  const value = values[i];
28099
28326
 
@@ -28113,8 +28340,8 @@ class KeyframeTrack {
28113
28340
 
28114
28341
  optimize() {
28115
28342
  // times or values may be shared with other tracks, so overwriting is unsafe
28116
- const times = AnimationUtils.arraySlice(this.times),
28117
- values = AnimationUtils.arraySlice(this.values),
28343
+ const times = arraySlice(this.times),
28344
+ values = arraySlice(this.values),
28118
28345
  stride = this.getValueSize(),
28119
28346
  smoothInterpolation = this.getInterpolation() === InterpolateSmooth,
28120
28347
  lastIndex = times.length - 1;
@@ -28173,8 +28400,8 @@ class KeyframeTrack {
28173
28400
  }
28174
28401
 
28175
28402
  if (writeIndex !== times.length) {
28176
- this.times = AnimationUtils.arraySlice(times, 0, writeIndex);
28177
- this.values = AnimationUtils.arraySlice(values, 0, writeIndex * stride);
28403
+ this.times = arraySlice(times, 0, writeIndex);
28404
+ this.values = arraySlice(values, 0, writeIndex * stride);
28178
28405
  } else {
28179
28406
  this.times = times;
28180
28407
  this.values = values;
@@ -28184,8 +28411,8 @@ class KeyframeTrack {
28184
28411
  }
28185
28412
 
28186
28413
  clone() {
28187
- const times = AnimationUtils.arraySlice(this.times, 0);
28188
- const values = AnimationUtils.arraySlice(this.values, 0);
28414
+ const times = arraySlice(this.times, 0);
28415
+ const values = arraySlice(this.values, 0);
28189
28416
  const TypedKeyframeTrack = this.constructor;
28190
28417
  const track = new TypedKeyframeTrack(this.name, times, values); // Interpolant argument to constructor is not saved, so copy the factory method directly.
28191
28418
 
@@ -28342,9 +28569,9 @@ class AnimationClip {
28342
28569
  let values = [];
28343
28570
  times.push((i + numMorphTargets - 1) % numMorphTargets, i, (i + 1) % numMorphTargets);
28344
28571
  values.push(0, 1, 0);
28345
- const order = AnimationUtils.getKeyframeOrder(times);
28346
- times = AnimationUtils.sortedArray(times, 1, order);
28347
- values = AnimationUtils.sortedArray(values, 1, order); // if there is a key at the first frame, duplicate it as the
28572
+ const order = getKeyframeOrder(times);
28573
+ times = sortedArray(times, 1, order);
28574
+ values = sortedArray(values, 1, order); // if there is a key at the first frame, duplicate it as the
28348
28575
  // last frame as well for perfect loop.
28349
28576
 
28350
28577
  if (!noLoop && times[0] === 0) {
@@ -28419,7 +28646,7 @@ class AnimationClip {
28419
28646
  if (animationKeys.length !== 0) {
28420
28647
  const times = [];
28421
28648
  const values = [];
28422
- AnimationUtils.flattenJSON(animationKeys, times, values, propertyName); // empty keys are filtered out, so check again
28649
+ flattenJSON(animationKeys, times, values, propertyName); // empty keys are filtered out, so check again
28423
28650
 
28424
28651
  if (times.length !== 0) {
28425
28652
  destTracks.push(new trackType(trackName, times, values));
@@ -28584,7 +28811,7 @@ function parseKeyframeTrack(json) {
28584
28811
  if (json.times === undefined) {
28585
28812
  const times = [],
28586
28813
  values = [];
28587
- AnimationUtils.flattenJSON(json.keys, times, values, 'value');
28814
+ flattenJSON(json.keys, times, values, 'value');
28588
28815
  json.times = times;
28589
28816
  json.values = values;
28590
28817
  } // derived classes can define a static parse method
@@ -28713,7 +28940,7 @@ class LoadingManager {
28713
28940
 
28714
28941
  }
28715
28942
 
28716
- const DefaultLoadingManager = new LoadingManager();
28943
+ const DefaultLoadingManager = /*@__PURE__*/new LoadingManager();
28717
28944
 
28718
28945
  class Loader {
28719
28946
  constructor(manager) {
@@ -28765,6 +28992,14 @@ class Loader {
28765
28992
 
28766
28993
  const loading = {};
28767
28994
 
28995
+ class HttpError extends Error {
28996
+ constructor(message, response) {
28997
+ super(message);
28998
+ this.response = response;
28999
+ }
29000
+
29001
+ }
29002
+
28768
29003
  class FileLoader extends Loader {
28769
29004
  constructor(manager) {
28770
29005
  super(manager);
@@ -28866,7 +29101,7 @@ class FileLoader extends Loader {
28866
29101
  });
28867
29102
  return new Response(stream);
28868
29103
  } else {
28869
- throw Error(`fetch for "${response.url}" responded with ${response.status}: ${response.statusText}`);
29104
+ throw new HttpError(`fetch for "${response.url}" responded with ${response.status}: ${response.statusText}`, response);
28870
29105
  }
28871
29106
  }).then(response => {
28872
29107
  switch (responseType) {
@@ -29453,6 +29688,7 @@ class SpotLight extends Light {
29453
29688
  this.penumbra = penumbra;
29454
29689
  this.decay = decay; // for physically correct lights, should be 2.
29455
29690
 
29691
+ this.map = null;
29456
29692
  this.shadow = new SpotLightShadow();
29457
29693
  }
29458
29694
 
@@ -29907,7 +30143,7 @@ class MaterialLoader extends Loader {
29907
30143
  return textures[name];
29908
30144
  }
29909
30145
 
29910
- const material = Material.fromType(json.type);
30146
+ const material = MaterialLoader.createMaterialFromType(json.type);
29911
30147
  if (json.uuid !== undefined) material.uuid = json.uuid;
29912
30148
  if (json.name !== undefined) material.name = json.name;
29913
30149
  if (json.color !== undefined && material.color !== undefined) material.color.setHex(json.color);
@@ -30021,17 +30257,15 @@ class MaterialLoader extends Loader {
30021
30257
  if (json.defines !== undefined) material.defines = json.defines;
30022
30258
  if (json.vertexShader !== undefined) material.vertexShader = json.vertexShader;
30023
30259
  if (json.fragmentShader !== undefined) material.fragmentShader = json.fragmentShader;
30260
+ if (json.glslVersion !== undefined) material.glslVersion = json.glslVersion;
30024
30261
 
30025
30262
  if (json.extensions !== undefined) {
30026
30263
  for (const key in json.extensions) {
30027
30264
  material.extensions[key] = json.extensions[key];
30028
30265
  }
30029
- } // Deprecated
30266
+ } // for PointsMaterial
30030
30267
 
30031
30268
 
30032
- if (json.shading !== undefined) material.flatShading = json.shading === 1; // THREE.FlatShading
30033
- // for PointsMaterial
30034
-
30035
30269
  if (json.size !== undefined) material.size = json.size;
30036
30270
  if (json.sizeAttenuation !== undefined) material.sizeAttenuation = json.sizeAttenuation; // maps
30037
30271
 
@@ -30091,6 +30325,30 @@ class MaterialLoader extends Loader {
30091
30325
  return this;
30092
30326
  }
30093
30327
 
30328
+ static createMaterialFromType(type) {
30329
+ const materialLib = {
30330
+ ShadowMaterial,
30331
+ SpriteMaterial,
30332
+ RawShaderMaterial,
30333
+ ShaderMaterial,
30334
+ PointsMaterial,
30335
+ MeshPhysicalMaterial,
30336
+ MeshStandardMaterial,
30337
+ MeshPhongMaterial,
30338
+ MeshToonMaterial,
30339
+ MeshNormalMaterial,
30340
+ MeshLambertMaterial,
30341
+ MeshDepthMaterial,
30342
+ MeshDistanceMaterial,
30343
+ MeshBasicMaterial,
30344
+ MeshMatcapMaterial,
30345
+ LineDashedMaterial,
30346
+ LineBasicMaterial,
30347
+ Material
30348
+ };
30349
+ return new materialLib[type]();
30350
+ }
30351
+
30094
30352
  }
30095
30353
 
30096
30354
  class LoaderUtils {
@@ -30500,28 +30758,11 @@ class ObjectLoader extends Loader {
30500
30758
  for (let i = 0, l = json.length; i < l; i++) {
30501
30759
  const data = json[i];
30502
30760
 
30503
- if (data.type === 'MultiMaterial') {
30504
- // Deprecated
30505
- const array = [];
30506
-
30507
- for (let j = 0; j < data.materials.length; j++) {
30508
- const material = data.materials[j];
30509
-
30510
- if (cache[material.uuid] === undefined) {
30511
- cache[material.uuid] = loader.parse(material);
30512
- }
30513
-
30514
- array.push(cache[material.uuid]);
30515
- }
30516
-
30517
- materials[data.uuid] = array;
30518
- } else {
30519
- if (cache[data.uuid] === undefined) {
30520
- cache[data.uuid] = loader.parse(data);
30521
- }
30522
-
30523
- materials[data.uuid] = cache[data.uuid];
30761
+ if (cache[data.uuid] === undefined) {
30762
+ cache[data.uuid] = loader.parse(data);
30524
30763
  }
30764
+
30765
+ materials[data.uuid] = cache[data.uuid];
30525
30766
  }
30526
30767
  }
30527
30768
 
@@ -31002,13 +31243,6 @@ class ObjectLoader extends Loader {
31002
31243
  }
31003
31244
  });
31004
31245
  }
31005
- /* DEPRECATED */
31006
-
31007
-
31008
- setTexturePath(value) {
31009
- console.warn('THREE.ObjectLoader: .setTexturePath() has been renamed to .setResourcePath().');
31010
- return this.setResourcePath(value);
31011
- }
31012
31246
 
31013
31247
  }
31014
31248
 
@@ -32010,22 +32244,22 @@ const _wordCharOrDot = '[^' + _RESERVED_CHARS_RE.replace('\\.', '') + ']'; // Pa
32010
32244
  // be matched to parse the rest of the track name.
32011
32245
 
32012
32246
 
32013
- const _directoryRe = /((?:WC+[\/:])*)/.source.replace('WC', _wordChar); // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.
32247
+ const _directoryRe = /*@__PURE__*/ /((?:WC+[\/:])*)/.source.replace('WC', _wordChar); // Target node. May contain word characters (a-zA-Z0-9_) and '.' or '-'.
32014
32248
 
32015
32249
 
32016
- const _nodeRe = /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot); // Object on target node, and accessor. May not contain reserved
32250
+ const _nodeRe = /*@__PURE__*/ /(WCOD+)?/.source.replace('WCOD', _wordCharOrDot); // Object on target node, and accessor. May not contain reserved
32017
32251
  // characters. Accessor may contain any character except closing bracket.
32018
32252
 
32019
32253
 
32020
- const _objectRe = /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar); // Property and accessor. May not contain reserved characters. Accessor may
32254
+ const _objectRe = /*@__PURE__*/ /(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace('WC', _wordChar); // Property and accessor. May not contain reserved characters. Accessor may
32021
32255
  // contain any non-bracket characters.
32022
32256
 
32023
32257
 
32024
- const _propertyRe = /\.(WC+)(?:\[(.+)\])?/.source.replace('WC', _wordChar);
32258
+ const _propertyRe = /*@__PURE__*/ /\.(WC+)(?:\[(.+)\])?/.source.replace('WC', _wordChar);
32025
32259
 
32026
32260
  const _trackRe = new RegExp('' + '^' + _directoryRe + _nodeRe + _objectRe + _propertyRe + '$');
32027
32261
 
32028
- const _supportedObjectNames = ['material', 'materials', 'bones'];
32262
+ const _supportedObjectNames = ['material', 'materials', 'bones', 'map'];
32029
32263
 
32030
32264
  class Composite {
32031
32265
  constructor(targetGroup, path, optionalParsedPath) {
@@ -32352,6 +32586,20 @@ class PropertyBinding {
32352
32586
 
32353
32587
  break;
32354
32588
 
32589
+ case 'map':
32590
+ if (!targetObject.material) {
32591
+ console.error('THREE.PropertyBinding: Can not bind to material as node does not have a material.', this);
32592
+ return;
32593
+ }
32594
+
32595
+ if (!targetObject.material.map) {
32596
+ console.error('THREE.PropertyBinding: Can not bind to material.map as node.material does not have a map.', this);
32597
+ return;
32598
+ }
32599
+
32600
+ targetObject = targetObject.material.map;
32601
+ break;
32602
+
32355
32603
  default:
32356
32604
  if (targetObject[objectName] === undefined) {
32357
32605
  console.error('THREE.PropertyBinding: Can not bind to objectName of node undefined.', this);
@@ -32999,13 +33247,12 @@ class AnimationAction {
32999
33247
  const timeRunning = (time - startTime) * timeDirection;
33000
33248
 
33001
33249
  if (timeRunning < 0 || timeDirection === 0) {
33002
- return; // yet to come / don't decide when delta = 0
33003
- } // start
33004
-
33005
-
33006
- this._startTime = null; // unschedule
33250
+ deltaTime = 0;
33251
+ } else {
33252
+ this._startTime = null; // unschedule
33007
33253
 
33008
- deltaTime = timeDirection * timeRunning;
33254
+ deltaTime = timeDirection * timeRunning;
33255
+ }
33009
33256
  } // apply time scale and advance time
33010
33257
 
33011
33258
 
@@ -33246,7 +33493,7 @@ class AnimationAction {
33246
33493
 
33247
33494
  }
33248
33495
 
33249
- const _controlInterpolantsResultBuffer = /*@__PURE__*/new Float32Array(1);
33496
+ const _controlInterpolantsResultBuffer = new Float32Array(1);
33250
33497
 
33251
33498
  class AnimationMixer extends EventDispatcher {
33252
33499
  constructor(root) {
@@ -33789,11 +34036,6 @@ class AnimationMixer extends EventDispatcher {
33789
34036
 
33790
34037
  class Uniform {
33791
34038
  constructor(value) {
33792
- if (typeof value === 'string') {
33793
- console.warn('THREE.Uniform: Type parameter is no longer needed.');
33794
- value = arguments[1];
33795
- }
33796
-
33797
34039
  this.value = value;
33798
34040
  }
33799
34041
 
@@ -33803,6 +34045,67 @@ class Uniform {
33803
34045
 
33804
34046
  }
33805
34047
 
34048
+ let id = 0;
34049
+
34050
+ class UniformsGroup extends EventDispatcher {
34051
+ constructor() {
34052
+ super();
34053
+ this.isUniformsGroup = true;
34054
+ Object.defineProperty(this, 'id', {
34055
+ value: id++
34056
+ });
34057
+ this.name = '';
34058
+ this.usage = StaticDrawUsage;
34059
+ this.uniforms = [];
34060
+ }
34061
+
34062
+ add(uniform) {
34063
+ this.uniforms.push(uniform);
34064
+ return this;
34065
+ }
34066
+
34067
+ remove(uniform) {
34068
+ const index = this.uniforms.indexOf(uniform);
34069
+ if (index !== -1) this.uniforms.splice(index, 1);
34070
+ return this;
34071
+ }
34072
+
34073
+ setName(name) {
34074
+ this.name = name;
34075
+ return this;
34076
+ }
34077
+
34078
+ setUsage(value) {
34079
+ this.usage = value;
34080
+ return this;
34081
+ }
34082
+
34083
+ dispose() {
34084
+ this.dispatchEvent({
34085
+ type: 'dispose'
34086
+ });
34087
+ return this;
34088
+ }
34089
+
34090
+ copy(source) {
34091
+ this.name = source.name;
34092
+ this.usage = source.usage;
34093
+ const uniformsSource = source.uniforms;
34094
+ this.uniforms.length = 0;
34095
+
34096
+ for (let i = 0, l = uniformsSource.length; i < l; i++) {
34097
+ this.uniforms.push(uniformsSource[i].clone());
34098
+ }
34099
+
34100
+ return this;
34101
+ }
34102
+
34103
+ clone() {
34104
+ return new this.constructor().copy(this);
34105
+ }
34106
+
34107
+ }
34108
+
33806
34109
  class InstancedInterleavedBuffer extends InterleavedBuffer {
33807
34110
  constructor(array, stride, meshPerAttribute = 1) {
33808
34111
  super(array, stride);
@@ -34563,27 +34866,29 @@ class GridHelper extends LineSegments {
34563
34866
  }
34564
34867
 
34565
34868
  class PolarGridHelper extends LineSegments {
34566
- constructor(radius = 10, radials = 16, circles = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888) {
34869
+ constructor(radius = 10, sectors = 16, rings = 8, divisions = 64, color1 = 0x444444, color2 = 0x888888) {
34567
34870
  color1 = new Color(color1);
34568
34871
  color2 = new Color(color2);
34569
34872
  const vertices = [];
34570
- const colors = []; // create the radials
34873
+ const colors = []; // create the sectors
34571
34874
 
34572
- for (let i = 0; i <= radials; i++) {
34573
- const v = i / radials * (Math.PI * 2);
34574
- const x = Math.sin(v) * radius;
34575
- const z = Math.cos(v) * radius;
34576
- vertices.push(0, 0, 0);
34577
- vertices.push(x, 0, z);
34578
- const color = i & 1 ? color1 : color2;
34579
- colors.push(color.r, color.g, color.b);
34580
- colors.push(color.r, color.g, color.b);
34581
- } // create the circles
34875
+ if (sectors > 1) {
34876
+ for (let i = 0; i < sectors; i++) {
34877
+ const v = i / sectors * (Math.PI * 2);
34878
+ const x = Math.sin(v) * radius;
34879
+ const z = Math.cos(v) * radius;
34880
+ vertices.push(0, 0, 0);
34881
+ vertices.push(x, 0, z);
34882
+ const color = i & 1 ? color1 : color2;
34883
+ colors.push(color.r, color.g, color.b);
34884
+ colors.push(color.r, color.g, color.b);
34885
+ }
34886
+ } // create the rings
34582
34887
 
34583
34888
 
34584
- for (let i = 0; i <= circles; i++) {
34889
+ for (let i = 0; i < rings; i++) {
34585
34890
  const color = i & 1 ? color1 : color2;
34586
- const r = radius - radius / circles * i;
34891
+ const r = radius - radius / rings * i;
34587
34892
 
34588
34893
  for (let j = 0; j < divisions; j++) {
34589
34894
  // first vertex
@@ -34695,54 +35000,48 @@ class CameraHelper extends LineSegments {
34695
35000
  });
34696
35001
  const vertices = [];
34697
35002
  const colors = [];
34698
- const pointMap = {}; // colors
34699
-
34700
- const colorFrustum = new Color(0xffaa00);
34701
- const colorCone = new Color(0xff0000);
34702
- const colorUp = new Color(0x00aaff);
34703
- const colorTarget = new Color(0xffffff);
34704
- const colorCross = new Color(0x333333); // near
35003
+ const pointMap = {}; // near
34705
35004
 
34706
- addLine('n1', 'n2', colorFrustum);
34707
- addLine('n2', 'n4', colorFrustum);
34708
- addLine('n4', 'n3', colorFrustum);
34709
- addLine('n3', 'n1', colorFrustum); // far
35005
+ addLine('n1', 'n2');
35006
+ addLine('n2', 'n4');
35007
+ addLine('n4', 'n3');
35008
+ addLine('n3', 'n1'); // far
34710
35009
 
34711
- addLine('f1', 'f2', colorFrustum);
34712
- addLine('f2', 'f4', colorFrustum);
34713
- addLine('f4', 'f3', colorFrustum);
34714
- addLine('f3', 'f1', colorFrustum); // sides
35010
+ addLine('f1', 'f2');
35011
+ addLine('f2', 'f4');
35012
+ addLine('f4', 'f3');
35013
+ addLine('f3', 'f1'); // sides
34715
35014
 
34716
- addLine('n1', 'f1', colorFrustum);
34717
- addLine('n2', 'f2', colorFrustum);
34718
- addLine('n3', 'f3', colorFrustum);
34719
- addLine('n4', 'f4', colorFrustum); // cone
35015
+ addLine('n1', 'f1');
35016
+ addLine('n2', 'f2');
35017
+ addLine('n3', 'f3');
35018
+ addLine('n4', 'f4'); // cone
34720
35019
 
34721
- addLine('p', 'n1', colorCone);
34722
- addLine('p', 'n2', colorCone);
34723
- addLine('p', 'n3', colorCone);
34724
- addLine('p', 'n4', colorCone); // up
35020
+ addLine('p', 'n1');
35021
+ addLine('p', 'n2');
35022
+ addLine('p', 'n3');
35023
+ addLine('p', 'n4'); // up
34725
35024
 
34726
- addLine('u1', 'u2', colorUp);
34727
- addLine('u2', 'u3', colorUp);
34728
- addLine('u3', 'u1', colorUp); // target
35025
+ addLine('u1', 'u2');
35026
+ addLine('u2', 'u3');
35027
+ addLine('u3', 'u1'); // target
34729
35028
 
34730
- addLine('c', 't', colorTarget);
34731
- addLine('p', 'c', colorCross); // cross
35029
+ addLine('c', 't');
35030
+ addLine('p', 'c'); // cross
34732
35031
 
34733
- addLine('cn1', 'cn2', colorCross);
34734
- addLine('cn3', 'cn4', colorCross);
34735
- addLine('cf1', 'cf2', colorCross);
34736
- addLine('cf3', 'cf4', colorCross);
35032
+ addLine('cn1', 'cn2');
35033
+ addLine('cn3', 'cn4');
35034
+ addLine('cf1', 'cf2');
35035
+ addLine('cf3', 'cf4');
34737
35036
 
34738
- function addLine(a, b, color) {
34739
- addPoint(a, color);
34740
- addPoint(b, color);
35037
+ function addLine(a, b) {
35038
+ addPoint(a);
35039
+ addPoint(b);
34741
35040
  }
34742
35041
 
34743
- function addPoint(id, color) {
35042
+ function addPoint(id) {
34744
35043
  vertices.push(0, 0, 0);
34745
- colors.push(color.r, color.g, color.b);
35044
+ colors.push(0, 0, 0);
34746
35045
 
34747
35046
  if (pointMap[id] === undefined) {
34748
35047
  pointMap[id] = [];
@@ -34760,7 +35059,102 @@ class CameraHelper extends LineSegments {
34760
35059
  this.matrix = camera.matrixWorld;
34761
35060
  this.matrixAutoUpdate = false;
34762
35061
  this.pointMap = pointMap;
34763
- this.update();
35062
+ this.update(); // colors
35063
+
35064
+ const colorFrustum = new Color(0xffaa00);
35065
+ const colorCone = new Color(0xff0000);
35066
+ const colorUp = new Color(0x00aaff);
35067
+ const colorTarget = new Color(0xffffff);
35068
+ const colorCross = new Color(0x333333);
35069
+ this.setColors(colorFrustum, colorCone, colorUp, colorTarget, colorCross);
35070
+ }
35071
+
35072
+ setColors(frustum, cone, up, target, cross) {
35073
+ const geometry = this.geometry;
35074
+ const colorAttribute = geometry.getAttribute('color'); // near
35075
+
35076
+ colorAttribute.setXYZ(0, frustum.r, frustum.g, frustum.b);
35077
+ colorAttribute.setXYZ(1, frustum.r, frustum.g, frustum.b); // n1, n2
35078
+
35079
+ colorAttribute.setXYZ(2, frustum.r, frustum.g, frustum.b);
35080
+ colorAttribute.setXYZ(3, frustum.r, frustum.g, frustum.b); // n2, n4
35081
+
35082
+ colorAttribute.setXYZ(4, frustum.r, frustum.g, frustum.b);
35083
+ colorAttribute.setXYZ(5, frustum.r, frustum.g, frustum.b); // n4, n3
35084
+
35085
+ colorAttribute.setXYZ(6, frustum.r, frustum.g, frustum.b);
35086
+ colorAttribute.setXYZ(7, frustum.r, frustum.g, frustum.b); // n3, n1
35087
+ // far
35088
+
35089
+ colorAttribute.setXYZ(8, frustum.r, frustum.g, frustum.b);
35090
+ colorAttribute.setXYZ(9, frustum.r, frustum.g, frustum.b); // f1, f2
35091
+
35092
+ colorAttribute.setXYZ(10, frustum.r, frustum.g, frustum.b);
35093
+ colorAttribute.setXYZ(11, frustum.r, frustum.g, frustum.b); // f2, f4
35094
+
35095
+ colorAttribute.setXYZ(12, frustum.r, frustum.g, frustum.b);
35096
+ colorAttribute.setXYZ(13, frustum.r, frustum.g, frustum.b); // f4, f3
35097
+
35098
+ colorAttribute.setXYZ(14, frustum.r, frustum.g, frustum.b);
35099
+ colorAttribute.setXYZ(15, frustum.r, frustum.g, frustum.b); // f3, f1
35100
+ // sides
35101
+
35102
+ colorAttribute.setXYZ(16, frustum.r, frustum.g, frustum.b);
35103
+ colorAttribute.setXYZ(17, frustum.r, frustum.g, frustum.b); // n1, f1
35104
+
35105
+ colorAttribute.setXYZ(18, frustum.r, frustum.g, frustum.b);
35106
+ colorAttribute.setXYZ(19, frustum.r, frustum.g, frustum.b); // n2, f2
35107
+
35108
+ colorAttribute.setXYZ(20, frustum.r, frustum.g, frustum.b);
35109
+ colorAttribute.setXYZ(21, frustum.r, frustum.g, frustum.b); // n3, f3
35110
+
35111
+ colorAttribute.setXYZ(22, frustum.r, frustum.g, frustum.b);
35112
+ colorAttribute.setXYZ(23, frustum.r, frustum.g, frustum.b); // n4, f4
35113
+ // cone
35114
+
35115
+ colorAttribute.setXYZ(24, cone.r, cone.g, cone.b);
35116
+ colorAttribute.setXYZ(25, cone.r, cone.g, cone.b); // p, n1
35117
+
35118
+ colorAttribute.setXYZ(26, cone.r, cone.g, cone.b);
35119
+ colorAttribute.setXYZ(27, cone.r, cone.g, cone.b); // p, n2
35120
+
35121
+ colorAttribute.setXYZ(28, cone.r, cone.g, cone.b);
35122
+ colorAttribute.setXYZ(29, cone.r, cone.g, cone.b); // p, n3
35123
+
35124
+ colorAttribute.setXYZ(30, cone.r, cone.g, cone.b);
35125
+ colorAttribute.setXYZ(31, cone.r, cone.g, cone.b); // p, n4
35126
+ // up
35127
+
35128
+ colorAttribute.setXYZ(32, up.r, up.g, up.b);
35129
+ colorAttribute.setXYZ(33, up.r, up.g, up.b); // u1, u2
35130
+
35131
+ colorAttribute.setXYZ(34, up.r, up.g, up.b);
35132
+ colorAttribute.setXYZ(35, up.r, up.g, up.b); // u2, u3
35133
+
35134
+ colorAttribute.setXYZ(36, up.r, up.g, up.b);
35135
+ colorAttribute.setXYZ(37, up.r, up.g, up.b); // u3, u1
35136
+ // target
35137
+
35138
+ colorAttribute.setXYZ(38, target.r, target.g, target.b);
35139
+ colorAttribute.setXYZ(39, target.r, target.g, target.b); // c, t
35140
+
35141
+ colorAttribute.setXYZ(40, cross.r, cross.g, cross.b);
35142
+ colorAttribute.setXYZ(41, cross.r, cross.g, cross.b); // p, c
35143
+ // cross
35144
+
35145
+ colorAttribute.setXYZ(42, cross.r, cross.g, cross.b);
35146
+ colorAttribute.setXYZ(43, cross.r, cross.g, cross.b); // cn1, cn2
35147
+
35148
+ colorAttribute.setXYZ(44, cross.r, cross.g, cross.b);
35149
+ colorAttribute.setXYZ(45, cross.r, cross.g, cross.b); // cn3, cn4
35150
+
35151
+ colorAttribute.setXYZ(46, cross.r, cross.g, cross.b);
35152
+ colorAttribute.setXYZ(47, cross.r, cross.g, cross.b); // cf1, cf2
35153
+
35154
+ colorAttribute.setXYZ(48, cross.r, cross.g, cross.b);
35155
+ colorAttribute.setXYZ(49, cross.r, cross.g, cross.b); // cf3, cf4
35156
+
35157
+ colorAttribute.needsUpdate = true;
34764
35158
  }
34765
35159
 
34766
35160
  update() {
@@ -34942,7 +35336,7 @@ class Box3Helper extends LineSegments {
34942
35336
  class PlaneHelper extends Line {
34943
35337
  constructor(plane, size = 1, hex = 0xffff00) {
34944
35338
  const color = hex;
34945
- const positions = [1, -1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0];
35339
+ const positions = [1, -1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0, 1, 1, 0];
34946
35340
  const geometry = new BufferGeometry();
34947
35341
  geometry.setAttribute('position', new Float32BufferAttribute(positions, 3));
34948
35342
  geometry.computeBoundingSphere();
@@ -34953,7 +35347,7 @@ class PlaneHelper extends Line {
34953
35347
  this.type = 'PlaneHelper';
34954
35348
  this.plane = plane;
34955
35349
  this.size = size;
34956
- const positions2 = [1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, 1, -1, -1, 1, 1, -1, 1];
35350
+ const positions2 = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, 1, 0, -1, -1, 0, 1, -1, 0];
34957
35351
  const geometry2 = new BufferGeometry();
34958
35352
  geometry2.setAttribute('position', new Float32BufferAttribute(positions2, 3));
34959
35353
  geometry2.computeBoundingSphere();
@@ -34967,13 +35361,10 @@ class PlaneHelper extends Line {
34967
35361
  }
34968
35362
 
34969
35363
  updateMatrixWorld(force) {
34970
- let scale = -this.plane.constant;
34971
- if (Math.abs(scale) < 1e-8) scale = 1e-8; // sign does not matter
34972
-
34973
- this.scale.set(0.5 * this.size, 0.5 * this.size, scale);
34974
- this.children[0].material.side = scale < 0 ? BackSide : FrontSide; // renderer flips side when determinant < 0; flipping not wanted here
34975
-
35364
+ this.position.set(0, 0, 0);
35365
+ this.scale.set(0.5 * this.size, 0.5 * this.size, 1);
34976
35366
  this.lookAt(this.plane.normal);
35367
+ this.translateZ(-this.plane.constant);
34977
35368
  super.updateMatrixWorld(force);
34978
35369
  }
34979
35370
 
@@ -35126,7 +35517,7 @@ class ShapePath {
35126
35517
  return this;
35127
35518
  }
35128
35519
 
35129
- toShapes(isCCW, noHoles) {
35520
+ toShapes(isCCW) {
35130
35521
  function toShapesNoHoles(inSubpaths) {
35131
35522
  const shapes = [];
35132
35523
 
@@ -35191,7 +35582,6 @@ class ShapePath {
35191
35582
  const isClockWise = ShapeUtils.isClockWise;
35192
35583
  const subPaths = this.subPaths;
35193
35584
  if (subPaths.length === 0) return [];
35194
- if (noHoles === true) return toShapesNoHoles(subPaths);
35195
35585
  let solid, tmpPath, tmpShape;
35196
35586
  const shapes = [];
35197
35587
 
@@ -35297,139 +35687,126 @@ class ShapePath {
35297
35687
 
35298
35688
  }
35299
35689
 
35300
- class DataUtils {
35301
- // float32 to float16
35302
- static toHalfFloat(val) {
35303
- if (Math.abs(val) > 65504) console.warn('THREE.DataUtils.toHalfFloat(): Value out of range.');
35304
- val = clamp(val, -65504, 65504);
35305
- _floatView[0] = val;
35306
- const f = _uint32View[0];
35307
- const e = f >> 23 & 0x1ff;
35308
- return _baseTable[e] + ((f & 0x007fffff) >> _shiftTable[e]);
35309
- } // float16 to float32
35310
-
35311
-
35312
- static fromHalfFloat(val) {
35313
- const m = val >> 10;
35314
- _uint32View[0] = _mantissaTable[_offsetTable[m] + (val & 0x3ff)] + _exponentTable[m];
35315
- return _floatView[0];
35316
- }
35317
-
35318
- } // float32 to float16 helpers
35690
+ const _tables = /*@__PURE__*/_generateTables();
35691
+
35692
+ function _generateTables() {
35693
+ // float32 to float16 helpers
35694
+ const buffer = new ArrayBuffer(4);
35695
+ const floatView = new Float32Array(buffer);
35696
+ const uint32View = new Uint32Array(buffer);
35697
+ const baseTable = new Uint32Array(512);
35698
+ const shiftTable = new Uint32Array(512);
35699
+
35700
+ for (let i = 0; i < 256; ++i) {
35701
+ const e = i - 127; // very small number (0, -0)
35702
+
35703
+ if (e < -27) {
35704
+ baseTable[i] = 0x0000;
35705
+ baseTable[i | 0x100] = 0x8000;
35706
+ shiftTable[i] = 24;
35707
+ shiftTable[i | 0x100] = 24; // small number (denorm)
35708
+ } else if (e < -14) {
35709
+ baseTable[i] = 0x0400 >> -e - 14;
35710
+ baseTable[i | 0x100] = 0x0400 >> -e - 14 | 0x8000;
35711
+ shiftTable[i] = -e - 1;
35712
+ shiftTable[i | 0x100] = -e - 1; // normal number
35713
+ } else if (e <= 15) {
35714
+ baseTable[i] = e + 15 << 10;
35715
+ baseTable[i | 0x100] = e + 15 << 10 | 0x8000;
35716
+ shiftTable[i] = 13;
35717
+ shiftTable[i | 0x100] = 13; // large number (Infinity, -Infinity)
35718
+ } else if (e < 128) {
35719
+ baseTable[i] = 0x7c00;
35720
+ baseTable[i | 0x100] = 0xfc00;
35721
+ shiftTable[i] = 24;
35722
+ shiftTable[i | 0x100] = 24; // stay (NaN, Infinity, -Infinity)
35723
+ } else {
35724
+ baseTable[i] = 0x7c00;
35725
+ baseTable[i | 0x100] = 0xfc00;
35726
+ shiftTable[i] = 13;
35727
+ shiftTable[i | 0x100] = 13;
35728
+ }
35729
+ } // float16 to float32 helpers
35319
35730
 
35320
35731
 
35321
- const _buffer = new ArrayBuffer(4);
35732
+ const mantissaTable = new Uint32Array(2048);
35733
+ const exponentTable = new Uint32Array(64);
35734
+ const offsetTable = new Uint32Array(64);
35322
35735
 
35323
- const _floatView = new Float32Array(_buffer);
35736
+ for (let i = 1; i < 1024; ++i) {
35737
+ let m = i << 13; // zero pad mantissa bits
35324
35738
 
35325
- const _uint32View = new Uint32Array(_buffer);
35739
+ let e = 0; // zero exponent
35740
+ // normalized
35326
35741
 
35327
- const _baseTable = new Uint32Array(512);
35742
+ while ((m & 0x00800000) === 0) {
35743
+ m <<= 1;
35744
+ e -= 0x00800000; // decrement exponent
35745
+ }
35328
35746
 
35329
- const _shiftTable = new Uint32Array(512);
35747
+ m &= ~0x00800000; // clear leading 1 bit
35330
35748
 
35331
- for (let i = 0; i < 256; ++i) {
35332
- const e = i - 127; // very small number (0, -0)
35749
+ e += 0x38800000; // adjust bias
35333
35750
 
35334
- if (e < -27) {
35335
- _baseTable[i] = 0x0000;
35336
- _baseTable[i | 0x100] = 0x8000;
35337
- _shiftTable[i] = 24;
35338
- _shiftTable[i | 0x100] = 24; // small number (denorm)
35339
- } else if (e < -14) {
35340
- _baseTable[i] = 0x0400 >> -e - 14;
35341
- _baseTable[i | 0x100] = 0x0400 >> -e - 14 | 0x8000;
35342
- _shiftTable[i] = -e - 1;
35343
- _shiftTable[i | 0x100] = -e - 1; // normal number
35344
- } else if (e <= 15) {
35345
- _baseTable[i] = e + 15 << 10;
35346
- _baseTable[i | 0x100] = e + 15 << 10 | 0x8000;
35347
- _shiftTable[i] = 13;
35348
- _shiftTable[i | 0x100] = 13; // large number (Infinity, -Infinity)
35349
- } else if (e < 128) {
35350
- _baseTable[i] = 0x7c00;
35351
- _baseTable[i | 0x100] = 0xfc00;
35352
- _shiftTable[i] = 24;
35353
- _shiftTable[i | 0x100] = 24; // stay (NaN, Infinity, -Infinity)
35354
- } else {
35355
- _baseTable[i] = 0x7c00;
35356
- _baseTable[i | 0x100] = 0xfc00;
35357
- _shiftTable[i] = 13;
35358
- _shiftTable[i | 0x100] = 13;
35751
+ mantissaTable[i] = m | e;
35359
35752
  }
35360
- } // float16 to float32 helpers
35361
-
35362
-
35363
- const _mantissaTable = new Uint32Array(2048);
35364
-
35365
- const _exponentTable = new Uint32Array(64);
35366
-
35367
- const _offsetTable = new Uint32Array(64);
35368
-
35369
- for (let i = 1; i < 1024; ++i) {
35370
- let m = i << 13; // zero pad mantissa bits
35371
-
35372
- let e = 0; // zero exponent
35373
- // normalized
35374
35753
 
35375
- while ((m & 0x00800000) === 0) {
35376
- m <<= 1;
35377
- e -= 0x00800000; // decrement exponent
35754
+ for (let i = 1024; i < 2048; ++i) {
35755
+ mantissaTable[i] = 0x38000000 + (i - 1024 << 13);
35378
35756
  }
35379
35757
 
35380
- m &= ~0x00800000; // clear leading 1 bit
35381
-
35382
- e += 0x38800000; // adjust bias
35383
-
35384
- _mantissaTable[i] = m | e;
35385
- }
35386
-
35387
- for (let i = 1024; i < 2048; ++i) {
35388
- _mantissaTable[i] = 0x38000000 + (i - 1024 << 13);
35389
- }
35390
-
35391
- for (let i = 1; i < 31; ++i) {
35392
- _exponentTable[i] = i << 23;
35393
- }
35758
+ for (let i = 1; i < 31; ++i) {
35759
+ exponentTable[i] = i << 23;
35760
+ }
35394
35761
 
35395
- _exponentTable[31] = 0x47800000;
35396
- _exponentTable[32] = 0x80000000;
35762
+ exponentTable[31] = 0x47800000;
35763
+ exponentTable[32] = 0x80000000;
35397
35764
 
35398
- for (let i = 33; i < 63; ++i) {
35399
- _exponentTable[i] = 0x80000000 + (i - 32 << 23);
35400
- }
35765
+ for (let i = 33; i < 63; ++i) {
35766
+ exponentTable[i] = 0x80000000 + (i - 32 << 23);
35767
+ }
35401
35768
 
35402
- _exponentTable[63] = 0xc7800000;
35769
+ exponentTable[63] = 0xc7800000;
35403
35770
 
35404
- for (let i = 1; i < 64; ++i) {
35405
- if (i !== 32) {
35406
- _offsetTable[i] = 1024;
35771
+ for (let i = 1; i < 64; ++i) {
35772
+ if (i !== 32) {
35773
+ offsetTable[i] = 1024;
35774
+ }
35407
35775
  }
35408
- }
35409
35776
 
35410
- class ParametricGeometry extends BufferGeometry {
35411
- constructor() {
35412
- console.error('THREE.ParametricGeometry has been moved to /examples/jsm/geometries/ParametricGeometry.js');
35413
- super();
35414
- }
35777
+ return {
35778
+ floatView: floatView,
35779
+ uint32View: uint32View,
35780
+ baseTable: baseTable,
35781
+ shiftTable: shiftTable,
35782
+ mantissaTable: mantissaTable,
35783
+ exponentTable: exponentTable,
35784
+ offsetTable: offsetTable
35785
+ };
35786
+ } // float32 to float16
35415
35787
 
35416
- } // r133, eb58ff153119090d3bbb24474ea0ffc40c70dc92
35417
35788
 
35418
- class TextGeometry extends BufferGeometry {
35419
- constructor() {
35420
- console.error('THREE.TextGeometry has been moved to /examples/jsm/geometries/TextGeometry.js');
35421
- super();
35422
- }
35789
+ function toHalfFloat(val) {
35790
+ if (Math.abs(val) > 65504) console.warn('THREE.DataUtils.toHalfFloat(): Value out of range.');
35791
+ val = clamp(val, -65504, 65504);
35792
+ _tables.floatView[0] = val;
35793
+ const f = _tables.uint32View[0];
35794
+ const e = f >> 23 & 0x1ff;
35795
+ return _tables.baseTable[e] + ((f & 0x007fffff) >> _tables.shiftTable[e]);
35796
+ } // float16 to float32
35423
35797
 
35424
- } // r133, eb58ff153119090d3bbb24474ea0ffc40c70dc92
35425
35798
 
35426
- function FontLoader() {
35427
- console.error('THREE.FontLoader has been moved to /examples/jsm/loaders/FontLoader.js');
35428
- } // r133, eb58ff153119090d3bbb24474ea0ffc40c70dc92
35799
+ function fromHalfFloat(val) {
35800
+ const m = val >> 10;
35801
+ _tables.uint32View[0] = _tables.mantissaTable[_tables.offsetTable[m] + (val & 0x3ff)] + _tables.exponentTable[m];
35802
+ return _tables.floatView[0];
35803
+ }
35429
35804
 
35430
- function Font() {
35431
- console.error('THREE.Font has been moved to /examples/jsm/loaders/FontLoader.js');
35432
- } // r134, d65e0af06644fe5a84a6fc0e372f4318f95a04c0
35805
+ var DataUtils = /*#__PURE__*/Object.freeze({
35806
+ __proto__: null,
35807
+ toHalfFloat: toHalfFloat,
35808
+ fromHalfFloat: fromHalfFloat
35809
+ });
35433
35810
 
35434
35811
  function ImmediateRenderObject() {
35435
35812
  console.error('THREE.ImmediateRenderObject has been removed.');
@@ -35458,6 +35835,158 @@ class DataTexture3D extends Data3DTexture {
35458
35835
  super(data, width, height, depth);
35459
35836
  }
35460
35837
 
35838
+ } // r144
35839
+
35840
+ class BoxBufferGeometry extends BoxGeometry {
35841
+ constructor(width, height, depth, widthSegments, heightSegments, depthSegments) {
35842
+ console.warn('THREE.BoxBufferGeometry has been renamed to THREE.BoxGeometry.');
35843
+ super(width, height, depth, widthSegments, heightSegments, depthSegments);
35844
+ }
35845
+
35846
+ } // r144
35847
+
35848
+ class CapsuleBufferGeometry extends CapsuleGeometry {
35849
+ constructor(radius, length, capSegments, radialSegments) {
35850
+ console.warn('THREE.CapsuleBufferGeometry has been renamed to THREE.CapsuleGeometry.');
35851
+ super(radius, length, capSegments, radialSegments);
35852
+ }
35853
+
35854
+ } // r144
35855
+
35856
+ class CircleBufferGeometry extends CircleGeometry {
35857
+ constructor(radius, segments, thetaStart, thetaLength) {
35858
+ console.warn('THREE.CircleBufferGeometry has been renamed to THREE.CircleGeometry.');
35859
+ super(radius, segments, thetaStart, thetaLength);
35860
+ }
35861
+
35862
+ } // r144
35863
+
35864
+ class ConeBufferGeometry extends ConeGeometry {
35865
+ constructor(radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength) {
35866
+ console.warn('THREE.ConeBufferGeometry has been renamed to THREE.ConeGeometry.');
35867
+ super(radius, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength);
35868
+ }
35869
+
35870
+ } // r144
35871
+
35872
+ class CylinderBufferGeometry extends CylinderGeometry {
35873
+ constructor(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength) {
35874
+ console.warn('THREE.CylinderBufferGeometry has been renamed to THREE.CylinderGeometry.');
35875
+ super(radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength);
35876
+ }
35877
+
35878
+ } // r144
35879
+
35880
+ class DodecahedronBufferGeometry extends DodecahedronGeometry {
35881
+ constructor(radius, detail) {
35882
+ console.warn('THREE.DodecahedronBufferGeometry has been renamed to THREE.DodecahedronGeometry.');
35883
+ super(radius, detail);
35884
+ }
35885
+
35886
+ } // r144
35887
+
35888
+ class ExtrudeBufferGeometry extends ExtrudeGeometry {
35889
+ constructor(shapes, options) {
35890
+ console.warn('THREE.ExtrudeBufferGeometry has been renamed to THREE.ExtrudeGeometry.');
35891
+ super(shapes, options);
35892
+ }
35893
+
35894
+ } // r144
35895
+
35896
+ class IcosahedronBufferGeometry extends IcosahedronGeometry {
35897
+ constructor(radius, detail) {
35898
+ console.warn('THREE.IcosahedronBufferGeometry has been renamed to THREE.IcosahedronGeometry.');
35899
+ super(radius, detail);
35900
+ }
35901
+
35902
+ } // r144
35903
+
35904
+ class LatheBufferGeometry extends LatheGeometry {
35905
+ constructor(points, segments, phiStart, phiLength) {
35906
+ console.warn('THREE.LatheBufferGeometry has been renamed to THREE.LatheGeometry.');
35907
+ super(points, segments, phiStart, phiLength);
35908
+ }
35909
+
35910
+ } // r144
35911
+
35912
+ class OctahedronBufferGeometry extends OctahedronGeometry {
35913
+ constructor(radius, detail) {
35914
+ console.warn('THREE.OctahedronBufferGeometry has been renamed to THREE.OctahedronGeometry.');
35915
+ super(radius, detail);
35916
+ }
35917
+
35918
+ } // r144
35919
+
35920
+ class PlaneBufferGeometry extends PlaneGeometry {
35921
+ constructor(width, height, widthSegments, heightSegments) {
35922
+ console.warn('THREE.PlaneBufferGeometry has been renamed to THREE.PlaneGeometry.');
35923
+ super(width, height, widthSegments, heightSegments);
35924
+ }
35925
+
35926
+ } // r144
35927
+
35928
+ class PolyhedronBufferGeometry extends PolyhedronGeometry {
35929
+ constructor(vertices, indices, radius, detail) {
35930
+ console.warn('THREE.PolyhedronBufferGeometry has been renamed to THREE.PolyhedronGeometry.');
35931
+ super(vertices, indices, radius, detail);
35932
+ }
35933
+
35934
+ } // r144
35935
+
35936
+ class RingBufferGeometry extends RingGeometry {
35937
+ constructor(innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength) {
35938
+ console.warn('THREE.RingBufferGeometry has been renamed to THREE.RingGeometry.');
35939
+ super(innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength);
35940
+ }
35941
+
35942
+ } // r144
35943
+
35944
+ class ShapeBufferGeometry extends ShapeGeometry {
35945
+ constructor(shapes, curveSegments) {
35946
+ console.warn('THREE.ShapeBufferGeometry has been renamed to THREE.ShapeGeometry.');
35947
+ super(shapes, curveSegments);
35948
+ }
35949
+
35950
+ } // r144
35951
+
35952
+ class SphereBufferGeometry extends SphereGeometry {
35953
+ constructor(radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength) {
35954
+ console.warn('THREE.SphereBufferGeometry has been renamed to THREE.SphereGeometry.');
35955
+ super(radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength);
35956
+ }
35957
+
35958
+ } // r144
35959
+
35960
+ class TetrahedronBufferGeometry extends TetrahedronGeometry {
35961
+ constructor(radius, detail) {
35962
+ console.warn('THREE.TetrahedronBufferGeometry has been renamed to THREE.TetrahedronGeometry.');
35963
+ super(radius, detail);
35964
+ }
35965
+
35966
+ } // r144
35967
+
35968
+ class TorusBufferGeometry extends TorusGeometry {
35969
+ constructor(radius, tube, radialSegments, tubularSegments, arc) {
35970
+ console.warn('THREE.TorusBufferGeometry has been renamed to THREE.TorusGeometry.');
35971
+ super(radius, tube, radialSegments, tubularSegments, arc);
35972
+ }
35973
+
35974
+ } // r144
35975
+
35976
+ class TorusKnotBufferGeometry extends TorusKnotGeometry {
35977
+ constructor(radius, tube, tubularSegments, radialSegments, p, q) {
35978
+ console.warn('THREE.TorusKnotBufferGeometry has been renamed to THREE.TorusKnotGeometry.');
35979
+ super(radius, tube, tubularSegments, radialSegments, p, q);
35980
+ }
35981
+
35982
+ } // r144
35983
+
35984
+ class TubeBufferGeometry extends TubeGeometry {
35985
+ constructor(path, tubularSegments, radius, radialSegments, closed) {
35986
+ console.warn('THREE.TubeBufferGeometry has been renamed to THREE.TubeGeometry.');
35987
+ super(path, tubularSegments, radius, radialSegments, closed);
35988
+ }
35989
+
35461
35990
  }
35462
35991
 
35463
35992
  if (typeof __THREE_DEVTOOLS__ !== 'undefined') {
@@ -35508,7 +36037,7 @@ exports.BooleanKeyframeTrack = BooleanKeyframeTrack;
35508
36037
  exports.Box2 = Box2;
35509
36038
  exports.Box3 = Box3;
35510
36039
  exports.Box3Helper = Box3Helper;
35511
- exports.BoxBufferGeometry = BoxGeometry;
36040
+ exports.BoxBufferGeometry = BoxBufferGeometry;
35512
36041
  exports.BoxGeometry = BoxGeometry;
35513
36042
  exports.BoxHelper = BoxHelper;
35514
36043
  exports.BufferAttribute = BufferAttribute;
@@ -35519,11 +36048,11 @@ exports.Cache = Cache;
35519
36048
  exports.Camera = Camera;
35520
36049
  exports.CameraHelper = CameraHelper;
35521
36050
  exports.CanvasTexture = CanvasTexture;
35522
- exports.CapsuleBufferGeometry = CapsuleGeometry;
36051
+ exports.CapsuleBufferGeometry = CapsuleBufferGeometry;
35523
36052
  exports.CapsuleGeometry = CapsuleGeometry;
35524
36053
  exports.CatmullRomCurve3 = CatmullRomCurve3;
35525
36054
  exports.CineonToneMapping = CineonToneMapping;
35526
- exports.CircleBufferGeometry = CircleGeometry;
36055
+ exports.CircleBufferGeometry = CircleBufferGeometry;
35527
36056
  exports.CircleGeometry = CircleGeometry;
35528
36057
  exports.ClampToEdgeWrapping = ClampToEdgeWrapping;
35529
36058
  exports.Clock = Clock;
@@ -35532,7 +36061,7 @@ exports.ColorKeyframeTrack = ColorKeyframeTrack;
35532
36061
  exports.ColorManagement = ColorManagement;
35533
36062
  exports.CompressedTexture = CompressedTexture;
35534
36063
  exports.CompressedTextureLoader = CompressedTextureLoader;
35535
- exports.ConeBufferGeometry = ConeGeometry;
36064
+ exports.ConeBufferGeometry = ConeBufferGeometry;
35536
36065
  exports.ConeGeometry = ConeGeometry;
35537
36066
  exports.CubeCamera = CubeCamera;
35538
36067
  exports.CubeReflectionMapping = CubeReflectionMapping;
@@ -35551,7 +36080,7 @@ exports.Curve = Curve;
35551
36080
  exports.CurvePath = CurvePath;
35552
36081
  exports.CustomBlending = CustomBlending;
35553
36082
  exports.CustomToneMapping = CustomToneMapping;
35554
- exports.CylinderBufferGeometry = CylinderGeometry;
36083
+ exports.CylinderBufferGeometry = CylinderBufferGeometry;
35555
36084
  exports.CylinderGeometry = CylinderGeometry;
35556
36085
  exports.Cylindrical = Cylindrical;
35557
36086
  exports.Data3DTexture = Data3DTexture;
@@ -35570,7 +36099,7 @@ exports.DepthTexture = DepthTexture;
35570
36099
  exports.DirectionalLight = DirectionalLight;
35571
36100
  exports.DirectionalLightHelper = DirectionalLightHelper;
35572
36101
  exports.DiscreteInterpolant = DiscreteInterpolant;
35573
- exports.DodecahedronBufferGeometry = DodecahedronGeometry;
36102
+ exports.DodecahedronBufferGeometry = DodecahedronBufferGeometry;
35574
36103
  exports.DodecahedronGeometry = DodecahedronGeometry;
35575
36104
  exports.DoubleSide = DoubleSide;
35576
36105
  exports.DstAlphaFactor = DstAlphaFactor;
@@ -35586,18 +36115,15 @@ exports.EquirectangularReflectionMapping = EquirectangularReflectionMapping;
35586
36115
  exports.EquirectangularRefractionMapping = EquirectangularRefractionMapping;
35587
36116
  exports.Euler = Euler;
35588
36117
  exports.EventDispatcher = EventDispatcher;
35589
- exports.ExtrudeBufferGeometry = ExtrudeGeometry;
36118
+ exports.ExtrudeBufferGeometry = ExtrudeBufferGeometry;
35590
36119
  exports.ExtrudeGeometry = ExtrudeGeometry;
35591
36120
  exports.FileLoader = FileLoader;
35592
- exports.FlatShading = FlatShading;
35593
36121
  exports.Float16BufferAttribute = Float16BufferAttribute;
35594
36122
  exports.Float32BufferAttribute = Float32BufferAttribute;
35595
36123
  exports.Float64BufferAttribute = Float64BufferAttribute;
35596
36124
  exports.FloatType = FloatType;
35597
36125
  exports.Fog = Fog;
35598
36126
  exports.FogExp2 = FogExp2;
35599
- exports.Font = Font;
35600
- exports.FontLoader = FontLoader;
35601
36127
  exports.FramebufferTexture = FramebufferTexture;
35602
36128
  exports.FrontSide = FrontSide;
35603
36129
  exports.Frustum = Frustum;
@@ -35614,7 +36140,7 @@ exports.HalfFloatType = HalfFloatType;
35614
36140
  exports.HemisphereLight = HemisphereLight;
35615
36141
  exports.HemisphereLightHelper = HemisphereLightHelper;
35616
36142
  exports.HemisphereLightProbe = HemisphereLightProbe;
35617
- exports.IcosahedronBufferGeometry = IcosahedronGeometry;
36143
+ exports.IcosahedronBufferGeometry = IcosahedronBufferGeometry;
35618
36144
  exports.IcosahedronGeometry = IcosahedronGeometry;
35619
36145
  exports.ImageBitmapLoader = ImageBitmapLoader;
35620
36146
  exports.ImageLoader = ImageLoader;
@@ -35640,7 +36166,7 @@ exports.InvertStencilOp = InvertStencilOp;
35640
36166
  exports.KeepStencilOp = KeepStencilOp;
35641
36167
  exports.KeyframeTrack = KeyframeTrack;
35642
36168
  exports.LOD = LOD;
35643
- exports.LatheBufferGeometry = LatheGeometry;
36169
+ exports.LatheBufferGeometry = LatheBufferGeometry;
35644
36170
  exports.LatheGeometry = LatheGeometry;
35645
36171
  exports.Layers = Layers;
35646
36172
  exports.LessDepth = LessDepth;
@@ -35715,7 +36241,7 @@ exports.NumberKeyframeTrack = NumberKeyframeTrack;
35715
36241
  exports.Object3D = Object3D;
35716
36242
  exports.ObjectLoader = ObjectLoader;
35717
36243
  exports.ObjectSpaceNormalMap = ObjectSpaceNormalMap;
35718
- exports.OctahedronBufferGeometry = OctahedronGeometry;
36244
+ exports.OctahedronBufferGeometry = OctahedronBufferGeometry;
35719
36245
  exports.OctahedronGeometry = OctahedronGeometry;
35720
36246
  exports.OneFactor = OneFactor;
35721
36247
  exports.OneMinusDstAlphaFactor = OneMinusDstAlphaFactor;
@@ -35726,11 +36252,10 @@ exports.OrthographicCamera = OrthographicCamera;
35726
36252
  exports.PCFShadowMap = PCFShadowMap;
35727
36253
  exports.PCFSoftShadowMap = PCFSoftShadowMap;
35728
36254
  exports.PMREMGenerator = PMREMGenerator;
35729
- exports.ParametricGeometry = ParametricGeometry;
35730
36255
  exports.Path = Path;
35731
36256
  exports.PerspectiveCamera = PerspectiveCamera;
35732
36257
  exports.Plane = Plane;
35733
- exports.PlaneBufferGeometry = PlaneGeometry;
36258
+ exports.PlaneBufferGeometry = PlaneBufferGeometry;
35734
36259
  exports.PlaneGeometry = PlaneGeometry;
35735
36260
  exports.PlaneHelper = PlaneHelper;
35736
36261
  exports.PointLight = PointLight;
@@ -35738,7 +36263,7 @@ exports.PointLightHelper = PointLightHelper;
35738
36263
  exports.Points = Points;
35739
36264
  exports.PointsMaterial = PointsMaterial;
35740
36265
  exports.PolarGridHelper = PolarGridHelper;
35741
- exports.PolyhedronBufferGeometry = PolyhedronGeometry;
36266
+ exports.PolyhedronBufferGeometry = PolyhedronBufferGeometry;
35742
36267
  exports.PolyhedronGeometry = PolyhedronGeometry;
35743
36268
  exports.PositionalAudio = PositionalAudio;
35744
36269
  exports.PropertyBinding = PropertyBinding;
@@ -35791,7 +36316,7 @@ exports.ReinhardToneMapping = ReinhardToneMapping;
35791
36316
  exports.RepeatWrapping = RepeatWrapping;
35792
36317
  exports.ReplaceStencilOp = ReplaceStencilOp;
35793
36318
  exports.ReverseSubtractEquation = ReverseSubtractEquation;
35794
- exports.RingBufferGeometry = RingGeometry;
36319
+ exports.RingBufferGeometry = RingBufferGeometry;
35795
36320
  exports.RingGeometry = RingGeometry;
35796
36321
  exports.SRGBColorSpace = SRGBColorSpace;
35797
36322
  exports.Scene = Scene;
@@ -35800,7 +36325,7 @@ exports.ShaderLib = ShaderLib;
35800
36325
  exports.ShaderMaterial = ShaderMaterial;
35801
36326
  exports.ShadowMaterial = ShadowMaterial;
35802
36327
  exports.Shape = Shape;
35803
- exports.ShapeBufferGeometry = ShapeGeometry;
36328
+ exports.ShapeBufferGeometry = ShapeBufferGeometry;
35804
36329
  exports.ShapeGeometry = ShapeGeometry;
35805
36330
  exports.ShapePath = ShapePath;
35806
36331
  exports.ShapeUtils = ShapeUtils;
@@ -35808,10 +36333,9 @@ exports.ShortType = ShortType;
35808
36333
  exports.Skeleton = Skeleton;
35809
36334
  exports.SkeletonHelper = SkeletonHelper;
35810
36335
  exports.SkinnedMesh = SkinnedMesh;
35811
- exports.SmoothShading = SmoothShading;
35812
36336
  exports.Source = Source;
35813
36337
  exports.Sphere = Sphere;
35814
- exports.SphereBufferGeometry = SphereGeometry;
36338
+ exports.SphereBufferGeometry = SphereBufferGeometry;
35815
36339
  exports.SphereGeometry = SphereGeometry;
35816
36340
  exports.Spherical = Spherical;
35817
36341
  exports.SphericalHarmonics3 = SphericalHarmonics3;
@@ -35835,20 +36359,19 @@ exports.SubtractEquation = SubtractEquation;
35835
36359
  exports.SubtractiveBlending = SubtractiveBlending;
35836
36360
  exports.TOUCH = TOUCH;
35837
36361
  exports.TangentSpaceNormalMap = TangentSpaceNormalMap;
35838
- exports.TetrahedronBufferGeometry = TetrahedronGeometry;
36362
+ exports.TetrahedronBufferGeometry = TetrahedronBufferGeometry;
35839
36363
  exports.TetrahedronGeometry = TetrahedronGeometry;
35840
- exports.TextGeometry = TextGeometry;
35841
36364
  exports.Texture = Texture;
35842
36365
  exports.TextureLoader = TextureLoader;
35843
- exports.TorusBufferGeometry = TorusGeometry;
36366
+ exports.TorusBufferGeometry = TorusBufferGeometry;
35844
36367
  exports.TorusGeometry = TorusGeometry;
35845
- exports.TorusKnotBufferGeometry = TorusKnotGeometry;
36368
+ exports.TorusKnotBufferGeometry = TorusKnotBufferGeometry;
35846
36369
  exports.TorusKnotGeometry = TorusKnotGeometry;
35847
36370
  exports.Triangle = Triangle;
35848
36371
  exports.TriangleFanDrawMode = TriangleFanDrawMode;
35849
36372
  exports.TriangleStripDrawMode = TriangleStripDrawMode;
35850
36373
  exports.TrianglesDrawMode = TrianglesDrawMode;
35851
- exports.TubeBufferGeometry = TubeGeometry;
36374
+ exports.TubeBufferGeometry = TubeBufferGeometry;
35852
36375
  exports.TubeGeometry = TubeGeometry;
35853
36376
  exports.UVMapping = UVMapping;
35854
36377
  exports.Uint16BufferAttribute = Uint16BufferAttribute;
@@ -35856,6 +36379,7 @@ exports.Uint32BufferAttribute = Uint32BufferAttribute;
35856
36379
  exports.Uint8BufferAttribute = Uint8BufferAttribute;
35857
36380
  exports.Uint8ClampedBufferAttribute = Uint8ClampedBufferAttribute;
35858
36381
  exports.Uniform = Uniform;
36382
+ exports.UniformsGroup = UniformsGroup;
35859
36383
  exports.UniformsLib = UniformsLib;
35860
36384
  exports.UniformsUtils = UniformsUtils;
35861
36385
  exports.UnsignedByteType = UnsignedByteType;