super-three 0.155.0 → 0.157.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 (268) hide show
  1. package/build/three.cjs +361 -324
  2. package/build/three.js +361 -324
  3. package/build/three.min.js +2 -2
  4. package/build/three.module.js +354 -323
  5. package/build/three.module.min.js +1 -1
  6. package/examples/jsm/capabilities/WebGL.js +17 -0
  7. package/examples/jsm/controls/DragControls.js +3 -2
  8. package/examples/jsm/controls/OrbitControls.js +13 -5
  9. package/examples/jsm/csm/CSMShader.js +59 -21
  10. package/examples/jsm/exporters/EXRExporter.js +102 -24
  11. package/examples/jsm/exporters/GLTFExporter.js +1 -1
  12. package/examples/jsm/libs/rhino3dm/rhino3dm.js +8726 -4
  13. package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +8737 -4
  14. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  15. package/examples/jsm/libs/tween.module.js +790 -735
  16. package/examples/jsm/libs/utif.module.js +1644 -1558
  17. package/examples/jsm/lights/LightProbeGenerator.js +37 -3
  18. package/examples/jsm/lines/LineMaterial.js +90 -156
  19. package/examples/jsm/loaders/3DMLoader.js +378 -104
  20. package/examples/jsm/loaders/DDSLoader.js +46 -3
  21. package/examples/jsm/loaders/EXRLoader.js +4 -4
  22. package/examples/jsm/loaders/FBXLoader.js +2 -0
  23. package/examples/jsm/loaders/GLTFLoader.js +18 -8
  24. package/examples/jsm/loaders/KTX2Loader.js +126 -77
  25. package/examples/jsm/loaders/LDrawLoader.js +22 -16
  26. package/examples/jsm/loaders/LogLuvLoader.js +2 -2
  27. package/examples/jsm/loaders/MMDLoader.js +10 -7
  28. package/examples/jsm/loaders/RGBELoader.js +48 -66
  29. package/examples/jsm/loaders/STLLoader.js +7 -0
  30. package/examples/jsm/loaders/USDZLoader.js +215 -12
  31. package/examples/jsm/materials/MeshGouraudMaterial.js +22 -18
  32. package/examples/jsm/nodes/Nodes.js +8 -1
  33. package/examples/jsm/nodes/accessors/BitangentNode.js +1 -1
  34. package/examples/jsm/nodes/accessors/BufferAttributeNode.js +30 -4
  35. package/examples/jsm/nodes/accessors/BufferNode.js +1 -1
  36. package/examples/jsm/nodes/accessors/CameraNode.js +1 -1
  37. package/examples/jsm/nodes/accessors/CubeTextureNode.js +19 -4
  38. package/examples/jsm/nodes/accessors/ExtendedMaterialNode.js +4 -5
  39. package/examples/jsm/nodes/accessors/InstanceNode.js +2 -2
  40. package/examples/jsm/nodes/accessors/LineMaterialNode.js +29 -0
  41. package/examples/jsm/nodes/accessors/MaterialNode.js +23 -13
  42. package/examples/jsm/nodes/accessors/MaterialReferenceNode.js +12 -9
  43. package/examples/jsm/nodes/accessors/ModelNode.js +1 -1
  44. package/examples/jsm/nodes/accessors/ModelViewProjectionNode.js +5 -4
  45. package/examples/jsm/nodes/accessors/MorphNode.js +4 -4
  46. package/examples/jsm/nodes/accessors/NormalNode.js +1 -1
  47. package/examples/jsm/nodes/accessors/Object3DNode.js +3 -3
  48. package/examples/jsm/nodes/accessors/PointUVNode.js +1 -1
  49. package/examples/jsm/nodes/accessors/PositionNode.js +1 -1
  50. package/examples/jsm/nodes/accessors/ReferenceNode.js +13 -7
  51. package/examples/jsm/nodes/accessors/ReflectVectorNode.js +2 -2
  52. package/examples/jsm/nodes/accessors/SceneNode.js +2 -2
  53. package/examples/jsm/nodes/accessors/SkinningNode.js +2 -2
  54. package/examples/jsm/nodes/accessors/StorageBufferNode.js +1 -1
  55. package/examples/jsm/nodes/accessors/TangentNode.js +1 -1
  56. package/examples/jsm/nodes/accessors/TextureBicubicNode.js +2 -2
  57. package/examples/jsm/nodes/accessors/TextureNode.js +18 -8
  58. package/examples/jsm/nodes/accessors/TextureSizeNode.js +2 -2
  59. package/examples/jsm/nodes/accessors/TextureStoreNode.js +29 -0
  60. package/examples/jsm/nodes/accessors/UVNode.js +1 -1
  61. package/examples/jsm/nodes/accessors/UserDataNode.js +2 -2
  62. package/examples/jsm/nodes/code/CodeNode.js +1 -1
  63. package/examples/jsm/nodes/code/ExpressionNode.js +1 -1
  64. package/examples/jsm/nodes/code/FunctionCallNode.js +1 -1
  65. package/examples/jsm/nodes/code/FunctionNode.js +18 -7
  66. package/examples/jsm/nodes/code/ScriptableNode.js +2 -2
  67. package/examples/jsm/nodes/code/ScriptableValueNode.js +2 -2
  68. package/examples/jsm/nodes/core/ArrayUniformNode.js +1 -1
  69. package/examples/jsm/nodes/core/AttributeNode.js +3 -3
  70. package/examples/jsm/nodes/core/BypassNode.js +1 -1
  71. package/examples/jsm/nodes/core/CacheNode.js +1 -1
  72. package/examples/jsm/nodes/core/ConstNode.js +1 -1
  73. package/examples/jsm/nodes/core/ContextNode.js +2 -2
  74. package/examples/jsm/nodes/core/IndexNode.js +1 -1
  75. package/examples/jsm/nodes/core/InputNode.js +1 -1
  76. package/examples/jsm/nodes/core/Node.js +45 -14
  77. package/examples/jsm/nodes/core/NodeBuilder.js +83 -15
  78. package/examples/jsm/nodes/core/NodeFrame.js +37 -14
  79. package/examples/jsm/nodes/core/NodeUniform.js +1 -1
  80. package/examples/jsm/nodes/core/OutputStructNode.js +62 -0
  81. package/examples/jsm/nodes/core/PropertyNode.js +3 -1
  82. package/examples/jsm/nodes/core/StackNode.js +5 -5
  83. package/examples/jsm/nodes/core/StructTypeNode.js +24 -0
  84. package/examples/jsm/nodes/core/TempNode.js +1 -1
  85. package/examples/jsm/nodes/core/UniformNode.js +3 -1
  86. package/examples/jsm/nodes/core/VarNode.js +1 -1
  87. package/examples/jsm/nodes/core/VaryingNode.js +1 -1
  88. package/examples/jsm/nodes/core/constants.js +1 -1
  89. package/examples/jsm/nodes/display/BlendModeNode.js +2 -2
  90. package/examples/jsm/nodes/display/BumpMapNode.js +2 -2
  91. package/examples/jsm/nodes/display/ColorAdjustmentNode.js +2 -2
  92. package/examples/jsm/nodes/display/ColorSpaceNode.js +2 -2
  93. package/examples/jsm/nodes/display/FrontFacingNode.js +1 -1
  94. package/examples/jsm/nodes/display/NormalMapNode.js +2 -2
  95. package/examples/jsm/nodes/display/PosterizeNode.js +2 -2
  96. package/examples/jsm/nodes/display/ToneMappingNode.js +2 -2
  97. package/examples/jsm/nodes/display/ViewportDepthNode.js +2 -2
  98. package/examples/jsm/nodes/display/ViewportDepthTextureNode.js +1 -1
  99. package/examples/jsm/nodes/display/ViewportNode.js +21 -7
  100. package/examples/jsm/nodes/display/ViewportSharedTextureNode.js +1 -1
  101. package/examples/jsm/nodes/display/ViewportTextureNode.js +1 -1
  102. package/examples/jsm/nodes/fog/FogExp2Node.js +2 -2
  103. package/examples/jsm/nodes/fog/FogNode.js +2 -2
  104. package/examples/jsm/nodes/fog/FogRangeNode.js +2 -2
  105. package/examples/jsm/nodes/geometry/RangeNode.js +2 -2
  106. package/examples/jsm/nodes/gpgpu/ComputeNode.js +1 -1
  107. package/examples/jsm/nodes/lighting/AONode.js +2 -2
  108. package/examples/jsm/nodes/lighting/AmbientLightNode.js +3 -3
  109. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +4 -4
  110. package/examples/jsm/nodes/lighting/DirectionalLightNode.js +4 -4
  111. package/examples/jsm/nodes/lighting/EnvironmentNode.js +2 -2
  112. package/examples/jsm/nodes/lighting/HemisphereLightNode.js +3 -3
  113. package/examples/jsm/nodes/lighting/IESSpotLightNode.js +2 -2
  114. package/examples/jsm/nodes/lighting/LightNode.js +2 -2
  115. package/examples/jsm/nodes/lighting/LightingContextNode.js +3 -3
  116. package/examples/jsm/nodes/lighting/LightingNode.js +1 -1
  117. package/examples/jsm/nodes/lighting/LightsNode.js +4 -4
  118. package/examples/jsm/nodes/lighting/PointLightNode.js +3 -3
  119. package/examples/jsm/nodes/lighting/SpotLightNode.js +4 -4
  120. package/examples/jsm/nodes/materials/Line2NodeMaterial.js +449 -0
  121. package/examples/jsm/nodes/materials/LineBasicNodeMaterial.js +1 -1
  122. package/examples/jsm/nodes/materials/LineDashedNodeMaterial.js +54 -0
  123. package/examples/jsm/nodes/materials/Materials.js +2 -0
  124. package/examples/jsm/nodes/materials/MeshBasicNodeMaterial.js +1 -1
  125. package/examples/jsm/nodes/materials/MeshLambertNodeMaterial.js +2 -2
  126. package/examples/jsm/nodes/materials/MeshNormalNodeMaterial.js +2 -2
  127. package/examples/jsm/nodes/materials/MeshPhongNodeMaterial.js +3 -3
  128. package/examples/jsm/nodes/materials/MeshPhysicalNodeMaterial.js +6 -6
  129. package/examples/jsm/nodes/materials/MeshStandardNodeMaterial.js +3 -3
  130. package/examples/jsm/nodes/materials/NodeMaterial.js +39 -29
  131. package/examples/jsm/nodes/materials/PointsNodeMaterial.js +1 -1
  132. package/examples/jsm/nodes/materials/SpriteNodeMaterial.js +2 -2
  133. package/examples/jsm/nodes/math/CondNode.js +1 -1
  134. package/examples/jsm/nodes/math/HashNode.js +34 -0
  135. package/examples/jsm/nodes/math/MathNode.js +2 -2
  136. package/examples/jsm/nodes/math/OperatorNode.js +1 -1
  137. package/examples/jsm/nodes/procedural/CheckerNode.js +3 -3
  138. package/examples/jsm/nodes/shadernode/ShaderNode.js +85 -28
  139. package/examples/jsm/nodes/utils/ArrayElementNode.js +1 -1
  140. package/examples/jsm/nodes/utils/ConvertNode.js +1 -1
  141. package/examples/jsm/nodes/utils/DiscardNode.js +1 -1
  142. package/examples/jsm/nodes/utils/EquirectUVNode.js +2 -2
  143. package/examples/jsm/nodes/utils/JoinNode.js +1 -1
  144. package/examples/jsm/nodes/utils/LoopNode.js +11 -11
  145. package/examples/jsm/nodes/utils/MatcapUVNode.js +2 -2
  146. package/examples/jsm/nodes/utils/MaxMipLevelNode.js +1 -1
  147. package/examples/jsm/nodes/utils/OscNode.js +2 -2
  148. package/examples/jsm/nodes/utils/PackingNode.js +2 -2
  149. package/examples/jsm/nodes/utils/RemapNode.js +2 -2
  150. package/examples/jsm/nodes/utils/RotateUVNode.js +2 -2
  151. package/examples/jsm/nodes/utils/SetNode.js +62 -0
  152. package/examples/jsm/nodes/utils/SpecularMIPLevelNode.js +2 -2
  153. package/examples/jsm/nodes/utils/SplitNode.js +2 -2
  154. package/examples/jsm/nodes/utils/SpriteSheetUVNode.js +2 -2
  155. package/examples/jsm/nodes/utils/TimerNode.js +2 -2
  156. package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +2 -2
  157. package/examples/jsm/objects/Sky.js +1 -3
  158. package/examples/jsm/postprocessing/FilmPass.js +3 -5
  159. package/examples/jsm/postprocessing/OutputPass.js +3 -2
  160. package/examples/jsm/postprocessing/RenderPass.js +30 -12
  161. package/examples/jsm/postprocessing/SAOPass.js +23 -98
  162. package/examples/jsm/postprocessing/SSAOPass.js +10 -30
  163. package/examples/jsm/renderers/common/Backend.js +11 -8
  164. package/examples/jsm/renderers/common/Background.js +2 -2
  165. package/examples/jsm/renderers/common/Binding.js +6 -0
  166. package/examples/jsm/renderers/common/Bindings.js +4 -5
  167. package/examples/jsm/renderers/common/Pipelines.js +9 -9
  168. package/examples/jsm/renderers/common/RenderContext.js +3 -0
  169. package/examples/jsm/renderers/common/RenderContexts.js +26 -1
  170. package/examples/jsm/renderers/common/RenderList.js +12 -4
  171. package/examples/jsm/renderers/common/RenderObject.js +43 -15
  172. package/examples/jsm/renderers/common/RenderObjects.js +8 -14
  173. package/examples/jsm/renderers/common/Renderer.js +52 -16
  174. package/examples/jsm/renderers/common/SampledTexture.js +6 -3
  175. package/examples/jsm/renderers/common/Sampler.js +1 -1
  176. package/examples/jsm/renderers/common/StorageBuffer.js +1 -1
  177. package/examples/jsm/renderers/common/StorageTexture.js +19 -0
  178. package/examples/jsm/renderers/common/Textures.js +166 -21
  179. package/examples/jsm/renderers/common/nodes/NodeBuilderState.js +35 -0
  180. package/examples/jsm/renderers/common/nodes/NodeSampledTexture.js +21 -11
  181. package/examples/jsm/renderers/common/nodes/NodeSampler.js +1 -7
  182. package/examples/jsm/renderers/common/nodes/Nodes.js +79 -18
  183. package/examples/jsm/renderers/webgl/WebGLBackend.js +702 -0
  184. package/examples/jsm/renderers/webgl/nodes/GLSLNodeBuilder.js +207 -20
  185. package/examples/jsm/renderers/webgl/utils/WebGLAttributeUtils.js +84 -0
  186. package/examples/jsm/renderers/webgl/utils/WebGLExtensions.js +26 -0
  187. package/examples/jsm/renderers/webgl/utils/WebGLState.js +529 -0
  188. package/examples/jsm/renderers/webgl/utils/WebGLTextureUtils.js +212 -0
  189. package/examples/jsm/renderers/webgl/utils/WebGLUtils.js +242 -0
  190. package/examples/jsm/renderers/webgl-legacy/nodes/GLSL1NodeBuilder.js +340 -0
  191. package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/WebGLNodeBuilder.js +4 -4
  192. package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/WebGLNodes.js +14 -2
  193. package/examples/jsm/renderers/webgpu/WebGPUBackend.js +282 -43
  194. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +18 -2
  195. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeBuilder.js +93 -60
  196. package/examples/jsm/renderers/webgpu/nodes/WGSLNodeFunction.js +2 -2
  197. package/examples/jsm/renderers/webgpu/utils/WebGPUBindingUtils.js +15 -2
  198. package/examples/jsm/renderers/webgpu/utils/WebGPUPipelineUtils.js +39 -14
  199. package/examples/jsm/renderers/webgpu/utils/WebGPUTexturePassUtils.js +285 -0
  200. package/examples/jsm/renderers/webgpu/utils/WebGPUTextureUtils.js +205 -284
  201. package/examples/jsm/renderers/webgpu/utils/WebGPUUtils.js +6 -5
  202. package/examples/jsm/shaders/FilmShader.js +11 -54
  203. package/examples/jsm/shaders/GammaCorrectionShader.js +1 -1
  204. package/examples/jsm/shaders/MMDToonShader.js +4 -4
  205. package/examples/jsm/shaders/OutputShader.js +2 -2
  206. package/examples/jsm/shaders/SAOShader.js +0 -13
  207. package/examples/jsm/shaders/SSAOShader.js +33 -26
  208. package/examples/jsm/shaders/SubsurfaceScatteringShader.js +6 -6
  209. package/examples/jsm/utils/BufferGeometryUtils.js +6 -4
  210. package/package.json +1 -1
  211. package/src/Three.js +1 -2
  212. package/src/animation/AnimationUtils.js +3 -20
  213. package/src/animation/KeyframeTrack.js +8 -8
  214. package/src/audio/Audio.js +6 -0
  215. package/src/cameras/Camera.js +1 -5
  216. package/src/cameras/CubeCamera.js +14 -8
  217. package/src/constants.js +10 -1
  218. package/src/core/Object3D.js +1 -14
  219. package/src/core/RenderTarget.js +16 -7
  220. package/src/core/UniformsGroup.js +2 -2
  221. package/src/extras/core/CurvePath.js +4 -1
  222. package/src/loaders/DataTextureLoader.js +0 -2
  223. package/src/loaders/MaterialLoader.js +1 -1
  224. package/src/loaders/ObjectLoader.js +6 -0
  225. package/src/materials/Material.js +10 -10
  226. package/src/math/Color.js +1 -5
  227. package/src/math/ColorManagement.js +82 -60
  228. package/src/math/Vector2.js +2 -2
  229. package/src/math/Vector3.js +3 -3
  230. package/src/math/Vector4.js +4 -4
  231. package/src/objects/Line.js +1 -1
  232. package/src/objects/Mesh.js +1 -1
  233. package/src/objects/Points.js +1 -1
  234. package/src/objects/Sprite.js +2 -2
  235. package/src/renderers/WebGLRenderer.js +42 -51
  236. package/src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js +1 -1
  237. package/src/renderers/shaders/ShaderChunk/clearcoat_normal_fragment_begin.glsl.js +1 -1
  238. package/src/renderers/shaders/ShaderChunk/colorspace_pars_fragment.glsl.js +35 -2
  239. package/src/renderers/shaders/ShaderChunk/common.glsl.js +0 -9
  240. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +19 -15
  241. package/src/renderers/shaders/ShaderChunk/lights_fragment_end.glsl.js +2 -2
  242. package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +4 -4
  243. package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +3 -3
  244. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +11 -6
  245. package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +4 -4
  246. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +1 -1
  247. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +16 -16
  248. package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +3 -3
  249. package/src/renderers/shaders/ShaderChunk/map_fragment.glsl.js +11 -1
  250. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +1 -1
  251. package/src/renderers/shaders/ShaderLib/background.glsl.js +8 -0
  252. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +1 -1
  253. package/src/renderers/shaders/UniformsUtils.js +2 -2
  254. package/src/renderers/webgl/WebGLBackground.js +9 -17
  255. package/src/renderers/webgl/WebGLLights.js +14 -3
  256. package/src/renderers/webgl/WebGLProgram.js +36 -5
  257. package/src/renderers/webgl/WebGLPrograms.js +9 -1
  258. package/src/renderers/webgl/WebGLTextures.js +19 -8
  259. package/src/renderers/webgl/WebGLUtils.js +25 -20
  260. package/src/scenes/Fog.js +1 -0
  261. package/src/scenes/FogExp2.js +1 -0
  262. package/src/textures/Source.js +2 -2
  263. package/src/textures/Texture.js +2 -2
  264. package/src/utils.js +9 -1
  265. package/examples/jsm/renderers/webgpu/utils/WebGPUTextureMipmapUtils.js +0 -163
  266. package/src/lights/AmbientLightProbe.js +0 -21
  267. package/src/lights/HemisphereLightProbe.js +0 -30
  268. /package/examples/jsm/renderers/{webgl → webgl-legacy}/nodes/SlotNode.js +0 -0
