@gnsx/three 0.185.16 → 0.186.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (418) hide show
  1. package/build/three.cjs +10 -82600
  2. package/build/three.core.js +1309 -807
  3. package/build/three.module.js +439 -338
  4. package/build/three.tsl.js +74 -44
  5. package/build/three.webgpu.js +6036 -2184
  6. package/build/three.webgpu.nodes.js +6020 -2184
  7. package/examples/jsm/Addons.js +6 -6
  8. package/examples/jsm/controls/ArcballControls.js +1 -1
  9. package/examples/jsm/controls/FirstPersonControls.js +44 -20
  10. package/examples/jsm/controls/OrbitControls.js +9 -0
  11. package/examples/jsm/controls/TrackballControls.js +109 -4
  12. package/examples/jsm/csm/CSMShadowNode.js +13 -0
  13. package/examples/jsm/exporters/GLTFExporter.js +23 -7
  14. package/examples/jsm/exporters/USDZExporter.js +2 -2
  15. package/examples/jsm/generators/CityGenerator.js +377 -45
  16. package/examples/jsm/generators/ForestGenerator.js +12 -12
  17. package/examples/jsm/generators/TerrainGenerator.js +49 -37
  18. package/examples/jsm/generators/TreeGenerator.js +70 -76
  19. package/examples/jsm/generators/city/BenchGenerator.js +127 -0
  20. package/examples/jsm/generators/city/CarGenerator.js +479 -0
  21. package/examples/jsm/generators/city/CityGeneratorUtils.js +31 -0
  22. package/examples/jsm/generators/city/HydrantGenerator.js +106 -0
  23. package/examples/jsm/generators/city/InstancedMeshGenerator.js +86 -0
  24. package/examples/jsm/generators/city/PersonGenerator.js +447 -0
  25. package/examples/jsm/generators/city/SidewalkGenerator.js +33 -38
  26. package/examples/jsm/generators/city/SkyscraperGenerator.js +448 -48
  27. package/examples/jsm/generators/city/StreetTreeGenerator.js +231 -0
  28. package/examples/jsm/generators/city/StreetlightGenerator.js +100 -0
  29. package/examples/jsm/generators/city/TrafficlightGenerator.js +106 -0
  30. package/examples/jsm/generators/city/TrashcanGenerator.js +100 -0
  31. package/examples/jsm/geometries/BoxLineGeometry.js +1 -1
  32. package/examples/jsm/geometries/ParametricGeometry.js +1 -1
  33. package/examples/jsm/geometries/RoundedBoxGeometry.js +1 -1
  34. package/examples/jsm/gpgpu/CountingSort.js +271 -0
  35. package/examples/jsm/helpers/LightProbeGridHelper.js +60 -239
  36. package/examples/jsm/helpers/LightProbeGridHelperWebGL.js +221 -0
  37. package/examples/jsm/inspector/Extension.js +94 -0
  38. package/examples/jsm/inspector/Inspector.js +145 -41
  39. package/examples/jsm/inspector/RendererInspector.js +100 -52
  40. package/examples/jsm/inspector/extensions/color-grading/ColorGrading.js +2609 -0
  41. package/examples/jsm/inspector/extensions/color-grading/ColorWheel.js +352 -0
  42. package/examples/jsm/inspector/extensions/color-grading/CurveEditor.js +599 -0
  43. package/examples/jsm/inspector/extensions/color-grading/LUT3DStyle.js +1201 -0
  44. package/examples/jsm/inspector/extensions/color-grading/LUTMath.js +788 -0
  45. package/examples/jsm/inspector/extensions/color-grading/modules/BrightnessModule.js +72 -0
  46. package/examples/jsm/inspector/extensions/color-grading/modules/ColorWheelModule.js +112 -0
  47. package/examples/jsm/inspector/extensions/color-grading/modules/ContrastModule.js +82 -0
  48. package/examples/jsm/inspector/extensions/color-grading/modules/CurvesModule.js +109 -0
  49. package/examples/jsm/inspector/extensions/color-grading/modules/ExposureHueModule.js +110 -0
  50. package/examples/jsm/inspector/extensions/color-grading/modules/ExposureModule.js +73 -0
  51. package/examples/jsm/inspector/extensions/color-grading/modules/HueModule.js +78 -0
  52. package/examples/jsm/inspector/extensions/color-grading/modules/ImportedCubeModule.js +89 -0
  53. package/examples/jsm/inspector/extensions/color-grading/modules/Module.js +285 -0
  54. package/examples/jsm/inspector/extensions/color-grading/modules/OutputModule.js +101 -0
  55. package/examples/jsm/inspector/extensions/color-grading/modules/RendererModule.js +225 -0
  56. package/examples/jsm/inspector/extensions/color-grading/modules/SatVibranceModule.js +102 -0
  57. package/examples/jsm/inspector/extensions/color-grading/modules/SaturationModule.js +76 -0
  58. package/examples/jsm/inspector/extensions/color-grading/modules/VibranceModule.js +76 -0
  59. package/examples/jsm/inspector/extensions/color-grading/modules/WhiteBalanceModule.js +86 -0
  60. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphEditor.js +26 -31
  61. package/examples/jsm/inspector/extensions/tsl-graph/TSLGraphLoader.js +1 -0
  62. package/examples/jsm/inspector/tabs/Memory.js +0 -2
  63. package/examples/jsm/inspector/tabs/Settings.js +4 -0
  64. package/examples/jsm/inspector/tabs/Timeline.js +223 -171
  65. package/examples/jsm/inspector/tabs/Viewer.js +515 -21
  66. package/examples/jsm/inspector/ui/List.js +15 -9
  67. package/examples/jsm/inspector/ui/Profiler.js +170 -14
  68. package/examples/jsm/inspector/ui/Style.js +269 -23
  69. package/examples/jsm/inspector/ui/Tab.js +2 -0
  70. package/examples/jsm/inspector/ui/Values.js +14 -2
  71. package/examples/jsm/interactive/HTMLMesh.js +19 -3
  72. package/examples/jsm/lighting/LightProbeGrid.js +484 -889
  73. package/examples/jsm/lighting/LightProbeGridUtils.js +107 -0
  74. package/examples/jsm/lighting/LightProbeGridWebGL.js +841 -0
  75. package/examples/jsm/lighting/vxgi/VXGIConeTracer.js +194 -0
  76. package/examples/jsm/lighting/vxgi/VXGINode.js +660 -0
  77. package/examples/jsm/lighting/vxgi/VXGISceneCollector.js +478 -0
  78. package/examples/jsm/lighting/vxgi/VXGIVolume.js +1430 -0
  79. package/examples/jsm/lights/SunLight.js +95 -0
  80. package/examples/jsm/lights/SunLightNode.js +56 -0
  81. package/examples/jsm/lights/SunLightShadow.js +319 -0
  82. package/examples/jsm/lights/SunShadowNode.js +312 -0
  83. package/examples/jsm/loaders/3DMLoader.js +150 -49
  84. package/examples/jsm/loaders/3MFLoader.js +202 -1
  85. package/examples/jsm/loaders/FBXLoader.js +81 -5
  86. package/examples/jsm/loaders/GLTFGaussianSplatLoaderExtension.js +330 -0
  87. package/examples/jsm/loaders/GLTFLoader.js +79 -14
  88. package/examples/jsm/loaders/GaussianSplatPLYLoader.js +386 -0
  89. package/examples/jsm/loaders/KSPLATLoader.js +463 -0
  90. package/examples/jsm/loaders/MaterialXLoader.js +111 -1010
  91. package/examples/jsm/loaders/PCDLoader.js +1 -1
  92. package/examples/jsm/loaders/SPLATLoader.js +139 -0
  93. package/examples/jsm/loaders/SPZLoader.js +561 -0
  94. package/examples/jsm/loaders/materialx/MaterialXArchive.js +108 -0
  95. package/examples/jsm/loaders/materialx/MaterialXDocument.js +878 -0
  96. package/examples/jsm/loaders/materialx/MaterialXHextile.js +183 -0
  97. package/examples/jsm/loaders/materialx/MaterialXInterfaceValidation.js +376 -0
  98. package/examples/jsm/loaders/materialx/MaterialXLog.js +75 -0
  99. package/examples/jsm/loaders/materialx/MaterialXNodeInterfaceRegistry.js +4 -0
  100. package/examples/jsm/loaders/materialx/MaterialXNodeLibrary.js +1021 -0
  101. package/examples/jsm/loaders/materialx/MaterialXSurfaceMappings.js +661 -0
  102. package/examples/jsm/loaders/materialx/MaterialXUtils.js +57 -0
  103. package/examples/jsm/loaders/materialx/compile/MaterialXCompileRegistry.js +997 -0
  104. package/examples/jsm/loaders/materialx/parse/MaterialXParser.js +28 -0
  105. package/examples/jsm/loaders/usd/USDAParser.js +15 -2
  106. package/examples/jsm/loaders/usd/USDCParser.js +1 -4
  107. package/examples/jsm/loaders/usd/USDComposer.js +80 -42
  108. package/examples/jsm/materials/WoodNodeMaterial.js +6 -108
  109. package/examples/jsm/misc/RollerCoaster.js +2 -2
  110. package/examples/jsm/misc/SculptGL.LICENSE.txt +21 -0
  111. package/examples/jsm/misc/Sculptor.js +1679 -0
  112. package/examples/jsm/misc/SculptorMesh.js +1504 -0
  113. package/examples/jsm/misc/SculptorTools.js +1180 -0
  114. package/examples/jsm/misc/SculptorUtils.js +345 -0
  115. package/examples/jsm/misc/TubePainter.js +28 -16
  116. package/examples/jsm/misc/VolumeSlice.js +24 -24
  117. package/examples/jsm/modifiers/SimplifyModifier.js +63 -556
  118. package/examples/jsm/objects/GaussianSplat.js +1039 -0
  119. package/examples/jsm/objects/Sky.js +66 -45
  120. package/examples/jsm/objects/SkyMesh.js +70 -51
  121. package/examples/jsm/physics/JoltPhysics.js +1 -1
  122. package/examples/jsm/postprocessing/AfterimagePass.js +4 -2
  123. package/examples/jsm/postprocessing/BloomPass.js +2 -2
  124. package/examples/jsm/postprocessing/GTAOPass.js +1 -1
  125. package/examples/jsm/postprocessing/OutlinePass.js +5 -5
  126. package/examples/jsm/postprocessing/SAOPass.js +1 -1
  127. package/examples/jsm/postprocessing/SSAOPass.js +1 -1
  128. package/examples/jsm/postprocessing/SSRPass.js +4 -2
  129. package/examples/jsm/postprocessing/SavePass.js +1 -1
  130. package/examples/jsm/postprocessing/TAARenderPass.js +1 -1
  131. package/examples/jsm/postprocessing/UnrealBloomPass.js +30 -13
  132. package/examples/jsm/renderers/CSS2DRenderer.js +29 -5
  133. package/examples/jsm/shaders/DepthLimitedBlurShader.js +4 -1
  134. package/examples/jsm/shaders/ExposureShader.js +1 -1
  135. package/examples/jsm/shaders/FilmShader.js +2 -1
  136. package/examples/jsm/transpiler/AST.js +21 -2
  137. package/examples/jsm/transpiler/GLSLDecoder.js +498 -8
  138. package/examples/jsm/transpiler/TSLEncoder.js +82 -10
  139. package/examples/jsm/transpiler/WGSLEncoder.js +33 -4
  140. package/examples/jsm/tsl/WebGLNodesHandler.js +29 -39
  141. package/examples/jsm/tsl/display/AfterImageNode.js +2 -0
  142. package/examples/jsm/tsl/display/AnaglyphPassNode.js +3 -2
  143. package/examples/jsm/tsl/display/BilateralBlurNode.js +5 -2
  144. package/examples/jsm/tsl/display/BloomNode.js +55 -30
  145. package/examples/jsm/tsl/display/DenoiseNode.js +21 -1
  146. package/examples/jsm/tsl/display/DepthOfFieldNode.js +24 -6
  147. package/examples/jsm/tsl/display/DotScreenNode.js +11 -11
  148. package/examples/jsm/tsl/display/FSR1Node.js +8 -4
  149. package/examples/jsm/tsl/display/GTAONode.js +199 -86
  150. package/examples/jsm/tsl/display/GaussianBlurNode.js +65 -52
  151. package/examples/jsm/tsl/display/GodraysNode.js +5 -2
  152. package/examples/jsm/tsl/display/ImportanceSampledEnvironment.js +2 -2
  153. package/examples/jsm/tsl/display/LensflareNode.js +5 -2
  154. package/examples/jsm/tsl/display/OITPassNode.js +352 -0
  155. package/examples/jsm/tsl/display/OutlineNode.js +2 -0
  156. package/examples/jsm/tsl/display/ParallaxBarrierPassNode.js +3 -2
  157. package/examples/jsm/tsl/display/RGBShiftNode.js +9 -9
  158. package/examples/jsm/tsl/display/RecurrentDenoiseNode.js +7 -4
  159. package/examples/jsm/tsl/display/RetroPassNode.js +1 -1
  160. package/examples/jsm/tsl/display/SMAANode.js +22 -61
  161. package/examples/jsm/tsl/display/SSAAPassNode.js +2 -4
  162. package/examples/jsm/tsl/display/SSAONode.js +436 -0
  163. package/examples/jsm/tsl/display/SSGINode.js +5 -2
  164. package/examples/jsm/tsl/display/SSRNode.js +7 -2
  165. package/examples/jsm/tsl/display/SSSNode.js +5 -2
  166. package/examples/jsm/tsl/display/SharpenNode.js +5 -4
  167. package/examples/jsm/tsl/display/StereoCompositePassNode.js +1 -3
  168. package/examples/jsm/tsl/display/StereoPassNode.js +1 -3
  169. package/examples/jsm/tsl/display/TAAUNode.js +22 -125
  170. package/examples/jsm/tsl/display/TRAANode.js +16 -142
  171. package/examples/jsm/tsl/display/TemporalReprojectNode.js +21 -15
  172. package/examples/jsm/tsl/display/depthAwareBlur.js +63 -0
  173. package/examples/jsm/tsl/display/hashBlur.js +3 -2
  174. package/examples/jsm/tsl/lighting/ClusteredLightsNode.js +38 -27
  175. package/examples/jsm/tsl/lighting/LightProbeGridNode.js +136 -0
  176. package/examples/jsm/tsl/math/voronoiNoise.js +112 -0
  177. package/examples/jsm/tsl/shadows/TileShadowNode.js +4 -6
  178. package/examples/jsm/tsl/utils/Raymarching.js +5 -5
  179. package/examples/jsm/tsl/utils/SoftParticles.js +60 -0
  180. package/examples/jsm/tsl/utils/TAAUtils.js +195 -0
  181. package/examples/jsm/utils/BufferGeometryUtils.js +14 -14
  182. package/examples/jsm/utils/GaussianSplatUtils.js +229 -0
  183. package/examples/jsm/utils/WebGLTextureUtils.js +1 -1
  184. package/examples/jsm/utils/WebGPUTextureUtils.js +1 -1
  185. package/examples/jsm/webxr/WebGLXRFallback.js +2 -16
  186. package/examples/jsm/webxr/XRControllerModelFactory.js +16 -4
  187. package/package.json +9 -16
  188. package/src/Three.Core.js +2 -1
  189. package/src/Three.TSL.js +73 -43
  190. package/src/Three.WebGPU.Nodes.js +1 -0
  191. package/src/Three.WebGPU.js +1 -0
  192. package/src/animation/AnimationClip.js +15 -2
  193. package/src/animation/AnimationObjectGroup.js +18 -6
  194. package/src/animation/AnimationUtils.js +26 -0
  195. package/src/animation/KeyframeTrack.js +37 -0
  196. package/src/constants.js +23 -1
  197. package/src/core/BufferAttribute.js +3 -2
  198. package/src/core/BufferGeometry.js +1 -1
  199. package/src/core/InterleavedBuffer.js +5 -1
  200. package/src/core/Object3D.js +40 -12
  201. package/src/core/Raycaster.js +4 -0
  202. package/src/core/RenderTarget.js +99 -9
  203. package/src/core/RenderTarget3D.js +12 -8
  204. package/src/extras/Controls.js +0 -8
  205. package/src/extras/PMREMGenerator.js +99 -205
  206. package/src/geometries/TorusGeometry.js +1 -1
  207. package/src/helpers/ArrowHelper.js +2 -0
  208. package/src/helpers/AxesHelper.js +2 -0
  209. package/src/helpers/Box3Helper.js +2 -0
  210. package/src/helpers/BoxHelper.js +2 -0
  211. package/src/helpers/CameraHelper.js +2 -0
  212. package/src/helpers/DirectionalLightHelper.js +2 -0
  213. package/src/helpers/GridHelper.js +2 -0
  214. package/src/helpers/HemisphereLightHelper.js +2 -0
  215. package/src/helpers/PlaneHelper.js +2 -0
  216. package/src/helpers/PointLightHelper.js +2 -0
  217. package/src/helpers/PolarGridHelper.js +2 -0
  218. package/src/helpers/SkeletonHelper.js +2 -0
  219. package/src/helpers/SpotLightHelper.js +2 -0
  220. package/src/lights/Light.js +0 -10
  221. package/src/lights/LightShadow.js +43 -12
  222. package/src/lights/SpotLightShadow.js +18 -0
  223. package/src/loaders/BufferGeometryLoader.js +5 -0
  224. package/src/loaders/ImageBitmapLoader.js +3 -1
  225. package/src/loaders/ObjectLoader.js +8 -5
  226. package/src/materials/Material.js +80 -57
  227. package/src/materials/MeshPhysicalMaterial.js +32 -0
  228. package/src/materials/nodes/Line2NodeMaterial.js +17 -8
  229. package/src/materials/nodes/MeshPhysicalNodeMaterial.js +42 -5
  230. package/src/materials/nodes/NodeMaterial.js +19 -13
  231. package/src/materials/nodes/PointsNodeMaterial.js +2 -1
  232. package/src/materials/nodes/manager/NodeMaterialObserver.js +282 -55
  233. package/src/math/Frustum.js +9 -0
  234. package/src/math/FrustumArray.js +1 -1
  235. package/src/math/MathUtils.js +5 -3
  236. package/src/math/Matrix4.js +2 -9
  237. package/src/math/Plane.js +30 -1
  238. package/src/math/Quaternion.js +0 -10
  239. package/src/math/Ray.js +95 -45
  240. package/src/math/Triangle.js +0 -2
  241. package/src/math/Vector3.js +2 -2
  242. package/src/math/Vector4.js +0 -4
  243. package/src/math/interpolants/BezierInterpolant.js +36 -23
  244. package/src/nodes/Nodes.js +2 -0
  245. package/src/nodes/TSL.js +11 -3
  246. package/src/nodes/accessors/Batch.js +85 -13
  247. package/src/nodes/accessors/BufferAttributeNode.js +1 -1
  248. package/src/nodes/accessors/BuiltinNode.js +1 -1
  249. package/src/nodes/accessors/Instance.js +19 -18
  250. package/src/nodes/accessors/MaterialNode.js +9 -0
  251. package/src/nodes/accessors/ModelNode.js +85 -9
  252. package/src/nodes/accessors/ReferenceBaseNode.js +1 -70
  253. package/src/nodes/accessors/ReferenceElementNode.js +72 -0
  254. package/src/nodes/accessors/ReferenceNode.js +1 -70
  255. package/src/nodes/accessors/Skinning.js +124 -12
  256. package/src/nodes/accessors/StorageTextureNode.js +7 -3
  257. package/src/nodes/accessors/Texture3DNode.js +1 -1
  258. package/src/nodes/accessors/TextureNode.js +51 -21
  259. package/src/nodes/accessors/TextureSizeNode.js +4 -2
  260. package/src/nodes/accessors/UniformArrayNode.js +30 -5
  261. package/src/nodes/code/CodeNode.js +1 -1
  262. package/src/nodes/code/FunctionNode.js +12 -2
  263. package/src/nodes/core/ArrayNode.js +2 -2
  264. package/src/nodes/core/ContextNode.js +57 -4
  265. package/src/nodes/core/IndexNode.js +69 -4
  266. package/src/nodes/core/InspectorNode.js +2 -2
  267. package/src/nodes/core/MRTNode.js +44 -2
  268. package/src/nodes/core/Node.js +6 -3
  269. package/src/nodes/core/NodeBuilder.js +65 -50
  270. package/src/nodes/core/NodeFrame.js +11 -3
  271. package/src/nodes/core/NodeUtils.js +88 -0
  272. package/src/nodes/core/PropertyNode.js +8 -0
  273. package/src/nodes/core/StackNode.js +0 -1
  274. package/src/nodes/core/StructNode.js +4 -3
  275. package/src/nodes/core/UniformGroupNode.js +3 -2
  276. package/src/nodes/core/UniformNode.js +26 -12
  277. package/src/nodes/core/VarNode.js +0 -1
  278. package/src/nodes/display/BumpMapNode.js +2 -2
  279. package/src/nodes/display/ColorAdjustment.js +1 -1
  280. package/src/nodes/display/PassNode.js +76 -15
  281. package/src/nodes/display/ScreenNode.js +22 -65
  282. package/src/nodes/fog/Fog.js +4 -4
  283. package/src/nodes/functions/BSDF/BRDF_GGX.js +6 -6
  284. package/src/nodes/functions/BSDF/BRDF_Sheen.js +1 -1
  285. package/src/nodes/functions/BSDF/DFGLUT.js +2 -1
  286. package/src/nodes/functions/BSDF/LTC.js +1 -1
  287. package/src/nodes/functions/PhongLightingModel.js +1 -1
  288. package/src/nodes/functions/PhysicalLightingModel.js +83 -25
  289. package/src/nodes/functions/ToonLightingModel.js +2 -2
  290. package/src/nodes/functions/material/getParallaxCorrectNormal.js +3 -3
  291. package/src/nodes/gpgpu/AtomicFunctionNode.js +64 -13
  292. package/src/nodes/gpgpu/BarrierNode.js +13 -4
  293. package/src/nodes/gpgpu/ComputeBuiltinNode.js +1 -1
  294. package/src/nodes/gpgpu/ComputeNode.js +20 -17
  295. package/src/nodes/gpgpu/SubgroupFunctionNode.js +165 -37
  296. package/src/nodes/gpgpu/WorkgroupInfoNode.js +44 -6
  297. package/src/nodes/lighting/EnvironmentNode.js +40 -4
  298. package/src/nodes/lighting/LightsNode.js +20 -4
  299. package/src/nodes/lighting/ShadowBaseNode.js +158 -1
  300. package/src/nodes/lighting/ShadowFilterNode.js +2 -106
  301. package/src/nodes/lighting/ShadowNode.js +22 -91
  302. package/src/nodes/materialx/{lib/mx_hsv.js → MaterialXColor.js} +3 -6
  303. package/src/nodes/materialx/{lib/mx_transform_color.js → MaterialXColorTransform.js} +3 -6
  304. package/src/nodes/materialx/MaterialXCore.js +37 -0
  305. package/src/nodes/materialx/MaterialXNodes.js +64 -72
  306. package/src/nodes/materialx/{lib/mx_noise.js → MaterialXNoise.js} +426 -197
  307. package/src/nodes/math/BitcountNode.js +24 -4
  308. package/src/nodes/math/MathNode.js +4 -4
  309. package/src/nodes/math/MathUtils.js +15 -4
  310. package/src/nodes/math/OperatorNode.js +2 -2
  311. package/src/nodes/math/PackFloatNode.js +29 -1
  312. package/src/nodes/math/Packed4x8IntegerNode.js +433 -0
  313. package/src/nodes/math/UnpackFloatNode.js +30 -2
  314. package/src/nodes/parsers/GLSLNodeFunction.js +1 -1
  315. package/src/nodes/pmrem/PMREMNode.js +1 -1
  316. package/src/nodes/pmrem/PMREMUtils.js +31 -74
  317. package/src/nodes/shapes/Shapes.js +1 -1
  318. package/src/nodes/tsl/TSLCore.js +1 -31
  319. package/src/nodes/utils/EventNode.js +75 -0
  320. package/src/nodes/utils/LoopNode.js +54 -13
  321. package/src/nodes/utils/PostProcessingUtils.js +23 -2
  322. package/src/nodes/utils/RTTNode.js +97 -32
  323. package/src/nodes/utils/ReflectorNode.js +8 -4
  324. package/src/nodes/utils/RotateNode.js +85 -8
  325. package/src/nodes/utils/SpriteUtils.js +58 -23
  326. package/src/objects/BatchedMesh.js +6 -0
  327. package/src/objects/InstancedMesh.js +1 -1
  328. package/src/objects/LOD.js +1 -1
  329. package/src/objects/Line.js +12 -0
  330. package/src/objects/Mesh.js +12 -0
  331. package/src/objects/Points.js +12 -0
  332. package/src/objects/Sprite.js +12 -0
  333. package/src/renderers/WebGLRenderer.js +93 -27
  334. package/src/renderers/common/Animation.js +12 -2
  335. package/src/renderers/common/Backend.js +38 -10
  336. package/src/renderers/common/BindGroup.js +0 -1
  337. package/src/renderers/common/Bindings.js +50 -4
  338. package/src/renderers/common/BundleGroup.js +4 -0
  339. package/src/renderers/common/ClippingContext.js +11 -1
  340. package/src/renderers/common/Color4.js +9 -0
  341. package/src/renderers/common/Constants.js +0 -5
  342. package/src/renderers/common/DirectRenderPipeline.js +233 -0
  343. package/src/renderers/common/Geometries.js +24 -3
  344. package/src/renderers/common/Info.js +3 -3
  345. package/src/renderers/common/InspectorBase.js +37 -8
  346. package/src/renderers/common/Lighting.js +11 -4
  347. package/src/renderers/common/Pipelines.js +6 -4
  348. package/src/renderers/common/QuadMesh.js +16 -2
  349. package/src/renderers/common/RenderContext.js +8 -0
  350. package/src/renderers/common/RenderList.js +53 -19
  351. package/src/renderers/common/RenderLists.js +58 -11
  352. package/src/renderers/common/RenderObject.js +14 -0
  353. package/src/renderers/common/RenderObjects.js +14 -9
  354. package/src/renderers/common/RenderPipeline.js +52 -44
  355. package/src/renderers/common/Renderer.js +226 -55
  356. package/src/renderers/common/Storage3DTexture.js +16 -0
  357. package/src/renderers/common/Textures.js +3 -3
  358. package/src/renderers/common/XRManager.js +79 -72
  359. package/src/renderers/common/extras/PMREMGenerator.js +76 -144
  360. package/src/renderers/common/nodes/NodeManager.js +144 -6
  361. package/src/renderers/common/nodes/NodeStorageBuffer.js +3 -1
  362. package/src/renderers/common/nodes/NodeUniformBuffer.js +3 -1
  363. package/src/renderers/shaders/DFGLUTData.js +2 -1
  364. package/src/renderers/shaders/ShaderChunk/defaultnormal_vertex.glsl.js +4 -2
  365. package/src/renderers/shaders/ShaderChunk/envmap_physical_pars_fragment.glsl.js +48 -0
  366. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +53 -4
  367. package/src/renderers/shaders/ShaderChunk/lights_fragment_maps.glsl.js +20 -2
  368. package/src/renderers/shaders/ShaderChunk/lights_pars_begin.glsl.js +20 -0
  369. package/src/renderers/shaders/ShaderChunk/lights_physical_fragment.glsl.js +6 -0
  370. package/src/renderers/shaders/ShaderChunk/lights_physical_pars_fragment.glsl.js +61 -57
  371. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_fragment.glsl.js +82 -0
  372. package/src/renderers/shaders/ShaderChunk/shadowmap_pars_vertex.glsl.js +9 -0
  373. package/src/renderers/shaders/ShaderChunk/shadowmap_vertex.glsl.js +8 -1
  374. package/src/renderers/shaders/ShaderChunk/shadowmask_pars_fragment.glsl.js +15 -0
  375. package/src/renderers/shaders/ShaderLib/meshphysical.glsl.js +4 -0
  376. package/src/renderers/shaders/ShaderLib.js +1 -0
  377. package/src/renderers/shaders/UniformsLib.js +16 -0
  378. package/src/renderers/webgl/WebGLAnimation.js +2 -2
  379. package/src/renderers/webgl/WebGLCapabilities.js +2 -2
  380. package/src/renderers/webgl/WebGLLights.js +74 -4
  381. package/src/renderers/webgl/WebGLMaterials.js +6 -0
  382. package/src/renderers/webgl/WebGLOutput.js +36 -24
  383. package/src/renderers/webgl/WebGLProgram.js +3 -0
  384. package/src/renderers/webgl/WebGLPrograms.js +8 -0
  385. package/src/renderers/webgl/WebGLRenderLists.js +6 -10
  386. package/src/renderers/webgl/WebGLShadowMap.js +47 -44
  387. package/src/renderers/webgl/WebGLTextures.js +7 -7
  388. package/src/renderers/webgl-fallback/WebGLBackend.js +153 -45
  389. package/src/renderers/webgl-fallback/nodes/GLSLNodeBuilder.js +83 -29
  390. package/src/renderers/webgl-fallback/utils/WebGLState.js +163 -17
  391. package/src/renderers/webgl-fallback/utils/WebGLTextureUtils.js +32 -5
  392. package/src/renderers/webgl-fallback/utils/WebGLTimestampQueryPool.js +11 -4
  393. package/src/renderers/webgpu/WebGPUBackend.js +513 -145
  394. package/src/renderers/webgpu/nodes/WGSLNodeBuilder.js +99 -20
  395. package/src/renderers/webgpu/nodes/WGSLNodeFunction.js +2 -1
  396. package/src/renderers/webgpu/utils/WebGPUAttributeUtils.js +3 -12
  397. package/src/renderers/webgpu/utils/WebGPUBindingUtils.js +24 -14
  398. package/src/renderers/webgpu/utils/WebGPUPipelineUtils.js +80 -14
  399. package/src/renderers/webgpu/utils/WebGPUTextureUtils.js +62 -7
  400. package/src/renderers/webgpu/utils/WebGPUTimestampQueryPool.js +9 -3
  401. package/src/renderers/webgpu/utils/WebGPUUtils.js +16 -4
  402. package/src/renderers/webxr/WebXRManager.js +25 -2
  403. package/src/scenes/Scene.js +3 -3
  404. package/src/textures/CompressedArrayTexture.js +16 -0
  405. package/src/textures/Data3DTexture.js +16 -0
  406. package/src/textures/DataArrayTexture.js +16 -0
  407. package/src/textures/DepthTexture.js +3 -3
  408. package/src/textures/Texture.js +3 -3
  409. package/src/textures/{Source.js → TextureSource.js} +39 -8
  410. package/src/utils.js +6 -79
  411. package/build/three.core.min.js +0 -6
  412. package/build/three.module.min.js +0 -6
  413. package/build/three.tsl.min.js +0 -6
  414. package/build/three.webgpu.min.js +0 -6
  415. package/build/three.webgpu.nodes.min.js +0 -6
  416. package/examples/jsm/libs/ecsy.module.js +0 -1792
  417. package/examples/jsm/loaders/LottieLoader.js +0 -130
  418. package/src/nodes/functions/BSDF/BRDF_GGX_Multiscatter.js +0 -52
