super-three 0.184.0 → 0.185.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 (366) hide show
  1. package/build/three.cjs +1260 -927
  2. package/build/three.core.js +1104 -829
  3. package/build/three.core.min.js +1 -1
  4. package/build/three.module.js +156 -98
  5. package/build/three.module.min.js +1 -1
  6. package/build/three.tsl.js +11 -4
  7. package/build/three.tsl.min.js +1 -1
  8. package/build/three.webgpu.js +7538 -3367
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +7538 -3366
  11. package/build/three.webgpu.nodes.min.js +1 -1
  12. package/examples/jsm/Addons.js +3 -0
  13. package/examples/jsm/controls/ArcballControls.js +6 -2
  14. package/examples/jsm/controls/FirstPersonControls.js +79 -42
  15. package/examples/jsm/controls/TransformControls.js +68 -15
  16. package/examples/jsm/csm/CSMFrustum.js +31 -6
  17. package/examples/jsm/csm/CSMShadowNode.js +4 -1
  18. package/examples/jsm/effects/AsciiEffect.js +14 -1
  19. package/examples/jsm/exporters/DRACOExporter.js +27 -6
  20. package/examples/jsm/exporters/GLTFExporter.js +114 -12
  21. package/examples/jsm/exporters/PLYExporter.js +286 -73
  22. package/examples/jsm/exporters/USDZExporter.js +347 -112
  23. package/examples/jsm/generators/CityGenerator.js +346 -0
  24. package/examples/jsm/generators/ForestGenerator.js +347 -0
  25. package/examples/jsm/generators/TerrainGenerator.js +504 -0
  26. package/examples/jsm/generators/TreeGenerator.js +377 -0
  27. package/examples/jsm/generators/city/SidewalkGenerator.js +253 -0
  28. package/examples/jsm/generators/city/SkyscraperGenerator.js +1357 -0
  29. package/examples/jsm/geometries/LoftGeometry.js +355 -0
  30. package/examples/jsm/helpers/LightProbeGridHelper.js +1 -1
  31. package/examples/jsm/helpers/LightProbeHelper.js +5 -4
  32. package/examples/jsm/helpers/ViewHelper.js +16 -6
  33. package/examples/jsm/inspector/Inspector.js +53 -15
  34. package/examples/jsm/inspector/RendererInspector.js +152 -36
  35. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +1 -1
  36. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +1 -1
  37. package/examples/jsm/inspector/tabs/Console.js +200 -18
  38. package/examples/jsm/inspector/tabs/Memory.js +8 -0
  39. package/examples/jsm/inspector/tabs/Parameters.js +64 -4
  40. package/examples/jsm/inspector/tabs/Performance.js +21 -6
  41. package/examples/jsm/inspector/tabs/Settings.js +51 -9
  42. package/examples/jsm/inspector/tabs/Timeline.js +178 -93
  43. package/examples/jsm/inspector/tabs/Viewer.js +628 -16
  44. package/examples/jsm/inspector/ui/Graph.js +162 -25
  45. package/examples/jsm/inspector/ui/Item.js +92 -13
  46. package/examples/jsm/inspector/ui/List.js +1 -1
  47. package/examples/jsm/inspector/ui/Profiler.js +90 -45
  48. package/examples/jsm/inspector/ui/Style.js +1788 -1401
  49. package/examples/jsm/inspector/ui/Tab.js +5 -3
  50. package/examples/jsm/inspector/ui/Values.js +71 -6
  51. package/examples/jsm/inspector/ui/utils.js +130 -10
  52. package/examples/jsm/libs/basis/README.md +0 -1
  53. package/examples/jsm/libs/demuxer_mp4.js +3 -3
  54. package/examples/jsm/libs/draco/README.md +0 -1
  55. package/examples/jsm/libs/meshopt_clusterizer.module.js +421 -0
  56. package/examples/jsm/libs/meshopt_simplifier.module.js +627 -0
  57. package/examples/jsm/libs/mikktspace.module.js +34 -9
  58. package/examples/jsm/lighting/ClusteredLighting.js +55 -0
  59. package/examples/jsm/lighting/LightProbeGrid.js +106 -76
  60. package/examples/jsm/lines/LineMaterial.js +38 -15
  61. package/examples/jsm/lines/LineSegments2.js +8 -0
  62. package/examples/jsm/lines/webgpu/LineSegments2.js +8 -0
  63. package/examples/jsm/loaders/3DMLoader.js +1 -1
  64. package/examples/jsm/loaders/DRACOLoader.js +46 -13
  65. package/examples/jsm/loaders/EXRLoader.js +27 -55
  66. package/examples/jsm/loaders/HDRLoader.js +6 -28
  67. package/examples/jsm/loaders/KTX2Loader.js +31 -12
  68. package/examples/jsm/loaders/LDrawLoader.js +8 -8
  69. package/examples/jsm/loaders/LUT3dlLoader.js +2 -2
  70. package/examples/jsm/loaders/LUTCubeLoader.js +2 -2
  71. package/examples/jsm/loaders/LWOLoader.js +4 -0
  72. package/examples/jsm/loaders/LottieLoader.js +1 -1
  73. package/examples/jsm/loaders/MaterialXLoader.js +31 -9
  74. package/examples/jsm/loaders/NRRDLoader.js +3 -3
  75. package/examples/jsm/loaders/PCDLoader.js +7 -7
  76. package/examples/jsm/loaders/PLYLoader.js +218 -55
  77. package/examples/jsm/loaders/SVGLoader.js +547 -495
  78. package/examples/jsm/loaders/TTFLoader.js +1 -1
  79. package/examples/jsm/loaders/USDLoader.js +33 -9
  80. package/examples/jsm/loaders/VRMLLoader.js +1 -1
  81. package/examples/jsm/loaders/usd/USDAParser.js +93 -20
  82. package/examples/jsm/loaders/usd/USDCParser.js +1 -1
  83. package/examples/jsm/loaders/usd/USDComposer.js +52 -19
  84. package/examples/jsm/misc/TileCreasedNormalsPlugin.js +270 -0
  85. package/examples/jsm/misc/Volume.js +2 -2
  86. package/examples/jsm/objects/GroundedSkybox.js +1 -1
  87. package/examples/jsm/objects/Reflector.js +2 -3
  88. package/examples/jsm/objects/Water2Mesh.js +1 -1
  89. package/examples/jsm/physics/AmmoPhysics.js +15 -8
  90. package/examples/jsm/physics/RapierPhysics.js +27 -2
  91. package/examples/jsm/shaders/VolumeShader.js +31 -44
  92. package/examples/jsm/transpiler/GLSLDecoder.js +6 -6
  93. package/examples/jsm/transpiler/Linker.js +1 -1
  94. package/examples/jsm/tsl/display/BloomNode.js +59 -19
  95. package/examples/jsm/tsl/display/DepthOfFieldNode.js +2 -2
  96. package/examples/jsm/tsl/display/FXAANode.js +11 -12
  97. package/examples/jsm/tsl/display/GTAONode.js +34 -13
  98. package/examples/jsm/tsl/display/GodraysNode.js +1 -1
  99. package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +560 -0
  100. package/examples/jsm/tsl/display/PixelationPassNode.js +2 -2
  101. package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +912 -0
  102. package/examples/jsm/tsl/display/SSAAPassNode.js +13 -25
  103. package/examples/jsm/tsl/display/SSGINode.js +89 -39
  104. package/examples/jsm/tsl/display/SSRNode.js +829 -132
  105. package/examples/jsm/tsl/display/SSSNode.js +2 -2
  106. package/examples/jsm/tsl/display/TemporalReprojectNode.js +1023 -0
  107. package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +622 -0
  108. package/examples/jsm/tsl/lighting/DynamicLightsNode.js +1 -1
  109. package/examples/jsm/tsl/math/curlNoise.js +107 -0
  110. package/examples/jsm/tsl/shadows/TileShadowNode.js +1 -1
  111. package/examples/jsm/tsl/shadows/TileShadowNodeHelper.js +3 -3
  112. package/examples/jsm/tsl/utils/GroundedSkybox.js +62 -0
  113. package/examples/jsm/tsl/utils/RNoise.js +51 -0
  114. package/examples/jsm/tsl/utils/SpecularHelpers.js +325 -0
  115. package/examples/jsm/utils/BufferGeometryUtils.js +126 -59
  116. package/examples/jsm/utils/GeometryCompressionUtils.js +1 -1
  117. package/examples/jsm/utils/SceneOptimizer.js +1 -1
  118. package/examples/jsm/webxr/ARButton.js +1 -1
  119. package/examples/jsm/webxr/WebGLXRFallback.js +89 -0
  120. package/examples/jsm/webxr/XRControllerModelFactory.js +2 -2
  121. package/package.json +7 -7
  122. package/src/Three.TSL.js +10 -3
  123. package/src/Three.WebGPU.js +4 -0
  124. package/src/animation/AnimationAction.js +15 -11
  125. package/src/animation/AnimationClip.js +0 -139
  126. package/src/animation/KeyframeTrack.js +2 -2
  127. package/src/animation/PropertyBinding.js +2 -2
  128. package/src/cameras/Camera.js +2 -2
  129. package/src/cameras/StereoCamera.js +5 -2
  130. package/src/constants.js +1 -1
  131. package/src/core/BufferGeometry.js +29 -7
  132. package/src/core/Object3D.js +17 -7
  133. package/src/core/Raycaster.js +1 -1
  134. package/src/core/RenderTarget.js +15 -2
  135. package/src/extras/PMREMGenerator.js +6 -4
  136. package/src/extras/TextureUtils.js +1 -1
  137. package/src/extras/core/ShapePath.js +149 -160
  138. package/src/geometries/SphereGeometry.js +8 -3
  139. package/src/helpers/DirectionalLightHelper.js +2 -0
  140. package/src/helpers/HemisphereLightHelper.js +2 -0
  141. package/src/helpers/PointLightHelper.js +2 -0
  142. package/src/helpers/SpotLightHelper.js +1 -1
  143. package/src/loaders/DataTextureLoader.js +69 -38
  144. package/src/loaders/LoadingManager.js +5 -0
  145. package/src/loaders/MaterialLoader.js +36 -266
  146. package/src/loaders/ObjectLoader.js +3 -1
  147. package/src/materials/LineBasicMaterial.js +4 -0
  148. package/src/materials/Material.js +196 -1
  149. package/src/materials/MeshBasicMaterial.js +24 -0
  150. package/src/materials/MeshDepthMaterial.js +10 -0
  151. package/src/materials/MeshDistanceMaterial.js +10 -0
  152. package/src/materials/MeshLambertMaterial.js +40 -1
  153. package/src/materials/MeshMatcapMaterial.js +25 -1
  154. package/src/materials/MeshNormalMaterial.js +9 -1
  155. package/src/materials/MeshPhongMaterial.js +40 -1
  156. package/src/materials/MeshPhysicalMaterial.js +38 -0
  157. package/src/materials/MeshStandardMaterial.js +42 -1
  158. package/src/materials/MeshToonMaterial.js +34 -1
  159. package/src/materials/PointsMaterial.js +7 -0
  160. package/src/materials/ShaderMaterial.js +86 -0
  161. package/src/materials/SpriteMaterial.js +7 -0
  162. package/src/materials/nodes/Line2NodeMaterial.js +378 -322
  163. package/src/materials/nodes/MeshBasicNodeMaterial.js +2 -2
  164. package/src/materials/nodes/MeshNormalNodeMaterial.js +2 -2
  165. package/src/materials/nodes/MeshPhongNodeMaterial.js +0 -9
  166. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +0 -30
  167. package/src/materials/nodes/MeshSSSNodeMaterial.js +0 -13
  168. package/src/materials/nodes/MeshStandardNodeMaterial.js +0 -11
  169. package/src/materials/nodes/NodeMaterial.js +115 -71
  170. package/src/materials/nodes/SpriteNodeMaterial.js +0 -10
  171. package/src/materials/nodes/manager/NodeMaterialObserver.js +49 -20
  172. package/src/math/Box3.js +5 -0
  173. package/src/math/FrustumArray.js +103 -133
  174. package/src/math/Interpolant.js +1 -1
  175. package/src/math/MathUtils.js +2 -2
  176. package/src/math/Matrix3.js +11 -0
  177. package/src/math/Matrix4.js +28 -3
  178. package/src/math/Vector2.js +2 -2
  179. package/src/math/Vector3.js +2 -2
  180. package/src/math/Vector4.js +2 -2
  181. package/src/math/interpolants/BezierInterpolant.js +4 -6
  182. package/src/nodes/Nodes.js +2 -5
  183. package/src/nodes/TSL.js +8 -6
  184. package/src/nodes/accessors/Arrays.js +4 -4
  185. package/src/nodes/accessors/Batch.js +108 -0
  186. package/src/nodes/accessors/Bitangent.js +2 -2
  187. package/src/nodes/accessors/BufferAttributeNode.js +13 -2
  188. package/src/nodes/accessors/Camera.js +7 -7
  189. package/src/nodes/accessors/ClippingNode.js +1 -1
  190. package/src/nodes/accessors/Instance.js +264 -0
  191. package/src/nodes/accessors/MaterialNode.js +18 -2
  192. package/src/nodes/accessors/MaterialProperties.js +4 -3
  193. package/src/nodes/accessors/{MorphNode.js → Morph.js} +99 -112
  194. package/src/nodes/accessors/Normal.js +13 -13
  195. package/src/nodes/accessors/Position.js +5 -1
  196. package/src/nodes/accessors/ReferenceNode.js +1 -0
  197. package/src/nodes/accessors/ReflectVector.js +3 -3
  198. package/src/nodes/accessors/SceneProperties.js +1 -1
  199. package/src/nodes/accessors/Skinning.js +263 -0
  200. package/src/nodes/accessors/StorageBufferNode.js +2 -2
  201. package/src/nodes/accessors/StorageTexture3DNode.js +100 -0
  202. package/src/nodes/accessors/StorageTextureNode.js +39 -7
  203. package/src/nodes/accessors/Tangent.js +4 -4
  204. package/src/nodes/accessors/TextureNode.js +60 -5
  205. package/src/nodes/code/FunctionNode.js +2 -16
  206. package/src/nodes/core/MRTNode.js +7 -2
  207. package/src/nodes/core/Node.js +39 -2
  208. package/src/nodes/core/NodeBuilder.js +201 -41
  209. package/src/nodes/core/NodeUtils.js +13 -13
  210. package/src/nodes/core/OutputStructNode.js +1 -1
  211. package/src/nodes/core/OverrideContextNode.js +153 -0
  212. package/src/nodes/core/PropertyNode.js +51 -5
  213. package/src/nodes/core/StackNode.js +56 -34
  214. package/src/nodes/core/StructNode.js +4 -6
  215. package/src/nodes/core/StructTypeNode.js +6 -6
  216. package/src/nodes/core/VarNode.js +8 -0
  217. package/src/nodes/core/VaryingNode.js +12 -2
  218. package/src/nodes/display/BlendModes.js +1 -41
  219. package/src/nodes/display/BumpMapNode.js +6 -1
  220. package/src/nodes/display/ColorAdjustment.js +10 -9
  221. package/src/nodes/display/FrontFacingNode.js +38 -9
  222. package/src/nodes/display/NormalMapNode.js +2 -2
  223. package/src/nodes/display/PassNode.js +35 -43
  224. package/src/nodes/display/PremultiplyAlphaFunctions.js +39 -0
  225. package/src/nodes/display/RenderOutputNode.js +12 -3
  226. package/src/nodes/functions/VolumetricLightingModel.js +40 -7
  227. package/src/nodes/gpgpu/WorkgroupInfoNode.js +1 -1
  228. package/src/nodes/lighting/EnvironmentNode.js +2 -2
  229. package/src/nodes/lighting/IESSpotLightNode.js +40 -2
  230. package/src/nodes/lighting/LightingContextNode.js +10 -2
  231. package/src/nodes/lighting/LightsNode.js +90 -37
  232. package/src/nodes/lighting/PointShadowNode.js +6 -1
  233. package/src/nodes/lighting/ShadowFilterNode.js +21 -52
  234. package/src/nodes/lighting/ShadowNode.js +34 -14
  235. package/src/nodes/materialx/lib/mx_noise.js +2 -2
  236. package/src/nodes/math/ConditionalNode.js +3 -3
  237. package/src/nodes/math/MathNode.js +39 -11
  238. package/src/nodes/math/OperatorNode.js +23 -23
  239. package/src/nodes/parsers/GLSLNodeFunction.js +1 -1
  240. package/src/nodes/pmrem/PMREMNode.js +33 -2
  241. package/src/nodes/tsl/TSLCore.js +63 -18
  242. package/src/nodes/utils/EquirectUV.js +30 -5
  243. package/src/nodes/utils/FunctionOverloadingNode.js +1 -1
  244. package/src/nodes/utils/Packing.js +35 -4
  245. package/src/nodes/utils/RTTNode.js +40 -24
  246. package/src/nodes/utils/ReflectorNode.js +1 -0
  247. package/src/nodes/utils/StorageArrayElementNode.js +1 -1
  248. package/src/objects/BatchedMesh.js +22 -14
  249. package/src/objects/InstancedMesh.js +0 -11
  250. package/src/objects/Skeleton.js +0 -9
  251. package/src/renderers/WebGLRenderer.js +19 -15
  252. package/src/renderers/common/Backend.js +49 -5
  253. package/src/renderers/common/Bindings.js +114 -45
  254. package/src/renderers/common/Buffer.js +9 -0
  255. package/src/renderers/common/ClippingContext.js +10 -2
  256. package/src/renderers/common/Info.js +63 -22
  257. package/src/renderers/common/Lighting.js +53 -5
  258. package/src/renderers/common/RenderList.js +41 -4
  259. package/src/renderers/common/RenderObject.js +73 -13
  260. package/src/renderers/common/Renderer.js +281 -108
  261. package/src/renderers/common/Sampler.js +16 -48
  262. package/src/renderers/common/Textures.js +32 -5
  263. package/src/renderers/common/TimestampQueryPool.js +1 -1
  264. package/src/renderers/common/UniformsGroup.js +31 -9
  265. package/src/renderers/common/XRManager.js +340 -22
  266. package/src/renderers/common/extras/PMREMGenerator.js +15 -38
  267. package/src/renderers/common/nodes/NodeBuilderState.js +9 -1
  268. package/src/renderers/common/nodes/NodeLibrary.js +4 -4
  269. package/src/renderers/common/nodes/NodeManager.js +63 -14
  270. package/src/renderers/common/nodes/NodeUniformBuffer.js +13 -0
  271. package/src/renderers/shaders/ShaderChunk/common.glsl.js +13 -4
  272. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +0 -6
  273. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +1 -1
  274. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +2 -2
  275. package/src/renderers/shaders/ShaderChunk/envmap_vertex.glsl.js +1 -1
  276. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +1 -1
  277. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +1 -1
  278. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +2 -2
  279. package/src/renderers/shaders/ShaderChunk/normal_vertex.glsl.js +6 -0
  280. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +1 -1
  281. package/src/renderers/shaders/ShaderChunk/transmission_fragment.glsl.js +1 -1
  282. package/src/renderers/shaders/ShaderLib/distance.glsl.js +1 -1
  283. package/src/renderers/webgl/WebGLOutput.js +2 -1
  284. package/src/renderers/webgl/WebGLProgram.js +5 -4
  285. package/src/renderers/webgl/WebGLPrograms.js +12 -5
  286. package/src/renderers/webgl/WebGLRenderLists.js +9 -1
  287. package/src/renderers/webgl/WebGLShaderCache.js +5 -11
  288. package/src/renderers/webgl/WebGLTextures.js +20 -7
  289. package/src/renderers/webgl/WebGLUniformsGroups.js +66 -38
  290. package/src/renderers/webgl-fallback/WebGLBackend.js +84 -25
  291. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +138 -8
  292. package/src/renderers/webgl-fallback/utils/WebGLAttributeUtils.js +1 -1
  293. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +52 -22
  294. package/src/renderers/webgl-fallback/utils/WebGLUtils.js +4 -2
  295. package/src/renderers/webgpu/WebGPUBackend.js +480 -169
  296. package/src/renderers/webgpu/descriptors/GPUBindGroupDescriptor.js +48 -0
  297. package/src/renderers/webgpu/descriptors/GPUBufferDescriptor.js +57 -0
  298. package/src/renderers/webgpu/descriptors/GPUCommandEncoderDescriptor.js +30 -0
  299. package/src/renderers/webgpu/descriptors/GPUComputePassDescriptor.js +38 -0
  300. package/src/renderers/webgpu/descriptors/GPUComputePipelineDescriptor.js +48 -0
  301. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageDestInfo.js +47 -0
  302. package/src/renderers/webgpu/descriptors/GPUCopyExternalImageSourceInfo.js +50 -0
  303. package/src/renderers/webgpu/descriptors/GPUExtent3D.js +51 -0
  304. package/src/renderers/webgpu/descriptors/GPUPipelineLayoutDescriptor.js +39 -0
  305. package/src/renderers/webgpu/descriptors/GPUQuerySetDescriptor.js +47 -0
  306. package/src/renderers/webgpu/descriptors/GPURenderBundleEncoderDescriptor.js +74 -0
  307. package/src/renderers/webgpu/descriptors/GPURenderPassColorAttachment.js +72 -0
  308. package/src/renderers/webgpu/descriptors/GPURenderPassDepthStencilAttachment.js +99 -0
  309. package/src/renderers/webgpu/descriptors/GPURenderPassDescriptor.js +72 -0
  310. package/src/renderers/webgpu/descriptors/GPURenderPassTimestampWrites.js +49 -0
  311. package/src/renderers/webgpu/descriptors/GPURenderPipelineDescriptor.js +130 -0
  312. package/src/renderers/webgpu/descriptors/GPUSamplerDescriptor.js +119 -0
  313. package/src/renderers/webgpu/descriptors/GPUShaderModuleDescriptor.js +46 -0
  314. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferInfo.js +57 -0
  315. package/src/renderers/webgpu/descriptors/GPUTexelCopyBufferLayout.js +48 -0
  316. package/src/renderers/webgpu/descriptors/GPUTexelCopyTextureInfo.js +61 -0
  317. package/src/renderers/webgpu/descriptors/GPUTextureDescriptor.js +99 -0
  318. package/src/renderers/webgpu/descriptors/GPUTextureViewDescriptor.js +108 -0
  319. package/src/renderers/webgpu/nodes/StandardNodeLibrary.js +0 -1
  320. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +164 -7
  321. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +1 -1
  322. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +98 -38
  323. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +72 -68
  324. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +164 -69
  325. package/src/renderers/webgpu/utils/WebGPUTexturePassUtils.js +158 -95
  326. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +297 -141
  327. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +33 -18
  328. package/src/renderers/webgpu/utils/WebGPUUtils.js +38 -3
  329. package/src/textures/DepthTexture.js +1 -1
  330. package/src/textures/ExternalTexture.js +0 -3
  331. package/examples/fonts/LICENSE +0 -13
  332. package/examples/fonts/MPLUSRounded1c/MPLUSRounded1c-Regular.typeface.json.zip +0 -0
  333. package/examples/fonts/MPLUSRounded1c/OFL.txt +0 -91
  334. package/examples/fonts/README.md +0 -11
  335. package/examples/fonts/droid/NOTICE +0 -190
  336. package/examples/fonts/droid/README.txt +0 -18
  337. package/examples/fonts/droid/droid_sans_bold.typeface.json +0 -1
  338. package/examples/fonts/droid/droid_sans_mono_regular.typeface.json +0 -1
  339. package/examples/fonts/droid/droid_sans_regular.typeface.json +0 -1
  340. package/examples/fonts/droid/droid_serif_bold.typeface.json +0 -1
  341. package/examples/fonts/droid/droid_serif_regular.typeface.json +0 -1
  342. package/examples/fonts/gentilis_bold.typeface.json +0 -1
  343. package/examples/fonts/gentilis_regular.typeface.json +0 -1
  344. package/examples/fonts/helvetiker_bold.typeface.json +0 -1
  345. package/examples/fonts/helvetiker_regular.typeface.json +0 -1
  346. package/examples/fonts/optimer_bold.typeface.json +0 -1
  347. package/examples/fonts/optimer_regular.typeface.json +0 -1
  348. package/examples/fonts/ttf/README.md +0 -9
  349. package/examples/fonts/ttf/kenpixel.ttf +0 -0
  350. package/examples/jsm/inspector/extensions/extensions.json +0 -6
  351. package/examples/jsm/libs/ammo.wasm.js +0 -822
  352. package/examples/jsm/libs/ammo.wasm.wasm +0 -0
  353. package/examples/jsm/libs/draco/draco_encoder.js +0 -33
  354. package/examples/jsm/libs/draco/gltf/draco_encoder.js +0 -33
  355. package/examples/jsm/libs/lottie_canvas.module.js +0 -14849
  356. package/examples/jsm/libs/opentype.module.js +0 -14506
  357. package/examples/jsm/libs/rhino3dm/rhino3dm.js +0 -21
  358. package/examples/jsm/libs/rhino3dm/rhino3dm.module.js +0 -16
  359. package/examples/jsm/libs/rhino3dm/rhino3dm.wasm +0 -0
  360. package/examples/jsm/lighting/TiledLighting.js +0 -42
  361. package/examples/jsm/tsl/display/AnamorphicNode.js +0 -293
  362. package/examples/jsm/tsl/lighting/TiledLightsNode.js +0 -442
  363. package/src/nodes/accessors/BatchNode.js +0 -163
  364. package/src/nodes/accessors/InstanceNode.js +0 -349
  365. package/src/nodes/accessors/InstancedMeshNode.js +0 -50
  366. package/src/nodes/accessors/SkinningNode.js +0 -328