package/build/three.js CHANGED
@@ -10,7 +10,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
10
10
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {}));
11
11
  })(this, (function (exports) { 'use strict';
12
12
 
13
- const REVISION = '155';
13
+ const REVISION = '157';
14
14
 
15
15
  const MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2, ROTATE: 0, DOLLY: 1, PAN: 2 };
16
16
  const TOUCH = { ROTATE: 0, PAN: 1, DOLLY_PAN: 2, DOLLY_ROTATE: 3 };
@@ -134,6 +134,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
134
134
  const RGBA_ASTC_12x10_Format = 37820;
135
135
  const RGBA_ASTC_12x12_Format = 37821;
136
136
  const RGBA_BPTC_Format = 36492;
137
+ const RGB_BPTC_SIGNED_Format = 36494;
138
+ const RGB_BPTC_UNSIGNED_Format = 36495;
137
139
  const RED_RGTC1_Format = 36283;
138
140
  const SIGNED_RED_RGTC1_Format = 36284;
139
141
  const RED_GREEN_RGTC2_Format = 36285;
@@ -166,6 +168,13 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
166
168
  const SRGBColorSpace = 'srgb';
167
169
  const LinearSRGBColorSpace = 'srgb-linear';
168
170
  const DisplayP3ColorSpace = 'display-p3';
171
+ const LinearDisplayP3ColorSpace = 'display-p3-linear';
172
+
173
+ const LinearTransfer = 'linear';
174
+ const SRGBTransfer = 'srgb';
175
+
176
+ const Rec709Primaries = 'rec709';
177
+ const P3Primaries = 'p3';
169
178
 
170
179
  const ZeroStencilOp = 0;
171
180
  const KeepStencilOp = 7680;
@@ -926,8 +935,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
926
935
 
927
936
  roundToZero() {
928
937
 
929
- this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
930
- this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
938
+ this.x = Math.trunc( this.x );
939
+ this.y = Math.trunc( this.y );
931
940
 
932
941
  return this;
933
942
 
@@ -1535,6 +1544,14 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
1535
1544
 
1536
1545
  }
1537
1546
 
1547
+ function createCanvasElement() {
1548
+
1549
+ const canvas = createElementNS( 'canvas' );
1550
+ canvas.style.display = 'block';
1551
+ return canvas;
1552
+
1553
+ }
1554
+
1538
1555
  const _cache = {};
1539
1556
 
1540
1557
  function warnOnce( message ) {
@@ -1547,18 +1564,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
1547
1564
 
1548
1565
  }
1549
1566
 
1550
- function SRGBToLinear( c ) {
1551
-
1552
- return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
1553
-
1554
- }
1555
-
1556
- function LinearToSRGB( c ) {
1557
-
1558
- return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
1559
-
1560
- }
1561
-
1562
1567
  /**
1563
1568
  * Matrices converting P3 <-> Rec. 709 primaries, without gamut mapping
1564
1569
  * or clipping. Based on W3C specifications for sRGB and Display P3,
@@ -1571,50 +1576,57 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
1571
1576
  * - http://www.russellcottrell.com/photo/matrixCalculator.htm
1572
1577
  */
1573
1578
 
1574
- const LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().fromArray( [
1575
- 0.8224621, 0.0331941, 0.0170827,
1576
- 0.1775380, 0.9668058, 0.0723974,
1577
- - 0.0000001, 0.0000001, 0.9105199
1578
- ] );
1579
-
1580
- const LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().fromArray( [
1581
- 1.2249401, - 0.0420569, - 0.0196376,
1582
- - 0.2249404, 1.0420571, - 0.0786361,
1583
- 0.0000001, 0.0000000, 1.0982735
1584
- ] );
1585
-
1586
- function DisplayP3ToLinearSRGB( color ) {
1587
-
1588
- // Display P3 uses the sRGB transfer functions
1589
- return color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB );
1590
-
1591
- }
1592
-
1593
- function LinearSRGBToDisplayP3( color ) {
1594
-
1595
- // Display P3 uses the sRGB transfer functions
1596
- return color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB();
1579
+ const LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = /*@__PURE__*/ new Matrix3().set(
1580
+ 0.8224621, 0.177538, 0.0,
1581
+ 0.0331941, 0.9668058, 0.0,
1582
+ 0.0170827, 0.0723974, 0.9105199,
1583
+ );
1597
1584
 
1598
- }
1585
+ const LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = /*@__PURE__*/ new Matrix3().set(
1586
+ 1.2249401, - 0.2249404, 0.0,
1587
+ - 0.0420569, 1.0420571, 0.0,
1588
+ - 0.0196376, - 0.0786361, 1.0982735
1589
+ );
1599
1590
 
1600
- // Conversions from <source> to Linear-sRGB reference space.
1601
- const TO_LINEAR = {
1602
- [ LinearSRGBColorSpace ]: ( color ) => color,
1603
- [ SRGBColorSpace ]: ( color ) => color.convertSRGBToLinear(),
1604
- [ DisplayP3ColorSpace ]: DisplayP3ToLinearSRGB,
1591
+ /**
1592
+ * Defines supported color spaces by transfer function and primaries,
1593
+ * and provides conversions to/from the Linear-sRGB reference space.
1594
+ */
1595
+ const COLOR_SPACES = {
1596
+ [ LinearSRGBColorSpace ]: {
1597
+ transfer: LinearTransfer,
1598
+ primaries: Rec709Primaries,
1599
+ toReference: ( color ) => color,
1600
+ fromReference: ( color ) => color,
1601
+ },
1602
+ [ SRGBColorSpace ]: {
1603
+ transfer: SRGBTransfer,
1604
+ primaries: Rec709Primaries,
1605
+ toReference: ( color ) => color.convertSRGBToLinear(),
1606
+ fromReference: ( color ) => color.convertLinearToSRGB(),
1607
+ },
1608
+ [ LinearDisplayP3ColorSpace ]: {
1609
+ transfer: LinearTransfer,
1610
+ primaries: P3Primaries,
1611
+ toReference: ( color ) => color.applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
1612
+ fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ),
1613
+ },
1614
+ [ DisplayP3ColorSpace ]: {
1615
+ transfer: SRGBTransfer,
1616
+ primaries: P3Primaries,
1617
+ toReference: ( color ) => color.convertSRGBToLinear().applyMatrix3( LINEAR_DISPLAY_P3_TO_LINEAR_SRGB ),
1618
+ fromReference: ( color ) => color.applyMatrix3( LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 ).convertLinearToSRGB(),
1619
+ },
1605
1620
  };
1606
1621
 
1607
- // Conversions to <target> from Linear-sRGB reference space.
1608
- const FROM_LINEAR = {
1609
- [ LinearSRGBColorSpace ]: ( color ) => color,
1610
- [ SRGBColorSpace ]: ( color ) => color.convertLinearToSRGB(),
1611
- [ DisplayP3ColorSpace ]: LinearSRGBToDisplayP3,
1612
- };
1622
+ const SUPPORTED_WORKING_COLOR_SPACES = new Set( [ LinearSRGBColorSpace, LinearDisplayP3ColorSpace ] );
1613
1623
 
1614
1624
  const ColorManagement = {
1615
1625
 
1616
1626
  enabled: true,
1617
1627
 
1628
+ _workingColorSpace: LinearSRGBColorSpace,
1629
+
1618
1630
  get legacyMode() {
1619
1631
 
1620
1632
  console.warn( 'THREE.ColorManagement: .legacyMode=false renamed to .enabled=true in r150.' );
@@ -1633,13 +1645,19 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
1633
1645
 
1634
1646
  get workingColorSpace() {
1635
1647
 
1636
- return LinearSRGBColorSpace;
1648
+ return this._workingColorSpace;
1637
1649
 
1638
1650
  },
1639
1651
 
1640
1652
  set workingColorSpace( colorSpace ) {
1641
1653
 
1642
- console.warn( 'THREE.ColorManagement: .workingColorSpace is readonly.' );
1654
+ if ( ! SUPPORTED_WORKING_COLOR_SPACES.has( colorSpace ) ) {
1655
+
1656
+ throw new Error( `Unsupported working color space, "${ colorSpace }".` );
1657
+
1658
+ }
1659
+
1660
+ this._workingColorSpace = colorSpace;
1643
1661
 
1644
1662
  },
1645
1663
 
@@ -1651,33 +1669,54 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
1651
1669
 
1652
1670
  }
1653
1671
 
1654
- const sourceToLinear = TO_LINEAR[ sourceColorSpace ];
1655
- const targetFromLinear = FROM_LINEAR[ targetColorSpace ];
1672
+ const sourceToReference = COLOR_SPACES[ sourceColorSpace ].toReference;
1673
+ const targetFromReference = COLOR_SPACES[ targetColorSpace ].fromReference;
1656
1674
 
1657
- if ( sourceToLinear === undefined || targetFromLinear === undefined ) {
1675
+ return targetFromReference( sourceToReference( color ) );
1658
1676
 
1659
- throw new Error( `Unsupported color space conversion, "${ sourceColorSpace }" to "${ targetColorSpace }".` );
1677
+ },
1660
1678
 
1661
- }
1679
+ fromWorkingColorSpace: function ( color, targetColorSpace ) {
1662
1680
 
1663
- return targetFromLinear( sourceToLinear( color ) );
1681
+ return this.convert( color, this._workingColorSpace, targetColorSpace );
1664
1682
 
1665
1683
  },
1666
1684
 
1667
- fromWorkingColorSpace: function ( color, targetColorSpace ) {
1685
+ toWorkingColorSpace: function ( color, sourceColorSpace ) {
1668
1686
 
1669
- return this.convert( color, this.workingColorSpace, targetColorSpace );
1687
+ return this.convert( color, sourceColorSpace, this._workingColorSpace );
1670
1688
 
1671
1689
  },
1672
1690
 
1673
- toWorkingColorSpace: function ( color, sourceColorSpace ) {
1691
+ getPrimaries: function ( colorSpace ) {
1674
1692
 
1675
- return this.convert( color, sourceColorSpace, this.workingColorSpace );
1693
+ return COLOR_SPACES[ colorSpace ].primaries;
1694
+
1695
+ },
1696
+
1697
+ getTransfer: function ( colorSpace ) {
1698
+
1699
+ if ( colorSpace === NoColorSpace ) return LinearTransfer;
1700
+
1701
+ return COLOR_SPACES[ colorSpace ].transfer;
1676
1702
 
1677
1703
  },
1678
1704
 
1679
1705
  };
1680
1706
 
1707
+
1708
+ function SRGBToLinear( c ) {
1709
+
1710
+ return ( c < 0.04045 ) ? c * 0.0773993808 : Math.pow( c * 0.9478672986 + 0.0521327014, 2.4 );
1711
+
1712
+ }
1713
+
1714
+ function LinearToSRGB( c ) {
1715
+
1716
+ return ( c < 0.0031308 ) ? c * 12.92 : 1.055 * ( Math.pow( c, 0.41666 ) ) - 0.055;
1717
+
1718
+ }
1719
+
1681
1720
  let _canvas;
1682
1721
 
1683
1722
  class ImageUtils {
@@ -1803,7 +1842,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
1803
1842
 
1804
1843
  }
1805
1844
 
1806
- let sourceId = 0;
1845
+ let _sourceId = 0;
1807
1846
 
1808
1847
  class Source {
1809
1848
 
@@ -1811,7 +1850,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
1811
1850
 
1812
1851
  this.isSource = true;
1813
1852
 
1814
- Object.defineProperty( this, 'id', { value: sourceId ++ } );
1853
+ Object.defineProperty( this, 'id', { value: _sourceId ++ } );
1815
1854
 
1816
1855
  this.uuid = generateUUID();
1817
1856
 
@@ -1926,7 +1965,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
1926
1965
 
1927
1966
  }
1928
1967
 
1929
- let textureId = 0;
1968
+ let _textureId = 0;
1930
1969
 
1931
1970
  class Texture extends EventDispatcher {
1932
1971
 
@@ -1936,7 +1975,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
1936
1975
 
1937
1976
  this.isTexture = true;
1938
1977
 
1939
- Object.defineProperty( this, 'id', { value: textureId ++ } );
1978
+ Object.defineProperty( this, 'id', { value: _textureId ++ } );
1940
1979
 
1941
1980
  this.uuid = generateUUID();
1942
1981
 
@@ -2746,10 +2785,10 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
2746
2785
 
2747
2786
  roundToZero() {
2748
2787
 
2749
- this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
2750
- this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
2751
- this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );
2752
- this.w = ( this.w < 0 ) ? Math.ceil( this.w ) : Math.floor( this.w );
2788
+ this.x = Math.trunc( this.x );
2789
+ this.y = Math.trunc( this.y );
2790
+ this.z = Math.trunc( this.z );
2791
+ this.w = Math.trunc( this.w );
2753
2792
 
2754
2793
  return this;
2755
2794
 
@@ -2917,20 +2956,29 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
2917
2956
 
2918
2957
  }
2919
2958
 
2959
+ options = Object.assign( {
2960
+ generateMipmaps: false,
2961
+ internalFormat: null,
2962
+ minFilter: LinearFilter,
2963
+ depthBuffer: true,
2964
+ stencilBuffer: false,
2965
+ depthTexture: null,
2966
+ samples: 0
2967
+ }, options );
2968
+
2920
2969
  this.texture = new Texture( image, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.colorSpace );
2921
2970
  this.texture.isRenderTargetTexture = true;
2922
2971
 
2923
2972
  this.texture.flipY = false;
2924
- this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
2925
- this.texture.internalFormat = options.internalFormat !== undefined ? options.internalFormat : null;
2926
- this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
2973
+ this.texture.generateMipmaps = options.generateMipmaps;
2974
+ this.texture.internalFormat = options.internalFormat;
2927
2975
 
2928
- this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
2929
- this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
2976
+ this.depthBuffer = options.depthBuffer;
2977
+ this.stencilBuffer = options.stencilBuffer;
2930
2978
 
2931
- this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
2979
+ this.depthTexture = options.depthTexture;
2932
2980
 
2933
- this.samples = options.samples !== undefined ? options.samples : 0;
2981
+ this.samples = options.samples;
2934
2982
 
2935
2983
  }
2936
2984
 
@@ -4257,9 +4305,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
4257
4305
 
4258
4306
  roundToZero() {
4259
4307
 
4260
- this.x = ( this.x < 0 ) ? Math.ceil( this.x ) : Math.floor( this.x );
4261
- this.y = ( this.y < 0 ) ? Math.ceil( this.y ) : Math.floor( this.y );
4262
- this.z = ( this.z < 0 ) ? Math.ceil( this.z ) : Math.floor( this.z );
4308
+ this.x = Math.trunc( this.x );
4309
+ this.y = Math.trunc( this.y );
4310
+ this.z = Math.trunc( this.z );
4263
4311
 
4264
4312
  return this;
4265
4313
 
@@ -7489,20 +7537,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
7489
7537
 
7490
7538
  clear() {
7491
7539
 
7492
- for ( let i = 0; i < this.children.length; i ++ ) {
7493
-
7494
- const object = this.children[ i ];
7495
-
7496
- object.parent = null;
7497
-
7498
- object.dispatchEvent( _removedEvent );
7499
-
7500
- }
7501
-
7502
- this.children.length = 0;
7503
-
7504
- return this;
7505
-
7540
+ return this.remove( ... this.children );
7506
7541
 
7507
7542
  }
7508
7543
 
@@ -8393,7 +8428,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
8393
8428
 
8394
8429
  }
8395
8430
 
8396
- let materialId = 0;
8431
+ let _materialId = 0;
8397
8432
 
8398
8433
  class Material extends EventDispatcher {
8399
8434
 
@@ -8403,7 +8438,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
8403
8438
 
8404
8439
  this.isMaterial = true;
8405
8440
 
8406
- Object.defineProperty( this, 'id', { value: materialId ++ } );
8441
+ Object.defineProperty( this, 'id', { value: _materialId ++ } );
8407
8442
 
8408
8443
  this.uuid = generateUUID();
8409
8444
 
@@ -8711,10 +8746,10 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
8711
8746
 
8712
8747
  if ( this.blending !== NormalBlending ) data.blending = this.blending;
8713
8748
  if ( this.side !== FrontSide ) data.side = this.side;
8714
- if ( this.vertexColors ) data.vertexColors = true;
8749
+ if ( this.vertexColors === true ) data.vertexColors = true;
8715
8750
 
8716
8751
  if ( this.opacity < 1 ) data.opacity = this.opacity;
8717
- if ( this.transparent === true ) data.transparent = this.transparent;
8752
+ if ( this.transparent === true ) data.transparent = true;
8718
8753
 
8719
8754
  data.depthFunc = this.depthFunc;
8720
8755
  data.depthTest = this.depthTest;
@@ -8745,17 +8780,17 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
8745
8780
  if ( this.dithering === true ) data.dithering = true;
8746
8781
 
8747
8782
  if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;
8748
- if ( this.alphaHash === true ) data.alphaHash = this.alphaHash;
8749
- if ( this.alphaToCoverage === true ) data.alphaToCoverage = this.alphaToCoverage;
8750
- if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha;
8751
- if ( this.forceSinglePass === true ) data.forceSinglePass = this.forceSinglePass;
8783
+ if ( this.alphaHash === true ) data.alphaHash = true;
8784
+ if ( this.alphaToCoverage === true ) data.alphaToCoverage = true;
8785
+ if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;
8786
+ if ( this.forceSinglePass === true ) data.forceSinglePass = true;
8752
8787
 
8753
- if ( this.wireframe === true ) data.wireframe = this.wireframe;
8788
+ if ( this.wireframe === true ) data.wireframe = true;
8754
8789
  if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;
8755
8790
  if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;
8756
8791
  if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;
8757
8792
 
8758
- if ( this.flatShading === true ) data.flatShading = this.flatShading;
8793
+ if ( this.flatShading === true ) data.flatShading = true;
8759
8794
 
8760
8795
  if ( this.visible === false ) data.visible = false;
8761
8796
 
@@ -9336,11 +9371,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
9336
9371
 
9337
9372
  this.getHSL( _hslA );
9338
9373
 
9339
- _hslA.h += h; _hslA.s += s; _hslA.l += l;
9340
-
9341
- this.setHSL( _hslA.h, _hslA.s, _hslA.l );
9342
-
9343
- return this;
9374
+ return this.setHSL( _hslA.h + h, _hslA.s + s, _hslA.l + l );
9344
9375
 
9345
9376
  }
9346
9377
 
@@ -10372,7 +10403,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
10372
10403
 
10373
10404
  }
