@gnsx/three 0.184.20 → 0.185.3

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 +1261 -926
  2. package/build/three.core.js +1104 -829
  3. package/build/three.core.min.js +1 -1
  4. package/build/three.module.js +157 -97
  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 +7542 -3371
  9. package/build/three.webgpu.min.js +1 -1
  10. package/build/three.webgpu.nodes.js +7542 -3370
  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 +67 -58
  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 +124 -91
  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 -74
  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 +92 -37
  232. package/src/nodes/lighting/PointShadowNode.js +7 -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 +21 -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 +42 -4
  259. package/src/renderers/common/RenderObject.js +73 -13
  260. package/src/renderers/common/Renderer.js +282 -109
  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 +11 -4
  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
 
@@ -12907,8 +12954,10 @@ class Object3D extends EventDispatcher {
12907
12954
  *
12908
12955
  * @param {boolean} [updateParents=false] Whether ancestor nodes should be updated or not.
12909
12956
  * @param {boolean} [updateChildren=false] Whether descendant nodes should be updated or not.
12957
+ * @param {boolean} [force=false] - When set to `true`, a recomputation of world matrices is forced even
12958
+ * when {@link Object3D#matrixWorldNeedsUpdate} is `false`.
12910
12959
  */
12911
- updateWorldMatrix( updateParents, updateChildren ) {
12960
+ updateWorldMatrix( updateParents, updateChildren, force = false ) {
12912
12961
 
12913
12962
  const parent = this.parent;
12914
12963
 
@@ -12920,18 +12969,26 @@ class Object3D extends EventDispatcher {
12920
12969
 
12921
12970
  if ( this.matrixAutoUpdate ) this.updateMatrix();
12922
12971
 
12923
- if ( this.matrixWorldAutoUpdate === true ) {
12972
+ if ( this.matrixWorldNeedsUpdate || force ) {
12924
12973
 
12925
- if ( this.parent === null ) {
12974
+ if ( this.matrixWorldAutoUpdate === true ) {
12926
12975
 
12927
- this.matrixWorld.copy( this.matrix );
12976
+ if ( this.parent === null ) {
12928
12977
 
12929
- } else {
12978
+ this.matrixWorld.copy( this.matrix );
12930
12979
 
12931
- this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
12980
+ } else {
12981
+
12982
+ this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
12983
+
12984
+ }
12932
12985
 
12933
12986
  }
12934
12987
 
12988
+ this.matrixWorldNeedsUpdate = false;
12989
+
12990
+ force = true;
12991
+
12935
12992
  }
12936
12993
 
12937
12994
  // make sure descendants are updated
@@ -12944,7 +13001,7 @@ class Object3D extends EventDispatcher {
12944
13001
 
12945
13002
  const child = children[ i ];
12946
13003
 
12947
- child.updateWorldMatrix( false, true );
13004
+ child.updateWorldMatrix( false, true, force );
12948
13005
 
12949
13006
  }
12950
13007
 
@@ -15819,6 +15876,11 @@ class Box3 {
15819
15876
  * (including its children), accounting for the object's, and children's,
15820
15877
  * world transforms. The function may result in a larger box than strictly necessary.
15821
15878
  *
15879
+ * Note: To compute the correct bounding box, make sure the given 3D object
15880
+ * has an up-to-date world matrix that reflects the current transformation of its
15881
+ * ancestor nodes. Call `object.updateWorldMatrix( true, false )` beforehand if
15882
+ * you're unsure.
15883
+ *
15822
15884
  * @param {Object3D} object - The 3D object to compute the bounding box for.
15823
15885
  * @param {boolean} [precise=false] - If set to `true`, the method computes the smallest
15824
15886
  * world-axis-aligned bounding box at the expense of more computation.
@@ -18324,6 +18386,19 @@ class BufferGeometry extends EventDispatcher {
18324
18386
  */
18325
18387
  this.userData = {};
18326
18388
 
18389
+ /**
18390
+ * `true` when the geometry has been transformed since construction
18391
+ * (e.g. via {@link BufferGeometry#applyMatrix4}). Only relevant for
18392
+ * geometry generators (subclasses that populate `parameters`): when set,
18393
+ * {@link BufferGeometry#toJSON} omits `parameters` since they no longer
18394
+ * describe the geometry.
18395
+ *
18396
+ * @private
18397
+ * @type {boolean}
18398
+ * @default false
18399
+ */
18400
+ this._transformed = false;
18401
+
18327
18402
  }
18328
18403
 
18329
18404
  /**
@@ -18535,6 +18610,8 @@ class BufferGeometry extends EventDispatcher {
18535
18610
 
18536
18611
  }
18537
18612
 
18613
+ this._transformed = true;
18614
+
18538
18615
  return this;
18539
18616
 
18540
18617
  }
@@ -18970,13 +19047,14 @@ class BufferGeometry extends EventDispatcher {
18970
19047
  const normalAttribute = attributes.normal;
18971
19048
  const uvAttribute = attributes.uv;
18972
19049
 
18973
- if ( this.hasAttribute( 'tangent' ) === false ) {
19050
+ let tangentAttribute = this.getAttribute( 'tangent' );
18974
19051
 
18975
- this.setAttribute( 'tangent', new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 ) );
19052
+ if ( tangentAttribute === undefined || tangentAttribute.count !== positionAttribute.count ) {
18976
19053
 
18977
- }
19054
+ tangentAttribute = new BufferAttribute( new Float32Array( 4 * positionAttribute.count ), 4 );
19055
+ this.setAttribute( 'tangent', tangentAttribute );
18978
19056
 
18979
- const tangentAttribute = this.getAttribute( 'tangent' );
19057
+ }
18980
19058
 
18981
19059
  const tan1 = [], tan2 = [];
18982
19060
 
@@ -19105,6 +19183,8 @@ class BufferGeometry extends EventDispatcher {
19105
19183
 
19106
19184
  }
19107
19185
 
19186
+ this._transformed = true;
19187
+
19108
19188
  }
19109
19189
 
19110
19190
  /**
@@ -19122,7 +19202,7 @@ class BufferGeometry extends EventDispatcher {
19122
19202
 
19123
19203
  let normalAttribute = this.getAttribute( 'normal' );
19124
19204
 
19125
- if ( normalAttribute === undefined ) {
19205
+ if ( normalAttribute === undefined || normalAttribute.count !== positionAttribute.count ) {
19126
19206
 
19127
19207
  normalAttribute = new BufferAttribute( new Float32Array( positionAttribute.count * 3 ), 3 );
19128
19208
  this.setAttribute( 'normal', normalAttribute );
@@ -19351,11 +19431,11 @@ class BufferGeometry extends EventDispatcher {
19351
19431
  // standard BufferGeometry serialization
19352
19432
 
19353
19433
  data.uuid = this.uuid;
19354
- data.type = this.type;
19434
+ data.type = ( this.parameters !== undefined && this._transformed === true ) ? 'BufferGeometry' : this.type;
19355
19435
  if ( this.name !== '' ) data.name = this.name;
19356
19436
  if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;
19357
19437
 
19358
- if ( this.parameters !== undefined ) {
19438
+ if ( this.parameters !== undefined && this._transformed !== true ) {
19359
19439
 
19360
19440
  const parameters = this.parameters;
19361
19441
 
@@ -19566,6 +19646,10 @@ class BufferGeometry extends EventDispatcher {
19566
19646
 
19567
19647
  this.userData = source.userData;
19568
19648
 
19649
+ // transformed flag
19650
+
19651
+ this._transformed = source._transformed;
19652
+
19569
19653
  return this;
19570
19654
 
19571
19655
  }
@@ -20989,7 +21073,11 @@ class Material extends EventDispatcher {
20989
21073
 
20990
21074
  currentValue.set( newValue );
20991
21075
 
20992
- } else if ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) ) {
21076
+ } else if (
21077
+ ( ( currentValue && currentValue.isVector2 ) && ( newValue && newValue.isVector2 ) ) ||
21078
+ ( ( currentValue && currentValue.isEuler ) && ( newValue && newValue.isEuler ) ) ||
21079
+ ( ( currentValue && currentValue.isVector3 ) && ( newValue && newValue.isVector3 ) )
21080
+ ) {
20993
21081
 
20994
21082
  currentValue.copy( newValue );
20995
21083
 
@@ -21290,6 +21378,196 @@ class Material extends EventDispatcher {
21290
21378
 
21291
21379
  }
21292
21380
 
21381
+ /**
21382
+ * Deserializes the material from the given JSON.
21383
+ *
21384
+ * @param {Object} json - The JSON holding the serialized material.
21385
+ * @param {Object<string,Texture>} textures - A dictionary holding textures referenced by the material.
21386
+ * @return {Material} A reference to this material.
21387
+ */
21388
+ fromJSON( json, textures ) {
21389
+
21390
+ if ( json.uuid !== undefined ) this.uuid = json.uuid;
21391
+ if ( json.name !== undefined ) this.name = json.name;
21392
+ if ( json.color !== undefined && this.color !== undefined ) this.color.setHex( json.color );
21393
+ if ( json.roughness !== undefined ) this.roughness = json.roughness;
21394
+ if ( json.metalness !== undefined ) this.metalness = json.metalness;
21395
+ if ( json.sheen !== undefined ) this.sheen = json.sheen;
21396
+ if ( json.sheenColor !== undefined ) this.sheenColor = new Color().setHex( json.sheenColor );
21397
+ if ( json.sheenRoughness !== undefined ) this.sheenRoughness = json.sheenRoughness;
21398
+ if ( json.emissive !== undefined && this.emissive !== undefined ) this.emissive.setHex( json.emissive );
21399
+ if ( json.specular !== undefined && this.specular !== undefined ) this.specular.setHex( json.specular );
21400
+ if ( json.specularIntensity !== undefined ) this.specularIntensity = json.specularIntensity;
21401
+ if ( json.specularColor !== undefined && this.specularColor !== undefined ) this.specularColor.setHex( json.specularColor );
21402
+ if ( json.shininess !== undefined ) this.shininess = json.shininess;
21403
+ if ( json.clearcoat !== undefined ) this.clearcoat = json.clearcoat;
21404
+ if ( json.clearcoatRoughness !== undefined ) this.clearcoatRoughness = json.clearcoatRoughness;
21405
+ if ( json.dispersion !== undefined ) this.dispersion = json.dispersion;
21406
+ if ( json.iridescence !== undefined ) this.iridescence = json.iridescence;
21407
+ if ( json.iridescenceIOR !== undefined ) this.iridescenceIOR = json.iridescenceIOR;
21408
+ if ( json.iridescenceThicknessRange !== undefined ) this.iridescenceThicknessRange = json.iridescenceThicknessRange;
21409
+ if ( json.transmission !== undefined ) this.transmission = json.transmission;
21410
+ if ( json.thickness !== undefined ) this.thickness = json.thickness;
21411
+ if ( json.attenuationDistance !== undefined ) this.attenuationDistance = json.attenuationDistance;
21412
+ if ( json.attenuationColor !== undefined && this.attenuationColor !== undefined ) this.attenuationColor.setHex( json.attenuationColor );
21413
+ if ( json.anisotropy !== undefined ) this.anisotropy = json.anisotropy;
21414
+ if ( json.anisotropyRotation !== undefined ) this.anisotropyRotation = json.anisotropyRotation;
21415
+ if ( json.fog !== undefined ) this.fog = json.fog;
21416
+ if ( json.flatShading !== undefined ) this.flatShading = json.flatShading;
21417
+ if ( json.blending !== undefined ) this.blending = json.blending;
21418
+ if ( json.combine !== undefined ) this.combine = json.combine;
21419
+ if ( json.side !== undefined ) this.side = json.side;
21420
+ if ( json.shadowSide !== undefined ) this.shadowSide = json.shadowSide;
21421
+ if ( json.opacity !== undefined ) this.opacity = json.opacity;
21422
+ if ( json.transparent !== undefined ) this.transparent = json.transparent;
21423
+ if ( json.alphaTest !== undefined ) this.alphaTest = json.alphaTest;
21424
+ if ( json.alphaHash !== undefined ) this.alphaHash = json.alphaHash;
21425
+ if ( json.depthFunc !== undefined ) this.depthFunc = json.depthFunc;
21426
+ if ( json.depthTest !== undefined ) this.depthTest = json.depthTest;
21427
+ if ( json.depthWrite !== undefined ) this.depthWrite = json.depthWrite;
21428
+ if ( json.colorWrite !== undefined ) this.colorWrite = json.colorWrite;
21429
+ if ( json.blendSrc !== undefined ) this.blendSrc = json.blendSrc;
21430
+ if ( json.blendDst !== undefined ) this.blendDst = json.blendDst;
21431
+ if ( json.blendEquation !== undefined ) this.blendEquation = json.blendEquation;
21432
+ if ( json.blendSrcAlpha !== undefined ) this.blendSrcAlpha = json.blendSrcAlpha;
21433
+ if ( json.blendDstAlpha !== undefined ) this.blendDstAlpha = json.blendDstAlpha;
21434
+ if ( json.blendEquationAlpha !== undefined ) this.blendEquationAlpha = json.blendEquationAlpha;
21435
+ if ( json.blendColor !== undefined && this.blendColor !== undefined ) this.blendColor.setHex( json.blendColor );
21436
+ if ( json.blendAlpha !== undefined ) this.blendAlpha = json.blendAlpha;
21437
+ if ( json.stencilWriteMask !== undefined ) this.stencilWriteMask = json.stencilWriteMask;
21438
+ if ( json.stencilFunc !== undefined ) this.stencilFunc = json.stencilFunc;
21439
+ if ( json.stencilRef !== undefined ) this.stencilRef = json.stencilRef;
21440
+ if ( json.stencilFuncMask !== undefined ) this.stencilFuncMask = json.stencilFuncMask;
21441
+ if ( json.stencilFail !== undefined ) this.stencilFail = json.stencilFail;
21442
+ if ( json.stencilZFail !== undefined ) this.stencilZFail = json.stencilZFail;
21443
+ if ( json.stencilZPass !== undefined ) this.stencilZPass = json.stencilZPass;
21444
+ if ( json.stencilWrite !== undefined ) this.stencilWrite = json.stencilWrite;
21445
+
21446
+ if ( json.wireframe !== undefined ) this.wireframe = json.wireframe;
21447
+ if ( json.wireframeLinewidth !== undefined ) this.wireframeLinewidth = json.wireframeLinewidth;
21448
+ if ( json.wireframeLinecap !== undefined ) this.wireframeLinecap = json.wireframeLinecap;
21449
+ if ( json.wireframeLinejoin !== undefined ) this.wireframeLinejoin = json.wireframeLinejoin;
21450
+
21451
+ if ( json.rotation !== undefined ) this.rotation = json.rotation;
21452
+
21453
+ if ( json.linewidth !== undefined ) this.linewidth = json.linewidth;
21454
+ if ( json.dashSize !== undefined ) this.dashSize = json.dashSize;
21455
+ if ( json.gapSize !== undefined ) this.gapSize = json.gapSize;
21456
+ if ( json.scale !== undefined ) this.scale = json.scale;
21457
+
21458
+ if ( json.polygonOffset !== undefined ) this.polygonOffset = json.polygonOffset;
21459
+ if ( json.polygonOffsetFactor !== undefined ) this.polygonOffsetFactor = json.polygonOffsetFactor;
21460
+ if ( json.polygonOffsetUnits !== undefined ) this.polygonOffsetUnits = json.polygonOffsetUnits;
21461
+
21462
+ if ( json.dithering !== undefined ) this.dithering = json.dithering;
21463
+
21464
+ if ( json.alphaToCoverage !== undefined ) this.alphaToCoverage = json.alphaToCoverage;
21465
+ if ( json.premultipliedAlpha !== undefined ) this.premultipliedAlpha = json.premultipliedAlpha;
21466
+ if ( json.forceSinglePass !== undefined ) this.forceSinglePass = json.forceSinglePass;
21467
+ if ( json.allowOverride !== undefined ) this.allowOverride = json.allowOverride;
21468
+
21469
+ if ( json.visible !== undefined ) this.visible = json.visible;
21470
+
21471
+ if ( json.toneMapped !== undefined ) this.toneMapped = json.toneMapped;
21472
+
21473
+ if ( json.userData !== undefined ) this.userData = json.userData;
21474
+
21475
+ if ( json.vertexColors !== undefined ) {
21476
+
21477
+ if ( typeof json.vertexColors === 'number' ) {
21478
+
21479
+ this.vertexColors = json.vertexColors > 0;
21480
+
21481
+ } else {
21482
+
21483
+ this.vertexColors = json.vertexColors;
21484
+
21485
+ }
21486
+
21487
+ }
21488
+
21489
+ // for PointsMaterial
21490
+
21491
+ if ( json.size !== undefined ) this.size = json.size;
21492
+ if ( json.sizeAttenuation !== undefined ) this.sizeAttenuation = json.sizeAttenuation;
21493
+
21494
+ // maps
21495
+
21496
+ if ( json.map !== undefined ) this.map = textures[ json.map ] || null;
21497
+ if ( json.matcap !== undefined ) this.matcap = textures[ json.matcap ] || null;
21498
+
21499
+ if ( json.alphaMap !== undefined ) this.alphaMap = textures[ json.alphaMap ] || null;
21500
+
21501
+ if ( json.bumpMap !== undefined ) this.bumpMap = textures[ json.bumpMap ] || null;
21502
+ if ( json.bumpScale !== undefined ) this.bumpScale = json.bumpScale;
21503
+
21504
+ if ( json.normalMap !== undefined ) this.normalMap = textures[ json.normalMap ] || null;
21505
+ if ( json.normalMapType !== undefined ) this.normalMapType = json.normalMapType;
21506
+ if ( json.normalScale !== undefined ) {
21507
+
21508
+ let normalScale = json.normalScale;
21509
+
21510
+ if ( Array.isArray( normalScale ) === false ) {
21511
+
21512
+ // Blender exporter used to export a scalar. See #7459
21513
+
21514
+ normalScale = [ normalScale, normalScale ];
21515
+
21516
+ }
21517
+
21518
+ this.normalScale = new Vector2().fromArray( normalScale );
21519
+
21520
+ }
21521
+
21522
+ if ( json.displacementMap !== undefined ) this.displacementMap = textures[ json.displacementMap ] || null;
21523
+ if ( json.displacementScale !== undefined ) this.displacementScale = json.displacementScale;
21524
+ if ( json.displacementBias !== undefined ) this.displacementBias = json.displacementBias;
21525
+
21526
+ if ( json.roughnessMap !== undefined ) this.roughnessMap = textures[ json.roughnessMap ] || null;
21527
+ if ( json.metalnessMap !== undefined ) this.metalnessMap = textures[ json.metalnessMap ] || null;
21528
+
21529
+ if ( json.emissiveMap !== undefined ) this.emissiveMap = textures[ json.emissiveMap ] || null;
21530
+ if ( json.emissiveIntensity !== undefined ) this.emissiveIntensity = json.emissiveIntensity;
21531
+
21532
+ if ( json.specularMap !== undefined ) this.specularMap = textures[ json.specularMap ] || null;
21533
+ if ( json.specularIntensityMap !== undefined ) this.specularIntensityMap = textures[ json.specularIntensityMap ] || null;
21534
+ if ( json.specularColorMap !== undefined ) this.specularColorMap = textures[ json.specularColorMap ] || null;
21535
+
21536
+ if ( json.envMap !== undefined ) this.envMap = textures[ json.envMap ] || null;
21537
+ if ( json.envMapRotation !== undefined ) this.envMapRotation.fromArray( json.envMapRotation );
21538
+ if ( json.envMapIntensity !== undefined ) this.envMapIntensity = json.envMapIntensity;
21539
+
21540
+ if ( json.reflectivity !== undefined ) this.reflectivity = json.reflectivity;
21541
+ if ( json.refractionRatio !== undefined ) this.refractionRatio = json.refractionRatio;
21542
+
21543
+ if ( json.lightMap !== undefined ) this.lightMap = textures[ json.lightMap ] || null;
21544
+ if ( json.lightMapIntensity !== undefined ) this.lightMapIntensity = json.lightMapIntensity;
21545
+
21546
+ if ( json.aoMap !== undefined ) this.aoMap = textures[ json.aoMap ] || null;
21547
+ if ( json.aoMapIntensity !== undefined ) this.aoMapIntensity = json.aoMapIntensity;
21548
+
21549
+ if ( json.gradientMap !== undefined ) this.gradientMap = textures[ json.gradientMap ] || null;
21550
+
21551
+ if ( json.clearcoatMap !== undefined ) this.clearcoatMap = textures[ json.clearcoatMap ] || null;
21552
+ if ( json.clearcoatRoughnessMap !== undefined ) this.clearcoatRoughnessMap = textures[ json.clearcoatRoughnessMap ] || null;
21553
+ if ( json.clearcoatNormalMap !== undefined ) this.clearcoatNormalMap = textures[ json.clearcoatNormalMap ] || null;
21554
+ if ( json.clearcoatNormalScale !== undefined ) this.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );
21555
+
21556
+ if ( json.iridescenceMap !== undefined ) this.iridescenceMap = textures[ json.iridescenceMap ] || null;
21557
+ if ( json.iridescenceThicknessMap !== undefined ) this.iridescenceThicknessMap = textures[ json.iridescenceThicknessMap ] || null;
21558
+
21559
+ if ( json.transmissionMap !== undefined ) this.transmissionMap = textures[ json.transmissionMap ] || null;
21560
+ if ( json.thicknessMap !== undefined ) this.thicknessMap = textures[ json.thicknessMap ] || null;
21561
+
21562
+ if ( json.anisotropyMap !== undefined ) this.anisotropyMap = textures[ json.anisotropyMap ] || null;
21563
+
21564
+ if ( json.sheenColorMap !== undefined ) this.sheenColorMap = textures[ json.sheenColorMap ] || null;
21565
+ if ( json.sheenRoughnessMap !== undefined ) this.sheenRoughnessMap = textures[ json.sheenRoughnessMap ] || null;
21566
+
21567
+ return this;
21568
+
21569
+ }
21570
+
21293
21571
  /**
21294
21572
  * Returns a new material with copied values from this instance.
21295
21573
  *
@@ -21476,6 +21754,10 @@ class SpriteMaterial extends Material {
21476
21754
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
21477
21755
  * color is modulated by the diffuse `color`.
21478
21756
  *
21757
+ * `map` represents color data, and the texture must be assigned a
21758
+ * {@link Texture#colorSpace}. Most `map` textures set
21759
+ * `texture.colorSpace = SRGBColorSpace`.
21760
+ *
21479
21761
  * @type {?Texture}
21480
21762
  * @default null
21481
21763
  */
@@ -21491,6 +21773,9 @@ class SpriteMaterial extends Material {
21491
21773
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
21492
21774
  * luminance/alpha textures will also still work as expected.
21493
21775
  *
21776
+ * `alphaMap` represents non-color data. Any texture assigned must have
21777
+ * `texture.colorSpace = NoColorSpace` (default).
21778
+ *
21494
21779
  * @type {?Texture}
21495
21780
  * @default null
21496
21781
  */
@@ -22811,6 +23096,10 @@ class MeshBasicMaterial extends Material {
22811
23096
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
22812
23097
  * color is modulated by the diffuse `color`.
22813
23098
  *
23099
+ * `map` represents color data, and the texture must be assigned a
23100
+ * {@link Texture#colorSpace}. Most `map` textures set
23101
+ * `texture.colorSpace = SRGBColorSpace`.
23102
+ *
22814
23103
  * @type {?Texture}
22815
23104
  * @default null
22816
23105
  */
@@ -22819,6 +23108,11 @@ class MeshBasicMaterial extends Material {
22819
23108
  /**
22820
23109
  * The light map. Requires a second set of UVs.
22821
23110
  *
23111
+ * `lightMap` represents pre-baked illuminance data, and the texture must be assigned
23112
+ * a {@link Texture#colorSpace}. Most `lightMap` textures set
23113
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
23114
+ * such as `.exr` or `.hdr`.
23115
+ *
22822
23116
  * @type {?Texture}
22823
23117
  * @default null
22824
23118
  */
@@ -22836,6 +23130,9 @@ class MeshBasicMaterial extends Material {
22836
23130
  * The red channel of this texture is used as the ambient occlusion map.
22837
23131
  * Requires a second set of UVs.
22838
23132
  *
23133
+ * `aoMap` represents non-color data. Any texture assigned must have
23134
+ * `texture.colorSpace = NoColorSpace` (default).
23135
+ *
22839
23136
  * @type {?Texture}
22840
23137
  * @default null
22841
23138
  */
@@ -22854,6 +23151,10 @@ class MeshBasicMaterial extends Material {
22854
23151
  /**
22855
23152
  * Specular map used by the material.
22856
23153
  *
23154
+ * `specularMap` represents color data, and the texture must be assigned a
23155
+ * {@link Texture#colorSpace}. Most `specularMap` textures set
23156
+ * `texture.colorSpace = SRGBColorSpace`.
23157
+ *
22857
23158
  * @type {?Texture}
22858
23159
  * @default null
22859
23160
  */
@@ -22869,6 +23170,9 @@ class MeshBasicMaterial extends Material {
22869
23170
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
22870
23171
  * luminance/alpha textures will also still work as expected.
22871
23172
  *
23173
+ * `alphaMap` represents non-color data. Any texture assigned must have
23174
+ * `texture.colorSpace = NoColorSpace` (default).
23175
+ *
22872
23176
  * @type {?Texture}
22873
23177
  * @default null
22874
23178
  */
@@ -22877,6 +23181,11 @@ class MeshBasicMaterial extends Material {
22877
23181
  /**
22878
23182
  * The environment map.
22879
23183
  *
23184
+ * `envMap` represents luminance data, and the texture must be assigned
23185
+ * a {@link Texture#colorSpace}. Most `envMap` textures set
23186
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
23187
+ * such as `.exr` or `.hdr`.
23188
+ *
22880
23189
  * @type {?Texture}
22881
23190
  * @default null
22882
23191
  */
@@ -24034,15 +24343,6 @@ class Skeleton {
24034
24343
  */
24035
24344
  this.boneMatrices = null;
24036
24345
 
24037
- /**
24038
- * An array buffer holding the bone data of the previous frame.
24039
- * Required for computing velocity. Maintained in {@link SkinningNode}.
24040
- *
24041
- * @type {?Float32Array}
24042
- * @default null
24043
- */
24044
- this.previousBoneMatrices = null;
24045
-
24046
24346
  /**
24047
24347
  * A texture holding the bone data for use
24048
24348
  * in the vertex shader.
@@ -24468,15 +24768,6 @@ class InstancedMesh extends Mesh {
24468
24768
  */
24469
24769
  this.instanceMatrix = new InstancedBufferAttribute( new Float32Array( count * 16 ), 16 );
24470
24770
 
24471
- /**
24472
- * Represents the local transformation of all instances of the previous frame.
24473
- * Required for computing velocity. Maintained in {@link InstanceNode}.
24474
- *
24475
- * @type {?InstancedBufferAttribute}
24476
- * @default null
24477
- */
24478
- this.previousInstanceMatrix = null;
24479
-
24480
24771
  /**
24481
24772
  * Represents the color of all instances. You have to set its
24482
24773
  * {@link BufferAttribute#needsUpdate} flag to true if you modify instanced data
@@ -24606,8 +24897,6 @@ class InstancedMesh extends Mesh {
24606
24897
 
24607
24898
  this.instanceMatrix.copy( source.instanceMatrix );
24608
24899
 
24609
- if ( source.previousInstanceMatrix !== null ) this.previousInstanceMatrix = source.previousInstanceMatrix.clone();
24610
-
24611
24900
  if ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();
24612
24901
  if ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();
24613
24902
 
@@ -25473,7 +25762,6 @@ class Frustum {
25473
25762
  }
25474
25763
 
25475
25764
  const _projScreenMatrix$1 = /*@__PURE__*/ new Matrix4();
25476
- const _frustum$1 = /*@__PURE__*/ new Frustum();
25477
25765
 
25478
25766
  /**
25479
25767
  * FrustumArray is used to determine if an object is visible in at least one camera
@@ -25495,220 +25783,191 @@ class FrustumArray {
25495
25783
  */
25496
25784
  this.coordinateSystem = WebGLCoordinateSystem;
25497
25785
 
25786
+ /**
25787
+ * A pool of frustum instances. It may hold more entries than are
25788
+ * currently in use; surplus instances are kept for reuse to avoid
25789
+ * reallocating when array cameras of different lengths are rendered.
25790
+ *
25791
+ * @private
25792
+ * @type {Array<Frustum>}
25793
+ */
25794
+ this._frustums = [];
25795
+
25796
+ /**
25797
+ * The number of frustums in {@link FrustumArray#_frustums} that are currently
25798
+ * in use.
25799
+ *
25800
+ * @private
25801
+ * @type {number}
25802
+ * @default 0
25803
+ */
25804
+ this._count = 0;
25805
+
25498
25806
  }
25499
25807
 
25500
25808
  /**
25501
- * Returns `true` if the 3D object's bounding sphere is intersecting any frustum
25502
- * from the camera array.
25809
+ * Computes and caches a frustum for each camera of the given array camera.
25503
25810
  *
25504
- * @param {Object3D} object - The 3D object to test.
25505
- * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.
25506
- * @return {boolean} Whether the 3D object is visible in any camera.
25811
+ * @param {ArrayCamera} cameraArray - The array camera whose sub-cameras define the frustums.
25812
+ * @return {FrustumArray} A reference to this frustum array.
25507
25813
  */
25508
- intersectsObject( object, cameraArray ) {
25509
-
25510
- if ( ! cameraArray.isArrayCamera || cameraArray.cameras.length === 0 ) {
25511
-
25512
- return false;
25513
-
25514
- }
25814
+ setFromArrayCamera( cameraArray ) {
25515
25815
 
25516
- for ( let i = 0; i < cameraArray.cameras.length; i ++ ) {
25816
+ const cameras = cameraArray.cameras;
25817
+ const frustums = this._frustums;
25517
25818
 
25518
- const camera = cameraArray.cameras[ i ];
25819
+ for ( let i = 0; i < cameras.length; i ++ ) {
25519
25820
 
25520
- _projScreenMatrix$1.multiplyMatrices(
25521
- camera.projectionMatrix,
25522
- camera.matrixWorldInverse
25523
- );
25821
+ const camera = cameras[ i ];
25524
25822
 
25525
- _frustum$1.setFromProjectionMatrix(
25526
- _projScreenMatrix$1,
25527
- camera.coordinateSystem,
25528
- camera.reversedDepth
25529
- );
25823
+ _projScreenMatrix$1.multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse );
25530
25824
 
25531
- if ( _frustum$1.intersectsObject( object ) ) {
25825
+ if ( frustums[ i ] === undefined ) frustums[ i ] = new Frustum();
25532
25826
 
25533
- return true; // Object is visible in at least one camera
25534
-
25535
- }
25827
+ frustums[ i ].setFromProjectionMatrix( _projScreenMatrix$1, camera.coordinateSystem, camera.reversedDepth );
25536
25828
 
25537
25829
  }
25538
25830
 
25539
- return false; // Not visible in any camera
25831
+ this._count = cameras.length;
25832
+
25833
+ return this;
25540
25834
 
25541
25835
  }
25542
25836
 
25543
25837
  /**
25544
- * Returns `true` if the given sprite is intersecting any frustum
25545
- * from the camera array.
25838
+ * Returns `true` if the 3D object's bounding sphere is intersecting any cached frustum.
25546
25839
  *
25547
- * @param {Sprite} sprite - The sprite to test.
25548
- * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.
25549
- * @return {boolean} Whether the sprite is visible in any camera.
25840
+ * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
25841
+ *
25842
+ * @param {Object3D} object - The 3D object to test.
25843
+ * @return {boolean} Whether the 3D object is visible in any camera.
25550
25844
  */
25551
- intersectsSprite( sprite, cameraArray ) {
25845
+ intersectsObject( object ) {
25552
25846
 
25553
- if ( ! cameraArray || ! cameraArray.cameras || cameraArray.cameras.length === 0 ) {
25847
+ const frustums = this._frustums;
25554
25848
 
25555
- return false;
25849
+ for ( let i = 0; i < this._count; i ++ ) {
25556
25850
 
25557
- }
25851
+ if ( frustums[ i ].intersectsObject( object ) ) return true;
25558
25852
 
25559
- for ( let i = 0; i < cameraArray.cameras.length; i ++ ) {
25853
+ }
25560
25854
 
25561
- const camera = cameraArray.cameras[ i ];
25855
+ return false;
25562
25856
 
25563
- _projScreenMatrix$1.multiplyMatrices(
25564
- camera.projectionMatrix,
25565
- camera.matrixWorldInverse
25566
- );
25857
+ }
25567
25858
 
25568
- _frustum$1.setFromProjectionMatrix(
25569
- _projScreenMatrix$1,
25570
- camera.coordinateSystem,
25571
- camera.reversedDepth
25572
- );
25859
+ /**
25860
+ * Returns `true` if the given sprite is intersecting any cached frustum.
25861
+ *
25862
+ * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
25863
+ *
25864
+ * @param {Sprite} sprite - The sprite to test.
25865
+ * @return {boolean} Whether the sprite is visible in any camera.
25866
+ */
25867
+ intersectsSprite( sprite ) {
25573
25868
 
25574
- if ( _frustum$1.intersectsSprite( sprite ) ) {
25869
+ const frustums = this._frustums;
25575
25870
 
25576
- return true; // Sprite is visible in at least one camera
25871
+ for ( let i = 0; i < this._count; i ++ ) {
25577
25872
 
25578
- }
25873
+ if ( frustums[ i ].intersectsSprite( sprite ) ) return true;
25579
25874
 
25580
25875
  }
25581
25876
 
25582
- return false; // Not visible in any camera
25877
+ return false;
25583
25878
 
25584
25879
  }
25585
25880
 
25586
25881
  /**
25587
- * Returns `true` if the given bounding sphere is intersecting any frustum
25588
- * from the camera array.
25882
+ * Returns `true` if the given bounding sphere is intersecting any cached frustum.
25883
+ *
25884
+ * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
25589
25885
  *
25590
25886
  * @param {Sphere} sphere - The bounding sphere to test.
25591
- * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.
25592
25887
  * @return {boolean} Whether the sphere is visible in any camera.
25593
25888
  */
25594
- intersectsSphere( sphere, cameraArray ) {
25595
-
25596
- if ( ! cameraArray || ! cameraArray.cameras || cameraArray.cameras.length === 0 ) {
25597
-
25598
- return false;
25599
-
25600
- }
25601
-
25602
- for ( let i = 0; i < cameraArray.cameras.length; i ++ ) {
25603
-
25604
- const camera = cameraArray.cameras[ i ];
25605
-
25606
- _projScreenMatrix$1.multiplyMatrices(
25607
- camera.projectionMatrix,
25608
- camera.matrixWorldInverse
25609
- );
25610
-
25611
- _frustum$1.setFromProjectionMatrix(
25612
- _projScreenMatrix$1,
25613
- camera.coordinateSystem,
25614
- camera.reversedDepth
25615
- );
25889
+ intersectsSphere( sphere ) {
25616
25890
 
25617
- if ( _frustum$1.intersectsSphere( sphere ) ) {
25891
+ const frustums = this._frustums;
25618
25892
 
25619
- return true; // Sphere is visible in at least one camera
25893
+ for ( let i = 0; i < this._count; i ++ ) {
25620
25894
 
25621
- }
25895
+ if ( frustums[ i ].intersectsSphere( sphere ) ) return true;
25622
25896
 
25623
25897
  }
25624
25898
 
25625
- return false; // Not visible in any camera
25899
+ return false;
25626
25900
 
25627
25901
  }
25628
25902
 
25629
25903
  /**
25630
- * Returns `true` if the given bounding box is intersecting any frustum
25631
- * from the camera array.
25904
+ * Returns `true` if the given bounding box is intersecting any cached frustum.
25905
+ *
25906
+ * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
25632
25907
  *
25633
25908
  * @param {Box3} box - The bounding box to test.
25634
- * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.
25635
25909
  * @return {boolean} Whether the box is visible in any camera.
25636
25910
  */
25637
- intersectsBox( box, cameraArray ) {
25638
-
25639
- if ( ! cameraArray || ! cameraArray.cameras || cameraArray.cameras.length === 0 ) {
25640
-
25641
- return false;
25642
-
25643
- }
25644
-
25645
- for ( let i = 0; i < cameraArray.cameras.length; i ++ ) {
25646
-
25647
- const camera = cameraArray.cameras[ i ];
25648
-
25649
- _projScreenMatrix$1.multiplyMatrices(
25650
- camera.projectionMatrix,
25651
- camera.matrixWorldInverse
25652
- );
25653
-
25654
- _frustum$1.setFromProjectionMatrix(
25655
- _projScreenMatrix$1,
25656
- camera.coordinateSystem,
25657
- camera.reversedDepth
25658
- );
25911
+ intersectsBox( box ) {
25659
25912
 
25660
- if ( _frustum$1.intersectsBox( box ) ) {
25913
+ const frustums = this._frustums;
25661
25914
 
25662
- return true; // Box is visible in at least one camera
25915
+ for ( let i = 0; i < this._count; i ++ ) {
25663
25916
 
25664
- }
25917
+ if ( frustums[ i ].intersectsBox( box ) ) return true;
25665
25918
 
25666
25919
  }
25667
25920
 
25668
- return false; // Not visible in any camera
25921
+ return false;
25669
25922
 
25670
25923
  }
25671
25924
 
25672
25925
  /**
25673
- * Returns `true` if the given point lies within any frustum
25674
- * from the camera array.
25926
+ * Returns `true` if the given point lies within any cached frustum.
25927
+ *
25928
+ * {@link FrustumArray#setFromArrayCamera} must be called once per render before this method.
25675
25929
  *
25676
25930
  * @param {Vector3} point - The point to test.
25677
- * @param {Object} cameraArray - An object with a cameras property containing an array of cameras.
25678
25931
  * @return {boolean} Whether the point is visible in any camera.
25679
25932
  */
25680
- containsPoint( point, cameraArray ) {
25933
+ containsPoint( point ) {
25681
25934
 
25682
- if ( ! cameraArray || ! cameraArray.cameras || cameraArray.cameras.length === 0 ) {
25935
+ const frustums = this._frustums;
25683
25936
 
25684
- return false;
25937
+ for ( let i = 0; i < this._count; i ++ ) {
25938
+
25939
+ if ( frustums[ i ].containsPoint( point ) ) return true;
25685
25940
 
25686
25941
  }
25687
25942
 
25688
- for ( let i = 0; i < cameraArray.cameras.length; i ++ ) {
25943
+ return false;
25689
25944
 
25690
- const camera = cameraArray.cameras[ i ];
25945
+ }
25691
25946
 
25692
- _projScreenMatrix$1.multiplyMatrices(
25693
- camera.projectionMatrix,
25694
- camera.matrixWorldInverse
25695
- );
25947
+ /**
25948
+ * Copies the values of the given frustum array to this instance.
25949
+ *
25950
+ * @param {FrustumArray} frustumArray - The frustum array to copy.
25951
+ * @return {FrustumArray} A reference to this frustum array.
25952
+ */
25953
+ copy( source ) {
25696
25954
 
25697
- _frustum$1.setFromProjectionMatrix(
25698
- _projScreenMatrix$1,
25699
- camera.coordinateSystem,
25700
- camera.reversedDepth
25701
- );
25955
+ this.coordinateSystem = source.coordinateSystem;
25702
25956
 
25703
- if ( _frustum$1.containsPoint( point ) ) {
25957
+ const frustums = this._frustums;
25958
+ const sourceFrustums = source._frustums;
25704
25959
 
25705
- return true; // Point is visible in at least one camera
25960
+ for ( let i = 0; i < source._count; i ++ ) {
25706
25961
 
25707
- }
25962
+ if ( frustums[ i ] === undefined ) frustums[ i ] = new Frustum();
25963
+
25964
+ frustums[ i ].copy( sourceFrustums[ i ] );
25708
25965
 
25709
25966
  }
25710
25967
 
25711
- return false; // Not visible in any camera
25968
+ this._count = source._count;
25969
+
25970
+ return this;
25712
25971
 
25713
25972
  }
25714
25973
 
@@ -25719,7 +25978,7 @@ class FrustumArray {
25719
25978
  */
25720
25979
  clone() {
25721
25980
 
25722
- return new FrustumArray();
25981
+ return new FrustumArray().copy( this );
25723
25982
 
25724
25983
  }
25725
25984
 
@@ -26990,7 +27249,7 @@ class BatchedMesh extends Mesh {
26990
27249
  // throw an error if it can't be shrunk to the desired size
26991
27250
  if ( maxInstanceCount < instanceInfo.length ) {
26992
27251
 
26993
- throw new Error( `BatchedMesh: Instance ids outside the range ${ maxInstanceCount } are being used. Cannot shrink instance count.` );
27252
+ throw new Error( `THREE.BatchedMesh: Instance ids outside the range ${ maxInstanceCount } are being used. Cannot shrink instance count.` );
26994
27253
 
26995
27254
  }
26996
27255
 
@@ -27042,7 +27301,7 @@ class BatchedMesh extends Mesh {
27042
27301
  const requiredVertexLength = Math.max( ...validRanges.map( range => range.vertexStart + range.reservedVertexCount ) );
27043
27302
  if ( requiredVertexLength > maxVertexCount ) {
27044
27303
 
27045
- throw new Error( `BatchedMesh: Geometry vertex values are being used outside the range ${ maxIndexCount }. Cannot shrink further.` );
27304
+ throw new Error( `THREE.BatchedMesh: Geometry vertex values are being used outside the range ${ maxIndexCount }. Cannot shrink further.` );
27046
27305
 
27047
27306
  }
27048
27307
 
@@ -27052,7 +27311,7 @@ class BatchedMesh extends Mesh {
27052
27311
  const requiredIndexLength = Math.max( ...validRanges.map( range => range.indexStart + range.reservedIndexCount ) );
27053
27312
  if ( requiredIndexLength > maxIndexCount ) {
27054
27313
 
27055
- throw new Error( `BatchedMesh: Geometry index values are being used outside the range ${ maxIndexCount }. Cannot shrink further.` );
27314
+ throw new Error( `THREE.BatchedMesh: Geometry index values are being used outside the range ${ maxIndexCount }. Cannot shrink further.` );
27056
27315
 
27057
27316
  }
27058
27317
 
@@ -27265,17 +27524,25 @@ class BatchedMesh extends Mesh {
27265
27524
 
27266
27525
  const frustum = camera.isArrayCamera ? _frustumArray : _frustum;
27267
27526
  // prepare the frustum in the local frame
27268
- if ( perObjectFrustumCulled && ! camera.isArrayCamera ) {
27527
+ if ( perObjectFrustumCulled ) {
27269
27528
 
27270
- _matrix$1
27271
- .multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )
27272
- .multiply( this.matrixWorld );
27529
+ if ( camera.isArrayCamera ) {
27273
27530
 
27274
- _frustum.setFromProjectionMatrix(
27275
- _matrix$1,
27276
- camera.coordinateSystem,
27277
- camera.reversedDepth
27278
- );
27531
+ frustum.setFromArrayCamera( camera );
27532
+
27533
+ } else {
27534
+
27535
+ _matrix$1
27536
+ .multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse )
27537
+ .multiply( this.matrixWorld );
27538
+
27539
+ frustum.setFromProjectionMatrix(
27540
+ _matrix$1,
27541
+ camera.coordinateSystem,
27542
+ camera.reversedDepth
27543
+ );
27544
+
27545
+ }
27279
27546
 
27280
27547
  }
27281
27548
 
@@ -27301,7 +27568,7 @@ class BatchedMesh extends Mesh {
27301
27568
  let culled = false;
27302
27569
  if ( perObjectFrustumCulled ) {
27303
27570
 
27304
- culled = ! frustum.intersectsSphere( _sphere$2, camera );
27571
+ culled = ! frustum.intersectsSphere( _sphere$2 );
27305
27572
 
27306
27573
  }
27307
27574
 
@@ -27358,7 +27625,7 @@ class BatchedMesh extends Mesh {
27358
27625
  // get the bounds in world space
27359
27626
  this.getMatrixAt( i, _matrix$1 );
27360
27627
  this.getBoundingSphereAt( geometryId, _sphere$2 ).applyMatrix4( _matrix$1 );
27361
- culled = ! frustum.intersectsSphere( _sphere$2, camera );
27628
+ culled = ! frustum.intersectsSphere( _sphere$2 );
27362
27629
 
27363
27630
  }
27364
27631
 
@@ -27441,6 +27708,10 @@ class LineBasicMaterial extends Material {
27441
27708
  * Sets the color of the lines using data from a texture. The texture map
27442
27709
  * color is modulated by the diffuse `color`.
27443
27710
  *
27711
+ * `map` represents color data, and the texture must be assigned a
27712
+ * {@link Texture#colorSpace}. Most `map` textures set
27713
+ * `texture.colorSpace = SRGBColorSpace`.
27714
+ *
27444
27715
  * @type {?Texture}
27445
27716
  * @default null
27446
27717
  */
@@ -27994,6 +28265,10 @@ class PointsMaterial extends Material {
27994
28265
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
27995
28266
  * color is modulated by the diffuse `color`.
27996
28267
  *
28268
+ * `map` represents color data, and the texture must be assigned a
28269
+ * {@link Texture#colorSpace}. Most `map` textures set
28270
+ * `texture.colorSpace = SRGBColorSpace`.
28271
+ *
27997
28272
  * @type {?Texture}
27998
28273
  * @default null
27999
28274
  */
@@ -28009,6 +28284,9 @@ class PointsMaterial extends Material {
28009
28284
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
28010
28285
  * luminance/alpha textures will also still work as expected.
28011
28286
  *
28287
+ * `alphaMap` represents non-color data. Any texture assigned must have
28288
+ * `texture.colorSpace = NoColorSpace` (default).
28289
+ *
28012
28290
  * @type {?Texture}
28013
28291
  * @default null
28014
28292
  */
@@ -28986,7 +29264,7 @@ class DepthTexture extends Texture {
28986
29264
 
28987
29265
  if ( format !== DepthFormat && format !== DepthStencilFormat ) {
28988
29266
 
28989
- throw new Error( 'DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
29267
+ throw new Error( 'THREE.DepthTexture: format must be either THREE.DepthFormat or THREE.DepthStencilFormat' );
28990
29268
 
28991
29269
  }
28992
29270
 
@@ -29136,9 +29414,6 @@ class CubeDepthTexture extends DepthTexture {
29136
29414
  * This may be a texture from a protected media stream, device camera feed,
29137
29415
  * or other data feeds like a depth sensor.
29138
29416
  *
29139
- * Note that this class is only supported in {@link WebGLRenderer}, and in
29140
- * the {@link WebGPURenderer} WebGPU backend.
29141
- *
29142
29417
  * @augments Texture
29143
29418
  */
29144
29419
  class ExternalTexture extends Texture {
@@ -36260,6 +36535,10 @@ class SphereGeometry extends BufferGeometry {
36260
36535
  const verticesRow = [];
36261
36536
 
36262
36537
  const v = iy / heightSegments;
36538
+ const theta = thetaStart + v * thetaLength;
36539
+
36540
+ const y = radius * Math.cos( theta );
36541
+ const ringRadius = Math.sqrt( radius * radius - y * y );
36263
36542
 
36264
36543
  // special case for the poles
36265
36544
 
@@ -36278,12 +36557,13 @@ class SphereGeometry extends BufferGeometry {
36278
36557
  for ( let ix = 0; ix <= widthSegments; ix ++ ) {
36279
36558
 
36280
36559
  const u = ix / widthSegments;
36560
+ const phi = phiStart + u * phiLength;
36281
36561
 
36282
36562
  // vertex
36283
36563
 
36284
- vertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
36285
- vertex.y = radius * Math.cos( thetaStart + v * thetaLength );
36286
- vertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
36564
+ vertex.x = - ringRadius * Math.cos( phi );
36565
+ vertex.y = y;
36566
+ vertex.z = ringRadius * Math.sin( phi );
36287
36567
 
36288
36568
  vertices.push( vertex.x, vertex.y, vertex.z );
36289
36569
 
@@ -37854,6 +38134,86 @@ class ShaderMaterial extends Material {
37854
38134
 
37855
38135
  }
37856
38136
 
38137
+ /**
38138
+ * Deserializes the material from the given JSON.
38139
+ *
38140
+ * @param {Object} json - The JSON holding the serialized material.
38141
+ * @param {Object<string,Texture>} textures - A dictionary holding textures referenced by the material.
38142
+ * @return {ShaderMaterial} A reference to this material.
38143
+ */
38144
+ fromJSON( json, textures ) {
38145
+
38146
+ super.fromJSON( json, textures );
38147
+
38148
+ if ( json.uniforms !== undefined ) {
38149
+
38150
+ for ( const name in json.uniforms ) {
38151
+
38152
+ const uniform = json.uniforms[ name ];
38153
+
38154
+ this.uniforms[ name ] = {};
38155
+
38156
+ switch ( uniform.type ) {
38157
+
38158
+ case 't':
38159
+ this.uniforms[ name ].value = textures[ uniform.value ] || null;
38160
+ break;
38161
+
38162
+ case 'c':
38163
+ this.uniforms[ name ].value = new Color().setHex( uniform.value );
38164
+ break;
38165
+
38166
+ case 'v2':
38167
+ this.uniforms[ name ].value = new Vector2().fromArray( uniform.value );
38168
+ break;
38169
+
38170
+ case 'v3':
38171
+ this.uniforms[ name ].value = new Vector3().fromArray( uniform.value );
38172
+ break;
38173
+
38174
+ case 'v4':
38175
+ this.uniforms[ name ].value = new Vector4().fromArray( uniform.value );
38176
+ break;
38177
+
38178
+ case 'm3':
38179
+ this.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );
38180
+ break;
38181
+
38182
+ case 'm4':
38183
+ this.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );
38184
+ break;
38185
+
38186
+ default:
38187
+ this.uniforms[ name ].value = uniform.value;
38188
+
38189
+ }
38190
+
38191
+ }
38192
+
38193
+ }
38194
+
38195
+ if ( json.defines !== undefined ) this.defines = json.defines;
38196
+ if ( json.vertexShader !== undefined ) this.vertexShader = json.vertexShader;
38197
+ if ( json.fragmentShader !== undefined ) this.fragmentShader = json.fragmentShader;
38198
+ if ( json.glslVersion !== undefined ) this.glslVersion = json.glslVersion;
38199
+
38200
+ if ( json.extensions !== undefined ) {
38201
+
38202
+ for ( const key in json.extensions ) {
38203
+
38204
+ this.extensions[ key ] = json.extensions[ key ];
38205
+
38206
+ }
38207
+
38208
+ }
38209
+
38210
+ if ( json.lights !== undefined ) this.lights = json.lights;
38211
+ if ( json.clipping !== undefined ) this.clipping = json.clipping;
38212
+
38213
+ return this;
38214
+
38215
+ }
38216
+
37857
38217
  }
37858
38218
 
37859
38219
  /**
@@ -37991,6 +38351,10 @@ class MeshStandardMaterial extends Material {
37991
38351
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
37992
38352
  * color is modulated by the diffuse `color`.
37993
38353
  *
38354
+ * `map` represents color data, and the texture must be assigned a
38355
+ * {@link Texture#colorSpace}. Most `map` textures set
38356
+ * `texture.colorSpace = SRGBColorSpace`.
38357
+ *
37994
38358
  * @type {?Texture}
37995
38359
  * @default null
37996
38360
  */
@@ -37999,6 +38363,11 @@ class MeshStandardMaterial extends Material {
37999
38363
  /**
38000
38364
  * The light map. Requires a second set of UVs.
38001
38365
  *
38366
+ * `lightMap` represents pre-baked illuminance data, and the texture must be assigned
38367
+ * a {@link Texture#colorSpace}. Most `lightMap` textures set
38368
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
38369
+ * such as `.exr` or `.hdr`.
38370
+ *
38002
38371
  * @type {?Texture}
38003
38372
  * @default null
38004
38373
  */
@@ -38016,6 +38385,9 @@ class MeshStandardMaterial extends Material {
38016
38385
  * The red channel of this texture is used as the ambient occlusion map.
38017
38386
  * Requires a second set of UVs.
38018
38387
  *
38388
+ * `aoMap` represents non-color data. Any texture assigned must have
38389
+ * `texture.colorSpace = NoColorSpace` (default).
38390
+ *
38019
38391
  * @type {?Texture}
38020
38392
  * @default null
38021
38393
  */
@@ -38053,6 +38425,10 @@ class MeshStandardMaterial extends Material {
38053
38425
  * emissive color and the emissive intensity. If you have an emissive map,
38054
38426
  * be sure to set the emissive color to something other than black.
38055
38427
  *
38428
+ * `emissiveMap` represents color data, and the texture must be assigned a
38429
+ * {@link Texture#colorSpace}. Most `emissiveMap` textures set
38430
+ * `texture.colorSpace = SRGBColorSpace`.
38431
+ *
38056
38432
  * @type {?Texture}
38057
38433
  * @default null
38058
38434
  */
@@ -38064,6 +38440,9 @@ class MeshStandardMaterial extends Material {
38064
38440
  * the geometry of the object, only the lighting. If a normal map is defined
38065
38441
  * this will be ignored.
38066
38442
  *
38443
+ * `bumpMap` represents non-color data. Any texture assigned must have
38444
+ * `texture.colorSpace = NoColorSpace` (default).
38445
+ *
38067
38446
  * @type {?Texture}
38068
38447
  * @default null
38069
38448
  */
@@ -38085,6 +38464,9 @@ class MeshStandardMaterial extends Material {
38085
38464
  * convention, the `y` component of `normalScale` should be negated to compensate
38086
38465
  * for the different handedness.
38087
38466
  *
38467
+ * `normalMap` represents non-color data. Any texture assigned must have
38468
+ * `texture.colorSpace = NoColorSpace` (default).
38469
+ *
38088
38470
  * @type {?Texture}
38089
38471
  * @default null
38090
38472
  */
@@ -38112,7 +38494,12 @@ class MeshStandardMaterial extends Material {
38112
38494
  * displaced vertices can cast shadows, block other objects, and otherwise
38113
38495
  * act as real geometry. The displacement texture is an image where the value
38114
38496
  * of each pixel (white being the highest) is mapped against, and
38115
- * repositions, the vertices of the mesh.
38497
+ * repositions, the vertices of the mesh. For best results, pair a
38498
+ * displacement map with a matching normal map, since the renderer can
38499
+ * not recompute surface normals from the displaced vertices.
38500
+ *
38501
+ * `displacementMap` represents non-color data. Any texture assigned must have
38502
+ * `texture.colorSpace = NoColorSpace` (default).
38116
38503
  *
38117
38504
  * @type {?Texture}
38118
38505
  * @default null
@@ -38143,6 +38530,9 @@ class MeshStandardMaterial extends Material {
38143
38530
  * The green channel of this texture is used to alter the roughness of the
38144
38531
  * material.
38145
38532
  *
38533
+ * `roughnessMap` represents non-color data. Any texture assigned must have
38534
+ * `texture.colorSpace = NoColorSpace` (default).
38535
+ *
38146
38536
  * @type {?Texture}
38147
38537
  * @default null
38148
38538
  */
@@ -38152,6 +38542,9 @@ class MeshStandardMaterial extends Material {
38152
38542
  * The blue channel of this texture is used to alter the metalness of the
38153
38543
  * material.
38154
38544
  *
38545
+ * `metalnessMap` represents non-color data. Any texture assigned must have
38546
+ * `texture.colorSpace = NoColorSpace` (default).
38547
+ *
38155
38548
  * @type {?Texture}
38156
38549
  * @default null
38157
38550
  */
@@ -38167,6 +38560,9 @@ class MeshStandardMaterial extends Material {
38167
38560
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
38168
38561
  * luminance/alpha textures will also still work as expected.
38169
38562
  *
38563
+ * `alphaMap` represents non-color data. Any texture assigned must have
38564
+ * `texture.colorSpace = NoColorSpace` (default).
38565
+ *
38170
38566
  * @type {?Texture}
38171
38567
  * @default null
38172
38568
  */
@@ -38176,6 +38572,11 @@ class MeshStandardMaterial extends Material {
38176
38572
  * The environment map. To ensure a physically correct rendering, environment maps
38177
38573
  * are internally pre-processed with {@link PMREMGenerator}.
38178
38574
  *
38575
+ * `envMap` represents luminance data, and the texture must be assigned
38576
+ * a {@link Texture#colorSpace}. Most `envMap` textures set
38577
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
38578
+ * such as `.exr` or `.hdr`.
38579
+ *
38179
38580
  * @type {?Texture}
38180
38581
  * @default null
38181
38582
  */
@@ -38387,6 +38788,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38387
38788
  * bitangent space, to be rotated by `anisotropyRotation`. The blue channel
38388
38789
  * contains strength as `[0, 1]` to be multiplied by `anisotropy`.
38389
38790
  *
38791
+ * `anisotropyMap` represents non-color data. Any texture assigned must have
38792
+ * `texture.colorSpace = NoColorSpace` (default).
38793
+ *
38390
38794
  * @type {?Texture}
38391
38795
  * @default null
38392
38796
  */
@@ -38396,6 +38800,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38396
38800
  * The red channel of this texture is multiplied against `clearcoat`,
38397
38801
  * for per-pixel control over a coating's intensity.
38398
38802
  *
38803
+ * `clearcoatMap` represents non-color data. Any texture assigned must have
38804
+ * `texture.colorSpace = NoColorSpace` (default).
38805
+ *
38399
38806
  * @type {?Texture}
38400
38807
  * @default null
38401
38808
  */
@@ -38413,6 +38820,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38413
38820
  * The green channel of this texture is multiplied against
38414
38821
  * `clearcoatRoughness`, for per-pixel control over a coating's roughness.
38415
38822
  *
38823
+ * `clearcoatRoughnessMap` represents non-color data. Any texture assigned must have
38824
+ * `texture.colorSpace = NoColorSpace` (default).
38825
+ *
38416
38826
  * @type {?Texture}
38417
38827
  * @default null
38418
38828
  */
@@ -38430,6 +38840,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38430
38840
  /**
38431
38841
  * Can be used to enable independent normals for the clear coat layer.
38432
38842
  *
38843
+ * `clearcoatNormalMap` represents non-color data. Any texture assigned must have
38844
+ * `texture.colorSpace = NoColorSpace` (default).
38845
+ *
38433
38846
  * @type {?Texture}
38434
38847
  * @default null
38435
38848
  */
@@ -38471,6 +38884,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38471
38884
  * The red channel of this texture is multiplied against `iridescence`, for per-pixel
38472
38885
  * control over iridescence.
38473
38886
  *
38887
+ * `iridescenceMap` represents non-color data. Any texture assigned must have
38888
+ * `texture.colorSpace = NoColorSpace` (default).
38889
+ *
38474
38890
  * @type {?Texture}
38475
38891
  * @default null
38476
38892
  */
@@ -38501,6 +38917,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38501
38917
  * - `1.0` in the green channel will result in thickness equal to second element of the array.
38502
38918
  * - Values in-between will linearly interpolate between the elements of the array.
38503
38919
  *
38920
+ * `iridescenceThicknessMap` represents non-color data. Any texture assigned must have
38921
+ * `texture.colorSpace = NoColorSpace` (default).
38922
+ *
38504
38923
  * @type {?Texture}
38505
38924
  * @default null
38506
38925
  */
@@ -38518,6 +38937,10 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38518
38937
  * The RGB channels of this texture are multiplied against `sheenColor`, for per-pixel control
38519
38938
  * over sheen tint.
38520
38939
  *
38940
+ * `sheenColorMap` represents color data, and the texture must be assigned a
38941
+ * {@link Texture#colorSpace}. Most `sheenColorMap` textures set
38942
+ * `texture.colorSpace = SRGBColorSpace`.
38943
+ *
38521
38944
  * @type {?Texture}
38522
38945
  * @default null
38523
38946
  */
@@ -38535,6 +38958,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38535
38958
  * The alpha channel of this texture is multiplied against `sheenRoughness`, for per-pixel control
38536
38959
  * over sheen roughness.
38537
38960
  *
38961
+ * `sheenRoughnessMap` represents non-color data. Any texture assigned must have
38962
+ * `texture.colorSpace = NoColorSpace` (default).
38963
+ *
38538
38964
  * @type {?Texture}
38539
38965
  * @default null
38540
38966
  */
@@ -38544,6 +38970,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38544
38970
  * The red channel of this texture is multiplied against `transmission`, for per-pixel control over
38545
38971
  * optical transparency.
38546
38972
  *
38973
+ * `transmissionMap` represents non-color data. Any texture assigned must have
38974
+ * `texture.colorSpace = NoColorSpace` (default).
38975
+ *
38547
38976
  * @type {?Texture}
38548
38977
  * @default null
38549
38978
  */
@@ -38563,6 +38992,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38563
38992
  * A texture that defines the thickness, stored in the green channel. This will
38564
38993
  * be multiplied by `thickness`.
38565
38994
  *
38995
+ * `thicknessMap` represents non-color data. Any texture assigned must have
38996
+ * `texture.colorSpace = NoColorSpace` (default).
38997
+ *
38566
38998
  * @type {?Texture}
38567
38999
  * @default null
38568
39000
  */
@@ -38600,6 +39032,9 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38600
39032
  * The alpha channel of this texture is multiplied against `specularIntensity`,
38601
39033
  * for per-pixel control over specular intensity.
38602
39034
  *
39035
+ * `specularIntensityMap` represents non-color data. Any texture assigned must have
39036
+ * `texture.colorSpace = NoColorSpace` (default).
39037
+ *
38603
39038
  * @type {?Texture}
38604
39039
  * @default null
38605
39040
  */
@@ -38617,6 +39052,10 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
38617
39052
  * The RGB channels of this texture are multiplied against `specularColor`,
38618
39053
  * for per-pixel control over specular color.
38619
39054
  *
39055
+ * `specularColorMap` represents color data, and the texture must be assigned a
39056
+ * {@link Texture#colorSpace}. Most `specularColorMap` textures set
39057
+ * `texture.colorSpace = SRGBColorSpace`.
39058
+ *
38620
39059
  * @type {?Texture}
38621
39060
  * @default null
38622
39061
  */
@@ -38914,6 +39353,10 @@ class MeshPhongMaterial extends Material {
38914
39353
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
38915
39354
  * color is modulated by the diffuse `color`.
38916
39355
  *
39356
+ * `map` represents color data, and the texture must be assigned a
39357
+ * {@link Texture#colorSpace}. Most `map` textures set
39358
+ * `texture.colorSpace = SRGBColorSpace`.
39359
+ *
38917
39360
  * @type {?Texture}
38918
39361
  * @default null
38919
39362
  */
@@ -38922,6 +39365,11 @@ class MeshPhongMaterial extends Material {
38922
39365
  /**
38923
39366
  * The light map. Requires a second set of UVs.
38924
39367
  *
39368
+ * `lightMap` represents pre-baked illuminance data, and the texture must be assigned
39369
+ * a {@link Texture#colorSpace}. Most `lightMap` textures set
39370
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
39371
+ * such as `.exr` or `.hdr`.
39372
+ *
38925
39373
  * @type {?Texture}
38926
39374
  * @default null
38927
39375
  */
@@ -38939,6 +39387,9 @@ class MeshPhongMaterial extends Material {
38939
39387
  * The red channel of this texture is used as the ambient occlusion map.
38940
39388
  * Requires a second set of UVs.
38941
39389
  *
39390
+ * `aoMap` represents non-color data. Any texture assigned must have
39391
+ * `texture.colorSpace = NoColorSpace` (default).
39392
+ *
38942
39393
  * @type {?Texture}
38943
39394
  * @default null
38944
39395
  */
@@ -38976,6 +39427,10 @@ class MeshPhongMaterial extends Material {
38976
39427
  * emissive color and the emissive intensity. If you have an emissive map,
38977
39428
  * be sure to set the emissive color to something other than black.
38978
39429
  *
39430
+ * `emissiveMap` represents color data, and the texture must be assigned a
39431
+ * {@link Texture#colorSpace}. Most `emissiveMap` textures set
39432
+ * `texture.colorSpace = SRGBColorSpace`.
39433
+ *
38979
39434
  * @type {?Texture}
38980
39435
  * @default null
38981
39436
  */
@@ -38987,6 +39442,9 @@ class MeshPhongMaterial extends Material {
38987
39442
  * the geometry of the object, only the lighting. If a normal map is defined
38988
39443
  * this will be ignored.
38989
39444
  *
39445
+ * `bumpMap` represents non-color data. Any texture assigned must have
39446
+ * `texture.colorSpace = NoColorSpace` (default).
39447
+ *
38990
39448
  * @type {?Texture}
38991
39449
  * @default null
38992
39450
  */
@@ -39008,6 +39466,9 @@ class MeshPhongMaterial extends Material {
39008
39466
  * convention, the `y` component of `normalScale` should be negated to compensate
39009
39467
  * for the different handedness.
39010
39468
  *
39469
+ * `normalMap` represents non-color data. Any texture assigned must have
39470
+ * `texture.colorSpace = NoColorSpace` (default).
39471
+ *
39011
39472
  * @type {?Texture}
39012
39473
  * @default null
39013
39474
  */
@@ -39035,7 +39496,12 @@ class MeshPhongMaterial extends Material {
39035
39496
  * displaced vertices can cast shadows, block other objects, and otherwise
39036
39497
  * act as real geometry. The displacement texture is an image where the value
39037
39498
  * of each pixel (white being the highest) is mapped against, and
39038
- * repositions, the vertices of the mesh.
39499
+ * repositions, the vertices of the mesh. For best results, pair a
39500
+ * displacement map with a matching normal map, since the renderer can
39501
+ * not recompute surface normals from the displaced vertices.
39502
+ *
39503
+ * `displacementMap` represents non-color data. Any texture assigned must have
39504
+ * `texture.colorSpace = NoColorSpace` (default).
39039
39505
  *
39040
39506
  * @type {?Texture}
39041
39507
  * @default null
@@ -39067,6 +39533,10 @@ class MeshPhongMaterial extends Material {
39067
39533
  * highlight contributes and how much of the environment map affects the
39068
39534
  * surface.
39069
39535
  *
39536
+ * `specularMap` represents color data, and the texture must be assigned a
39537
+ * {@link Texture#colorSpace}. Most `specularMap` textures set
39538
+ * `texture.colorSpace = SRGBColorSpace`.
39539
+ *
39070
39540
  * @type {?Texture}
39071
39541
  * @default null
39072
39542
  */
@@ -39082,6 +39552,9 @@ class MeshPhongMaterial extends Material {
39082
39552
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
39083
39553
  * luminance/alpha textures will also still work as expected.
39084
39554
  *
39555
+ * `alphaMap` represents non-color data. Any texture assigned must have
39556
+ * `texture.colorSpace = NoColorSpace` (default).
39557
+ *
39085
39558
  * @type {?Texture}
39086
39559
  * @default null
39087
39560
  */
@@ -39090,6 +39563,11 @@ class MeshPhongMaterial extends Material {
39090
39563
  /**
39091
39564
  * The environment map.
39092
39565
  *
39566
+ * `envMap` represents luminance data, and the texture must be assigned
39567
+ * a {@link Texture#colorSpace}. Most `envMap` textures set
39568
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
39569
+ * such as `.exr` or `.hdr`.
39570
+ *
39093
39571
  * @type {?Texture}
39094
39572
  * @default null
39095
39573
  */
@@ -39304,6 +39782,10 @@ class MeshToonMaterial extends Material {
39304
39782
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
39305
39783
  * color is modulated by the diffuse `color`.
39306
39784
  *
39785
+ * `map` represents color data, and the texture must be assigned a
39786
+ * {@link Texture#colorSpace}. Most `map` textures set
39787
+ * `texture.colorSpace = SRGBColorSpace`.
39788
+ *
39307
39789
  * @type {?Texture}
39308
39790
  * @default null
39309
39791
  */
@@ -39314,6 +39796,9 @@ class MeshToonMaterial extends Material {
39314
39796
  * {@link Texture#minFilter} and {@link Texture#magFilter} to {@link NearestFilter}
39315
39797
  * when using this type of texture.
39316
39798
  *
39799
+ * `gradientMap` represents non-color data. Any texture assigned must have
39800
+ * `texture.colorSpace = NoColorSpace` (default).
39801
+ *
39317
39802
  * @type {?Texture}
39318
39803
  * @default null
39319
39804
  */
@@ -39322,6 +39807,11 @@ class MeshToonMaterial extends Material {
39322
39807
  /**
39323
39808
  * The light map. Requires a second set of UVs.
39324
39809
  *
39810
+ * `lightMap` represents pre-baked illuminance data, and the texture must be assigned
39811
+ * a {@link Texture#colorSpace}. Most `lightMap` textures set
39812
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
39813
+ * such as `.exr` or `.hdr`.
39814
+ *
39325
39815
  * @type {?Texture}
39326
39816
  * @default null
39327
39817
  */
@@ -39339,6 +39829,9 @@ class MeshToonMaterial extends Material {
39339
39829
  * The red channel of this texture is used as the ambient occlusion map.
39340
39830
  * Requires a second set of UVs.
39341
39831
  *
39832
+ * `aoMap` represents non-color data. Any texture assigned must have
39833
+ * `texture.colorSpace = NoColorSpace` (default).
39834
+ *
39342
39835
  * @type {?Texture}
39343
39836
  * @default null
39344
39837
  */
@@ -39376,6 +39869,10 @@ class MeshToonMaterial extends Material {
39376
39869
  * emissive color and the emissive intensity. If you have an emissive map,
39377
39870
  * be sure to set the emissive color to something other than black.
39378
39871
  *
39872
+ * `emissiveMap` represents color data, and the texture must be assigned a
39873
+ * {@link Texture#colorSpace}. Most `emissiveMap` textures set
39874
+ * `texture.colorSpace = SRGBColorSpace`.
39875
+ *
39379
39876
  * @type {?Texture}
39380
39877
  * @default null
39381
39878
  */
@@ -39387,6 +39884,9 @@ class MeshToonMaterial extends Material {
39387
39884
  * the geometry of the object, only the lighting. If a normal map is defined
39388
39885
  * this will be ignored.
39389
39886
  *
39887
+ * `bumpMap` represents non-color data. Any texture assigned must have
39888
+ * `texture.colorSpace = NoColorSpace` (default).
39889
+ *
39390
39890
  * @type {?Texture}
39391
39891
  * @default null
39392
39892
  */
@@ -39408,6 +39908,9 @@ class MeshToonMaterial extends Material {
39408
39908
  * convention, the `y` component of `normalScale` should be negated to compensate
39409
39909
  * for the different handedness.
39410
39910
  *
39911
+ * `normalMap` represents non-color data. Any texture assigned must have
39912
+ * `texture.colorSpace = NoColorSpace` (default).
39913
+ *
39411
39914
  * @type {?Texture}
39412
39915
  * @default null
39413
39916
  */
@@ -39435,7 +39938,12 @@ class MeshToonMaterial extends Material {
39435
39938
  * displaced vertices can cast shadows, block other objects, and otherwise
39436
39939
  * act as real geometry. The displacement texture is an image where the value
39437
39940
  * of each pixel (white being the highest) is mapped against, and
39438
- * repositions, the vertices of the mesh.
39941
+ * repositions, the vertices of the mesh. For best results, pair a
39942
+ * displacement map with a matching normal map, since the renderer can
39943
+ * not recompute surface normals from the displaced vertices.
39944
+ *
39945
+ * `displacementMap` represents non-color data. Any texture assigned must have
39946
+ * `texture.colorSpace = NoColorSpace` (default).
39439
39947
  *
39440
39948
  * @type {?Texture}
39441
39949
  * @default null
@@ -39472,6 +39980,9 @@ class MeshToonMaterial extends Material {
39472
39980
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
39473
39981
  * luminance/alpha textures will also still work as expected.
39474
39982
  *
39983
+ * `alphaMap` represents non-color data. Any texture assigned must have
39984
+ * `texture.colorSpace = NoColorSpace` (default).
39985
+ *
39475
39986
  * @type {?Texture}
39476
39987
  * @default null
39477
39988
  */
@@ -39610,6 +40121,9 @@ class MeshNormalMaterial extends Material {
39610
40121
  * the geometry of the object, only the lighting. If a normal map is defined
39611
40122
  * this will be ignored.
39612
40123
  *
40124
+ * `bumpMap` represents non-color data. Any texture assigned must have
40125
+ * `texture.colorSpace = NoColorSpace` (default).
40126
+ *
39613
40127
  * @type {?Texture}
39614
40128
  * @default null
39615
40129
  */
@@ -39631,6 +40145,9 @@ class MeshNormalMaterial extends Material {
39631
40145
  * convention, the `y` component of `normalScale` should be negated to compensate
39632
40146
  * for the different handedness.
39633
40147
  *
40148
+ * `normalMap` represents non-color data. Any texture assigned must have
40149
+ * `texture.colorSpace = NoColorSpace` (default).
40150
+ *
39634
40151
  * @type {?Texture}
39635
40152
  * @default null
39636
40153
  */
@@ -39658,7 +40175,9 @@ class MeshNormalMaterial extends Material {
39658
40175
  * displaced vertices can cast shadows, block other objects, and otherwise
39659
40176
  * act as real geometry. The displacement texture is an image where the value
39660
40177
  * of each pixel (white being the highest) is mapped against, and
39661
- * repositions, the vertices of the mesh.
40178
+ * repositions, the vertices of the mesh. For best results, pair a
40179
+ * displacement map with a matching normal map, since the renderer can
40180
+ * not recompute surface normals from the displaced vertices.
39662
40181
  *
39663
40182
  * @type {?Texture}
39664
40183
  * @default null
@@ -39798,6 +40317,10 @@ class MeshLambertMaterial extends Material {
39798
40317
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
39799
40318
  * color is modulated by the diffuse `color`.
39800
40319
  *
40320
+ * `map` represents color data, and the texture must be assigned a
40321
+ * {@link Texture#colorSpace}. Most `map` textures set
40322
+ * `texture.colorSpace = SRGBColorSpace`.
40323
+ *
39801
40324
  * @type {?Texture}
39802
40325
  * @default null
39803
40326
  */
@@ -39806,6 +40329,11 @@ class MeshLambertMaterial extends Material {
39806
40329
  /**
39807
40330
  * The light map. Requires a second set of UVs.
39808
40331
  *
40332
+ * `lightMap` represents pre-baked illuminance data, and the texture must be assigned
40333
+ * a {@link Texture#colorSpace}. Most `lightMap` textures set
40334
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
40335
+ * such as `.exr` or `.hdr`.
40336
+ *
39809
40337
  * @type {?Texture}
39810
40338
  * @default null
39811
40339
  */
@@ -39823,6 +40351,9 @@ class MeshLambertMaterial extends Material {
39823
40351
  * The red channel of this texture is used as the ambient occlusion map.
39824
40352
  * Requires a second set of UVs.
39825
40353
  *
40354
+ * `aoMap` represents non-color data. Any texture assigned must have
40355
+ * `texture.colorSpace = NoColorSpace` (default).
40356
+ *
39826
40357
  * @type {?Texture}
39827
40358
  * @default null
39828
40359
  */
@@ -39860,6 +40391,10 @@ class MeshLambertMaterial extends Material {
39860
40391
  * emissive color and the emissive intensity. If you have an emissive map,
39861
40392
  * be sure to set the emissive color to something other than black.
39862
40393
  *
40394
+ * `emissiveMap` represents color data, and the texture must be assigned a
40395
+ * {@link Texture#colorSpace}. Most `emissiveMap` textures set
40396
+ * `texture.colorSpace = SRGBColorSpace`.
40397
+ *
39863
40398
  * @type {?Texture}
39864
40399
  * @default null
39865
40400
  */
@@ -39871,6 +40406,9 @@ class MeshLambertMaterial extends Material {
39871
40406
  * the geometry of the object, only the lighting. If a normal map is defined
39872
40407
  * this will be ignored.
39873
40408
  *
40409
+ * `bumpMap` represents non-color data. Any texture assigned must have
40410
+ * `texture.colorSpace = NoColorSpace` (default).
40411
+ *
39874
40412
  * @type {?Texture}
39875
40413
  * @default null
39876
40414
  */
@@ -39892,6 +40430,9 @@ class MeshLambertMaterial extends Material {
39892
40430
  * convention, the `y` component of `normalScale` should be negated to compensate
39893
40431
  * for the different handedness.
39894
40432
  *
40433
+ * `normalMap` represents non-color data. Any texture assigned must have
40434
+ * `texture.colorSpace = NoColorSpace` (default).
40435
+ *
39895
40436
  * @type {?Texture}
39896
40437
  * @default null
39897
40438
  */
@@ -39919,7 +40460,12 @@ class MeshLambertMaterial extends Material {
39919
40460
  * displaced vertices can cast shadows, block other objects, and otherwise
39920
40461
  * act as real geometry. The displacement texture is an image where the value
39921
40462
  * of each pixel (white being the highest) is mapped against, and
39922
- * repositions, the vertices of the mesh.
40463
+ * repositions, the vertices of the mesh. For best results, pair a
40464
+ * displacement map with a matching normal map, since the renderer can
40465
+ * not recompute surface normals from the displaced vertices.
40466
+ *
40467
+ * `displacementMap` represents non-color data. Any texture assigned must have
40468
+ * `texture.colorSpace = NoColorSpace` (default).
39923
40469
  *
39924
40470
  * @type {?Texture}
39925
40471
  * @default null
@@ -39949,6 +40495,10 @@ class MeshLambertMaterial extends Material {
39949
40495
  /**
39950
40496
  * Specular map used by the material.
39951
40497
  *
40498
+ * `specularMap` represents color data, and the texture must be assigned a
40499
+ * {@link Texture#colorSpace}. Most `specularMap` textures set
40500
+ * `texture.colorSpace = SRGBColorSpace`.
40501
+ *
39952
40502
  * @type {?Texture}
39953
40503
  * @default null
39954
40504
  */
@@ -39964,6 +40514,9 @@ class MeshLambertMaterial extends Material {
39964
40514
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
39965
40515
  * luminance/alpha textures will also still work as expected.
39966
40516
  *
40517
+ * `alphaMap` represents non-color data. Any texture assigned must have
40518
+ * `texture.colorSpace = NoColorSpace` (default).
40519
+ *
39967
40520
  * @type {?Texture}
39968
40521
  * @default null
39969
40522
  */
@@ -39972,6 +40525,11 @@ class MeshLambertMaterial extends Material {
39972
40525
  /**
39973
40526
  * The environment map.
39974
40527
  *
40528
+ * `envMap` represents luminance data, and the texture must be assigned
40529
+ * a {@link Texture#colorSpace}. Most `envMap` textures set
40530
+ * `texture.colorSpace = LinearSRGBColorSpace` and use float-type formats
40531
+ * such as `.exr` or `.hdr`.
40532
+ *
39975
40533
  * @type {?Texture}
39976
40534
  * @default null
39977
40535
  */
@@ -40182,6 +40740,10 @@ class MeshDepthMaterial extends Material {
40182
40740
  * The color map. May optionally include an alpha channel, typically combined
40183
40741
  * with {@link Material#transparent} or {@link Material#alphaTest}.
40184
40742
  *
40743
+ * `map` represents color data, and the texture must be assigned a
40744
+ * {@link Texture#colorSpace}. Most `map` textures set
40745
+ * `texture.colorSpace = SRGBColorSpace`.
40746
+ *
40185
40747
  * @type {?Texture}
40186
40748
  * @default null
40187
40749
  */
@@ -40197,6 +40759,9 @@ class MeshDepthMaterial extends Material {
40197
40759
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
40198
40760
  * luminance/alpha textures will also still work as expected.
40199
40761
  *
40762
+ * `alphaMap` represents non-color data. Any texture assigned must have
40763
+ * `texture.colorSpace = NoColorSpace` (default).
40764
+ *
40200
40765
  * @type {?Texture}
40201
40766
  * @default null
40202
40767
  */
@@ -40210,6 +40775,9 @@ class MeshDepthMaterial extends Material {
40210
40775
  * of each pixel (white being the highest) is mapped against, and
40211
40776
  * repositions, the vertices of the mesh.
40212
40777
  *
40778
+ * `displacementMap` represents non-color data. Any texture assigned must have
40779
+ * `texture.colorSpace = NoColorSpace` (default).
40780
+ *
40213
40781
  * @type {?Texture}
40214
40782
  * @default null
40215
40783
  */
@@ -40322,6 +40890,10 @@ class MeshDistanceMaterial extends Material {
40322
40890
  * The color map. May optionally include an alpha channel, typically combined
40323
40891
  * with {@link Material#transparent} or {@link Material#alphaTest}.
40324
40892
  *
40893
+ * `map` represents color data, and the texture must be assigned a
40894
+ * {@link Texture#colorSpace}. Most `map` textures set
40895
+ * `texture.colorSpace = SRGBColorSpace`.
40896
+ *
40325
40897
  * @type {?Texture}
40326
40898
  * @default null
40327
40899
  */
@@ -40337,6 +40909,9 @@ class MeshDistanceMaterial extends Material {
40337
40909
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
40338
40910
  * luminance/alpha textures will also still work as expected.
40339
40911
  *
40912
+ * `alphaMap` represents non-color data. Any texture assigned must have
40913
+ * `texture.colorSpace = NoColorSpace` (default).
40914
+ *
40340
40915
  * @type {?Texture}
40341
40916
  * @default null
40342
40917
  */
@@ -40350,6 +40925,9 @@ class MeshDistanceMaterial extends Material {
40350
40925
  * of each pixel (white being the highest) is mapped against, and
40351
40926
  * repositions, the vertices of the mesh.
40352
40927
  *
40928
+ * `displacementMap` represents non-color data. Any texture assigned must have
40929
+ * `texture.colorSpace = NoColorSpace` (default).
40930
+ *
40353
40931
  * @type {?Texture}
40354
40932
  * @default null
40355
40933
  */
@@ -40448,6 +41026,12 @@ class MeshMatcapMaterial extends Material {
40448
41026
  /**
40449
41027
  * The matcap map.
40450
41028
  *
41029
+ * `matcap` represents luminance data, and the texture must be assigned
41030
+ * a {@link Texture#colorSpace}. HDR `matcap` textures (e.g. `.exr`)
41031
+ * typically set `texture.colorSpace = LinearSRGBColorSpace`, while LDR
41032
+ * `matcap` textures (e.g. `.png`, `.jpg`, `.webp`) typically set
41033
+ * `texture.colorSpace = SRGBColorSpace`.
41034
+ *
40451
41035
  * @type {?Texture}
40452
41036
  * @default null
40453
41037
  */
@@ -40458,6 +41042,10 @@ class MeshMatcapMaterial extends Material {
40458
41042
  * with {@link Material#transparent} or {@link Material#alphaTest}. The texture map
40459
41043
  * color is modulated by the diffuse `color`.
40460
41044
  *
41045
+ * `map` represents color data, and the texture must be assigned a
41046
+ * {@link Texture#colorSpace}. Most `map` textures set
41047
+ * `texture.colorSpace = SRGBColorSpace`.
41048
+ *
40461
41049
  * @type {?Texture}
40462
41050
  * @default null
40463
41051
  */
@@ -40469,6 +41057,9 @@ class MeshMatcapMaterial extends Material {
40469
41057
  * the geometry of the object, only the lighting. If a normal map is defined
40470
41058
  * this will be ignored.
40471
41059
  *
41060
+ * `bumpMap` represents non-color data. Any texture assigned must have
41061
+ * `texture.colorSpace = NoColorSpace` (default).
41062
+ *
40472
41063
  * @type {?Texture}
40473
41064
  * @default null
40474
41065
  */
@@ -40490,6 +41081,9 @@ class MeshMatcapMaterial extends Material {
40490
41081
  * convention, the `y` component of `normalScale` should be negated to compensate
40491
41082
  * for the different handedness.
40492
41083
  *
41084
+ * `normalMap` represents non-color data. Any texture assigned must have
41085
+ * `texture.colorSpace = NoColorSpace` (default).
41086
+ *
40493
41087
  * @type {?Texture}
40494
41088
  * @default null
40495
41089
  */
@@ -40517,7 +41111,12 @@ class MeshMatcapMaterial extends Material {
40517
41111
  * displaced vertices can cast shadows, block other objects, and otherwise
40518
41112
  * act as real geometry. The displacement texture is an image where the value
40519
41113
  * of each pixel (white being the highest) is mapped against, and
40520
- * repositions, the vertices of the mesh.
41114
+ * repositions, the vertices of the mesh. For best results, pair a
41115
+ * displacement map with a matching normal map, since the renderer can
41116
+ * not recompute surface normals from the displaced vertices.
41117
+ *
41118
+ * `displacementMap` represents non-color data. Any texture assigned must have
41119
+ * `texture.colorSpace = NoColorSpace` (default).
40521
41120
  *
40522
41121
  * @type {?Texture}
40523
41122
  * @default null
@@ -40554,6 +41153,9 @@ class MeshMatcapMaterial extends Material {
40554
41153
  * green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
40555
41154
  * luminance/alpha textures will also still work as expected.
40556
41155
  *
41156
+ * `alphaMap` represents non-color data. Any texture assigned must have
41157
+ * `texture.colorSpace = NoColorSpace` (default).
41158
+ *
40557
41159
  * @type {?Texture}
40558
41160
  * @default null
40559
41161
  */
@@ -41499,7 +42101,7 @@ class Interpolant {
41499
42101
  */
41500
42102
  interpolate_( /* i1, t0, t, t1 */ ) {
41501
42103
 
41502
- throw new Error( 'call to abstract method' );
42104
+ throw new Error( 'THREE.Interpolant: Call to abstract method.' );
41503
42105
  // implementations shall return this.resultBuffer
41504
42106
 
41505
42107
  }
@@ -41758,9 +42360,8 @@ class DiscreteInterpolant extends Interpolant {
41758
42360
  * each keyframe has explicit in/out tangent control points specified as
41759
42361
  * 2D coordinates (time, value).
41760
42362
  *
41761
- * The tangent data must be provided via the `settings` object:
41762
- * - `settings.inTangents`: Float32Array with [time, value] pairs per keyframe per component
41763
- * - `settings.outTangents`: Float32Array with [time, value] pairs per keyframe per component
42363
+ * Tangent data is read from `inTangents` and `outTangents` on the interpolant
42364
+ * (populated by `KeyframeTrack.InterpolantFactoryMethodBezier`).
41764
42365
  *
41765
42366
  * For a track with N keyframes and stride S:
41766
42367
  * - Each tangent array has N * S * 2 values
@@ -41780,9 +42381,8 @@ class BezierInterpolant extends Interpolant {
41780
42381
  const offset1 = i1 * stride;
41781
42382
  const offset0 = offset1 - stride;
41782
42383
 
41783
- const settings = this.settings || this.DefaultSettings_;
41784
- const inTangents = settings.inTangents;
41785
- const outTangents = settings.outTangents;
42384
+ const inTangents = this.inTangents;
42385
+ const outTangents = this.outTangents;
41786
42386
 
41787
42387
  // If no tangent data, fall back to linear interpolation
41788
42388
  if ( ! inTangents || ! outTangents ) {
@@ -42003,10 +42603,10 @@ class KeyframeTrack {
42003
42603
 
42004
42604
  const interpolant = new BezierInterpolant( this.times, this.values, this.getValueSize(), result );
42005
42605
 
42006
- // Pass tangent data from track settings to interpolant
42007
42606
  if ( this.settings ) {
42008
42607
 
42009
- interpolant.settings = this.settings;
42608
+ interpolant.inTangents = this.settings.inTangents;
42609
+ interpolant.outTangents = this.settings.outTangents;
42010
42610
 
42011
42611
  }
42012
42612
 
@@ -43048,144 +43648,6 @@ class AnimationClip {
43048
43648
 
43049
43649
  }
43050
43650
 
43051
- /**
43052
- * Parses the `animation.hierarchy` format and returns a new animation clip.
43053
- *
43054
- * @static
43055
- * @deprecated since r175.
43056
- * @param {Object} animation - A serialized animation clip as JSON.
43057
- * @param {Array<Bone>} bones - An array of bones.
43058
- * @return {?AnimationClip} The new animation clip.
43059
- */
43060
- static parseAnimation( animation, bones ) {
43061
-
43062
- warn( 'AnimationClip: parseAnimation() is deprecated and will be removed with r185' );
43063
-
43064
- if ( ! animation ) {
43065
-
43066
- error( 'AnimationClip: No animation in JSONLoader data.' );
43067
- return null;
43068
-
43069
- }
43070
-
43071
- const addNonemptyTrack = function ( trackType, trackName, animationKeys, propertyName, destTracks ) {
43072
-
43073
- // only return track if there are actually keys.
43074
- if ( animationKeys.length !== 0 ) {
43075
-
43076
- const times = [];
43077
- const values = [];
43078
-
43079
- flattenJSON( animationKeys, times, values, propertyName );
43080
-
43081
- // empty keys are filtered out, so check again
43082
- if ( times.length !== 0 ) {
43083
-
43084
- destTracks.push( new trackType( trackName, times, values ) );
43085
-
43086
- }
43087
-
43088
- }
43089
-
43090
- };
43091
-
43092
- const tracks = [];
43093
-
43094
- const clipName = animation.name || 'default';
43095
- const fps = animation.fps || 30;
43096
- const blendMode = animation.blendMode;
43097
-
43098
- // automatic length determination in AnimationClip.
43099
- let duration = animation.length || -1;
43100
-
43101
- const hierarchyTracks = animation.hierarchy || [];
43102
-
43103
- for ( let h = 0; h < hierarchyTracks.length; h ++ ) {
43104
-
43105
- const animationKeys = hierarchyTracks[ h ].keys;
43106
-
43107
- // skip empty tracks
43108
- if ( ! animationKeys || animationKeys.length === 0 ) continue;
43109
-
43110
- // process morph targets
43111
- if ( animationKeys[ 0 ].morphTargets ) {
43112
-
43113
- // figure out all morph targets used in this track
43114
- const morphTargetNames = {};
43115
-
43116
- let k;
43117
-
43118
- for ( k = 0; k < animationKeys.length; k ++ ) {
43119
-
43120
- if ( animationKeys[ k ].morphTargets ) {
43121
-
43122
- for ( let m = 0; m < animationKeys[ k ].morphTargets.length; m ++ ) {
43123
-
43124
- morphTargetNames[ animationKeys[ k ].morphTargets[ m ] ] = -1;
43125
-
43126
- }
43127
-
43128
- }
43129
-
43130
- }
43131
-
43132
- // create a track for each morph target with all zero
43133
- // morphTargetInfluences except for the keys in which
43134
- // the morphTarget is named.
43135
- for ( const morphTargetName in morphTargetNames ) {
43136
-
43137
- const times = [];
43138
- const values = [];
43139
-
43140
- for ( let m = 0; m !== animationKeys[ k ].morphTargets.length; ++ m ) {
43141
-
43142
- const animationKey = animationKeys[ k ];
43143
-
43144
- times.push( animationKey.time );
43145
- values.push( ( animationKey.morphTarget === morphTargetName ) ? 1 : 0 );
43146
-
43147
- }
43148
-
43149
- tracks.push( new NumberKeyframeTrack( '.morphTargetInfluence[' + morphTargetName + ']', times, values ) );
43150
-
43151
- }
43152
-
43153
- duration = morphTargetNames.length * fps;
43154
-
43155
- } else {
43156
-
43157
- // ...assume skeletal animation
43158
-
43159
- const boneName = '.bones[' + bones[ h ].name + ']';
43160
-
43161
- addNonemptyTrack(
43162
- VectorKeyframeTrack, boneName + '.position',
43163
- animationKeys, 'pos', tracks );
43164
-
43165
- addNonemptyTrack(
43166
- QuaternionKeyframeTrack, boneName + '.quaternion',
43167
- animationKeys, 'rot', tracks );
43168
-
43169
- addNonemptyTrack(
43170
- VectorKeyframeTrack, boneName + '.scale',
43171
- animationKeys, 'scl', tracks );
43172
-
43173
- }
43174
-
43175
- }
43176
-
43177
- if ( tracks.length === 0 ) {
43178
-
43179
- return null;
43180
-
43181
- }
43182
-
43183
- const clip = new this( clipName, duration, tracks, blendMode );
43184
-
43185
- return clip;
43186
-
43187
- }
43188
-
43189
43651
  /**
43190
43652
  * Sets the duration of this clip to the duration of its longest keyframe track.
43191
43653
  *
@@ -43650,6 +44112,11 @@ class LoadingManager {
43650
44112
  */
43651
44113
  this.resolveURL = function ( url ) {
43652
44114
 
44115
+ // Normalize to NFC so that Unicode URIs (e.g. from glTF)
44116
+ // are percent-encoded correctly per RFC 3987.
44117
+
44118
+ url = url.normalize( 'NFC' );
44119
+
43653
44120
  if ( urlModifier ) {
43654
44121
 
43655
44122
  return urlModifier( url );
@@ -44967,77 +45434,108 @@ class DataTextureLoader extends Loader {
44967
45434
 
44968
45435
  }
44969
45436
 
44970
- if ( texData.image !== undefined ) {
45437
+ scope._applyTexData( texture, texData );
44971
45438
 
44972
- texture.image = texData.image;
45439
+ if ( onLoad ) onLoad( texture, texData );
44973
45440
 
44974
- } else if ( texData.data !== undefined ) {
45441
+ }, onProgress, onError );
44975
45442
 
44976
- texture.image.width = texData.width;
44977
- texture.image.height = texData.height;
44978
- texture.image.data = texData.data;
44979
45443
 
44980
- }
45444
+ return texture;
44981
45445
 
44982
- texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;
44983
- texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;
45446
+ }
44984
45447
 
44985
- texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;
44986
- texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;
45448
+ /**
45449
+ * Parses the given buffer and returns a configured data texture. Use this method
45450
+ * for parsing texture data that is already in memory (e.g. drag and drop or data
45451
+ * loaded from a server) without going through {@link DataTextureLoader#load}.
45452
+ *
45453
+ * @param {ArrayBuffer} buffer - The raw texture data.
45454
+ * @return {DataTexture} The data texture.
45455
+ */
45456
+ createDataTexture( buffer ) {
44987
45457
 
44988
- texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;
45458
+ const texture = new DataTexture();
44989
45459
 
44990
- if ( texData.colorSpace !== undefined ) {
45460
+ this._applyTexData( texture, this.parse( buffer ) );
44991
45461
 
44992
- texture.colorSpace = texData.colorSpace;
45462
+ return texture;
44993
45463
 
44994
- }
45464
+ }
45465
+
45466
+ /**
45467
+ * Applies the given parsed texture data to the given data texture.
45468
+ *
45469
+ * @private
45470
+ * @param {DataTexture} texture - The data texture.
45471
+ * @param {DataTextureLoader~TexData} texData - The parsed texture data.
45472
+ */
45473
+ _applyTexData( texture, texData ) {
44995
45474
 
44996
- if ( texData.flipY !== undefined ) {
45475
+ if ( texData.image !== undefined ) {
44997
45476
 
44998
- texture.flipY = texData.flipY;
45477
+ texture.image = texData.image;
44999
45478
 
45000
- }
45479
+ } else if ( texData.data !== undefined ) {
45001
45480
 
45002
- if ( texData.format !== undefined ) {
45481
+ texture.image.width = texData.width;
45482
+ texture.image.height = texData.height;
45483
+ texture.image.data = texData.data;
45003
45484
 
45004
- texture.format = texData.format;
45485
+ }
45005
45486
 
45006
- }
45487
+ texture.wrapS = texData.wrapS !== undefined ? texData.wrapS : ClampToEdgeWrapping;
45488
+ texture.wrapT = texData.wrapT !== undefined ? texData.wrapT : ClampToEdgeWrapping;
45007
45489
 
45008
- if ( texData.type !== undefined ) {
45490
+ texture.magFilter = texData.magFilter !== undefined ? texData.magFilter : LinearFilter;
45491
+ texture.minFilter = texData.minFilter !== undefined ? texData.minFilter : LinearFilter;
45009
45492
 
45010
- texture.type = texData.type;
45493
+ texture.anisotropy = texData.anisotropy !== undefined ? texData.anisotropy : 1;
45011
45494
 
45012
- }
45495
+ if ( texData.colorSpace !== undefined ) {
45013
45496
 
45014
- if ( texData.mipmaps !== undefined ) {
45497
+ texture.colorSpace = texData.colorSpace;
45015
45498
 
45016
- texture.mipmaps = texData.mipmaps;
45017
- texture.minFilter = LinearMipmapLinearFilter; // presumably...
45499
+ }
45018
45500
 
45019
- }
45501
+ if ( texData.flipY !== undefined ) {
45020
45502
 
45021
- if ( texData.mipmapCount === 1 ) {
45503
+ texture.flipY = texData.flipY;
45022
45504
 
45023
- texture.minFilter = LinearFilter;
45505
+ }
45024
45506
 
45025
- }
45507
+ if ( texData.format !== undefined ) {
45026
45508
 
45027
- if ( texData.generateMipmaps !== undefined ) {
45509
+ texture.format = texData.format;
45028
45510
 
45029
- texture.generateMipmaps = texData.generateMipmaps;
45511
+ }
45030
45512
 
45031
- }
45513
+ if ( texData.type !== undefined ) {
45032
45514
 
45033
- texture.needsUpdate = true;
45515
+ texture.type = texData.type;
45034
45516
 
45035
- if ( onLoad ) onLoad( texture, texData );
45517
+ }
45036
45518
 
45037
- }, onProgress, onError );
45519
+ if ( texData.mipmaps !== undefined ) {
45038
45520
 
45521
+ texture.mipmaps = texData.mipmaps;
45522
+ texture.minFilter = LinearMipmapLinearFilter; // presumably...
45039
45523
 
45040
- return texture;
45524
+ }
45525
+
45526
+ if ( texData.mipmapCount === 1 ) {
45527
+
45528
+ texture.minFilter = LinearFilter;
45529
+
45530
+ }
45531
+
45532
+ if ( texData.generateMipmaps !== undefined ) {
45533
+
45534
+ texture.generateMipmaps = texData.generateMipmaps;
45535
+
45536
+ }
45537
+
45538
+ texture.needsUpdate = true;
45041
45539
 
45042
45540
  }
45043
45541
 
@@ -45727,9 +46225,9 @@ class Camera extends Object3D {
45727
46225
 
45728
46226
  }
45729
46227
 
45730
- updateWorldMatrix( updateParents, updateChildren ) {
46228
+ updateWorldMatrix( updateParents, updateChildren, force = false ) {
45731
46229
 
45732
- super.updateWorldMatrix( updateParents, updateChildren );
46230
+ super.updateWorldMatrix( updateParents, updateChildren, force );
45733
46231
 
45734
46232
  // exclude scale from view matrix to be glTF conform
45735
46233
 
@@ -47511,6 +48009,8 @@ class LightProbe extends Light {
47511
48009
 
47512
48010
  }
47513
48011
 
48012
+ const _customMaterials = {};
48013
+
47514
48014
  /**
47515
48015
  * Class for loading materials. The files are internally
47516
48016
  * loaded via {@link FileLoader}.
@@ -47593,265 +48093,9 @@ class MaterialLoader extends Loader {
47593
48093
  */
47594
48094
  parse( json ) {
47595
48095
 
47596
- const textures = this.textures;
47597
-
47598
- function getTexture( name ) {
47599
-
47600
- if ( textures[ name ] === undefined ) {
47601
-
47602
- warn( 'MaterialLoader: Undefined texture', name );
47603
-
47604
- }
47605
-
47606
- return textures[ name ];
47607
-
47608
- }
47609
-
47610
48096
  const material = this.createMaterialFromType( json.type );
47611
48097
 
47612
- if ( json.uuid !== undefined ) material.uuid = json.uuid;
47613
- if ( json.name !== undefined ) material.name = json.name;
47614
- if ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );
47615
- if ( json.roughness !== undefined ) material.roughness = json.roughness;
47616
- if ( json.metalness !== undefined ) material.metalness = json.metalness;
47617
- if ( json.sheen !== undefined ) material.sheen = json.sheen;
47618
- if ( json.sheenColor !== undefined ) material.sheenColor = new Color().setHex( json.sheenColor );
47619
- if ( json.sheenRoughness !== undefined ) material.sheenRoughness = json.sheenRoughness;
47620
- if ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );
47621
- if ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );
47622
- if ( json.specularIntensity !== undefined ) material.specularIntensity = json.specularIntensity;
47623
- if ( json.specularColor !== undefined && material.specularColor !== undefined ) material.specularColor.setHex( json.specularColor );
47624
- if ( json.shininess !== undefined ) material.shininess = json.shininess;
47625
- if ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;
47626
- if ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;
47627
- if ( json.dispersion !== undefined ) material.dispersion = json.dispersion;
47628
- if ( json.iridescence !== undefined ) material.iridescence = json.iridescence;
47629
- if ( json.iridescenceIOR !== undefined ) material.iridescenceIOR = json.iridescenceIOR;
47630
- if ( json.iridescenceThicknessRange !== undefined ) material.iridescenceThicknessRange = json.iridescenceThicknessRange;
47631
- if ( json.transmission !== undefined ) material.transmission = json.transmission;
47632
- if ( json.thickness !== undefined ) material.thickness = json.thickness;
47633
- if ( json.attenuationDistance !== undefined ) material.attenuationDistance = json.attenuationDistance;
47634
- if ( json.attenuationColor !== undefined && material.attenuationColor !== undefined ) material.attenuationColor.setHex( json.attenuationColor );
47635
- if ( json.anisotropy !== undefined ) material.anisotropy = json.anisotropy;
47636
- if ( json.anisotropyRotation !== undefined ) material.anisotropyRotation = json.anisotropyRotation;
47637
- if ( json.fog !== undefined ) material.fog = json.fog;
47638
- if ( json.flatShading !== undefined ) material.flatShading = json.flatShading;
47639
- if ( json.blending !== undefined ) material.blending = json.blending;
47640
- if ( json.combine !== undefined ) material.combine = json.combine;
47641
- if ( json.side !== undefined ) material.side = json.side;
47642
- if ( json.shadowSide !== undefined ) material.shadowSide = json.shadowSide;
47643
- if ( json.opacity !== undefined ) material.opacity = json.opacity;
47644
- if ( json.transparent !== undefined ) material.transparent = json.transparent;
47645
- if ( json.alphaTest !== undefined ) material.alphaTest = json.alphaTest;
47646
- if ( json.alphaHash !== undefined ) material.alphaHash = json.alphaHash;
47647
- if ( json.depthFunc !== undefined ) material.depthFunc = json.depthFunc;
47648
- if ( json.depthTest !== undefined ) material.depthTest = json.depthTest;
47649
- if ( json.depthWrite !== undefined ) material.depthWrite = json.depthWrite;
47650
- if ( json.colorWrite !== undefined ) material.colorWrite = json.colorWrite;
47651
- if ( json.blendSrc !== undefined ) material.blendSrc = json.blendSrc;
47652
- if ( json.blendDst !== undefined ) material.blendDst = json.blendDst;
47653
- if ( json.blendEquation !== undefined ) material.blendEquation = json.blendEquation;
47654
- if ( json.blendSrcAlpha !== undefined ) material.blendSrcAlpha = json.blendSrcAlpha;
47655
- if ( json.blendDstAlpha !== undefined ) material.blendDstAlpha = json.blendDstAlpha;
47656
- if ( json.blendEquationAlpha !== undefined ) material.blendEquationAlpha = json.blendEquationAlpha;
47657
- if ( json.blendColor !== undefined && material.blendColor !== undefined ) material.blendColor.setHex( json.blendColor );
47658
- if ( json.blendAlpha !== undefined ) material.blendAlpha = json.blendAlpha;
47659
- if ( json.stencilWriteMask !== undefined ) material.stencilWriteMask = json.stencilWriteMask;
47660
- if ( json.stencilFunc !== undefined ) material.stencilFunc = json.stencilFunc;
47661
- if ( json.stencilRef !== undefined ) material.stencilRef = json.stencilRef;
47662
- if ( json.stencilFuncMask !== undefined ) material.stencilFuncMask = json.stencilFuncMask;
47663
- if ( json.stencilFail !== undefined ) material.stencilFail = json.stencilFail;
47664
- if ( json.stencilZFail !== undefined ) material.stencilZFail = json.stencilZFail;
47665
- if ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;
47666
- if ( json.stencilWrite !== undefined ) material.stencilWrite = json.stencilWrite;
47667
-
47668
- if ( json.wireframe !== undefined ) material.wireframe = json.wireframe;
47669
- if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;
47670
- if ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;
47671
- if ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;
47672
-
47673
- if ( json.rotation !== undefined ) material.rotation = json.rotation;
47674
-
47675
- if ( json.linewidth !== undefined ) material.linewidth = json.linewidth;
47676
- if ( json.dashSize !== undefined ) material.dashSize = json.dashSize;
47677
- if ( json.gapSize !== undefined ) material.gapSize = json.gapSize;
47678
- if ( json.scale !== undefined ) material.scale = json.scale;
47679
-
47680
- if ( json.polygonOffset !== undefined ) material.polygonOffset = json.polygonOffset;
47681
- if ( json.polygonOffsetFactor !== undefined ) material.polygonOffsetFactor = json.polygonOffsetFactor;
47682
- if ( json.polygonOffsetUnits !== undefined ) material.polygonOffsetUnits = json.polygonOffsetUnits;
47683
-
47684
- if ( json.dithering !== undefined ) material.dithering = json.dithering;
47685
-
47686
- if ( json.alphaToCoverage !== undefined ) material.alphaToCoverage = json.alphaToCoverage;
47687
- if ( json.premultipliedAlpha !== undefined ) material.premultipliedAlpha = json.premultipliedAlpha;
47688
- if ( json.forceSinglePass !== undefined ) material.forceSinglePass = json.forceSinglePass;
47689
- if ( json.allowOverride !== undefined ) material.allowOverride = json.allowOverride;
47690
-
47691
- if ( json.visible !== undefined ) material.visible = json.visible;
47692
-
47693
- if ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;
47694
-
47695
- if ( json.userData !== undefined ) material.userData = json.userData;
47696
-
47697
- if ( json.vertexColors !== undefined ) {
47698
-
47699
- if ( typeof json.vertexColors === 'number' ) {
47700
-
47701
- material.vertexColors = json.vertexColors > 0;
47702
-
47703
- } else {
47704
-
47705
- material.vertexColors = json.vertexColors;
47706
-
47707
- }
47708
-
47709
- }
47710
-
47711
- // Shader Material
47712
-
47713
- if ( json.uniforms !== undefined ) {
47714
-
47715
- for ( const name in json.uniforms ) {
47716
-
47717
- const uniform = json.uniforms[ name ];
47718
-
47719
- material.uniforms[ name ] = {};
47720
-
47721
- switch ( uniform.type ) {
47722
-
47723
- case 't':
47724
- material.uniforms[ name ].value = getTexture( uniform.value );
47725
- break;
47726
-
47727
- case 'c':
47728
- material.uniforms[ name ].value = new Color().setHex( uniform.value );
47729
- break;
47730
-
47731
- case 'v2':
47732
- material.uniforms[ name ].value = new Vector2().fromArray( uniform.value );
47733
- break;
47734
-
47735
- case 'v3':
47736
- material.uniforms[ name ].value = new Vector3().fromArray( uniform.value );
47737
- break;
47738
-
47739
- case 'v4':
47740
- material.uniforms[ name ].value = new Vector4().fromArray( uniform.value );
47741
- break;
47742
-
47743
- case 'm3':
47744
- material.uniforms[ name ].value = new Matrix3().fromArray( uniform.value );
47745
- break;
47746
-
47747
- case 'm4':
47748
- material.uniforms[ name ].value = new Matrix4().fromArray( uniform.value );
47749
- break;
47750
-
47751
- default:
47752
- material.uniforms[ name ].value = uniform.value;
47753
-
47754
- }
47755
-
47756
- }
47757
-
47758
- }
47759
-
47760
- if ( json.defines !== undefined ) material.defines = json.defines;
47761
- if ( json.vertexShader !== undefined ) material.vertexShader = json.vertexShader;
47762
- if ( json.fragmentShader !== undefined ) material.fragmentShader = json.fragmentShader;
47763
- if ( json.glslVersion !== undefined ) material.glslVersion = json.glslVersion;
47764
-
47765
- if ( json.extensions !== undefined ) {
47766
-
47767
- for ( const key in json.extensions ) {
47768
-
47769
- material.extensions[ key ] = json.extensions[ key ];
47770
-
47771
- }
47772
-
47773
- }
47774
-
47775
- if ( json.lights !== undefined ) material.lights = json.lights;
47776
- if ( json.clipping !== undefined ) material.clipping = json.clipping;
47777
-
47778
- // for PointsMaterial
47779
-
47780
- if ( json.size !== undefined ) material.size = json.size;
47781
- if ( json.sizeAttenuation !== undefined ) material.sizeAttenuation = json.sizeAttenuation;
47782
-
47783
- // maps
47784
-
47785
- if ( json.map !== undefined ) material.map = getTexture( json.map );
47786
- if ( json.matcap !== undefined ) material.matcap = getTexture( json.matcap );
47787
-
47788
- if ( json.alphaMap !== undefined ) material.alphaMap = getTexture( json.alphaMap );
47789
-
47790
- if ( json.bumpMap !== undefined ) material.bumpMap = getTexture( json.bumpMap );
47791
- if ( json.bumpScale !== undefined ) material.bumpScale = json.bumpScale;
47792
-
47793
- if ( json.normalMap !== undefined ) material.normalMap = getTexture( json.normalMap );
47794
- if ( json.normalMapType !== undefined ) material.normalMapType = json.normalMapType;
47795
- if ( json.normalScale !== undefined ) {
47796
-
47797
- let normalScale = json.normalScale;
47798
-
47799
- if ( Array.isArray( normalScale ) === false ) {
47800
-
47801
- // Blender exporter used to export a scalar. See #7459
47802
-
47803
- normalScale = [ normalScale, normalScale ];
47804
-
47805
- }
47806
-
47807
- material.normalScale = new Vector2().fromArray( normalScale );
47808
-
47809
- }
47810
-
47811
- if ( json.displacementMap !== undefined ) material.displacementMap = getTexture( json.displacementMap );
47812
- if ( json.displacementScale !== undefined ) material.displacementScale = json.displacementScale;
47813
- if ( json.displacementBias !== undefined ) material.displacementBias = json.displacementBias;
47814
-
47815
- if ( json.roughnessMap !== undefined ) material.roughnessMap = getTexture( json.roughnessMap );
47816
- if ( json.metalnessMap !== undefined ) material.metalnessMap = getTexture( json.metalnessMap );
47817
-
47818
- if ( json.emissiveMap !== undefined ) material.emissiveMap = getTexture( json.emissiveMap );
47819
- if ( json.emissiveIntensity !== undefined ) material.emissiveIntensity = json.emissiveIntensity;
47820
-
47821
- if ( json.specularMap !== undefined ) material.specularMap = getTexture( json.specularMap );
47822
- if ( json.specularIntensityMap !== undefined ) material.specularIntensityMap = getTexture( json.specularIntensityMap );
47823
- if ( json.specularColorMap !== undefined ) material.specularColorMap = getTexture( json.specularColorMap );
47824
-
47825
- if ( json.envMap !== undefined ) material.envMap = getTexture( json.envMap );
47826
- if ( json.envMapRotation !== undefined ) material.envMapRotation.fromArray( json.envMapRotation );
47827
- if ( json.envMapIntensity !== undefined ) material.envMapIntensity = json.envMapIntensity;
47828
-
47829
- if ( json.reflectivity !== undefined ) material.reflectivity = json.reflectivity;
47830
- if ( json.refractionRatio !== undefined ) material.refractionRatio = json.refractionRatio;
47831
-
47832
- if ( json.lightMap !== undefined ) material.lightMap = getTexture( json.lightMap );
47833
- if ( json.lightMapIntensity !== undefined ) material.lightMapIntensity = json.lightMapIntensity;
47834
-
47835
- if ( json.aoMap !== undefined ) material.aoMap = getTexture( json.aoMap );
47836
- if ( json.aoMapIntensity !== undefined ) material.aoMapIntensity = json.aoMapIntensity;
47837
-
47838
- if ( json.gradientMap !== undefined ) material.gradientMap = getTexture( json.gradientMap );
47839
-
47840
- if ( json.clearcoatMap !== undefined ) material.clearcoatMap = getTexture( json.clearcoatMap );
47841
- if ( json.clearcoatRoughnessMap !== undefined ) material.clearcoatRoughnessMap = getTexture( json.clearcoatRoughnessMap );
47842
- if ( json.clearcoatNormalMap !== undefined ) material.clearcoatNormalMap = getTexture( json.clearcoatNormalMap );
47843
- if ( json.clearcoatNormalScale !== undefined ) material.clearcoatNormalScale = new Vector2().fromArray( json.clearcoatNormalScale );
47844
-
47845
- if ( json.iridescenceMap !== undefined ) material.iridescenceMap = getTexture( json.iridescenceMap );
47846
- if ( json.iridescenceThicknessMap !== undefined ) material.iridescenceThicknessMap = getTexture( json.iridescenceThicknessMap );
47847
-
47848
- if ( json.transmissionMap !== undefined ) material.transmissionMap = getTexture( json.transmissionMap );
47849
- if ( json.thicknessMap !== undefined ) material.thicknessMap = getTexture( json.thicknessMap );
47850
-
47851
- if ( json.anisotropyMap !== undefined ) material.anisotropyMap = getTexture( json.anisotropyMap );
47852
-
47853
- if ( json.sheenColorMap !== undefined ) material.sheenColorMap = getTexture( json.sheenColorMap );
47854
- if ( json.sheenRoughnessMap !== undefined ) material.sheenRoughnessMap = getTexture( json.sheenRoughnessMap );
48098
+ material.fromJSON( json, this.textures );
47855
48099
 
47856
48100
  return material;
47857
48101
 
@@ -47910,10 +48154,40 @@ class MaterialLoader extends Loader {
47910
48154
  MeshMatcapMaterial,
47911
48155
  LineDashedMaterial,
47912
48156
  LineBasicMaterial,
47913
- Material
48157
+ Material,
48158
+ ... _customMaterials
47914
48159
  };
47915
48160
 
47916
- return new materialLib[ type ]();
48161
+ const MaterialType = materialLib[ type ];
48162
+
48163
+ let materialInstance;
48164
+
48165
+ if ( MaterialType === undefined ) {
48166
+
48167
+ warnOnce( `MaterialLoader: Unknown material type "${ type }". Use .registerMaterial() before starting the deserialization process.` );
48168
+ materialInstance = new Material();
48169
+
48170
+ } else {
48171
+
48172
+ materialInstance = new MaterialType();
48173
+
48174
+ }
48175
+
48176
+ return materialInstance;
48177
+
48178
+ }
48179
+
48180
+ /**
48181
+ * Registers the given material at the internal
48182
+ * material library.
48183
+ *
48184
+ * @static
48185
+ * @param {string} type - The material type.
48186
+ * @param {Material.constructor} materialClass - The material class.
48187
+ */
48188
+ static registerMaterial( type, materialClass ) {
48189
+
48190
+ _customMaterials[ type ] = materialClass;
47917
48191
 
47918
48192
  }
47919
48193
 
@@ -48379,7 +48653,7 @@ class ObjectLoader extends Loader {
48379
48653
 
48380
48654
  } catch ( e ) {
48381
48655
 
48382
- throw new Error( 'ObjectLoader: Can\'t parse ' + url + '. ' + e.message );
48656
+ throw new Error( 'THREE.ObjectLoader: Can\'t parse ' + url + '. ' + e.message );
48383
48657
 
48384
48658
  }
48385
48659
 
@@ -48658,6 +48932,8 @@ class ObjectLoader extends Loader {
48658
48932
 
48659
48933
  function loadImage( url ) {
48660
48934
 
48935
+ url = scope.manager.resolveURL( url );
48936
+
48661
48937
  scope.manager.itemStart( url );
48662
48938
 
48663
48939
  return loader.load( url, function () {
@@ -49995,8 +50271,11 @@ class StereoCamera {
49995
50271
 
49996
50272
  }
49997
50273
 
49998
- this.cameraL.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeLeft );
49999
- this.cameraR.matrixWorld.copy( camera.matrixWorld ).multiply( _eyeRight );
50274
+ this.cameraL.matrix.copy( camera.matrixWorld ).multiply( _eyeLeft );
50275
+ this.cameraL.matrixWorldNeedsUpdate = true;
50276
+
50277
+ this.cameraR.matrix.copy( camera.matrixWorld ).multiply( _eyeRight );
50278
+ this.cameraR.matrixWorldNeedsUpdate = true;
50000
50279
 
50001
50280
  }
50002
50281
 
@@ -52413,7 +52692,7 @@ class PropertyBinding {
52413
52692
 
52414
52693
  if ( matches === null ) {
52415
52694
 
52416
- throw new Error( 'PropertyBinding: Cannot parse trackName: ' + trackName );
52695
+ throw new Error( 'THREE.PropertyBinding: Cannot parse trackName: ' + trackName );
52417
52696
 
52418
52697
  }
52419
52698
 
@@ -52447,7 +52726,7 @@ class PropertyBinding {
52447
52726
 
52448
52727
  if ( results.propertyName === null || results.propertyName.length === 0 ) {
52449
52728
 
52450
- throw new Error( 'PropertyBinding: can not parse propertyName from trackName: ' + trackName );
52729
+ throw new Error( 'THREE.PropertyBinding: can not parse propertyName from trackName: ' + trackName );
52451
52730
 
52452
52731
  }
52453
52732
 
@@ -53438,15 +53717,6 @@ class AnimationAction {
53438
53717
 
53439
53718
  const interpolant = tracks[ i ].createInterpolant( null );
53440
53719
  interpolants[ i ] = interpolant;
53441
-
53442
- // preserve interpolant settings (like tangent data from BezierInterpolant)
53443
-
53444
- if ( interpolant.settings ) {
53445
-
53446
- Object.assign( interpolantSettings, interpolant.settings );
53447
-
53448
- }
53449
-
53450
53720
  interpolant.settings = interpolantSettings;
53451
53721
 
53452
53722
  }
@@ -53462,6 +53732,7 @@ class AnimationAction {
53462
53732
  this._byClipCacheIndex = null; // for the memory manager
53463
53733
 
53464
53734
  this._timeScaleInterpolant = null;
53735
+ this._restoreTimeScale = null;
53465
53736
  this._weightInterpolant = null;
53466
53737
 
53467
53738
  /**
@@ -53749,6 +54020,10 @@ class AnimationAction {
53749
54020
  startEndRatio = fadeOutDuration / fadeInDuration,
53750
54021
  endStartRatio = fadeInDuration / fadeOutDuration;
53751
54022
 
54023
+
54024
+ fadeOutAction._restoreTimeScale = fadeOutAction.timeScale;
54025
+ this._restoreTimeScale = this.timeScale;
54026
+
53752
54027
  fadeOutAction.warp( 1.0, startEndRatio, duration );
53753
54028
  this.warp( endStartRatio, 1.0, duration );
53754
54029
 
@@ -53917,6 +54192,8 @@ class AnimationAction {
53917
54192
 
53918
54193
  }
53919
54194
 
54195
+ this._restoreTimeScale = null;
54196
+
53920
54197
  return this;
53921
54198
 
53922
54199
  }
@@ -54089,8 +54366,6 @@ class AnimationAction {
54089
54366
 
54090
54367
  if ( time > interpolant.parameterPositions[ 1 ] ) {
54091
54368
 
54092
- this.stopWarping();
54093
-
54094
54369
  if ( timeScale === 0 ) {
54095
54370
 
54096
54371
  // motion has halted, pause
@@ -54098,11 +54373,19 @@ class AnimationAction {
54098
54373
 
54099
54374
  } else {
54100
54375
 
54376
+ if ( this._restoreTimeScale !== null ) {
54377
+
54378
+ timeScale = this._restoreTimeScale;
54379
+
54380
+ }
54381
+
54101
54382
  // warp done - apply final time scale
54102
54383
  this.timeScale = timeScale;
54103
54384
 
54104
54385
  }
54105
54386
 
54387
+ this.stopWarping();
54388
+
54106
54389
  }
54107
54390
 
54108
54391
  }
@@ -55815,7 +56098,7 @@ class Raycaster {
55815
56098
 
55816
56099
  } else if ( camera.isOrthographicCamera ) {
55817
56100
 
55818
- this.ray.origin.set( coords.x, coords.y, ( camera.near + camera.far ) / ( camera.near - camera.far ) ).unproject( camera ); // set origin in plane of camera
56101
+ this.ray.origin.set( coords.x, coords.y, camera.projectionMatrix.elements[ 14 ] ).unproject( camera ); // set origin in plane of camera
55819
56102
  this.ray.direction.set( 0, 0, -1 ).transformDirection( camera.matrixWorld );
55820
56103
  this.camera = camera;
55821
56104
 
@@ -57303,7 +57586,7 @@ class SpotLightHelper extends Object3D {
57303
57586
 
57304
57587
  }
57305
57588
 
57306
- this.matrixWorld.copy( this.light.matrixWorld );
57589
+ this.matrixWorldNeedsUpdate = true;
57307
57590
 
57308
57591
  const coneLength = this.light.distance ? this.light.distance : 1000;
57309
57592
  const coneWidth = coneLength * Math.tan( this.light.angle );
@@ -57586,6 +57869,8 @@ class PointLightHelper extends Mesh {
57586
57869
  */
57587
57870
  update() {
57588
57871
 
57872
+ this.matrixWorldNeedsUpdate = true;
57873
+
57589
57874
  this.light.updateWorldMatrix( true, false );
57590
57875
 
57591
57876
  if ( this.color !== undefined ) {
@@ -57729,6 +58014,8 @@ class HemisphereLightHelper extends Object3D {
57729
58014
 
57730
58015
  }
57731
58016
 
58017
+ this.matrixWorldNeedsUpdate = true;
58018
+
57732
58019
  this.light.updateWorldMatrix( true, false );
57733
58020
 
57734
58021
  mesh.lookAt( _vector$1.setFromMatrixPosition( this.light.matrixWorld ).negate() );
@@ -58040,6 +58327,8 @@ class DirectionalLightHelper extends Object3D {
58040
58327
  */
58041
58328
  update() {
58042
58329
 
58330
+ this.matrixWorldNeedsUpdate = true;
58331
+
58043
58332
  this.light.updateWorldMatrix( true, false );
58044
58333
  this.light.target.updateWorldMatrix( true, false );
58045
58334
 
@@ -58993,6 +59282,14 @@ class ShapePath {
58993
59282
  */
58994
59283
  this.currentPath = null;
58995
59284
 
59285
+ /**
59286
+ * An object that can be used to store custom data about the shape path.
59287
+ * Mainly used by SVGLoader to store style information.
59288
+ *
59289
+ * @type {Object}
59290
+ */
59291
+ this.userData = {};
59292
+
58996
59293
  }
58997
59294
 
58998
59295
  /**
@@ -59084,235 +59381,213 @@ class ShapePath {
59084
59381
  /**
59085
59382
  * Converts the paths into an array of shapes.
59086
59383
  *
59087
- * @param {boolean} isCCW - By default solid shapes are defined clockwise (CW) and holes are defined counterclockwise (CCW).
59088
- * If this flag is set to `true`, then those are flipped.
59089
59384
  * @return {Array<Shape>} An array of shapes.
59090
59385
  */
59091
- toShapes( isCCW ) {
59092
-
59093
- function toShapesNoHoles( inSubpaths ) {
59094
-
59095
- const shapes = [];
59386
+ toShapes() {
59096
59387
 
59097
- for ( let i = 0, l = inSubpaths.length; i < l; i ++ ) {
59388
+ // Point-in-polygon test using the even-odd ray-casting rule. Valid for
59389
+ // simple (non self-intersecting) polygons.
59390
+ function pointInPolygon( p, polygon ) {
59098
59391
 
59099
- const tmpPath = inSubpaths[ i ];
59100
-
59101
- const tmpShape = new Shape();
59102
- tmpShape.curves = tmpPath.curves;
59103
-
59104
- shapes.push( tmpShape );
59105
-
59106
- }
59107
-
59108
- return shapes;
59109
-
59110
- }
59111
-
59112
- function isPointInsidePolygon( inPt, inPolygon ) {
59113
-
59114
- const polyLen = inPolygon.length;
59115
-
59116
- // inPt on polygon contour => immediate success or
59117
- // toggling of inside/outside at every single! intersection point of an edge
59118
- // with the horizontal line through inPt, left of inPt
59119
- // not counting lowerY endpoints of edges and whole edges on that line
59120
59392
  let inside = false;
59121
- for ( let p = polyLen - 1, q = 0; q < polyLen; p = q ++ ) {
59393
+ const n = polygon.length;
59122
59394
 
59123
- let edgeLowPt = inPolygon[ p ];
59124
- let edgeHighPt = inPolygon[ q ];
59395
+ for ( let i = 0, j = n - 1; i < n; j = i ++ ) {
59125
59396
 
59126
- let edgeDx = edgeHighPt.x - edgeLowPt.x;
59127
- let edgeDy = edgeHighPt.y - edgeLowPt.y;
59397
+ const a = polygon[ i ];
59398
+ const b = polygon[ j ];
59128
59399
 
59129
- if ( Math.abs( edgeDy ) > Number.EPSILON ) {
59400
+ if ( ( a.y > p.y ) !== ( b.y > p.y ) &&
59401
+ p.x < ( b.x - a.x ) * ( p.y - a.y ) / ( b.y - a.y ) + a.x ) {
59130
59402
 
59131
- // not parallel
59132
- if ( edgeDy < 0 ) {
59133
-
59134
- edgeLowPt = inPolygon[ q ]; edgeDx = - edgeDx;
59135
- edgeHighPt = inPolygon[ p ]; edgeDy = - edgeDy;
59136
-
59137
- }
59138
-
59139
- if ( ( inPt.y < edgeLowPt.y ) || ( inPt.y > edgeHighPt.y ) ) continue;
59140
-
59141
- if ( inPt.y === edgeLowPt.y ) {
59142
-
59143
- if ( inPt.x === edgeLowPt.x ) return true; // inPt is on contour ?
59144
- // continue; // no intersection or edgeLowPt => doesn't count !!!
59145
-
59146
- } else {
59147
-
59148
- const perpEdge = edgeDy * ( inPt.x - edgeLowPt.x ) - edgeDx * ( inPt.y - edgeLowPt.y );
59149
- if ( perpEdge === 0 ) return true; // inPt is on contour ?
59150
- if ( perpEdge < 0 ) continue;
59151
- inside = ! inside; // true intersection left of inPt
59152
-
59153
- }
59154
-
59155
- } else {
59156
-
59157
- // parallel or collinear
59158
- if ( inPt.y !== edgeLowPt.y ) continue; // parallel
59159
- // edge lies on the same horizontal line as inPt
59160
- if ( ( ( edgeHighPt.x <= inPt.x ) && ( inPt.x <= edgeLowPt.x ) ) ||
59161
- ( ( edgeLowPt.x <= inPt.x ) && ( inPt.x <= edgeHighPt.x ) ) ) return true; // inPt: Point on contour !
59162
- // continue;
59403
+ inside = ! inside;
59163
59404
 
59164
59405
  }
59165
59406
 
59166
59407
  }
59167
59408
 
59168
- return inside;
59409
+ return inside;
59169
59410
 
59170
59411
  }
59171
59412
 
59172
- const isClockWise = ShapeUtils.isClockWise;
59173
-
59174
- const subPaths = this.subPaths;
59175
- if ( subPaths.length === 0 ) return [];
59176
-
59177
- let solid, tmpPath, tmpShape;
59178
- const shapes = [];
59179
-
59180
- if ( subPaths.length === 1 ) {
59413
+ // Returns a point guaranteed to be strictly inside the given simple
59414
+ // polygon. First tries the bounding-box center; if that falls outside
59415
+ // the polygon, casts a horizontal ray at the center's y and picks the
59416
+ // midpoint between the first two sorted intercepts.
59417
+ //
59418
+ // Port of paper.js' Path#getInteriorPoint()
59419
+ // https://github.com/paperjs/paper.js/blob/develop/src/path/PathItem.Boolean.js
59420
+ function getInteriorPoint( polygon, boundingBox ) {
59181
59421
 
59182
- tmpPath = subPaths[ 0 ];
59183
- tmpShape = new Shape();
59184
- tmpShape.curves = tmpPath.curves;
59185
- shapes.push( tmpShape );
59186
- return shapes;
59422
+ const point = boundingBox.getCenter( new Vector2() );
59187
59423
 
59188
- }
59424
+ if ( pointInPolygon( point, polygon ) ) return point;
59189
59425
 
59190
- let holesFirst = ! isClockWise( subPaths[ 0 ].getPoints() );
59191
- holesFirst = isCCW ? ! holesFirst : holesFirst;
59426
+ const y = point.y;
59427
+ const intercepts = [];
59428
+ const n = polygon.length;
59192
59429
 
59193
- // log("Holes first", holesFirst);
59430
+ for ( let i = 0; i < n; i ++ ) {
59194
59431
 
59195
- const betterShapeHoles = [];
59196
- const newShapes = [];
59197
- let newShapeHoles = [];
59198
- let mainIdx = 0;
59199
- let tmpPoints;
59432
+ const a = polygon[ i ];
59433
+ const b = polygon[ ( i + 1 ) % n ];
59200
59434
 
59201
- newShapes[ mainIdx ] = undefined;
59202
- newShapeHoles[ mainIdx ] = [];
59435
+ // Half-open crossing rule — counts each vertex exactly once and
59436
+ // skips horizontal edges.
59437
+ if ( ( a.y > y ) !== ( b.y > y ) ) {
59203
59438
 
59204
- for ( let i = 0, l = subPaths.length; i < l; i ++ ) {
59439
+ const x = a.x + ( y - a.y ) * ( b.x - a.x ) / ( b.y - a.y );
59440
+ intercepts.push( x );
59205
59441
 
59206
- tmpPath = subPaths[ i ];
59207
- tmpPoints = tmpPath.getPoints();
59208
- solid = isClockWise( tmpPoints );
59209
- solid = isCCW ? ! solid : solid;
59442
+ }
59210
59443
 
59211
- if ( solid ) {
59444
+ }
59212
59445
 
59213
- if ( ( ! holesFirst ) && ( newShapes[ mainIdx ] ) ) mainIdx ++;
59446
+ if ( intercepts.length > 1 ) {
59214
59447
 
59215
- newShapes[ mainIdx ] = { s: new Shape(), p: tmpPoints };
59216
- newShapes[ mainIdx ].s.curves = tmpPath.curves;
59448
+ intercepts.sort( ( a, b ) => a - b );
59449
+ point.x = ( intercepts[ 0 ] + intercepts[ 1 ] ) / 2;
59217
59450
 
59218
- if ( holesFirst ) mainIdx ++;
59219
- newShapeHoles[ mainIdx ] = [];
59451
+ }
59220
59452
 
59221
- //log('cw', i);
59453
+ return point;
59222
59454
 
59223
- } else {
59455
+ }
59224
59456
 
59225
- newShapeHoles[ mainIdx ].push( { h: tmpPath, p: tmpPoints[ 0 ] } );
59457
+ // Resolve fill-rule. Defaults to 'nonzero'.
59458
+ let fillRule = ( this.userData.style && this.userData.style.fillRule ) || 'nonzero';
59226
59459
 
59227
- //log('ccw', i);
59460
+ if ( fillRule !== 'nonzero' && fillRule !== 'evenodd' ) {
59228
59461
 
59229
- }
59462
+ warn( 'Fill-rule "' + fillRule + '" is not supported, falling back to "nonzero".' );
59463
+ fillRule = 'nonzero';
59230
59464
 
59231
59465
  }
59232
59466
 
59233
- // only Holes? -> probably all Shapes with wrong orientation
59234
- if ( ! newShapes[ 0 ] ) return toShapesNoHoles( subPaths );
59467
+ // Predicate that decides whether a winding number falls inside the fill
59468
+ // region, per the SVG fill-rule spec. Works for negative windings too,
59469
+ // because JavaScript's bitwise AND preserves odd/even under two's
59470
+ // complement.
59471
+ const isInside = fillRule === 'nonzero'
59472
+ ? ( w => w !== 0 )
59473
+ : ( w => ( w & 1 ) !== 0 );
59235
59474
 
59475
+ // Build an entry per usable subpath. Self-winding follows the standard
59476
+ // convention used by ShapeUtils: counter-clockwise (signed area > 0)
59477
+ // contributes +1 to the winding number at an interior point,
59478
+ // clockwise contributes -1.
59479
+ const entries = [];
59236
59480
 
59237
- if ( newShapes.length > 1 ) {
59481
+ for ( const subPath of this.subPaths ) {
59238
59482
 
59239
- let ambiguous = false;
59240
- let toChange = 0;
59483
+ const points = subPath.getPoints();
59484
+ if ( points.length < 3 ) continue;
59241
59485
 
59242
- for ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
59486
+ const area = ShapeUtils.area( points );
59487
+ if ( area === 0 ) continue;
59243
59488
 
59244
- betterShapeHoles[ sIdx ] = [];
59489
+ const boundingBox = new Box2();
59490
+ for ( let i = 0; i < points.length; i ++ ) boundingBox.expandByPoint( points[ i ] );
59245
59491
 
59246
- }
59247
-
59248
- for ( let sIdx = 0, sLen = newShapes.length; sIdx < sLen; sIdx ++ ) {
59492
+ entries.push( {
59493
+ subPath: subPath,
59494
+ points: points,
59495
+ boundingBox: boundingBox,
59496
+ interiorPoint: getInteriorPoint( points, boundingBox ),
59497
+ absArea: Math.abs( area ),
59498
+ winding: area < 0 ? -1 : 1,
59499
+ container: null,
59500
+ exclude: false,
59501
+ role: null
59502
+ } );
59249
59503
 
59250
- const sho = newShapeHoles[ sIdx ];
59504
+ }
59251
59505
 
59252
- for ( let hIdx = 0; hIdx < sho.length; hIdx ++ ) {
59506
+ // Sort by area descending. This guarantees that any subpath that could
59507
+ // contain `entries[i]` is located at a smaller index and has already
59508
+ // been processed when it's entries[i]'s turn. Port of paper.js'
59509
+ // reorientPaths() algorithm.
59510
+ entries.sort( ( a, b ) => b.absArea - a.absArea );
59253
59511
 
59254
- const ho = sho[ hIdx ];
59255
- let hole_unassigned = true;
59512
+ // Walk already-processed entries from closest-in-size to largest,
59513
+ // stopping at the innermost container. Accumulate the container's
59514
+ // cumulative winding into this entry's winding so that the final value
59515
+ // equals the winding number at this entry's interior point.
59516
+ //
59517
+ // A subpath only contributes to the fill boundary when crossing it
59518
+ // actually flips the "insideness" per the fill rule; otherwise it's a
59519
+ // redundant overlap and gets excluded to avoid double-counting.
59520
+ for ( let i = 0; i < entries.length; i ++ ) {
59256
59521
 
59257
- for ( let s2Idx = 0; s2Idx < newShapes.length; s2Idx ++ ) {
59522
+ const entry = entries[ i ];
59523
+ let containerWinding = 0;
59258
59524
 
59259
- if ( isPointInsidePolygon( ho.p, newShapes[ s2Idx ].p ) ) {
59525
+ for ( let j = i - 1; j >= 0; j -- ) {
59260
59526
 
59261
- if ( sIdx !== s2Idx ) toChange ++;
59527
+ const candidate = entries[ j ];
59262
59528
 
59263
- if ( hole_unassigned ) {
59529
+ if ( ! candidate.boundingBox.containsBox( entry.boundingBox ) ) continue;
59530
+ if ( ! pointInPolygon( entry.interiorPoint, candidate.points ) ) continue;
59264
59531
 
59265
- hole_unassigned = false;
59266
- betterShapeHoles[ s2Idx ].push( ho );
59532
+ entry.container = candidate.exclude ? candidate.container : candidate;
59533
+ containerWinding = candidate.winding;
59534
+ entry.winding += containerWinding;
59535
+ break;
59267
59536
 
59268
- } else {
59537
+ }
59269
59538
 
59270
- ambiguous = true;
59539
+ if ( isInside( entry.winding ) === isInside( containerWinding ) ) {
59271
59540
 
59272
- }
59541
+ entry.exclude = true;
59273
59542
 
59274
- }
59275
-
59276
- }
59543
+ }
59277
59544
 
59278
- if ( hole_unassigned ) {
59545
+ }
59279
59546
 
59280
- betterShapeHoles[ sIdx ].push( ho );
59547
+ // Classify retained entries. An entry is an outer shape if it has no
59548
+ // container or if its container is itself a hole (a solid nested inside
59549
+ // a hole becomes a new top-level shape); otherwise it's a hole in its
59550
+ // container. Entries were already sorted outermost-first, so each
59551
+ // container's role is known by the time we look at it.
59552
+ for ( const entry of entries ) {
59281
59553
 
59282
- }
59554
+ if ( entry.exclude ) continue;
59555
+ entry.role = ( entry.container === null || entry.container.role === 'hole' ) ? 'outer' : 'hole';
59283
59556
 
59284
- }
59557
+ }
59285
59558
 
59286
- }
59559
+ // Build Shapes for outers first, then attach holes to their container's
59560
+ // Shape.
59561
+ const shapes = [];
59562
+ const shapeByEntry = new Map();
59287
59563
 
59288
- if ( toChange > 0 && ambiguous === false ) {
59564
+ for ( const entry of entries ) {
59289
59565
 
59290
- newShapeHoles = betterShapeHoles;
59566
+ if ( entry.exclude || entry.role !== 'outer' ) continue;
59291
59567
 
59292
- }
59568
+ const shape = new Shape();
59569
+ shape.curves = entry.subPath.curves;
59570
+ shapes.push( shape );
59571
+ shapeByEntry.set( entry, shape );
59293
59572
 
59294
59573
  }
59295
59574
 
59296
- let tmpHoles;
59297
-
59298
- for ( let i = 0, il = newShapes.length; i < il; i ++ ) {
59575
+ for ( const entry of entries ) {
59299
59576
 
59300
- tmpShape = newShapes[ i ].s;
59301
- shapes.push( tmpShape );
59302
- tmpHoles = newShapeHoles[ i ];
59577
+ if ( entry.exclude || entry.role !== 'hole' ) continue;
59303
59578
 
59304
- for ( let j = 0, jl = tmpHoles.length; j < jl; j ++ ) {
59579
+ const shape = shapeByEntry.get( entry.container );
59580
+ if ( ! shape ) continue;
59305
59581
 
59306
- tmpShape.holes.push( tmpHoles[ j ].h );
59307
-
59308
- }
59582
+ const hole = new Path();
59583
+ hole.curves = entry.subPath.curves;
59584
+ shape.holes.push( hole );
59309
59585
 
59310
59586
  }
59311
59587
 
59312
- //log("shape", shapes);
59313
-
59314
59588
  return shapes;
59315
59589
 
59590
+
59316
59591
  }
59317
59592
 
59318
59593
  }
@@ -59657,7 +59932,7 @@ function getTextureTypeByteLength( type ) {
59657
59932
 
59658
59933
  }
59659
59934
 
59660
- throw new Error( `Unknown texture type ${type}.` );
59935
+ throw new Error( `THREE.TextureUtils: Unknown texture type ${type}.` );
59661
59936
 
59662
59937
  }
59663
59938