@@ -3,7 +3,7 @@
3
3
  * Copyright 2010-2026 Three.js Authors
4
4
  * SPDX-License-Identifier: MIT
5
5
  */
6
- const REVISION = '185';
6
+ const REVISION = '186';
7
7
 
8
8
  /**
9
9
  * Represents mouse buttons and interaction types in context of controls.
@@ -75,6 +75,7 @@ const PCFShadowMap = 1;
75
75
  *
76
76
  * @type {number}
77
77
  * @constant
78
+ * @deprecated since r186. Use `PCFShadowMap` instead.
78
79
  */
79
80
  const PCFSoftShadowMap = 2;
80
81
 
@@ -1714,6 +1715,18 @@ const Compatibility = {
1714
1715
  TEXTURE_COMPARE: 'depthTextureCompare'
1715
1716
  };
1716
1717
 
1718
+ /**
1719
+ * Represents the refresh types of render objects.
1720
+ *
1721
+ * @type {ConstantsRenderObjectRefreshType}
1722
+ * @constant
1723
+ */
1724
+ const RenderObjectRefreshType = {
1725
+ NONE: 0,
1726
+ SHARED: 1,
1727
+ FULL: 2
1728
+ };
1729
+
1717
1730
  /**
1718
1731
  * This type represents mouse buttons and interaction types in context of controls.
1719
1732
  *
@@ -1764,6 +1777,15 @@ const Compatibility = {
1764
1777
  * @property {string} EITHER - Flat interpolation using either vertex.
1765
1778
  */
1766
1779
 
1780
+ /**
1781
+ * Represents the refresh types of render objects.
1782
+ *
1783
+ * @typedef {Object} ConstantsRenderObjectRefreshType
1784
+ * @property {number} NONE - No refresh required.
1785
+ * @property {number} SHARED - Only shared uniform buffers require an update.
1786
+ * @property {number} FULL - The render object requires a full refresh.
1787
+ */
1788
+
1767
1789
  /**
1768
1790
  * Checks if an array contains values that require Uint32 representation.
1769
1791
  *
@@ -2065,79 +2087,9 @@ function warnOnce( ...params ) {
2065
2087
 
2066
2088
  }
2067
2089
 
2068
- // WITH_GENESYS
2069
- /**
2070
- * Shared MessageChannel used by {@link yieldToTask}. One pair of ports is
2071
- * owned for the lifetime of this module so compileAsync does not allocate a
2072
- * channel per yield.
2073
- *
2074
- * @private
2075
- * @type {MessageChannel|null}
2076
- */
2077
- let _taskYieldChannel = null;
2078
-
2079
- /**
2080
- * Resolvers waiting for the next MessageChannel task. Sequential
2081
- * `await yieldToMain()` callers queue at most one entry; the array still
2082
- * preserves ordering if several yields overlap.
2083
- *
2084
- * @private
2085
- * @type {Array<Function>}
2086
- */
2087
- const _taskYieldResolvers = [];
2088
-
2089
- /**
2090
- * Yields to a new event-loop task without waiting for a display frame.
2091
- *
2092
- * @private
2093
- * @return {Promise<void>}
2094
- */
2095
- function yieldToTask() {
2096
-
2097
- return new Promise( resolve => {
2098
-
2099
- if ( typeof MessageChannel === 'function' ) {
2100
-
2101
- if ( _taskYieldChannel === null ) {
2102
-
2103
- _taskYieldChannel = new MessageChannel();
2104
- _taskYieldChannel.port1.onmessage = function () {
2105
-
2106
- const next = _taskYieldResolvers.shift();
2107
- if ( next !== undefined ) next();
2108
-
2109
- };
2110
-
2111
- }
2112
-
2113
- _taskYieldResolvers.push( resolve );
2114
- _taskYieldChannel.port2.postMessage( null );
2115
- return;
2116
-
2117
- }
2118
-
2119
- if ( typeof setTimeout === 'function' ) {
2120
-
2121
- setTimeout( resolve, 0 );
2122
- return;
2123
-
2124
- }
2125
-
2126
- resolve();
2127
-
2128
- } );
2129
-
2130
- }
2131
- // !WITH_GENESYS
2132
-
2133
2090
  /**
2134
2091
  * Yields execution to the main thread to allow rendering and other tasks.
2135
- * Uses scheduler.yield() when available (Chrome 115+).
2136
- * WITH_GENESYS
2137
- * Falls back to a MessageChannel (or setTimeout) task continuation so browsers
2138
- * without the Scheduler API do not wait one animation frame per yield.
2139
- * !WITH_GENESYS
2140
- * Falls back to requestAnimationFrame.
2092
+ * Uses scheduler.yield() when available (Chrome 115+), falls back to requestAnimationFrame.
2141
2093
  *
2142
2094
  * @return {Promise<void>}
2143
2095
  */
@@ -2149,14 +2101,11 @@ function yieldToMain() {
2149
2101
 
2150
2102
  }
2151
2103
 
2152
- // WITH_GENESYS
2153
- return yieldToTask();
2154
- // !WITH_GENESYS
2155
- // return new Promise( resolve => {
2156
- //
2157
- // requestAnimationFrame( resolve );
2158
- //
2159
- // } );
2104
+ return new Promise( resolve => {
2105
+
2106
+ requestAnimationFrame( resolve );
2107
+
2108
+ } );
2160
2109
 
2161
2110
  }
2162
2111
 
@@ -2631,14 +2580,14 @@ function radToDeg( radians ) {
2631
2580
  }
2632
2581
 
2633
2582
  /**
2634
- * Returns `true` if the given number is a power of two.
2583
+ * Returns `true` if the given integer is a power of two.
2635
2584
  *
2636
2585
  * @param {number} value - The value to check.
2637
- * @return {boolean} Whether the given number is a power of two or not.
2586
+ * @return {boolean} Whether the given integer is a power of two or not.
2638
2587
  */
2639
2588
  function isPowerOfTwo( value ) {
2640
2589
 
2641
- return ( value & ( value - 1 ) ) === 0 && value !== 0;
2590
+ return value > 0 && Number.isInteger( value ) && 2 ** Math.round( Math.log2( value ) ) === value;
2642
2591
 
2643
2592
  }
2644
2593
 