@@ -3,7 +3,7 @@
3
3
  * Copyright 2010-2026 Three.js Authors
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
- const REVISION = '184';
6
+ const REVISION = '185';
7
7
 
8
8
  /**
9
9
  * Represents mouse buttons and interaction types in context of controls.
@@ -2697,7 +2697,7 @@ function denormalize( value, array ) {
2697
2697
 
2698
2698
  default:
2699
2699
 
2700
- throw new Error( 'Invalid component type.' );
2700
+ throw new Error( 'THREE.MathUtils: Invalid component type.' );
2701
2701
 
2702
2702
  }
2703
2703
 
@@ -2744,7 +2744,7 @@ function normalize( value, array ) {
2744
2744
 
2745
2745
  default:
2746
2746
 
2747
- throw new Error( 'Invalid component type.' );
2747
+ throw new Error( 'THREE.MathUtils: Invalid component type.' );
2748
2748
 
2749
2749
  }
2750
2750
 
@@ -3170,7 +3170,7 @@ class Vector2 {
3170
3170
 
3171
3171
  case 0: this.x = value; break;
3172
3172
  case 1: this.y = value; break;
3173
- default: throw new Error( 'index is out of range: ' + index );
3173
+ default: throw new Error( 'THREE.Vector2: index is out of range: ' + index );
3174
3174
 
3175
3175
  }
3176
3176
 
@@ -3190,7 +3190,7 @@ class Vector2 {
3190
3190
 
3191
3191
  case 0: return this.x;
3192
3192
  case 1: return this.y;
3193
- default: throw new Error( 'index is out of range: ' + index );
3193
+ default: throw new Error( 'THREE.Vector2: index is out of range: ' + index );
3194
3194
 
3195
3195
  }
3196
3196
 
@@ -4945,7 +4945,7 @@ class Vector3 {
4945
4945
  case 0: this.x = value; break;
4946
4946
  case 1: this.y = value; break;
4947
4947
  case 2: this.z = value; break;
4948
- default: throw new Error( 'index is out of range: ' + index );
4948
+ default: throw new Error( 'THREE.Vector3: index is out of range: ' + index );
4949
4949
 
4950
4950
  }
4951
4951
 
@@ -4966,7 +4966,7 @@ class Vector3 {
4966
4966
  case 0: return this.x;
4967
4967
  case 1: return this.y;
4968
4968
  case 2: return this.z;
4969
- default: throw new Error( 'index is out of range: ' + index );
4969
+ default: throw new Error( 'THREE.Vector3: index is out of range: ' + index );
4970
4970
 
4971
4971
  }
4972
4972
 
@@ -6449,12 +6449,15 @@ class Matrix3 {
6449
6449
  /**
6450
6450
  * Scales this matrix with the given scalar values.
6451
6451
  *
6452
+ * @deprecated
6452
6453
  * @param {number} sx - The amount to scale in the X axis.
6453
6454
  * @param {number} sy - The amount to scale in the Y axis.
6454
6455
  * @return {Matrix3} A reference to this matrix.
6455
6456
  */