10374
10405
 
10375
- let _id$1 = 0;
10406
+ let _id$2 = 0;
10376
10407
 
10377
10408
  const _m1 = /*@__PURE__*/ new Matrix4();
10378
10409
  const _obj = /*@__PURE__*/ new Object3D();
@@ -10389,7 +10420,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
10389
10420
 
10390
10421
  this.isBufferGeometry = true;
10391
10422
 
10392
- Object.defineProperty( this, 'id', { value: _id$1 ++ } );
10423
+ Object.defineProperty( this, 'id', { value: _id$2 ++ } );
10393
10424
 
10394
10425
  this.uuid = generateUUID();
10395
10426
 
@@ -11494,7 +11525,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
11494
11525
 
11495
11526
  }
11496
11527
 
11497
- this.material = source.material;
11528
+ this.material = Array.isArray( source.material ) ? source.material.slice() : source.material;
11498
11529
  this.geometry = source.geometry;
11499
11530
 
11500
11531
  return this;
@@ -12123,7 +12154,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
12123
12154
 
12124
12155
  }
12125
12156
 
12126
- return LinearSRGBColorSpace;
12157
+ return ColorManagement.workingColorSpace;
12127
12158
 
12128
12159
  }
12129
12160
 
@@ -12351,11 +12382,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
12351
12382
 
12352
12383
  getWorldDirection( target ) {
12353
12384
 
12354
- this.updateWorldMatrix( true, false );
12355
-
12356
- const e = this.matrixWorld.elements;
12357
-
12358
- return target.set( - e[ 8 ], - e[ 9 ], - e[ 10 ] ).normalize();
12385
+ return super.getWorldDirection( target ).negate();
12359
12386
 
12360
12387
  }
12361
12388
 
@@ -12625,6 +12652,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
12625
12652
 
12626
12653
  this.renderTarget = renderTarget;
12627
12654
  this.coordinateSystem = null;
12655
+ this.activeMipmapLevel = 0;
12628
12656
 
12629
12657
  const cameraPX = new PerspectiveCamera( fov, aspect, near, far );
12630
12658
  cameraPX.layers = this.layers;
@@ -12722,7 +12750,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
12722
12750
 
12723
12751
  if ( this.parent === null ) this.updateMatrixWorld();
12724
12752
 
12725
- const renderTarget = this.renderTarget;
12753
+ const { renderTarget, activeMipmapLevel } = this;
12726
12754
 
12727
12755
  if ( this.coordinateSystem !== renderer.coordinateSystem ) {
12728
12756
 
@@ -12735,6 +12763,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
12735
12763
  const [ cameraPX, cameraNX, cameraPY, cameraNY, cameraPZ, cameraNZ ] = this.children;
12736
12764
 
12737
12765
  const currentRenderTarget = renderer.getRenderTarget();
12766
+ const currentActiveCubeFace = renderer.getActiveCubeFace();
12767
+ const currentActiveMipmapLevel = renderer.getActiveMipmapLevel();
12738
12768
 
12739
12769
  const currentXrEnabled = renderer.xr.enabled;
12740
12770
 
@@ -12744,27 +12774,30 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
12744
12774
 
12745
12775
  renderTarget.texture.generateMipmaps = false;
12746
12776
 
12747
- renderer.setRenderTarget( renderTarget, 0 );
12777
+ renderer.setRenderTarget( renderTarget, 0, activeMipmapLevel );
12748
12778
  renderer.render( scene, cameraPX );
12749
12779
 
12750
- renderer.setRenderTarget( renderTarget, 1 );
12780
+ renderer.setRenderTarget( renderTarget, 1, activeMipmapLevel );
12751
12781
  renderer.render( scene, cameraNX );
12752
12782
 
12753
- renderer.setRenderTarget( renderTarget, 2 );
12783
+ renderer.setRenderTarget( renderTarget, 2, activeMipmapLevel );
12754
12784
  renderer.render( scene, cameraPY );
12755
12785
 
12756
- renderer.setRenderTarget( renderTarget, 3 );
12786
+ renderer.setRenderTarget( renderTarget, 3, activeMipmapLevel );
12757
12787
  renderer.render( scene, cameraNY );
12758
12788
 
12759
- renderer.setRenderTarget( renderTarget, 4 );
12789
+ renderer.setRenderTarget( renderTarget, 4, activeMipmapLevel );
12760
12790
  renderer.render( scene, cameraPZ );
12761
12791
 
12792
+ // mipmaps are generated during the last call of render()
12793
+ // at this point, all sides of the cube render target are defined
12794
+
12762
12795
  renderTarget.texture.generateMipmaps = generateMipmaps;
12763
12796
 
12764
- renderer.setRenderTarget( renderTarget, 5 );
12797
+ renderer.setRenderTarget( renderTarget, 5, activeMipmapLevel );
12765
12798
  renderer.render( scene, cameraNZ );
12766
12799
 
12767
- renderer.setRenderTarget( currentRenderTarget );
12800
+ renderer.setRenderTarget( currentRenderTarget, currentActiveCubeFace, currentActiveMipmapLevel );
12768
12801
 
12769
12802
  renderer.xr.enabled = currentXrEnabled;
12770
12803
 
@@ -13678,7 +13711,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
13678
13711
 
13679
13712
  var alphatest_pars_fragment = "#ifdef USE_ALPHATEST\n\tuniform float alphaTest;\n#endif";
13680
13713
 
13681
- var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif";
13714
+ var aomap_fragment = "#ifdef USE_AOMAP\n\tfloat ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;\n\treflectedLight.indirectDiffuse *= ambientOcclusion;\n\t#if defined( USE_ENVMAP ) && defined( STANDARD )\n\t\tfloat dotNV = saturate( dot( geometryNormal, geometryViewDir ) );\n\t\treflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );\n\t#endif\n#endif";
13682
13715
 
13683
13716
  var aomap_pars_fragment = "#ifdef USE_AOMAP\n\tuniform sampler2D aoMap;\n\tuniform float aoMapIntensity;\n#endif";
13684
13717
 
@@ -13708,7 +13741,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
13708
13741
 
13709
13742
  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";
13710
13743
 
13711
- 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};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated";
13744
+ var common = "#define PI 3.141592653589793\n#define PI2 6.283185307179586\n#define PI_HALF 1.5707963267948966\n#define RECIPROCAL_PI 0.3183098861837907\n#define RECIPROCAL_PI2 0.15915494309189535\n#define EPSILON 1e-6\n#ifndef saturate\n#define saturate( a ) clamp( a, 0.0, 1.0 )\n#endif\n#define whiteComplement( a ) ( 1.0 - saturate( a ) )\nfloat pow2( const in float x ) { return x*x; }\nvec3 pow2( const in vec3 x ) { return x*x; }\nfloat pow3( const in float x ) { return x*x*x; }\nfloat pow4( const in float x ) { float x2 = x*x; return x2*x2; }\nfloat max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }\nfloat average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }\nhighp float rand( const in vec2 uv ) {\n\tconst highp float a = 12.9898, b = 78.233, c = 43758.5453;\n\thighp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );\n\treturn fract( sin( sn ) * c );\n}\n#ifdef HIGH_PRECISION\n\tfloat precisionSafeLength( vec3 v ) { return length( v ); }\n#else\n\tfloat precisionSafeLength( vec3 v ) {\n\t\tfloat maxComponent = max3( abs( v ) );\n\t\treturn length( v / maxComponent ) * maxComponent;\n\t}\n#endif\nstruct IncidentLight {\n\tvec3 color;\n\tvec3 direction;\n\tbool visible;\n};\nstruct ReflectedLight {\n\tvec3 directDiffuse;\n\tvec3 directSpecular;\n\tvec3 indirectDiffuse;\n\tvec3 indirectSpecular;\n};\n#ifdef USE_ALPHAHASH\n\tvarying vec3 vPosition;\n#endif\nvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n}\nvec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {\n\treturn normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );\n}\nmat3 transposeMat3( const in mat3 m ) {\n\tmat3 tmp;\n\ttmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );\n\ttmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );\n\ttmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );\n\treturn tmp;\n}\nfloat luminance( const in vec3 rgb ) {\n\tconst vec3 weights = vec3( 0.2126729, 0.7151522, 0.0721750 );\n\treturn dot( weights, rgb );\n}\nbool isPerspectiveMatrix( mat4 m ) {\n\treturn m[ 2 ][ 3 ] == - 1.0;\n}\nvec2 equirectUv( in vec3 dir ) {\n\tfloat u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;\n\tfloat v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;\n\treturn vec2( u, v );\n}\nvec3 BRDF_Lambert( const in vec3 diffuseColor ) {\n\treturn RECIPROCAL_PI * diffuseColor;\n}\nvec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n}\nfloat F_Schlick( const in float f0, const in float f90, const in float dotVH ) {\n\tfloat fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );\n\treturn f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );\n} // validated";
13712
13745
 