@@ -2753,6 +2702,7 @@ function denormalize( value, array ) {
2753
2702
  return value / 65535.0;
2754
2703
 
2755
2704
  case Uint8Array:
2705
+ case Uint8ClampedArray:
2756
2706
 
2757
2707
  return value / 255.0;
2758
2708
 
@@ -2800,6 +2750,7 @@ function normalize( value, array ) {
2800
2750
  return Math.round( value * 65535.0 );
2801
2751
 
2802
2752
  case Uint8Array:
2753
+ case Uint8ClampedArray:
2803
2754
 
2804
2755
  return Math.round( value * 255.0 );
2805
2756
 
@@ -4241,10 +4192,6 @@ class Quaternion {
4241
4192
 
4242
4193
  const x = euler._x, y = euler._y, z = euler._z, order = euler._order;
4243
4194
 
4244
- // http://www.mathworks.com/matlabcentral/fileexchange/
4245
- // 20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors/
4246
- // content/SpinCalc.m
4247
-
4248
4195
  const cos = Math.cos;
4249
4196
  const sin = Math.sin;
4250
4197
 
@@ -4320,8 +4267,6 @@ class Quaternion {
4320
4267
  */
4321
4268
  setFromAxisAngle( axis, angle ) {
4322
4269
 
4323
- // http://www.euclideanspace.com/maths/geometry/rotations/conversions/angleToQuaternion/index.htm
4324
-
4325
4270
  const halfAngle = angle / 2, s = Math.sin( halfAngle );
4326
4271
 
4327
4272
  this._x = axis.x * s;
@@ -4343,8 +4288,6 @@ class Quaternion {
4343
4288
  */
4344
4289
  setFromRotationMatrix( m ) {
4345
4290
 
4346
- // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/index.htm
4347
-
4348
4291
  // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
4349
4292
 
4350
4293
  const te = m.elements,
@@ -4632,8 +4575,6 @@ class Quaternion {
4632
4575
  */
4633
4576
  multiplyQuaternions( a, b ) {
4634
4577
 
4635
- // from http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/code/index.htm
4636
-
4637
4578
  const qax = a._x, qay = a._y, qaz = a._z, qaw = a._w;
4638
4579
  const qbx = b._x, qby = b._y, qbz = b._z, qbw = b._w;
4639
4580
 
@@ -5369,8 +5310,8 @@ class Vector3 {
5369
5310
  }
5370
5311
 
5371
5312
  /**
5372
- * Transforms the direction of this vector by a matrix (the upper left 3 x 3
5373
- * subset of the given 4x4 matrix and then normalizes the result.
5313
+ * Transforms this vector by the upper left 3x3 sub-matrix of the given 4x4 matrix,
5314
+ * and normalizes the result.
5374
5315
  *
5375
5316
  * @param {Matrix4} m - The matrix.
5376
5317
  * @return {Vector3} A reference to this vector.
@@ -7091,10 +7032,10 @@ let _sourceId = 0;
7091
7032
  * The main purpose of this class is to decouple the data definition from the texture
7092
7033
  * definition so the same data can be used with multiple texture instances.
7093
7034
  */
7094
- class Source {
7035
+ class TextureSource {
7095
7036
 
7096
7037
  /**
7097
- * Constructs a new video texture.
7038
+ * Constructs a new texture source.
7098
7039
  *
7099
7040
  * @param {any} [data=null] - The data definition of a texture.
7100
7041
  */
@@ -7107,12 +7048,12 @@ class Source {
7107
7048
  * @readonly
7108
7049
  * @default true
7109
7050
  */
7110
- this.isSource = true;
7051
+ this.isTextureSource = true;
7111
7052
 
7112
7053
  /**
7113
7054
  * The ID of the source.
7114
7055
  *
7115
- * @name Source#id
7056
+ * @name TextureSource#id
7116
7057
  * @type {number}
7117
7058
  * @readonly
7118
7059
  */
@@ -7134,7 +7075,7 @@ class Source {
7134
7075
  this.data = data;
7135
7076
 
7136
7077
  /**
7137
- * This property is only relevant when {@link Source#needsUpdate} is set to `true` and
7078
+ * This property is only relevant when {@link TextureSource#needsUpdate} is set to `true` and
7138
7079
  * provides more control on how texture data should be processed. When `dataReady` is set
7139
7080
  * to `false`, the engine performs the memory allocation (if necessary) but does not transfer
7140
7081
  * the data into the GPU memory.
@@ -7145,7 +7086,7 @@ class Source {
7145
7086
  this.dataReady = true;
7146
7087
 
7147
7088
  /**
7148
- * This starts at `0` and counts how many times {@link Source#needsUpdate} is set to `true`.
7089
+ * This starts at `0` and counts how many times {@link TextureSource#needsUpdate} is set to `true`.
7149
7090
  *
7150
7091
  * @type {number}
7151
7092
  * @readonly
@@ -7308,6 +7249,37 @@ function serializeImage( image ) {
7308
7249
 
7309
7250
  }
7310
7251
 
7252
+ /**
7253
+ * @deprecated since r186. Use {@link TextureSource} instead. `Source` has been renamed to `TextureSource`.
7254
+ */
7255
+ class Source extends TextureSource {
7256
+
7257
+ /**
7258
+ * Constructs a new texture source.
7259
+ *
7260
+ * @param {any} [data=null] - The data definition of a texture.
7261
+ * @deprecated since r186. Use {@link TextureSource} instead.
7262
+ */
7263
+ constructor( data = null ) {
7264
+
7265
+ warnOnce( 'Source: "Source" has been renamed to "TextureSource". Please update your code to use "THREE.TextureSource" instead.' ); // @deprecated, r186
7266
+
7267
+ super( data );
7268
+
7269
+ /**
7270
+ * This flag can be used for type testing.
7271
+ *
7272
+ * @deprecated since r186. Use {@link TextureSource#isTextureSource} instead.
7273
+ * @type {boolean}
7274
+ * @readonly
7275
+ * @default true
7276
+ */
7277
+ this.isSource = true;
7278
+
7279
+ }
7280
+
7281
+ }
7282
+
7311
7283
  let _textureId = 0;
7312
7284
 
7313
7285
  const _tempVec3 = /*@__PURE__*/ new Vector3();
@@ -7379,9 +7351,9 @@ class Texture extends EventDispatcher {
7379
7351
  * where multiple textures render the same data but with different texture
7380
7352
  * transformations.
7381
7353
  *
7382
- * @type {Source}
7354
+ * @type {TextureSource}
7383
7355
  */
7384
- this.source = new Source( image );
7356
+ this.source = new TextureSource( image );
7385
7357
 
7386
7358
  /**
7387
7359
  * An array holding user-defined mipmaps.
@@ -8593,8 +8565,6 @@ class Vector4 {
8593
8565
  */
8594
8566
  setAxisAngleFromQuaternion( q ) {
8595
8567
 
8596
- // http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm
8597
-
8598
8568
  // q is assumed to be normalized
8599
8569
 
8600
8570
  this.w = 2 * Math.acos( q.w );
@@ -8628,8 +8598,6 @@ class Vector4 {
8628
8598
  */
8629
8599
  setAxisAngleFromRotationMatrix( m ) {
8630
8600
 
8631
- // http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
8632
-
8633
8601
  // assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
8634
8602
 
8635
8603
  let angle, x, y, z; // variables for result
@@ -9190,8 +9158,12 @@ class RenderTarget extends EventDispatcher {
9190
9158
  * @property {string} [colorSpace=NoColorSpace] - The texture's color space.
9191
9159
  * @property {boolean} [depthBuffer=true] - Whether to allocate a depth buffer or not.
9192
9160
  * @property {boolean} [stencilBuffer=false] - Whether to allocate a stencil buffer or not.
9193
- * @property {boolean} [resolveDepthBuffer=true] - Whether to resolve the depth buffer or not.
9194
- * @property {boolean} [resolveStencilBuffer=true] - Whether to resolve the stencil buffer or not.
9161
+ * @property {boolean} [resolveColorBuffer=true] - Whether to resolve the color buffer or not. Only relevant for multisampled render targets.
9162
+ * @property {boolean} [resolveDepthBuffer=true] - Whether to resolve the depth buffer or not. Only relevant for multisampled render targets.
9163
+ * @property {boolean} [resolveStencilBuffer=true] - Whether to resolve the stencil buffer or not. Only relevant for multisampled render targets.
9164
+ * @property {boolean} [storeMultisampledColorBuffer=true] - Whether to store the multisampled color buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass.
9165
+ * @property {boolean} [storeMultisampledDepthBuffer=true] - Whether to store the multisampled depth buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass.
9166
+ * @property {boolean} [storeMultisampledStencilBuffer=true] - Whether to store the multisampled stencil buffer or not. Setting to `false` saves memory bandwidth when the multisampled data are not needed after a render pass.
9195
9167
  * @property {?Texture} [depthTexture=null] - Reference to a depth texture.
9196
9168
  * @property {number} [samples=0] - The MSAA samples count.
9197
9169
  * @property {number} [count=1] - Defines the number of color attachments . Must be at least `1`.
@@ -9217,8 +9189,12 @@ class RenderTarget extends EventDispatcher {
9217
9189
  minFilter: LinearFilter,
9218
9190
  depthBuffer: true,
9219
9191
  stencilBuffer: false,
9192
+ resolveColorBuffer: true,
9220
9193
  resolveDepthBuffer: true,
9221
9194
  resolveStencilBuffer: true,
9195
+ storeMultisampledColorBuffer: true,
9196
+ storeMultisampledDepthBuffer: true,
9197
+ storeMultisampledStencilBuffer: true,
9222
9198
  depthTexture: null,
9223
9199
  samples: 0,
9224
9200
  count: 1,
@@ -9325,7 +9301,28 @@ class RenderTarget extends EventDispatcher {
9325
9301
  this.stencilBuffer = options.stencilBuffer;
9326
9302
 
9327
9303
  /**
9328
- * Whether to resolve the depth buffer or not.
9304
+ * Whether to resolve the color buffer or not. When set to `false`, the color
9305
+ * attachments do not receive the resolved (single-sampled) output of a render
9306
+ * pass and the render target's textures are left untouched. The rendered
9307
+ * content is then only accessible within the render pass itself.
9308
+ *
9309
+ * Only relevant for multisampled render targets.
9310
+ *
9311
+ * @type {boolean}
9312
+ * @default true
9313
+ */
9314
+ this.resolveColorBuffer = options.resolveColorBuffer;
9315
+
9316
+ /**
9317
+ * Whether to resolve the depth buffer or not. When set to `false`, the depth
9318
+ * texture does not receive the resolved depth output of a render pass which
9319
+ * saves memory bandwidth. Use this setting when the depth data of a render
9320
+ * pass are not required afterwards.
9321
+ *
9322
+ * Only relevant for multisampled render targets in WebGL. WebGPU does not
9323
+ * support depth resolves; sampling the depth texture of a multisampled render
9324
+ * target accesses the multisampled data directly, see
9325
+ * {@link RenderTarget#storeMultisampledDepthBuffer}.
9329
9326
  *
9330
9327
  * @type {boolean}
9331
9328
  * @default true
@@ -9333,13 +9330,54 @@ class RenderTarget extends EventDispatcher {
9333
9330
  this.resolveDepthBuffer = options.resolveDepthBuffer;
9334
9331
 
9335
9332
  /**
9336
- * Whether to resolve the stencil buffer or not.
9333
+ * Whether to resolve the stencil buffer or not. Analogous to
9334
+ * {@link RenderTarget#resolveDepthBuffer} but for the stencil aspect.
9337
9335
  *
9338
9336
  * @type {boolean}
9339
9337
  * @default true
9340
9338
  */
9341
9339
  this.resolveStencilBuffer = options.resolveStencilBuffer;
9342
9340
 
9341
+ /**
9342
+ * Whether to store the multisampled color buffer or not. When set to `false`,
9343
+ * the multisampled data are discarded at the end of a render pass, right after
9344
+ * they have been resolved. This saves memory bandwidth, especially on tile-based
9345
+ * GPUs, and is the recommended setting for render targets that are fully redrawn
9346
+ * each frame and whose output is only accessed via the resolved textures (e.g.
9347
+ * scene passes in post-processing chains).
9348
+ *
9349
+ * Must be kept `true` when the multisampled data are needed after the render
9350
+ * pass ends, e.g. when rendering into the target without clearing or when the
9351
+ * scene contains transmissive objects which require a mid-pass framebuffer copy.
9352
+ *
9353
+ * @type {boolean}
9354
+ * @default true
9355
+ */
9356
+ this.storeMultisampledColorBuffer = options.storeMultisampledColorBuffer;
9357
+
9358
+ /**
9359
+ * Whether to store the multisampled depth buffer or not. When set to `false`,
9360
+ * the multisampled depth data are discarded at the end of a render pass which
9361
+ * saves memory bandwidth.
9362
+ *
9363
+ * Must be kept `true` in WebGPU when the depth texture of a multisampled render
9364
+ * target is sampled (e.g. by depth-based post-processing effects) since depth
9365
+ * is read directly from the multisampled data.
9366
+ *
9367
+ * @type {boolean}
9368
+ * @default true
9369
+ */
9370
+ this.storeMultisampledDepthBuffer = options.storeMultisampledDepthBuffer;
9371
+
9372
+ /**
9373
+ * Whether to store the multisampled stencil buffer or not. Analogous to
9374
+ * {@link RenderTarget#storeMultisampledDepthBuffer} but for the stencil aspect.
9375
+ *
9376
+ * @type {boolean}
9377
+ * @default true
9378
+ */
9379
+ this.storeMultisampledStencilBuffer = options.storeMultisampledStencilBuffer;
9380
+
9343
9381
  this._depthTexture = null;
9344
9382
  this.depthTexture = options.depthTexture;
9345
9383
 
@@ -9424,8 +9462,8 @@ class RenderTarget extends EventDispatcher {
9424
9462
 
9425
9463
  set depthTexture( current ) {
9426
9464
 
9427
- if ( this._depthTexture !== null ) this._depthTexture.renderTarget = null;
9428
- if ( current !== null ) current.renderTarget = this;
9465
+ if ( this._depthTexture !== null && this._depthTexture.renderTarget === this ) this._depthTexture.renderTarget = null;
9466
+ if ( current !== null && current.renderTarget === null ) current.renderTarget = this;
9429
9467
 
9430
9468
  this._depthTexture = current;
9431
9469
 
@@ -9528,17 +9566,37 @@ class RenderTarget extends EventDispatcher {
9528
9566
  // ensure image object is not shared, see #20328
9529
9567
 
9530
9568
  const image = Object.assign( {}, source.textures[ i ].image );
9531
- this.textures[ i ].source = new Source( image );
9569
+ this.textures[ i ].source = new TextureSource( image );
9532
9570
 
9533
9571
  }
9534
9572
 
9535
9573
  this.depthBuffer = source.depthBuffer;
9536
9574
  this.stencilBuffer = source.stencilBuffer;
9537
9575
 
9576
+ this.resolveColorBuffer = source.resolveColorBuffer;
9538
9577
  this.resolveDepthBuffer = source.resolveDepthBuffer;
9539
9578
  this.resolveStencilBuffer = source.resolveStencilBuffer;
9540
9579
 
9541
- if ( source.depthTexture !== null ) this.depthTexture = source.depthTexture.clone();
9580
+ this.storeMultisampledColorBuffer = source.storeMultisampledColorBuffer;
9581
+ this.storeMultisampledDepthBuffer = source.storeMultisampledDepthBuffer;
9582
+ this.storeMultisampledStencilBuffer = source.storeMultisampledStencilBuffer;
9583
+
9584
+ if ( source.depthTexture !== null ) {
9585
+
9586
+ if ( source.depthTexture.renderTarget === source ) {
9587
+
9588
+ const depthTexture = source.depthTexture.clone();
9589
+ depthTexture.renderTarget = null;
9590
+
9591
+ this.depthTexture = depthTexture;
9592
+
9593
+ } else {
9594
+
9595
+ this.depthTexture = source.depthTexture;
9596
+
9597
+ }
9598
+
9599
+ }
9542
9600
 
9543
9601
  this.samples = source.samples;
9544
9602
  this.multiview = source.multiview;
@@ -9697,6 +9755,22 @@ class DataArrayTexture extends Texture {
9697
9755
 
9698
9756
  }
9699
9757
 
9758
+ /**
9759
+ * Copies the values of the given texture to this instance.
9760
+ *
9761
+ * @param {DataArrayTexture} source - The texture to copy.
9762
+ * @return {DataArrayTexture} A reference to this instance.
9763
+ */
9764
+ copy( source ) {
9765
+
9766
+ super.copy( source );
9767
+
9768
+ this.wrapR = source.wrapR;
9769
+
9770
+ return this;
9771
+
9772
+ }
9773
+
9700
9774
  /**
9701
9775
  * Describes that a specific layer of the texture needs to be updated.
9702
9776
  * Normally when {@link Texture#needsUpdate} is set to `true`, the
@@ -9873,6 +9947,22 @@ class Data3DTexture extends Texture {
9873
9947
 
9874
9948
  }
9875
9949
 
9950
+ /**
9951
+ * Copies the values of the given texture to this instance.
9952
+ *
9953
+ * @param {Data3DTexture} source - The texture to copy.
9954
+ * @return {Data3DTexture} A reference to this instance.
9955
+ */
9956
+ copy( source ) {
9957
+
9958
+ super.copy( source );
9959
+
9960
+ this.wrapR = source.wrapR;
9961
+
9962
+ return this;
9963
+
9964
+ }
9965
+
9876
9966
  }
9877
9967
 
9878
9968
  /**
@@ -10147,7 +10237,7 @@ class Matrix4 {
10147
10237
  }
10148
10238
 
10149
10239
  /**
10150
- * Extracts the basis of this matrix into the three axis vectors provided.
10240
+ * Extracts the basis vectors of this matrix into the three vectors provided.
10151
10241
  *
10152
10242
  * @param {Vector3} xAxis - The basis's x axis.
10153
10243
  * @param {Vector3} yAxis - The basis's y axis.
@@ -10539,8 +10629,6 @@ class Matrix4 {
10539
10629
  /**
10540
10630
  * Computes and returns the determinant of this matrix.
10541
10631
  *
10542
- * Based on the method outlined [here](http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.html).
10543
- *
10544
10632
  * @return {number} The determinant.
10545
10633
  */
10546
10634
  determinant() {
@@ -10706,7 +10794,7 @@ class Matrix4 {
10706
10794
  }
10707
10795
 
10708
10796
  /**
10709
- * Multiplies the columns of this matrix by the given vector.
10797
+ * Scales each of the first three columns of this matrix by the corresponding component of the given vector.
10710
10798
  *
10711
10799
  * @param {Vector3} v - The scale vector.
10712
10800
  * @return {Matrix4} A reference to this matrix.
@@ -10856,17 +10944,12 @@ class Matrix4 {
10856
10944
  * Sets this matrix as a rotational transformation around the given axis by
10857
10945
  * the given angle.
10858
10946
  *
10859
- * This is a somewhat controversial but mathematically sound alternative to
10860
- * rotating via Quaternions. See the discussion [here](https://www.gamedev.net/articles/programming/math-and-physics/do-we-really-need-quaternions-r1199).
10861
- *
10862
10947
  * @param {Vector3} axis - The normalized rotation axis.
10863
10948
  * @param {number} angle - The rotation in radians.
10864
10949
  * @return {Matrix4} A reference to this matrix.
10865
10950
  */
10866
10951
  makeRotationAxis( axis, angle ) {
10867
10952
 
10868
- // Based on http://www.gamedev.net/reference/articles/article1199.asp
10869
-
10870
10953
  const c = Math.cos( angle );
10871
10954
  const s = Math.sin( angle );
10872
10955
  const t = 1 - c;
@@ -13537,6 +13620,17 @@ class Object3D extends EventDispatcher {
13537
13620
  */
13538
13621
  raycast( /* raycaster, intersects */ ) {}
13539
13622
 
13623
+ /**
13624
+ * Abstract method to test whether this 3D object intersects the given frustum.
13625
+ * Renderable 3D objects such as {@link Mesh}, {@link Line} or {@link Points}
13626
+ * implement this method in order to use frustum culling.
13627
+ *
13628
+ * @abstract
13629
+ * @param {Frustum|FrustumArray} frustum - The frustum to test.
13630
+ * @return {boolean|undefined} Whether this 3D object intersects the given frustum or not.
13631
+ */
13632
+ intersectsFrustum( /* frustum */ ) {}
13633
+
13540
13634
  /**
13541
13635
  * Executes the callback on this 3D object and all descendants.
13542
13636
  *
@@ -13786,20 +13880,18 @@ class Object3D extends EventDispatcher {
13786
13880
  object.uuid = this.uuid;
13787
13881
  object.type = this.type;
13788
13882
 
13883
+ object.name = this.name;
13884
+ object.castShadow = this.castShadow;
13885
+ object.receiveShadow = this.receiveShadow;
13886
+ object.visible = this.visible;
13887
+ object.frustumCulled = this.frustumCulled;
13888
+ object.renderOrder = this.renderOrder;
13889
+ object.static = this.static;
13890
+ object.matrixAutoUpdate = this.matrixAutoUpdate;
13789
13891
  // WITH_GENESYS
13790
13892
  object.nodeId = this.nodeId;
13791
- // !WITH_GENESYS
13792
-
13793
- if ( this.name !== '' ) object.name = this.name;
13794
- if ( this.castShadow === true ) object.castShadow = true;
13795
- if ( this.receiveShadow === true ) object.receiveShadow = true;
13796
- if ( this.visible === false ) object.visible = false;
13797
- // WITH_GENESYS
13798
13893
  if ( this.selfHidden === true ) object.selfHidden = true;
13799
13894
  // !WITH_GENESYS
13800
- if ( this.frustumCulled === false ) object.frustumCulled = false;
13801
- if ( this.renderOrder !== 0 ) object.renderOrder = this.renderOrder;
13802
- if ( this.static !== false ) object.static = this.static;
13803
13895
  if ( Object.keys( this.userData ).length > 0 ) object.userData = this.userData;
13804
13896
 
13805
13897
  object.layers = this.layers.mask;
@@ -13808,8 +13900,6 @@ class Object3D extends EventDispatcher {
13808
13900
 
13809
13901
  if ( this.pivot !== null ) object.pivot = this.pivot.toArray();
13810
13902
 
13811
- if ( this.matrixAutoUpdate === false ) object.matrixAutoUpdate = false;
13812
-
13813
13903
  if ( this.morphTargetDictionary !== undefined ) object.morphTargetDictionary = Object.assign( {}, this.morphTargetDictionary );
13814
13904
  if ( this.morphTargetInfluences !== undefined ) object.morphTargetInfluences = this.morphTargetInfluences.slice();
13815
13905
 
@@ -14131,6 +14221,27 @@ class Object3D extends EventDispatcher {
14131
14221
 
14132
14222
  }
14133
14223
 
14224
+ /**
14225
+ * Frees the GPU-related resources allocated by this instance. Call this
14226
+ * method whenever this instance is no longer used in your app.
14227
+ *
14228
+ * Geometries, materials and textures are potentially shared with other
14229
+ * 3D objects and must be disposed of separately.
14230
+ *
14231
+ * @fires Object3D#dispose
14232
+ */
14233
+ dispose() {
14234
+
14235
+ /**
14236
+ * Fires when the 3D object has been disposed of.
14237
+ *
14238
+ * @event Object3D#dispose
14239
+ * @type {Object}
14240
+ */
14241
+ this.dispatchEvent( { type: 'dispose' } );
14242
+
14243
+ }
14244
+
14134
14245
  }
14135
14246
 
14136
14247
  /**
@@ -15923,11 +16034,11 @@ class Scene extends Object3D {
15923
16034
 
15924
16035
  if ( this.fog !== null ) data.object.fog = this.fog.toJSON();
15925
16036
 
15926
- if ( this.backgroundBlurriness > 0 ) data.object.backgroundBlurriness = this.backgroundBlurriness;
15927
- if ( this.backgroundIntensity !== 1 ) data.object.backgroundIntensity = this.backgroundIntensity;
16037
+ data.object.backgroundBlurriness = this.backgroundBlurriness;
16038
+ data.object.backgroundIntensity = this.backgroundIntensity;
15928
16039
  data.object.backgroundRotation = this.backgroundRotation.toArray();
15929
16040
 
15930
- if ( this.environmentIntensity !== 1 ) data.object.environmentIntensity = this.environmentIntensity;
16041
+ data.object.environmentIntensity = this.environmentIntensity;
15931
16042
  data.object.environmentRotation = this.environmentRotation.toArray();
15932
16043
 
15933
16044
  return data;
@@ -16028,8 +16139,6 @@ class Triangle {
16028
16139
  */
16029
16140
  static getBarycoord( point, a, b, c, target ) {
16030
16141
 
16031
- // based on: http://www.blackpawn.com/texts/pointinpoly/default.html
16032
-
16033
16142
  _v0$2.subVectors( c, a );
16034
16143
  _v1$5.subVectors( b, a );
16035
16144
  _v2$4.subVectors( point, a );
@@ -18152,8 +18261,9 @@ class BufferAttribute extends EventDispatcher {
18152
18261
  normalized: this.normalized
18153
18262
  };
18154
18263
 
18155
- if ( this.name !== '' ) data.name = this.name;
18156
- if ( this.usage !== StaticDrawUsage ) data.usage = this.usage;
18264
+ data.name = this.name;
18265
+ data.usage = this.usage;
18266
+ data.gpuType = this.gpuType;
18157
18267
 
18158
18268
  return data;
18159
18269
 
@@ -20169,7 +20279,7 @@ class BufferGeometry extends EventDispatcher {
20169
20279
 
20170
20280
  data.uuid = this.uuid;
20171
20281
  data.type = ( this.parameters !== undefined && this._transformed === true ) ? 'BufferGeometry' : this.type;
20172
- if ( this.name !== '' ) data.name = this.name;
20282
+ data.name = this.name;
20173
20283
  if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;
20174
20284
 
20175
20285
  if ( this.parameters !== undefined && this._transformed !== true ) {
@@ -20681,13 +20791,17 @@ class InterleavedBuffer {
20681
20791
 
20682
20792
  //
20683
20793
 
20684
- return {
20794
+ const json = {
20685
20795
  uuid: this.uuid,
20686
20796
  buffer: this.array.buffer._uuid,
20687
20797
  type: this.array.constructor.name,
20688
20798
  stride: this.stride
20689
20799
  };
20690
20800
 
20801
+ json.usage = this.usage;
20802
+
20803
+ return json;
20804
+
20691
20805
  }
20692
20806
 
20693
20807
  }
@@ -21234,6 +21348,399 @@ class InterleavedBufferAttribute {
21234
21348
 
21235
21349
  }
21236
21350
 
21351
+ const _vector1 = /*@__PURE__*/ new Vector3();
21352
+ const _vector2 = /*@__PURE__*/ new Vector3();
21353
+ const _normalMatrix = /*@__PURE__*/ new Matrix3();
21354
+
21355
+ /**
21356
+ * A two dimensional surface that extends infinitely in 3D space, represented
21357
+ * in [Hessian normal form](https://mathworld.wolfram.com/HessianNormalForm.html)
21358
+ * by a unit length normal vector and a constant.
21359
+ */
21360
+ class Plane {
21361
+
21362
+ /**
21363
+ * Constructs a new plane.
21364
+ *
21365
+ * @param {Vector3} [normal=(1,0,0)] - A unit length vector defining the normal of the plane.
21366
+ * @param {number} [constant=0] - The signed distance from the origin to the plane.
21367
+ */
21368
+ constructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {
21369
+
21370
+ /**
21371
+ * This flag can be used for type testing.
21372
+ *
21373
+ * @type {boolean}
21374
+ * @readonly
21375
+ * @default true
21376
+ */
21377
+ this.isPlane = true;
21378
+
21379
+ /**
21380
+ * A unit length vector defining the normal of the plane.
21381
+ *
21382
+ * @type {Vector3}
21383
+ */
21384
+ this.normal = normal;
21385
+
21386
+ /**
21387
+ * The signed distance from the origin to the plane.
21388
+ *
21389
+ * @type {number}
21390
+ * @default 0
21391
+ */
21392
+ this.constant = constant;
21393
+
21394
+ }
21395
+
21396
+ /**
21397
+ * Sets the plane components by copying the given values.
21398
+ *
21399
+ * @param {Vector3} normal - The normal.
21400
+ * @param {number} constant - The constant.
21401
+ * @return {Plane} A reference to this plane.
21402
+ */
21403
+ set( normal, constant ) {
21404
+
21405
+ this.normal.copy( normal );
21406
+ this.constant = constant;
21407
+
21408
+ return this;
21409
+
21410
+ }
21411
+
21412
+ /**
21413
+ * Sets the plane components by defining `x`, `y`, `z` as the
21414
+ * plane normal and `w` as the constant.
21415
+ *
21416
+ * @param {number} x - The value for the normal's x component.
21417
+ * @param {number} y - The value for the normal's y component.
21418
+ * @param {number} z - The value for the normal's z component.
21419
+ * @param {number} w - The constant value.
21420
+ * @return {Plane} A reference to this plane.
21421
+ */
21422
+ setComponents( x, y, z, w ) {
21423
+
21424
+ this.normal.set( x, y, z );
21425
+ this.constant = w;
21426
+
21427
+ return this;
21428
+
21429
+ }
21430
+
21431
+ /**
21432
+ * Sets the plane from the given normal and coplanar point (that is a point
21433
+ * that lies onto the plane).
21434
+ *
21435
+ * @param {Vector3} normal - The normal.
21436
+ * @param {Vector3} point - A coplanar point.
21437
+ * @return {Plane} A reference to this plane.
21438
+ */
21439
+ setFromNormalAndCoplanarPoint( normal, point ) {
21440
+
21441
+ this.normal.copy( normal );
21442
+ this.constant = - point.dot( this.normal );
21443
+
21444
+ return this;
21445
+
21446
+ }
21447
+
21448
+ /**
21449
+ * Sets the plane from three coplanar points. The winding order is
21450
+ * assumed to be counter-clockwise, and determines the direction of
21451
+ * the plane normal.
21452
+ *
21453
+ * @param {Vector3} a - The first coplanar point.
21454
+ * @param {Vector3} b - The second coplanar point.
21455
+ * @param {Vector3} c - The third coplanar point.
21456
+ * @return {Plane} A reference to this plane.
21457
+ */
21458
+ setFromCoplanarPoints( a, b, c ) {
21459
+
21460
+ const normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();
21461
+
21462
+ // Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
21463
+
21464
+ this.setFromNormalAndCoplanarPoint( normal, a );
21465
+
21466
+ return this;
21467
+
21468
+ }
21469
+
21470
+ /**
21471
+ * Copies the values of the given plane to this instance.
21472
+ *
21473
+ * @param {Plane} plane - The plane to copy.
21474
+ * @return {Plane} A reference to this plane.
21475
+ */
21476
+ copy( plane ) {
21477
+
21478
+ this.normal.copy( plane.normal );
21479
+ this.constant = plane.constant;
21480
+
21481
+ return this;
21482
+
21483
+ }
21484
+
21485
+ /**
21486
+ * Normalizes the plane normal and adjusts the constant accordingly.
21487
+ *
21488
+ * @return {Plane} A reference to this plane.
21489
+ */
21490
+ normalize() {
21491
+
21492
+ // Note: will lead to a divide by zero if the plane is invalid.
21493
+
21494
+ const inverseNormalLength = 1.0 / this.normal.length();
21495
+ this.normal.multiplyScalar( inverseNormalLength );
21496
+ this.constant *= inverseNormalLength;
21497
+
21498
+ return this;
21499
+
21500
+ }
21501
+
21502
+ /**
21503
+ * Negates both the plane normal and the constant.
21504
+ *
21505
+ * @return {Plane} A reference to this plane.
21506
+ */
21507
+ negate() {
21508
+
21509
+ this.constant *= -1;
21510
+ this.normal.negate();
21511
+
21512
+ return this;
21513
+
21514
+ }
21515
+
21516
+ /**
21517
+ * Returns the signed distance from the given point to this plane.
21518
+ *
21519
+ * @param {Vector3} point - The point to compute the distance for.
21520
+ * @return {number} The signed distance.
21521
+ */
21522
+ distanceToPoint( point ) {
21523
+
21524
+ return this.normal.dot( point ) + this.constant;
21525
+
21526
+ }
21527
+
21528
+ /**
21529
+ * Returns the signed distance from the given sphere to this plane.
21530
+ *
21531
+ * @param {Sphere} sphere - The sphere to compute the distance for.
21532
+ * @return {number} The signed distance.
21533
+ */
21534
+ distanceToSphere( sphere ) {
21535
+
21536
+ return this.distanceToPoint( sphere.center ) - sphere.radius;
21537
+
21538
+ }
21539
+
21540
+ /**
21541
+ * Projects a the given point onto the plane.
21542
+ *
21543
+ * @param {Vector3} point - The point to project.
21544
+ * @param {Vector3} target - The target vector that is used to store the method's result.
21545
+ * @return {Vector3} The projected point on the plane.
21546
+ */
21547
+ projectPoint( point, target ) {
21548
+
21549
+ return target.copy( point ).addScaledVector( this.normal, - this.distanceToPoint( point ) );
21550
+
21551
+ }
21552
+
21553
+ /**
21554
+ * Returns the intersection point of the passed line and the plane. Returns
21555
+ * `null` if the line does not intersect. Returns the line's starting point if
21556
+ * the line is coplanar with the plane.
21557
+ *
21558
+ * @param {Line3} line - The line to compute the intersection for.
21559
+ * @param {Vector3} target - The target vector that is used to store the method's result.
21560
+ * @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment.
21561
+ * @return {?Vector3} The intersection point. Returns `null` if no intersection is detected.
21562
+ */
21563
+ intersectLine( line, target, clampToLine = true ) {
21564
+
21565
+ const direction = line.delta( _vector1 );
21566
+
21567
+ const denominator = this.normal.dot( direction );
21568
+
21569
+ if ( denominator === 0 ) {
21570
+
21571
+ // line is coplanar, return origin
21572
+ if ( this.distanceToPoint( line.start ) === 0 ) {
21573
+
21574
+ return target.copy( line.start );
21575
+
21576
+ }
21577
+
21578
+ // Unsure if this is the correct method to handle this case.
21579
+ return null;
21580
+
21581
+ }
21582
+
21583
+ const t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;
21584
+
21585
+ if ( ( clampToLine === true ) && ( t < 0 || t > 1 ) ) {
21586
+
21587
+ return null;
21588
+
21589
+ }
21590
+
21591
+ return target.copy( line.start ).addScaledVector( direction, t );
21592
+
21593
+ }
21594
+
21595
+ /**
21596
+ * Returns `true` if the given line segment intersects with (passes through) the plane.
21597
+ *
21598
+ * @param {Line3} line - The line to test.
21599
+ * @return {boolean} Whether the given line segment intersects with the plane or not.
21600
+ */
21601
+ intersectsLine( line ) {
21602
+
21603
+ // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.
21604
+
21605
+ const startSign = this.distanceToPoint( line.start );
21606
+ const endSign = this.distanceToPoint( line.end );
21607
+
21608
+ return ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );
21609
+
21610
+ }
21611
+
21612
+ /**
21613
+ * Returns `true` if the given bounding box intersects with the plane.
21614
+ *
21615
+ * @param {Box3} box - The bounding box to test.
21616
+ * @return {boolean} Whether the given bounding box intersects with the plane or not.
21617
+ */
21618
+ intersectsBox( box ) {
21619
+
21620
+ return box.intersectsPlane( this );
21621
+
21622
+ }
21623
+
21624
+ /**
21625
+ * Returns `true` if the given bounding sphere intersects with the plane.
21626
+ *
21627
+ * @param {Sphere} sphere - The bounding sphere to test.
21628
+ * @return {boolean} Whether the given bounding sphere intersects with the plane or not.
21629
+ */
21630
+ intersectsSphere( sphere ) {
21631
+
21632
+ return sphere.intersectsPlane( this );
21633
+
21634
+ }
21635
+
21636
+ /**
21637
+ * Returns a coplanar vector to the plane, by calculating the
21638
+ * projection of the normal at the origin onto the plane.
21639
+ *
21640
+ * @param {Vector3} target - The target vector that is used to store the method's result.
21641
+ * @return {Vector3} The coplanar point.
21642
+ */
21643
+ coplanarPoint( target ) {
21644
+
21645
+ return target.copy( this.normal ).multiplyScalar( - this.constant );
21646
+
21647
+ }
21648
+
21649
+ /**
21650
+ * Apply a 4x4 matrix to the plane. The matrix must be an affine, homogeneous transform.
21651
+ *
21652
+ * The optional normal matrix can be pre-computed like so:
21653
+ * ```js
21654
+ * const optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );
21655
+ * ```
21656
+ *
21657
+ * @param {Matrix4} matrix - The transformation matrix.
21658
+ * @param {Matrix4} [optionalNormalMatrix] - A pre-computed normal matrix.
21659
+ * @return {Plane} A reference to this plane.
21660
+ */
21661
+ applyMatrix4( matrix, optionalNormalMatrix ) {
21662
+
21663
+ const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );
21664
+
21665
+ const referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );
21666
+
21667
+ const normal = this.normal.applyMatrix3( normalMatrix ).normalize();
21668
+
21669
+ this.constant = - referencePoint.dot( normal );
21670
+
21671
+ return this;
21672
+
21673
+ }
21674
+
21675
+ /**
21676
+ * Translates the plane by the distance defined by the given offset vector.
21677
+ * Note that this only affects the plane constant and will not affect the normal vector.
21678
+ *
21679
+ * @param {Vector3} offset - The offset vector.
21680
+ * @return {Plane} A reference to this plane.
21681
+ */
21682
+ translate( offset ) {
21683
+
21684
+ this.constant -= offset.dot( this.normal );
21685
+
21686
+ return this;
21687
+
21688
+ }
21689
+
21690
+ /**
21691
+ * Returns `true` if this plane is equal with the given one.
21692
+ *
21693
+ * @param {Plane} plane - The plane to test for equality.
21694
+ * @return {boolean} Whether this plane is equal with the given one.
21695
+ */
21696
+ equals( plane ) {
21697
+
21698
+ return plane.normal.equals( this.normal ) && ( plane.constant === this.constant );
21699
+
21700
+ }
21701
+
21702
+ /**
21703
+ * Returns a new plane with copied values from this instance.
21704
+ *
21705
+ * @return {Plane} A clone of this instance.
21706
+ */
21707
+ clone() {
21708
+
21709
+ return new this.constructor().copy( this );
21710
+
21711
+ }
21712
+
21713
+ /**
21714
+ * Returns a serialized structure of the plane.
21715
+ *
21716
+ * @return {Object} Serialized structure with fields representing the object state.
21717
+ */
21718
+ toJSON() {
21719
+
21720
+ return {
21721
+ normal: this.normal.toArray(),
21722
+ constant: this.constant
21723
+ };
21724
+
21725
+ }
21726
+
21727
+ /**
21728
+ * Sets the plane properties from the given JSON.
21729
+ *
21730
+ * @param {Object} json - The serialized json to set the plane from.
21731
+ * @return {Plane} A reference to this plane.
21732
+ */
21733
+ fromJSON( json ) {
21734
+
21735
+ this.normal.fromArray( json.normal );
21736
+ this.constant = json.constant;
21737
+
21738
+ return this;
21739
+
21740
+ }
21741
+
21742
+ }
21743
+
21237
21744
  let _materialId = 0;
21238
21745
 
21239
21746
  /**
@@ -21857,10 +22364,61 @@ class Material extends EventDispatcher {
21857
22364
  };
21858
22365
 
21859
22366
  // standard Material serialization
22367
+
21860
22368
  data.uuid = this.uuid;
21861
22369
  data.type = this.type;
21862
22370
 
21863
- if ( this.name !== '' ) data.name = this.name;
22371
+ data.blending = this.blending;
22372
+ data.side = this.side;
22373
+ data.shadowSide = this.shadowSide;
22374
+ data.vertexColors = this.vertexColors;
22375
+
22376
+ data.opacity = this.opacity;
22377
+ data.transparent = this.transparent;
22378
+
22379
+ data.blendSrc = this.blendSrc;
22380
+ data.blendDst = this.blendDst;
22381
+ data.blendEquation = this.blendEquation;
22382
+ data.blendSrcAlpha = this.blendSrcAlpha;
22383
+ data.blendDstAlpha = this.blendDstAlpha;
22384
+ data.blendEquationAlpha = this.blendEquationAlpha;
22385
+ data.blendColor = this.blendColor.getHex();
22386
+ data.blendAlpha = this.blendAlpha;
22387
+
22388
+ data.depthFunc = this.depthFunc;
22389
+ data.depthTest = this.depthTest;
22390
+ data.depthWrite = this.depthWrite;
22391
+ data.colorWrite = this.colorWrite;
22392
+
22393
+ data.clipIntersection = this.clipIntersection;
22394
+ data.clipShadows = this.clipShadows;
22395
+
22396
+ data.stencilWriteMask = this.stencilWriteMask;
22397
+ data.stencilFunc = this.stencilFunc;
22398
+ data.stencilRef = this.stencilRef;
22399
+ data.stencilFuncMask = this.stencilFuncMask;
22400
+ data.stencilFail = this.stencilFail;
22401
+ data.stencilZFail = this.stencilZFail;
22402
+ data.stencilZPass = this.stencilZPass;
22403
+ data.stencilWrite = this.stencilWrite;
22404
+
22405
+ data.polygonOffset = this.polygonOffset;
22406
+ data.polygonOffsetFactor = this.polygonOffsetFactor;
22407
+ data.polygonOffsetUnits = this.polygonOffsetUnits;
22408
+
22409
+ data.dithering = this.dithering;
22410
+
22411
+ data.alphaTest = this.alphaTest;
22412
+ data.alphaHash = this.alphaHash;
22413
+ data.alphaToCoverage = this.alphaToCoverage;
22414
+ data.premultipliedAlpha = this.premultipliedAlpha;
22415
+ data.forceSinglePass = this.forceSinglePass;
22416
+ data.allowOverride = this.allowOverride;
22417
+
22418
+ data.visible = this.visible;
22419
+ data.toneMapped = this.toneMapped;
22420
+
22421
+ data.name = this.name;
21864
22422
 
21865
22423
  if ( this.color && this.color.isColor ) data.color = this.color.getHex();
21866
22424
 
@@ -21871,7 +22429,7 @@ class Material extends EventDispatcher {
21871
22429
  if ( this.sheenColor && this.sheenColor.isColor ) data.sheenColor = this.sheenColor.getHex();
21872
22430
  if ( this.sheenRoughness !== undefined ) data.sheenRoughness = this.sheenRoughness;
21873
22431
  if ( this.emissive && this.emissive.isColor ) data.emissive = this.emissive.getHex();
21874
- if ( this.emissiveIntensity !== undefined && this.emissiveIntensity !== 1 ) data.emissiveIntensity = this.emissiveIntensity;
22432
+ if ( this.emissiveIntensity !== undefined ) data.emissiveIntensity = this.emissiveIntensity;
21875
22433
 
21876
22434
  if ( this.specular && this.specular.isColor ) data.specular = this.specular.getHex();
21877
22435
  if ( this.specularIntensity !== undefined ) data.specularIntensity = this.specularIntensity;
@@ -21912,6 +22470,7 @@ class Material extends EventDispatcher {
21912
22470
  }
21913
22471
 
21914
22472
  if ( this.dispersion !== undefined ) data.dispersion = this.dispersion;
22473
+ if ( this.retroreflectivity !== undefined ) data.retroreflectivity = this.retroreflectivity;
21915
22474
 
21916
22475
  if ( this.iridescence !== undefined ) data.iridescence = this.iridescence;
21917
22476
  if ( this.iridescenceIOR !== undefined ) data.iridescenceIOR = this.iridescenceIOR;
@@ -22010,76 +22569,39 @@ class Material extends EventDispatcher {
22010
22569
  if ( this.transmissionMap && this.transmissionMap.isTexture ) data.transmissionMap = this.transmissionMap.toJSON( meta ).uuid;
22011
22570
  if ( this.thickness !== undefined ) data.thickness = this.thickness;
22012
22571
  if ( this.thicknessMap && this.thicknessMap.isTexture ) data.thicknessMap = this.thicknessMap.toJSON( meta ).uuid;
22013
- if ( this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity ) data.attenuationDistance = this.attenuationDistance;
22572
+ if ( this.attenuationDistance !== undefined ) data.attenuationDistance = this.attenuationDistance;
22014
22573
  if ( this.attenuationColor !== undefined ) data.attenuationColor = this.attenuationColor.getHex();
22015
22574
 
22016
22575
  if ( this.size !== undefined ) data.size = this.size;
22017
- if ( this.shadowSide !== null ) data.shadowSide = this.shadowSide;
22018
22576
  if ( this.sizeAttenuation !== undefined ) data.sizeAttenuation = this.sizeAttenuation;
22019
22577
 
22020
- if ( this.blending !== NormalBlending ) data.blending = this.blending;
22021
- if ( this.side !== FrontSide ) data.side = this.side;
22022
- if ( this.vertexColors === true ) data.vertexColors = true;
22023
-
22024
- if ( this.opacity < 1 ) data.opacity = this.opacity;
22025
- if ( this.transparent === true ) data.transparent = true;
22026
-
22027
- if ( this.blendSrc !== SrcAlphaFactor ) data.blendSrc = this.blendSrc;
22028
- if ( this.blendDst !== OneMinusSrcAlphaFactor ) data.blendDst = this.blendDst;
22029
- if ( this.blendEquation !== AddEquation ) data.blendEquation = this.blendEquation;
22030
- if ( this.blendSrcAlpha !== null ) data.blendSrcAlpha = this.blendSrcAlpha;
22031
- if ( this.blendDstAlpha !== null ) data.blendDstAlpha = this.blendDstAlpha;
22032
- if ( this.blendEquationAlpha !== null ) data.blendEquationAlpha = this.blendEquationAlpha;
22033
- if ( this.blendColor && this.blendColor.isColor ) data.blendColor = this.blendColor.getHex();
22034
- if ( this.blendAlpha !== 0 ) data.blendAlpha = this.blendAlpha;
22035
-
22036
- if ( this.depthFunc !== LessEqualDepth ) data.depthFunc = this.depthFunc;
22037
- if ( this.depthTest === false ) data.depthTest = this.depthTest;
22038
- if ( this.depthWrite === false ) data.depthWrite = this.depthWrite;
22039
- if ( this.colorWrite === false ) data.colorWrite = this.colorWrite;
22040
-
22041
- if ( this.stencilWriteMask !== 0xff ) data.stencilWriteMask = this.stencilWriteMask;
22042
- if ( this.stencilFunc !== AlwaysStencilFunc ) data.stencilFunc = this.stencilFunc;
22043
- if ( this.stencilRef !== 0 ) data.stencilRef = this.stencilRef;
22044
- if ( this.stencilFuncMask !== 0xff ) data.stencilFuncMask = this.stencilFuncMask;
22045
- if ( this.stencilFail !== KeepStencilOp ) data.stencilFail = this.stencilFail;
22046
- if ( this.stencilZFail !== KeepStencilOp ) data.stencilZFail = this.stencilZFail;
22047
- if ( this.stencilZPass !== KeepStencilOp ) data.stencilZPass = this.stencilZPass;
22048
- if ( this.stencilWrite === true ) data.stencilWrite = this.stencilWrite;
22578
+ if ( Array.isArray( this.clippingPlanes ) && this.clippingPlanes.length > 0 ) {
22579
+
22580
+ data.clippingPlanes = this.clippingPlanes.map( plane => plane.toJSON() );
22581
+
22582
+ }
22049
22583
 
22050
22584
  // rotation (SpriteMaterial)
22051
- if ( this.rotation !== undefined && this.rotation !== 0 ) data.rotation = this.rotation;
22585
+ if ( this.rotation !== undefined ) data.rotation = this.rotation;
22052
22586
 
22053
- if ( this.polygonOffset === true ) data.polygonOffset = true;
22054
- if ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;
22055
- if ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;
22587
+ // depthPacking (MeshDepthMaterial)
22588
+ if ( this.depthPacking !== undefined ) data.depthPacking = this.depthPacking;
22056
22589
 
22057
- if ( this.linewidth !== undefined && this.linewidth !== 1 ) data.linewidth = this.linewidth;
22590
+ if ( this.linewidth !== undefined ) data.linewidth = this.linewidth;
22591
+ if ( this.linecap !== undefined ) data.linecap = this.linecap;
22592
+ if ( this.linejoin !== undefined ) data.linejoin = this.linejoin;
22058
22593
  if ( this.dashSize !== undefined ) data.dashSize = this.dashSize;
22059
22594
  if ( this.gapSize !== undefined ) data.gapSize = this.gapSize;
22060
22595
  if ( this.scale !== undefined ) data.scale = this.scale;
22061
22596
 
22062
- if ( this.dithering === true ) data.dithering = true;
22597
+ if ( this.wireframe !== undefined ) data.wireframe = this.wireframe;
22598
+ if ( this.wireframeLinewidth !== undefined ) data.wireframeLinewidth = this.wireframeLinewidth;
22599
+ if ( this.wireframeLinecap !== undefined ) data.wireframeLinecap = this.wireframeLinecap;
22600
+ if ( this.wireframeLinejoin !== undefined ) data.wireframeLinejoin = this.wireframeLinejoin;
22063
22601
 
22064
- if ( this.alphaTest > 0 ) data.alphaTest = this.alphaTest;
22065
- if ( this.alphaHash === true ) data.alphaHash = true;
22066
- if ( this.alphaToCoverage === true ) data.alphaToCoverage = true;
22067
- if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = true;
22068
- if ( this.forceSinglePass === true ) data.forceSinglePass = true;
22069
- if ( this.allowOverride === false ) data.allowOverride = false;
22602
+ if ( this.flatShading !== undefined ) data.flatShading = this.flatShading;
22070
22603
 
22071
- if ( this.wireframe === true ) data.wireframe = true;
22072
- if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;
22073
- if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;
22074
- if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;
22075
-
22076
- if ( this.flatShading === true ) data.flatShading = true;
22077
-
22078
- if ( this.visible === false ) data.visible = false;
22079
-
22080
- if ( this.toneMapped === false ) data.toneMapped = false;
22081
-
22082
- if ( this.fog === false ) data.fog = false;
22604
+ if ( this.fog !== undefined ) data.fog = this.fog;
22083
22605
 
22084
22606
  if ( Object.keys( this.userData ).length > 0 ) data.userData = this.userData;
22085
22607
 
@@ -22140,6 +22662,7 @@ class Material extends EventDispatcher {
22140
22662
  if ( json.clearcoat !== undefined ) this.clearcoat = json.clearcoat;
22141
22663
  if ( json.clearcoatRoughness !== undefined ) this.clearcoatRoughness = json.clearcoatRoughness;
22142
22664
  if ( json.dispersion !== undefined ) this.dispersion = json.dispersion;
22665
+ if ( json.retroreflectivity !== undefined ) this.retroreflectivity = json.retroreflectivity;
22143
22666
  if ( json.iridescence !== undefined ) this.iridescence = json.iridescence;
22144
22667
  if ( json.iridescenceIOR !== undefined ) this.iridescenceIOR = json.iridescenceIOR;
22145
22668
  if ( json.iridescenceThicknessRange !== undefined ) this.iridescenceThicknessRange = json.iridescenceThicknessRange;
@@ -22163,6 +22686,10 @@ class Material extends EventDispatcher {
22163
22686
  if ( json.depthTest !== undefined ) this.depthTest = json.depthTest;
22164
22687
  if ( json.depthWrite !== undefined ) this.depthWrite = json.depthWrite;
22165
22688
  if ( json.colorWrite !== undefined ) this.colorWrite = json.colorWrite;
22689
+ if ( json.clippingPlanes !== undefined ) this.clippingPlanes = json.clippingPlanes.map( plane => new Plane().fromJSON( plane ) );
22690
+ if ( json.clipIntersection !== undefined ) this.clipIntersection = json.clipIntersection;
22691
+ if ( json.clipShadows !== undefined ) this.clipShadows = json.clipShadows;
22692
+ if ( json.depthPacking !== undefined ) this.depthPacking = json.depthPacking;
22166
22693
  if ( json.blendSrc !== undefined ) this.blendSrc = json.blendSrc;
22167
22694
  if ( json.blendDst !== undefined ) this.blendDst = json.blendDst;
22168
22695
  if ( json.blendEquation !== undefined ) this.blendEquation = json.blendEquation;
@@ -22188,6 +22715,8 @@ class Material extends EventDispatcher {
22188
22715
  if ( json.rotation !== undefined ) this.rotation = json.rotation;
22189
22716
 
22190
22717
  if ( json.linewidth !== undefined ) this.linewidth = json.linewidth;
22718
+ if ( json.linecap !== undefined ) this.linecap = json.linecap;
22719
+ if ( json.linejoin !== undefined ) this.linejoin = json.linejoin;
22191
22720
  if ( json.dashSize !== undefined ) this.dashSize = json.dashSize;
22192
22721
  if ( json.gapSize !== undefined ) this.gapSize = json.gapSize;
22193
22722
  if ( json.scale !== undefined ) this.scale = json.scale;
@@ -22688,6 +23217,18 @@ class Sprite extends Object3D {
22688
23217
 
22689
23218
  }
22690
23219
 
23220
+ /**
23221
+ * Returns `true` if this sprite intersects the given frustum.
23222
+ *
23223
+ * @param {Frustum|FrustumArray} frustum - The frustum to test.
23224
+ * @return {boolean} Whether this sprite intersects the given frustum or not.
23225
+ */
23226
+ intersectsFrustum( frustum ) {
23227
+
23228
+ return frustum.intersectsSprite( this );
23229
+
23230
+ }
23231
+
22691
23232
  /**
22692
23233
  * Computes intersection points between a casted ray and this sprite.
22693
23234
  *
@@ -23110,7 +23651,7 @@ class LOD extends Object3D {
23110
23651
 
23111
23652
  const data = super.toJSON( meta );
23112
23653
 
23113
- if ( this.autoUpdate === false ) data.object.autoUpdate = false;
23654
+ data.object.autoUpdate = this.autoUpdate;
23114
23655
 
23115
23656
  data.object.levels = [];
23116
23657
 
@@ -23139,10 +23680,6 @@ const _segCenter = /*@__PURE__*/ new Vector3();
23139
23680
  const _segDir = /*@__PURE__*/ new Vector3();
23140
23681
  const _diff = /*@__PURE__*/ new Vector3();
23141
23682
 
23142
- const _edge1 = /*@__PURE__*/ new Vector3();
23143
- const _edge2 = /*@__PURE__*/ new Vector3();
23144
- const _normal$1 = /*@__PURE__*/ new Vector3();
23145
-
23146
23683
  /**
23147
23684
  * A ray that emits from an origin in a certain direction. The class is used by
23148
23685
  * {@link Raycaster} to assist with raycasting. Raycasting is used for
@@ -23444,6 +23981,8 @@ class Ray {
23444
23981
  */
23445
23982
  intersectSphere( sphere, target ) {
23446
23983
 
23984
+ if ( sphere.radius < 0 ) return null; // handle empty spheres, see #31187
23985
+
23447
23986
  _vector$7.subVectors( sphere.center, this.origin );
23448
23987
  const tca = _vector$7.dot( this.direction );
23449
23988
  const d2 = _vector$7.dot( _vector$7 ) - tca * tca;
@@ -23673,76 +24212,128 @@ class Ray {
23673
24212
  */
23674
24213
  intersectTriangle( a, b, c, backfaceCulling, target ) {
23675
24214
 
23676
- // Compute the offset origin, edges, and normal.
24215
+ // Watertight ray/triangle intersection. Reference: Woop, Benthin, Wald,
24216
+ // "Watertight Ray/Triangle Intersection", JCGT vol. 2 no. 1 (2013), Appendix A.
24217
+ // https://jcgt.org/published/0002/01/05/
24218
+
24219
+ const origin = this.origin;
24220
+ const direction = this.direction;
24221
+
24222
+ const dx = direction.x;
24223
+ const dy = direction.y;
24224
+ const dz = direction.z;
24225
+
24226
+ // triangle vertices relative to the ray origin
24227
+
24228
+ const aox = a.x - origin.x, aoy = a.y - origin.y, aoz = a.z - origin.z;
24229
+ const box = b.x - origin.x, boy = b.y - origin.y, boz = b.z - origin.z;
24230
+ const cox = c.x - origin.x, coy = c.y - origin.y, coz = c.z - origin.z;
23677
24231
 
23678
- // from https://github.com/pmjoniak/GeometricTools/blob/master/GTEngine/Include/Mathematics/GteIntrRay3Triangle3.h
24232
+ // Use the dimension where the ray direction is maximal as the projection
24233
+ // axis (kz) and read every component already permuted into (kx, ky, kz).
24234
+ // kx and ky are swapped when the direction's kz component is negative, to
24235
+ // preserve the winding order of triangles.
23679
24236
 
23680
- _edge1.subVectors( b, a );
23681
- _edge2.subVectors( c, a );
23682
- _normal$1.crossVectors( _edge1, _edge2 );
24237
+ const adx = Math.abs( dx ), ady = Math.abs( dy ), adz = Math.abs( dz );
23683
24238
 
23684
- // Solve Q + t*D = b1*E1 + b2*E2 (Q = kDiff, D = ray direction,
23685
- // E1 = kEdge1, E2 = kEdge2, N = Cross(E1,E2)) by
23686
- // |Dot(D,N)|*b1 = sign(Dot(D,N))*Dot(D,Cross(Q,E2))
23687
- // |Dot(D,N)|*b2 = sign(Dot(D,N))*Dot(D,Cross(E1,Q))
23688
- // |Dot(D,N)|*t = -sign(Dot(D,N))*Dot(Q,N)
23689
- let DdN = this.direction.dot( _normal$1 );
23690
- let sign;
24239
+ let dkx, dky, dkz;
24240
+ let akx, aky, akz, bkx, bky, bkz, ckx, cky, ckz;
23691
24241
 
23692
- if ( DdN > 0 ) {
24242
+ if ( adx >= ady && adx >= adz ) {
23693
24243
 
23694
- if ( backfaceCulling ) return null;
23695
- sign = 1;
24244
+ dkz = dx; akz = aox; bkz = box; ckz = cox;
23696
24245
 
23697
- } else if ( DdN < 0 ) {
24246
+ if ( dx >= 0 ) {
23698
24247
 
23699
- sign = -1;
23700
- DdN = - DdN;
24248
+ dkx = dy; dky = dz;
24249
+ akx = aoy; aky = aoz; bkx = boy; bky = boz; ckx = coy; cky = coz;
24250
+
24251
+ } else {
24252
+
24253
+ dkx = dz; dky = dy;
24254
+ akx = aoz; aky = aoy; bkx = boz; bky = boy; ckx = coz; cky = coy;
24255
+
24256
+ }
24257
+
24258
+ } else if ( ady >= adz ) {
24259
+
24260
+ dkz = dy; akz = aoy; bkz = boy; ckz = coy;
24261
+
24262
+ if ( dy >= 0 ) {
24263
+
24264
+ dkx = dz; dky = dx;
24265
+ akx = aoz; aky = aox; bkx = boz; bky = box; ckx = coz; cky = cox;
24266
+
24267
+ } else {
24268
+
24269
+ dkx = dx; dky = dz;
24270
+ akx = aox; aky = aoz; bkx = box; bky = boz; ckx = cox; cky = coz;
24271
+
24272
+ }
23701
24273
 
23702
24274
  } else {
23703
24275
 
23704
- return null;
24276
+ dkz = dz; akz = aoz; bkz = boz; ckz = coz;
23705
24277
 
23706
- }
24278
+ if ( dz >= 0 ) {
24279
+
24280
+ dkx = dx; dky = dy;
24281
+ akx = aox; aky = aoy; bkx = box; bky = boy; ckx = cox; cky = coy;
23707
24282
 
23708
- _diff.subVectors( this.origin, a );
23709
- const DdQxE2 = sign * this.direction.dot( _edge2.crossVectors( _diff, _edge2 ) );
24283
+ } else {
23710
24284
 
23711
- // b1 < 0, no intersection
23712
- if ( DdQxE2 < 0 ) {
24285
+ dkx = dy; dky = dx;
24286
+ akx = aoy; aky = aox; bkx = boy; bky = box; ckx = coy; cky = cox;
23713
24287
 
23714
- return null;
24288
+ }
23715
24289
 
23716
24290
  }
23717
24291
 
23718
- const DdE1xQ = sign * this.direction.dot( _edge1.cross( _diff ) );
24292
+ // a zero direction has no maximal axis and cannot intersect
23719
24293
 
23720
- // b2 < 0, no intersection
23721
- if ( DdE1xQ < 0 ) {
24294
+ if ( dkz === 0 ) return null;
23722
24295
 
23723
- return null;
24296
+ // shear constants that align the ray with the +kz axis
23724
24297
 
23725
- }
24298
+ const sx = dkx / dkz, sy = dky / dkz, sz = 1 / dkz;
23726
24299
 
23727
- // b1+b2 > 1, no intersection
23728
- if ( DdQxE2 + DdE1xQ > DdN ) {
24300
+ // sheared and scaled vertices
23729
24301
 
23730
- return null;
24302
+ const ax = akx - sx * akz, ay = aky - sy * akz;
24303
+ const bx = bkx - sx * bkz, by = bky - sy * bkz;
24304
+ const cx = ckx - sx * ckz, cy = cky - sy * ckz;
23731
24305
 
23732
- }
24306
+ // scaled barycentric coordinates (signed edge functions); the shear makes a
24307
+ // shared edge evaluate identically for both adjacent triangles, so the ray
24308
+ // can never fall between them
23733
24309
 
23734
- // Line intersects triangle, check if ray does.
23735
- const QdN = - sign * _diff.dot( _normal$1 );
24310
+ const u = cx * by - cy * bx;
24311
+ const v = ax * cy - ay * cx;
24312
+ const w = bx * ay - by * ax;
23736
24313
 
23737
- // t < 0, no intersection
23738
- if ( QdN < 0 ) {
24314
+ if ( backfaceCulling ) {
23739
24315
 
23740
- return null;
24316
+ if ( u < 0 || v < 0 || w < 0 ) return null;
24317
+
24318
+ } else {
24319
+
24320
+ if ( ( u < 0 || v < 0 || w < 0 ) && ( u > 0 || v > 0 || w > 0 ) ) return null;
23741
24321
 
23742
24322
  }
23743
24323
 
23744
- // Ray intersects triangle.
23745
- return this.at( QdN / DdN, target );
24324
+ const det = u + v + w;
24325
+
24326
+ // ray is co-planar with the triangle
24327
+
24328
+ if ( det === 0 ) return null;
24329
+
24330
+ // scaled hit distance; t = tScaled / det must lie in front of the origin
24331
+
24332
+ const tScaled = sz * ( u * akz + v * bkz + w * ckz );
24333
+
24334
+ if ( det > 0 ? tScaled < 0 : tScaled > 0 ) return null;
24335
+
24336
+ return this.at( tScaled / det, target );
23746
24337
 
23747
24338
  }
23748
24339
 
@@ -24262,6 +24853,18 @@ class Mesh extends Object3D {
24262
24853
 
24263
24854
  }
24264
24855
 
24856
+ /**
24857
+ * Returns `true` if this mesh intersects the given frustum.
24858
+ *
24859
+ * @param {Frustum|FrustumArray} frustum - The frustum to test.
24860
+ * @return {boolean} Whether this mesh intersects the given frustum or not.
24861
+ */
24862
+ intersectsFrustum( frustum ) {
24863
+
24864
+ return frustum.intersectsObject( this );
24865
+
24866
+ }
24867
+
24265
24868
  /**
24266
24869
  * Computes intersection points between a casted ray and this line.
24267
24870
  *
@@ -25628,594 +26231,230 @@ class InstancedMesh extends Mesh {
25628
26231
 
25629
26232
  }
25630
26233
 
25631
- copy( source, recursive ) {
25632
-
25633
- super.copy( source, recursive );
25634
-
25635
- this.instanceMatrix.copy( source.instanceMatrix );
25636
-
25637
- if ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();
25638
- if ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();
25639
-
25640
- this.count = source.count;
25641
-
25642
- if ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();
25643
- if ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();
25644
-
25645
- return this;
25646
-
25647
- }
25648
-
25649
- /**
25650
- * Gets the color of the defined instance.
25651
- *
25652
- * @param {number} index - The instance index.
25653
- * @param {Color} color - The target object that is used to store the method's result.
25654
- * @return {Color} A reference to the target color.
25655
- */
25656
- getColorAt( index, color ) {
25657
-
25658
- if ( this.instanceColor === null ) {
25659
-
25660
- return color.setRGB( 1, 1, 1 );
25661
-
25662
- } else {
25663
-
25664
- return color.fromArray( this.instanceColor.array, index * 3 );
25665
-
25666
- }
25667
-
25668
- }
25669
-
25670
- /**
25671
- * Gets the local transformation matrix of the defined instance.
25672
- *
25673
- * @param {number} index - The instance index.
25674
- * @param {Matrix4} matrix - The target object that is used to store the method's result.
25675
- * @return {Matrix4} A reference to the target matrix.
25676
- */
25677
- getMatrixAt( index, matrix ) {
25678
-
25679
- return matrix.fromArray( this.instanceMatrix.array, index * 16 );
25680
-
25681
- }
25682
-
25683
- /**
25684
- * Gets the morph target weights of the defined instance.
25685
- *
25686
- * @param {number} index - The instance index.
25687
- * @param {Mesh} object - The target object that is used to store the method's result.
25688
- */
25689
- getMorphAt( index, object ) {
25690
-
25691
- const objectInfluences = object.morphTargetInfluences;
25692
-
25693
- const array = this.morphTexture.source.data.data;
25694
-
25695
- const len = objectInfluences.length + 1; // All influences + the baseInfluenceSum
25696
-
25697
- const dataIndex = index * len + 1; // Skip the baseInfluenceSum at the beginning
25698
-
25699
- for ( let i = 0; i < objectInfluences.length; i ++ ) {
25700
-
25701
- objectInfluences[ i ] = array[ dataIndex + i ];
25702
-
25703
- }
25704
-
25705
- }
25706
-
25707
- raycast( raycaster, intersects ) {
25708
-
25709
- const matrixWorld = this.matrixWorld;
25710
- const raycastTimes = this.count;
25711
-
25712
- _mesh$1.geometry = this.geometry;
25713
- _mesh$1.material = this.material;
25714
-
25715
- if ( _mesh$1.material === undefined ) return;
25716
-
25717
- // test with bounding sphere first
25718
-
25719
- if ( this.boundingSphere === null ) this.computeBoundingSphere();
25720
-
25721
- _sphere$4.copy( this.boundingSphere );
25722
- _sphere$4.applyMatrix4( matrixWorld );
25723
-
25724
- if ( raycaster.ray.intersectsSphere( _sphere$4 ) === false ) return;
25725
-
25726
- // now test each instance
25727
-
25728
- for ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {
25729
-
25730
- // calculate the world matrix for each instance
25731
-
25732
- this.getMatrixAt( instanceId, _instanceLocalMatrix );
25733
-
25734
- _instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );
25735
-
25736
- // the mesh represents this single instance
25737
-
25738
- _mesh$1.matrixWorld = _instanceWorldMatrix;
25739
-
25740
- _mesh$1.raycast( raycaster, _instanceIntersects );
25741
-
25742
- // process the result of raycast
25743
-
25744
- for ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) {
25745
-
25746
- const intersect = _instanceIntersects[ i ];
25747
- intersect.instanceId = instanceId;
25748
- intersect.object = this;
25749
- intersects.push( intersect );
25750
-
25751
- }
25752
-
25753
- _instanceIntersects.length = 0;
25754
-
25755
- }
25756
-
25757
- }
25758
-
25759
- /**
25760
- * Sets the given color to the defined instance. Make sure you set the `needsUpdate` flag of
25761
- * {@link InstancedMesh#instanceColor} to `true` after updating all the colors.
25762
- *
25763
- * @param {number} index - The instance index.
25764
- * @param {Color} color - The instance color.
25765
- * @return {InstancedMesh} A reference to this instanced mesh.
25766
- */
25767
- setColorAt( index, color ) {
25768
-
25769
- if ( this.instanceColor === null ) {
25770
-
25771
- this.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ).fill( 1 ), 3 );
25772
-
25773
- }
25774
-
25775
- color.toArray( this.instanceColor.array, index * 3 );
25776
- return this;
25777
-
25778
- }
25779
-
25780
- /**
25781
- * Sets the given local transformation matrix to the defined instance. Make sure you set the `needsUpdate` flag of
25782
- * {@link InstancedMesh#instanceMatrix} to `true` after updating all the matrices.
25783
- *
25784
- * @param {number} index - The instance index.
25785
- * @param {Matrix4} matrix - The local transformation.
25786
- * @return {InstancedMesh} A reference to this instanced mesh.
25787
- */
25788
- setMatrixAt( index, matrix ) {
25789
-
25790
- matrix.toArray( this.instanceMatrix.array, index * 16 );
25791
- return this;
25792
-
25793
- }
25794
-
25795
- /**
25796
- * Sets the morph target weights to the defined instance. Make sure you set the `needsUpdate` flag of
25797
- * {@link InstancedMesh#morphTexture} to `true` after updating all the influences.
25798
- *
25799
- * @param {number} index - The instance index.
25800
- * @param {Mesh} object - A mesh which `morphTargetInfluences` property containing the morph target weights
25801
- * of a single instance.
25802
- * @return {InstancedMesh} A reference to this instanced mesh.
25803
- */
25804
- setMorphAt( index, object ) {
25805
-
25806
- const objectInfluences = object.morphTargetInfluences;
25807
-
25808
- const len = objectInfluences.length + 1; // morphBaseInfluence + all influences
25809
-
25810
- if ( this.morphTexture === null ) {
25811
-
25812
- this.morphTexture = new DataTexture( new Float32Array( len * this.count ), len, this.count, RedFormat, FloatType );
25813
-
25814
- }
25815
-
25816
- const array = this.morphTexture.source.data.data;
25817
-
25818
- let morphInfluencesSum = 0;
25819
-
25820
- for ( let i = 0; i < objectInfluences.length; i ++ ) {
25821
-
25822
- morphInfluencesSum += objectInfluences[ i ];
25823
-
25824
- }
25825
-
25826
- const morphBaseInfluence = this.geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
25827
-
25828
- const dataIndex = len * index;
25829
-
25830
- array[ dataIndex ] = morphBaseInfluence;
25831
-
25832
- array.set( objectInfluences, dataIndex + 1 );
25833
- return this;
25834
-
25835
- }
25836
-
25837
- updateMorphTargets() {
25838
-
25839
- }
25840
-
25841
- /**
25842
- * Frees the GPU-related resources allocated by this instance. Call this
25843
- * method whenever this instance is no longer used in your app.
25844
- */
25845
- dispose() {
25846
-
25847
- this.dispatchEvent( { type: 'dispose' } );
25848
-
25849
- if ( this.morphTexture !== null ) {
25850
-
25851
- this.morphTexture.dispose();
25852
- this.morphTexture = null;
25853
-
25854
- }
25855
-
25856
- }
25857
-
25858
- }
25859
-
25860
- const _vector1 = /*@__PURE__*/ new Vector3();
25861
- const _vector2 = /*@__PURE__*/ new Vector3();
25862
- const _normalMatrix = /*@__PURE__*/ new Matrix3();
25863
-
25864
- /**
25865
- * A two dimensional surface that extends infinitely in 3D space, represented
25866
- * in [Hessian normal form](http://mathworld.wolfram.com/HessianNormalForm.html)
25867
- * by a unit length normal vector and a constant.
25868
- */
25869
- class Plane {
25870
-
25871
- /**
25872
- * Constructs a new plane.
25873
- *
25874
- * @param {Vector3} [normal=(1,0,0)] - A unit length vector defining the normal of the plane.
25875
- * @param {number} [constant=0] - The signed distance from the origin to the plane.
25876
- */
25877
- constructor( normal = new Vector3( 1, 0, 0 ), constant = 0 ) {
25878
-
25879
- /**
25880
- * This flag can be used for type testing.
25881
- *
25882
- * @type {boolean}
25883
- * @readonly
25884
- * @default true
25885
- */
25886
- this.isPlane = true;
25887
-
25888
- /**
25889
- * A unit length vector defining the normal of the plane.
25890
- *
25891
- * @type {Vector3}
25892
- */
25893
- this.normal = normal;
25894
-
25895
- /**
25896
- * The signed distance from the origin to the plane.
25897
- *
25898
- * @type {number}
25899
- * @default 0
25900
- */
25901
- this.constant = constant;
25902
-
25903
- }
25904
-
25905
- /**
25906
- * Sets the plane components by copying the given values.
25907
- *
25908
- * @param {Vector3} normal - The normal.
25909
- * @param {number} constant - The constant.
25910
- * @return {Plane} A reference to this plane.
25911
- */
25912
- set( normal, constant ) {
25913
-
25914
- this.normal.copy( normal );
25915
- this.constant = constant;
25916
-
25917
- return this;
25918
-
25919
- }
25920
-
25921
- /**
25922
- * Sets the plane components by defining `x`, `y`, `z` as the
25923
- * plane normal and `w` as the constant.
25924
- *
25925
- * @param {number} x - The value for the normal's x component.
25926
- * @param {number} y - The value for the normal's y component.
25927
- * @param {number} z - The value for the normal's z component.
25928
- * @param {number} w - The constant value.
25929
- * @return {Plane} A reference to this plane.
25930
- */
25931
- setComponents( x, y, z, w ) {
25932
-
25933
- this.normal.set( x, y, z );
25934
- this.constant = w;
26234
+ copy( source, recursive ) {
25935
26235
 
25936
- return this;
26236
+ super.copy( source, recursive );
25937
26237
 
25938
- }
26238
+ this.instanceMatrix.copy( source.instanceMatrix );
25939
26239
 
25940
- /**
25941
- * Sets the plane from the given normal and coplanar point (that is a point
25942
- * that lies onto the plane).
25943
- *
25944
- * @param {Vector3} normal - The normal.
25945
- * @param {Vector3} point - A coplanar point.
25946
- * @return {Plane} A reference to this plane.
25947
- */
25948
- setFromNormalAndCoplanarPoint( normal, point ) {
26240
+ if ( source.morphTexture !== null ) this.morphTexture = source.morphTexture.clone();
26241
+ if ( source.instanceColor !== null ) this.instanceColor = source.instanceColor.clone();
25949
26242
 
25950
- this.normal.copy( normal );
25951
- this.constant = - point.dot( this.normal );
26243
+ this.count = source.count;
26244
+
26245
+ if ( source.boundingBox !== null ) this.boundingBox = source.boundingBox.clone();
26246
+ if ( source.boundingSphere !== null ) this.boundingSphere = source.boundingSphere.clone();
25952
26247
 
25953
26248
  return this;
25954
26249
 
25955
26250
  }
25956
26251
 
25957
26252
  /**
25958
- * Sets the plane from three coplanar points. The winding order is
25959
- * assumed to be counter-clockwise, and determines the direction of
25960
- * the plane normal.
26253
+ * Gets the color of the defined instance.
25961
26254
  *
25962
- * @param {Vector3} a - The first coplanar point.
25963
- * @param {Vector3} b - The second coplanar point.
25964
- * @param {Vector3} c - The third coplanar point.
25965
- * @return {Plane} A reference to this plane.
26255
+ * @param {number} index - The instance index.
26256
+ * @param {Color} color - The target object that is used to store the method's result.
26257
+ * @return {Color} A reference to the target color.
25966
26258
  */
25967
- setFromCoplanarPoints( a, b, c ) {
26259
+ getColorAt( index, color ) {
25968
26260
 
25969
- const normal = _vector1.subVectors( c, b ).cross( _vector2.subVectors( a, b ) ).normalize();
26261
+ if ( this.instanceColor === null ) {
25970
26262
 
25971
- // Q: should an error be thrown if normal is zero (e.g. degenerate plane)?
26263
+ return color.setRGB( 1, 1, 1 );
25972
26264
 
25973
- this.setFromNormalAndCoplanarPoint( normal, a );
26265
+ } else {
25974
26266
 
25975
- return this;
26267
+ return color.fromArray( this.instanceColor.array, index * 3 );
26268
+
26269
+ }
25976
26270
 
25977
26271
  }
25978
26272
 
25979
26273
  /**
25980
- * Copies the values of the given plane to this instance.
26274
+ * Gets the local transformation matrix of the defined instance.
25981
26275
  *
25982
- * @param {Plane} plane - The plane to copy.
25983
- * @return {Plane} A reference to this plane.
26276
+ * @param {number} index - The instance index.
26277
+ * @param {Matrix4} matrix - The target object that is used to store the method's result.
26278
+ * @return {Matrix4} A reference to the target matrix.
25984
26279
  */
25985
- copy( plane ) {
25986
-
25987
- this.normal.copy( plane.normal );
25988
- this.constant = plane.constant;
26280
+ getMatrixAt( index, matrix ) {
25989
26281
 
25990
- return this;
26282
+ return matrix.fromArray( this.instanceMatrix.array, index * 16 );
25991
26283
 
25992
26284
  }
25993
26285
 
25994
26286
  /**
25995
- * Normalizes the plane normal and adjusts the constant accordingly.
26287
+ * Gets the morph target weights of the defined instance.
25996
26288
  *
25997
- * @return {Plane} A reference to this plane.
26289
+ * @param {number} index - The instance index.
26290
+ * @param {Mesh} object - The target object that is used to store the method's result.
25998
26291
  */
25999
- normalize() {
26292
+ getMorphAt( index, object ) {
26000
26293
 
26001
- // Note: will lead to a divide by zero if the plane is invalid.
26294
+ const objectInfluences = object.morphTargetInfluences;
26002
26295
 
26003
- const inverseNormalLength = 1.0 / this.normal.length();
26004
- this.normal.multiplyScalar( inverseNormalLength );
26005
- this.constant *= inverseNormalLength;
26296
+ const array = this.morphTexture.source.data.data;
26006
26297
 
26007
- return this;
26298
+ const len = objectInfluences.length + 1; // All influences + the baseInfluenceSum
26008
26299
 
26009
- }
26300
+ const dataIndex = index * len + 1; // Skip the baseInfluenceSum at the beginning
26010
26301
 
26011
- /**
26012
- * Negates both the plane normal and the constant.
26013
- *
26014
- * @return {Plane} A reference to this plane.
26015
- */
26016
- negate() {
26302
+ for ( let i = 0; i < objectInfluences.length; i ++ ) {
26017
26303
 
26018
- this.constant *= -1;
26019
- this.normal.negate();
26304
+ objectInfluences[ i ] = array[ dataIndex + i ];
26020
26305
 
26021
- return this;
26306
+ }
26022
26307
 
26023
26308
  }
26024
26309
 
26025
- /**
26026
- * Returns the signed distance from the given point to this plane.
26027
- *
26028
- * @param {Vector3} point - The point to compute the distance for.
26029
- * @return {number} The signed distance.
26030
- */
26031
- distanceToPoint( point ) {
26310
+ raycast( raycaster, intersects ) {
26032
26311
 
26033
- return this.normal.dot( point ) + this.constant;
26312
+ const matrixWorld = this.matrixWorld;
26313
+ const raycastTimes = this.count;
26034
26314
 
26035
- }
26315
+ _mesh$1.geometry = this.geometry;
26316
+ _mesh$1.material = this.material;
26036
26317
 
26037
- /**
26038
- * Returns the signed distance from the given sphere to this plane.
26039
- *
26040
- * @param {Sphere} sphere - The sphere to compute the distance for.
26041
- * @return {number} The signed distance.
26042
- */
26043
- distanceToSphere( sphere ) {
26318
+ if ( _mesh$1.material === undefined ) return;
26044
26319
 
26045
- return this.distanceToPoint( sphere.center ) - sphere.radius;
26320
+ // test with bounding sphere first
26046
26321
 
26047
- }
26322
+ if ( this.boundingSphere === null ) this.computeBoundingSphere();
26048
26323
 
26049
- /**
26050
- * Projects a the given point onto the plane.
26051
- *
26052
- * @param {Vector3} point - The point to project.
26053
- * @param {Vector3} target - The target vector that is used to store the method's result.
26054
- * @return {Vector3} The projected point on the plane.
26055
- */
26056
- projectPoint( point, target ) {
26324
+ _sphere$4.copy( this.boundingSphere );
26325
+ _sphere$4.applyMatrix4( matrixWorld );
26057
26326
 
26058
- return target.copy( point ).addScaledVector( this.normal, - this.distanceToPoint( point ) );
26327
+ if ( raycaster.ray.intersectsSphere( _sphere$4 ) === false ) return;
26059
26328
 
26060
- }
26329
+ // now test each instance
26061
26330
 
26062
- /**
26063
- * Returns the intersection point of the passed line and the plane. Returns
26064
- * `null` if the line does not intersect. Returns the line's starting point if
26065
- * the line is coplanar with the plane.
26066
- *
26067
- * @param {Line3} line - The line to compute the intersection for.
26068
- * @param {Vector3} target - The target vector that is used to store the method's result.
26069
- * @param {boolean} [clampToLine=true] - Whether to clamp the intersection to the line segment.
26070
- * @return {?Vector3} The intersection point. Returns `null` if no intersection is detected.
26071
- */
26072
- intersectLine( line, target, clampToLine = true ) {
26331
+ for ( let instanceId = 0; instanceId < raycastTimes; instanceId ++ ) {
26073
26332
 
26074
- const direction = line.delta( _vector1 );
26333
+ // calculate the world matrix for each instance
26075
26334
 
26076
- const denominator = this.normal.dot( direction );
26335
+ this.getMatrixAt( instanceId, _instanceLocalMatrix );
26077
26336
 
26078
- if ( denominator === 0 ) {
26337
+ _instanceWorldMatrix.multiplyMatrices( matrixWorld, _instanceLocalMatrix );
26079
26338
 
26080
- // line is coplanar, return origin
26081
- if ( this.distanceToPoint( line.start ) === 0 ) {
26339
+ // the mesh represents this single instance
26082
26340
 
26083
- return target.copy( line.start );
26341
+ _mesh$1.matrixWorld = _instanceWorldMatrix;
26084
26342
 
26085
- }
26343
+ _mesh$1.raycast( raycaster, _instanceIntersects );
26086
26344
 
26087
- // Unsure if this is the correct method to handle this case.
26088
- return null;
26345
+ // process the result of raycast
26089
26346
 
26090
- }
26347
+ for ( let i = 0, l = _instanceIntersects.length; i < l; i ++ ) {
26091
26348
 
26092
- const t = - ( line.start.dot( this.normal ) + this.constant ) / denominator;
26349
+ const intersect = _instanceIntersects[ i ];
26350
+ intersect.instanceId = instanceId;
26351
+ intersect.object = this;
26352
+ intersects.push( intersect );
26093
26353
 
26094
- if ( ( clampToLine === true ) && ( t < 0 || t > 1 ) ) {
26354
+ }
26095
26355
 
26096
- return null;
26356
+ _instanceIntersects.length = 0;
26097
26357
 
26098
26358
  }
26099
26359
 
26100
- return target.copy( line.start ).addScaledVector( direction, t );
26101
-
26102
26360
  }
26103
26361
 
26104
26362
  /**
26105
- * Returns `true` if the given line segment intersects with (passes through) the plane.
26363
+ * Sets the given color to the defined instance. Make sure you set the `needsUpdate` flag of
26364
+ * {@link InstancedMesh#instanceColor} to `true` after updating all the colors.
26106
26365
  *
26107
- * @param {Line3} line - The line to test.
26108
- * @return {boolean} Whether the given line segment intersects with the plane or not.
26366
+ * @param {number} index - The instance index.
26367
+ * @param {Color} color - The instance color.
26368
+ * @return {InstancedMesh} A reference to this instanced mesh.
26109
26369
  */
26110
- intersectsLine( line ) {
26370
+ setColorAt( index, color ) {
26111
26371
 
26112
- // Note: this tests if a line intersects the plane, not whether it (or its end-points) are coplanar with it.
26372
+ if ( this.instanceColor === null ) {
26113
26373
 
26114
- const startSign = this.distanceToPoint( line.start );
26115
- const endSign = this.distanceToPoint( line.end );
26374
+ this.instanceColor = new InstancedBufferAttribute( new Float32Array( this.instanceMatrix.count * 3 ).fill( 1 ), 3 );
26116
26375
 
26117
- return ( startSign < 0 && endSign > 0 ) || ( endSign < 0 && startSign > 0 );
26376
+ }
26377
+
26378
+ color.toArray( this.instanceColor.array, index * 3 );
26379
+ return this;
26118
26380
 
26119
26381
  }
26120
26382
 
26121
26383
  /**
26122
- * Returns `true` if the given bounding box intersects with the plane.
26384
+ * Sets the given local transformation matrix to the defined instance. Make sure you set the `needsUpdate` flag of
26385
+ * {@link InstancedMesh#instanceMatrix} to `true` after updating all the matrices.
26123
26386
  *
26124
- * @param {Box3} box - The bounding box to test.
26125
- * @return {boolean} Whether the given bounding box intersects with the plane or not.
26387
+ * @param {number} index - The instance index.
26388
+ * @param {Matrix4} matrix - The local transformation.
26389
+ * @return {InstancedMesh} A reference to this instanced mesh.
26126
26390
  */
26127
- intersectsBox( box ) {
26391
+ setMatrixAt( index, matrix ) {
26128
26392
 
26129
- return box.intersectsPlane( this );
26393
+ matrix.toArray( this.instanceMatrix.array, index * 16 );
26394
+ return this;
26130
26395
 
26131
26396
  }
26132
26397
 
26133
26398
  /**
26134
- * Returns `true` if the given bounding sphere intersects with the plane.
26399
+ * Sets the morph target weights to the defined instance. Make sure you set the `needsUpdate` flag of
26400
+ * {@link InstancedMesh#morphTexture} to `true` after updating all the influences.
26135
26401
  *
26136
- * @param {Sphere} sphere - The bounding sphere to test.
26137
- * @return {boolean} Whether the given bounding sphere intersects with the plane or not.
26402
+ * @param {number} index - The instance index.
26403
+ * @param {Mesh} object - A mesh which `morphTargetInfluences` property containing the morph target weights
26404
+ * of a single instance.
26405
+ * @return {InstancedMesh} A reference to this instanced mesh.
26138
26406
  */
26139
- intersectsSphere( sphere ) {
26140
-
26141
- return sphere.intersectsPlane( this );
26407
+ setMorphAt( index, object ) {
26142
26408
 
26143
- }
26409
+ const objectInfluences = object.morphTargetInfluences;
26144
26410
 
26145
- /**
26146
- * Returns a coplanar vector to the plane, by calculating the
26147
- * projection of the normal at the origin onto the plane.
26148
- *
26149
- * @param {Vector3} target - The target vector that is used to store the method's result.
26150
- * @return {Vector3} The coplanar point.
26151
- */
26152
- coplanarPoint( target ) {
26411
+ const len = objectInfluences.length + 1; // morphBaseInfluence + all influences
26153
26412
 
26154
- return target.copy( this.normal ).multiplyScalar( - this.constant );
26413
+ if ( this.morphTexture === null ) {
26155
26414
 
26156
- }
26415
+ this.morphTexture = new DataTexture( new Float32Array( len * this.count ), len, this.count, RedFormat, FloatType );
26157
26416
 
26158
- /**
26159
- * Apply a 4x4 matrix to the plane. The matrix must be an affine, homogeneous transform.
26160
- *
26161
- * The optional normal matrix can be pre-computed like so:
26162
- * ```js
26163
- * const optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );
26164
- * ```
26165
- *
26166
- * @param {Matrix4} matrix - The transformation matrix.
26167
- * @param {Matrix4} [optionalNormalMatrix] - A pre-computed normal matrix.
26168
- * @return {Plane} A reference to this plane.
26169
- */
26170
- applyMatrix4( matrix, optionalNormalMatrix ) {
26417
+ }
26171
26418
 
26172
- const normalMatrix = optionalNormalMatrix || _normalMatrix.getNormalMatrix( matrix );
26419
+ const array = this.morphTexture.source.data.data;
26173
26420
 
26174
- const referencePoint = this.coplanarPoint( _vector1 ).applyMatrix4( matrix );
26421
+ let morphInfluencesSum = 0;
26175
26422
 
26176
- const normal = this.normal.applyMatrix3( normalMatrix ).normalize();
26423
+ for ( let i = 0; i < objectInfluences.length; i ++ ) {
26177
26424
 
26178
- this.constant = - referencePoint.dot( normal );
26425
+ morphInfluencesSum += objectInfluences[ i ];
26179
26426
 
26180
- return this;
26427
+ }
26181
26428
 
26182
- }
26429
+ const morphBaseInfluence = this.geometry.morphTargetsRelative ? 1 : 1 - morphInfluencesSum;
26183
26430
 
26184
- /**
26185
- * Translates the plane by the distance defined by the given offset vector.
26186
- * Note that this only affects the plane constant and will not affect the normal vector.
26187
- *
26188
- * @param {Vector3} offset - The offset vector.
26189
- * @return {Plane} A reference to this plane.
26190
- */
26191
- translate( offset ) {
26431
+ const dataIndex = len * index;
26192
26432
 
26193
- this.constant -= offset.dot( this.normal );
26433
+ array[ dataIndex ] = morphBaseInfluence;
26194
26434
 
26435
+ array.set( objectInfluences, dataIndex + 1 );
26195
26436
  return this;
26196
26437
 
26197
26438
  }
26198
26439
 
26199
- /**
26200
- * Returns `true` if this plane is equal with the given one.
26201
- *
26202
- * @param {Plane} plane - The plane to test for equality.
26203
- * @return {boolean} Whether this plane is equal with the given one.
26204
- */
26205
- equals( plane ) {
26206
-
26207
- return plane.normal.equals( this.normal ) && ( plane.constant === this.constant );
26440
+ updateMorphTargets() {
26208
26441
 
26209
26442
  }
26210
26443
 
26211
26444
  /**
26212
- * Returns a new plane with copied values from this instance.
26213
- *
26214
- * @return {Plane} A clone of this instance.
26445
+ * Frees the GPU-related resources allocated by this instance. Call this
26446
+ * method whenever this instance is no longer used in your app.
26215
26447
  */
26216
- clone() {
26448
+ dispose() {
26217
26449
 
26218
- return new this.constructor().copy( this );
26450
+ super.dispose();
26451
+
26452
+ if ( this.morphTexture !== null ) {
26453
+
26454
+ this.morphTexture.dispose();
26455
+ this.morphTexture = null;
26456
+
26457
+ }
26219
26458
 
26220
26459
  }
26221
26460
 
@@ -26404,6 +26643,10 @@ class Frustum {
26404
26643
  /**
26405
26644
  * Returns `true` if the given bounding sphere is intersecting this frustum.
26406
26645
  *
26646
+ * This is a fast, conservative test that favors performance over precision. It can
26647
+ * report false positives for spheres that lie outside the frustum but are not separated
26648
+ * by a single frustum plane. It never reports false negatives, so it is safe for culling.
26649
+ *
26407
26650
  * @param {Sphere} sphere - The bounding sphere to test.
26408
26651
  * @return {boolean} Whether the bounding sphere is intersecting this frustum or not.
26409
26652
  */
@@ -26432,6 +26675,11 @@ class Frustum {
26432
26675
  /**
26433
26676
  * Returns `true` if the given bounding box is intersecting this frustum.
26434
26677
  *
26678
+ * This is a fast, conservative test that favors performance over precision. It can
26679
+ * report false positives for large boxes that lie outside the frustum but are not
26680
+ * separated by a single frustum plane. It never reports false negatives, so it is
26681
+ * safe for culling.
26682
+ *
26435
26683
  * @param {Box3} box - The bounding box to test.
26436
26684
  * @return {boolean} Whether the bounding box is intersecting this frustum or not.
26437
26685
  */
@@ -26684,7 +26932,7 @@ class FrustumArray {
26684
26932
  /**
26685
26933
  * Copies the values of the given frustum array to this instance.
26686
26934
  *
26687
- * @param {FrustumArray} frustumArray - The frustum array to copy.
26935
+ * @param {FrustumArray} source - The frustum array to copy.
26688
26936
  * @return {FrustumArray} A reference to this frustum array.
26689
26937
  */
26690
26938
  copy( source ) {
@@ -26981,6 +27229,7 @@ class BatchedMesh extends Mesh {
26981
27229
  this._multiDrawCounts = new Int32Array( maxInstanceCount );
26982
27230
  this._multiDrawStarts = new Int32Array( maxInstanceCount );
26983
27231
  this._multiDrawCount = 0;
27232
+ this._multiDrawBytesPerElement = 1;
26984
27233
 
26985
27234
  // Local matrix per geometry by using data texture
26986
27235
  this._matricesTexture = null;
@@ -27912,6 +28161,7 @@ class BatchedMesh extends Mesh {
27912
28161
  this.validateGeometryId( geometryId );
27913
28162
 
27914
28163
  this._instanceInfo[ instanceId ].geometryIndex = geometryId;
28164
+ this._visibilityChanged = true;
27915
28165
 
27916
28166
  return this;
27917
28167
 
@@ -28182,6 +28432,7 @@ class BatchedMesh extends Mesh {
28182
28432
  this._geometryInitialized = source._geometryInitialized;
28183
28433
  this._multiDrawCounts = source._multiDrawCounts.slice();
28184
28434
  this._multiDrawStarts = source._multiDrawStarts.slice();
28435
+ this._multiDrawBytesPerElement = source._multiDrawBytesPerElement;
28185
28436
 
28186
28437
  this._indirectTexture = source._indirectTexture.clone();
28187
28438
  this._indirectTexture.image.data = this._indirectTexture.image.data.slice();
@@ -28206,6 +28457,8 @@ class BatchedMesh extends Mesh {
28206
28457
  */
28207
28458
  dispose() {
28208
28459
 
28460
+ super.dispose();
28461
+
28209
28462
  // Assuming the geometry is not shared with other meshes
28210
28463
  this.geometry.dispose();
28211
28464
 
@@ -28384,6 +28637,7 @@ class BatchedMesh extends Mesh {
28384
28637
 
28385
28638
  indirectTexture.needsUpdate = true;
28386
28639
  this._multiDrawCount = multiDrawCount;
28640
+ this._multiDrawBytesPerElement = bytesPerElement;
28387
28641
  this._visibilityChanged = false;
28388
28642
 
28389
28643
  }
@@ -28661,6 +28915,18 @@ class Line extends Object3D {
28661
28915
 
28662
28916
  }
28663
28917
 
28918
+ /**
28919
+ * Returns `true` if this line intersects the given frustum.
28920
+ *
28921
+ * @param {Frustum|FrustumArray} frustum - The frustum to test.
28922
+ * @return {boolean} Whether this line intersects the given frustum or not.
28923
+ */
28924
+ intersectsFrustum( frustum ) {
28925
+
28926
+ return frustum.intersectsObject( this );
28927
+
28928
+ }
28929
+
28664
28930
  /**
28665
28931
  * Computes intersection points between a casted ray and this line.
28666
28932
  *
@@ -29163,6 +29429,18 @@ class Points extends Object3D {
29163
29429
 
29164
29430
  }
29165
29431
 
29432
+ /**
29433
+ * Returns `true` if this point cloud intersects the given frustum.
29434
+ *
29435
+ * @param {Frustum|FrustumArray} frustum - The frustum to test.
29436
+ * @return {boolean} Whether this point cloud intersects the given frustum or not.
29437
+ */
29438
+ intersectsFrustum( frustum ) {
29439
+
29440
+ return frustum.intersectsObject( this );
29441
+
29442
+ }
29443
+
29166
29444
  /**
29167
29445
  * Computes intersection points between a casted ray and this point cloud.
29168
29446
  *
@@ -29714,6 +29992,22 @@ class CompressedArrayTexture extends CompressedTexture {
29714
29992
 
29715
29993
  }
29716
29994
 
29995
+ /**
29996
+ * Copies the values of the given texture to this instance.
29997
+ *
29998
+ * @param {CompressedArrayTexture} source - The texture to copy.
29999
+ * @return {CompressedArrayTexture} A reference to this instance.
30000
+ */
30001
+ copy( source ) {
30002
+
30003
+ super.copy( source );
30004
+
30005
+ this.wrapR = source.wrapR;
30006
+
30007
+ return this;
30008
+
30009
+ }
30010
+
29717
30011
  /**
29718
30012
  * Describes that a specific layer of the texture needs to be updated.
29719
30013
  * Normally when {@link Texture#needsUpdate} is set to `true`, the
@@ -30054,7 +30348,7 @@ class DepthTexture extends Texture {
30054
30348
 
30055
30349
  super.copy( source );
30056
30350
 
30057
- this.source = new Source( Object.assign( {}, source.image ) ); // see #30540
30351
+ this.source = new TextureSource( Object.assign( {}, source.image ) ); // see #30540
30058
30352
  this.compareFunction = source.compareFunction;
30059
30353
 
30060
30354
  return this;
@@ -30065,7 +30359,7 @@ class DepthTexture extends Texture {
30065
30359
 
30066
30360
  const data = super.toJSON( meta );
30067
30361
 
30068
- if ( this.compareFunction !== null ) data.compareFunction = this.compareFunction;
30362
+ data.compareFunction = this.compareFunction;
30069
30363
 
30070
30364
  return data;
30071
30365
 
@@ -37587,7 +37881,7 @@ class TorusGeometry extends BufferGeometry {
37587
37881
  */
37588
37882
  static fromJSON( data ) {
37589
37883
 
37590
- return new TorusGeometry( data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc );
37884
+ return new TorusGeometry( data.radius, data.tube, data.radialSegments, data.tubularSegments, data.arc, data.thetaStart, data.thetaLength );
37591
37885
 
37592
37886
  }
37593
37887
 
@@ -39467,6 +39761,8 @@ class MeshStandardMaterial extends Material {
39467
39761
  * transparent materials are less reflective. Physically-based transmission provides a more
39468
39762
  * realistic option for thin, transparent surfaces like glass.
39469
39763
  * - Advanced reflectivity: More flexible reflectivity for non-metallic materials.
39764
+ * - Retroreflection: Redirects specular light back toward the light source for
39765
+ * safety materials like road markings and reflective tape.
39470
39766
  * - Sheen: Can be used for representing cloth and fabric materials.
39471
39767
  *
39472
39768
  * As a result of these complex shading features, `MeshPhysicalMaterial` has a
@@ -39802,6 +40098,7 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
39802
40098
  this._clearcoat = 0;
39803
40099
  this._dispersion = 0;
39804
40100
  this._iridescence = 0;
40101
+ this._retroreflectivity = 0;
39805
40102
  this._sheen = 0.0;
39806
40103
  this._transmission = 0;
39807
40104
 
@@ -39909,6 +40206,33 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
39909
40206
 
39910
40207
  }
39911
40208
 
40209
+ /**
40210
+ * The strength of retroreflection, from `0.0` to `1.0`. A value of `1.0`
40211
+ * evaluates the material's microfacet reflection with the view direction
40212
+ * reflected about the surface normal, redirecting the specular lobe back
40213
+ * toward the light source.
40214
+ *
40215
+ * @type {number}
40216
+ * @default 0
40217
+ */
40218
+ get retroreflectivity() {
40219
+
40220
+ return this._retroreflectivity;
40221
+
40222
+ }
40223
+
40224
+ set retroreflectivity( value ) {
40225
+
40226
+ if ( this._retroreflectivity > 0 !== value > 0 ) {
40227
+
40228
+ this.version ++;
40229
+
40230
+ }
40231
+
40232
+ this._retroreflectivity = value;
40233
+
40234
+ }
40235
+
39912
40236
  /**
39913
40237
  * The intensity of the sheen layer, from `0.0` to `1.0`.
39914
40238
  *
@@ -39994,6 +40318,8 @@ class MeshPhysicalMaterial extends MeshStandardMaterial {
39994
40318
  this.iridescenceThicknessRange = [ ...source.iridescenceThicknessRange ];
39995
40319
  this.iridescenceThicknessMap = source.iridescenceThicknessMap;
39996
40320
 
40321
+ this.retroreflectivity = source.retroreflectivity;
40322
+
39997
40323
  this.sheen = source.sheen;
39998
40324
  this.sheenColor.copy( source.sheenColor );
39999
40325
  this.sheenColorMap = source.sheenColorMap;
@@ -42079,6 +42405,18 @@ function convertArray( array, type ) {
42079
42405
 
42080
42406
  }
42081
42407
 
42408
+ /**
42409
+ * Returns `true` if the given keyframe track settings hold Bezier tangent data.
42410
+ *
42411
+ * @param {?Object} settings - The settings of a keyframe track.
42412
+ * @return {boolean} Whether both tangent arrays are defined or not.
42413
+ */
42414
+ function hasTangents( settings ) {
42415
+
42416
+ return settings !== undefined && settings.inTangents !== undefined && settings.outTangents !== undefined;
42417
+
42418
+ }
42419
+
42082
42420
  /**
42083
42421
  * Returns an array by which times and values can be sorted.
42084
42422
  *
@@ -42461,6 +42799,19 @@ class AnimationUtils {
42461
42799
 
42462
42800
  }
42463
42801
 
42802
+ /**
42803
+ * Returns `true` if the given keyframe track settings hold Bezier tangent data.
42804
+ *
42805
+ * @static
42806
+ * @param {?Object} settings - The settings of a keyframe track.
42807
+ * @return {boolean} Whether both tangent arrays are defined or not.
42808
+ */
42809
+ static hasTangents( settings ) {
42810
+
42811
+ return hasTangents( settings );
42812
+
42813
+ }
42814
+
42464
42815
  /**
42465
42816
  * Returns an array by which times and values can be sorted.
42466
42817
  *
@@ -43155,42 +43506,55 @@ class BezierInterpolant extends Interpolant {
43155
43506
  const c1x = inTangents[ inTangentOffset ];
43156
43507
  const c1y = inTangents[ inTangentOffset + 1 ];
43157
43508
 
43158
- // Solve for Bezier parameter s where Bx(s) = t using Newton-Raphson
43159
- let s = ( t - t0 ) / ( t1 - t0 );
43160
- let s2, s3, oneMinusS, oneMinusS2, oneMinusS3;
43509
+ // Find the curve parameter s where the Bezier X(s) matches t, then evaluate Y(s)
43510
+ const s = solveBezierParameter( t, t0, c0x, c1x, t1 );
43161
43511
 
43162
- for ( let iter = 0; iter < 8; iter ++ ) {
43512
+ result[ i ] = cubicBezier( s, v0, c0y, c1y, v1 );
43163
43513
 
43164
- s2 = s * s;
43165
- s3 = s2 * s;
43166
- oneMinusS = 1 - s;
43167
- oneMinusS2 = oneMinusS * oneMinusS;
43168
- oneMinusS3 = oneMinusS2 * oneMinusS;
43514
+ }
43169
43515
 
43170
- // Bezier X(s) = (1-s)³·t0 + 3(1-s)²s·c0x + 3(1-s)s²·c1x + s³·t1
43171
- const bx = oneMinusS3 * t0 + 3 * oneMinusS2 * s * c0x + 3 * oneMinusS * s2 * c1x + s3 * t1;
43516
+ return result;
43172
43517
 
43173
- const error = bx - t;
43174
- if ( Math.abs( error ) < 1e-10 ) break;
43518
+ }
43175
43519
 
43176
- // Derivative dX/ds
43177
- const dbx = 3 * oneMinusS2 * ( c0x - t0 ) + 6 * oneMinusS * s * ( c1x - c0x ) + 3 * s2 * ( t1 - c1x );
43178
- if ( Math.abs( dbx ) < 1e-10 ) break;
43520
+ }
43179
43521
 
43180
- s = s - error / dbx;
43181
- s = Math.max( 0, Math.min( 1, s ) );
43522
+ function cubicBezier( s, p0, p1, p2, p3 ) {
43182
43523
 
43183
- }
43524
+ const k = 1 - s;
43184
43525
 
43185
- // Evaluate Bezier Y(s)
43186
- result[ i ] = oneMinusS3 * v0 + 3 * oneMinusS2 * s * c0y + 3 * oneMinusS * s2 * c1y + s3 * v1;
43526
+ return k * k * k * p0 + 3 * k * k * s * p1 + 3 * k * s * s * p2 + s * s * s * p3;
43187
43527
 
43188
- }
43528
+ }
43189
43529
 
43190
- return result;
43530
+ function cubicBezierSlope( s, p0, p1, p2, p3 ) {
43531
+
43532
+ const k = 1 - s;
43533
+
43534
+ return 3 * k * k * ( p1 - p0 ) + 6 * k * s * ( p2 - p1 ) + 3 * s * s * ( p3 - p2 );
43535
+
43536
+ }
43537
+
43538
+ // Solves cubicBezier( s, x0, x1, x2, x3 ) = x for s in [0,1] using Newton-Raphson
43539
+
43540
+ function solveBezierParameter( x, x0, x1, x2, x3 ) {
43541
+
43542
+ let s = ( x - x0 ) / ( x3 - x0 );
43543
+
43544
+ for ( let i = 0; i < 8; i ++ ) {
43545
+
43546
+ const error = cubicBezier( s, x0, x1, x2, x3 ) - x;
43547
+ if ( Math.abs( error ) < 1e-10 ) break;
43548
+
43549
+ const slope = cubicBezierSlope( s, x0, x1, x2, x3 );
43550
+ if ( Math.abs( slope ) < 1e-10 ) break;
43551
+
43552
+ s = Math.max( 0, Math.min( 1, s - error / slope ) );
43191
43553
 
43192
43554
  }
43193
43555
 
43556
+ return s;
43557
+
43194
43558
  }
43195
43559
 
43196
43560
  /**
@@ -43277,6 +43641,15 @@ class KeyframeTrack {
43277
43641
 
43278
43642
  }
43279
43643
 
43644
+ if ( hasTangents( track.settings ) ) {
43645
+
43646
+ json.settings = {
43647
+ inTangents: convertArray( track.settings.inTangents, Array ),
43648
+ outTangents: convertArray( track.settings.outTangents, Array )
43649
+ };
43650
+
43651
+ }
43652
+
43280
43653
  }
43281
43654
 
43282
43655
  json.type = track.ValueTypeName; // mandatory
@@ -43502,6 +43875,13 @@ class KeyframeTrack {
43502
43875
 
43503
43876
  }
43504
43877
 
43878
+ if ( hasTangents( this.settings ) ) {
43879
+
43880
+ scaleTangentTimes( this.settings.inTangents, timeScale );
43881
+ scaleTangentTimes( this.settings.outTangents, timeScale );
43882
+
43883
+ }
43884
+
43505
43885
  }
43506
43886
 
43507
43887
  return this;
@@ -43777,12 +44157,33 @@ class KeyframeTrack {
43777
44157
  // Interpolant argument to constructor is not saved, so copy the factory method directly.
43778
44158
  track.createInterpolant = this.createInterpolant;
43779
44159
 
44160
+ if ( hasTangents( this.settings ) ) {
44161
+
44162
+ track.settings = {
44163
+ inTangents: this.settings.inTangents.slice(),
44164
+ outTangents: this.settings.outTangents.slice()
44165
+ };
44166
+
44167
+ }
44168
+
43780
44169
  return track;
43781
44170
 
43782
44171
  }
43783
44172
 
43784
44173
  }
43785
44174
 
44175
+ function scaleTangentTimes( tangents, timeScale ) {
44176
+
44177
+ // tangents are [ time, value ] pairs, so only every second entry is a time
44178
+
44179
+ for ( let i = 0, n = tangents.length; i !== n; i += 2 ) {
44180
+
44181
+ tangents[ i ] *= timeScale;
44182
+
44183
+ }
44184
+
44185
+ }
44186
+
43786
44187
  /**
43787
44188
  * The value type name.
43788
44189
  *
@@ -44563,18 +44964,31 @@ function parseKeyframeTrack( json ) {
44563
44964
 
44564
44965
  }
44565
44966
 
44967
+ let track;
44968
+
44566
44969
  // derived classes can define a static parse method
44567
44970
  if ( trackType.parse !== undefined ) {
44568
44971
 
44569
- return trackType.parse( json );
44972
+ track = trackType.parse( json );
44570
44973
 
44571
44974
  } else {
44572
44975
 
44573
44976
  // by default, we assume a constructor compatible with the base
44574
- return new trackType( json.name, json.times, json.values, json.interpolation );
44977
+ track = new trackType( json.name, json.times, json.values, json.interpolation );
44978
+
44979
+ }
44980
+
44981
+ if ( hasTangents( json.settings ) ) {
44982
+
44983
+ track.settings = {
44984
+ inTangents: convertArray( json.settings.inTangents, Float32Array ),
44985
+ outTangents: convertArray( json.settings.outTangents, Float32Array )
44986
+ };
44575
44987
 
44576
44988
  }
44577
44989
 
44990
+ return track;
44991
+
44578
44992
  }
44579
44993
 
44580
44994
  /**
@@ -46393,16 +46807,6 @@ class Light extends Object3D {
46393
46807
 
46394
46808
  }
46395
46809
 
46396
- /**
46397
- * Frees the GPU-related resources allocated by this instance. Call this
46398
- * method whenever this instance is no longer used in your app.
46399
- */
46400
- dispose() {
46401
-
46402
- this.dispatchEvent( { type: 'dispose' } );
46403
-
46404
- }
46405
-
46406
46810
  copy( source, recursive ) {
46407
46811
 
46408
46812
  super.copy( source, recursive );
@@ -46675,6 +47079,18 @@ class LightShadow {
46675
47079
 
46676
47080
  }
46677
47081
 
47082
+ /**
47083
+ * Used internally by the renderer to get the camera that renders the given viewport.
47084
+ *
47085
+ * @param {number} [viewportIndex=0] - The viewport index.
47086
+ * @return {Camera} The shadow camera.
47087
+ */
47088
+ getCamera( /* viewportIndex */ ) {
47089
+
47090
+ return this.camera;
47091
+
47092
+ }
47093
+
46678
47094
  /**
46679
47095
  * Gets the shadow cameras frustum. Used internally by the renderer to cull objects.
46680
47096
  *
@@ -46694,23 +47110,41 @@ class LightShadow {
46694
47110
  updateMatrices( light ) {
46695
47111
 
46696
47112
  const shadowCamera = this.camera;
46697
- const shadowMatrix = this.matrix;
46698
-
46699
47113
  _lightPositionWorld.setFromMatrixPosition( light.matrixWorld );
46700
47114
  shadowCamera.position.copy( _lightPositionWorld );
46701
47115
 
46702
47116
  _lookTarget.setFromMatrixPosition( light.target.matrixWorld );
46703
47117
  shadowCamera.lookAt( _lookTarget );
46704
47118
  shadowCamera.updateMatrixWorld();
47119
+ this._updateMatrix( shadowCamera, this.matrix, this._frustum );
47120
+
47121
+ }
47122
+
47123
+ /**
47124
+ * Updates a shadow projection matrix and its corresponding frustum.
47125
+ *
47126
+ * @private
47127
+ * @param {Camera} shadowCamera - The shadow camera.
47128
+ * @param {Matrix4} shadowMatrix - The target shadow matrix.
47129
+ * @param {Frustum} frustum - The target frustum.
47130
+ * @param {Vector4} [viewport] - The viewport within the shadow atlas.
47131
+ */
47132
+ _updateMatrix( shadowCamera, shadowMatrix, frustum, viewport ) {
46705
47133
 
46706
47134
  _projScreenMatrix.multiplyMatrices( shadowCamera.projectionMatrix, shadowCamera.matrixWorldInverse );
46707
- this._frustum.setFromProjectionMatrix( _projScreenMatrix, shadowCamera.coordinateSystem, shadowCamera.reversedDepth );
47135
+ frustum.setFromProjectionMatrix( _projScreenMatrix, shadowCamera.coordinateSystem, shadowCamera.reversedDepth );
47136
+
47137
+ const frameExtents = this._frameExtents;
47138
+ const scaleX = viewport ? viewport.z / frameExtents.x : 1;
47139
+ const scaleY = viewport ? viewport.w / frameExtents.y : 1;
47140
+ const offsetX = viewport ? viewport.x / frameExtents.x : 0;
47141
+ const offsetY = viewport ? viewport.y / frameExtents.y : 0;
46708
47142
 
46709
47143
  if ( shadowCamera.coordinateSystem === WebGPUCoordinateSystem || shadowCamera.reversedDepth ) {
46710
47144
 
46711
47145
  shadowMatrix.set(
46712
- 0.5, 0.0, 0.0, 0.5,
46713
- 0.0, 0.5, 0.0, 0.5,
47146
+ 0.5 * scaleX, 0.0, 0.0, 0.5 * scaleX + offsetX,
47147
+ 0.0, 0.5 * scaleY, 0.0, 0.5 * scaleY + offsetY,
46714
47148
  0.0, 0.0, 1.0, 0.0, // Identity Z (preserving the correct [0, 1] range from the projection matrix)
46715
47149
  0.0, 0.0, 0.0, 1.0
46716
47150
  );
@@ -46718,8 +47152,8 @@ class LightShadow {
46718
47152
  } else {
46719
47153
 
46720
47154
  shadowMatrix.set(
46721
- 0.5, 0.0, 0.0, 0.5,
46722
- 0.0, 0.5, 0.0, 0.5,
47155
+ 0.5 * scaleX, 0.0, 0.0, 0.5 * scaleX + offsetX,
47156
+ 0.0, 0.5 * scaleY, 0.0, 0.5 * scaleY + offsetY,
46723
47157
  0.0, 0.0, 0.5, 0.5,
46724
47158
  0.0, 0.0, 0.0, 1.0
46725
47159
  );
@@ -46822,11 +47256,12 @@ class LightShadow {
46822
47256
 
46823
47257
  const object = {};
46824
47258
 
46825
- if ( this.intensity !== 1 ) object.intensity = this.intensity;
46826
- if ( this.bias !== 0 ) object.bias = this.bias;
46827
- if ( this.normalBias !== 0 ) object.normalBias = this.normalBias;
46828
- if ( this.radius !== 1 ) object.radius = this.radius;
46829
- if ( this.mapSize.x !== 512 || this.mapSize.y !== 512 ) object.mapSize = this.mapSize.toArray();
47259
+ object.intensity = this.intensity;
47260
+ object.bias = this.bias;
47261
+ object.normalBias = this.normalBias;
47262
+ object.radius = this.radius;
47263
+ object.blurSamples = this.blurSamples;
47264
+ object.mapSize = this.mapSize.toArray();
46830
47265
 
46831
47266
  object.camera = this.camera.toJSON( false ).object;
46832
47267
  delete object.camera.matrix;
@@ -47459,11 +47894,29 @@ class SpotLightShadow extends LightShadow {
47459
47894
  super.copy( source );
47460
47895
 
47461
47896
  this.focus = source.focus;
47897
+ this.aspect = source.aspect;
47462
47898
 
47463
47899
  return this;
47464
47900
 
47465
47901
  }
47466
47902
 
47903
+ /**
47904
+ * Serializes the light shadow into JSON.
47905
+ *
47906
+ * @return {Object} A JSON object representing the serialized light shadow.
47907
+ * @see {@link ObjectLoader#parse}
47908
+ */
47909
+ toJSON() {
47910
+
47911
+ const object = super.toJSON();
47912
+
47913
+ object.focus = this.focus;
47914
+ object.aspect = this.aspect;
47915
+
47916
+ return object;
47917
+
47918
+ }
47919
+
47467
47920
  }
47468
47921
 
47469
47922
  /**
@@ -49139,6 +49592,8 @@ class BufferGeometryLoader extends Loader {
49139
49592
  const ib = new InterleavedBuffer( array, interleavedBuffer.stride );
49140
49593
  ib.uuid = interleavedBuffer.uuid;
49141
49594
 
49595
+ if ( interleavedBuffer.usage !== undefined ) ib.setUsage( interleavedBuffer.usage );
49596
+
49142
49597
  interleavedBufferMap[ uuid ] = ib;
49143
49598
 
49144
49599
  return ib;
@@ -49193,6 +49648,7 @@ class BufferGeometryLoader extends Loader {
49193
49648
 
49194
49649
  if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;
49195
49650
  if ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );
49651
+ if ( attribute.gpuType !== undefined ) bufferAttribute.gpuType = attribute.gpuType;
49196
49652
 
49197
49653
  geometry.setAttribute( key, bufferAttribute );
49198
49654
 
@@ -49226,6 +49682,8 @@ class BufferGeometryLoader extends Loader {
49226
49682
  }
49227
49683
 
49228
49684
  if ( attribute.name !== undefined ) bufferAttribute.name = attribute.name;
49685
+ if ( attribute.usage !== undefined ) bufferAttribute.setUsage( attribute.usage );
49686
+ if ( attribute.gpuType !== undefined ) bufferAttribute.gpuType = attribute.gpuType;
49229
49687
  array.push( bufferAttribute );
49230
49688
 
49231
49689
  }
@@ -49758,14 +50216,14 @@ class ObjectLoader extends Loader {
49758
50216
 
49759
50217
  }
49760
50218
 
49761
- images[ image.uuid ] = new Source( imageArray );
50219
+ images[ image.uuid ] = new TextureSource( imageArray );
49762
50220
 
49763
50221
  } else {
49764
50222
 
49765
50223
  // load single image
49766
50224
 
49767
50225
  const deserializedImage = deserializeImage( image.url );
49768
- images[ image.uuid ] = new Source( deserializedImage );
50226
+ images[ image.uuid ] = new TextureSource( deserializedImage );
49769
50227
 
49770
50228
 
49771
50229
  }
@@ -49855,14 +50313,14 @@ class ObjectLoader extends Loader {
49855
50313
 
49856
50314
  }
49857
50315
 
49858
- images[ image.uuid ] = new Source( imageArray );
50316
+ images[ image.uuid ] = new TextureSource( imageArray );
49859
50317
 
49860
50318
  } else {
49861
50319
 
49862
50320
  // load single image
49863
50321
 
49864
50322
  const deserializedImage = await deserializeImage( image.url );
49865
- images[ image.uuid ] = new Source( deserializedImage );
50323
+ images[ image.uuid ] = new TextureSource( deserializedImage );
49866
50324
 
49867
50325
  }
49868
50326
 
@@ -50376,6 +50834,9 @@ class ObjectLoader extends Loader {
50376
50834
  if ( data.shadow.bias !== undefined ) object.shadow.bias = data.shadow.bias;
50377
50835
  if ( data.shadow.normalBias !== undefined ) object.shadow.normalBias = data.shadow.normalBias;
50378
50836
  if ( data.shadow.radius !== undefined ) object.shadow.radius = data.shadow.radius;
50837
+ if ( data.shadow.blurSamples !== undefined ) object.shadow.blurSamples = data.shadow.blurSamples;
50838
+ if ( data.shadow.focus !== undefined ) object.shadow.focus = data.shadow.focus;
50839
+ if ( data.shadow.aspect !== undefined ) object.shadow.aspect = data.shadow.aspect;
50379
50840
  if ( data.shadow.mapSize !== undefined ) object.shadow.mapSize.fromArray( data.shadow.mapSize );
50380
50841
  if ( data.shadow.camera !== undefined ) object.shadow.camera = this.parseObject( data.shadow.camera );
50381
50842
 
@@ -50694,7 +51155,7 @@ class ImageBitmapLoader extends Loader {
50694
51155
 
50695
51156
  } ).then( function ( blob ) {
50696
51157
 
50697
- return createImageBitmap( blob, Object.assign( scope.options, { colorSpaceConversion: 'none' } ) );
51158
+ return createImageBitmap( blob, Object.assign( {}, scope.options, { colorSpaceConversion: 'none' } ) );
50698
51159
 
50699
51160
  } ).then( function ( imageBitmap ) {
50700
51161
 
@@ -50704,6 +51165,8 @@ class ImageBitmapLoader extends Loader {
50704
51165
 
50705
51166
  scope.manager.itemEnd( url );
50706
51167
 
51168
+ return imageBitmap; // see #34150
51169
+
50707
51170
  } ).catch( function ( e ) {
50708
51171
 
50709
51172
  if ( onError ) onError( e );
@@ -54284,12 +54747,24 @@ class AnimationObjectGroup {
54284
54747
  lastIndex = -- nObjects,
54285
54748
  lastObject = objects[ lastIndex ];
54286
54749
 
54287
- // last cached object takes this object's place
54288
- indicesByUUID[ lastCachedObject.uuid ] = index;
54750
+ if ( index !== firstActiveIndex ) {
54751
+
54752
+ // last cached object takes this object's place
54753
+
54754
+ indicesByUUID[ lastCachedObject.uuid ] = index;
54755
+
54756
+ }
54757
+
54289
54758
  objects[ index ] = lastCachedObject;
54290
54759
 
54291
- // last object goes to the activated slot and pop
54292
- indicesByUUID[ lastObject.uuid ] = firstActiveIndex;
54760
+ if ( firstActiveIndex !== lastIndex ) {
54761
+
54762
+ // last object goes to the activated slot and pop
54763
+
54764
+ indicesByUUID[ lastObject.uuid ] = firstActiveIndex;
54765
+
54766
+ }
54767
+
54293
54768
  objects[ firstActiveIndex ] = lastObject;
54294
54769
  objects.pop();
54295
54770
 
@@ -54314,7 +54789,7 @@ class AnimationObjectGroup {
54314
54789
  const lastIndex = -- nObjects,
54315
54790
  lastObject = objects[ lastIndex ];
54316
54791
 
54317
- if ( lastIndex > 0 ) {
54792
+ if ( index !== lastIndex ) {
54318
54793
 
54319
54794
  indicesByUUID[ lastObject.uuid ] = index;
54320
54795
 
@@ -54398,7 +54873,7 @@ class AnimationObjectGroup {
54398
54873
  bindings = this._bindings,
54399
54874
  lastBindingsIndex = bindings.length - 1,
54400
54875
  lastBindings = bindings[ lastBindingsIndex ],
54401
- lastBindingsPath = path[ lastBindingsIndex ];
54876
+ lastBindingsPath = paths[ lastBindingsIndex ];
54402
54877
 
54403
54878
  indicesByPath[ lastBindingsPath ] = index;
54404
54879
 
@@ -56240,15 +56715,19 @@ class RenderTarget3D extends RenderTarget {
56240
56715
 
56241
56716
  this.depth = depth;
56242
56717
 
56243
- /**
56244
- * Overwritten with a different texture type.
56245
- *
56246
- * @type {Data3DTexture}
56247
- */
56248
- this.texture = new Data3DTexture( null, width, height, depth );
56249
- this._setTextureOptions( options );
56718
+ // overwrite attachments with 3D textures
56250
56719
 
56251
- this.texture.isRenderTargetTexture = true;
56720
+ for ( let i = 0; i < this.textures.length; i ++ ) {
56721
+
56722
+ const texture = new Data3DTexture( null, width, height, depth );
56723
+ texture.isRenderTargetTexture = true;
56724
+ texture.renderTarget = this;
56725
+
56726
+ this.textures[ i ] = texture;
56727
+
56728
+ }
56729
+
56730
+ this._setTextureOptions( options );
56252
56731
 
56253
56732
  }
56254
56733
 
@@ -56898,6 +57377,10 @@ class Raycaster {
56898
57377
  * be detected. To raycast against both faces of an object, you'll want to set {@link Material#side}
56899
57378
  * to `THREE.DoubleSide`.
56900
57379
  *
57380
+ * Note that a ray hitting a triangle mesh exactly along an edge shared by two faces may be
57381
+ * reported by both faces, resulting in two coincident intersections (identical point and
57382
+ * distance) in the returned array.
57383
+ *
56901
57384
  * @param {Object3D} object - The 3D object to check for intersection with the ray.
56902
57385
  * @param {boolean} [recursive=true] - If set to `true`, it also checks all descendants.
56903
57386
  * Otherwise it only checks intersection with the object.
@@ -58297,6 +58780,8 @@ class SpotLightHelper extends Object3D {
58297
58780
  */
58298
58781
  dispose() {
58299
58782
 
58783
+ super.dispose();
58784
+
58300
58785
  this.cone.geometry.dispose();
58301
58786
  this.cone.material.dispose();
58302
58787
 
@@ -58508,6 +58993,8 @@ class SkeletonHelper extends LineSegments {
58508
58993
  */
58509
58994
  dispose() {
58510
58995
 
58996
+ super.dispose();
58997
+
58511
58998
  this.geometry.dispose();
58512
58999
  this.material.dispose();
58513
59000
 
@@ -58599,6 +59086,8 @@ class PointLightHelper extends Mesh {
58599
59086
  */
58600
59087
  dispose() {
58601
59088
 
59089
+ super.dispose();
59090
+
58602
59091
  this.geometry.dispose();
58603
59092
  this.material.dispose();
58604
59093
 
@@ -58719,6 +59208,8 @@ class HemisphereLightHelper extends Object3D {
58719
59208
  */
58720
59209
  dispose() {
58721
59210
 
59211
+ super.dispose();
59212
+
58722
59213
  this.children[ 0 ].geometry.dispose();
58723
59214
  this.children[ 0 ].material.dispose();
58724
59215
 
@@ -58832,6 +59323,8 @@ class GridHelper extends LineSegments {
58832
59323
  */
58833
59324
  dispose() {
58834
59325
 
59326
+ super.dispose();
59327
+
58835
59328
  this.geometry.dispose();
58836
59329
  this.material.dispose();
58837
59330
 
@@ -58950,6 +59443,8 @@ class PolarGridHelper extends LineSegments {
58950
59443
  */
58951
59444
  dispose() {
58952
59445
 
59446
+ super.dispose();
59447
+
58953
59448
  this.geometry.dispose();
58954
59449
  this.material.dispose();
58955
59450
 
@@ -59055,6 +59550,8 @@ class DirectionalLightHelper extends Object3D {
59055
59550
  */
59056
59551
  dispose() {
59057
59552
 
59553
+ super.dispose();
59554
+
59058
59555
  this.lightPlane.geometry.dispose();
59059
59556
  this.lightPlane.material.dispose();
59060
59557
  this.targetLine.geometry.dispose();
@@ -59405,6 +59902,8 @@ class CameraHelper extends LineSegments {
59405
59902
  */
59406
59903
  dispose() {
59407
59904
 
59905
+ super.dispose();
59906
+
59408
59907
  this.geometry.dispose();
59409
59908
  this.material.dispose();
59410
59909
 
@@ -59567,6 +60066,8 @@ class BoxHelper extends LineSegments {
59567
60066
  */
59568
60067
  dispose() {
59569
60068
 
60069
+ super.dispose();
60070
+
59570
60071
  this.geometry.dispose();
59571
60072
  this.material.dispose();
59572
60073
 
@@ -59644,6 +60145,8 @@ class Box3Helper extends LineSegments {
59644
60145
  */
59645
60146
  dispose() {
59646
60147
 
60148
+ super.dispose();
60149
+
59647
60150
  this.geometry.dispose();
59648
60151
  this.material.dispose();
59649
60152
 
@@ -59730,6 +60233,8 @@ class PlaneHelper extends Line {
59730
60233
  */
59731
60234
  dispose() {
59732
60235
 
60236
+ super.dispose();
60237
+
59733
60238
  this.geometry.dispose();
59734
60239
  this.material.dispose();
59735
60240
  this.children[ 0 ].geometry.dispose();
@@ -59890,6 +60395,8 @@ class ArrowHelper extends Object3D {
59890
60395
  */
59891
60396
  dispose() {
59892
60397
 
60398
+ super.dispose();
60399
+
59893
60400
  this.line.geometry.dispose();
59894
60401
  this.line.material.dispose();
59895
60402
  this.cone.geometry.dispose();
@@ -59980,6 +60487,8 @@ class AxesHelper extends LineSegments {
59980
60487
  */
59981
60488
  dispose() {
59982
60489
 
60490
+ super.dispose();
60491
+
59983
60492
  this.geometry.dispose();
59984
60493
  this.material.dispose();
59985
60494
 
@@ -60415,13 +60924,6 @@ class Controls extends EventDispatcher {
60415
60924
  */
60416
60925
  connect( element ) {
60417
60926
 
60418
- if ( element === undefined ) {
60419
-
60420
- warn( 'Controls: connect() now requires an element.' ); // @deprecated, the warning can be removed with r185
60421
- return;
60422
-
60423
- }
60424
-
60425
60927
  if ( this.domElement !== null ) this.disconnect();
60426
60928
 
60427
60929
  this.domElement = element;
@@ -62472,4 +62974,4 @@ if ( typeof window !== 'undefined' ) {
62472
62974
 
62473
62975
  }
62474
62976
 
62475
- export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, Controls, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, FrustumArray, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NodePath, NormalAnimationBlendMode, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, ProfilerService, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, R11_EAC_Format, RAD2DEG, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDepthPacking, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGDepthPacking, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderTarget, RenderTarget3D, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, ReversedDepthFuncs, RingGeometry, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLRenderTarget, WebGPUCoordinateSystem, WebXRController, WireframeGeometry, WrapAroundEnding, XorShift32, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, allocateNodeId, cloneUniforms, collectSiblingNodeIds, configureNodeIdSeed, createCanvasElement, createElementNS, ensureUniqueNodeIdAmongParentChildren, error, generateNodeId, getByteLength, getConsoleFunction, getUnlitUniformColorSpace, hashStringToUint32, isTypedArray, isValidNodeId, log, mergeUniforms, nodeIdFromKey, nodeIdFromString, nodeIdToString, probeAsync, profile, profileClass, randomSeedUint32, setConsoleFunction, warn, warnOnce, xorshift32, yieldToMain };
62977
+ export { ACESFilmicToneMapping, AddEquation, AddOperation, AdditiveAnimationBlendMode, AdditiveBlending, AgXToneMapping, AlphaFormat, AlwaysCompare, AlwaysDepth, AlwaysStencilFunc, AmbientLight, AnimationAction, AnimationClip, AnimationLoader, AnimationMixer, AnimationObjectGroup, AnimationUtils, ArcCurve, ArrayCamera, ArrowHelper, AttachedBindMode, Audio, AudioAnalyser, AudioContext, AudioListener, AudioLoader, AxesHelper, BackSide, BasicDepthPacking, BasicShadowMap, BatchedMesh, BezierInterpolant, Bone, BooleanKeyframeTrack, Box2, Box3, Box3Helper, BoxGeometry, BoxHelper, BufferAttribute, BufferGeometry, BufferGeometryLoader, ByteType, Cache, Camera, CameraHelper, CanvasTexture, CapsuleGeometry, CatmullRomCurve3, CineonToneMapping, CircleGeometry, ClampToEdgeWrapping, Clock, Color, ColorKeyframeTrack, ColorManagement, Compatibility, CompressedArrayTexture, CompressedCubeTexture, CompressedTexture, CompressedTextureLoader, ConeGeometry, ConstantAlphaFactor, ConstantColorFactor, Controls, CubeCamera, CubeDepthTexture, CubeReflectionMapping, CubeRefractionMapping, CubeTexture, CubeTextureLoader, CubeUVReflectionMapping, CubicBezierCurve, CubicBezierCurve3, CubicInterpolant, CullFaceBack, CullFaceFront, CullFaceFrontBack, CullFaceNone, Curve, CurvePath, CustomBlending, CustomToneMapping, CylinderGeometry, Cylindrical, Data3DTexture, DataArrayTexture, DataTexture, DataTextureLoader, DataUtils, DecrementStencilOp, DecrementWrapStencilOp, DefaultLoadingManager, DepthFormat, DepthStencilFormat, DepthTexture, DetachedBindMode, DirectionalLight, DirectionalLightHelper, DiscreteInterpolant, DodecahedronGeometry, DoubleSide, DstAlphaFactor, DstColorFactor, DynamicCopyUsage, DynamicDrawUsage, DynamicReadUsage, EdgesGeometry, EllipseCurve, EqualCompare, EqualDepth, EqualStencilFunc, EquirectangularReflectionMapping, EquirectangularRefractionMapping, Euler, EventDispatcher, ExternalTexture, ExtrudeGeometry, FileLoader, Float16BufferAttribute, Float32BufferAttribute, FloatType, Fog, FogExp2, FramebufferTexture, FrontSide, Frustum, FrustumArray, GLBufferAttribute, GLSL1, GLSL3, GreaterCompare, GreaterDepth, GreaterEqualCompare, GreaterEqualDepth, GreaterEqualStencilFunc, GreaterStencilFunc, GridHelper, Group, HTMLTexture, HalfFloatType, HemisphereLight, HemisphereLightHelper, IcosahedronGeometry, ImageBitmapLoader, ImageLoader, ImageUtils, IncrementStencilOp, IncrementWrapStencilOp, InstancedBufferAttribute, InstancedBufferGeometry, InstancedInterleavedBuffer, InstancedMesh, Int16BufferAttribute, Int32BufferAttribute, Int8BufferAttribute, IntType, InterleavedBuffer, InterleavedBufferAttribute, Interpolant, InterpolateBezier, InterpolateDiscrete, InterpolateLinear, InterpolateSmooth, InterpolationSamplingMode, InterpolationSamplingType, InvertStencilOp, KeepStencilOp, KeyframeTrack, LOD, LatheGeometry, Layers, LessCompare, LessDepth, LessEqualCompare, LessEqualDepth, LessEqualStencilFunc, LessStencilFunc, Light, LightProbe, LightShadow, Line, Line3, LineBasicMaterial, LineCurve, LineCurve3, LineDashedMaterial, LineLoop, LineSegments, LinearFilter, LinearInterpolant, LinearMipMapLinearFilter, LinearMipMapNearestFilter, LinearMipmapLinearFilter, LinearMipmapNearestFilter, LinearSRGBColorSpace, LinearToneMapping, LinearTransfer, Loader, LoaderUtils, LoadingManager, LoopOnce, LoopPingPong, LoopRepeat, MOUSE, Material, MaterialBlending, MaterialLoader, MathUtils, Matrix2, Matrix3, Matrix4, MaxEquation, Mesh, MeshBasicMaterial, MeshDepthMaterial, MeshDistanceMaterial, MeshLambertMaterial, MeshMatcapMaterial, MeshNormalMaterial, MeshPhongMaterial, MeshPhysicalMaterial, MeshStandardMaterial, MeshToonMaterial, MinEquation, MirroredRepeatWrapping, MixOperation, MultiplyBlending, MultiplyOperation, NearestFilter, NearestMipMapLinearFilter, NearestMipMapNearestFilter, NearestMipmapLinearFilter, NearestMipmapNearestFilter, NeutralToneMapping, NeverCompare, NeverDepth, NeverStencilFunc, NoBlending, NoColorSpace, NoNormalPacking, NoToneMapping, NodePath, NormalAnimationBlendMode, NormalBlending, NormalGAPacking, NormalRGPacking, NotEqualCompare, NotEqualDepth, NotEqualStencilFunc, NumberKeyframeTrack, Object3D, ObjectLoader, ObjectSpaceNormalMap, OctahedronGeometry, OneFactor, OneMinusConstantAlphaFactor, OneMinusConstantColorFactor, OneMinusDstAlphaFactor, OneMinusDstColorFactor, OneMinusSrcAlphaFactor, OneMinusSrcColorFactor, OrthographicCamera, PCFShadowMap, PCFSoftShadowMap, Path, PerspectiveCamera, Plane, PlaneGeometry, PlaneHelper, PointLight, PointLightHelper, Points, PointsMaterial, PolarGridHelper, PolyhedronGeometry, PositionalAudio, ProfilerService, PropertyBinding, PropertyMixer, QuadraticBezierCurve, QuadraticBezierCurve3, Quaternion, QuaternionKeyframeTrack, QuaternionLinearInterpolant, R11_EAC_Format, RAD2DEG, RED_GREEN_RGTC2_Format, RED_RGTC1_Format, REVISION, RG11_EAC_Format, RGBADepthPacking, RGBAFormat, RGBAIntegerFormat, RGBA_ASTC_10x10_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGBDepthPacking, RGBFormat, RGBIntegerFormat, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGDepthPacking, RGFormat, RGIntegerFormat, RawShaderMaterial, Ray, Raycaster, RectAreaLight, RedFormat, RedIntegerFormat, ReinhardToneMapping, RenderObjectRefreshType, RenderTarget, RenderTarget3D, RepeatWrapping, ReplaceStencilOp, ReverseSubtractEquation, ReversedDepthFuncs, RingGeometry, SIGNED_R11_EAC_Format, SIGNED_RED_GREEN_RGTC2_Format, SIGNED_RED_RGTC1_Format, SIGNED_RG11_EAC_Format, SRGBColorSpace, SRGBTransfer, Scene, ShaderMaterial, ShadowMaterial, Shape, ShapeGeometry, ShapePath, ShapeUtils, ShortType, Skeleton, SkeletonHelper, SkinnedMesh, Source, Sphere, SphereGeometry, Spherical, SphericalHarmonics3, SplineCurve, SpotLight, SpotLightHelper, Sprite, SpriteMaterial, SrcAlphaFactor, SrcAlphaSaturateFactor, SrcColorFactor, StaticCopyUsage, StaticDrawUsage, StaticReadUsage, StereoCamera, StreamCopyUsage, StreamDrawUsage, StreamReadUsage, StringKeyframeTrack, SubtractEquation, SubtractiveBlending, TOUCH, TangentSpaceNormalMap, TetrahedronGeometry, Texture, TextureLoader, TextureSource, TextureUtils, Timer, TimestampQuery, TorusGeometry, TorusKnotGeometry, Triangle, TriangleFanDrawMode, TriangleStripDrawMode, TrianglesDrawMode, TubeGeometry, UVMapping, Uint16BufferAttribute, Uint32BufferAttribute, Uint8BufferAttribute, Uint8ClampedBufferAttribute, Uniform, UniformsGroup, UniformsUtils, UnsignedByteType, UnsignedInt101111Type, UnsignedInt248Type, UnsignedInt5999Type, UnsignedIntType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedShortType, VSMShadowMap, Vector2, Vector3, Vector4, VectorKeyframeTrack, VideoFrameTexture, VideoTexture, WebGL3DRenderTarget, WebGLArrayRenderTarget, WebGLCoordinateSystem, WebGLRenderTarget, WebGPUCoordinateSystem, WebXRController, WireframeGeometry, WrapAroundEnding, XorShift32, ZeroCurvatureEnding, ZeroFactor, ZeroSlopeEnding, ZeroStencilOp, allocateNodeId, cloneUniforms, collectSiblingNodeIds, configureNodeIdSeed, createCanvasElement, createElementNS, ensureUniqueNodeIdAmongParentChildren, error, generateNodeId, getByteLength, getConsoleFunction, getUnlitUniformColorSpace, hashStringToUint32, isTypedArray, isValidNodeId, log, mergeUniforms, nodeIdFromKey, nodeIdFromString, nodeIdToString, probeAsync, profile, profileClass, randomSeedUint32, setConsoleFunction, warn, warnOnce, xorshift32, yieldToMain };