6456
6457
  scale( sx, sy ) {
6457
6458
 
6459
+ warnOnce( 'Matrix3: .scale() is deprecated. Use .makeScale() instead.' ); // @deprecated r185
6460
+
6458
6461
  this.premultiply( _m3.makeScale( sx, sy ) );
6459
6462
 
6460
6463
  return this;
@@ -6464,11 +6467,14 @@ class Matrix3 {
6464
6467
  /**
6465
6468
  * Rotates this matrix by the given angle.
6466
6469
  *
6470
+ * @deprecated
6467
6471
  * @param {number} theta - The rotation in radians.
6468
6472
  * @return {Matrix3} A reference to this matrix.
6469
6473
  */
6470
6474
  rotate( theta ) {
6471
6475
 
6476
+ warnOnce( 'Matrix3: .rotate() is deprecated. Use .makeRotation() instead.' ); // @deprecated r185
6477
+
6472
6478
  this.premultiply( _m3.makeRotation( - theta ) );
6473
6479
 
6474
6480
  return this;
@@ -6478,12 +6484,15 @@ class Matrix3 {
6478
6484
  /**
6479
6485
  * Translates this matrix by the given scalar values.
6480
6486
  *
6487
+ * @deprecated
6481
6488
  * @param {number} tx - The amount to translate in the X axis.
6482
6489
  * @param {number} ty - The amount to translate in the Y axis.
6483
6490
  * @return {Matrix3} A reference to this matrix.
6484
6491
  */
6485
6492
  translate( tx, ty ) {
6486
6493
 
6494
+ warnOnce( 'Matrix3: .translate() is deprecated. Use .makeTranslation() instead.' ); // @deprecated r185
6495
+
6487
6496
  this.premultiply( _m3.makeTranslation( tx, ty ) );
6488
6497
 
6489
6498
  return this;
@@ -8240,7 +8249,7 @@ class Vector4 {
8240
8249
  case 1: this.y = value; break;
8241
8250
  case 2: this.z = value; break;
8242
8251
  case 3: this.w = value; break;
8243
- default: throw new Error( 'index is out of range: ' + index );
8252
+ default: throw new Error( 'THREE.Vector4: index is out of range: ' + index );
8244
8253
 
8245
8254
  }
8246
8255
 
@@ -8263,7 +8272,7 @@ class Vector4 {
8263
8272
  case 1: return this.y;
8264
8273
  case 2: return this.z;
8265
8274
  case 3: return this.w;
8266
- default: throw new Error( 'index is out of range: ' + index );
8275
+ default: throw new Error( 'THREE.Vector4: index is out of range: ' + index );
8267
8276
 
8268
8277
  }
8269
8278
 
@@ -9114,7 +9123,8 @@ class RenderTarget extends EventDispatcher {
9114
9123
  * @property {number} [samples=0] - The MSAA samples count.
9115
9124
  * @property {number} [count=1] - Defines the number of color attachments . Must be at least `1`.
9116
9125
  * @property {number} [depth=1] - The texture depth.
9117
- * @property {boolean} [multiview=false] - Whether this target is used for multiview rendering.
9126
+ * @property {boolean} [multiview=false] - Whether this target is used for multiview rendering (WebGL OVR_multiview2 extension).
9127
+ * @property {boolean} [useArrayDepthTexture=false] - Whether to create the depth texture as an array texture for per-layer depth testing. This is separate from multiview so layered render targets can use array depth without the multiview extension.
9118
9128
  */
9119
9129
 
9120
9130
  /**
@@ -9140,7 +9150,8 @@ class RenderTarget extends EventDispatcher {
9140
9150
  samples: 0,
9141
9151
  count: 1,
9142
9152
  depth: 1,
9143
- multiview: false
9153
+ multiview: false,
9154
+ useArrayDepthTexture: false
9144
9155
  }, options );
9145
9156
 
9146
9157
  /**
@@ -9277,6 +9288,16 @@ class RenderTarget extends EventDispatcher {
9277
9288
  */
9278
9289
  this.multiview = options.multiview;
9279
9290
 
9291
+ /**
9292
+ * Whether to create the depth texture as an array texture for per-layer depth testing.
9293
+ * This is separate from multiview so layered render targets can use array depth without
9294
+ * the multiview extension.
9295
+ *
9296
+ * @type {boolean}
9297
+ * @default false
9298
+ */
9299
+ this.useArrayDepthTexture = options.useArrayDepthTexture;
9300
+
9280
9301
  }
9281
9302
 
9282
9303
  _setTextureOptions( options = {} ) {
@@ -9448,6 +9469,7 @@ class RenderTarget extends EventDispatcher {
9448
9469
 
9449
9470
  this.samples = source.samples;
9450
9471
  this.multiview = source.multiview;
9472
+ this.useArrayDepthTexture = source.useArrayDepthTexture;
9451
9473
 
9452
9474
  return this;
9453
9475
 
@@ -10061,7 +10083,7 @@ class Matrix4 {
10061
10083
  */
10062
10084
  extractBasis( xAxis, yAxis, zAxis ) {
10063
10085
 
10064
- if ( this.determinant() === 0 ) {
10086
+ if ( this.determinantAffine() === 0 ) {
10065
10087
 
10066
10088
  xAxis.set( 1, 0, 0 );
10067
10089
  yAxis.set( 0, 1, 0 );
@@ -10111,7 +10133,7 @@ class Matrix4 {
10111
10133
  */
10112
10134
  extractRotation( m ) {
10113
10135
 
10114
- if ( m.determinant() === 0 ) {
10136
+ if ( m.determinantAffine() === 0 ) {
10115
10137
 
10116
10138
  return this.identity();
10117
10139
 
@@ -10472,6 +10494,31 @@ class Matrix4 {
10472
10494
 
10473
10495
  }
10474
10496
 
10497
+ /**
10498
+ * Computes and returns the determinant of the 4x4 matrix, but assumes the
10499
+ * matrix is affine, saving some computations.
10500
+ *
10501
+ * For affine matrices (like an object's world matrix), this value equals the
10502
+ * full 4x4 {@link Matrix4#determinant} but is cheaper to compute.
10503
+ *
10504
+ * Assumes the bottom row is [0, 0, 0, 1].
10505
+ *
10506
+ * @return {number} The determinant of the matrix.
10507
+ */
10508
+ determinantAffine() {
10509
+
10510
+ const te = this.elements;
10511
+
10512
+ const n11 = te[ 0 ], n12 = te[ 4 ], n13 = te[ 8 ];
10513
+ const n21 = te[ 1 ], n22 = te[ 5 ], n23 = te[ 9 ];
10514
+ const n31 = te[ 2 ], n32 = te[ 6 ], n33 = te[ 10 ];
10515
+
10516
+ return n11 * ( n22 * n33 - n23 * n32 ) -
10517
+ n12 * ( n21 * n33 - n23 * n31 ) +
10518
+ n13 * ( n21 * n32 - n22 * n31 );
10519
+
10520
+ }
10521
+
10475
10522
  /**
10476
10523
  * Transposes this matrix in place.
10477
10524
  *
@@ -10881,7 +10928,7 @@ class Matrix4 {
10881
10928
  position.y = te[ 13 ];
10882
10929
  position.z = te[ 14 ];
10883
10930
 
10884
- const det = this.determinant();
10931
+ const det = this.determinantAffine();
10885
10932
 
10886
10933
  if ( det === 0 ) {
10887
10934
 
@@ -12896,8 +12943,10 @@ class Object3D extends EventDispatcher {
12896
12943
  *
12897
12944
  * @param {boolean} [updateParents=false] Whether ancestor nodes should be updated or not.
12898
12945
  * @param {boolean} [updateChildren=false] Whether descendant nodes should be updated or not.
12946
+ * @param {boolean} [force=false] - When set to `true`, a recomputation of world matrices is forced even
12947
+ * when {@link Object3D#matrixWorldNeedsUpdate} is `false`.
12899
12948
  */
12900
- updateWorldMatrix( updateParents, updateChildren ) {
12949
+ updateWorldMatrix( updateParents, updateChildren, force = false ) {
12901
12950
 
12902
12951
  const parent = this.parent;
12903
12952
 
@@ -12909,18 +12958,26 @@ class Object3D extends EventDispatcher {
12909
12958
 
12910
12959
  if ( this.matrixAutoUpdate ) this.updateMatrix();
12911
12960
 
12912
- if ( this.matrixWorldAutoUpdate === true ) {
12961
+ if ( this.matrixWorldNeedsUpdate || force ) {
12913
12962
 
12914
- if ( this.parent === null ) {
12963
+ if ( this.matrixWorldAutoUpdate === true ) {
12915
12964
 
12916
- this.matrixWorld.copy( this.matrix );
12965
+ if ( this.parent === null ) {
12917
12966
 
12918
- } else {
12967
+ this.matrixWorld.copy( this.matrix );
12919
12968
 
12920
- this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
12969
+ } else {
12970
+
12971
+ this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
12972
+
12973
+ }
12921
12974
 
12922
12975
  }
12923
12976
 
12977
+ this.matrixWorldNeedsUpdate = false;
12978
+
12979
+ force = true;
12980
+
12924
12981
  }
12925
12982
 
12926
12983
  // make sure descendants are updated
@@ -12933,7 +12990,7 @@ class Object3D extends EventDispatcher {
12933
12990
 
12934
12991
  const child = children[ i ];
12935
12992
 
12936
- child.updateWorldMatrix( false, true );
12993
+ child.updateWorldMatrix( false, true, force );
12937
12994
 
12938
12995
  }
12939
12996
 
@@ -15802,6 +15859,11 @@ class Box3 {
15802
15859
  * (including its children), accounting for the object's, and children's,
15803
15860
  * world transforms. The function may result in a larger box than strictly necessary.
15804
15861
  *
15862
+ * Note: To compute the correct bounding box, make sure the given 3D object
15863
+ * has an up-to-date world matrix that reflects the current transformation of its
15864
+ * ancestor nodes. Call `object.updateWorldMatrix( true, false )` beforehand if
15865
+ * you're unsure.
15866
+ *
15805
15867
  * @param {Object3D} object - The 3D object to compute the bounding box for.
15806
15868
  * @param {boolean} [precise=false] - If set to `true`, the method computes the smallest
15807
15869
  * world-axis-aligned bounding box at the expense of more computation.
@@ -18307,6 +18369,19 @@ class BufferGeometry extends EventDispatcher {
18307
18369
  */
18308
18370
  this.userData = {};
18309
18371
 
18372
+ /**
18373
+ * `true` when the geometry has been transformed since construction
18374
+ * (e.g. via {@link BufferGeometry#applyMatrix4}). Only relevant for
18375
+ * geometry generators (subclasses that populate `parameters`): when set,
18376
+ * {@link BufferGeometry#toJSON} omits `parameters` since they no longer
18377
+ * describe the geometry.
18378
+ *
18379
+ * @private
18380
+ * @type {boolean}
18381
+ * @default false
18382
+ */
18383
+ this._transformed = false;
18384
+
18310
18385
  }
18311
18386
 
18312
18387
  /**
@@ -18518,6 +18593,8 @@ class BufferGeometry extends EventDispatcher {
18518
18593
 
18519
18594
  }
18520
18595
 
18596
+ this._transformed = true;
18597
+
18521
18598
  return this;
18522
18599
 
18523
18600
  }
@@ -18953,13 +19030,14 @@ class BufferGeometry extends EventDispatcher {
18953
19030
  const normalAttribute = attributes.normal;
18954
19031
  const uvAttribute = attributes.uv;
18955
19032
 
18956
- if ( this.hasAttribute( 'tangent' ) === false ) {
19033
+ let tangentAttribute = this.getAttribute( 'tangent' );
18957
19034
 
18958
- this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 ) );
19035
+ if ( tangentAttribute === undefined || tangentAttribute.count !== positionAttribute.count ) {
18959
19036
 
18960
- }
19037
+ tangentAttribute = new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 );
19038
+ this.setAttribute( 'tangent', tangentAttribute );
18961
19039
 
18962
- const tangentAttribute = this.getAttribute( 'tangent' );
19040
+ }
18963
19041
 
18964
19042
  const tan1 = [], tan2 = [];
18965
19043
 
@@ -19088,6 +19166,8 @@ class BufferGeometry extends EventDispatcher {
19088
19166
 
19089
19167
  }
19090
19168
 
19169
+ this._transformed = true;
19170
+
19091
19171
  }
19092
19172
 
19093
19173
  /**
@@ -19105,7 +19185,7 @@ class BufferGeometry extends EventDispatcher {
19105
19185
 
19106
19186
  let normalAttribute = this.getAttribute( 'normal' );
19107
19187
 
19108
- if ( normalAttribute === undefined ) {
19188
+ if ( normalAttribute === undefined || normalAttribute.count !== positionAttribute.count ) {
19109
19189
 
19110
19190
  normalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );
19111
19191
  this.setAttribute( 'normal', normalAttribute );
@@ -19334,11 +19414,11 @@ class BufferGeometry extends EventDispatcher {
19334
19414
  // standard BufferGeometry serialization
19335
19415
 
19336
19416
  data.uuid = this.uuid;
19337
- data.type = this.type;
19417
+ data.type = ( this.parameters !== undefined && this._transformed === true ) ? 'BufferGeometry' : this.type;
19338
19418
  if ( this.name !== '' ) data.name = this.name;
19339
19419
  if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;
19340
19420
 
19341
- if ( this.parameters !== undefined ) {
19421
+ if ( this.parameters !== undefined && this._transformed !== true ) {
19342
19422
 
19343
19423
  const parameters = this.parameters;
19344
19424
 
@@ -19549,6 +19629,10 @@ class BufferGeometry extends EventDispatcher {
19549
19629
 
19550
19630
  this.userData = source.userData;
19551
19631
 
19632
+ // transformed flag
19633
+
19634
+ this._transformed = source._transformed;
19635
+
19552
19636
  return this;
19553
19637
 
19554
19638
  }
@@ -20972,7 +21056,11 @@ class Material extends EventDispatcher {
20972
21056
 
20973
21057
  currentValue.set( newValue );
20974
21058
 
20975
- } else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {
21059
+ } else if (
21060
+ ( ( currentValue && currentValue.isVector2 ) && ( newValue && newValue.isVector2 ) ) ||
21061
+ ( ( currentValue && currentValue.isEuler ) && ( newValue && newValue.isEuler ) ) ||
21062
+ ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) )
21063
+ ) {
20976
21064
 
20977
21065
  currentValue.copy( newValue );
20978
21066
 
@@ -21273,6 +21361,196 @@ class Material extends EventDispatcher {
21273
21361
 
21274
21362
  }
21275
21363
 
21364
+ /**
21365
+ * Deserializes the material from the given JSON.
21366
+ *
21367
+ * @param {Object} json - The JSON holding the serialized material.
21368
+ * @param {Object<string,Texture>} textures - A dictionary holding textures referenced by the material.
21369
+ * @return {Material} A reference to this material.
21370
+ */
21371
+ fromJSON( json, textures ) {
21372
+
21373
+ if ( json.uuid !== undefined ) this.uuid = json.uuid;
21374
+ if ( json.name !== undefined ) this.name = json.name;
21375
+ if ( json.color !== undefined && this.color !== undefined ) this.color.setHex( json.color );
21376
+ if ( json.roughness !== undefined ) this.roughness = json.roughness;
21377
+ if ( json.metalness !== undefined ) this.metalness = json.metalness;
21378
+ if ( json.sheen !== undefined ) this.sheen = json.sheen;
21379
+ if ( json.sheenColor !== undefined ) this.sheenColor = new Color().setHex( json.sheenColor );
21380
+ if ( json.sheenRoughness !== undefined ) this.sheenRoughness = json.sheenRoughness;
21381
+ if ( json.emissive !== undefined && this.emissive !== undefined ) this.emissive.setHex( json.emissive );
21382
+ if ( json.specular !== undefined && this.specular !== undefined ) this.specular.setHex( json.specular );
21383
+ if ( json.specularIntensity !== undefined ) this.specularIntensity = json.specularIntensity;
21384
+ if ( json.specularColor !== undefined && this.specularColor !== undefined ) this.specularColor.setHex( json.specularColor );
21385
+ if ( json.shininess !== undefined ) this.shininess = json.shininess;
21386
+ if ( json.clearcoat !== undefined ) this.clearcoat = json.clearcoat;
21387
+ if ( json.clearcoatRoughness !== undefined ) this.clearcoatRoughness = json.clearcoatRoughness;
21388
+ if ( json.dispersion !== undefined ) this.dispersion = json.dispersion;
21389
+ if ( json.iridescence !== undefined ) this.iridescence = json.iridescence;
21390
+ if ( json.iridescenceIOR !== undefined ) this.iridescenceIOR = json.iridescenceIOR;
21391
+ if ( json.iridescenceThicknessRange !== undefined ) this.iridescenceThicknessRange = json.iridescenceThicknessRange;
21392
+ if ( json.transmission !== undefined ) this.transmission = json.transmission;
21393
+ if ( json.thickness !== undefined ) this.thickness = json.thickness;
21394
+ if ( json.attenuationDistance !== undefined ) this.attenuationDistance = json.attenuationDistance;
21395
+ if ( json.attenuationColor !== undefined && this.attenuationColor !== undefined ) this.attenuationColor.setHex( json.attenuationColor );
21396
+ if ( json.anisotropy !== undefined ) this.anisotropy = json.anisotropy;
21397
+ if ( json.anisotropyRotation !== undefined ) this.anisotropyRotation = json.anisotropyRotation;
21398
+ if ( json.fog !== undefined ) this.fog = json.fog;
21399
+ if ( json.flatShading !== undefined ) this.flatShading = json.flatShading;
21400
+ if ( json.blending !== undefined ) this.blending = json.blending;
21401
+ if ( json.combine !== undefined ) this.combine = json.combine;
21402
+ if ( json.side !== undefined ) this.side = json.side;
21403
+ if ( json.shadowSide !== undefined ) this.shadowSide = json.shadowSide;
21404
+ if ( json.opacity !== undefined ) this.opacity = json.opacity;
21405
+ if ( json.transparent !== undefined ) this.transparent = json.transparent;
21406
+ if ( json.alphaTest !== undefined ) this.alphaTest = json.alphaTest;
21407
+ if ( json.alphaHash !== undefined ) this.alphaHash = json.alphaHash;
21408
+ if ( json.depthFunc !== undefined ) this.depthFunc = json.depthFunc;
21409
+ if ( json.depthTest !== undefined ) this.depthTest = json.depthTest;
21410
+ if ( json.depthWrite !== undefined ) this.depthWrite = json.depthWrite;
21411
+ if ( json.colorWrite !== undefined ) this.colorWrite = json.colorWrite;
21412
+ if ( json.blendSrc !== undefined ) this.blendSrc = json.blendSrc;
21413
+ if ( json.blendDst !== undefined ) this.blendDst = json.blendDst;
21414
+ if ( json.blendEquation !== undefined ) this.blendEquation = json.blendEquation;
21415
+ if ( json.blendSrcAlpha !== undefined ) this.blendSrcAlpha = json.blendSrcAlpha;
21416
+ if ( json.blendDstAlpha !== undefined ) this.blendDstAlpha = json.blendDstAlpha;
21417
+ if ( json.blendEquationAlpha !== undefined ) this.blendEquationAlpha = json.blendEquationAlpha;
21418
+ if ( json.blendColor !== undefined && this.blendColor !== undefined ) this.blendColor.setHex( json.blendColor );
21419
+ if ( json.blendAlpha !== undefined ) this.blendAlpha = json.blendAlpha;
21420
+ if ( json.stencilWriteMask !== undefined ) this.stencilWriteMask = json.stencilWriteMask;
21421
+ if ( json.stencilFunc !== undefined ) this.stencilFunc = json.stencilFunc;
21422
+ if ( json.stencilRef !== undefined ) this.stencilRef = json.stencilRef;
21423
+ if ( json.stencilFuncMask !== undefined ) this.stencilFuncMask = json.stencilFuncMask;
21424
+ if ( json.stencilFail !== undefined ) this.stencilFail = json.stencilFail;
21425
+ if ( json.stencilZFail !== undefined ) this.stencilZFail = json.stencilZFail;
21426
+ if ( json.stencilZPass !== undefined ) this.stencilZPass = json.stencilZPass;
21427
+ if ( json.stencilWrite !== undefined ) this.stencilWrite = json.stencilWrite;
21428
+
21429
+ if ( json.wireframe !== undefined ) this.wireframe = json.wireframe;
21430
+ if ( json.wireframeLinewidth !== undefined ) this.wireframeLinewidth = json.wireframeLinewidth;
21431
+ if ( json.wireframeLinecap !== undefined ) this.wireframeLinecap = json.wireframeLinecap;
21432
+ if ( json.wireframeLinejoin !== undefined ) this.wireframeLinejoin = json.wireframeLinejoin;
21433
+
21434
+ if ( json.rotation !== undefined ) this.rotation = json.rotation;
21435
+
21436
+ if ( json.linewidth !== undefined ) this.linewidth = json.linewidth;
21437
+ if ( json.dashSize !== undefined ) this.dashSize = json.dashSize;
21438
+ if ( json.gapSize !== undefined ) this.gapSize = json.gapSize;
21439
+ if ( json.scale !== undefined ) this.scale = json.scale;
21440
+
21441
+ if ( json.polygonOffset !== undefined ) this.polygonOffset = json.polygonOffset;
21442
+ if ( json.polygonOffsetFactor !== undefined ) this.polygonOffsetFactor = json.polygonOffsetFactor;
21443
+ if ( json.polygonOffsetUnits !== undefined ) this.polygonOffsetUnits = json.polygonOffsetUnits;
21444
+
21445
+ if ( json.dithering !== undefined ) this.dithering = json.dithering;
21446
+
21447
+ if ( json.alphaToCoverage !== undefined ) this.alphaToCoverage = json.alphaToCoverage;
21448
+ if ( json.premultipliedAlpha !== undefined ) this.premultipliedAlpha = json.premultipliedAlpha;
21449
+ if ( json.forceSinglePass !== undefined ) this.forceSinglePass = json.forceSinglePass;
21450
+ if ( json.allowOverride !== undefined ) this.allowOverride = json.allowOverride;
21451
+
21452
+ if ( json.visible !== undefined ) this.visible = json.visible;
21453
+
21454
+ if ( json.toneMapped !== undefined ) this.toneMapped = json.toneMapped;
21455
+
21456
+ if ( json.userData !== undefined ) this.userData = json.userData;
21457
+
21458
+ if ( json.vertexColors !== undefined ) {
21459
+
21460
+ if ( typeof json.vertexColors === 'number' ) {
21461
+
21462
+ this.vertexColors = json.vertexColors > 0;
21463
+
21464
+ } else {
21465
+
21466
+ this.vertexColors = json.vertexColors;
21467
+
21468
+ }
21469
+
21470
+ }
21471
+
21472
+ // for PointsMaterial
21473
+
21474
+ if ( json.size !== undefined ) this.size = json.size;
21475
+ if ( json.sizeAttenuation !== undefined ) this.sizeAttenuation = json.sizeAttenuation;
21476
+
21477
+ // maps
21478
+
21479
+ if ( json.map !== undefined ) this.map = textures[ json.map ] || null;
21480
+ if ( json.matcap !== undefined ) this.matcap = textures[ json.matcap ] || null;
21481
+
21482
+ if ( json.alphaMap !== undefined ) this.alphaMap = textures[ json.alphaMap ] || null;
21483
+
21484
+ if ( json.bumpMap !== undefined ) this.bumpMap = textures[ json.bumpMap ] || null;
21485
+ if ( json.bumpScale !== undefined ) this.bumpScale = json.bumpScale;
21486
+
21487
+ if ( json.normalMap !== undefined ) this.normalMap = textures[ json.normalMap ] || null;
21488
+ if ( json.normalMapType !== undefined ) this.normalMapType = json.normalMapType;
21489
+ if ( json.normalScale !== undefined ) {
21490
+
21491
+ let normalScale = json.normalScale;
21492
+
21493
+ if ( Array.isArray( normalScale ) === false ) {
21494
+
21495
+ // Blender exporter used to export a scalar. See #7459
21496
+
21497
+ normalScale = [ normalScale, normalScale ];
21498
+
21499
+ }
21500
+
21501
+ this.normalScale = new Vector2().fromArray( normalScale );
21502
+
21503
+ }
21504
+
21505
+ if ( json.displacementMap !== undefined ) this.displacementMap = textures[ json.displacementMap ] || null;
21506
+ if ( json.displacementScale !== undefined ) this.displacementScale = json.displacementScale;
21507
+ if ( json.displacementBias !== undefined ) this.displacementBias = json.displacementBias;
21508
+
21509
+ if ( json.roughnessMap !== undefined ) this.roughnessMap = textures[ json.roughnessMap ] || null;
21510
+ if ( json.metalnessMap !== undefined ) this.metalnessMap = textures[ json.metalnessMap ] || null;
21511
+
21512
+ if ( json.emissiveMap !== undefined ) this.emissiveMap = textures[ json.emissiveMap ] || null;
21513
+ if ( json.emissiveIntensity !== undefined ) this.emissiveIntensity = json.emissiveIntensity;
21514
+
21515
+ if ( json.specularMap !== undefined ) this.specularMap = textures[ json.specularMap ] || null;
21516
+ if ( json.specularIntensityMap !== undefined ) this.specularIntensityMap = textures[ json.specularIntensityMap ] || null;
21517
+ if ( json.specularColorMap !== undefined ) this.specularColorMap = textures[ json.specularColorMap ] || null;
21518
+
21519
+ if ( json.envMap !== undefined ) this.envMap = textures[ json.envMap ] || null;
21520
+ if ( json.envMapRotation !== undefined ) this.envMapRotation.fromArray( json.envMapRotation );
21521
+ if ( json.envMapIntensity !== undefined ) this.envMapIntensity = json.envMapIntensity;
21522
+
21523
+ if ( json.reflectivity !== undefined ) this.reflectivity = json.reflectivity;
21524
+ if ( json.refractionRatio !== undefined ) this.refractionRatio = json.refractionRatio;
21525
+
21526
+ if ( json.lightMap !== undefined ) this.lightMap = textures[ json.lightMap ] || null;
21527
+ if ( json.lightMapIntensity !== undefined ) this.lightMapIntensity = json.lightMapIntensity;
21528
+
21529
+ if ( json.aoMap !== undefined ) this.aoMap = textures[ json.aoMap ] || null;
21530
+ if ( json.aoMapIntensity !== undefined ) this.aoMapIntensity = json.aoMapIntensity;
21531
+
21532
+ if ( json.gradientMap !== undefined ) this.gradientMap = textures[ json.gradientMap ] || null;
21533
+
21534
+ if ( json.clearcoatMap !== undefined ) this.clearcoatMap = textures[ json.clearcoatMap ] || null;
21535
+ if ( json.clearcoatRoughnessMap !== undefined ) this.clearcoatRoughnessMap = textures[ json.clearcoatRoughnessMap ] || null;
21536
+ if ( json.clearcoatNormalMap !== undefined ) this.clearcoatNormalMap = textures[ json.clearcoatNormalMap ] || null;
21537
+ if ( json.clearcoatNormalScale !== undefined ) this.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );
21538
+
21539
+ if ( json.iridescenceMap !== undefined ) this.iridescenceMap = textures[ json.iridescenceMap ] || null;
21540
+ if ( json.iridescenceThicknessMap !== undefined ) this.iridescenceThicknessMap = textures[ json.iridescenceThicknessMap ] || null;
21541
+
21542
+ if ( json.transmissionMap !== undefined ) this.transmissionMap = textures[ json.transmissionMap ] || null;
21543
+ if ( json.thicknessMap !== undefined ) this.thicknessMap = textures[ json.thicknessMap ] || null;
21544
+
21545
+ if ( json.anisotropyMap !== undefined ) this.anisotropyMap = textures[ json.anisotropyMap ] || null;
21546
+
21547
+ if ( json.sheenColorMap !== undefined ) this.sheenColorMap = textures[ json.sheenColorMap ] || null;
21548
+ if ( json.sheenRoughnessMap !== undefined ) this.sheenRoughnessMap = textures[ json.sheenRoughnessMap ] || null;
21549
+
21550
+ return this;
21551
+
21552
+ }
21553
+
21276
21554
  /**
21277
21555
  * Returns a new material with copied values from this instance.
21278
21556
  *
@@ -21459,6 +21737,10 @@ class SpriteMaterial extends Material {
21459
21737
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
21460
21738
  * color is modulated by the diffuse `color`.
21461
21739
  *
21740
+ * `map` represents color data, and the texture must be assigned a
21741
+ * {@link Texture#colorSpace}. Most `map` textures set
21742
+ * `texture.colorSpace = SRGBColorSpace`.
21743
+ *
21462
21744
  * @type {?Texture}
21463
21745
  * @default null
21464
21746
  */
@@ -21474,6 +21756,9 @@ class SpriteMaterial extends Material {
21474
21756
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
21475
21757
  * luminance/alpha textures will also still work as expected.
21476
21758
  *
21759
+ * `alphaMap` represents non-color data. Any texture assigned must have
21760
+ * `texture.colorSpace = NoColorSpace` (default).
21761
+ *
21477
21762
  * @type {?Texture}
21478
21763
  * @default null
21479
21764
  */
@@ -22794,6 +23079,10 @@ class MeshBasicMaterial extends Material {
22794
23079
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
22795
23080
  * color is modulated by the diffuse `color`.
22796
23081
  *
23082
+ * `map` represents color data, and the texture must be assigned a
23083
+ * {@link Texture#colorSpace}. Most `map` textures set
23084
+ * `texture.colorSpace = SRGBColorSpace`.
23085
+ *
22797
23086
  * @type {?Texture}
22798
23087
  * @default null
22799
23088
  */
@@ -22802,6 +23091,11 @@ class MeshBasicMaterial extends Material {
22802
23091
  /**
22803
23092
  * The light map. Requires a second set of UVs.
22804
23093
  *
23094
+ * `lightMap` represents pre-baked illuminance data, and the texture must be assigned
23095
+ * a {@link Texture#colorSpace}. Most `lightMap` textures set
23096
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
23097
+ * such as `.exr` or `.hdr`.
23098
+ *
22805
23099
  * @type {?Texture}
22806
23100
  * @default null
22807
23101
  */
@@ -22819,6 +23113,9 @@ class MeshBasicMaterial extends Material {
22819
23113
  * The red channel of this texture is used as the ambient occlusion map.
22820
23114
  * Requires a second set of UVs.
22821
23115
  *
23116
+ * `aoMap` represents non-color data. Any texture assigned must have
23117
+ * `texture.colorSpace = NoColorSpace` (default).
23118
+ *
22822
23119
  * @type {?Texture}
22823
23120
  * @default null
22824
23121
  */
@@ -22837,6 +23134,10 @@ class MeshBasicMaterial extends Material {
22837
23134
  /**
22838
23135
  * Specular map used by the material.
22839
23136
  *
23137
+ * `specularMap` represents color data, and the texture must be assigned a
23138
+ * {@link Texture#colorSpace}. Most `specularMap` textures set
23139
+ * `texture.colorSpace = SRGBColorSpace`.
23140
+ *
22840
23141
  * @type {?Texture}
22841
23142
  * @default null
22842
23143
  */
@@ -22852,6 +23153,9 @@ class MeshBasicMaterial extends Material {
22852
23153
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
22853
23154
  * luminance/alpha textures will also still work as expected.
22854
23155
  *
23156
+ * `alphaMap` represents non-color data. Any texture assigned must have
23157
+ * `texture.colorSpace = NoColorSpace` (default).
23158
+ *
22855
23159
  * @type {?Texture}
22856
23160
  * @default null
22857
23161
  */
@@ -22860,6 +23164,11 @@ class MeshBasicMaterial extends Material {
22860
23164
  /**
22861
23165
  * The environment map.
22862
23166
  *
23167
+ * `envMap` represents luminance data, and the texture must be assigned
23168
+ * a {@link Texture#colorSpace}. Most `envMap` textures set
23169
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
23170
+ * such as `.exr` or `.hdr`.
23171
+ *
22863
23172
  * @type {?Texture}
22864
23173
  * @default null
22865
23174
  */
@@ -24017,15 +24326,6 @@ class Skeleton {
24017
24326
  */
24018
24327
  this.boneMatrices = null;
24019
24328
 
24020
- /**
24021
- * An array buffer holding the bone data of the previous frame.
24022
- * Required for computing velocity. Maintained in {@link SkinningNode}.
24023
- *
24024
- * @type {?Float32Array}
24025
- * @default null
24026
- */
24027
- this.previousBoneMatrices = null;
24028
-
24029
24329
  /**
24030
24330
  * A texture holding the bone data for use
24031
24331
  * in the vertex shader.
@@ -24451,15 +24751,6 @@ class InstancedMesh extends Mesh {
24451
24751
  */
24452
24752
  this.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );
24453
24753
 
24454
- /**
24455
- * Represents the local transformation of all instances of the previous frame.
24456
- * Required for computing velocity. Maintained in {@link InstanceNode}.
24457
- *
24458
- * @type {?InstancedBufferAttribute}
24459
- * @default null
24460
- */
24461
- this.previousInstanceMatrix = null;
24462
-
24463
24754
  /**
24464
24755
  * Represents the color of all instances. You have to set its
24465
24756
  * {@link BufferAttribute#needsUpdate} flag to true if you modify instanced data
@@ -24589,8 +24880,6 @@ class InstancedMesh extends Mesh {
24589
24880
 
24590
24881
  this.instanceMatrix.copy( source.instanceMatrix );
24591
24882
 
24592
- if ( source.previousInstanceMatrix !== null ) this.previousInstanceMatrix = source.previousInstanceMatrix.clone();
24593
-
24594
24883
  if ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();
24595
24884
  if ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();
24596
24885
 
@@ -25456,7 +25745,6 @@ class Frustum {
25456
25745
  }
25457
25746
 
25458
25747
  const _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4();
25459
- const _frustum$1 = /*@__PURE__*/ new Frustum();
25460
25748
 
25461
25749
  /**
25462
25750
  * FrustumArray is used to determine if an object is visible in at least one camera
@@ -25478,220 +25766,191 @@ class FrustumArray {
25478
25766
  */
25479
25767
  this.coordinateSystem = WebGLCoordinateSystem;
25480
25768
 
25769
+ /**
25770
+ * A pool of frustum instances. It may hold more entries than are
25771
+ * currently in use; surplus instances are kept for reuse to avoid
25772
+ * reallocating when array cameras of different lengths are rendered.
25773
+ *
25774
+ * @private
25775
+ * @type {Array<Frustum>}
25776
+ */
25777
+ this._frustums = [];
25778
+
25779
+ /**
25780
+ * The number of frustums in {@link FrustumArray#_frustums} that are currently
25781
+ * in use.
25782
+ *
25783
+ * @private
25784
+ * @type {number}
25785
+ * @default 0
25786
+ */
25787
+ this._count = 0;
25788
+
25481
25789
  }
25482
25790
 
25483
25791
  /**
25484
- * Returns `true` if the 3D object's bounding sphere is intersecting any frustum
25485
- * from the camera array.
25792
+ * Computes and caches a frustum for each camera of the given array camera.
25486
25793
  *
25487
- * @param {Object3D} object - The 3D object to test.
25488
- * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.
25489
- * @return {boolean} Whether the 3D object is visible in any camera.
25794
+ * @param {ArrayCamera} cameraArray - The array camera whose sub-cameras define the frustums.
25795
+ * @return {FrustumArray} A reference to this frustum array.
25490
25796
  */
25491
- intersectsObject( object, cameraArray ) {
25492
-
25493
- if ( ! cameraArray.isArrayCamera || cameraArray.cameras.length === 0 ) {
25494
-
25495
- return false;
25496
-
25497
- }
25797
+ setFromArrayCamera( cameraArray ) {
25498
25798
 
25499
- for ( let i = 0; i < cameraArray.cameras.length; i ++ ) {
25799
+ const cameras = cameraArray.cameras;
25800
+ const frustums = this._frustums;
25500
25801
 
25501
- const camera = cameraArray.cameras[ i ];
25802
+ for ( let i = 0; i < cameras.length; i ++ ) {
25502
25803
 
25503
- _projScreenMatrix$1.multiplyMatrices(
25504
- camera.projectionMatrix,
25505
- camera.matrixWorldInverse
25506
- );
25804
+ const camera = cameras[ i ];
25507
25805
 
25508
- _frustum$1.setFromProjectionMatrix(
25509
- _projScreenMatrix$1,
25510
- camera.coordinateSystem,
25511
- camera.reversedDepth
25512
- );
25806
+ _projScreenMatrix$1.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
25513
25807
 
25514
- if ( _frustum$1.intersectsObject( object ) ) {
25808
+ if ( frustums[ i ] === undefined ) frustums[ i ] = new Frustum();
25515
25809
 
25516
- return true; // Object is visible in at least one camera
25517
-
25518
- }
25810
+ frustums[ i ].setFromProjectionMatrix( _projScreenMatrix$1, camera.coordinateSystem, camera.reversedDepth );
25519
25811
 
25520
25812
  }
25521
25813
 
25522
- return false; // Not visible in any camera
25814
+ this._count = cameras.length;
25815
+
25816
+ return this;
25523
25817
 
25524
25818
  }
25525
25819
 
25526
25820
  /**
25527
- * Returns `true` if the given sprite is intersecting any frustum
25528
- * from the camera array.
25821
+ * Returns `true` if the 3D object's bounding sphere is intersecting any cached frustum.
25529
25822
  *
25530
- * @param {Sprite} sprite - The sprite to test.
25531
- * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.
25532
- * @return {boolean} Whether the sprite is visible in any camera.
25823
+ * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
25824
+ *
25825
+ * @param {Object3D} object - The 3D object to test.
25826
+ * @return {boolean} Whether the 3D object is visible in any camera.
25533
25827
  */
25534
- intersectsSprite( sprite, cameraArray ) {
25828
+ intersectsObject( object ) {
25535
25829
 
25536
- if ( ! cameraArray || ! cameraArray.cameras || cameraArray.cameras.length === 0 ) {
25830
+ const frustums = this._frustums;
25537
25831
 
25538
- return false;
25832
+ for ( let i = 0; i < this._count; i ++ ) {
25539
25833
 
25540
- }
25834
+ if ( frustums[ i ].intersectsObject( object ) ) return true;
25541
25835
 
25542
- for ( let i = 0; i < cameraArray.cameras.length; i ++ ) {
25836
+ }
25543
25837
 
25544
- const camera = cameraArray.cameras[ i ];
25838
+ return false;
25545
25839
 
25546
- _projScreenMatrix$1.multiplyMatrices(
25547
- camera.projectionMatrix,
25548
- camera.matrixWorldInverse
25549
- );
25840
+ }
25550
25841
 
25551
- _frustum$1.setFromProjectionMatrix(
25552
- _projScreenMatrix$1,
25553
- camera.coordinateSystem,
25554
- camera.reversedDepth
25555
- );
25842
+ /**
25843
+ * Returns `true` if the given sprite is intersecting any cached frustum.
25844
+ *
25845
+ * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
25846
+ *
25847
+ * @param {Sprite} sprite - The sprite to test.
25848
+ * @return {boolean} Whether the sprite is visible in any camera.
25849
+ */
25850
+ intersectsSprite( sprite ) {
25556
25851
 
25557
- if ( _frustum$1.intersectsSprite( sprite ) ) {
25852
+ const frustums = this._frustums;
25558
25853
 
25559
- return true; // Sprite is visible in at least one camera
25854
+ for ( let i = 0; i < this._count; i ++ ) {
25560
25855
 
25561
- }
25856
+ if ( frustums[ i ].intersectsSprite( sprite ) ) return true;
25562
25857
 
25563
25858
  }
25564
25859
 
25565
- return false; // Not visible in any camera
25860
+ return false;
25566
25861
 
25567
25862
  }
25568
25863
 
25569
25864
  /**
25570
- * Returns `true` if the given bounding sphere is intersecting any frustum
25571
- * from the camera array.
25865
+ * Returns `true` if the given bounding sphere is intersecting any cached frustum.
25866
+ *
25867
+ * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
25572
25868
  *
25573
25869
  * @param {Sphere} sphere - The bounding sphere to test.
25574
- * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.
25575
25870
  * @return {boolean} Whether the sphere is visible in any camera.
25576
25871
  */
25577
- intersectsSphere( sphere, cameraArray ) {
25578
-
25579
- if ( ! cameraArray || ! cameraArray.cameras || cameraArray.cameras.length === 0 ) {
25580
-
25581
- return false;
25582
-
25583
- }
25584
-
25585
- for ( let i = 0; i < cameraArray.cameras.length; i ++ ) {
25586
-
25587
- const camera = cameraArray.cameras[ i ];
25588
-
25589
- _projScreenMatrix$1.multiplyMatrices(
25590
- camera.projectionMatrix,
25591
- camera.matrixWorldInverse
25592
- );
25593
-
25594
- _frustum$1.setFromProjectionMatrix(
25595
- _projScreenMatrix$1,
25596
- camera.coordinateSystem,
25597
- camera.reversedDepth
25598
- );
25872
+ intersectsSphere( sphere ) {
25599
25873
 
25600
- if ( _frustum$1.intersectsSphere( sphere ) ) {
25874
+ const frustums = this._frustums;
25601
25875
 
25602
- return true; // Sphere is visible in at least one camera
25876
+ for ( let i = 0; i < this._count; i ++ ) {
25603
25877
 
25604
- }
25878
+ if ( frustums[ i ].intersectsSphere( sphere ) ) return true;
25605
25879
 
25606
25880
  }
25607
25881
 
25608
- return false; // Not visible in any camera
25882
+ return false;
25609
25883
 
25610
25884
  }
25611
25885
 
25612
25886
  /**
25613
- * Returns `true` if the given bounding box is intersecting any frustum
25614
- * from the camera array.
25887
+ * Returns `true` if the given bounding box is intersecting any cached frustum.
25888
+ *
25889
+ * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
25615
25890
  *
25616
25891
  * @param {Box3} box - The bounding box to test.
25617
- * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.
25618
25892
  * @return {boolean} Whether the box is visible in any camera.
25619
25893
  */
25620
- intersectsBox( box, cameraArray ) {
25621
-
25622
- if ( ! cameraArray || ! cameraArray.cameras || cameraArray.cameras.length === 0 ) {
25623
-
25624
- return false;
25625
-
25626
- }
25627
-
25628
- for ( let i = 0; i < cameraArray.cameras.length; i ++ ) {
25629
-
25630
- const camera = cameraArray.cameras[ i ];
25631
-
25632
- _projScreenMatrix$1.multiplyMatrices(
25633
- camera.projectionMatrix,
25634
- camera.matrixWorldInverse
25635
- );
25636
-
25637
- _frustum$1.setFromProjectionMatrix(
25638
- _projScreenMatrix$1,
25639
- camera.coordinateSystem,
25640
- camera.reversedDepth
25641
- );
25894
+ intersectsBox( box ) {
25642
25895
 
25643
- if ( _frustum$1.intersectsBox( box ) ) {
25896
+ const frustums = this._frustums;
25644
25897
 
25645
- return true; // Box is visible in at least one camera
25898
+ for ( let i = 0; i < this._count; i ++ ) {
25646
25899
 
25647
- }
25900
+ if ( frustums[ i ].intersectsBox( box ) ) return true;
25648
25901
 
25649
25902
  }
25650
25903
 
25651
- return false; // Not visible in any camera
25904
+ return false;
25652
25905
 
25653
25906
  }
25654
25907
 
25655
25908
  /**
25656
- * Returns `true` if the given point lies within any frustum
25657
- * from the camera array.
25909
+ * Returns `true` if the given point lies within any cached frustum.
25910
+ *
25911
+ * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
25658
25912
  *
25659
25913
  * @param {Vector3} point - The point to test.
25660
- * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.
25661
25914
  * @return {boolean} Whether the point is visible in any camera.
25662
25915
  */
25663
- containsPoint( point, cameraArray ) {
25916
+ containsPoint( point ) {
25664
25917
 
25665
- if ( ! cameraArray || ! cameraArray.cameras || cameraArray.cameras.length === 0 ) {
25918
+ const frustums = this._frustums;
25666
25919
 
25667
- return false;
25920
+ for ( let i = 0; i < this._count; i ++ ) {
25921
+
25922
+ if ( frustums[ i ].containsPoint( point ) ) return true;
25668
25923
 
25669
25924
  }
25670
25925
 
25671
- for ( let i = 0; i < cameraArray.cameras.length; i ++ ) {
25926
+ return false;
25672
25927
 
25673
- const camera = cameraArray.cameras[ i ];
25928
+ }
25674
25929
 
25675
- _projScreenMatrix$1.multiplyMatrices(
25676
- camera.projectionMatrix,
25677
- camera.matrixWorldInverse
25678
- );
25930
+ /**
25931
+ * Copies the values of the given frustum array to this instance.
25932
+ *
25933
+ * @param {FrustumArray} frustumArray - The frustum array to copy.
25934
+ * @return {FrustumArray} A reference to this frustum array.
25935
+ */
25936
+ copy( source ) {
25679
25937
 
25680
- _frustum$1.setFromProjectionMatrix(
25681
- _projScreenMatrix$1,
25682
- camera.coordinateSystem,
25683
- camera.reversedDepth
25684
- );
25938
+ this.coordinateSystem = source.coordinateSystem;
25685
25939
 
25686
- if ( _frustum$1.containsPoint( point ) ) {
25940
+ const frustums = this._frustums;
25941
+ const sourceFrustums = source._frustums;
25687
25942
 
25688
- return true; // Point is visible in at least one camera
25943
+ for ( let i = 0; i < source._count; i ++ ) {
25689
25944
 
25690
- }
25945
+ if ( frustums[ i ] === undefined ) frustums[ i ] = new Frustum();
25946
+
25947
+ frustums[ i ].copy( sourceFrustums[ i ] );
25691
25948
 
25692
25949
  }
25693
25950
 
25694
- return false; // Not visible in any camera
25951
+ this._count = source._count;
25952
+
25953
+ return this;
25695
25954
 
25696
25955
  }
25697
25956
 
@@ -25702,7 +25961,7 @@ class FrustumArray {
25702
25961
  */
25703
25962
  clone() {
25704
25963
 
25705
- return new FrustumArray();
25964
+ return new FrustumArray().copy( this );
25706
25965
 
25707
25966
  }
25708
25967
 
@@ -26973,7 +27232,7 @@ class BatchedMesh extends Mesh {
26973
27232
  // throw an error if it can't be shrunk to the desired size
26974
27233
  if ( maxInstanceCount < instanceInfo.length ) {
26975
27234
 
26976
- throw new Error( `BatchedMesh: Instance ids outside the range ${ maxInstanceCount } are being used. Cannot shrink instance count.` );
27235
+ throw new Error( `THREE.BatchedMesh: Instance ids outside the range ${ maxInstanceCount } are being used. Cannot shrink instance count.` );
26977
27236
 
26978
27237
  }
26979
27238
 
@@ -27025,7 +27284,7 @@ class BatchedMesh extends Mesh {
27025
27284
  const requiredVertexLength = Math.max( ...validRanges.map( range => range.vertexStart + range.reservedVertexCount ) );
27026
27285
  if ( requiredVertexLength > maxVertexCount ) {
27027
27286
 
27028
- throw new Error( `BatchedMesh: Geometry vertex values are being used outside the range ${ maxIndexCount }. Cannot shrink further.` );
27287
+ throw new Error( `THREE.BatchedMesh: Geometry vertex values are being used outside the range ${ maxIndexCount }. Cannot shrink further.` );
27029
27288
 
27030
27289
  }
27031
27290
 
@@ -27035,7 +27294,7 @@ class BatchedMesh extends Mesh {
27035
27294
  const requiredIndexLength = Math.max( ...validRanges.map( range => range.indexStart + range.reservedIndexCount ) );
27036
27295
  if ( requiredIndexLength > maxIndexCount ) {
27037
27296
 
27038
- throw new Error( `BatchedMesh: Geometry index values are being used outside the range ${ maxIndexCount }. Cannot shrink further.` );
27297
+ throw new Error( `THREE.BatchedMesh: Geometry index values are being used outside the range ${ maxIndexCount }. Cannot shrink further.` );
27039
27298
 
27040
27299
  }
27041
27300
 
@@ -27248,17 +27507,25 @@ class BatchedMesh extends Mesh {
27248
27507
 
27249
27508
  const frustum = camera.isArrayCamera ? _frustumArray : _frustum;
27250
27509
  // prepare the frustum in the local frame
27251
- if ( perObjectFrustumCulled && ! camera.isArrayCamera ) {
27510
+ if ( perObjectFrustumCulled ) {
27252
27511
 
27253
- _matrix$1
27254
- .multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )
27255
- .multiply( this.matrixWorld );
27512
+ if ( camera.isArrayCamera ) {
27256
27513
 
27257
- _frustum.setFromProjectionMatrix(
27258
- _matrix$1,
27259
- camera.coordinateSystem,
27260
- camera.reversedDepth
27261
- );
27514
+ frustum.setFromArrayCamera( camera );
27515
+
27516
+ } else {
27517
+
27518
+ _matrix$1
27519
+ .multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )
27520
+ .multiply( this.matrixWorld );
27521
+
27522
+ frustum.setFromProjectionMatrix(
27523
+ _matrix$1,
27524
+ camera.coordinateSystem,
27525
+ camera.reversedDepth
27526
+ );
27527
+
27528
+ }
27262
27529
 
27263
27530
  }
27264
27531
 
@@ -27284,7 +27551,7 @@ class BatchedMesh extends Mesh {
27284
27551
  let culled = false;
27285
27552
  if ( perObjectFrustumCulled ) {
27286
27553
 
27287
- culled = ! frustum.intersectsSphere( _sphere$2, camera );
27554
+ culled = ! frustum.intersectsSphere( _sphere$2 );
27288
27555
 
27289
27556
  }
27290
27557
 
@@ -27341,7 +27608,7 @@ class BatchedMesh extends Mesh {
27341
27608
  // get the bounds in world space
27342
27609
  this.getMatrixAt( i, _matrix$1 );
27343
27610
  this.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );
27344
- culled = ! frustum.intersectsSphere( _sphere$2, camera );
27611
+ culled = ! frustum.intersectsSphere( _sphere$2 );
27345
27612
 
27346
27613
  }
27347
27614
 
@@ -27424,6 +27691,10 @@ class LineBasicMaterial extends Material {
27424
27691
  * Sets the color of the lines using data from a texture. The texture map
27425
27692
  * color is modulated by the diffuse `color`.
27426
27693
  *
27694
+ * `map` represents color data, and the texture must be assigned a
27695
+ * {@link Texture#colorSpace}. Most `map` textures set
27696
+ * `texture.colorSpace = SRGBColorSpace`.
27697
+ *
27427
27698
  * @type {?Texture}
27428
27699
  * @default null
27429
27700
  */
@@ -27977,6 +28248,10 @@ class PointsMaterial extends Material {
27977
28248
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
27978
28249
  * color is modulated by the diffuse `color`.
27979
28250
  *
28251
+ * `map` represents color data, and the texture must be assigned a
28252
+ * {@link Texture#colorSpace}. Most `map` textures set
28253
+ * `texture.colorSpace = SRGBColorSpace`.
28254
+ *
27980
28255
  * @type {?Texture}
27981
28256
  * @default null
27982
28257
  */
@@ -27992,6 +28267,9 @@ class PointsMaterial extends Material {
27992
28267
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
27993
28268
  * luminance/alpha textures will also still work as expected.
27994
28269
  *
28270
+ * `alphaMap` represents non-color data. Any texture assigned must have
28271
+ * `texture.colorSpace = NoColorSpace` (default).
28272
+ *
27995
28273
  * @type {?Texture}
27996
28274
  * @default null
27997
28275
  */
@@ -28969,7 +29247,7 @@ class DepthTexture extends Texture {
28969
29247
 
28970
29248
  if ( format !== DepthFormat && format !== DepthStencilFormat ) {
28971
29249
 
28972
- throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
29250
+ throw new Error( 'THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
28973
29251
 
28974
29252
  }
28975
29253
 
@@ -29119,9 +29397,6 @@ class CubeDepthTexture extends DepthTexture {
29119
29397
  * This may be a texture from a protected media stream, device camera feed,
29120
29398
  * or other data feeds like a depth sensor.
29121
29399
  *
29122
- * Note that this class is only supported in {@link WebGLRenderer}, and in
29123
- * the {@link WebGPURenderer} WebGPU backend.
29124
- *
29125
29400
  * @augments Texture
29126
29401
  */
29127
29402
  class ExternalTexture extends Texture {
@@ -36243,6 +36518,10 @@ class SphereGeometry extends BufferGeometry {
36243
36518
  const verticesRow = [];
36244
36519
 
36245
36520
  const v = iy / heightSegments;
36521
+ const theta = thetaStart + v * thetaLength;
36522
+
36523
+ const y = radius * Math.cos( theta );
36524
+ const ringRadius = Math.sqrt( radius * radius - y * y );
36246
36525
 
36247
36526
  // special case for the poles
36248
36527
 
@@ -36261,12 +36540,13 @@ class SphereGeometry extends BufferGeometry {
36261
36540
  for ( let ix = 0; ix <= widthSegments; ix ++ ) {
36262
36541
 
36263
36542
  const u = ix / widthSegments;
36543
+ const phi = phiStart + u * phiLength;
36264
36544
 
36265
36545
  // vertex
36266
36546
 
36267
- vertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
36268
- vertex.y = radius * Math.cos( thetaStart + v * thetaLength );
36269
- vertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
36547
+ vertex.x = - ringRadius * Math.cos( phi );
36548
+ vertex.y = y;
36549
+ vertex.z = ringRadius * Math.sin( phi );
36270
36550
 
36271
36551
  vertices.push( vertex.x, vertex.y, vertex.z );
36272
36552
 
@@ -37837,6 +38117,86 @@ class ShaderMaterial extends Material {
37837
38117
 
37838
38118
  }
37839
38119
 
38120
+ /**
38121
+ * Deserializes the material from the given JSON.
38122
+ *
38123
+ * @param {Object} json - The JSON holding the serialized material.
38124
+ * @param {Object<string,Texture>} textures - A dictionary holding textures referenced by the material.
38125
+ * @return {ShaderMaterial} A reference to this material.
38126
+ */
38127
+ fromJSON( json, textures ) {
38128
+
38129
+ super.fromJSON( json, textures );
38130
+
38131
+ if ( json.uniforms !== undefined ) {
38132
+
38133
+ for ( const name in json.uniforms ) {
38134
+
38135
+ const uniform = json.uniforms[ name ];
38136
+
38137
+ this.uniforms[ name ] = {};
38138
+
38139
+ switch ( uniform.type ) {
38140
+
38141
+ case 't':
38142
+ this.uniforms[ name ].value = textures[ uniform.value ] || null;
38143
+ break;
38144
+
38145
+ case 'c':
38146
+ this.uniforms[ name ].value = new Color().setHex( uniform.value );
38147
+ break;
38148
+
38149
+ case 'v2':
38150
+ this.uniforms[ name ].value = new Vector2().fromArray( uniform.value );
38151
+ break;
38152
+
38153
+ case 'v3':
38154
+ this.uniforms[ name ].value = new Vector3().fromArray( uniform.value );
38155
+ break;
38156
+
38157
+ case 'v4':
38158
+ this.uniforms[ name ].value = new Vector4().fromArray( uniform.value );
38159
+ break;
38160
+
38161
+ case 'm3':
38162
+ this.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );
38163
+ break;
38164
+
38165
+ case 'm4':
38166
+ this.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );
38167
+ break;
38168
+
38169
+ default:
38170
+ this.uniforms[ name ].value = uniform.value;
38171
+
38172
+ }
38173
+
38174
+ }
38175
+
38176
+ }
38177
+
38178
+ if ( json.defines !== undefined ) this.defines = json.defines;
38179
+ if ( json.vertexShader !== undefined ) this.vertexShader = json.vertexShader;
38180
+ if ( json.fragmentShader !== undefined ) this.fragmentShader = json.fragmentShader;
38181
+ if ( json.glslVersion !== undefined ) this.glslVersion = json.glslVersion;
38182
+
38183
+ if ( json.extensions !== undefined ) {
38184
+
38185
+ for ( const key in json.extensions ) {
38186
+
38187
+ this.extensions[ key ] = json.extensions[ key ];
38188
+
38189
+ }
38190
+
38191
+ }
38192
+
38193
+ if ( json.lights !== undefined ) this.lights = json.lights;
38194
+ if ( json.clipping !== undefined ) this.clipping = json.clipping;
38195
+
38196
+ return this;
38197
+
38198
+ }
38199
+
37840
38200
  }
37841
38201
 
37842
38202
  /**
@@ -37974,6 +38334,10 @@ class MeshStandardMaterial extends Material {
37974
38334
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
37975
38335
  * color is modulated by the diffuse `color`.
37976
38336
  *
38337
+ * `map` represents color data, and the texture must be assigned a
38338
+ * {@link Texture#colorSpace}. Most `map` textures set
38339
+ * `texture.colorSpace = SRGBColorSpace`.
38340
+ *
37977
38341
  * @type {?Texture}
37978
38342
  * @default null
37979
38343
  */
@@ -37982,6 +38346,11 @@ class MeshStandardMaterial extends Material {
37982
38346
  /**
37983
38347
  * The light map. Requires a second set of UVs.
37984
38348
  *
38349
+ * `lightMap` represents pre-baked illuminance data, and the texture must be assigned
38350
+ * a {@link Texture#colorSpace}. Most `lightMap` textures set
38351
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
38352
+ * such as `.exr` or `.hdr`.
38353
+ *
37985
38354
  * @type {?Texture}
37986
38355
  * @default null
37987
38356
  */
@@ -37999,6 +38368,9 @@ class MeshStandardMaterial extends Material {
37999
38368
  * The red channel of this texture is used as the ambient occlusion map.
38000
38369
  * Requires a second set of UVs.
38001
38370
  *
38371
+ * `aoMap` represents non-color data. Any texture assigned must have
38372
+ * `texture.colorSpace = NoColorSpace` (default).
38373
+ *
38002
38374
  * @type {?Texture}
38003
38375
  * @default null
38004
38376
  */
@@ -38036,6 +38408,10 @@ class MeshStandardMaterial extends Material {
38036
38408
  * emissive color and the emissive intensity. If you have an emissive map,
38037
38409
  * be sure to set the emissive color to something other than black.
38038
38410
  *
38411
+ * `emissiveMap` represents color data, and the texture must be assigned a
38412
+ * {@link Texture#colorSpace}. Most `emissiveMap` textures set
38413
+ * `texture.colorSpace = SRGBColorSpace`.
38414
+ *
38039
38415
  * @type {?Texture}
38040
38416
  * @default null
38041
38417
  */
@@ -38047,6 +38423,9 @@ class MeshStandardMaterial extends Material {
38047
38423
  * the geometry of the object, only the lighting. If a normal map is defined
38048
38424
  * this will be ignored.
38049
38425
  *
38426
+ * `bumpMap` represents non-color data. Any texture assigned must have
38427
+ * `texture.colorSpace = NoColorSpace` (default).
38428
+ *
38050
38429
  * @type {?Texture}
38051
38430
  * @default null
38052
38431
  */
@@ -38068,6 +38447,9 @@ class MeshStandardMaterial extends Material {
38068
38447
  * convention, the `y` component of `normalScale` should be negated to compensate
38069
38448
  * for the different handedness.
38070
38449
  *
38450
+ * `normalMap` represents non-color data. Any texture assigned must have
38451
+ * `texture.colorSpace = NoColorSpace` (default).
38452
+ *
38071
38453
  * @type {?Texture}
38072
38454
  * @default null
38073
38455
  */
@@ -38095,7 +38477,12 @@ class MeshStandardMaterial extends Material {
38095
38477
  * displaced vertices can cast shadows, block other objects, and otherwise
38096
38478
  * act as real geometry. The displacement texture is an image where the value
38097
38479
  * of each pixel (white being the highest) is mapped against, and
38098
- * repositions, the vertices of the mesh.
38480
+ * repositions, the vertices of the mesh. For best results, pair a
38481
+ * displacement map with a matching normal map, since the renderer can
38482
+ * not recompute surface normals from the displaced vertices.
38483
+ *
38484
+ * `displacementMap` represents non-color data. Any texture assigned must have
38485
+ * `texture.colorSpace = NoColorSpace` (default).
38099
38486
  *
38100
38487
  * @type {?Texture}
38101
38488
  * @default null
@@ -38126,6 +38513,9 @@ class MeshStandardMaterial extends Material {
38126
38513
  * The green channel of this texture is used to alter the roughness of the
38127
38514
  * material.
38128
38515
  *
38516
+ * `roughnessMap` represents non-color data. Any texture assigned must have
38517
+ * `texture.colorSpace = NoColorSpace` (default).
38518
+ *
38129
38519
  * @type {?Texture}
38130
38520
  * @default null
38131
38521
  */
@@ -38135,6 +38525,9 @@ class MeshStandardMaterial extends Material {
38135
38525
  * The blue channel of this texture is used to alter the metalness of the
38136
38526
  * material.
38137
38527
  *
38528
+ * `metalnessMap` represents non-color data. Any texture assigned must have
38529
+ * `texture.colorSpace = NoColorSpace` (default).
38530
+ *
38138
38531
  * @type {?Texture}
38139
38532
  * @default null
38140
38533
  */
@@ -38150,6 +38543,9 @@ class MeshStandardMaterial extends Material {
38150
38543
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
38151
38544
  * luminance/alpha textures will also still work as expected.
38152
38545
  *
38546
+ * `alphaMap` represents non-color data. Any texture assigned must have
38547
+ * `texture.colorSpace = NoColorSpace` (default).
38548
+ *
38153
38549
  * @type {?Texture}
38154
38550
  * @default null
38155
38551
  */
@@ -38159,6 +38555,11 @@ class MeshStandardMaterial extends Material {
38159
38555
  * The environment map. To ensure a physically correct rendering, environment maps
38160
38556
  * are internally pre-processed with {@link PMREMGenerator}.
38161
38557
  *
38558
+ * `envMap` represents luminance data, and the texture must be assigned
38559
+ * a {@link Texture#colorSpace}. Most `envMap` textures set
38560
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
38561
+ * such as `.exr` or `.hdr`.
38562
+ *
38162
38563
  * @type {?Texture}
38163
38564
  * @default null
38164
38565
  */
@@ -38370,6 +38771,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38370
38771
  * bitangent space, to be rotated by `anisotropyRotation`. The blue channel
38371
38772
  * contains strength as `[0, 1]` to be multiplied by `anisotropy`.
38372
38773
  *
38774
+ * `anisotropyMap` represents non-color data. Any texture assigned must have
38775
+ * `texture.colorSpace = NoColorSpace` (default).
38776
+ *
38373
38777
  * @type {?Texture}
38374
38778
  * @default null
38375
38779
  */
@@ -38379,6 +38783,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38379
38783
  * The red channel of this texture is multiplied against `clearcoat`,
38380
38784
  * for per-pixel control over a coating's intensity.
38381
38785
  *
38786
+ * `clearcoatMap` represents non-color data. Any texture assigned must have
38787
+ * `texture.colorSpace = NoColorSpace` (default).
38788
+ *
38382
38789
  * @type {?Texture}
38383
38790
  * @default null
38384
38791
  */
@@ -38396,6 +38803,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38396
38803
  * The green channel of this texture is multiplied against
38397
38804
  * `clearcoatRoughness`, for per-pixel control over a coating's roughness.
38398
38805
  *
38806
+ * `clearcoatRoughnessMap` represents non-color data. Any texture assigned must have
38807
+ * `texture.colorSpace = NoColorSpace` (default).
38808
+ *
38399
38809
  * @type {?Texture}
38400
38810
  * @default null
38401
38811
  */
@@ -38413,6 +38823,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38413
38823
  /**
38414
38824
  * Can be used to enable independent normals for the clear coat layer.
38415
38825
  *
38826
+ * `clearcoatNormalMap` represents non-color data. Any texture assigned must have
38827
+ * `texture.colorSpace = NoColorSpace` (default).
38828
+ *
38416
38829
  * @type {?Texture}
38417
38830
  * @default null
38418
38831
  */
@@ -38454,6 +38867,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38454
38867
  * The red channel of this texture is multiplied against `iridescence`, for per-pixel
38455
38868
  * control over iridescence.
38456
38869
  *
38870
+ * `iridescenceMap` represents non-color data. Any texture assigned must have
38871
+ * `texture.colorSpace = NoColorSpace` (default).
38872
+ *
38457
38873
  * @type {?Texture}
38458
38874
  * @default null
38459
38875
  */
@@ -38484,6 +38900,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38484
38900
  * - `1.0` in the green channel will result in thickness equal to second element of the array.
38485
38901
  * - Values in-between will linearly interpolate between the elements of the array.
38486
38902
  *
38903
+ * `iridescenceThicknessMap` represents non-color data. Any texture assigned must have
38904
+ * `texture.colorSpace = NoColorSpace` (default).
38905
+ *
38487
38906
  * @type {?Texture}
38488
38907
  * @default null
38489
38908
  */
@@ -38501,6 +38920,10 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38501
38920
  * The RGB channels of this texture are multiplied against `sheenColor`, for per-pixel control
38502
38921
  * over sheen tint.
38503
38922
  *
38923
+ * `sheenColorMap` represents color data, and the texture must be assigned a
38924
+ * {@link Texture#colorSpace}. Most `sheenColorMap` textures set
38925
+ * `texture.colorSpace = SRGBColorSpace`.
38926
+ *
38504
38927
  * @type {?Texture}
38505
38928
  * @default null
38506
38929
  */
@@ -38518,6 +38941,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38518
38941
  * The alpha channel of this texture is multiplied against `sheenRoughness`, for per-pixel control
38519
38942
  * over sheen roughness.
38520
38943
  *
38944
+ * `sheenRoughnessMap` represents non-color data. Any texture assigned must have
38945
+ * `texture.colorSpace = NoColorSpace` (default).
38946
+ *
38521
38947
  * @type {?Texture}
38522
38948
  * @default null
38523
38949
  */
@@ -38527,6 +38953,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38527
38953
  * The red channel of this texture is multiplied against `transmission`, for per-pixel control over
38528
38954
  * optical transparency.
38529
38955
  *
38956
+ * `transmissionMap` represents non-color data. Any texture assigned must have
38957
+ * `texture.colorSpace = NoColorSpace` (default).
38958
+ *
38530
38959
  * @type {?Texture}
38531
38960
  * @default null
38532
38961
  */
@@ -38546,6 +38975,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38546
38975
  * A texture that defines the thickness, stored in the green channel. This will
38547
38976
  * be multiplied by `thickness`.
38548
38977
  *
38978
+ * `thicknessMap` represents non-color data. Any texture assigned must have
38979
+ * `texture.colorSpace = NoColorSpace` (default).
38980
+ *
38549
38981
  * @type {?Texture}
38550
38982
  * @default null
38551
38983
  */
@@ -38583,6 +39015,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38583
39015
  * The alpha channel of this texture is multiplied against `specularIntensity`,
38584
39016
  * for per-pixel control over specular intensity.
38585
39017
  *
39018
+ * `specularIntensityMap` represents non-color data. Any texture assigned must have
39019
+ * `texture.colorSpace = NoColorSpace` (default).
39020
+ *
38586
39021
  * @type {?Texture}
38587
39022
  * @default null
38588
39023
  */
@@ -38600,6 +39035,10 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38600
39035
  * The RGB channels of this texture are multiplied against `specularColor`,
38601
39036
  * for per-pixel control over specular color.
38602
39037
  *
39038
+ * `specularColorMap` represents color data, and the texture must be assigned a
39039
+ * {@link Texture#colorSpace}. Most `specularColorMap` textures set
39040
+ * `texture.colorSpace = SRGBColorSpace`.
39041
+ *
38603
39042
  * @type {?Texture}
38604
39043
  * @default null
38605
39044
  */
@@ -38897,6 +39336,10 @@ class MeshPhongMaterial extends Material {
38897
39336
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
38898
39337
  * color is modulated by the diffuse `color`.
38899
39338
  *
39339
+ * `map` represents color data, and the texture must be assigned a
39340
+ * {@link Texture#colorSpace}. Most `map` textures set
39341
+ * `texture.colorSpace = SRGBColorSpace`.
39342
+ *
38900
39343
  * @type {?Texture}
38901
39344
  * @default null
38902
39345
  */
@@ -38905,6 +39348,11 @@ class MeshPhongMaterial extends Material {
38905
39348
  /**
38906
39349
  * The light map. Requires a second set of UVs.
38907
39350
  *
39351
+ * `lightMap` represents pre-baked illuminance data, and the texture must be assigned
39352
+ * a {@link Texture#colorSpace}. Most `lightMap` textures set
39353
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
39354
+ * such as `.exr` or `.hdr`.
39355
+ *
38908
39356
  * @type {?Texture}
38909
39357
  * @default null
38910
39358
  */
@@ -38922,6 +39370,9 @@ class MeshPhongMaterial extends Material {
38922
39370
  * The red channel of this texture is used as the ambient occlusion map.
38923
39371
  * Requires a second set of UVs.
38924
39372
  *
39373
+ * `aoMap` represents non-color data. Any texture assigned must have
39374
+ * `texture.colorSpace = NoColorSpace` (default).
39375
+ *
38925
39376
  * @type {?Texture}
38926
39377
  * @default null
38927
39378
  */
@@ -38959,6 +39410,10 @@ class MeshPhongMaterial extends Material {
38959
39410
  * emissive color and the emissive intensity. If you have an emissive map,
38960
39411
  * be sure to set the emissive color to something other than black.
38961
39412
  *
39413
+ * `emissiveMap` represents color data, and the texture must be assigned a
39414
+ * {@link Texture#colorSpace}. Most `emissiveMap` textures set
39415
+ * `texture.colorSpace = SRGBColorSpace`.
39416
+ *
38962
39417
  * @type {?Texture}
38963
39418
  * @default null
38964
39419
  */
@@ -38970,6 +39425,9 @@ class MeshPhongMaterial extends Material {
38970
39425
  * the geometry of the object, only the lighting. If a normal map is defined
38971
39426
  * this will be ignored.
38972
39427
  *
39428
+ * `bumpMap` represents non-color data. Any texture assigned must have
39429
+ * `texture.colorSpace = NoColorSpace` (default).
39430
+ *
38973
39431
  * @type {?Texture}
38974
39432
  * @default null
38975
39433
  */
@@ -38991,6 +39449,9 @@ class MeshPhongMaterial extends Material {
38991
39449
  * convention, the `y` component of `normalScale` should be negated to compensate
38992
39450
  * for the different handedness.
38993
39451
  *
39452
+ * `normalMap` represents non-color data. Any texture assigned must have
39453
+ * `texture.colorSpace = NoColorSpace` (default).
39454
+ *
38994
39455
  * @type {?Texture}
38995
39456
  * @default null
38996
39457
  */
@@ -39018,7 +39479,12 @@ class MeshPhongMaterial extends Material {
39018
39479
  * displaced vertices can cast shadows, block other objects, and otherwise
39019
39480
  * act as real geometry. The displacement texture is an image where the value
39020
39481
  * of each pixel (white being the highest) is mapped against, and
39021
- * repositions, the vertices of the mesh.
39482
+ * repositions, the vertices of the mesh. For best results, pair a
39483
+ * displacement map with a matching normal map, since the renderer can
39484
+ * not recompute surface normals from the displaced vertices.
39485
+ *
39486
+ * `displacementMap` represents non-color data. Any texture assigned must have
39487
+ * `texture.colorSpace = NoColorSpace` (default).
39022
39488
  *
39023
39489
  * @type {?Texture}
39024
39490
  * @default null
@@ -39050,6 +39516,10 @@ class MeshPhongMaterial extends Material {
39050
39516
  * highlight contributes and how much of the environment map affects the
39051
39517
  * surface.
39052
39518
  *
39519
+ * `specularMap` represents color data, and the texture must be assigned a
39520
+ * {@link Texture#colorSpace}. Most `specularMap` textures set
39521
+ * `texture.colorSpace = SRGBColorSpace`.
39522
+ *
39053
39523
  * @type {?Texture}
39054
39524
  * @default null
39055
39525
  */
@@ -39065,6 +39535,9 @@ class MeshPhongMaterial extends Material {
39065
39535
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
39066
39536
  * luminance/alpha textures will also still work as expected.
39067
39537
  *
39538
+ * `alphaMap` represents non-color data. Any texture assigned must have
39539
+ * `texture.colorSpace = NoColorSpace` (default).
39540
+ *
39068
39541
  * @type {?Texture}
39069
39542
  * @default null
39070
39543
  */
@@ -39073,6 +39546,11 @@ class MeshPhongMaterial extends Material {
39073
39546
  /**
39074
39547
  * The environment map.
39075
39548
  *
39549
+ * `envMap` represents luminance data, and the texture must be assigned
39550
+ * a {@link Texture#colorSpace}. Most `envMap` textures set
39551
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
39552
+ * such as `.exr` or `.hdr`.
39553
+ *
39076
39554
  * @type {?Texture}
39077
39555
  * @default null
39078
39556
  */
@@ -39287,6 +39765,10 @@ class MeshToonMaterial extends Material {
39287
39765
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
39288
39766
  * color is modulated by the diffuse `color`.
39289
39767
  *
39768
+ * `map` represents color data, and the texture must be assigned a
39769
+ * {@link Texture#colorSpace}. Most `map` textures set
39770
+ * `texture.colorSpace = SRGBColorSpace`.
39771
+ *
39290
39772
  * @type {?Texture}
39291
39773
  * @default null
39292
39774
  */
@@ -39297,6 +39779,9 @@ class MeshToonMaterial extends Material {
39297
39779
  * {@link Texture#minFilter} and {@link Texture#magFilter} to {@link NearestFilter}
39298
39780
  * when using this type of texture.
39299
39781
  *
39782
+ * `gradientMap` represents non-color data. Any texture assigned must have
39783
+ * `texture.colorSpace = NoColorSpace` (default).
39784
+ *
39300
39785
  * @type {?Texture}
39301
39786
  * @default null
39302
39787
  */
@@ -39305,6 +39790,11 @@ class MeshToonMaterial extends Material {
39305
39790
  /**
39306
39791
  * The light map. Requires a second set of UVs.
39307
39792
  *
39793
+ * `lightMap` represents pre-baked illuminance data, and the texture must be assigned
39794
+ * a {@link Texture#colorSpace}. Most `lightMap` textures set
39795
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
39796
+ * such as `.exr` or `.hdr`.
39797
+ *
39308
39798
  * @type {?Texture}
39309
39799
  * @default null
39310
39800
  */
@@ -39322,6 +39812,9 @@ class MeshToonMaterial extends Material {
39322
39812
  * The red channel of this texture is used as the ambient occlusion map.
39323
39813
  * Requires a second set of UVs.
39324
39814
  *
39815
+ * `aoMap` represents non-color data. Any texture assigned must have
39816
+ * `texture.colorSpace = NoColorSpace` (default).
39817
+ *
39325
39818
  * @type {?Texture}
39326
39819
  * @default null
39327
39820
  */
@@ -39359,6 +39852,10 @@ class MeshToonMaterial extends Material {
39359
39852
  * emissive color and the emissive intensity. If you have an emissive map,
39360
39853
  * be sure to set the emissive color to something other than black.
39361
39854
  *
39855
+ * `emissiveMap` represents color data, and the texture must be assigned a
39856
+ * {@link Texture#colorSpace}. Most `emissiveMap` textures set
39857
+ * `texture.colorSpace = SRGBColorSpace`.
39858
+ *
39362
39859
  * @type {?Texture}
39363
39860
  * @default null
39364
39861
  */
@@ -39370,6 +39867,9 @@ class MeshToonMaterial extends Material {
39370
39867
  * the geometry of the object, only the lighting. If a normal map is defined
39371
39868
  * this will be ignored.
39372
39869
  *
39870
+ * `bumpMap` represents non-color data. Any texture assigned must have
39871
+ * `texture.colorSpace = NoColorSpace` (default).
39872
+ *
39373
39873
  * @type {?Texture}
39374
39874
  * @default null
39375
39875
  */
@@ -39391,6 +39891,9 @@ class MeshToonMaterial extends Material {
39391
39891
  * convention, the `y` component of `normalScale` should be negated to compensate
39392
39892
  * for the different handedness.
39393
39893
  *
39894
+ * `normalMap` represents non-color data. Any texture assigned must have
39895
+ * `texture.colorSpace = NoColorSpace` (default).
39896
+ *
39394
39897
  * @type {?Texture}
39395
39898
  * @default null
39396
39899
  */
@@ -39418,7 +39921,12 @@ class MeshToonMaterial extends Material {
39418
39921
  * displaced vertices can cast shadows, block other objects, and otherwise
39419
39922
  * act as real geometry. The displacement texture is an image where the value
39420
39923
  * of each pixel (white being the highest) is mapped against, and
39421
- * repositions, the vertices of the mesh.
39924
+ * repositions, the vertices of the mesh. For best results, pair a
39925
+ * displacement map with a matching normal map, since the renderer can
39926
+ * not recompute surface normals from the displaced vertices.
39927
+ *
39928
+ * `displacementMap` represents non-color data. Any texture assigned must have
39929
+ * `texture.colorSpace = NoColorSpace` (default).
39422
39930
  *
39423
39931
  * @type {?Texture}
39424
39932
  * @default null
@@ -39455,6 +39963,9 @@ class MeshToonMaterial extends Material {
39455
39963
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
39456
39964
  * luminance/alpha textures will also still work as expected.
39457
39965
  *
39966
+ * `alphaMap` represents non-color data. Any texture assigned must have
39967
+ * `texture.colorSpace = NoColorSpace` (default).
39968
+ *
39458
39969
  * @type {?Texture}
39459
39970
  * @default null
39460
39971
  */
@@ -39593,6 +40104,9 @@ class MeshNormalMaterial extends Material {
39593
40104
  * the geometry of the object, only the lighting. If a normal map is defined
39594
40105
  * this will be ignored.
39595
40106
  *
40107
+ * `bumpMap` represents non-color data. Any texture assigned must have
40108
+ * `texture.colorSpace = NoColorSpace` (default).
40109
+ *
39596
40110
  * @type {?Texture}
39597
40111
  * @default null
39598
40112
  */
@@ -39614,6 +40128,9 @@ class MeshNormalMaterial extends Material {
39614
40128
  * convention, the `y` component of `normalScale` should be negated to compensate
39615
40129
  * for the different handedness.
39616
40130
  *
40131
+ * `normalMap` represents non-color data. Any texture assigned must have
40132
+ * `texture.colorSpace = NoColorSpace` (default).
40133
+ *
39617
40134
  * @type {?Texture}
39618
40135
  * @default null
39619
40136
  */
@@ -39641,7 +40158,9 @@ class MeshNormalMaterial extends Material {
39641
40158
  * displaced vertices can cast shadows, block other objects, and otherwise
39642
40159
  * act as real geometry. The displacement texture is an image where the value
39643
40160
  * of each pixel (white being the highest) is mapped against, and
39644
- * repositions, the vertices of the mesh.
40161
+ * repositions, the vertices of the mesh. For best results, pair a
40162
+ * displacement map with a matching normal map, since the renderer can
40163
+ * not recompute surface normals from the displaced vertices.
39645
40164
  *
39646
40165
  * @type {?Texture}
39647
40166
  * @default null
@@ -39781,6 +40300,10 @@ class MeshLambertMaterial extends Material {
39781
40300
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
39782
40301
  * color is modulated by the diffuse `color`.
39783
40302
  *
40303
+ * `map` represents color data, and the texture must be assigned a
40304
+ * {@link Texture#colorSpace}. Most `map` textures set
40305
+ * `texture.colorSpace = SRGBColorSpace`.
40306
+ *
39784
40307
  * @type {?Texture}
39785
40308
  * @default null
39786
40309
  */
@@ -39789,6 +40312,11 @@ class MeshLambertMaterial extends Material {
39789
40312
  /**
39790
40313
  * The light map. Requires a second set of UVs.
39791
40314
  *
40315
+ * `lightMap` represents pre-baked illuminance data, and the texture must be assigned
40316
+ * a {@link Texture#colorSpace}. Most `lightMap` textures set
40317
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
40318
+ * such as `.exr` or `.hdr`.
40319
+ *
39792
40320
  * @type {?Texture}
39793
40321
  * @default null
39794
40322
  */
@@ -39806,6 +40334,9 @@ class MeshLambertMaterial extends Material {
39806
40334
  * The red channel of this texture is used as the ambient occlusion map.
39807
40335
  * Requires a second set of UVs.
39808
40336
  *
40337
+ * `aoMap` represents non-color data. Any texture assigned must have
40338
+ * `texture.colorSpace = NoColorSpace` (default).
40339
+ *
39809
40340
  * @type {?Texture}
39810
40341
  * @default null
39811
40342
  */
@@ -39843,6 +40374,10 @@ class MeshLambertMaterial extends Material {
39843
40374
  * emissive color and the emissive intensity. If you have an emissive map,
39844
40375
  * be sure to set the emissive color to something other than black.
39845
40376
  *
40377
+ * `emissiveMap` represents color data, and the texture must be assigned a
40378
+ * {@link Texture#colorSpace}. Most `emissiveMap` textures set
40379
+ * `texture.colorSpace = SRGBColorSpace`.
40380
+ *
39846
40381
  * @type {?Texture}
39847
40382
  * @default null
39848
40383
  */
@@ -39854,6 +40389,9 @@ class MeshLambertMaterial extends Material {
39854
40389
  * the geometry of the object, only the lighting. If a normal map is defined
39855
40390
  * this will be ignored.
39856
40391
  *
40392
+ * `bumpMap` represents non-color data. Any texture assigned must have
40393
+ * `texture.colorSpace = NoColorSpace` (default).
40394
+ *
39857
40395
  * @type {?Texture}
39858
40396
  * @default null
39859
40397
  */
@@ -39875,6 +40413,9 @@ class MeshLambertMaterial extends Material {
39875
40413
  * convention, the `y` component of `normalScale` should be negated to compensate
39876
40414
  * for the different handedness.
39877
40415
  *
40416
+ * `normalMap` represents non-color data. Any texture assigned must have
40417
+ * `texture.colorSpace = NoColorSpace` (default).
40418
+ *
39878
40419
  * @type {?Texture}
39879
40420
  * @default null
39880
40421
  */
@@ -39902,7 +40443,12 @@ class MeshLambertMaterial extends Material {
39902
40443
  * displaced vertices can cast shadows, block other objects, and otherwise
39903
40444
  * act as real geometry. The displacement texture is an image where the value
39904
40445
  * of each pixel (white being the highest) is mapped against, and
39905
- * repositions, the vertices of the mesh.
40446
+ * repositions, the vertices of the mesh. For best results, pair a
40447
+ * displacement map with a matching normal map, since the renderer can
40448
+ * not recompute surface normals from the displaced vertices.
40449
+ *
40450
+ * `displacementMap` represents non-color data. Any texture assigned must have
40451
+ * `texture.colorSpace = NoColorSpace` (default).
39906
40452
  *
39907
40453
  * @type {?Texture}
39908
40454
  * @default null
@@ -39932,6 +40478,10 @@ class MeshLambertMaterial extends Material {
39932
40478
  /**
39933
40479
  * Specular map used by the material.
39934
40480
  *
40481
+ * `specularMap` represents color data, and the texture must be assigned a
40482
+ * {@link Texture#colorSpace}. Most `specularMap` textures set
40483
+ * `texture.colorSpace = SRGBColorSpace`.
40484
+ *
39935
40485
  * @type {?Texture}
39936
40486
  * @default null
39937
40487
  */
@@ -39947,6 +40497,9 @@ class MeshLambertMaterial extends Material {
39947
40497
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
39948
40498
  * luminance/alpha textures will also still work as expected.
39949
40499
  *
40500
+ * `alphaMap` represents non-color data. Any texture assigned must have
40501
+ * `texture.colorSpace = NoColorSpace` (default).
40502
+ *
39950
40503
  * @type {?Texture}
39951
40504
  * @default null
39952
40505
  */
@@ -39955,6 +40508,11 @@ class MeshLambertMaterial extends Material {
39955
40508
  /**
39956
40509
  * The environment map.
39957
40510
  *
40511
+ * `envMap` represents luminance data, and the texture must be assigned
40512
+ * a {@link Texture#colorSpace}. Most `envMap` textures set
40513
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
40514
+ * such as `.exr` or `.hdr`.
40515
+ *
39958
40516
  * @type {?Texture}
39959
40517
  * @default null
39960
40518
  */
@@ -40165,6 +40723,10 @@ class MeshDepthMaterial extends Material {
40165
40723
  * The color map. May optionally include an alpha channel, typically combined
40166
40724
  * with {@link Material#transparent} or {@link Material#alphaTest}.
40167
40725
  *
40726
+ * `map` represents color data, and the texture must be assigned a
40727
+ * {@link Texture#colorSpace}. Most `map` textures set
40728
+ * `texture.colorSpace = SRGBColorSpace`.
40729
+ *
40168
40730
  * @type {?Texture}
40169
40731
  * @default null
40170
40732
  */
@@ -40180,6 +40742,9 @@ class MeshDepthMaterial extends Material {
40180
40742
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
40181
40743
  * luminance/alpha textures will also still work as expected.
40182
40744
  *
40745
+ * `alphaMap` represents non-color data. Any texture assigned must have
40746
+ * `texture.colorSpace = NoColorSpace` (default).
40747
+ *
40183
40748
  * @type {?Texture}
40184
40749
  * @default null
40185
40750
  */
@@ -40193,6 +40758,9 @@ class MeshDepthMaterial extends Material {
40193
40758
  * of each pixel (white being the highest) is mapped against, and
40194
40759
  * repositions, the vertices of the mesh.
40195
40760
  *
40761
+ * `displacementMap` represents non-color data. Any texture assigned must have
40762
+ * `texture.colorSpace = NoColorSpace` (default).
40763
+ *
40196
40764
  * @type {?Texture}
40197
40765
  * @default null
40198
40766
  */
@@ -40305,6 +40873,10 @@ class MeshDistanceMaterial extends Material {
40305
40873
  * The color map. May optionally include an alpha channel, typically combined
40306
40874
  * with {@link Material#transparent} or {@link Material#alphaTest}.
40307
40875
  *
40876
+ * `map` represents color data, and the texture must be assigned a
40877
+ * {@link Texture#colorSpace}. Most `map` textures set
40878
+ * `texture.colorSpace = SRGBColorSpace`.
40879
+ *
40308
40880
  * @type {?Texture}
40309
40881
  * @default null
40310
40882
  */
@@ -40320,6 +40892,9 @@ class MeshDistanceMaterial extends Material {
40320
40892
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
40321
40893
  * luminance/alpha textures will also still work as expected.
40322
40894
  *
40895
+ * `alphaMap` represents non-color data. Any texture assigned must have
40896
+ * `texture.colorSpace = NoColorSpace` (default).
40897
+ *
40323
40898
  * @type {?Texture}
40324
40899
  * @default null
40325
40900
  */
@@ -40333,6 +40908,9 @@ class MeshDistanceMaterial extends Material {
40333
40908
  * of each pixel (white being the highest) is mapped against, and
40334
40909
  * repositions, the vertices of the mesh.
40335
40910
  *
40911
+ * `displacementMap` represents non-color data. Any texture assigned must have
40912
+ * `texture.colorSpace = NoColorSpace` (default).
40913
+ *
40336
40914
  * @type {?Texture}
40337
40915
  * @default null
40338
40916
  */
@@ -40431,6 +41009,12 @@ class MeshMatcapMaterial extends Material {
40431
41009
  /**
40432
41010
  * The matcap map.
40433
41011
  *
41012
+ * `matcap` represents luminance data, and the texture must be assigned
41013
+ * a {@link Texture#colorSpace}. HDR `matcap` textures (e.g. `.exr`)
41014
+ * typically set `texture.colorSpace = LinearSRGBColorSpace`, while LDR
41015
+ * `matcap` textures (e.g. `.png`, `.jpg`, `.webp`) typically set
41016
+ * `texture.colorSpace = SRGBColorSpace`.
41017
+ *
40434
41018
  * @type {?Texture}
40435
41019
  * @default null
40436
41020
  */
@@ -40441,6 +41025,10 @@ class MeshMatcapMaterial extends Material {
40441
41025
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
40442
41026
  * color is modulated by the diffuse `color`.
40443
41027
  *
41028
+ * `map` represents color data, and the texture must be assigned a
41029
+ * {@link Texture#colorSpace}. Most `map` textures set
41030
+ * `texture.colorSpace = SRGBColorSpace`.
41031
+ *
40444
41032
  * @type {?Texture}
40445
41033
  * @default null
40446
41034
  */
@@ -40452,6 +41040,9 @@ class MeshMatcapMaterial extends Material {
40452
41040
  * the geometry of the object, only the lighting. If a normal map is defined
40453
41041
  * this will be ignored.
40454
41042
  *
41043
+ * `bumpMap` represents non-color data. Any texture assigned must have
41044
+ * `texture.colorSpace = NoColorSpace` (default).
41045
+ *
40455
41046
  * @type {?Texture}
40456
41047
  * @default null
40457
41048
  */
@@ -40473,6 +41064,9 @@ class MeshMatcapMaterial extends Material {
40473
41064
  * convention, the `y` component of `normalScale` should be negated to compensate
40474
41065
  * for the different handedness.
40475
41066
  *
41067
+ * `normalMap` represents non-color data. Any texture assigned must have
41068
+ * `texture.colorSpace = NoColorSpace` (default).
41069
+ *
40476
41070
  * @type {?Texture}
40477
41071
  * @default null
40478
41072
  */
@@ -40500,7 +41094,12 @@ class MeshMatcapMaterial extends Material {
40500
41094
  * displaced vertices can cast shadows, block other objects, and otherwise
40501
41095
  * act as real geometry. The displacement texture is an image where the value
40502
41096
  * of each pixel (white being the highest) is mapped against, and
40503
- * repositions, the vertices of the mesh.
41097
+ * repositions, the vertices of the mesh. For best results, pair a
41098
+ * displacement map with a matching normal map, since the renderer can
41099
+ * not recompute surface normals from the displaced vertices.
41100
+ *
41101
+ * `displacementMap` represents non-color data. Any texture assigned must have
41102
+ * `texture.colorSpace = NoColorSpace` (default).
40504
41103
  *
40505
41104
  * @type {?Texture}
40506
41105
  * @default null
@@ -40537,6 +41136,9 @@ class MeshMatcapMaterial extends Material {
40537
41136
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
40538
41137
  * luminance/alpha textures will also still work as expected.
40539
41138
  *
41139
+ * `alphaMap` represents non-color data. Any texture assigned must have
41140
+ * `texture.colorSpace = NoColorSpace` (default).
41141
+ *
40540
41142
  * @type {?Texture}
40541
41143
  * @default null
40542
41144
  */
@@ -41482,7 +42084,7 @@ class Interpolant {
41482
42084
  */
41483
42085
  interpolate_( /* i1, t0, t, t1 */ ) {
41484
42086
 
41485
- throw new Error( 'call to abstract method' );
42087
+ throw new Error( 'THREE.Interpolant: Call to abstract method.' );
41486
42088
  // implementations shall return this.resultBuffer
41487
42089
 
41488
42090
  }
@@ -41741,9 +42343,8 @@ class DiscreteInterpolant extends Interpolant {
41741
42343
  * each keyframe has explicit in/out tangent control points specified as
41742
42344
  * 2D coordinates (time, value).
41743
42345
  *
41744
- * The tangent data must be provided via the `settings` object:
41745
- * - `settings.inTangents`: Float32Array with [time, value] pairs per keyframe per component
41746
- * - `settings.outTangents`: Float32Array with [time, value] pairs per keyframe per component
42346
+ * Tangent data is read from `inTangents` and `outTangents` on the interpolant
42347
+ * (populated by `KeyframeTrack.InterpolantFactoryMethodBezier`).
41747
42348
  *
41748
42349
  * For a track with N keyframes and stride S:
41749
42350
  * - Each tangent array has N * S * 2 values
@@ -41763,9 +42364,8 @@ class BezierInterpolant extends Interpolant {
41763
42364
  const offset1 = i1 * stride;
41764
42365
  const offset0 = offset1 - stride;
41765
42366
 
41766
- const settings = this.settings || this.DefaultSettings_;
41767
- const inTangents = settings.inTangents;
41768
- const outTangents = settings.outTangents;
42367
+ const inTangents = this.inTangents;
42368
+ const outTangents = this.outTangents;
41769
42369
 
41770
42370
  // If no tangent data, fall back to linear interpolation
41771
42371
  if ( ! inTangents || ! outTangents ) {
@@ -41986,10 +42586,10 @@ class KeyframeTrack {
41986
42586
 
41987
42587
  const interpolant = new BezierInterpolant( this.times, this.values, this.getValueSize(), result );
41988
42588
 
41989
- // Pass tangent data from track settings to interpolant
41990
42589
  if ( this.settings ) {
41991
42590
 
41992
- interpolant.settings = this.settings;
42591
+ interpolant.inTangents = this.settings.inTangents;
42592
+ interpolant.outTangents = this.settings.outTangents;
41993
42593
 
41994
42594
  }
41995
42595
 
@@ -43031,144 +43631,6 @@ class AnimationClip {
43031
43631
 
43032
43632
  }
43033
43633
 
43034
- /**
43035
- * Parses the `animation.hierarchy` format and returns a new animation clip.
43036
- *
43037
- * @static
43038
- * @deprecated since r175.
43039
- * @param {Object} animation - A serialized animation clip as JSON.
43040
- * @param {Array<Bone>} bones - An array of bones.
43041
- * @return {?AnimationClip} The new animation clip.
43042
- */
43043
- static parseAnimation( animation, bones ) {
43044
-
43045
- warn( 'AnimationClip: parseAnimation() is deprecated and will be removed with r185' );
43046
-
43047
- if ( ! animation ) {
43048
-
43049
- error( 'AnimationClip: No animation in JSONLoader data.' );
43050
- return null;
43051
-
43052
- }
43053
-
43054
- const addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {
43055
-
43056
- // only return track if there are actually keys.
43057
- if ( animationKeys.length !== 0 ) {
43058
-
43059
- const times = [];
43060
- const values = [];
43061
-
43062
- flattenJSON( animationKeys, times, values, propertyName );
43063
-
43064
- // empty keys are filtered out, so check again
43065
- if ( times.length !== 0 ) {
43066
-
43067
- destTracks.push( new trackType( trackName, times, values ) );
43068
-
43069
- }
43070
-
43071
- }
43072
-
43073
- };
43074
-
43075
- const tracks = [];
43076
-
43077
- const clipName = animation.name || 'default';
43078
- const fps = animation.fps || 30;
43079
- const blendMode = animation.blendMode;
43080
-
43081
- // automatic length determination in AnimationClip.
43082
- let duration = animation.length || -1;
43083
-
43084
- const hierarchyTracks = animation.hierarchy || [];
43085
-
43086
- for ( let h = 0; h < hierarchyTracks.length; h ++ ) {
43087
-
43088
- const animationKeys = hierarchyTracks[ h ].keys;
43089
-
43090
- // skip empty tracks
43091
- if ( ! animationKeys || animationKeys.length === 0 ) continue;
43092
-
43093
- // process morph targets
43094
- if ( animationKeys[ 0 ].morphTargets ) {
43095
-
43096
- // figure out all morph targets used in this track
43097
- const morphTargetNames = {};
43098
-
43099
- let k;
43100
-
43101
- for ( k = 0; k < animationKeys.length; k ++ ) {
43102
-
43103
- if ( animationKeys[ k ].morphTargets ) {
43104
-
43105
- for ( let m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) {
43106
-
43107
- morphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = -1;
43108
-
43109
- }
43110
-
43111
- }
43112
-
43113
- }
43114
-
43115
- // create a track for each morph target with all zero
43116
- // morphTargetInfluences except for the keys in which
43117
- // the morphTarget is named.
43118
- for ( const morphTargetName in morphTargetNames ) {
43119
-
43120
- const times = [];
43121
- const values = [];
43122
-
43123
- for ( let m = 0; m !== animationKeys[ k ].morphTargets.length; ++ m ) {
43124
-
43125
- const animationKey = animationKeys[ k ];
43126
-
43127
- times.push( animationKey.time );
43128
- values.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 );
43129
-
43130
- }
43131
-
43132
- tracks.push( new NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', times, values ) );
43133
-
43134
- }
43135
-
43136
- duration = morphTargetNames.length * fps;
43137
-
43138
- } else {
43139
-
43140
- // ...assume skeletal animation
43141
-
43142
- const boneName = '.bones[' + bones[ h ].name + ']';
43143
-
43144
- addNonemptyTrack(
43145
- VectorKeyframeTrack, boneName + '.position',
43146
- animationKeys, 'pos', tracks );
43147
-
43148
- addNonemptyTrack(
43149
- QuaternionKeyframeTrack, boneName + '.quaternion',
43150
- animationKeys, 'rot', tracks );
43151
-
43152
- addNonemptyTrack(
43153
- VectorKeyframeTrack, boneName + '.scale',
43154
- animationKeys, 'scl', tracks );
43155
-
43156
- }
43157
-
43158
- }
43159
-
43160
- if ( tracks.length === 0 ) {
43161
-
43162
- return null;
43163
-
43164
- }
43165
-
43166
- const clip = new this( clipName, duration, tracks, blendMode );
43167
-
43168
- return clip;
43169
-
43170
- }
43171
-
43172
43634
  /**
43173
43635
  * Sets the duration of this clip to the duration of its longest keyframe track.
43174
43636
  *
@@ -43633,6 +44095,11 @@ class LoadingManager {
43633
44095
  */
43634
44096
  this.resolveURL = function ( url ) {
43635
44097
 
44098
+ // Normalize to NFC so that Unicode URIs (e.g. from glTF)
44099
+ // are percent-encoded correctly per RFC 3987.
44100
+
44101
+ url = url.normalize( 'NFC' );
44102
+
43636
44103
  if ( urlModifier ) {
43637
44104
 
43638
44105
  return urlModifier( url );
@@ -44950,77 +45417,108 @@ class DataTextureLoader extends Loader {
44950
45417
 
44951
45418
  }
44952
45419
 
44953
- if ( texData.image !== undefined ) {
45420
+ scope._applyTexData( texture, texData );
44954
45421
 
44955
- texture.image = texData.image;
45422
+ if ( onLoad ) onLoad( texture, texData );
44956
45423
 
44957
- } else if ( texData.data !== undefined ) {
45424
+ }, onProgress, onError );
44958
45425
 
44959
- texture.image.width = texData.width;
44960
- texture.image.height = texData.height;
44961
- texture.image.data = texData.data;
44962
45426
 
44963
- }
45427
+ return texture;
44964
45428
 
44965
- texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;
44966
- texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;
45429
+ }
44967
45430
 
44968
- texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;
44969
- texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;
45431
+ /**
45432
+ * Parses the given buffer and returns a configured data texture. Use this method
45433
+ * for parsing texture data that is already in memory (e.g. drag and drop or data
45434
+ * loaded from a server) without going through {@link DataTextureLoader#load}.
45435
+ *
45436
+ * @param {ArrayBuffer} buffer - The raw texture data.
45437
+ * @return {DataTexture} The data texture.
45438
+ */
45439
+ createDataTexture( buffer ) {
44970
45440
 
44971
- texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;
45441
+ const texture = new DataTexture();
44972
45442
 
44973
- if ( texData.colorSpace !== undefined ) {
45443
+ this._applyTexData( texture, this.parse( buffer ) );
44974
45444
 
44975
- texture.colorSpace = texData.colorSpace;
45445
+ return texture;
44976
45446
 
44977
- }
45447
+ }
45448
+
45449
+ /**
45450
+ * Applies the given parsed texture data to the given data texture.
45451
+ *
45452
+ * @private
45453
+ * @param {DataTexture} texture - The data texture.
45454
+ * @param {DataTextureLoader~TexData} texData - The parsed texture data.
45455
+ */
45456
+ _applyTexData( texture, texData ) {
44978
45457
 
44979
- if ( texData.flipY !== undefined ) {
45458
+ if ( texData.image !== undefined ) {
44980
45459
 
44981
- texture.flipY = texData.flipY;
45460
+ texture.image = texData.image;
44982
45461
 
44983
- }
45462
+ } else if ( texData.data !== undefined ) {
44984
45463
 
44985
- if ( texData.format !== undefined ) {
45464
+ texture.image.width = texData.width;
45465
+ texture.image.height = texData.height;
45466
+ texture.image.data = texData.data;
44986
45467
 
44987
- texture.format = texData.format;
45468
+ }
44988
45469
 
44989
- }
45470
+ texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;
45471
+ texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;
44990
45472
 
44991
- if ( texData.type !== undefined ) {
45473
+ texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;
45474
+ texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;
44992
45475
 
44993
- texture.type = texData.type;
45476
+ texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;
44994
45477
 
44995
- }
45478
+ if ( texData.colorSpace !== undefined ) {
44996
45479
 
44997
- if ( texData.mipmaps !== undefined ) {
45480
+ texture.colorSpace = texData.colorSpace;
44998
45481
 
44999
- texture.mipmaps = texData.mipmaps;
45000
- texture.minFilter = LinearMipmapLinearFilter; // presumably...
45482
+ }
45001
45483
 
45002
- }
45484
+ if ( texData.flipY !== undefined ) {
45003
45485
 
45004
- if ( texData.mipmapCount === 1 ) {
45486
+ texture.flipY = texData.flipY;
45005
45487
 
45006
- texture.minFilter = LinearFilter;
45488
+ }
45007
45489
 
45008
- }
45490
+ if ( texData.format !== undefined ) {
45009
45491
 
45010
- if ( texData.generateMipmaps !== undefined ) {
45492
+ texture.format = texData.format;
45011
45493
 
45012
- texture.generateMipmaps = texData.generateMipmaps;
45494
+ }
45013
45495
 
45014
- }
45496
+ if ( texData.type !== undefined ) {
45015
45497
 
45016
- texture.needsUpdate = true;
45498
+ texture.type = texData.type;
45017
45499
 
45018
- if ( onLoad ) onLoad( texture, texData );
45500
+ }
45019
45501
 
45020
- }, onProgress, onError );
45502
+ if ( texData.mipmaps !== undefined ) {
45021
45503
 
45504
+ texture.mipmaps = texData.mipmaps;
45505
+ texture.minFilter = LinearMipmapLinearFilter; // presumably...
45022
45506
 
45023
- return texture;
45507
+ }
45508
+
45509
+ if ( texData.mipmapCount === 1 ) {
45510
+
45511
+ texture.minFilter = LinearFilter;
45512
+
45513
+ }
45514
+
45515
+ if ( texData.generateMipmaps !== undefined ) {
45516
+
45517
+ texture.generateMipmaps = texData.generateMipmaps;
45518
+
45519
+ }
45520
+
45521
+ texture.needsUpdate = true;
45024
45522
 
45025
45523
  }
45026
45524
 
@@ -45710,9 +46208,9 @@ class Camera extends Object3D {
45710
46208
 
45711
46209
  }
45712
46210
 
45713
- updateWorldMatrix( updateParents, updateChildren ) {
46211
+ updateWorldMatrix( updateParents, updateChildren, force = false ) {
45714
46212
 
45715
- super.updateWorldMatrix( updateParents, updateChildren );
46213
+ super.updateWorldMatrix( updateParents, updateChildren, force );
45716
46214
 
45717
46215
  // exclude scale from view matrix to be glTF conform
45718
46216
 
@@ -47494,6 +47992,8 @@ class LightProbe extends Light {
47494
47992
 
47495
47993
  }
47496
47994
 
47995
+ const _customMaterials = {};
47996
+
47497
47997
  /**
47498
47998
  * Class for loading materials. The files are internally
47499
47999
  * loaded via {@link FileLoader}.
@@ -47576,265 +48076,9 @@ class MaterialLoader extends Loader {
47576
48076
  */
47577
48077
  parse( json ) {
47578
48078
 
47579
- const textures = this.textures;
47580
-
47581
- function getTexture( name ) {
47582
-
47583
- if ( textures[ name ] === undefined ) {
47584
-
47585
- warn( 'MaterialLoader: Undefined texture', name );
47586
-
47587
- }
47588
-
47589
- return textures[ name ];
47590
-
47591
- }
47592
-
47593
48079
  const material = this.createMaterialFromType( json.type );
47594
48080
 
47595
- if ( json.uuid !== undefined ) material.uuid = json.uuid;
47596
- if ( json.name !== undefined ) material.name = json.name;
47597
- if ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );
47598
- if ( json.roughness !== undefined ) material.roughness = json.roughness;
47599
- if ( json.metalness !== undefined ) material.metalness = json.metalness;
47600
- if ( json.sheen !== undefined ) material.sheen = json.sheen;
47601
- if ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );
47602
- if ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;
47603
- if ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );
47604
- if ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );
47605
- if ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;
47606
- if ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );
47607
- if ( json.shininess !== undefined ) material.shininess = json.shininess;
47608
- if ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;
47609
- if ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;
47610
- if ( json.dispersion !== undefined ) material.dispersion = json.dispersion;
47611
- if ( json.iridescence !== undefined ) material.iridescence = json.iridescence;
47612
- if ( json.iridescenceIOR !== undefined ) material.iridescenceIOR = json.iridescenceIOR;
47613
- if ( json.iridescenceThicknessRange !== undefined ) material.iridescenceThicknessRange = json.iridescenceThicknessRange;
47614
- if ( json.transmission !== undefined ) material.transmission = json.transmission;
47615
- if ( json.thickness !== undefined ) material.thickness = json.thickness;
47616
- if ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;
47617
- if ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );
47618
- if ( json.anisotropy !== undefined ) material.anisotropy = json.anisotropy;
47619
- if ( json.anisotropyRotation !== undefined ) material.anisotropyRotation = json.anisotropyRotation;
47620
- if ( json.fog !== undefined ) material.fog = json.fog;
47621
- if ( json.flatShading !== undefined ) material.flatShading = json.flatShading;
47622
- if ( json.blending !== undefined ) material.blending = json.blending;
47623
- if ( json.combine !== undefined ) material.combine = json.combine;
47624
- if ( json.side !== undefined ) material.side = json.side;
47625
- if ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;
47626
- if ( json.opacity !== undefined ) material.opacity = json.opacity;
47627
- if ( json.transparent !== undefined ) material.transparent = json.transparent;
47628
- if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;
47629
- if ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;
47630
- if ( json.depthFunc !== undefined ) material.depthFunc = json.depthFunc;
47631
- if ( json.depthTest !== undefined ) material.depthTest = json.depthTest;
47632
- if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;
47633
- if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;
47634
- if ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;
47635
- if ( json.blendDst !== undefined ) material.blendDst = json.blendDst;
47636
- if ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;
47637
- if ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;
47638
- if ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;
47639
- if ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;
47640
- if ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );
47641
- if ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;
47642
- if ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;
47643
- if ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;
47644
- if ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;
47645
- if ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;
47646
- if ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;
47647
- if ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;
47648
- if ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;
47649
- if ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;
47650
-
47651
- if ( json.wireframe !== undefined ) material.wireframe = json.wireframe;
47652
- if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;
47653
- if ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;
47654
- if ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;
47655
-
47656
- if ( json.rotation !== undefined ) material.rotation = json.rotation;
47657
-
47658
- if ( json.linewidth !== undefined ) material.linewidth = json.linewidth;
47659
- if ( json.dashSize !== undefined ) material.dashSize = json.dashSize;
47660
- if ( json.gapSize !== undefined ) material.gapSize = json.gapSize;
47661
- if ( json.scale !== undefined ) material.scale = json.scale;
47662
-
47663
- if ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;
47664
- if ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;
47665
- if ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;
47666
-
47667
- if ( json.dithering !== undefined ) material.dithering = json.dithering;
47668
-
47669
- if ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;
47670
- if ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;
47671
- if ( json.forceSinglePass !== undefined ) material.forceSinglePass = json.forceSinglePass;
47672
- if ( json.allowOverride !== undefined ) material.allowOverride = json.allowOverride;
47673
-
47674
- if ( json.visible !== undefined ) material.visible = json.visible;
47675
-
47676
- if ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;
47677
-
47678
- if ( json.userData !== undefined ) material.userData = json.userData;
47679
-
47680
- if ( json.vertexColors !== undefined ) {
47681
-
47682
- if ( typeof json.vertexColors === 'number' ) {
47683
-
47684
- material.vertexColors = json.vertexColors > 0;
47685
-
47686
- } else {
47687
-
47688
- material.vertexColors = json.vertexColors;
47689
-
47690
- }
47691
-
47692
- }
47693
-
47694
- // Shader Material
47695
-
47696
- if ( json.uniforms !== undefined ) {
47697
-
47698
- for ( const name in json.uniforms ) {
47699
-
47700
- const uniform = json.uniforms[ name ];
47701
-
47702
- material.uniforms[ name ] = {};
47703
-
47704
- switch ( uniform.type ) {
47705
-
47706
- case 't':
47707
- material.uniforms[ name ].value = getTexture( uniform.value );
47708
- break;
47709
-
47710
- case 'c':
47711
- material.uniforms[ name ].value = new Color().setHex( uniform.value );
47712
- break;
47713
-
47714
- case 'v2':
47715
- material.uniforms[ name ].value = new Vector2().fromArray( uniform.value );
47716
- break;
47717
-
47718
- case 'v3':
47719
- material.uniforms[ name ].value = new Vector3().fromArray( uniform.value );
47720
- break;
47721
-
47722
- case 'v4':
47723
- material.uniforms[ name ].value = new Vector4().fromArray( uniform.value );
47724
- break;
47725
-
47726
- case 'm3':
47727
- material.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );
47728
- break;
47729
-
47730
- case 'm4':
47731
- material.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );
47732
- break;
47733
-
47734
- default:
47735
- material.uniforms[ name ].value = uniform.value;
47736
-
47737
- }
47738
-
47739
- }
47740
-
47741
- }
47742
-
47743
- if ( json.defines !== undefined ) material.defines = json.defines;
47744
- if ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;
47745
- if ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;
47746
- if ( json.glslVersion !== undefined ) material.glslVersion = json.glslVersion;
47747
-
47748
- if ( json.extensions !== undefined ) {
47749
-
47750
- for ( const key in json.extensions ) {
47751
-
47752
- material.extensions[ key ] = json.extensions[ key ];
47753
-
47754
- }
47755
-
47756
- }
47757
-
47758
- if ( json.lights !== undefined ) material.lights = json.lights;
47759
- if ( json.clipping !== undefined ) material.clipping = json.clipping;
47760
-
47761
- // for PointsMaterial
47762
-
47763
- if ( json.size !== undefined ) material.size = json.size;
47764
- if ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;
47765
-
47766
- // maps
47767
-
47768
- if ( json.map !== undefined ) material.map = getTexture( json.map );
47769
- if ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );
47770
-
47771
- if ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap );
47772
-
47773
- if ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );
47774
- if ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;
47775
-
47776
- if ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );
47777
- if ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;
47778
- if ( json.normalScale !== undefined ) {
47779
-
47780
- let normalScale = json.normalScale;
47781
-
47782
- if ( Array.isArray( normalScale ) === false ) {
47783
-
47784
- // Blender exporter used to export a scalar. See #7459
47785
-
47786
- normalScale = [ normalScale, normalScale ];
47787
-
47788
- }
47789
-
47790
- material.normalScale = new Vector2().fromArray( normalScale );
47791
-
47792
- }
47793
-
47794
- if ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );
47795
- if ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;
47796
- if ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;
47797
-
47798
- if ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );
47799
- if ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );
47800
-
47801
- if ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );
47802
- if ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;
47803
-
47804
- if ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );
47805
- if ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );
47806
- if ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );
47807
-
47808
- if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );
47809
- if ( json.envMapRotation !== undefined ) material.envMapRotation.fromArray( json.envMapRotation );
47810
- if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;
47811
-
47812
- if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;
47813
- if ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;
47814
-
47815
- if ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );
47816
- if ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;
47817
-
47818
- if ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );
47819
- if ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;
47820
-
47821
- if ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );
47822
-
47823
- if ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap );
47824
- if ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap );
47825
- if ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );
47826
- if ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );
47827
-
47828
- if ( json.iridescenceMap !== undefined ) material.iridescenceMap = getTexture( json.iridescenceMap );
47829
- if ( json.iridescenceThicknessMap !== undefined ) material.iridescenceThicknessMap = getTexture( json.iridescenceThicknessMap );
47830
-
47831
- if ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );
47832
- if ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );
47833
-
47834
- if ( json.anisotropyMap !== undefined ) material.anisotropyMap = getTexture( json.anisotropyMap );
47835
-
47836
- if ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );
47837
- if ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );
48081
+ material.fromJSON( json, this.textures );
47838
48082
 
47839
48083
  return material;
47840
48084
 
@@ -47893,10 +48137,40 @@ class MaterialLoader extends Loader {
47893
48137
  MeshMatcapMaterial,
47894
48138
  LineDashedMaterial,
47895
48139
  LineBasicMaterial,
47896
- Material
48140
+ Material,
48141
+ ... _customMaterials
47897
48142
  };
47898
48143
 
47899
- return new materialLib[ type ]();
48144
+ const MaterialType = materialLib[ type ];
48145
+
48146
+ let materialInstance;
48147
+
48148
+ if ( MaterialType === undefined ) {
48149
+
48150
+ warnOnce( `MaterialLoader: Unknown material type "${ type }". Use .registerMaterial() before starting the deserialization process.` );
48151
+ materialInstance = new Material();
48152
+
48153
+ } else {
48154
+
48155
+ materialInstance = new MaterialType();
48156
+
48157
+ }
48158
+
48159
+ return materialInstance;
48160
+
48161
+ }
48162
+
48163
+ /**
48164
+ * Registers the given material at the internal
48165
+ * material library.
48166
+ *
48167
+ * @static
48168
+ * @param {string} type - The material type.
48169
+ * @param {Material.constructor} materialClass - The material class.
48170
+ */
48171
+ static registerMaterial( type, materialClass ) {
48172
+
48173
+ _customMaterials[ type ] = materialClass;
47900
48174
 
47901
48175
  }
47902
48176
 
@@ -48362,7 +48636,7 @@ class ObjectLoader extends Loader {
48362
48636
 
48363
48637
  } catch ( e ) {
48364
48638
 
48365
- throw new Error( 'ObjectLoader: Can\'t parse ' + url + '. ' + e.message );
48639
+ throw new Error( 'THREE.ObjectLoader: Can\'t parse ' + url + '. ' + e.message );
48366
48640
 
48367
48641
  }
48368
48642
 
@@ -48656,6 +48930,8 @@ class ObjectLoader extends Loader {
48656
48930
 
48657
48931
  function loadImage( url ) {
48658
48932
 
48933
+ url = scope.manager.resolveURL( url );
48934
+
48659
48935
  scope.manager.itemStart( url );
48660
48936
 
48661
48937
  return loader.load( url, function () {
@@ -49990,8 +50266,11 @@ class StereoCamera {
49990
50266
 
49991
50267
  }
49992
50268
 
49993
- this.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeLeft );
49994
- this.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeRight );
50269
+ this.cameraL.matrix.copy( camera.matrixWorld ).multiply( _eyeLeft );
50270
+ this.cameraL.matrixWorldNeedsUpdate = true;
50271
+
50272
+ this.cameraR.matrix.copy( camera.matrixWorld ).multiply( _eyeRight );
50273
+ this.cameraR.matrixWorldNeedsUpdate = true;
49995
50274
 
49996
50275
  }
49997
50276
 
@@ -52408,7 +52687,7 @@ class PropertyBinding {
52408
52687
 
52409
52688
  if ( matches === null ) {
52410
52689
 
52411
- throw new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );
52690
+ throw new Error( 'THREE.PropertyBinding: Cannot parse trackName: ' + trackName );
52412
52691
 
52413
52692
  }
52414
52693
 
@@ -52442,7 +52721,7 @@ class PropertyBinding {
52442
52721
 
52443
52722
  if ( results.propertyName === null || results.propertyName.length === 0 ) {
52444
52723
 
52445
- throw new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );
52724
+ throw new Error( 'THREE.PropertyBinding: can not parse propertyName from trackName: ' + trackName );
52446
52725
 
52447
52726
  }
52448
52727
 
@@ -53433,15 +53712,6 @@ class AnimationAction {
53433
53712
 
53434
53713
  const interpolant = tracks[ i ].createInterpolant( null );
53435
53714
  interpolants[ i ] = interpolant;
53436
-
53437
- // preserve interpolant settings (like tangent data from BezierInterpolant)
53438
-
53439
- if ( interpolant.settings ) {
53440
-
53441
- Object.assign( interpolantSettings, interpolant.settings );
53442
-
53443
- }
53444
-
53445
53715
  interpolant.settings = interpolantSettings;
53446
53716
 
53447
53717
  }
@@ -53457,6 +53727,7 @@ class AnimationAction {
53457
53727
  this._byClipCacheIndex = null; // for the memory manager
53458
53728
 
53459
53729
  this._timeScaleInterpolant = null;
53730
+ this._restoreTimeScale = null;
53460
53731
  this._weightInterpolant = null;
53461
53732
 
53462
53733
  /**
@@ -53744,6 +54015,10 @@ class AnimationAction {
53744
54015
  startEndRatio = fadeOutDuration / fadeInDuration,
53745
54016
  endStartRatio = fadeInDuration / fadeOutDuration;
53746
54017
 
54018
+
54019
+ fadeOutAction._restoreTimeScale = fadeOutAction.timeScale;
54020
+ this._restoreTimeScale = this.timeScale;
54021
+
53747
54022
  fadeOutAction.warp( 1.0, startEndRatio, duration );
53748
54023
  this.warp( endStartRatio, 1.0, duration );
53749
54024
 
@@ -53912,6 +54187,8 @@ class AnimationAction {
53912
54187
 
53913
54188
  }
53914
54189
 
54190
+ this._restoreTimeScale = null;
54191
+
53915
54192
  return this;
53916
54193
 
53917
54194
  }
@@ -54084,8 +54361,6 @@ class AnimationAction {
54084
54361
 
54085
54362
  if ( time > interpolant.parameterPositions[ 1 ] ) {
54086
54363
 
54087
- this.stopWarping();
54088
-
54089
54364
  if ( timeScale === 0 ) {
54090
54365
 
54091
54366
  // motion has halted, pause
@@ -54093,11 +54368,19 @@ class AnimationAction {
54093
54368
 
54094
54369
  } else {
54095
54370
 
54371
+ if ( this._restoreTimeScale !== null ) {
54372
+
54373
+ timeScale = this._restoreTimeScale;
54374
+
54375
+ }
54376
+
54096
54377
  // warp done - apply final time scale
54097
54378
  this.timeScale = timeScale;
54098
54379
 
54099
54380
  }
54100
54381
 
54382
+ this.stopWarping();
54383
+
54101
54384
  }
54102
54385
 
54103
54386
  }
@@ -55810,7 +56093,7 @@ class Raycaster {
55810
56093
 
55811
56094
  } else if ( camera.isOrthographicCamera ) {
55812
56095
 
55813
- this.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera
56096
+ this.ray.origin.set( coords.x, coords.y, camera.projectionMatrix.elements[ 14 ] ).unproject( camera ); // set origin in plane of camera
55814
56097
  this.ray.direction.set( 0, 0, -1 ).transformDirection( camera.matrixWorld );
55815
56098
  this.camera = camera;
55816
56099
 
@@ -57298,7 +57581,7 @@ class SpotLightHelper extends Object3D {
57298
57581
 
57299
57582
  }
57300
57583
 
57301
- this.matrixWorld.copy( this.light.matrixWorld );
57584
+ this.matrixWorldNeedsUpdate = true;
57302
57585
 
57303
57586
  const coneLength = this.light.distance ? this.light.distance : 1000;
57304
57587
  const coneWidth = coneLength * Math.tan( this.light.angle );
@@ -57581,6 +57864,8 @@ class PointLightHelper extends Mesh {
57581
57864
  */
57582
57865
  update() {
57583
57866
 
57867
+ this.matrixWorldNeedsUpdate = true;
57868
+
57584
57869
  this.light.updateWorldMatrix( true, false );
57585
57870
 
57586
57871
  if ( this.color !== undefined ) {
@@ -57724,6 +58009,8 @@ class HemisphereLightHelper extends Object3D {
57724
58009
 
57725
58010
  }
57726
58011
 
58012
+ this.matrixWorldNeedsUpdate = true;
58013
+
57727
58014
  this.light.updateWorldMatrix( true, false );
57728
58015
 
57729
58016
  mesh.lookAt( _vector$1.setFromMatrixPosition( this.light.matrixWorld ).negate() );
@@ -58035,6 +58322,8 @@ class DirectionalLightHelper extends Object3D {
58035
58322
  */
58036
58323
  update() {
58037
58324
 
58325
+ this.matrixWorldNeedsUpdate = true;
58326
+
58038
58327
  this.light.updateWorldMatrix( true, false );
58039
58328
  this.light.target.updateWorldMatrix( true, false );
58040
58329
 
@@ -58988,6 +59277,14 @@ class ShapePath {
58988
59277
  */
58989
59278
  this.currentPath = null;
58990
59279
 
59280
+ /**
59281
+ * An object that can be used to store custom data about the shape path.
59282
+ * Mainly used by SVGLoader to store style information.
59283
+ *
59284
+ * @type {Object}
59285
+ */
59286
+ this.userData = {};
59287
+
58991
59288
  }
58992
59289
 
58993
59290
  /**
@@ -59079,235 +59376,213 @@ class ShapePath {
59079
59376
  /**
59080
59377
  * Converts the paths into an array of shapes.
59081
59378
  *
59082
- * @param {boolean} isCCW - By default solid shapes are defined clockwise (CW) and holes are defined counterclockwise (CCW).
59083
- * If this flag is set to `true`, then those are flipped.
59084
59379
  * @return {Array<Shape>} An array of shapes.
59085
59380
  */
59086
- toShapes( isCCW ) {
59087
-
59088
- function toShapesNoHoles( inSubpaths ) {
59089
-
59090
- const shapes = [];
59381
+ toShapes() {
59091
59382
 
59092
- for ( let i = 0, l = inSubpaths.length; i < l; i ++ ) {
59383
+ // Point-in-polygon test using the even-odd ray-casting rule. Valid for
59384
+ // simple (non self-intersecting) polygons.
59385
+ function pointInPolygon( p, polygon ) {
59093
59386
 
59094
- const tmpPath = inSubpaths[ i ];
59095
-
59096
- const tmpShape = new Shape();
59097
- tmpShape.curves = tmpPath.curves;
59098
-
59099
- shapes.push( tmpShape );
59100
-
59101
- }
59102
-
59103
- return shapes;
59104
-
59105
- }
59106
-
59107
- function isPointInsidePolygon( inPt, inPolygon ) {
59108
-
59109
- const polyLen = inPolygon.length;
59110
-
59111
- // inPt on polygon contour => immediate success or
59112
- // toggling of inside/outside at every single! intersection point of an edge
59113
- // with the horizontal line through inPt, left of inPt
59114
- // not counting lowerY endpoints of edges and whole edges on that line
59115
59387
  let inside = false;
59116
- for ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {
59388
+ const n = polygon.length;
59117
59389
 
59118
- let edgeLowPt = inPolygon[ p ];
59119
- let edgeHighPt = inPolygon[ q ];
59390
+ for ( let i = 0, j = n - 1; i < n; j = i ++ ) {
59120
59391
 
59121
- let edgeDx = edgeHighPt.x - edgeLowPt.x;
59122
- let edgeDy = edgeHighPt.y - edgeLowPt.y;
59392
+ const a = polygon[ i ];
59393
+ const b = polygon[ j ];
59123
59394
 
59124
- if ( Math.abs( edgeDy ) > Number.EPSILON ) {
59395
+ if ( ( a.y > p.y ) !== ( b.y > p.y ) &&
59396
+ p.x < ( b.x - a.x ) * ( p.y - a.y ) / ( b.y - a.y ) + a.x ) {
59125
59397
 
59126
- // not parallel
59127
- if ( edgeDy < 0 ) {
59128
-
59129
- edgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;
59130
- edgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;
59131
-
59132
- }
59133
-
59134
- if ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) continue;
59135
-
59136
- if ( inPt.y === edgeLowPt.y ) {
59137
-
59138
- if ( inPt.x === edgeLowPt.x ) return true; // inPt is on contour ?
59139
- // continue; // no intersection or edgeLowPt => doesn't count !!!
59140
-
59141
- } else {
59142
-
59143
- const perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );
59144
- if ( perpEdge === 0 ) return true; // inPt is on contour ?
59145
- if ( perpEdge < 0 ) continue;
59146
- inside = ! inside; // true intersection left of inPt
59147
-
59148
- }
59149
-
59150
- } else {
59151
-
59152
- // parallel or collinear
59153
- if ( inPt.y !== edgeLowPt.y ) continue; // parallel
59154
- // edge lies on the same horizontal line as inPt
59155
- if ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||
59156
- ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) ) return true; // inPt: Point on contour !
59157
- // continue;
59398
+ inside = ! inside;
59158
59399
 
59159
59400
  }
59160
59401
 
59161
59402
  }
59162
59403
 
59163
- return inside;
59404
+ return inside;
59164
59405
 
59165
59406
  }
59166
59407
 
59167
- const isClockWise = ShapeUtils.isClockWise;
59168
-
59169
- const subPaths = this.subPaths;
59170
- if ( subPaths.length === 0 ) return [];
59171
-
59172
- let solid, tmpPath, tmpShape;
59173
- const shapes = [];
59174
-
59175
- if ( subPaths.length === 1 ) {
59408
+ // Returns a point guaranteed to be strictly inside the given simple
59409
+ // polygon. First tries the bounding-box center; if that falls outside
59410
+ // the polygon, casts a horizontal ray at the center's y and picks the
59411
+ // midpoint between the first two sorted intercepts.
59412
+ //
59413
+ // Port of paper.js' Path#getInteriorPoint()
59414
+ // https://github.com/paperjs/paper.js/blob/develop/src/path/PathItem.Boolean.js
59415
+ function getInteriorPoint( polygon, boundingBox ) {
59176
59416
 
59177
- tmpPath = subPaths[ 0 ];
59178
- tmpShape = new Shape();
59179
- tmpShape.curves = tmpPath.curves;
59180
- shapes.push( tmpShape );
59181
- return shapes;
59417
+ const point = boundingBox.getCenter( new Vector2() );
59182
59418
 
59183
- }
59419
+ if ( pointInPolygon( point, polygon ) ) return point;
59184
59420
 
59185
- let holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );
59186
- holesFirst = isCCW ? ! holesFirst : holesFirst;
59421
+ const y = point.y;
59422
+ const intercepts = [];
59423
+ const n = polygon.length;
59187
59424
 
59188
- // log("Holes first", holesFirst);
59425
+ for ( let i = 0; i < n; i ++ ) {
59189
59426
 
59190
- const betterShapeHoles = [];
59191
- const newShapes = [];
59192
- let newShapeHoles = [];
59193
- let mainIdx = 0;
59194
- let tmpPoints;
59427
+ const a = polygon[ i ];
59428
+ const b = polygon[ ( i + 1 ) % n ];
59195
59429
 
59196
- newShapes[ mainIdx ] = undefined;
59197
- newShapeHoles[ mainIdx ] = [];
59430
+ // Half-open crossing rule — counts each vertex exactly once and
59431
+ // skips horizontal edges.
59432
+ if ( ( a.y > y ) !== ( b.y > y ) ) {
59198
59433
 
59199
- for ( let i = 0, l = subPaths.length; i < l; i ++ ) {
59434
+ const x = a.x + ( y - a.y ) * ( b.x - a.x ) / ( b.y - a.y );
59435
+ intercepts.push( x );
59200
59436
 
59201
- tmpPath = subPaths[ i ];
59202
- tmpPoints = tmpPath.getPoints();
59203
- solid = isClockWise( tmpPoints );
59204
- solid = isCCW ? ! solid : solid;
59437
+ }
59205
59438
 
59206
- if ( solid ) {
59439
+ }
59207
59440
 
59208
- if ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) ) mainIdx ++;
59441
+ if ( intercepts.length > 1 ) {
59209
59442
 
59210
- newShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };
59211
- newShapes[ mainIdx ].s.curves = tmpPath.curves;
59443
+ intercepts.sort( ( a, b ) => a - b );
59444
+ point.x = ( intercepts[ 0 ] + intercepts[ 1 ] ) / 2;
59212
59445
 
59213
- if ( holesFirst ) mainIdx ++;
59214
- newShapeHoles[ mainIdx ] = [];
59446
+ }
59215
59447
 
59216
- //log('cw', i);
59448
+ return point;
59217
59449
 
59218
- } else {
59450
+ }
59219
59451
 
59220
- newShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );
59452
+ // Resolve fill-rule. Defaults to 'nonzero'.
59453
+ let fillRule = ( this.userData.style && this.userData.style.fillRule ) || 'nonzero';
59221
59454
 
59222
- //log('ccw', i);
59455
+ if ( fillRule !== 'nonzero' && fillRule !== 'evenodd' ) {
59223
59456
 
59224
- }
59457
+ warn( 'Fill-rule "' + fillRule + '" is not supported, falling back to "nonzero".' );
59458
+ fillRule = 'nonzero';
59225
59459
 
59226
59460
  }
59227
59461
 
59228
- // only Holes? -> probably all Shapes with wrong orientation
59229
- if ( ! newShapes[ 0 ] ) return toShapesNoHoles( subPaths );
59462
+ // Predicate that decides whether a winding number falls inside the fill
59463
+ // region, per the SVG fill-rule spec. Works for negative windings too,
59464
+ // because JavaScript's bitwise AND preserves odd/even under two's
59465
+ // complement.
59466
+ const isInside = fillRule === 'nonzero'
59467
+ ? ( w => w !== 0 )
59468
+ : ( w => ( w & 1 ) !== 0 );
59230
59469
 
59470
+ // Build an entry per usable subpath. Self-winding follows the standard
59471
+ // convention used by ShapeUtils: counter-clockwise (signed area > 0)
59472
+ // contributes +1 to the winding number at an interior point,
59473
+ // clockwise contributes -1.
59474
+ const entries = [];
59231
59475
 
59232
- if ( newShapes.length > 1 ) {
59476
+ for ( const subPath of this.subPaths ) {
59233
59477
 
59234
- let ambiguous = false;
59235
- let toChange = 0;
59478
+ const points = subPath.getPoints();
59479
+ if ( points.length < 3 ) continue;
59236
59480
 
59237
- for ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
59481
+ const area = ShapeUtils.area( points );
59482
+ if ( area === 0 ) continue;
59238
59483
 
59239
- betterShapeHoles[ sIdx ] = [];
59484
+ const boundingBox = new Box2();
59485
+ for ( let i = 0; i < points.length; i ++ ) boundingBox.expandByPoint( points[ i ] );
59240
59486
 
59241
- }
59242
-
59243
- for ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
59487
+ entries.push( {
59488
+ subPath: subPath,
59489
+ points: points,
59490
+ boundingBox: boundingBox,
59491
+ interiorPoint: getInteriorPoint( points, boundingBox ),
59492
+ absArea: Math.abs( area ),
59493
+ winding: area < 0 ? -1 : 1,
59494
+ container: null,
59495
+ exclude: false,
59496
+ role: null
59497
+ } );
59244
59498
 
59245
- const sho = newShapeHoles[ sIdx ];
59499
+ }
59246
59500
 
59247
- for ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {
59501
+ // Sort by area descending. This guarantees that any subpath that could
59502
+ // contain `entries[i]` is located at a smaller index and has already
59503
+ // been processed when it's entries[i]'s turn. Port of paper.js'
59504
+ // reorientPaths() algorithm.
59505
+ entries.sort( ( a, b ) => b.absArea - a.absArea );
59248
59506
 
59249
- const ho = sho[ hIdx ];
59250
- let hole_unassigned = true;
59507
+ // Walk already-processed entries from closest-in-size to largest,
59508
+ // stopping at the innermost container. Accumulate the container's
59509
+ // cumulative winding into this entry's winding so that the final value
59510
+ // equals the winding number at this entry's interior point.
59511
+ //
59512
+ // A subpath only contributes to the fill boundary when crossing it
59513
+ // actually flips the "insideness" per the fill rule; otherwise it's a
59514
+ // redundant overlap and gets excluded to avoid double-counting.
59515
+ for ( let i = 0; i < entries.length; i ++ ) {
59251
59516
 
59252
- for ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {
59517
+ const entry = entries[ i ];
59518
+ let containerWinding = 0;
59253
59519
 
59254
- if ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {
59520
+ for ( let j = i - 1; j >= 0; j -- ) {
59255
59521
 
59256
- if ( sIdx !== s2Idx ) toChange ++;
59522
+ const candidate = entries[ j ];
59257
59523
 
59258
- if ( hole_unassigned ) {
59524
+ if ( ! candidate.boundingBox.containsBox( entry.boundingBox ) ) continue;
59525
+ if ( ! pointInPolygon( entry.interiorPoint, candidate.points ) ) continue;
59259
59526
 
59260
- hole_unassigned = false;
59261
- betterShapeHoles[ s2Idx ].push( ho );
59527
+ entry.container = candidate.exclude ? candidate.container : candidate;
59528
+ containerWinding = candidate.winding;
59529
+ entry.winding += containerWinding;
59530
+ break;
59262
59531
 
59263
- } else {
59532
+ }
59264
59533
 
59265
- ambiguous = true;
59534
+ if ( isInside( entry.winding ) === isInside( containerWinding ) ) {
59266
59535
 
59267
- }
59536
+ entry.exclude = true;
59268
59537
 
59269
- }
59270
-
59271
- }
59538
+ }
59272
59539
 
59273
- if ( hole_unassigned ) {
59540
+ }
59274
59541
 
59275
- betterShapeHoles[ sIdx ].push( ho );
59542
+ // Classify retained entries. An entry is an outer shape if it has no
59543
+ // container or if its container is itself a hole (a solid nested inside
59544
+ // a hole becomes a new top-level shape); otherwise it's a hole in its
59545
+ // container. Entries were already sorted outermost-first, so each
59546
+ // container's role is known by the time we look at it.
59547
+ for ( const entry of entries ) {
59276
59548
 
59277
- }
59549
+ if ( entry.exclude ) continue;
59550
+ entry.role = ( entry.container === null || entry.container.role === 'hole' ) ? 'outer' : 'hole';
59278
59551
 
59279
- }
59552
+ }
59280
59553
 
59281
- }
59554
+ // Build Shapes for outers first, then attach holes to their container's
59555
+ // Shape.
59556
+ const shapes = [];
59557
+ const shapeByEntry = new Map();
59282
59558
 
59283
- if ( toChange > 0 && ambiguous === false ) {
59559
+ for ( const entry of entries ) {
59284
59560
 
59285
- newShapeHoles = betterShapeHoles;
59561
+ if ( entry.exclude || entry.role !== 'outer' ) continue;
59286
59562
 
59287
- }
59563
+ const shape = new Shape();
59564
+ shape.curves = entry.subPath.curves;
59565
+ shapes.push( shape );
59566
+ shapeByEntry.set( entry, shape );
59288
59567
 
59289
59568
  }
59290
59569
 
59291
- let tmpHoles;
59292
-
59293
- for ( let i = 0, il = newShapes.length; i < il; i ++ ) {
59570
+ for ( const entry of entries ) {
59294
59571
 
59295
- tmpShape = newShapes[ i ].s;
59296
- shapes.push( tmpShape );
59297
- tmpHoles = newShapeHoles[ i ];
59572
+ if ( entry.exclude || entry.role !== 'hole' ) continue;
59298
59573
 
59299
- for ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) {
59574
+ const shape = shapeByEntry.get( entry.container );
59575
+ if ( ! shape ) continue;
59300
59576
 
59301
- tmpShape.holes.push( tmpHoles[ j ].h );
59302
-
59303
- }
59577
+ const hole = new Path();
59578
+ hole.curves = entry.subPath.curves;
59579
+ shape.holes.push( hole );
59304
59580
 
59305
59581
  }
59306
59582
 
59307
- //log("shape", shapes);
59308
-
59309
59583
  return shapes;
59310
59584
 
59585
+
59311
59586
  }
59312
59587
 
59313
59588
  }
@@ -59652,7 +59927,7 @@ function getTextureTypeByteLength( type ) {
59652
59927
 
59653
59928
  }
59654
59929
 
59655
- throw new Error( `Unknown texture type ${type}.` );
59930
+ throw new Error( `THREE.TextureUtils: Unknown texture type ${type}.` );
59656
59931
 
59657
59932
  }
59658
59933