13713
13746
  var cube_uv_reflection_fragment = "#ifdef ENVMAP_TYPE_CUBE_UV\n\t#define cubeUV_minMipLevel 4.0\n\t#define cubeUV_minTileSize 16.0\n\tfloat getFace( vec3 direction ) {\n\t\tvec3 absDirection = abs( direction );\n\t\tfloat face = - 1.0;\n\t\tif ( absDirection.x > absDirection.z ) {\n\t\t\tif ( absDirection.x > absDirection.y )\n\t\t\t\tface = direction.x > 0.0 ? 0.0 : 3.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t} else {\n\t\t\tif ( absDirection.z > absDirection.y )\n\t\t\t\tface = direction.z > 0.0 ? 2.0 : 5.0;\n\t\t\telse\n\t\t\t\tface = direction.y > 0.0 ? 1.0 : 4.0;\n\t\t}\n\t\treturn face;\n\t}\n\tvec2 getUV( vec3 direction, float face ) {\n\t\tvec2 uv;\n\t\tif ( face == 0.0 ) {\n\t\t\tuv = vec2( direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 1.0 ) {\n\t\t\tuv = vec2( - direction.x, - direction.z ) / abs( direction.y );\n\t\t} else if ( face == 2.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.y ) / abs( direction.z );\n\t\t} else if ( face == 3.0 ) {\n\t\t\tuv = vec2( - direction.z, direction.y ) / abs( direction.x );\n\t\t} else if ( face == 4.0 ) {\n\t\t\tuv = vec2( - direction.x, direction.z ) / abs( direction.y );\n\t\t} else {\n\t\t\tuv = vec2( direction.x, direction.y ) / abs( direction.z );\n\t\t}\n\t\treturn 0.5 * ( uv + 1.0 );\n\t}\n\tvec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {\n\t\tfloat face = getFace( direction );\n\t\tfloat filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );\n\t\tmipInt = max( mipInt, cubeUV_minMipLevel );\n\t\tfloat faceSize = exp2( mipInt );\n\t\thighp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;\n\t\tif ( face > 2.0 ) {\n\t\t\tuv.y += faceSize;\n\t\t\tface -= 3.0;\n\t\t}\n\t\tuv.x += face * faceSize;\n\t\tuv.x += filterInt * 3.0 * cubeUV_minTileSize;\n\t\tuv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );\n\t\tuv.x *= CUBEUV_TEXEL_WIDTH;\n\t\tuv.y *= CUBEUV_TEXEL_HEIGHT;\n\t\t#ifdef texture2DGradEXT\n\t\t\treturn texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;\n\t\t#else\n\t\t\treturn texture2D( envMap, uv ).rgb;\n\t\t#endif\n\t}\n\t#define cubeUV_r0 1.0\n\t#define cubeUV_v0 0.339\n\t#define cubeUV_m0 - 2.0\n\t#define cubeUV_r1 0.8\n\t#define cubeUV_v1 0.276\n\t#define cubeUV_m1 - 1.0\n\t#define cubeUV_r4 0.4\n\t#define cubeUV_v4 0.046\n\t#define cubeUV_m4 2.0\n\t#define cubeUV_r5 0.305\n\t#define cubeUV_v5 0.016\n\t#define cubeUV_m5 3.0\n\t#define cubeUV_r6 0.21\n\t#define cubeUV_v6 0.0038\n\t#define cubeUV_m6 4.0\n\tfloat roughnessToMip( float roughness ) {\n\t\tfloat mip = 0.0;\n\t\tif ( roughness >= cubeUV_r1 ) {\n\t\t\tmip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;\n\t\t} else if ( roughness >= cubeUV_r4 ) {\n\t\t\tmip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;\n\t\t} else if ( roughness >= cubeUV_r5 ) {\n\t\t\tmip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;\n\t\t} else if ( roughness >= cubeUV_r6 ) {\n\t\t\tmip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;\n\t\t} else {\n\t\t\tmip = - 2.0 * log2( 1.16 * roughness );\t\t}\n\t\treturn mip;\n\t}\n\tvec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {\n\t\tfloat mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );\n\t\tfloat mipF = fract( mip );\n\t\tfloat mipInt = floor( mip );\n\t\tvec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );\n\t\tif ( mipF == 0.0 ) {\n\t\t\treturn vec4( color0, 1.0 );\n\t\t} else {\n\t\t\tvec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );\n\t\t\treturn vec4( mix( color0, color1, mipF ), 1.0 );\n\t\t}\n\t}\n#endif";
13714
13747
 
@@ -13724,7 +13757,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
13724
13757
 
13725
13758
  var colorspace_fragment = "gl_FragColor = linearToOutputTexel( gl_FragColor );";
13726
13759
 
13727
- var colorspace_pars_fragment = "vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}";
13760
+ var colorspace_pars_fragment = "\nconst mat3 LINEAR_SRGB_TO_LINEAR_DISPLAY_P3 = mat3(\n\tvec3( 0.8224621, 0.177538, 0.0 ),\n\tvec3( 0.0331941, 0.9668058, 0.0 ),\n\tvec3( 0.0170827, 0.0723974, 0.9105199 )\n);\nconst mat3 LINEAR_DISPLAY_P3_TO_LINEAR_SRGB = mat3(\n\tvec3( 1.2249401, - 0.2249404, 0.0 ),\n\tvec3( - 0.0420569, 1.0420571, 0.0 ),\n\tvec3( - 0.0196376, - 0.0786361, 1.0982735 )\n);\nvec4 LinearSRGBToLinearDisplayP3( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_SRGB_TO_LINEAR_DISPLAY_P3, value.a );\n}\nvec4 LinearDisplayP3ToLinearSRGB( in vec4 value ) {\n\treturn vec4( value.rgb * LINEAR_DISPLAY_P3_TO_LINEAR_SRGB, value.a );\n}\nvec4 LinearTransferOETF( in vec4 value ) {\n\treturn value;\n}\nvec4 sRGBTransferOETF( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}\nvec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn sRGBTransferOETF( value );\n}";
13728
13761
 
13729
13762
  var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
13730
13763
 
@@ -13752,29 +13785,29 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
13752
13785
 
13753
13786
  var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
13754
13787
 
13755
- 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";
13788
+ 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 vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, 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";
13756
13789
 
13757
- 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 ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, 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";
13790
+ var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\n#if defined( USE_LIGHT_PROBES )\n\tuniform vec3 lightProbe[ 9 ];\n#endif\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( LEGACY_LIGHTS )\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#else\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometryPosition;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";
13758
13791
 
13759
13792
  var envmap_physical_pars_fragment = "#ifdef USE_ENVMAP\n\tvec3 getIBLIrradiance( const in vec3 normal ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, worldNormal, 1.0 );\n\t\t\treturn PI * envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\tvec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {\n\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\tvec3 reflectVec = reflect( - viewDir, normal );\n\t\t\treflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );\n\t\t\treflectVec = inverseTransformDirection( reflectVec, viewMatrix );\n\t\t\tvec4 envMapColor = textureCubeUV( envMap, reflectVec, roughness );\n\t\t\treturn envMapColor.rgb * envMapIntensity;\n\t\t#else\n\t\t\treturn vec3( 0.0 );\n\t\t#endif\n\t}\n\t#ifdef USE_ANISOTROPY\n\t\tvec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {\n\t\t\t#ifdef ENVMAP_TYPE_CUBE_UV\n\t\t\t\tvec3 bentNormal = cross( bitangent, viewDir );\n\t\t\t\tbentNormal = normalize( cross( bentNormal, bitangent ) );\n\t\t\t\tbentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );\n\t\t\t\treturn getIBLRadiance( viewDir, bentNormal, roughness );\n\t\t\t#else\n\t\t\t\treturn vec3( 0.0 );\n\t\t\t#endif\n\t\t}\n\t#endif\n#endif";
13760
13793
 
13761
13794
  var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
13762
13795
 
13763
- var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon";
13796
+ var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon";
13764
13797
 
13765
13798
  var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
13766
13799
 
13767
- 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";
13800
+ var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong";
13768
13801
 
13769
- 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 USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif";
13802
+ var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef USE_SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULAR_COLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;\n\t\t#endif\n\t\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\t#ifdef USE_ANISOTROPYMAP\n\t\tmat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );\n\t\tvec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;\n\t\tvec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;\n\t#else\n\t\tvec2 anisotropyV = anisotropyVector;\n\t#endif\n\tmaterial.anisotropy = length( anisotropyV );\n\tanisotropyV /= material.anisotropy;\n\tmaterial.anisotropy = saturate( material.anisotropy );\n\tmaterial.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );\n\tmaterial.anisotropyT = tbn[ 0 ] * anisotropyV.x - tbn[ 1 ] * anisotropyV.y;\n\tmaterial.anisotropyB = tbn[ 1 ] * anisotropyV.x + tbn[ 0 ] * anisotropyV.y;\n#endif";
13770
13803
 
13771
- var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in 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_Clearcoat( directLight.direction, geometry.viewDir, geometry.clearcoatNormal, material );\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\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometry.viewDir, geometry.normal, material );\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}";
13804
+ var lights_physical_pars_fragment = "struct PhysicalMaterial {\n\tvec3 diffuseColor;\n\tfloat roughness;\n\tvec3 specularColor;\n\tfloat specularF90;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat clearcoat;\n\t\tfloat clearcoatRoughness;\n\t\tvec3 clearcoatF0;\n\t\tfloat clearcoatF90;\n\t#endif\n\t#ifdef USE_IRIDESCENCE\n\t\tfloat iridescence;\n\t\tfloat iridescenceIOR;\n\t\tfloat iridescenceThickness;\n\t\tvec3 iridescenceFresnel;\n\t\tvec3 iridescenceF0;\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tvec3 sheenColor;\n\t\tfloat sheenRoughness;\n\t#endif\n\t#ifdef IOR\n\t\tfloat ior;\n\t#endif\n\t#ifdef USE_TRANSMISSION\n\t\tfloat transmission;\n\t\tfloat transmissionAlpha;\n\t\tfloat thickness;\n\t\tfloat attenuationDistance;\n\t\tvec3 attenuationColor;\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat anisotropy;\n\t\tfloat alphaT;\n\t\tvec3 anisotropyT;\n\t\tvec3 anisotropyB;\n\t#endif\n};\nvec3 clearcoatSpecular = vec3( 0.0 );\nvec3 sheenSpecular = vec3( 0.0 );\nvec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {\n float x = clamp( 1.0 - dotVH, 0.0, 1.0 );\n float x2 = x * x;\n float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );\n return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );\n}\nfloat V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {\n\tfloat a2 = pow2( alpha );\n\tfloat gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );\n\tfloat gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );\n\treturn 0.5 / max( gv + gl, EPSILON );\n}\nfloat D_GGX( const in float alpha, const in float dotNH ) {\n\tfloat a2 = pow2( alpha );\n\tfloat denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;\n\treturn RECIPROCAL_PI * a2 / pow2( denom );\n}\n#ifdef USE_ANISOTROPY\n\tfloat V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {\n\t\tfloat gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );\n\t\tfloat gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );\n\t\tfloat v = 0.5 / ( gv + gl );\n\t\treturn saturate(v);\n\t}\n\tfloat D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {\n\t\tfloat a2 = alphaT * alphaB;\n\t\thighp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );\n\t\thighp float v2 = dot( v, v );\n\t\tfloat w2 = a2 / v2;\n\t\treturn RECIPROCAL_PI * a2 * pow2 ( w2 );\n\t}\n#endif\n#ifdef USE_CLEARCOAT\n\tvec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {\n\t\tvec3 f0 = material.clearcoatF0;\n\t\tfloat f90 = material.clearcoatF90;\n\t\tfloat roughness = material.clearcoatRoughness;\n\t\tfloat alpha = pow2( roughness );\n\t\tvec3 halfDir = normalize( lightDir + viewDir );\n\t\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\t\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\t\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\t\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\t\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t\treturn F * ( V * D );\n\t}\n#endif\nvec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {\n\tvec3 f0 = material.specularColor;\n\tfloat f90 = material.specularF90;\n\tfloat roughness = material.roughness;\n\tfloat alpha = pow2( roughness );\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat dotVH = saturate( dot( viewDir, halfDir ) );\n\tvec3 F = F_Schlick( f0, f90, dotVH );\n\t#ifdef USE_IRIDESCENCE\n\t\tF = mix( F, material.iridescenceFresnel, material.iridescence );\n\t#endif\n\t#ifdef USE_ANISOTROPY\n\t\tfloat dotTL = dot( material.anisotropyT, lightDir );\n\t\tfloat dotTV = dot( material.anisotropyT, viewDir );\n\t\tfloat dotTH = dot( material.anisotropyT, halfDir );\n\t\tfloat dotBL = dot( material.anisotropyB, lightDir );\n\t\tfloat dotBV = dot( material.anisotropyB, viewDir );\n\t\tfloat dotBH = dot( material.anisotropyB, halfDir );\n\t\tfloat V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );\n\t\tfloat D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );\n\t#else\n\t\tfloat V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );\n\t\tfloat D = D_GGX( alpha, dotNH );\n\t#endif\n\treturn F * ( V * D );\n}\nvec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {\n\tconst float LUT_SIZE = 64.0;\n\tconst float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;\n\tconst float LUT_BIAS = 0.5 / LUT_SIZE;\n\tfloat dotNV = saturate( dot( N, V ) );\n\tvec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );\n\tuv = uv * LUT_SCALE + LUT_BIAS;\n\treturn uv;\n}\nfloat LTC_ClippedSphereFormFactor( const in vec3 f ) {\n\tfloat l = length( f );\n\treturn max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );\n}\nvec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {\n\tfloat x = dot( v1, v2 );\n\tfloat y = abs( x );\n\tfloat a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;\n\tfloat b = 3.4175940 + ( 4.1616724 + y ) * y;\n\tfloat v = a / b;\n\tfloat theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;\n\treturn cross( v1, v2 ) * theta_sintheta;\n}\nvec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {\n\tvec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];\n\tvec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];\n\tvec3 lightNormal = cross( v1, v2 );\n\tif( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );\n\tvec3 T1, T2;\n\tT1 = normalize( V - N * dot( V, N ) );\n\tT2 = - cross( N, T1 );\n\tmat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );\n\tvec3 coords[ 4 ];\n\tcoords[ 0 ] = mat * ( rectCoords[ 0 ] - P );\n\tcoords[ 1 ] = mat * ( rectCoords[ 1 ] - P );\n\tcoords[ 2 ] = mat * ( rectCoords[ 2 ] - P );\n\tcoords[ 3 ] = mat * ( rectCoords[ 3 ] - P );\n\tcoords[ 0 ] = normalize( coords[ 0 ] );\n\tcoords[ 1 ] = normalize( coords[ 1 ] );\n\tcoords[ 2 ] = normalize( coords[ 2 ] );\n\tcoords[ 3 ] = normalize( coords[ 3 ] );\n\tvec3 vectorFormFactor = vec3( 0.0 );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );\n\tvectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );\n\tfloat result = LTC_ClippedSphereFormFactor( vectorFormFactor );\n\treturn vec3( result );\n}\n#if defined( USE_SHEEN )\nfloat D_Charlie( float roughness, float dotNH ) {\n\tfloat alpha = pow2( roughness );\n\tfloat invAlpha = 1.0 / alpha;\n\tfloat cos2h = dotNH * dotNH;\n\tfloat sin2h = max( 1.0 - cos2h, 0.0078125 );\n\treturn ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );\n}\nfloat V_Neubelt( float dotNV, float dotNL ) {\n\treturn saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );\n}\nvec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {\n\tvec3 halfDir = normalize( lightDir + viewDir );\n\tfloat dotNL = saturate( dot( normal, lightDir ) );\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat dotNH = saturate( dot( normal, halfDir ) );\n\tfloat D = D_Charlie( sheenRoughness, dotNH );\n\tfloat V = V_Neubelt( dotNV, dotNL );\n\treturn sheenColor * ( D * V );\n}\n#endif\nfloat IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tfloat r2 = roughness * roughness;\n\tfloat a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;\n\tfloat b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;\n\tfloat DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );\n\treturn saturate( DG * RECIPROCAL_PI );\n}\nvec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {\n\tfloat dotNV = saturate( dot( normal, viewDir ) );\n\tconst vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );\n\tconst vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );\n\tvec4 r = roughness * c0 + c1;\n\tfloat a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;\n\tvec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;\n\treturn fab;\n}\nvec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\treturn specularColor * fab.x + specularF90 * fab.y;\n}\n#ifdef USE_IRIDESCENCE\nvoid computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#else\nvoid computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {\n#endif\n\tvec2 fab = DFGApprox( normal, viewDir, roughness );\n\t#ifdef USE_IRIDESCENCE\n\t\tvec3 Fr = mix( specularColor, iridescenceF0, iridescence );\n\t#else\n\t\tvec3 Fr = specularColor;\n\t#endif\n\tvec3 FssEss = Fr * fab.x + specularF90 * fab.y;\n\tfloat Ess = fab.x + fab.y;\n\tfloat Ems = 1.0 - Ess;\n\tvec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;\tvec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );\n\tsingleScatter += FssEss;\n\tmultiScatter += Fms * Ems;\n}\n#if NUM_RECT_AREA_LIGHTS > 0\n\tvoid RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\t\tvec3 normal = geometryNormal;\n\t\tvec3 viewDir = geometryViewDir;\n\t\tvec3 position = geometryPosition;\n\t\tvec3 lightPos = rectAreaLight.position;\n\t\tvec3 halfWidth = rectAreaLight.halfWidth;\n\t\tvec3 halfHeight = rectAreaLight.halfHeight;\n\t\tvec3 lightColor = rectAreaLight.color;\n\t\tfloat roughness = material.roughness;\n\t\tvec3 rectCoords[ 4 ];\n\t\trectCoords[ 0 ] = lightPos + halfWidth - halfHeight;\t\trectCoords[ 1 ] = lightPos - halfWidth - halfHeight;\n\t\trectCoords[ 2 ] = lightPos - halfWidth + halfHeight;\n\t\trectCoords[ 3 ] = lightPos + halfWidth + halfHeight;\n\t\tvec2 uv = LTC_Uv( normal, viewDir, roughness );\n\t\tvec4 t1 = texture2D( ltc_1, uv );\n\t\tvec4 t2 = texture2D( ltc_2, uv );\n\t\tmat3 mInv = mat3(\n\t\t\tvec3( t1.x, 0, t1.y ),\n\t\t\tvec3( 0, 1, 0 ),\n\t\t\tvec3( t1.z, 0, t1.w )\n\t\t);\n\t\tvec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );\n\t\treflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );\n\t\treflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );\n\t}\n#endif\nvoid RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometryNormal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );\n\t\tvec3 ccIrradiance = dotNLcc * directLight.color;\n\t\tclearcoatSpecular += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );\n\t#endif\n\treflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatSpecular += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );\n\t#endif\n\t#ifdef USE_SHEEN\n\t\tsheenSpecular += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );\n\t#endif\n\tvec3 singleScattering = vec3( 0.0 );\n\tvec3 multiScattering = vec3( 0.0 );\n\tvec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n\t#ifdef USE_IRIDESCENCE\n\t\tcomputeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );\n\t#else\n\t\tcomputeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );\n\t#endif\n\tvec3 totalScattering = singleScattering + multiScattering;\n\tvec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );\n\treflectedLight.indirectSpecular += radiance * singleScattering;\n\treflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n\treflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n#define RE_Direct\t\t\t\tRE_Direct_Physical\n#define RE_Direct_RectArea\t\tRE_Direct_RectArea_Physical\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Physical\n#define RE_IndirectSpecular\t\tRE_IndirectSpecular_Physical\nfloat computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {\n\treturn saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );\n}";
13772
13805
 
13773
- 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 *= ( 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 *= ( 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 *= ( 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";
13806
+ var lights_fragment_begin = "\nvec3 geometryPosition = - vViewPosition;\nvec3 geometryNormal = normal;\nvec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );\nvec3 geometryClearcoatNormal;\n#ifdef USE_CLEARCOAT\n\tgeometryClearcoatNormal = clearcoatNormal;\n#endif\n#ifdef USE_IRIDESCENCE\n\tfloat dotNVi = saturate( dot( normal, geometryViewDir ) );\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, geometryPosition, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )\n\t\tpointLightShadow = pointLightShadows[ i ];\n\t\tdirectLight.color *= ( 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, geometryPosition, 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 *= ( 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, directLight );\n\t\t#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )\n\t\tdirectionalLightShadow = directionalLightShadows[ i ];\n\t\tdirectLight.color *= ( 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, 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\t#if defined( USE_LIGHT_PROBES )\n\t\tirradiance += getLightProbeIrradiance( lightProbe, geometryNormal );\n\t#endif\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 ], geometryNormal );\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";
13774
13807
 
13775
- var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\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\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometry.viewDir, geometry.normal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometry.viewDir, geometry.normal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometry.viewDir, geometry.clearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
13808
+ var lights_fragment_maps = "#if defined( RE_IndirectDiffuse )\n\t#ifdef USE_LIGHTMAP\n\t\tvec4 lightMapTexel = texture2D( lightMap, vLightMapUv );\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( geometryNormal );\n\t#endif\n#endif\n#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )\n\t#ifdef USE_ANISOTROPY\n\t\tradiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );\n\t#else\n\t\tradiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tclearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );\n\t#endif\n#endif";
13776
13809
 
13777
- var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometry, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometry, material, reflectedLight );\n#endif";
13810
+ var lights_fragment_end = "#if defined( RE_IndirectDiffuse )\n\tRE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif\n#if defined( RE_IndirectSpecular )\n\tRE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );\n#endif";
13778
13811
 
13779
13812
  var logdepthbuf_fragment = "#if defined( USE_LOGDEPTHBUF ) && defined( USE_LOGDEPTHBUF_EXT )\n\tgl_FragDepthEXT = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;\n#endif";
13780
13813
 
@@ -13784,7 +13817,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
13784
13817
 
13785
13818
  var logdepthbuf_vertex = "#ifdef USE_LOGDEPTHBUF\n\t#ifdef USE_LOGDEPTHBUF_EXT\n\t\tvFragDepth = 1.0 + gl_Position.w;\n\t\tvIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );\n\t#else\n\t\tif ( isPerspectiveMatrix( projectionMatrix ) ) {\n\t\t\tgl_Position.z = log2( max( EPSILON, gl_Position.w + 1.0 ) ) * logDepthBufFC - 1.0;\n\t\t\tgl_Position.z *= gl_Position.w;\n\t\t}\n\t#endif\n#endif";
13786
13819
 
13787
- var map_fragment = "#ifdef USE_MAP\n\tdiffuseColor *= texture2D( map, vMapUv );\n#endif";
13820
+ var map_fragment = "#ifdef USE_MAP\n\tvec4 sampledDiffuseColor = texture2D( map, vMapUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tsampledDiffuseColor = vec4( mix( pow( sampledDiffuseColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), sampledDiffuseColor.rgb * 0.0773993808, vec3( lessThanEqual( sampledDiffuseColor.rgb, vec3( 0.04045 ) ) ) ), sampledDiffuseColor.w );\n\t\n\t#endif\n\tdiffuseColor *= sampledDiffuseColor;\n#endif";
13788
13821
 
13789
13822
  var map_pars_fragment = "#ifdef USE_MAP\n\tuniform sampler2D map;\n#endif";
13790
13823
 
@@ -13804,7 +13837,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
13804
13837
 
13805
13838
  var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif";
13806
13839
 
13807
- var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 geometryNormal = normal;";
13840
+ var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal *= faceDirection;\n\t#endif\n#endif\n#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn = getTangentFrame( - vViewPosition, normal,\n\t\t#if defined( USE_NORMALMAP )\n\t\t\tvNormalMapUv\n\t\t#elif defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tvClearcoatNormalMapUv\n\t\t#else\n\t\t\tvUv\n\t\t#endif\n\t\t);\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn[0] *= faceDirection;\n\t\ttbn[1] *= faceDirection;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT_NORMALMAP\n\t#ifdef USE_TANGENT\n\t\tmat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );\n\t#else\n\t\tmat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );\n\t#endif\n\t#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )\n\t\ttbn2[0] *= faceDirection;\n\t\ttbn2[1] *= faceDirection;\n\t#endif\n#endif\nvec3 nonPerturbedNormal = normal;";
13808
13841
 
13809
13842
  var normal_fragment_maps = "#ifdef USE_NORMALMAP_OBJECTSPACE\n\tnormal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( USE_NORMALMAP_TANGENTSPACE )\n\tvec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\tnormal = normalize( tbn * mapN );\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
13810
13843
 
@@ -13816,7 +13849,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
13816
13849
 
13817
13850
  var normalmap_pars_fragment = "#ifdef USE_NORMALMAP\n\tuniform sampler2D normalMap;\n\tuniform vec2 normalScale;\n#endif\n#ifdef USE_NORMALMAP_OBJECTSPACE\n\tuniform mat3 normalMatrix;\n#endif\n#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )\n\tmat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {\n\t\tvec3 q0 = dFdx( eye_pos.xyz );\n\t\tvec3 q1 = dFdy( eye_pos.xyz );\n\t\tvec2 st0 = dFdx( uv.st );\n\t\tvec2 st1 = dFdy( uv.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 : inversesqrt( det );\n\t\treturn mat3( T * scale, B * scale, N );\n\t}\n#endif";
13818
13851
 
13819
- var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = geometryNormal;\n#endif";
13852
+ var clearcoat_normal_fragment_begin = "#ifdef USE_CLEARCOAT\n\tvec3 clearcoatNormal = nonPerturbedNormal;\n#endif";
13820
13853
 
13821
13854
  var clearcoat_normal_fragment_maps = "#ifdef USE_CLEARCOAT_NORMALMAP\n\tvec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;\n\tclearcoatMapN.xy *= clearcoatNormalScale;\n\tclearcoatNormal = normalize( tbn2 * clearcoatMapN );\n#endif";
13822
13855
 
@@ -13878,7 +13911,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
13878
13911
 
13879
13912
  const vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
13880
13913
 
13881
- const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
13914
+ const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n}";
13882
13915
 
13883
13916
  const vertex$g = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
13884
13917
 
@@ -13926,7 +13959,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
13926
13959
 
13927
13960
  const vertex$5 = "#define STANDARD\nvarying vec3 vViewPosition;\n#ifdef USE_TRANSMISSION\n\tvarying vec3 vWorldPosition;\n#endif\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n#ifdef USE_TRANSMISSION\n\tvWorldPosition = worldPosition.xyz;\n#endif\n}";
13928
13961
 
13929
- const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + 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 <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
13962
+ const fragment$5 = "#define STANDARD\n#ifdef PHYSICAL\n\t#define IOR\n\t#define USE_SPECULAR\n#endif\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float roughness;\nuniform float metalness;\nuniform float opacity;\n#ifdef IOR\n\tuniform float ior;\n#endif\n#ifdef USE_SPECULAR\n\tuniform float specularIntensity;\n\tuniform vec3 specularColor;\n\t#ifdef USE_SPECULAR_COLORMAP\n\t\tuniform sampler2D specularColorMap;\n\t#endif\n\t#ifdef USE_SPECULAR_INTENSITYMAP\n\t\tuniform sampler2D specularIntensityMap;\n\t#endif\n#endif\n#ifdef USE_CLEARCOAT\n\tuniform float clearcoat;\n\tuniform float clearcoatRoughness;\n#endif\n#ifdef USE_IRIDESCENCE\n\tuniform float iridescence;\n\tuniform float iridescenceIOR;\n\tuniform float iridescenceThicknessMinimum;\n\tuniform float iridescenceThicknessMaximum;\n#endif\n#ifdef USE_SHEEN\n\tuniform vec3 sheenColor;\n\tuniform float sheenRoughness;\n\t#ifdef USE_SHEEN_COLORMAP\n\t\tuniform sampler2D sheenColorMap;\n\t#endif\n\t#ifdef USE_SHEEN_ROUGHNESSMAP\n\t\tuniform sampler2D sheenRoughnessMap;\n\t#endif\n#endif\n#ifdef USE_ANISOTROPY\n\tuniform vec2 anisotropyVector;\n\t#ifdef USE_ANISOTROPYMAP\n\t\tuniform sampler2D anisotropyMap;\n\t#endif\n#endif\nvarying vec3 vViewPosition;\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <iridescence_fragment>\n#include <cube_uv_reflection_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_physical_pars_fragment>\n#include <fog_pars_fragment>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_physical_pars_fragment>\n#include <transmission_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <clearcoat_pars_fragment>\n#include <iridescence_pars_fragment>\n#include <roughnessmap_pars_fragment>\n#include <metalnessmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( diffuse, opacity );\n\tReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );\n\tvec3 totalEmissiveRadiance = emissive;\n\t#include <logdepthbuf_fragment>\n\t#include <map_fragment>\n\t#include <color_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <alphahash_fragment>\n\t#include <roughnessmap_fragment>\n\t#include <metalnessmap_fragment>\n\t#include <normal_fragment_begin>\n\t#include <normal_fragment_maps>\n\t#include <clearcoat_normal_fragment_begin>\n\t#include <clearcoat_normal_fragment_maps>\n\t#include <emissivemap_fragment>\n\t#include <lights_physical_fragment>\n\t#include <lights_fragment_begin>\n\t#include <lights_fragment_maps>\n\t#include <lights_fragment_end>\n\t#include <aomap_fragment>\n\tvec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;\n\tvec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;\n\t#include <transmission_fragment>\n\tvec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;\n\t#ifdef USE_SHEEN\n\t\tfloat sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );\n\t\toutgoingLight = outgoingLight * sheenEnergyComp + sheenSpecular;\n\t#endif\n\t#ifdef USE_CLEARCOAT\n\t\tfloat dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );\n\t\tvec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );\n\t\toutgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + clearcoatSpecular * material.clearcoat;\n\t#endif\n\t#include <opaque_fragment>\n\t#include <tonemapping_fragment>\n\t#include <colorspace_fragment>\n\t#include <fog_fragment>\n\t#include <premultiplied_alpha_fragment>\n\t#include <dithering_fragment>\n}";
13930
13963
 
13931
13964
  const vertex$4 = "#define TOON\nvarying vec3 vViewPosition;\n#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvoid main() {\n\t#include <uv_vertex>\n\t#include <color_vertex>\n\t#include <morphcolor_vertex>\n\t#include <beginnormal_vertex>\n\t#include <morphnormal_vertex>\n\t#include <skinbase_vertex>\n\t#include <skinnormal_vertex>\n\t#include <defaultnormal_vertex>\n\t#include <normal_vertex>\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvViewPosition = - mvPosition.xyz;\n\t#include <worldpos_vertex>\n\t#include <shadowmap_vertex>\n\t#include <fog_vertex>\n}";
13932
13965
 
@@ -14698,24 +14731,15 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
14698
14731
 
14699
14732
  }
14700
14733
 
14701
- const xr = renderer.xr;
14702
- const environmentBlendMode = xr.getEnvironmentBlendMode();
14734
+ const environmentBlendMode = renderer.xr.getEnvironmentBlendMode();
14703
14735
 
14704
- switch ( environmentBlendMode ) {
14736
+ if ( environmentBlendMode === 'additive' ) {
14705
14737
 
14706
- case 'opaque':
14707
- forceClear = true;
14708
- break;
14738
+ state.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );
14709
14739
 
14710
- case 'additive':
14711
- state.buffers.color.setClear( 0, 0, 0, 1, premultipliedAlpha );
14712
- forceClear = true;
14713
- break;
14740
+ } else if ( environmentBlendMode === 'alpha-blend' ) {
14714
14741
 
14715
- case 'alpha-blend':
14716
- state.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );
14717
- forceClear = true;
14718
- break;
14742
+ state.buffers.color.setClear( 0, 0, 0, 0, premultipliedAlpha );
14719
14743
 
14720
14744
  }
14721
14745
 
@@ -14771,7 +14795,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
14771
14795
  boxMesh.material.uniforms.flipEnvMap.value = ( background.isCubeTexture && background.isRenderTargetTexture === false ) ? - 1 : 1;
14772
14796
  boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
14773
14797
  boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
14774
- boxMesh.material.toneMapped = ( background.colorSpace === SRGBColorSpace ) ? false : true;
14798
+ boxMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
14775
14799
 
14776
14800
  if ( currentBackground !== background ||
14777
14801
  currentBackgroundVersion !== background.version ||
@@ -14827,7 +14851,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
14827
14851
 
14828
14852
  planeMesh.material.uniforms.t2D.value = background;
14829
14853
  planeMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
14830
- planeMesh.material.toneMapped = ( background.colorSpace === SRGBColorSpace ) ? false : true;
14854
+ planeMesh.material.toneMapped = ColorManagement.getTransfer( background.colorSpace ) !== SRGBTransfer;
14831
14855
 
14832
14856
  if ( background.matrixAutoUpdate === true ) {
14833
14857
 
@@ -19091,15 +19115,38 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
19091
19115
 
19092
19116
  function getEncodingComponents( colorSpace ) {
19093
19117
 
19118
+ const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );
19119
+ const encodingPrimaries = ColorManagement.getPrimaries( colorSpace );
19120
+
19121
+ let gamutMapping;
19122
+
19123
+ if ( workingPrimaries === encodingPrimaries ) {
19124
+
19125
+ gamutMapping = '';
19126
+
19127
+ } else if ( workingPrimaries === P3Primaries && encodingPrimaries === Rec709Primaries ) {
19128
+
19129
+ gamutMapping = 'LinearDisplayP3ToLinearSRGB';
19130
+
19131
+ } else if ( workingPrimaries === Rec709Primaries && encodingPrimaries === P3Primaries ) {
19132
+
19133
+ gamutMapping = 'LinearSRGBToLinearDisplayP3';
19134
+
19135
+ }
19136
+
19094
19137
  switch ( colorSpace ) {
19095
19138
 
19096
19139
  case LinearSRGBColorSpace:
19097
- return [ 'Linear', '( value )' ];
19140
+ case LinearDisplayP3ColorSpace:
19141
+ return [ gamutMapping, 'LinearTransferOETF' ];
19142
+
19098
19143
  case SRGBColorSpace:
19099
- return [ 'sRGB', '( value )' ];
19144
+ case DisplayP3ColorSpace:
19145
+ return [ gamutMapping, 'sRGBTransferOETF' ];
19146
+
19100
19147
  default:
19101
19148
  console.warn( 'THREE.WebGLProgram: Unsupported color space:', colorSpace );
19102
- return [ 'Linear', '( value )' ];
19149
+ return [ gamutMapping, 'LinearTransferOETF' ];
19103
19150
 
19104
19151
  }
19105
19152
 
@@ -19132,7 +19179,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
19132
19179
  function getTexelEncodingFunction( functionName, colorSpace ) {
19133
19180
 
19134
19181
  const components = getEncodingComponents( colorSpace );
19135
- return 'vec4 ' + functionName + '( vec4 value ) { return LinearTo' + components[ 0 ] + components[ 1 ] + '; }';
19182
+ return `vec4 ${functionName}( vec4 value ) { return ${components[ 0 ]}( ${components[ 1 ]}( value ) ); }`;
19136
19183
 
19137
19184
  }
19138
19185
 
@@ -19559,6 +19606,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
19559
19606
  parameters.displacementMap ? '#define USE_DISPLACEMENTMAP' : '',
19560
19607
  parameters.emissiveMap ? '#define USE_EMISSIVEMAP' : '',
19561
19608
 
19609
+ parameters.anisotropy ? '#define USE_ANISOTROPY' : '',
19562
19610
  parameters.anisotropyMap ? '#define USE_ANISOTROPYMAP' : '',
19563
19611
 
19564
19612
  parameters.clearcoatMap ? '#define USE_CLEARCOATMAP' : '',
@@ -19646,6 +19694,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
19646
19694
 
19647
19695
  parameters.sizeAttenuation ? '#define USE_SIZEATTENUATION' : '',
19648
19696
 
19697
+ parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
19698
+
19649
19699
  parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
19650
19700
 
19651
19701
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
@@ -19828,8 +19878,12 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
19828
19878
 
19829
19879
  parameters.premultipliedAlpha ? '#define PREMULTIPLIED_ALPHA' : '',
19830
19880
 
19881
+ parameters.numLightProbes > 0 ? '#define USE_LIGHT_PROBES' : '',
19882
+
19831
19883
  parameters.useLegacyLights ? '#define LEGACY_LIGHTS' : '',
19832
19884
 
19885
+ parameters.decodeVideoTexture ? '#define DECODE_VIDEO_TEXTURE' : '',
19886
+
19833
19887
  parameters.logarithmicDepthBuffer ? '#define USE_LOGDEPTHBUF' : '',
19834
19888
  ( parameters.logarithmicDepthBuffer && parameters.rendererExtensionFragDepth ) ? '#define USE_LOGDEPTHBUF_EXT' : '',
19835
19889
 
@@ -20064,7 +20118,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
20064
20118
 
20065
20119
  }
20066
20120
 
20067
- let _id = 0;
20121
+ let _id$1 = 0;
20068
20122
 
20069
20123
  class WebGLShaderCache {
20070
20124
 
@@ -20178,7 +20232,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
20178
20232
 
20179
20233
  constructor( code ) {
20180
20234
 
20181
- this.id = _id ++;
20235
+ this.id = _id$1 ++;
20182
20236
 
20183
20237
  this.code = code;
20184
20238
  this.usedTimes = 0;
@@ -20506,6 +20560,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
20506
20560
  numSpotLightShadows: lights.spotShadowMap.length,
20507
20561
  numSpotLightShadowsWithMaps: lights.numSpotLightShadowsWithMaps,
20508
20562
 
20563
+ numLightProbes: lights.numLightProbes,
20564
+
20509
20565
  numClippingPlanes: clipping.numPlanes,
20510
20566
  numClipIntersection: clipping.numIntersection,
20511
20567
 
@@ -20517,6 +20573,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
20517
20573
  toneMapping: toneMapping,
20518
20574
  useLegacyLights: renderer._useLegacyLights,
20519
20575
 
20576
+ decodeVideoTexture: HAS_MAP && ( material.map.isVideoTexture === true ) && ( ColorManagement.getTransfer( material.map.colorSpace ) === SRGBTransfer ),
20577
+
20520
20578
  premultipliedAlpha: material.premultipliedAlpha,
20521
20579
 
20522
20580
  doubleSided: material.side === DoubleSide,
@@ -20628,6 +20686,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
20628
20686
  array.push( parameters.numPointLightShadows );
20629
20687
  array.push( parameters.numSpotLightShadows );
20630
20688
  array.push( parameters.numSpotLightShadowsWithMaps );
20689
+ array.push( parameters.numLightProbes );
20631
20690
  array.push( parameters.shadowMapType );
20632
20691
  array.push( parameters.toneMapping );
20633
20692
  array.push( parameters.numClippingPlanes );
@@ -20718,6 +20777,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
20718
20777
  _programLayers.enable( 17 );
20719
20778
  if ( parameters.pointsUvs )
20720
20779
  _programLayers.enable( 18 );
20780
+ if ( parameters.decodeVideoTexture )
20781
+ _programLayers.enable( 19 );
20721
20782
 
20722
20783
  array.push( _programLayers.mask );
20723
20784
 
@@ -21264,7 +21325,9 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
21264
21325
  numDirectionalShadows: - 1,
21265
21326
  numPointShadows: - 1,
21266
21327
  numSpotShadows: - 1,
21267
- numSpotMaps: - 1
21328
+ numSpotMaps: - 1,
21329
+
21330
+ numLightProbes: - 1
21268
21331
  },
21269
21332
 
21270
21333
  ambient: [ 0, 0, 0 ],
@@ -21286,7 +21349,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
21286
21349
  pointShadowMap: [],
21287
21350
  pointShadowMatrix: [],
21288
21351
  hemi: [],
21289
- numSpotLightShadowsWithMaps: 0
21352
+ numSpotLightShadowsWithMaps: 0,
21353
+ numLightProbes: 0
21290
21354
 
21291
21355
  };
21292
21356
 
@@ -21314,6 +21378,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
21314
21378
  let numSpotMaps = 0;
21315
21379
  let numSpotShadowsWithMaps = 0;
21316
21380
 
21381
+ let numLightProbes = 0;
21382
+
21317
21383
  // ordering : [shadow casting + map texturing, map texturing, shadow casting, none ]
21318
21384
  lights.sort( shadowCastingAndTexturingLightsFirst );
21319
21385
 
@@ -21344,6 +21410,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
21344
21410
 
21345
21411
  }
21346
21412
 
21413
+ numLightProbes ++;
21414
+
21347
21415
  } else if ( light.isDirectionalLight ) {
21348
21416
 
21349
21417
  const uniforms = cache.get( light );
@@ -21531,7 +21599,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
21531
21599
  hash.numDirectionalShadows !== numDirectionalShadows ||
21532
21600
  hash.numPointShadows !== numPointShadows ||
21533
21601
  hash.numSpotShadows !== numSpotShadows ||
21534
- hash.numSpotMaps !== numSpotMaps ) {
21602
+ hash.numSpotMaps !== numSpotMaps ||
21603
+ hash.numLightProbes !== numLightProbes ) {
21535
21604
 
21536
21605
  state.directional.length = directionalLength;
21537
21606
  state.spot.length = spotLength;
@@ -21550,6 +21619,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
21550
21619
  state.spotLightMatrix.length = numSpotShadows + numSpotMaps - numSpotShadowsWithMaps;
21551
21620
  state.spotLightMap.length = numSpotMaps;
21552
21621
  state.numSpotLightShadowsWithMaps = numSpotShadowsWithMaps;
21622
+ state.numLightProbes = numLightProbes;
21553
21623
 
21554
21624
  hash.directionalLength = directionalLength;
21555
21625
  hash.pointLength = pointLength;
@@ -21562,6 +21632,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
21562
21632
  hash.numSpotShadows = numSpotShadows;
21563
21633
  hash.numSpotMaps = numSpotMaps;
21564
21634
 
21635
+ hash.numLightProbes = numLightProbes;
21636
+
21565
21637
  state.version = nextVersion ++;
21566
21638
 
21567
21639
  }
@@ -23708,9 +23780,11 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
23708
23780
 
23709
23781
  if ( glFormat === _gl.RGBA ) {
23710
23782
 
23783
+ const transfer = forceLinearTransfer ? LinearTransfer : ColorManagement.getTransfer( colorSpace );
23784
+
23711
23785
  if ( glType === _gl.FLOAT ) internalFormat = _gl.RGBA32F;
23712
23786
  if ( glType === _gl.HALF_FLOAT ) internalFormat = _gl.RGBA16F;
23713
- if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( colorSpace === SRGBColorSpace && forceLinearTransfer === false ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
23787
+ if ( glType === _gl.UNSIGNED_BYTE ) internalFormat = ( transfer === SRGBTransfer ) ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
23714
23788
  if ( glType === _gl.UNSIGNED_SHORT_4_4_4_4 ) internalFormat = _gl.RGBA4;
23715
23789
  if ( glType === _gl.UNSIGNED_SHORT_5_5_5_1 ) internalFormat = _gl.RGB5_A1;
23716
23790
 
@@ -24265,10 +24339,14 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
24265
24339
 
24266
24340
  state.activeTexture( _gl.TEXTURE0 + slot );
24267
24341
 
24342
+ const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );
24343
+ const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );
24344
+ const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
24345
+
24268
24346
  _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
24269
24347
  _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
24270
24348
  _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
24271
- _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE );
24349
+ _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
24272
24350
 
24273
24351
  const needsPowerOfTwo = textureNeedsPowerOfTwo( texture ) && isPowerOfTwo$1( texture.image ) === false;
24274
24352
  let image = resizeImage( texture.image, needsPowerOfTwo, false, maxTextureSize );
@@ -24278,7 +24356,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
24278
24356
  glFormat = utils.convert( texture.format, texture.colorSpace );
24279
24357
 
24280
24358
  let glType = utils.convert( texture.type ),
24281
- glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace );
24359
+ glInternalFormat = getInternalFormat( texture.internalFormat, glFormat, glType, texture.colorSpace, texture.isVideoTexture );
24282
24360
 
24283
24361
  setTextureParameters( textureType, texture, supportsMips );
24284
24362
 
@@ -24679,10 +24757,14 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
24679
24757
 
24680
24758
  state.activeTexture( _gl.TEXTURE0 + slot );
24681
24759
 
24760
+ const workingPrimaries = ColorManagement.getPrimaries( ColorManagement.workingColorSpace );
24761
+ const texturePrimaries = texture.colorSpace === NoColorSpace ? null : ColorManagement.getPrimaries( texture.colorSpace );
24762
+ const unpackConversion = texture.colorSpace === NoColorSpace || workingPrimaries === texturePrimaries ? _gl.NONE : _gl.BROWSER_DEFAULT_WEBGL;
24763
+
24682
24764
  _gl.pixelStorei( _gl.UNPACK_FLIP_Y_WEBGL, texture.flipY );
24683
24765
  _gl.pixelStorei( _gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha );
24684
24766
  _gl.pixelStorei( _gl.UNPACK_ALIGNMENT, texture.unpackAlignment );
24685
- _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, _gl.NONE );
24767
+ _gl.pixelStorei( _gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, unpackConversion );
24686
24768
 
24687
24769
  const isCompressed = ( texture.isCompressedTexture || texture.image[ 0 ].isCompressedTexture );
24688
24770
  const isDataTexture = ( texture.image[ 0 ] && texture.image[ 0 ].isDataTexture );
@@ -24922,7 +25004,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
24922
25004
 
24923
25005
  if ( renderTarget.depthBuffer && ! renderTarget.stencilBuffer ) {
24924
25006
 
24925
- let glInternalFormat = _gl.DEPTH_COMPONENT16;
25007
+ let glInternalFormat = ( isWebGL2 === true ) ? _gl.DEPTH_COMPONENT24 : _gl.DEPTH_COMPONENT16;
24926
25008
 
24927
25009
  if ( isMultisample || useMultisampledRTT( renderTarget ) ) {
24928
25010
 
@@ -25557,13 +25639,13 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
25557
25639
  const format = texture.format;
25558
25640
  const type = texture.type;
25559
25641
 
25560
- if ( texture.isCompressedTexture === true || texture.format === _SRGBAFormat ) return image;
25642
+ if ( texture.isCompressedTexture === true || texture.isVideoTexture === true || texture.format === _SRGBAFormat ) return image;
25561
25643
 
25562
25644
  if ( colorSpace !== LinearSRGBColorSpace && colorSpace !== NoColorSpace ) {
25563
25645
 
25564
25646
  // sRGB
25565
25647
 
25566
- if ( colorSpace === SRGBColorSpace ) {
25648
+ if ( ColorManagement.getTransfer( colorSpace ) === SRGBTransfer ) {
25567
25649
 
25568
25650
  if ( isWebGL2 === false ) {
25569
25651
 
@@ -25637,6 +25719,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
25637
25719
 
25638
25720
  let extension;
25639
25721
 
25722
+ const transfer = ColorManagement.getTransfer( colorSpace );
25723
+
25640
25724
  if ( p === UnsignedByteType ) return gl.UNSIGNED_BYTE;
25641
25725
  if ( p === UnsignedShort4444Type ) return gl.UNSIGNED_SHORT_4_4_4_4;
25642
25726
  if ( p === UnsignedShort5551Type ) return gl.UNSIGNED_SHORT_5_5_5_1;
@@ -25703,7 +25787,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
25703
25787
 
25704
25788
  if ( p === RGB_S3TC_DXT1_Format || p === RGBA_S3TC_DXT1_Format || p === RGBA_S3TC_DXT3_Format || p === RGBA_S3TC_DXT5_Format ) {
25705
25789
 
25706
- if ( colorSpace === SRGBColorSpace ) {
25790
+ if ( transfer === SRGBTransfer ) {
25707
25791
 
25708
25792
  extension = extensions.get( 'WEBGL_compressed_texture_s3tc_srgb' );
25709
25793
 
@@ -25788,8 +25872,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
25788
25872
 
25789
25873
  if ( extension !== null ) {
25790
25874
 
25791
- if ( p === RGB_ETC2_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
25792
- if ( p === RGBA_ETC2_EAC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;
25875
+ if ( p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2;
25876
+ if ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC;
25793
25877
 
25794
25878
  } else {
25795
25879
 
@@ -25811,20 +25895,20 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
25811
25895
 
25812
25896
  if ( extension !== null ) {
25813
25897
 
25814
- if ( p === RGBA_ASTC_4x4_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;
25815
- if ( p === RGBA_ASTC_5x4_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;
25816
- if ( p === RGBA_ASTC_5x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;
25817
- if ( p === RGBA_ASTC_6x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;
25818
- if ( p === RGBA_ASTC_6x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;
25819
- if ( p === RGBA_ASTC_8x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;
25820
- if ( p === RGBA_ASTC_8x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;
25821
- if ( p === RGBA_ASTC_8x8_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;
25822
- if ( p === RGBA_ASTC_10x5_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;
25823
- if ( p === RGBA_ASTC_10x6_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;
25824
- if ( p === RGBA_ASTC_10x8_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;
25825
- if ( p === RGBA_ASTC_10x10_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;
25826
- if ( p === RGBA_ASTC_12x10_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;
25827
- if ( p === RGBA_ASTC_12x12_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;
25898
+ if ( p === RGBA_ASTC_4x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR : extension.COMPRESSED_RGBA_ASTC_4x4_KHR;
25899
+ if ( p === RGBA_ASTC_5x4_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR : extension.COMPRESSED_RGBA_ASTC_5x4_KHR;
25900
+ if ( p === RGBA_ASTC_5x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR : extension.COMPRESSED_RGBA_ASTC_5x5_KHR;
25901
+ if ( p === RGBA_ASTC_6x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR : extension.COMPRESSED_RGBA_ASTC_6x5_KHR;
25902
+ if ( p === RGBA_ASTC_6x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR : extension.COMPRESSED_RGBA_ASTC_6x6_KHR;
25903
+ if ( p === RGBA_ASTC_8x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR : extension.COMPRESSED_RGBA_ASTC_8x5_KHR;
25904
+ if ( p === RGBA_ASTC_8x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR : extension.COMPRESSED_RGBA_ASTC_8x6_KHR;
25905
+ if ( p === RGBA_ASTC_8x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR : extension.COMPRESSED_RGBA_ASTC_8x8_KHR;
25906
+ if ( p === RGBA_ASTC_10x5_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR : extension.COMPRESSED_RGBA_ASTC_10x5_KHR;
25907
+ if ( p === RGBA_ASTC_10x6_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR : extension.COMPRESSED_RGBA_ASTC_10x6_KHR;
25908
+ if ( p === RGBA_ASTC_10x8_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR : extension.COMPRESSED_RGBA_ASTC_10x8_KHR;
25909
+ if ( p === RGBA_ASTC_10x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR : extension.COMPRESSED_RGBA_ASTC_10x10_KHR;
25910
+ if ( p === RGBA_ASTC_12x10_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR : extension.COMPRESSED_RGBA_ASTC_12x10_KHR;
25911
+ if ( p === RGBA_ASTC_12x12_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR : extension.COMPRESSED_RGBA_ASTC_12x12_KHR;
25828
25912
 
25829
25913
  } else {
25830
25914
 
@@ -25836,13 +25920,15 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
25836
25920
 
25837
25921
  // BPTC
25838
25922
 
25839
- if ( p === RGBA_BPTC_Format ) {
25923
+ if ( p === RGBA_BPTC_Format || p === RGB_BPTC_SIGNED_Format || p === RGB_BPTC_UNSIGNED_Format ) {
25840
25924
 
25841
25925
  extension = extensions.get( 'EXT_texture_compression_bptc' );
25842
25926
 
25843
25927
  if ( extension !== null ) {
25844
25928
 
25845
- if ( p === RGBA_BPTC_Format ) return ( colorSpace === SRGBColorSpace ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;
25929
+ if ( p === RGBA_BPTC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT : extension.COMPRESSED_RGBA_BPTC_UNORM_EXT;
25930
+ if ( p === RGB_BPTC_SIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;
25931
+ if ( p === RGB_BPTC_UNSIGNED_Format ) return extension.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT;
25846
25932
 
25847
25933
  } else {
25848
25934
 
@@ -28630,14 +28716,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
28630
28716
 
28631
28717
  }
28632
28718
 
28633
- function createCanvasElement() {
28634
-
28635
- const canvas = createElementNS( 'canvas' );
28636
- canvas.style.display = 'block';
28637
- return canvas;
28638
-
28639
- }
28640
-
28641
28719
  class WebGLRenderer {
28642
28720
 
28643
28721
  constructor( parameters = {} ) {
@@ -28718,7 +28796,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
28718
28796
 
28719
28797
  // physically based shading
28720
28798
 
28721
- this.outputColorSpace = SRGBColorSpace;
28799
+ this._outputColorSpace = SRGBColorSpace;
28722
28800
 
28723
28801
  // physical lights
28724
28802
 
@@ -30368,48 +30446,28 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
30368
30446
 
30369
30447
  if ( refreshProgram || _currentCamera !== camera ) {
30370
30448
 
30371
- p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
30372
-
30373
- if ( capabilities.logarithmicDepthBuffer ) {
30449
+ // common camera uniforms
30374
30450
 
30375
- p_uniforms.setValue( _gl, 'logDepthBufFC',
30376
- 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
30377
-
30378
- }
30379
-
30380
- if ( _currentCamera !== camera ) {
30451
+ p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
30452
+ p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
30381
30453
 
30382
- _currentCamera = camera;
30454
+ const uCamPos = p_uniforms.map.cameraPosition;
30383
30455
 
30384
- // lighting uniforms depend on the camera so enforce an update
30385
- // now, in case this material supports lights - or later, when
30386
- // the next material that does gets activated:
30456
+ if ( uCamPos !== undefined ) {
30387
30457
 
30388
- refreshMaterial = true; // set to true on material change
30389
- refreshLights = true; // remains set until update done
30458
+ uCamPos.setValue( _gl, _vector3.setFromMatrixPosition( camera.matrixWorld ) );
30390
30459
 
30391
30460
  }
30392
30461
 
30393
- // load material specific uniforms
30394
- // (shader material also gets them for the sake of genericity)
30395
-
30396
- if ( material.isShaderMaterial ||
30397
- material.isMeshPhongMaterial ||
30398
- material.isMeshToonMaterial ||
30399
- material.isMeshStandardMaterial ||
30400
- material.envMap ) {
30401
-
30402
- const uCamPos = p_uniforms.map.cameraPosition;
30403
-
30404
- if ( uCamPos !== undefined ) {
30405
-
30406
- uCamPos.setValue( _gl,
30407
- _vector3.setFromMatrixPosition( camera.matrixWorld ) );
30462
+ if ( capabilities.logarithmicDepthBuffer ) {
30408
30463
 
30409
- }
30464
+ p_uniforms.setValue( _gl, 'logDepthBufFC',
30465
+ 2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
30410
30466
 
30411
30467
  }
30412
30468
 
30469
+ // consider moving isOrthographic to UniformLib and WebGLMaterials, see https://github.com/mrdoob/three.js/pull/26467#issuecomment-1645185067
30470
+
30413
30471
  if ( material.isMeshPhongMaterial ||
30414
30472
  material.isMeshToonMaterial ||
30415
30473
  material.isMeshLambertMaterial ||
@@ -30421,16 +30479,16 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
30421
30479
 
30422
30480
  }
30423
30481
 
30424
- if ( material.isMeshPhongMaterial ||
30425
- material.isMeshToonMaterial ||
30426
- material.isMeshLambertMaterial ||
30427
- material.isMeshBasicMaterial ||
30428
- material.isMeshStandardMaterial ||
30429
- material.isShaderMaterial ||
30430
- material.isShadowMaterial ||
30431
- object.isSkinnedMesh ) {
30482
+ if ( _currentCamera !== camera ) {
30432
30483
 
30433
- p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
30484
+ _currentCamera = camera;
30485
+
30486
+ // lighting uniforms depend on the camera so enforce an update
30487
+ // now, in case this material supports lights - or later, when
30488
+ // the next material that does gets activated:
30489
+
30490
+ refreshMaterial = true; // set to true on material change
30491
+ refreshLights = true; // remains set until update done
30434
30492
 
30435
30493
  }
30436
30494
 
@@ -31046,6 +31104,22 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
31046
31104
 
31047
31105
  }
31048
31106
 
31107
+ get outputColorSpace() {
31108
+
31109
+ return this._outputColorSpace;
31110
+
31111
+ }
31112
+
31113
+ set outputColorSpace( colorSpace ) {
31114
+
31115
+ this._outputColorSpace = colorSpace;
31116
+
31117
+ const gl = this.getContext();
31118
+ gl.drawingBufferColorSpace = colorSpace === DisplayP3ColorSpace ? 'display-p3' : 'srgb';
31119
+ gl.unpackColorSpace = ColorManagement.workingColorSpace === LinearDisplayP3ColorSpace ? 'display-p3' : 'srgb';
31120
+
31121
+ }
31122
+
31049
31123
  get physicallyCorrectLights() { // @deprecated, r150
31050
31124
 
31051
31125
  console.warn( 'THREE.WebGLRenderer: The property .physicallyCorrectLights has been removed. Set renderer.useLegacyLights instead.' );
@@ -31117,6 +31191,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
31117
31191
 
31118
31192
  return {
31119
31193
  type: 'FogExp2',
31194
+ name: this.name,
31120
31195
  color: this.color.getHex(),
31121
31196
  density: this.density
31122
31197
  };
@@ -31150,6 +31225,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
31150
31225
 
31151
31226
  return {
31152
31227
  type: 'Fog',
31228
+ name: this.name,
31153
31229
  color: this.color.getHex(),
31154
31230
  near: this.near,
31155
31231
  far: this.far
@@ -31755,7 +31831,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
31755
31831
 
31756
31832
  class Sprite extends Object3D {
31757
31833
 
31758
- constructor( material ) {
31834
+ constructor( material = new SpriteMaterial() ) {
31759
31835
 
31760
31836
  super();
31761
31837
 
@@ -31783,7 +31859,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
31783
31859
  }
31784
31860
 
31785
31861
  this.geometry = _geometry;
31786
- this.material = ( material !== undefined ) ? material : new SpriteMaterial();
31862
+ this.material = material;
31787
31863
 
31788
31864
  this.center = new Vector2( 0.5, 0.5 );
31789
31865
 
@@ -32987,7 +33063,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
32987
33063
 
32988
33064
  super.copy( source, recursive );
32989
33065
 
32990
- this.material = source.material;
33066
+ this.material = Array.isArray( source.material ) ? source.material.slice() : source.material;
32991
33067
  this.geometry = source.geometry;
32992
33068
 
32993
33069
  return this;
@@ -33308,7 +33384,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
33308
33384
 
33309
33385
  super.copy( source, recursive );
33310
33386
 
33311
- this.material = source.material;
33387
+ this.material = Array.isArray( source.material ) ? source.material.slice() : source.material;
33312
33388
  this.geometry = source.geometry;
33313
33389
 
33314
33390
  return this;
@@ -35077,10 +35153,13 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
35077
35153
 
35078
35154
  if ( ! startPoint.equals( endPoint ) ) {
35079
35155
 
35080
- this.curves.push( new LineCurve( endPoint, startPoint ) );
35156
+ const lineType = ( startPoint.isVector2 === true ) ? 'LineCurve' : 'LineCurve3';
35157
+ this.curves.push( new Curves[ lineType ]( endPoint, startPoint ) );
35081
35158
 
35082
35159
  }
35083
35160
 
35161
+ return this;
35162
+
35084
35163
  }
35085
35164
 
35086
35165
  // To get accurate point with reference to
@@ -40436,21 +40515,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
40436
40515
 
40437
40516
  }
40438
40517
 
40439
- // same as Array.prototype.slice, but also works on typed arrays
40440
- function arraySlice( array, from, to ) {
40441
-
40442
- if ( isTypedArray( array ) ) {
40443
-
40444
- // in ios9 array.subarray(from, undefined) will return empty array
40445
- // but array.subarray(from) or array.subarray(from, len) is correct
40446
- return new array.constructor( array.subarray( from, to !== undefined ? to : array.length ) );
40447
-
40448
- }
40449
-
40450
- return array.slice( from, to );
40451
-
40452
- }
40453
-
40454
40518
  // converts an array to a specific type
40455
40519
  function convertArray( array, type, forceClone ) {
40456
40520
 
@@ -40714,14 +40778,14 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
40714
40778
  // Reference frame is earlier than the first keyframe, so just use the first keyframe
40715
40779
  const startIndex = referenceOffset;
40716
40780
  const endIndex = referenceValueSize - referenceOffset;
40717
- referenceValue = arraySlice( referenceTrack.values, startIndex, endIndex );
40781
+ referenceValue = referenceTrack.values.slice( startIndex, endIndex );
40718
40782
 
40719
40783
  } else if ( referenceTime >= referenceTrack.times[ lastIndex ] ) {
40720
40784
 
40721
40785
  // Reference frame is after the last keyframe, so just use the last keyframe
40722
40786
  const startIndex = lastIndex * referenceValueSize + referenceOffset;
40723
40787
  const endIndex = startIndex + referenceValueSize - referenceOffset;
40724
- referenceValue = arraySlice( referenceTrack.values, startIndex, endIndex );
40788
+ referenceValue = referenceTrack.values.slice( startIndex, endIndex );
40725
40789
 
40726
40790
  } else {
40727
40791
 
@@ -40730,7 +40794,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
40730
40794
  const startIndex = referenceOffset;
40731
40795
  const endIndex = referenceValueSize - referenceOffset;
40732
40796
  interpolant.evaluate( referenceTime );
40733
- referenceValue = arraySlice( interpolant.resultBuffer, startIndex, endIndex );
40797
+ referenceValue = interpolant.resultBuffer.slice( startIndex, endIndex );
40734
40798
 
40735
40799
  }
40736
40800
 
@@ -40785,7 +40849,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
40785
40849
  }
40786
40850
 
40787
40851
  const AnimationUtils = {
40788
- arraySlice: arraySlice,
40789
40852
  convertArray: convertArray,
40790
40853
  isTypedArray: isTypedArray,
40791
40854
  getKeyframeOrder: getKeyframeOrder,
@@ -41468,8 +41531,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
41468
41531
  }
41469
41532
 
41470
41533
  const stride = this.getValueSize();
41471
- this.times = arraySlice( times, from, to );
41472
- this.values = arraySlice( this.values, from * stride, to * stride );
41534
+ this.times = times.slice( from, to );
41535
+ this.values = this.values.slice( from * stride, to * stride );
41473
41536
 
41474
41537
  }
41475
41538
 
@@ -41559,8 +41622,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
41559
41622
  optimize() {
41560
41623
 
41561
41624
  // times or values may be shared with other tracks, so overwriting is unsafe
41562
- const times = arraySlice( this.times ),
41563
- values = arraySlice( this.values ),
41625
+ const times = this.times.slice(),
41626
+ values = this.values.slice(),
41564
41627
  stride = this.getValueSize(),
41565
41628
 
41566
41629
  smoothInterpolation = this.getInterpolation() === InterpolateSmooth,
@@ -41653,8 +41716,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
41653
41716
 
41654
41717
  if ( writeIndex !== times.length ) {
41655
41718
 
41656
- this.times = arraySlice( times, 0, writeIndex );
41657
- this.values = arraySlice( values, 0, writeIndex * stride );
41719
+ this.times = times.slice( 0, writeIndex );
41720
+ this.values = values.slice( 0, writeIndex * stride );
41658
41721
 
41659
41722
  } else {
41660
41723
 
@@ -41669,8 +41732,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
41669
41732
 
41670
41733
  clone() {
41671
41734
 
41672
- const times = arraySlice( this.times, 0 );
41673
- const values = arraySlice( this.values, 0 );
41735
+ const times = this.times.slice();
41736
+ const values = this.values.slice();
41674
41737
 
41675
41738
  const TypedKeyframeTrack = this.constructor;
41676
41739
  const track = new TypedKeyframeTrack( this.name, times, values );
@@ -43144,8 +43207,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
43144
43207
 
43145
43208
  }
43146
43209
 
43147
- if ( ! texData ) return onError(); // TODO: Remove this when all loaders properly throw errors
43148
-
43149
43210
  if ( texData.image !== undefined ) {
43150
43211
 
43151
43212
  texture.image = texData.image;
@@ -44251,7 +44312,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
44251
44312
 
44252
44313
  if ( json.rotation !== undefined ) material.rotation = json.rotation;
44253
44314
 
44254
- if ( json.linewidth !== 1 ) material.linewidth = json.linewidth;
44315
+ if ( json.linewidth !== undefined ) material.linewidth = json.linewidth;
44255
44316
  if ( json.dashSize !== undefined ) material.dashSize = json.dashSize;
44256
44317
  if ( json.gapSize !== undefined ) material.gapSize = json.gapSize;
44257
44318
  if ( json.scale !== undefined ) material.scale = json.scale;
@@ -45532,6 +45593,12 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
45532
45593
 
45533
45594
  }
45534
45595
 
45596
+ if ( data.fog.name !== '' ) {
45597
+
45598
+ object.fog.name = data.fog.name;
45599
+
45600
+ }
45601
+
45535
45602
  }
45536
45603
 
45537
45604
  if ( data.backgroundBlurriness !== undefined ) object.backgroundBlurriness = data.backgroundBlurriness;
@@ -46016,48 +46083,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
46016
46083
 
46017
46084
  }
46018
46085
 
46019
- class HemisphereLightProbe extends LightProbe {
46020
-
46021
- constructor( skyColor, groundColor, intensity = 1 ) {
46022
-
46023
- super( undefined, intensity );
46024
-
46025
- this.isHemisphereLightProbe = true;
46026
-
46027
- const color1 = new Color().set( skyColor );
46028
- const color2 = new Color().set( groundColor );
46029
-
46030
- const sky = new Vector3( color1.r, color1.g, color1.b );
46031
- const ground = new Vector3( color2.r, color2.g, color2.b );
46032
-
46033
- // without extra factor of PI in the shader, should = 1 / Math.sqrt( Math.PI );
46034
- const c0 = Math.sqrt( Math.PI );
46035
- const c1 = c0 * Math.sqrt( 0.75 );
46036
-
46037
- this.sh.coefficients[ 0 ].copy( sky ).add( ground ).multiplyScalar( c0 );
46038
- this.sh.coefficients[ 1 ].copy( sky ).sub( ground ).multiplyScalar( c1 );
46039
-
46040
- }
46041
-
46042
- }
46043
-
46044
- class AmbientLightProbe extends LightProbe {
46045
-
46046
- constructor( color, intensity = 1 ) {
46047
-
46048
- super( undefined, intensity );
46049
-
46050
- this.isAmbientLightProbe = true;
46051
-
46052
- const color1 = new Color().set( color );
46053
-
46054
- // without extra factor of PI in the shader, would be 2 / Math.sqrt( Math.PI );
46055
- this.sh.coefficients[ 0 ].set( color1.r, color1.g, color1.b ).multiplyScalar( 2 * Math.sqrt( Math.PI ) );
46056
-
46057
- }
46058
-
46059
- }
46060
-
46061
46086
  const _eyeRight = /*@__PURE__*/ new Matrix4();
46062
46087
  const _eyeLeft = /*@__PURE__*/ new Matrix4();
46063
46088
  const _projectionMatrix = /*@__PURE__*/ new Matrix4();
@@ -46566,6 +46591,12 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
46566
46591
 
46567
46592
  disconnect() {
46568
46593
 
46594
+ if ( this._connected === false ) {
46595
+
46596
+ return;
46597
+
46598
+ }
46599
+
46569
46600
  if ( this.filters.length > 0 ) {
46570
46601
 
46571
46602
  this.source.disconnect( this.filters[ 0 ] );
@@ -49814,7 +49845,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
49814
49845
 
49815
49846
  }
49816
49847
 
49817
- let id = 0;
49848
+ let _id = 0;
49818
49849
 
49819
49850
  class UniformsGroup extends EventDispatcher {
49820
49851
 
@@ -49824,7 +49855,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
49824
49855
 
49825
49856
  this.isUniformsGroup = true;
49826
49857
 
49827
- Object.defineProperty( this, 'id', { value: id ++ } );
49858
+ Object.defineProperty( this, 'id', { value: _id ++ } );
49828
49859
 
49829
49860
  this.name = '';
49830
49861
 
@@ -52102,7 +52133,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
52102
52133
  exports.AlwaysDepth = AlwaysDepth;
52103
52134
  exports.AlwaysStencilFunc = AlwaysStencilFunc;
52104
52135
  exports.AmbientLight = AmbientLight;
52105
- exports.AmbientLightProbe = AmbientLightProbe;
52106
52136
  exports.AnimationAction = AnimationAction;
52107
52137
  exports.AnimationClip = AnimationClip;
52108
52138
  exports.AnimationLoader = AnimationLoader;
@@ -52225,7 +52255,6 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
52225
52255
  exports.HalfFloatType = HalfFloatType;
52226
52256
  exports.HemisphereLight = HemisphereLight;
52227
52257
  exports.HemisphereLightHelper = HemisphereLightHelper;
52228
- exports.HemisphereLightProbe = HemisphereLightProbe;
52229
52258
  exports.IcosahedronGeometry = IcosahedronGeometry;
52230
52259
  exports.ImageBitmapLoader = ImageBitmapLoader;
52231
52260
  exports.ImageLoader = ImageLoader;
@@ -52268,6 +52297,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
52268
52297
  exports.LineDashedMaterial = LineDashedMaterial;
52269
52298
  exports.LineLoop = LineLoop;
52270
52299
  exports.LineSegments = LineSegments;
52300
+ exports.LinearDisplayP3ColorSpace = LinearDisplayP3ColorSpace;
52271
52301
  exports.LinearEncoding = LinearEncoding;
52272
52302
  exports.LinearFilter = LinearFilter;
52273
52303
  exports.LinearInterpolant = LinearInterpolant;
@@ -52277,6 +52307,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
52277
52307
  exports.LinearMipmapNearestFilter = LinearMipmapNearestFilter;
52278
52308
  exports.LinearSRGBColorSpace = LinearSRGBColorSpace;
52279
52309
  exports.LinearToneMapping = LinearToneMapping;
52310
+ exports.LinearTransfer = LinearTransfer;
52280
52311
  exports.Loader = Loader;
52281
52312
  exports.LoaderUtils = LoaderUtils;
52282
52313
  exports.LoadingManager = LoadingManager;
@@ -52335,6 +52366,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
52335
52366
  exports.OneMinusSrcAlphaFactor = OneMinusSrcAlphaFactor;
52336
52367
  exports.OneMinusSrcColorFactor = OneMinusSrcColorFactor;
52337
52368
  exports.OrthographicCamera = OrthographicCamera;
52369
+ exports.P3Primaries = P3Primaries;
52338
52370
  exports.PCFShadowMap = PCFShadowMap;
52339
52371
  exports.PCFSoftShadowMap = PCFSoftShadowMap;
52340
52372
  exports.PMREMGenerator = PMREMGenerator;
@@ -52384,6 +52416,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
52384
52416
  exports.RGBA_S3TC_DXT1_Format = RGBA_S3TC_DXT1_Format;
52385
52417
  exports.RGBA_S3TC_DXT3_Format = RGBA_S3TC_DXT3_Format;
52386
52418
  exports.RGBA_S3TC_DXT5_Format = RGBA_S3TC_DXT5_Format;
52419
+ exports.RGB_BPTC_SIGNED_Format = RGB_BPTC_SIGNED_Format;
52420
+ exports.RGB_BPTC_UNSIGNED_Format = RGB_BPTC_UNSIGNED_Format;
52387
52421
  exports.RGB_ETC1_Format = RGB_ETC1_Format;
52388
52422
  exports.RGB_ETC2_Format = RGB_ETC2_Format;
52389
52423
  exports.RGB_PVRTC_2BPPV1_Format = RGB_PVRTC_2BPPV1_Format;
@@ -52394,6 +52428,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
52394
52428
  exports.RawShaderMaterial = RawShaderMaterial;
52395
52429
  exports.Ray = Ray;
52396
52430
  exports.Raycaster = Raycaster;
52431
+ exports.Rec709Primaries = Rec709Primaries;
52397
52432
  exports.RectAreaLight = RectAreaLight;
52398
52433
  exports.RedFormat = RedFormat;
52399
52434
  exports.RedIntegerFormat = RedIntegerFormat;
@@ -52406,6 +52441,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
52406
52441
  exports.SIGNED_RED_GREEN_RGTC2_Format = SIGNED_RED_GREEN_RGTC2_Format;
52407
52442
  exports.SIGNED_RED_RGTC1_Format = SIGNED_RED_RGTC1_Format;
52408
52443
  exports.SRGBColorSpace = SRGBColorSpace;
52444
+ exports.SRGBTransfer = SRGBTransfer;
52409
52445
  exports.Scene = Scene;
52410
52446
  exports.ShaderChunk = ShaderChunk;
52411
52447
  exports.ShaderLib = ShaderLib;
@@ -52493,6 +52529,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
52493
52529
  exports.ZeroSlopeEnding = ZeroSlopeEnding;
52494
52530
  exports.ZeroStencilOp = ZeroStencilOp;
52495
52531
  exports._SRGBAFormat = _SRGBAFormat;
52532
+ exports.createCanvasElement = createCanvasElement;
52496
52533
  exports.sRGBEncoding = sRGBEncoding;
52497
52534
 
52498
52535
  }));