super-three 0.144.0 → 0.147.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 (450) hide show
  1. package/README.md +1 -1
  2. package/build/three.cjs +735 -387
  3. package/build/three.js +735 -387
  4. package/build/three.min.js +1 -1
  5. package/build/three.module.js +910 -408
  6. package/examples/js/animation/AnimationClipCreator.js +0 -8
  7. package/examples/js/animation/CCDIKSolver.js +50 -67
  8. package/examples/js/animation/MMDAnimationHelper.js +66 -137
  9. package/examples/js/animation/MMDPhysics.js +70 -134
  10. package/examples/js/cameras/CinematicCamera.js +33 -22
  11. package/examples/js/controls/ArcballControls.js +138 -405
  12. package/examples/js/controls/DragControls.js +8 -33
  13. package/examples/js/controls/FirstPersonControls.js +32 -54
  14. package/examples/js/controls/FlyControls.js +29 -55
  15. package/examples/js/controls/OrbitControls.js +125 -99
  16. package/examples/js/controls/PointerLockControls.js +5 -14
  17. package/examples/js/controls/TrackballControls.js +33 -86
  18. package/examples/js/controls/TransformControls.js +85 -170
  19. package/examples/js/csm/CSM.js +4 -39
  20. package/examples/js/csm/CSMFrustum.js +3 -9
  21. package/examples/js/csm/CSMHelper.js +24 -4
  22. package/examples/js/csm/CSMShader.js +2 -6
  23. package/examples/js/curves/CurveExtras.js +27 -27
  24. package/examples/js/curves/NURBSCurve.js +4 -16
  25. package/examples/js/curves/NURBSSurface.js +3 -9
  26. package/examples/js/curves/NURBSUtils.js +8 -45
  27. package/examples/js/effects/AnaglyphEffect.js +4 -18
  28. package/examples/js/effects/AsciiEffect.js +32 -31
  29. package/examples/js/effects/OutlineEffect.js +26 -30
  30. package/examples/js/effects/ParallaxBarrierEffect.js +0 -13
  31. package/examples/js/effects/PeppersGhostEffect.js +12 -39
  32. package/examples/js/effects/StereoEffect.js +0 -4
  33. package/examples/js/environments/RoomEnvironment.js +12 -10
  34. package/examples/js/exporters/ColladaExporter.js +48 -65
  35. package/examples/js/exporters/DRACOExporter.js +22 -22
  36. package/examples/js/exporters/EXRExporter.js +15 -18
  37. package/examples/js/exporters/GLTFExporter.js +141 -317
  38. package/examples/js/exporters/MMDExporter.js +5 -12
  39. package/examples/js/exporters/OBJExporter.js +42 -33
  40. package/examples/js/exporters/PLYExporter.js +38 -33
  41. package/examples/js/exporters/STLExporter.js +5 -7
  42. package/examples/js/exporters/USDZExporter.js +113 -27
  43. package/examples/js/geometries/BoxLineGeometry.js +0 -1
  44. package/examples/js/geometries/ConvexGeometry.js +11 -6
  45. package/examples/js/geometries/DecalGeometry.js +53 -20
  46. package/examples/js/geometries/LightningStrike.js +54 -67
  47. package/examples/js/geometries/ParametricGeometries.js +8 -7
  48. package/examples/js/geometries/ParametricGeometry.js +25 -12
  49. package/examples/js/geometries/RoundedBoxGeometry.js +21 -19
  50. package/examples/js/geometries/TeapotGeometry.js +54 -50
  51. package/examples/js/geometries/TextGeometry.js +6 -4
  52. package/examples/js/helpers/LightProbeHelper.js +1 -2
  53. package/examples/js/helpers/OctreeHelper.js +22 -20
  54. package/examples/js/helpers/PositionalAudioHelper.js +8 -6
  55. package/examples/js/helpers/RectAreaLightHelper.js +6 -7
  56. package/examples/js/helpers/VertexNormalsHelper.js +15 -13
  57. package/examples/js/helpers/VertexTangentsHelper.js +15 -9
  58. package/examples/js/helpers/ViewHelper.js +31 -16
  59. package/examples/js/interactive/HTMLMesh.js +25 -39
  60. package/examples/js/interactive/InteractiveGroup.js +9 -14
  61. package/examples/js/interactive/SelectionBox.js +3 -70
  62. package/examples/js/interactive/SelectionHelper.js +0 -8
  63. package/examples/js/lights/LightProbeGenerator.js +32 -39
  64. package/examples/js/lights/RectAreaLightUniformsLib.js +5 -1
  65. package/examples/js/lines/LineGeometry.js +3 -5
  66. package/examples/js/lines/LineMaterial.js +4 -11
  67. package/examples/js/lines/LineSegments2.js +40 -89
  68. package/examples/js/lines/LineSegmentsGeometry.js +7 -28
  69. package/examples/js/lines/Wireframe.js +2 -7
  70. package/examples/js/lines/WireframeGeometry2.js +3 -1
  71. package/examples/js/loaders/3DMLoader.js +58 -155
  72. package/examples/js/loaders/3MFLoader.js +72 -106
  73. package/examples/js/loaders/AMFLoader.js +0 -25
  74. package/examples/js/loaders/BVHLoader.js +44 -43
  75. package/examples/js/loaders/BasisTextureLoader.js +16 -46
  76. package/examples/js/loaders/ColladaLoader.js +228 -359
  77. package/examples/js/loaders/DDSLoader.js +24 -25
  78. package/examples/js/loaders/DRACOLoader.js +29 -66
  79. package/examples/js/loaders/EXRLoader.js +67 -164
  80. package/examples/js/loaders/FBXLoader.js +287 -441
  81. package/examples/js/loaders/FontLoader.js +6 -15
  82. package/examples/js/loaders/GCodeLoader.js +15 -16
  83. package/examples/js/loaders/GLTFLoader.js +409 -706
  84. package/examples/js/loaders/HDRCubeTextureLoader.js +0 -6
  85. package/examples/js/loaders/KMZLoader.js +3 -7
  86. package/examples/js/loaders/KTXLoader.js +12 -30
  87. package/examples/js/loaders/LDrawLoader.js +178 -289
  88. package/examples/js/loaders/LUT3dlLoader.js +7 -11
  89. package/examples/js/loaders/LUTCubeLoader.js +0 -8
  90. package/examples/js/loaders/LWOLoader.js +59 -124
  91. package/examples/js/loaders/LogLuvLoader.js +27 -77
  92. package/examples/js/loaders/LottieLoader.js +4 -4
  93. package/examples/js/loaders/MD2Loader.js +26 -27
  94. package/examples/js/loaders/MDDLoader.js +6 -10
  95. package/examples/js/loaders/MMDLoader.js +180 -189
  96. package/examples/js/loaders/MTLLoader.js +18 -47
  97. package/examples/js/loaders/NRRDLoader.js +44 -84
  98. package/examples/js/loaders/OBJLoader.js +50 -65
  99. package/examples/js/loaders/PCDLoader.js +34 -29
  100. package/examples/js/loaders/PDBLoader.js +17 -13
  101. package/examples/js/loaders/PLYLoader.js +62 -48
  102. package/examples/js/loaders/PRWMLoader.js +11 -22
  103. package/examples/js/loaders/PVRLoader.js +7 -16
  104. package/examples/js/loaders/RGBELoader.js +36 -61
  105. package/examples/js/loaders/RGBMLoader.js +26 -87
  106. package/examples/js/loaders/STLLoader.js +20 -27
  107. package/examples/js/loaders/SVGLoader.js +361 -233
  108. package/examples/js/loaders/TDSLoader.js +81 -118
  109. package/examples/js/loaders/TGALoader.js +39 -41
  110. package/examples/js/loaders/TIFFLoader.js +0 -1
  111. package/examples/js/loaders/TTFLoader.js +0 -8
  112. package/examples/js/loaders/TiltLoader.js +14 -15
  113. package/examples/js/loaders/VOXLoader.js +8 -16
  114. package/examples/js/loaders/VRMLLoader.js +243 -340
  115. package/examples/js/loaders/VTKLoader.js +101 -118
  116. package/examples/js/loaders/XYZLoader.js +2 -4
  117. package/examples/js/loaders/lwo/IFFParser.js +55 -136
  118. package/examples/js/loaders/lwo/LWO2Parser.js +32 -83
  119. package/examples/js/loaders/lwo/LWO3Parser.js +31 -73
  120. package/examples/js/materials/MeshGouraudMaterial.js +15 -13
  121. package/examples/js/math/Capsule.js +0 -17
  122. package/examples/js/math/ColorConverter.js +3 -3
  123. package/examples/js/math/ConvexHull.js +185 -141
  124. package/examples/js/math/ImprovedNoise.js +1 -1
  125. package/examples/js/math/Lut.js +8 -15
  126. package/examples/js/math/MeshSurfaceSampler.js +6 -28
  127. package/examples/js/math/OBB.js +90 -49
  128. package/examples/js/math/Octree.js +2 -57
  129. package/examples/js/math/SimplexNoise.js +74 -88
  130. package/examples/js/misc/ConvexObjectBreaker.js +37 -48
  131. package/examples/js/misc/GPUComputationRenderer.js +26 -16
  132. package/examples/js/misc/Gyroscope.js +5 -9
  133. package/examples/js/misc/MD2Character.js +14 -23
  134. package/examples/js/misc/MD2CharacterComplex.js +73 -54
  135. package/examples/js/misc/MorphAnimMesh.js +0 -6
  136. package/examples/js/misc/MorphBlendMesh.js +3 -30
  137. package/examples/js/misc/ProgressiveLightMap.js +47 -43
  138. package/examples/js/misc/RollerCoaster.js +17 -24
  139. package/examples/js/misc/TubePainter.js +18 -12
  140. package/examples/js/misc/Volume.js +16 -45
  141. package/examples/js/misc/VolumeSlice.js +14 -24
  142. package/examples/js/modifiers/CurveModifier.js +19 -21
  143. package/examples/js/modifiers/EdgeSplitModifier.js +0 -30
  144. package/examples/js/modifiers/SimplifyModifier.js +56 -59
  145. package/examples/js/modifiers/TessellateModifier.js +2 -9
  146. package/examples/js/objects/GroundProjectedEnv.js +2 -14
  147. package/examples/js/objects/Lensflare.js +47 -38
  148. package/examples/js/objects/LightningStorm.js +10 -13
  149. package/examples/js/objects/MarchingCubes.js +80 -59
  150. package/examples/js/objects/Reflector.js +22 -20
  151. package/examples/js/objects/ReflectorForSSRPass.js +19 -23
  152. package/examples/js/objects/Refractor.js +52 -30
  153. package/examples/js/objects/ShadowMesh.js +1 -2
  154. package/examples/js/objects/Sky.js +2 -7
  155. package/examples/js/objects/Water.js +23 -18
  156. package/examples/js/objects/Water2.js +20 -19
  157. package/examples/js/physics/AmmoPhysics.js +23 -20
  158. package/examples/js/physics/OimoPhysics.js +19 -17
  159. package/examples/js/postprocessing/AdaptiveToneMappingPass.js +13 -20
  160. package/examples/js/postprocessing/AfterimagePass.js +19 -12
  161. package/examples/js/postprocessing/BloomPass.js +38 -17
  162. package/examples/js/postprocessing/BokehPass.js +29 -12
  163. package/examples/js/postprocessing/ClearPass.js +1 -6
  164. package/examples/js/postprocessing/CubeTexturePass.js +12 -9
  165. package/examples/js/postprocessing/DotScreenPass.js +7 -5
  166. package/examples/js/postprocessing/EffectComposer.js +25 -32
  167. package/examples/js/postprocessing/FilmPass.js +7 -5
  168. package/examples/js/postprocessing/GlitchPass.js +10 -11
  169. package/examples/js/postprocessing/HalftonePass.js +9 -9
  170. package/examples/js/postprocessing/LUTPass.js +2 -15
  171. package/examples/js/postprocessing/MaskPass.js +20 -17
  172. package/examples/js/postprocessing/OutlinePass.js +45 -36
  173. package/examples/js/postprocessing/Pass.js +11 -14
  174. package/examples/js/postprocessing/RenderPass.js +3 -7
  175. package/examples/js/postprocessing/RenderPixelatedPass.js +215 -0
  176. package/examples/js/postprocessing/SAOPass.js +40 -32
  177. package/examples/js/postprocessing/SMAAPass.js +34 -17
  178. package/examples/js/postprocessing/SSAARenderPass.js +14 -14
  179. package/examples/js/postprocessing/SSAOPass.js +56 -42
  180. package/examples/js/postprocessing/SSRPass.js +78 -61
  181. package/examples/js/postprocessing/SavePass.js +14 -6
  182. package/examples/js/postprocessing/ShaderPass.js +9 -8
  183. package/examples/js/postprocessing/TAARenderPass.js +11 -9
  184. package/examples/js/postprocessing/TexturePass.js +7 -4
  185. package/examples/js/postprocessing/UnrealBloomPass.js +43 -25
  186. package/examples/js/renderers/CSS2DRenderer.js +2 -21
  187. package/examples/js/renderers/CSS3DRenderer.js +3 -24
  188. package/examples/js/renderers/Projector.js +29 -85
  189. package/examples/js/renderers/SVGRenderer.js +4 -50
  190. package/examples/js/shaders/ACESFilmicToneMappingShader.js +3 -6
  191. package/examples/js/shaders/AfterimageShader.js +3 -6
  192. package/examples/js/shaders/BasicShader.js +3 -6
  193. package/examples/js/shaders/BleachBypassShader.js +3 -6
  194. package/examples/js/shaders/BlendShader.js +3 -6
  195. package/examples/js/shaders/BokehShader.js +3 -6
  196. package/examples/js/shaders/BokehShader2.js +4 -13
  197. package/examples/js/shaders/BrightnessContrastShader.js +3 -6
  198. package/examples/js/shaders/ColorCorrectionShader.js +2 -6
  199. package/examples/js/shaders/ColorifyShader.js +2 -6
  200. package/examples/js/shaders/ConvolutionShader.js +5 -10
  201. package/examples/js/shaders/CopyShader.js +3 -6
  202. package/examples/js/shaders/DOFMipMapShader.js +3 -6
  203. package/examples/js/shaders/DepthLimitedBlurShader.js +2 -9
  204. package/examples/js/shaders/DigitalGlitch.js +3 -6
  205. package/examples/js/shaders/DotScreenShader.js +2 -6
  206. package/examples/js/shaders/FXAAShader.js +1 -3
  207. package/examples/js/shaders/FilmShader.js +3 -6
  208. package/examples/js/shaders/FocusShader.js +3 -6
  209. package/examples/js/shaders/FreiChenShader.js +2 -6
  210. package/examples/js/shaders/GammaCorrectionShader.js +3 -6
  211. package/examples/js/shaders/GodRaysShader.js +11 -24
  212. package/examples/js/shaders/HalftoneShader.js +3 -6
  213. package/examples/js/shaders/HorizontalBlurShader.js +3 -6
  214. package/examples/js/shaders/HorizontalTiltShiftShader.js +3 -6
  215. package/examples/js/shaders/HueSaturationShader.js +3 -6
  216. package/examples/js/shaders/KaleidoShader.js +3 -6
  217. package/examples/js/shaders/LuminosityHighPassShader.js +2 -6
  218. package/examples/js/shaders/LuminosityShader.js +3 -6
  219. package/examples/js/shaders/MMDToonShader.js +2 -8
  220. package/examples/js/shaders/MirrorShader.js +3 -6
  221. package/examples/js/shaders/NormalMapShader.js +2 -6
  222. package/examples/js/shaders/RGBShiftShader.js +3 -6
  223. package/examples/js/shaders/SAOShader.js +2 -6
  224. package/examples/js/shaders/SMAAShader.js +6 -18
  225. package/examples/js/shaders/SSAOShader.js +2 -6
  226. package/examples/js/shaders/SSRShader.js +6 -18
  227. package/examples/js/shaders/SepiaShader.js +3 -6
  228. package/examples/js/shaders/SobelOperatorShader.js +2 -6
  229. package/examples/js/shaders/TechnicolorShader.js +3 -6
  230. package/examples/js/shaders/ToneMapShader.js +3 -6
  231. package/examples/js/shaders/ToonShader.js +8 -24
  232. package/examples/js/shaders/TriangleBlurShader.js +2 -6
  233. package/examples/js/shaders/UnpackDepthRGBAShader.js +3 -6
  234. package/examples/js/shaders/VelocityShader.js +126 -0
  235. package/examples/js/shaders/VerticalBlurShader.js +3 -6
  236. package/examples/js/shaders/VerticalTiltShiftShader.js +3 -6
  237. package/examples/js/shaders/VignetteShader.js +3 -6
  238. package/examples/js/shaders/VolumeShader.js +2 -6
  239. package/examples/js/shaders/WaterRefractionShader.js +2 -6
  240. package/examples/js/textures/FlakesTexture.js +0 -1
  241. package/examples/js/utils/BufferGeometryUtils.js +236 -170
  242. package/examples/js/utils/CameraUtils.js +5 -20
  243. package/examples/js/utils/GPUStatsPanel.js +3 -12
  244. package/examples/js/utils/GeometryCompressionUtils.js +19 -44
  245. package/examples/js/utils/GeometryUtils.js +13 -18
  246. package/examples/js/utils/LDrawUtils.js +8 -11
  247. package/examples/js/utils/PackedPhongMaterial.js +6 -4
  248. package/examples/js/utils/SceneUtils.js +117 -6
  249. package/examples/js/utils/ShadowMapViewer.js +17 -14
  250. package/examples/js/utils/SkeletonUtils.js +13 -27
  251. package/examples/js/utils/UVsDebug.js +20 -12
  252. package/examples/js/utils/WorkerPool.js +1 -11
  253. package/examples/jsm/animation/CCDIKSolver.js +27 -3
  254. package/examples/jsm/animation/MMDPhysics.js +25 -0
  255. package/examples/jsm/capabilities/WebGPU.js +3 -1
  256. package/examples/jsm/controls/FirstPersonControls.js +20 -20
  257. package/examples/jsm/controls/FlyControls.js +16 -17
  258. package/examples/jsm/controls/OrbitControls.js +44 -4
  259. package/examples/jsm/controls/TrackballControls.js +14 -2
  260. package/examples/jsm/controls/TransformControls.js +1 -1
  261. package/examples/jsm/csm/CSM.js +1 -0
  262. package/examples/jsm/csm/CSMHelper.js +30 -0
  263. package/examples/jsm/exporters/GLTFExporter.js +0 -79
  264. package/examples/jsm/exporters/USDZExporter.js +93 -1
  265. package/examples/jsm/helpers/OctreeHelper.js +22 -8
  266. package/examples/jsm/helpers/VertexNormalsHelper.js +7 -1
  267. package/examples/jsm/helpers/VertexTangentsHelper.js +7 -0
  268. package/examples/jsm/helpers/ViewHelper.js +24 -0
  269. package/examples/jsm/interactive/HTMLMesh.js +5 -6
  270. package/examples/jsm/interactive/InteractiveGroup.js +4 -2
  271. package/examples/jsm/libs/flow.module.js +610 -160
  272. package/examples/jsm/libs/lottie_canvas.module.js +14844 -0
  273. package/examples/jsm/lines/LineSegments2.js +4 -0
  274. package/examples/jsm/loaders/3DMLoader.js +1 -2
  275. package/examples/jsm/loaders/ColladaLoader.js +28 -0
  276. package/examples/jsm/loaders/FBXLoader.js +18 -2
  277. package/examples/jsm/loaders/GLTFLoader.js +269 -428
  278. package/examples/jsm/loaders/KTX2Loader.js +68 -29
  279. package/examples/jsm/loaders/LDrawLoader.js +14 -13
  280. package/examples/jsm/loaders/LottieLoader.js +4 -2
  281. package/examples/jsm/loaders/MaterialXLoader.js +728 -0
  282. package/examples/jsm/loaders/PCDLoader.js +1 -1
  283. package/examples/jsm/loaders/PLYLoader.js +68 -16
  284. package/examples/jsm/loaders/SVGLoader.js +227 -14
  285. package/examples/jsm/loaders/USDZLoader.js +351 -111
  286. package/examples/jsm/loaders/VRMLLoader.js +13 -1
  287. package/examples/jsm/math/ConvexHull.js +4 -4
  288. package/examples/jsm/math/Octree.js +1 -1
  289. package/examples/jsm/node-editor/NodeEditor.js +91 -12
  290. package/examples/jsm/node-editor/core/BaseNode.js +10 -3
  291. package/examples/jsm/node-editor/materials/BasicMaterialEditor.js +6 -9
  292. package/examples/jsm/node-editor/materials/StandardMaterialEditor.js +6 -9
  293. package/examples/jsm/node-editor/math/AngleEditor.js +3 -3
  294. package/examples/jsm/node-editor/math/InvertEditor.js +2 -2
  295. package/examples/jsm/node-editor/scene/MeshEditor.js +11 -8
  296. package/examples/jsm/node-editor/utils/PreviewEditor.js +4 -0
  297. package/examples/jsm/nodes/Nodes.js +30 -3
  298. package/examples/jsm/nodes/accessors/BitangentNode.js +62 -0
  299. package/examples/jsm/nodes/accessors/NormalNode.js +6 -6
  300. package/examples/jsm/nodes/accessors/Object3DNode.js +1 -1
  301. package/examples/jsm/nodes/accessors/PositionNode.js +6 -0
  302. package/examples/jsm/nodes/accessors/ReferenceNode.js +1 -1
  303. package/examples/jsm/nodes/accessors/SkinningNode.js +8 -1
  304. package/examples/jsm/nodes/accessors/TangentNode.js +95 -0
  305. package/examples/jsm/nodes/core/AttributeNode.js +31 -8
  306. package/examples/jsm/nodes/core/Node.js +1 -1
  307. package/examples/jsm/nodes/core/NodeBuilder.js +55 -6
  308. package/examples/jsm/nodes/core/NodeFrame.js +2 -2
  309. package/examples/jsm/nodes/core/NodeVarying.js +7 -4
  310. package/examples/jsm/nodes/core/VaryingNode.js +6 -4
  311. package/examples/jsm/nodes/core/constants.js +13 -13
  312. package/examples/jsm/nodes/display/BlendModeNode.js +85 -0
  313. package/examples/jsm/nodes/display/ColorAdjustmentNode.js +2 -12
  314. package/examples/jsm/nodes/display/NormalMapNode.js +19 -12
  315. package/examples/jsm/nodes/display/PosterizeNode.js +25 -0
  316. package/examples/jsm/nodes/display/ViewportNode.js +106 -0
  317. package/examples/jsm/nodes/functions/BSDF/BRDF_GGX.js +5 -5
  318. package/examples/jsm/nodes/functions/PhysicalLightingModel.js +3 -3
  319. package/examples/jsm/nodes/functions/light/getDistanceAttenuation.js +2 -2
  320. package/examples/jsm/nodes/gpgpu/ComputeNode.js +1 -1
  321. package/examples/jsm/nodes/lighting/AnalyticLightNode.js +1 -1
  322. package/examples/jsm/nodes/loaders/NodeMaterialLoader.js +3 -1
  323. package/examples/jsm/nodes/materials/Materials.js +9 -7
  324. package/examples/jsm/nodes/materials/NodeMaterial.js +9 -1
  325. package/examples/jsm/nodes/materialx/{Disclaimer.md → DISCLAIMER.md} +1 -1
  326. package/examples/jsm/nodes/materialx/MaterialXNodes.js +59 -0
  327. package/examples/jsm/nodes/materialx/{functions/lib → lib}/mx_hsv.js +1 -1
  328. package/examples/jsm/nodes/materialx/{functions/lib → lib}/mx_noise.js +13 -3
  329. package/examples/jsm/nodes/materialx/lib/mx_transform_color.js +18 -0
  330. package/examples/jsm/nodes/math/MathNode.js +5 -5
  331. package/examples/jsm/nodes/math/OperatorNode.js +16 -3
  332. package/examples/jsm/nodes/shadernode/ShaderNode.js +35 -20
  333. package/examples/jsm/nodes/shadernode/ShaderNodeBaseElements.js +87 -63
  334. package/examples/jsm/nodes/shadernode/ShaderNodeElements.js +29 -0
  335. package/examples/jsm/nodes/utils/ConvertNode.js +15 -14
  336. package/examples/jsm/nodes/utils/EquirectUVNode.js +27 -0
  337. package/examples/jsm/nodes/utils/JoinNode.js +8 -2
  338. package/examples/jsm/nodes/utils/MatcapUVNode.js +2 -4
  339. package/examples/jsm/nodes/utils/MaxMipLevelNode.js +1 -1
  340. package/examples/jsm/nodes/utils/OscNode.js +2 -2
  341. package/examples/jsm/nodes/utils/RemapNode.js +34 -0
  342. package/examples/jsm/nodes/utils/SpriteSheetUVNode.js +8 -10
  343. package/examples/jsm/nodes/utils/TimerNode.js +21 -1
  344. package/examples/jsm/nodes/utils/TriplanarTexturesNode.js +51 -0
  345. package/examples/jsm/postprocessing/AfterimagePass.js +17 -4
  346. package/examples/jsm/postprocessing/BloomPass.js +22 -3
  347. package/examples/jsm/postprocessing/BokehPass.js +18 -4
  348. package/examples/jsm/postprocessing/CubeTexturePass.js +12 -5
  349. package/examples/jsm/postprocessing/DotScreenPass.js +8 -0
  350. package/examples/jsm/postprocessing/EffectComposer.js +9 -0
  351. package/examples/jsm/postprocessing/FilmPass.js +8 -0
  352. package/examples/jsm/postprocessing/GlitchPass.js +13 -1
  353. package/examples/jsm/postprocessing/HalftonePass.js +8 -0
  354. package/examples/jsm/postprocessing/OutlinePass.js +21 -1
  355. package/examples/jsm/postprocessing/Pass.js +2 -0
  356. package/examples/jsm/postprocessing/RenderPixelatedPass.js +234 -0
  357. package/examples/jsm/postprocessing/SAOPass.js +20 -0
  358. package/examples/jsm/postprocessing/SMAAPass.js +16 -0
  359. package/examples/jsm/postprocessing/SSAARenderPass.js +4 -0
  360. package/examples/jsm/postprocessing/SavePass.js +17 -1
  361. package/examples/jsm/postprocessing/ShaderPass.js +8 -0
  362. package/examples/jsm/postprocessing/TAARenderPass.js +9 -0
  363. package/examples/jsm/postprocessing/TexturePass.js +8 -0
  364. package/examples/jsm/postprocessing/UnrealBloomPass.js +16 -0
  365. package/examples/jsm/renderers/webgl/nodes/WebGLNodeBuilder.js +56 -35
  366. package/examples/jsm/renderers/webgpu/WebGPUAnimation.js +58 -0
  367. package/examples/jsm/renderers/webgpu/WebGPUAttributes.js +63 -5
  368. package/examples/jsm/renderers/webgpu/WebGPUBackground.js +36 -7
  369. package/examples/jsm/renderers/webgpu/WebGPURenderer.js +47 -12
  370. package/examples/jsm/renderers/webgpu/nodes/WebGPUNodeBuilder.js +41 -9
  371. package/examples/jsm/shaders/MMDToonShader.js +0 -2
  372. package/examples/jsm/shaders/VelocityShader.js +128 -0
  373. package/examples/jsm/utils/BufferGeometryUtils.js +174 -42
  374. package/examples/jsm/utils/SceneUtils.js +129 -4
  375. package/examples/jsm/webxr/OculusHandModel.js +3 -2
  376. package/examples/jsm/webxr/XRHandMeshModel.js +8 -3
  377. package/package.json +13 -13
  378. package/src/Three.js +1 -0
  379. package/src/animation/PropertyBinding.js +7 -0
  380. package/src/audio/AudioContext.js +5 -5
  381. package/src/cameras/CubeCamera.js +14 -14
  382. package/src/constants.js +1 -1
  383. package/src/core/InstancedBufferGeometry.js +1 -7
  384. package/src/core/InterleavedBufferAttribute.js +4 -4
  385. package/src/extras/Earcut.js +67 -67
  386. package/src/geometries/PolyhedronGeometry.js +1 -1
  387. package/src/geometries/ShapeGeometry.js +1 -1
  388. package/src/helpers/ArrowHelper.js +9 -0
  389. package/src/helpers/Box3Helper.js +7 -0
  390. package/src/helpers/BoxHelper.js +7 -1
  391. package/src/helpers/DirectionalLightHelper.js +5 -1
  392. package/src/helpers/GridHelper.js +7 -0
  393. package/src/helpers/HemisphereLightHelper.js +4 -1
  394. package/src/helpers/PlaneHelper.js +9 -0
  395. package/src/helpers/PointLightHelper.js +2 -1
  396. package/src/helpers/PolarGridHelper.js +7 -0
  397. package/src/helpers/SkeletonHelper.js +7 -0
  398. package/src/helpers/SpotLightHelper.js +4 -2
  399. package/src/lights/LightShadow.js +1 -2
  400. package/src/lights/PointLight.js +2 -2
  401. package/src/lights/SpotLight.js +2 -2
  402. package/src/loaders/FileLoader.js +4 -1
  403. package/src/loaders/ObjectLoader.js +5 -1
  404. package/src/materials/Material.js +1 -1
  405. package/src/materials/MeshPhysicalMaterial.js +1 -1
  406. package/src/math/Color.js +5 -5
  407. package/src/math/Matrix3.js +53 -18
  408. package/src/math/Ray.js +2 -5
  409. package/src/math/Sphere.js +36 -21
  410. package/src/objects/InstancedMesh.js +7 -0
  411. package/src/objects/LOD.js +25 -6
  412. package/src/renderers/WebGL3DRenderTarget.js +1 -1
  413. package/src/renderers/WebGLArrayRenderTarget.js +1 -1
  414. package/src/renderers/WebGLCubeRenderTarget.js +1 -1
  415. package/src/renderers/WebGLMultipleRenderTargets.js +1 -1
  416. package/src/renderers/WebGLRenderTarget.js +1 -1
  417. package/src/renderers/WebGLRenderer.js +36 -62
  418. package/src/renderers/shaders/ShaderChunk/envmap_fragment.glsl.js +0 -4
  419. package/src/renderers/shaders/ShaderChunk/lights_fragment_begin.glsl.js +0 -1
  420. package/src/renderers/shaders/ShaderChunk/lights_lambert_pars_fragment.glsl.js +0 -2
  421. package/src/renderers/shaders/ShaderChunk/lights_phong_pars_fragment.glsl.js +0 -2
  422. package/src/renderers/shaders/ShaderChunk/lights_toon_pars_fragment.glsl.js +0 -2
  423. package/src/renderers/shaders/ShaderChunk/normal_fragment_begin.glsl.js +2 -4
  424. package/src/renderers/shaders/ShaderChunk/packing.glsl.js +8 -0
  425. package/src/renderers/shaders/ShaderChunk/transmission_pars_fragment.glsl.js +2 -2
  426. package/src/renderers/shaders/ShaderChunk.js +3 -0
  427. package/src/renderers/shaders/ShaderLib/background.glsl.js +7 -2
  428. package/src/renderers/shaders/ShaderLib/backgroundCube.glsl.js +62 -0
  429. package/src/renderers/shaders/ShaderLib/cube.glsl.js +4 -6
  430. package/src/renderers/shaders/ShaderLib/vsm.glsl.js +0 -3
  431. package/src/renderers/shaders/ShaderLib.js +20 -6
  432. package/src/renderers/shaders/UniformsLib.js +1 -1
  433. package/src/renderers/shaders/UniformsUtils.js +15 -0
  434. package/src/renderers/webgl/WebGLAttributes.js +2 -0
  435. package/src/renderers/webgl/WebGLBackground.js +15 -7
  436. package/src/renderers/webgl/WebGLLights.js +0 -4
  437. package/src/renderers/webgl/WebGLMaterials.js +2 -1
  438. package/src/renderers/webgl/WebGLShadowMap.js +3 -1
  439. package/src/renderers/webgl/WebGLState.js +78 -41
  440. package/src/renderers/webgl/WebGLTextures.js +94 -39
  441. package/src/renderers/webgl/WebGLUniforms.js +152 -24
  442. package/src/renderers/webgl/WebGLUtils.js +1 -1
  443. package/src/renderers/webxr/WebXRController.js +46 -13
  444. package/src/renderers/webxr/WebXRManager.js +70 -2
  445. package/src/scenes/Scene.js +8 -0
  446. package/src/textures/CompressedArrayTexture.js +18 -0
  447. package/src/textures/Texture.js +2 -1
  448. package/examples/js/libs/lottie_canvas.js +0 -12751
  449. package/examples/js/shaders/PixelShader.js +0 -51
  450. package/examples/jsm/shaders/PixelShader.js +0 -44
package/build/three.js CHANGED
@@ -9,7 +9,7 @@
9
9
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.THREE = {}));
10
10
  })(this, (function (exports) { 'use strict';
11
11
 
12
- const REVISION = '144';
12
+ const REVISION = '147';
13
13
  const MOUSE = {
14
14
  LEFT: 0,
15
15
  MIDDLE: 1,
@@ -998,49 +998,44 @@
998
998
  const s = Math.sin(rotation);
999
999
  this.set(sx * c, sx * s, -sx * (c * cx + s * cy) + cx + tx, -sy * s, sy * c, -sy * (-s * cx + c * cy) + cy + ty, 0, 0, 1);
1000
1000
  return this;
1001
- }
1001
+ } //
1002
+
1002
1003
 
1003
1004
  scale(sx, sy) {
1004
- const te = this.elements;
1005
- te[0] *= sx;
1006
- te[3] *= sx;
1007
- te[6] *= sx;
1008
- te[1] *= sy;
1009
- te[4] *= sy;
1010
- te[7] *= sy;
1005
+ this.premultiply(_m3.makeScale(sx, sy));
1011
1006
  return this;
1012
1007
  }
1013
1008
 
1014
1009
  rotate(theta) {
1015
- const c = Math.cos(theta);
1016
- const s = Math.sin(theta);
1017
- const te = this.elements;
1018
- const a11 = te[0],
1019
- a12 = te[3],
1020
- a13 = te[6];
1021
- const a21 = te[1],
1022
- a22 = te[4],
1023
- a23 = te[7];
1024
- te[0] = c * a11 + s * a21;
1025
- te[3] = c * a12 + s * a22;
1026
- te[6] = c * a13 + s * a23;
1027
- te[1] = -s * a11 + c * a21;
1028
- te[4] = -s * a12 + c * a22;
1029
- te[7] = -s * a13 + c * a23;
1010
+ this.premultiply(_m3.makeRotation(-theta));
1030
1011
  return this;
1031
1012
  }
1032
1013
 
1033
1014
  translate(tx, ty) {
1034
- const te = this.elements;
1035
- te[0] += tx * te[2];
1036
- te[3] += tx * te[5];
1037
- te[6] += tx * te[8];
1038
- te[1] += ty * te[2];
1039
- te[4] += ty * te[5];
1040
- te[7] += ty * te[8];
1015
+ this.premultiply(_m3.makeTranslation(tx, ty));
1016
+ return this;
1017
+ } // for 2D Transforms
1018
+
1019
+
1020
+ makeTranslation(x, y) {
1021
+ this.set(1, 0, x, 0, 1, y, 0, 0, 1);
1041
1022
  return this;
1042
1023
  }
1043
1024
 
1025
+ makeRotation(theta) {
1026
+ // counterclockwise
1027
+ const c = Math.cos(theta);
1028
+ const s = Math.sin(theta);
1029
+ this.set(c, -s, 0, s, c, 0, 0, 0, 1);
1030
+ return this;
1031
+ }
1032
+
1033
+ makeScale(x, y) {
1034
+ this.set(x, 0, 0, 0, y, 0, 0, 0, 1);
1035
+ return this;
1036
+ } //
1037
+
1038
+
1044
1039
  equals(matrix) {
1045
1040
  const te = this.elements;
1046
1041
  const me = matrix.elements;
@@ -1080,6 +1075,8 @@
1080
1075
 
1081
1076
  }
1082
1077
 
1078
+ const _m3 = /*@__PURE__*/new Matrix3();
1079
+
1083
1080
  function arrayNeedsUint32(array) {
1084
1081
  // assumes larger values usually on last
1085
1082
  for (let i = array.length - 1; i >= 0; --i) {
@@ -1309,7 +1306,7 @@
1309
1306
  'yellow': 0xFFFF00,
1310
1307
  'yellowgreen': 0x9ACD32
1311
1308
  };
1312
- const _rgb = {
1309
+ const _rgb$1 = {
1313
1310
  r: 0,
1314
1311
  g: 0,
1315
1312
  b: 0
@@ -1384,7 +1381,7 @@
1384
1381
  return this;
1385
1382
  }
1386
1383
 
1387
- setRGB(r, g, b, colorSpace = LinearSRGBColorSpace) {
1384
+ setRGB(r, g, b, colorSpace = ColorManagement.workingColorSpace) {
1388
1385
  this.r = r;
1389
1386
  this.g = g;
1390
1387
  this.b = b;
@@ -1392,7 +1389,7 @@
1392
1389
  return this;
1393
1390
  }
1394
1391
 
1395
- setHSL(h, s, l, colorSpace = LinearSRGBColorSpace) {
1392
+ setHSL(h, s, l, colorSpace = ColorManagement.workingColorSpace) {
1396
1393
  // h,s,l ranges are in 0.0 - 1.0
1397
1394
  h = euclideanModulo(h, 1);
1398
1395
  s = clamp(s, 0, 1);
@@ -1547,20 +1544,20 @@
1547
1544
  }
1548
1545
 
1549
1546
  getHex(colorSpace = SRGBColorSpace) {
1550
- ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb), colorSpace);
1551
- return clamp(_rgb.r * 255, 0, 255) << 16 ^ clamp(_rgb.g * 255, 0, 255) << 8 ^ clamp(_rgb.b * 255, 0, 255) << 0;
1547
+ ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb$1), colorSpace);
1548
+ return clamp(_rgb$1.r * 255, 0, 255) << 16 ^ clamp(_rgb$1.g * 255, 0, 255) << 8 ^ clamp(_rgb$1.b * 255, 0, 255) << 0;
1552
1549
  }
1553
1550
 
1554
1551
  getHexString(colorSpace = SRGBColorSpace) {
1555
1552
  return ('000000' + this.getHex(colorSpace).toString(16)).slice(-6);
1556
1553
  }
1557
1554
 
1558
- getHSL(target, colorSpace = LinearSRGBColorSpace) {
1555
+ getHSL(target, colorSpace = ColorManagement.workingColorSpace) {
1559
1556
  // h,s,l ranges are in 0.0 - 1.0
1560
- ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb), colorSpace);
1561
- const r = _rgb.r,
1562
- g = _rgb.g,
1563
- b = _rgb.b;
1557
+ ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb$1), colorSpace);
1558
+ const r = _rgb$1.r,
1559
+ g = _rgb$1.g,
1560
+ b = _rgb$1.b;
1564
1561
  const max = Math.max(r, g, b);
1565
1562
  const min = Math.min(r, g, b);
1566
1563
  let hue, saturation;
@@ -1596,23 +1593,23 @@
1596
1593
  return target;
1597
1594
  }
1598
1595
 
1599
- getRGB(target, colorSpace = LinearSRGBColorSpace) {
1600
- ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb), colorSpace);
1601
- target.r = _rgb.r;
1602
- target.g = _rgb.g;
1603
- target.b = _rgb.b;
1596
+ getRGB(target, colorSpace = ColorManagement.workingColorSpace) {
1597
+ ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb$1), colorSpace);
1598
+ target.r = _rgb$1.r;
1599
+ target.g = _rgb$1.g;
1600
+ target.b = _rgb$1.b;
1604
1601
  return target;
1605
1602
  }
1606
1603
 
1607
1604
  getStyle(colorSpace = SRGBColorSpace) {
1608
- ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb), colorSpace);
1605
+ ColorManagement.fromWorkingColorSpace(toComponents(this, _rgb$1), colorSpace);
1609
1606
 
1610
1607
  if (colorSpace !== SRGBColorSpace) {
1611
1608
  // Requires CSS Color Module Level 4 (https://www.w3.org/TR/css-color-4/).
1612
- return `color(${colorSpace} ${_rgb.r} ${_rgb.g} ${_rgb.b})`;
1609
+ return `color(${colorSpace} ${_rgb$1.r} ${_rgb$1.g} ${_rgb$1.b})`;
1613
1610
  }
1614
1611
 
1615
- return `rgb(${_rgb.r * 255 | 0},${_rgb.g * 255 | 0},${_rgb.b * 255 | 0})`;
1612
+ return `rgb(${_rgb$1.r * 255 | 0},${_rgb$1.g * 255 | 0},${_rgb$1.b * 255 | 0})`;
1616
1613
  }
1617
1614
 
1618
1615
  offsetHSL(h, s, l) {
@@ -1889,7 +1886,7 @@
1889
1886
  let textureId = 0;
1890
1887
 
1891
1888
  class Texture extends EventDispatcher {
1892
- constructor(image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = 1, encoding = LinearEncoding) {
1889
+ constructor(image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = Texture.DEFAULT_ANISOTROPY, encoding = LinearEncoding) {
1893
1890
  super();
1894
1891
  this.isTexture = true;
1895
1892
  Object.defineProperty(this, 'id', {
@@ -2088,6 +2085,7 @@
2088
2085
 
2089
2086
  Texture.DEFAULT_IMAGE = null;
2090
2087
  Texture.DEFAULT_MAPPING = UVMapping;
2088
+ Texture.DEFAULT_ANISOTROPY = 1;
2091
2089
 
2092
2090
  class Vector4 {
2093
2091
  constructor(x = 0, y = 0, z = 0, w = 1) {
@@ -2575,7 +2573,7 @@
2575
2573
  */
2576
2574
 
2577
2575
  class WebGLRenderTarget extends EventDispatcher {
2578
- constructor(width, height, options = {}) {
2576
+ constructor(width = 1, height = 1, options = {}) {
2579
2577
  super();
2580
2578
  this.isWebGLRenderTarget = true;
2581
2579
  this.width = width;
@@ -2666,7 +2664,7 @@
2666
2664
  }
2667
2665
 
2668
2666
  class WebGLArrayRenderTarget extends WebGLRenderTarget {
2669
- constructor(width, height, depth) {
2667
+ constructor(width = 1, height = 1, depth = 1) {
2670
2668
  super(width, height);
2671
2669
  this.isWebGLArrayRenderTarget = true;
2672
2670
  this.depth = depth;
@@ -2704,7 +2702,7 @@
2704
2702
  }
2705
2703
 
2706
2704
  class WebGL3DRenderTarget extends WebGLRenderTarget {
2707
- constructor(width, height, depth) {
2705
+ constructor(width = 1, height = 1, depth = 1) {
2708
2706
  super(width, height);
2709
2707
  this.isWebGL3DRenderTarget = true;
2710
2708
  this.depth = depth;
@@ -2715,7 +2713,7 @@
2715
2713
  }
2716
2714
 
2717
2715
  class WebGLMultipleRenderTargets extends WebGLRenderTarget {
2718
- constructor(width, height, count, options = {}) {
2716
+ constructor(width = 1, height = 1, count = 1, options = {}) {
2719
2717
  super(width, height, options);
2720
2718
  this.isWebGLMultipleRenderTargets = true;
2721
2719
  const texture = this.texture;
@@ -4057,28 +4055,28 @@
4057
4055
 
4058
4056
  _v1$7.subVectors(triangle.b, _center);
4059
4057
 
4060
- _v2$3.subVectors(triangle.c, _center); // compute edge vectors for triangle
4058
+ _v2$4.subVectors(triangle.c, _center); // compute edge vectors for triangle
4061
4059
 
4062
4060
 
4063
4061
  _f0.subVectors(_v1$7, _v0$2);
4064
4062
 
4065
- _f1.subVectors(_v2$3, _v1$7);
4063
+ _f1.subVectors(_v2$4, _v1$7);
4066
4064
 
4067
- _f2.subVectors(_v0$2, _v2$3); // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
4065
+ _f2.subVectors(_v0$2, _v2$4); // test against axes that are given by cross product combinations of the edges of the triangle and the edges of the aabb
4068
4066
  // make an axis testing of each of the 3 sides of the aabb against each of the 3 sides of the triangle = 9 axis of separation
4069
4067
  // axis_ij = u_i x f_j (u0, u1, u2 = face normals of aabb = x,y,z axes vectors since aabb is axis aligned)
4070
4068
 
4071
4069
 
4072
4070
  let axes = [0, -_f0.z, _f0.y, 0, -_f1.z, _f1.y, 0, -_f2.z, _f2.y, _f0.z, 0, -_f0.x, _f1.z, 0, -_f1.x, _f2.z, 0, -_f2.x, -_f0.y, _f0.x, 0, -_f1.y, _f1.x, 0, -_f2.y, _f2.x, 0];
4073
4071
 
4074
- if (!satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents)) {
4072
+ if (!satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents)) {
4075
4073
  return false;
4076
4074
  } // test 3 face normals from the aabb
4077
4075
 
4078
4076
 
4079
4077
  axes = [1, 0, 0, 0, 1, 0, 0, 0, 1];
4080
4078
 
4081
- if (!satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents)) {
4079
+ if (!satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents)) {
4082
4080
  return false;
4083
4081
  } // finally testing the face normal of the triangle
4084
4082
  // use already existing triangle edge vectors here
@@ -4087,7 +4085,7 @@
4087
4085
  _triangleNormal.crossVectors(_f0, _f1);
4088
4086
 
4089
4087
  axes = [_triangleNormal.x, _triangleNormal.y, _triangleNormal.z];
4090
- return satForAxes(axes, _v0$2, _v1$7, _v2$3, _extents);
4088
+ return satForAxes(axes, _v0$2, _v1$7, _v2$4, _extents);
4091
4089
  }
4092
4090
 
4093
4091
  clampPoint(point, target) {
@@ -4175,7 +4173,7 @@
4175
4173
 
4176
4174
  const _v1$7 = /*@__PURE__*/new Vector3();
4177
4175
 
4178
- const _v2$3 = /*@__PURE__*/new Vector3(); // triangle edge vectors
4176
+ const _v2$4 = /*@__PURE__*/new Vector3(); // triangle edge vectors
4179
4177
 
4180
4178
 
4181
4179
  const _f0 = /*@__PURE__*/new Vector3();
@@ -4217,9 +4215,7 @@
4217
4215
 
4218
4216
  const _v1$6 = /*@__PURE__*/new Vector3();
4219
4217
 
4220
- const _toFarthestPoint = /*@__PURE__*/new Vector3();
4221
-
4222
- const _toPoint = /*@__PURE__*/new Vector3();
4218
+ const _v2$3 = /*@__PURE__*/new Vector3();
4223
4219
 
4224
4220
  class Sphere {
4225
4221
  constructor(center = new Vector3(), radius = -1) {
@@ -4325,37 +4321,46 @@
4325
4321
  }
4326
4322
 
4327
4323
  expandByPoint(point) {
4328
- // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L649-L671
4329
- _toPoint.subVectors(point, this.center);
4324
+ if (this.isEmpty()) {
4325
+ this.center.copy(point);
4326
+ this.radius = 0;
4327
+ return this;
4328
+ }
4329
+
4330
+ _v1$6.subVectors(point, this.center);
4330
4331
 
4331
- const lengthSq = _toPoint.lengthSq();
4332
+ const lengthSq = _v1$6.lengthSq();
4332
4333
 
4333
4334
  if (lengthSq > this.radius * this.radius) {
4335
+ // calculate the minimal sphere
4334
4336
  const length = Math.sqrt(lengthSq);
4335
- const missingRadiusHalf = (length - this.radius) * 0.5; // Nudge this sphere towards the target point. Add half the missing distance to radius,
4336
- // and the other half to position. This gives a tighter enclosure, instead of if
4337
- // the whole missing distance were just added to radius.
4338
-
4339
- this.center.add(_toPoint.multiplyScalar(missingRadiusHalf / length));
4340
- this.radius += missingRadiusHalf;
4337
+ const delta = (length - this.radius) * 0.5;
4338
+ this.center.addScaledVector(_v1$6, delta / length);
4339
+ this.radius += delta;
4341
4340
  }
4342
4341
 
4343
4342
  return this;
4344
4343
  }
4345
4344
 
4346
4345
  union(sphere) {
4347
- // from https://github.com/juj/MathGeoLib/blob/2940b99b99cfe575dd45103ef20f4019dee15b54/src/Geometry/Sphere.cpp#L759-L769
4348
- // To enclose another sphere into this sphere, we only need to enclose two points:
4349
- // 1) Enclose the farthest point on the other sphere into this sphere.
4350
- // 2) Enclose the opposite point of the farthest point into this sphere.
4346
+ if (sphere.isEmpty()) {
4347
+ return this;
4348
+ }
4349
+
4350
+ if (this.isEmpty()) {
4351
+ this.copy(sphere);
4352
+ return this;
4353
+ }
4354
+
4351
4355
  if (this.center.equals(sphere.center) === true) {
4352
- _toFarthestPoint.set(0, 0, 1).multiplyScalar(sphere.radius);
4356
+ this.radius = Math.max(this.radius, sphere.radius);
4353
4357
  } else {
4354
- _toFarthestPoint.subVectors(sphere.center, this.center).normalize().multiplyScalar(sphere.radius);
4358
+ _v2$3.subVectors(sphere.center, this.center).setLength(sphere.radius);
4359
+
4360
+ this.expandByPoint(_v1$6.copy(sphere.center).add(_v2$3));
4361
+ this.expandByPoint(_v1$6.copy(sphere.center).sub(_v2$3));
4355
4362
  }
4356
4363
 
4357
- this.expandByPoint(_v1$6.copy(sphere.center).add(_toFarthestPoint));
4358
- this.expandByPoint(_v1$6.copy(sphere.center).sub(_toFarthestPoint));
4359
4364
  return this;
4360
4365
  }
4361
4366
 
@@ -4627,11 +4632,9 @@
4627
4632
  tymax = (box.min.y - origin.y) * invdiry;
4628
4633
  }
4629
4634
 
4630
- if (tmin > tymax || tymin > tmax) return null; // These lines also handle the case where tmin or tmax is NaN
4631
- // (result of 0 * Infinity). x !== x returns true if x is NaN
4632
-
4633
- if (tymin > tmin || tmin !== tmin) tmin = tymin;
4634
- if (tymax < tmax || tmax !== tmax) tmax = tymax;
4635
+ if (tmin > tymax || tymin > tmax) return null;
4636
+ if (tymin > tmin || isNaN(tmin)) tmin = tymin;
4637
+ if (tymax < tmax || isNaN(tmax)) tmax = tymax;
4635
4638
 
4636
4639
  if (invdirz >= 0) {
4637
4640
  tzmin = (box.min.z - origin.z) * invdirz;
@@ -6876,7 +6879,7 @@
6876
6879
  if (this.transmissionMap && this.transmissionMap.isTexture) data.transmissionMap = this.transmissionMap.toJSON(meta).uuid;
6877
6880
  if (this.thickness !== undefined) data.thickness = this.thickness;
6878
6881
  if (this.thicknessMap && this.thicknessMap.isTexture) data.thicknessMap = this.thicknessMap.toJSON(meta).uuid;
6879
- if (this.attenuationDistance !== undefined) data.attenuationDistance = this.attenuationDistance;
6882
+ if (this.attenuationDistance !== undefined && this.attenuationDistance !== Infinity) data.attenuationDistance = this.attenuationDistance;
6880
6883
  if (this.attenuationColor !== undefined) data.attenuationColor = this.attenuationColor.getHex();
6881
6884
  if (this.size !== undefined) data.size = this.size;
6882
6885
  if (this.shadowSide !== null) data.shadowSide = this.shadowSide;
@@ -8592,6 +8595,7 @@
8592
8595
  /**
8593
8596
  * Uniform Utilities
8594
8597
  */
8598
+
8595
8599
  function cloneUniforms(src) {
8596
8600
  const dst = {};
8597
8601
 
@@ -8634,6 +8638,14 @@
8634
8638
  }
8635
8639
 
8636
8640
  return dst;
8641
+ }
8642
+ function getUnlitUniformColorSpace(renderer) {
8643
+ if (renderer.getRenderTarget() === null) {
8644
+ // https://github.com/mrdoob/three.js/pull/23937#issuecomment-1111067398
8645
+ return renderer.outputEncoding === sRGBEncoding ? SRGBColorSpace : LinearSRGBColorSpace;
8646
+ }
8647
+
8648
+ return LinearSRGBColorSpace;
8637
8649
  } // Legacy
8638
8650
 
8639
8651
  const UniformsUtils = {
@@ -8993,8 +9005,9 @@
8993
9005
 
8994
9006
  }
8995
9007
 
8996
- const fov = 90,
8997
- aspect = 1;
9008
+ const fov = -90; // negative fov is not an error
9009
+
9010
+ const aspect = 1;
8998
9011
 
8999
9012
  class CubeCamera extends Object3D {
9000
9013
  constructor(near, far, renderTarget) {
@@ -9003,33 +9016,33 @@
9003
9016
  this.renderTarget = renderTarget;
9004
9017
  const cameraPX = new PerspectiveCamera(fov, aspect, near, far);
9005
9018
  cameraPX.layers = this.layers;
9006
- cameraPX.up.set(0, -1, 0);
9007
- cameraPX.lookAt(new Vector3(1, 0, 0));
9019
+ cameraPX.up.set(0, 1, 0);
9020
+ cameraPX.lookAt(1, 0, 0);
9008
9021
  this.add(cameraPX);
9009
9022
  const cameraNX = new PerspectiveCamera(fov, aspect, near, far);
9010
9023
  cameraNX.layers = this.layers;
9011
- cameraNX.up.set(0, -1, 0);
9012
- cameraNX.lookAt(new Vector3(-1, 0, 0));
9024
+ cameraNX.up.set(0, 1, 0);
9025
+ cameraNX.lookAt(-1, 0, 0);
9013
9026
  this.add(cameraNX);
9014
9027
  const cameraPY = new PerspectiveCamera(fov, aspect, near, far);
9015
9028
  cameraPY.layers = this.layers;
9016
- cameraPY.up.set(0, 0, 1);
9017
- cameraPY.lookAt(new Vector3(0, 1, 0));
9029
+ cameraPY.up.set(0, 0, -1);
9030
+ cameraPY.lookAt(0, 1, 0);
9018
9031
  this.add(cameraPY);
9019
9032
  const cameraNY = new PerspectiveCamera(fov, aspect, near, far);
9020
9033
  cameraNY.layers = this.layers;
9021
- cameraNY.up.set(0, 0, -1);
9022
- cameraNY.lookAt(new Vector3(0, -1, 0));
9034
+ cameraNY.up.set(0, 0, 1);
9035
+ cameraNY.lookAt(0, -1, 0);
9023
9036
  this.add(cameraNY);
9024
9037
  const cameraPZ = new PerspectiveCamera(fov, aspect, near, far);
9025
9038
  cameraPZ.layers = this.layers;
9026
- cameraPZ.up.set(0, -1, 0);
9027
- cameraPZ.lookAt(new Vector3(0, 0, 1));
9039
+ cameraPZ.up.set(0, 1, 0);
9040
+ cameraPZ.lookAt(0, 0, 1);
9028
9041
  this.add(cameraPZ);
9029
9042
  const cameraNZ = new PerspectiveCamera(fov, aspect, near, far);
9030
9043
  cameraNZ.layers = this.layers;
9031
- cameraNZ.up.set(0, -1, 0);
9032
- cameraNZ.lookAt(new Vector3(0, 0, -1));
9044
+ cameraNZ.up.set(0, 1, 0);
9045
+ cameraNZ.lookAt(0, 0, -1);
9033
9046
  this.add(cameraNZ);
9034
9047
  }
9035
9048
 
@@ -9085,7 +9098,7 @@
9085
9098
  }
9086
9099
 
9087
9100
  class WebGLCubeRenderTarget extends WebGLRenderTarget {
9088
- constructor(size, options = {}) {
9101
+ constructor(size = 1, options = {}) {
9089
9102
  super(size, size, options);
9090
9103
  this.isWebGLCubeRenderTarget = true;
9091
9104
  const image = {
@@ -9559,6 +9572,8 @@
9559
9572
 
9560
9573
  updateRange.count = -1; // reset range
9561
9574
  }
9575
+
9576
+ attribute.onUploadCallback();
9562
9577
  } //
9563
9578
 
9564
9579
 
@@ -9726,7 +9741,7 @@
9726
9741
 
9727
9742
  var encodings_pars_fragment = "vec4 LinearToLinear( in vec4 value ) {\n\treturn value;\n}\nvec4 LinearTosRGB( in vec4 value ) {\n\treturn vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );\n}";
9728
9743
 
9729
- var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 envColor = textureCubeUV( envMap, reflectVec, 0.0 );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
9744
+ var envmap_fragment = "#ifdef USE_ENVMAP\n\t#ifdef ENV_WORLDPOS\n\t\tvec3 cameraToFrag;\n\t\tif ( isOrthographic ) {\n\t\t\tcameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );\n\t\t} else {\n\t\t\tcameraToFrag = normalize( vWorldPosition - cameraPosition );\n\t\t}\n\t\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\t\t#ifdef ENVMAP_MODE_REFLECTION\n\t\t\tvec3 reflectVec = reflect( cameraToFrag, worldNormal );\n\t\t#else\n\t\t\tvec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );\n\t\t#endif\n\t#else\n\t\tvec3 reflectVec = vReflect;\n\t#endif\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 envColor = textureCube( envMap, vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );\n\t#else\n\t\tvec4 envColor = vec4( 0.0 );\n\t#endif\n\t#ifdef ENVMAP_BLENDING_MULTIPLY\n\t\toutgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_MIX )\n\t\toutgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );\n\t#elif defined( ENVMAP_BLENDING_ADD )\n\t\toutgoingLight += envColor.xyz * specularStrength * reflectivity;\n\t#endif\n#endif";
9730
9745
 
9731
9746
  var envmap_common_pars_fragment = "#ifdef USE_ENVMAP\n\tuniform float envMapIntensity;\n\tuniform float flipEnvMap;\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tuniform samplerCube envMap;\n\t#else\n\t\tuniform sampler2D envMap;\n\t#endif\n\t\n#endif";
9732
9747
 
@@ -9752,7 +9767,7 @@
9752
9767
 
9753
9768
  var lights_lambert_fragment = "LambertMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularStrength = specularStrength;";
9754
9769
 
9755
- var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert\n#define Material_LightProbeLOD( material )\t(0)";
9770
+ var lights_lambert_pars_fragment = "varying vec3 vViewPosition;\nstruct LambertMaterial {\n\tvec3 diffuseColor;\n\tfloat specularStrength;\n};\nvoid RE_Direct_Lambert( const in IncidentLight directLight, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in GeometricContext geometry, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Lambert\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Lambert";
9756
9771
 
9757
9772
  var lights_pars_begin = "uniform bool receiveShadow;\nuniform vec3 ambientLightColor;\nuniform vec3 lightProbe[ 9 ];\nvec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {\n\tfloat x = normal.x, y = normal.y, z = normal.z;\n\tvec3 result = shCoefficients[ 0 ] * 0.886227;\n\tresult += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;\n\tresult += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;\n\tresult += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;\n\tresult += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;\n\tresult += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;\n\tresult += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );\n\tresult += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;\n\tresult += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );\n\treturn result;\n}\nvec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {\n\tvec3 worldNormal = inverseTransformDirection( normal, viewMatrix );\n\tvec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );\n\treturn irradiance;\n}\nvec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {\n\tvec3 irradiance = ambientLightColor;\n\treturn irradiance;\n}\nfloat getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n\t#if defined ( PHYSICALLY_CORRECT_LIGHTS )\n\t\tfloat distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n\t\tif ( cutoffDistance > 0.0 ) {\n\t\t\tdistanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n\t\t}\n\t\treturn distanceFalloff;\n\t#else\n\t\tif ( cutoffDistance > 0.0 && decayExponent > 0.0 ) {\n\t\t\treturn pow( saturate( - lightDistance / cutoffDistance + 1.0 ), decayExponent );\n\t\t}\n\t\treturn 1.0;\n\t#endif\n}\nfloat getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n\treturn smoothstep( coneCosine, penumbraCosine, angleCosine );\n}\n#if NUM_DIR_LIGHTS > 0\n\tstruct DirectionalLight {\n\t\tvec3 direction;\n\t\tvec3 color;\n\t};\n\tuniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];\n\tvoid getDirectionalLightInfo( const in DirectionalLight directionalLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tlight.color = directionalLight.color;\n\t\tlight.direction = directionalLight.direction;\n\t\tlight.visible = true;\n\t}\n#endif\n#if NUM_POINT_LIGHTS > 0\n\tstruct PointLight {\n\t\tvec3 position;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t};\n\tuniform PointLight pointLights[ NUM_POINT_LIGHTS ];\n\tvoid getPointLightInfo( const in PointLight pointLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = pointLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat lightDistance = length( lVector );\n\t\tlight.color = pointLight.color;\n\t\tlight.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );\n\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t}\n#endif\n#if NUM_SPOT_LIGHTS > 0\n\tstruct SpotLight {\n\t\tvec3 position;\n\t\tvec3 direction;\n\t\tvec3 color;\n\t\tfloat distance;\n\t\tfloat decay;\n\t\tfloat coneCos;\n\t\tfloat penumbraCos;\n\t};\n\tuniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];\n\tvoid getSpotLightInfo( const in SpotLight spotLight, const in GeometricContext geometry, out IncidentLight light ) {\n\t\tvec3 lVector = spotLight.position - geometry.position;\n\t\tlight.direction = normalize( lVector );\n\t\tfloat angleCos = dot( light.direction, spotLight.direction );\n\t\tfloat spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n\t\tif ( spotAttenuation > 0.0 ) {\n\t\t\tfloat lightDistance = length( lVector );\n\t\t\tlight.color = spotLight.color * spotAttenuation;\n\t\t\tlight.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n\t\t\tlight.visible = ( light.color != vec3( 0.0 ) );\n\t\t} else {\n\t\t\tlight.color = vec3( 0.0 );\n\t\t\tlight.visible = false;\n\t\t}\n\t}\n#endif\n#if NUM_RECT_AREA_LIGHTS > 0\n\tstruct RectAreaLight {\n\t\tvec3 color;\n\t\tvec3 position;\n\t\tvec3 halfWidth;\n\t\tvec3 halfHeight;\n\t};\n\tuniform sampler2D ltc_1;\tuniform sampler2D ltc_2;\n\tuniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];\n#endif\n#if NUM_HEMI_LIGHTS > 0\n\tstruct HemisphereLight {\n\t\tvec3 direction;\n\t\tvec3 skyColor;\n\t\tvec3 groundColor;\n\t};\n\tuniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];\n\tvec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {\n\t\tfloat dotNL = dot( normal, hemiLight.direction );\n\t\tfloat hemiDiffuseWeight = 0.5 * dotNL + 0.5;\n\t\tvec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );\n\t\treturn irradiance;\n\t}\n#endif";
9758
9773
 
@@ -9760,11 +9775,11 @@
9760
9775
 
9761
9776
  var lights_toon_fragment = "ToonMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;";
9762
9777
 
9763
- var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon\n#define Material_LightProbeLOD( material )\t(0)";
9778
+ var lights_toon_pars_fragment = "varying vec3 vViewPosition;\nstruct ToonMaterial {\n\tvec3 diffuseColor;\n};\nvoid RE_Direct_Toon( const in IncidentLight directLight, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\tvec3 irradiance = getGradientIrradiance( geometry.normal, directLight.direction ) * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\nvoid RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in GeometricContext geometry, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_Toon\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_Toon";
9764
9779
 
9765
9780
  var lights_phong_fragment = "BlinnPhongMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb;\nmaterial.specularColor = specular;\nmaterial.specularShininess = shininess;\nmaterial.specularStrength = specularStrength;";
9766
9781
 
9767
- var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong\n#define Material_LightProbeLOD( material )\t(0)";
9782
+ var lights_phong_pars_fragment = "varying vec3 vViewPosition;\nstruct BlinnPhongMaterial {\n\tvec3 diffuseColor;\n\tvec3 specularColor;\n\tfloat specularShininess;\n\tfloat specularStrength;\n};\nvoid RE_Direct_BlinnPhong( const in IncidentLight directLight, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\tfloat dotNL = saturate( dot( geometry.normal, directLight.direction ) );\n\tvec3 irradiance = dotNL * directLight.color;\n\treflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n\treflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularShininess ) * material.specularStrength;\n}\nvoid RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in GeometricContext geometry, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {\n\treflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );\n}\n#define RE_Direct\t\t\t\tRE_Direct_BlinnPhong\n#define RE_IndirectDiffuse\t\tRE_IndirectDiffuse_BlinnPhong";
9768
9783
 
9769
9784
  var lights_physical_fragment = "PhysicalMaterial material;\nmaterial.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );\nvec3 dxy = max( abs( dFdx( geometryNormal ) ), abs( dFdy( geometryNormal ) ) );\nfloat geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );\nmaterial.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;\nmaterial.roughness = min( material.roughness, 1.0 );\n#ifdef IOR\n\tmaterial.ior = ior;\n\t#ifdef SPECULAR\n\t\tfloat specularIntensityFactor = specularIntensity;\n\t\tvec3 specularColorFactor = specularColor;\n\t\t#ifdef USE_SPECULARINTENSITYMAP\n\t\t\tspecularIntensityFactor *= texture2D( specularIntensityMap, vUv ).a;\n\t\t#endif\n\t\t#ifdef USE_SPECULARCOLORMAP\n\t\t\tspecularColorFactor *= texture2D( specularColorMap, vUv ).rgb;\n\t\t#endif\n\t\tmaterial.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );\n\t#else\n\t\tfloat specularIntensityFactor = 1.0;\n\t\tvec3 specularColorFactor = vec3( 1.0 );\n\t\tmaterial.specularF90 = 1.0;\n\t#endif\n\tmaterial.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );\n#else\n\tmaterial.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );\n\tmaterial.specularF90 = 1.0;\n#endif\n#ifdef USE_CLEARCOAT\n\tmaterial.clearcoat = clearcoat;\n\tmaterial.clearcoatRoughness = clearcoatRoughness;\n\tmaterial.clearcoatF0 = vec3( 0.04 );\n\tmaterial.clearcoatF90 = 1.0;\n\t#ifdef USE_CLEARCOATMAP\n\t\tmaterial.clearcoat *= texture2D( clearcoatMap, vUv ).x;\n\t#endif\n\t#ifdef USE_CLEARCOAT_ROUGHNESSMAP\n\t\tmaterial.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vUv ).y;\n\t#endif\n\tmaterial.clearcoat = saturate( material.clearcoat );\tmaterial.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );\n\tmaterial.clearcoatRoughness += geometryRoughness;\n\tmaterial.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );\n#endif\n#ifdef USE_IRIDESCENCE\n\tmaterial.iridescence = iridescence;\n\tmaterial.iridescenceIOR = iridescenceIOR;\n\t#ifdef USE_IRIDESCENCEMAP\n\t\tmaterial.iridescence *= texture2D( iridescenceMap, vUv ).r;\n\t#endif\n\t#ifdef USE_IRIDESCENCE_THICKNESSMAP\n\t\tmaterial.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vUv ).g + iridescenceThicknessMinimum;\n\t#else\n\t\tmaterial.iridescenceThickness = iridescenceThicknessMaximum;\n\t#endif\n#endif\n#ifdef USE_SHEEN\n\tmaterial.sheenColor = sheenColor;\n\t#ifdef USE_SHEENCOLORMAP\n\t\tmaterial.sheenColor *= texture2D( sheenColorMap, vUv ).rgb;\n\t#endif\n\tmaterial.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );\n\t#ifdef USE_SHEENROUGHNESSMAP\n\t\tmaterial.sheenRoughness *= texture2D( sheenRoughnessMap, vUv ).a;\n\t#endif\n#endif";
9770
9785
 
@@ -9804,7 +9819,7 @@
9804
9819
 
9805
9820
  var morphtarget_vertex = "#ifdef USE_MORPHTARGETS\n\ttransformed *= morphTargetBaseInfluence;\n\t#ifdef MORPHTARGETS_TEXTURE\n\t\tfor ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {\n\t\t\tif ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];\n\t\t}\n\t#else\n\t\ttransformed += morphTarget0 * morphTargetInfluences[ 0 ];\n\t\ttransformed += morphTarget1 * morphTargetInfluences[ 1 ];\n\t\ttransformed += morphTarget2 * morphTargetInfluences[ 2 ];\n\t\ttransformed += morphTarget3 * morphTargetInfluences[ 3 ];\n\t\t#ifndef USE_MORPHNORMALS\n\t\t\ttransformed += morphTarget4 * morphTargetInfluences[ 4 ];\n\t\t\ttransformed += morphTarget5 * morphTargetInfluences[ 5 ];\n\t\t\ttransformed += morphTarget6 * morphTargetInfluences[ 6 ];\n\t\t\ttransformed += morphTarget7 * morphTargetInfluences[ 7 ];\n\t\t#endif\n\t#endif\n#endif";
9806
9821
 
9807
- var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = vec3( dFdx( vViewPosition.x ), dFdx( vViewPosition.y ), dFdx( vViewPosition.z ) );\n\tvec3 fdy = vec3( dFdy( vViewPosition.x ), dFdy( vViewPosition.y ), dFdy( vViewPosition.z ) );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;";
9822
+ var normal_fragment_begin = "float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;\n#ifdef FLAT_SHADED\n\tvec3 fdx = dFdx( vViewPosition );\n\tvec3 fdy = dFdy( vViewPosition );\n\tvec3 normal = normalize( cross( fdx, fdy ) );\n#else\n\tvec3 normal = normalize( vNormal );\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\t#ifdef USE_TANGENT\n\t\tvec3 tangent = normalize( vTangent );\n\t\tvec3 bitangent = normalize( vBitangent );\n\t\t#ifdef DOUBLE_SIDED\n\t\t\ttangent = tangent * faceDirection;\n\t\t\tbitangent = bitangent * faceDirection;\n\t\t#endif\n\t\t#if defined( TANGENTSPACE_NORMALMAP ) || defined( USE_CLEARCOAT_NORMALMAP )\n\t\t\tmat3 vTBN = mat3( tangent, bitangent, normal );\n\t\t#endif\n\t#endif\n#endif\nvec3 geometryNormal = normal;";
9808
9823
 
9809
9824
  var normal_fragment_maps = "#ifdef OBJECTSPACE_NORMALMAP\n\tnormal = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\t#ifdef FLIP_SIDED\n\t\tnormal = - normal;\n\t#endif\n\t#ifdef DOUBLE_SIDED\n\t\tnormal = normal * faceDirection;\n\t#endif\n\tnormal = normalize( normalMatrix * normal );\n#elif defined( TANGENTSPACE_NORMALMAP )\n\tvec3 mapN = texture2D( normalMap, vUv ).xyz * 2.0 - 1.0;\n\tmapN.xy *= normalScale;\n\t#ifdef USE_TANGENT\n\t\tnormal = normalize( vTBN * mapN );\n\t#else\n\t\tnormal = perturbNormal2Arb( - vViewPosition, normal, mapN, faceDirection );\n\t#endif\n#elif defined( USE_BUMPMAP )\n\tnormal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );\n#endif";
9810
9825
 
@@ -9826,7 +9841,7 @@
9826
9841
 
9827
9842
  var output_fragment = "#ifdef OPAQUE\ndiffuseColor.a = 1.0;\n#endif\n#ifdef USE_TRANSMISSION\ndiffuseColor.a *= material.transmissionAlpha + 0.1;\n#endif\ngl_FragColor = vec4( outgoingLight, diffuseColor.a );";
9828
9843
 
9829
- var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}";
9844
+ var packing = "vec3 packNormalToRGB( const in vec3 normal ) {\n\treturn normalize( normal ) * 0.5 + 0.5;\n}\nvec3 unpackRGBToNormal( const in vec3 rgb ) {\n\treturn 2.0 * rgb.xyz - 1.0;\n}\nconst float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;\nconst vec3 PackFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );\nconst vec4 UnpackFactors = UnpackDownscale / vec4( PackFactors, 1. );\nconst float ShiftRight8 = 1. / 256.;\nvec4 packDepthToRGBA( const in float v ) {\n\tvec4 r = vec4( fract( v * PackFactors ), v );\n\tr.yzw -= r.xyz * ShiftRight8;\treturn r * PackUpscale;\n}\nfloat unpackRGBAToDepth( const in vec4 v ) {\n\treturn dot( v, UnpackFactors );\n}\nvec2 packDepthToRG( in highp float v ) {\n\treturn packDepthToRGBA( v ).yx;\n}\nfloat unpackRGToDepth( const in highp vec2 v ) {\n\treturn unpackRGBAToDepth( vec4( v.xy, 0.0, 0.0 ) );\n}\nvec4 pack2HalfToRGBA( vec2 v ) {\n\tvec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );\n\treturn vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );\n}\nvec2 unpackRGBATo2Half( vec4 v ) {\n\treturn vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );\n}\nfloat viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( viewZ + near ) / ( near - far );\n}\nfloat orthographicDepthToViewZ( const in float linearClipZ, const in float near, const in float far ) {\n\treturn linearClipZ * ( near - far ) - near;\n}\nfloat viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {\n\treturn ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );\n}\nfloat perspectiveDepthToViewZ( const in float invClipZ, const in float near, const in float far ) {\n\treturn ( near * far ) / ( ( far - near ) * invClipZ - far );\n}";
9830
9845
 
9831
9846
  var premultiplied_alpha_fragment = "#ifdef PREMULTIPLIED_ALPHA\n\tgl_FragColor.rgb *= gl_FragColor.a;\n#endif";
9832
9847
 
@@ -9866,7 +9881,7 @@
9866
9881
 
9867
9882
  var transmission_fragment = "#ifdef USE_TRANSMISSION\n\tmaterial.transmission = transmission;\n\tmaterial.transmissionAlpha = 1.0;\n\tmaterial.thickness = thickness;\n\tmaterial.attenuationDistance = attenuationDistance;\n\tmaterial.attenuationColor = attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tmaterial.transmission *= texture2D( transmissionMap, vUv ).r;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tmaterial.thickness *= texture2D( thicknessMap, vUv ).g;\n\t#endif\n\tvec3 pos = vWorldPosition;\n\tvec3 v = normalize( cameraPosition - pos );\n\tvec3 n = inverseTransformDirection( normal, viewMatrix );\n\tvec4 transmission = getIBLVolumeRefraction(\n\t\tn, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,\n\t\tpos, modelMatrix, viewMatrix, projectionMatrix, material.ior, material.thickness,\n\t\tmaterial.attenuationColor, material.attenuationDistance );\n\tmaterial.transmissionAlpha = mix( material.transmissionAlpha, transmission.a, material.transmission );\n\ttotalDiffuse = mix( totalDiffuse, transmission.rgb, material.transmission );\n#endif";
9868
9883
 
9869
- var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( attenuationDistance == 0.0 ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif";
9884
+ var transmission_pars_fragment = "#ifdef USE_TRANSMISSION\n\tuniform float transmission;\n\tuniform float thickness;\n\tuniform float attenuationDistance;\n\tuniform vec3 attenuationColor;\n\t#ifdef USE_TRANSMISSIONMAP\n\t\tuniform sampler2D transmissionMap;\n\t#endif\n\t#ifdef USE_THICKNESSMAP\n\t\tuniform sampler2D thicknessMap;\n\t#endif\n\tuniform vec2 transmissionSamplerSize;\n\tuniform sampler2D transmissionSamplerMap;\n\tuniform mat4 modelMatrix;\n\tuniform mat4 projectionMatrix;\n\tvarying vec3 vWorldPosition;\n\tvec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {\n\t\tvec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );\n\t\tvec3 modelScale;\n\t\tmodelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );\n\t\tmodelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );\n\t\tmodelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );\n\t\treturn normalize( refractionVector ) * thickness * modelScale;\n\t}\n\tfloat applyIorToRoughness( const in float roughness, const in float ior ) {\n\t\treturn roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );\n\t}\n\tvec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {\n\t\tfloat framebufferLod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );\n\t\t#ifdef texture2DLodEXT\n\t\t\treturn texture2DLodEXT( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#else\n\t\t\treturn texture2D( transmissionSamplerMap, fragCoord.xy, framebufferLod );\n\t\t#endif\n\t}\n\tvec3 applyVolumeAttenuation( const in vec3 radiance, const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tif ( isinf( attenuationDistance ) ) {\n\t\t\treturn radiance;\n\t\t} else {\n\t\t\tvec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;\n\t\t\tvec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );\t\t\treturn transmittance * radiance;\n\t\t}\n\t}\n\tvec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,\n\t\tconst in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,\n\t\tconst in mat4 viewMatrix, const in mat4 projMatrix, const in float ior, const in float thickness,\n\t\tconst in vec3 attenuationColor, const in float attenuationDistance ) {\n\t\tvec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );\n\t\tvec3 refractedRayExit = position + transmissionRay;\n\t\tvec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );\n\t\tvec2 refractionCoords = ndcPos.xy / ndcPos.w;\n\t\trefractionCoords += 1.0;\n\t\trefractionCoords /= 2.0;\n\t\tvec4 transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );\n\t\tvec3 attenuatedColor = applyVolumeAttenuation( transmittedLight.rgb, length( transmissionRay ), attenuationColor, attenuationDistance );\n\t\tvec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );\n\t\treturn vec4( ( 1.0 - F ) * attenuatedColor * diffuseColor, transmittedLight.a );\n\t}\n#endif";
9870
9885
 
9871
9886
  var uv_pars_fragment = "#if ( defined( USE_UV ) && ! defined( UVS_VERTEX_ONLY ) )\n\tvarying vec2 vUv;\n#endif";
9872
9887
 
@@ -9882,11 +9897,14 @@
9882
9897
 
9883
9898
  var worldpos_vertex = "#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0\n\tvec4 worldPosition = vec4( transformed, 1.0 );\n\t#ifdef USE_INSTANCING\n\t\tworldPosition = instanceMatrix * worldPosition;\n\t#endif\n\tworldPosition = modelMatrix * worldPosition;\n#endif";
9884
9899
 
9885
- const vertex$g = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
9886
- const fragment$g = "uniform sampler2D t2D;\nvarying vec2 vUv;\nvoid main() {\n\tgl_FragColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\tgl_FragColor = vec4( mix( pow( gl_FragColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), gl_FragColor.rgb * 0.0773993808, vec3( lessThanEqual( gl_FragColor.rgb, vec3( 0.04045 ) ) ) ), gl_FragColor.w );\n\t#endif\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
9900
+ const vertex$h = "varying vec2 vUv;\nuniform mat3 uvTransform;\nvoid main() {\n\tvUv = ( uvTransform * vec3( uv, 1 ) ).xy;\n\tgl_Position = vec4( position.xy, 1.0, 1.0 );\n}";
9901
+ const fragment$h = "uniform sampler2D t2D;\nuniform float backgroundIntensity;\nvarying vec2 vUv;\nvoid main() {\n\tvec4 texColor = texture2D( t2D, vUv );\n\t#ifdef DECODE_VIDEO_TEXTURE\n\t\ttexColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
9902
+
9903
+ const vertex$g = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
9904
+ const fragment$g = "#ifdef ENVMAP_TYPE_CUBE\n\tuniform samplerCube envMap;\n#elif defined( ENVMAP_TYPE_CUBE_UV )\n\tuniform sampler2D envMap;\n#endif\nuniform float flipEnvMap;\nuniform float backgroundBlurriness;\nuniform float backgroundIntensity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\t#ifdef ENVMAP_TYPE_CUBE\n\t\tvec4 texColor = textureCube( envMap, vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );\n\t#elif defined( ENVMAP_TYPE_CUBE_UV )\n\t\tvec4 texColor = textureCubeUV( envMap, vWorldDirection, backgroundBlurriness );\n\t#else\n\t\tvec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );\n\t#endif\n\ttexColor.rgb *= backgroundIntensity;\n\tgl_FragColor = texColor;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
9887
9905
 
9888
9906
  const vertex$f = "varying vec3 vWorldDirection;\n#include <common>\nvoid main() {\n\tvWorldDirection = transformDirection( position, modelMatrix );\n\t#include <begin_vertex>\n\t#include <project_vertex>\n\tgl_Position.z = gl_Position.w;\n}";
9889
- const fragment$f = "#include <envmap_common_pars_fragment>\nuniform float opacity;\nvarying vec3 vWorldDirection;\n#include <cube_uv_reflection_fragment>\nvoid main() {\n\tvec3 vReflect = vWorldDirection;\n\t#include <envmap_fragment>\n\tgl_FragColor = envColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
9907
+ const fragment$f = "uniform samplerCube tCube;\nuniform float tFlip;\nuniform float opacity;\nvarying vec3 vWorldDirection;\nvoid main() {\n\tvec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );\n\tgl_FragColor = texColor;\n\tgl_FragColor.a *= opacity;\n\t#include <tonemapping_fragment>\n\t#include <encodings_fragment>\n}";
9890
9908
 
9891
9909
  const vertex$e = "#include <common>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <uv_vertex>\n\t#include <skinbase_vertex>\n\t#ifdef USE_DISPLACEMENTMAP\n\t\t#include <beginnormal_vertex>\n\t\t#include <morphnormal_vertex>\n\t\t#include <skinnormal_vertex>\n\t#endif\n\t#include <begin_vertex>\n\t#include <morphtarget_vertex>\n\t#include <skinning_vertex>\n\t#include <displacementmap_vertex>\n\t#include <project_vertex>\n\t#include <logdepthbuf_vertex>\n\t#include <clipping_planes_vertex>\n\tvHighPrecisionZW = gl_Position.zw;\n}";
9892
9910
  const fragment$e = "#if DEPTH_PACKING == 3200\n\tuniform float opacity;\n#endif\n#include <common>\n#include <packing>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\nvarying vec2 vHighPrecisionZW;\nvoid main() {\n\t#include <clipping_planes_fragment>\n\tvec4 diffuseColor = vec4( 1.0 );\n\t#if DEPTH_PACKING == 3200\n\t\tdiffuseColor.a = opacity;\n\t#endif\n\t#include <map_fragment>\n\t#include <alphamap_fragment>\n\t#include <alphatest_fragment>\n\t#include <logdepthbuf_fragment>\n\tfloat fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;\n\t#if DEPTH_PACKING == 3200\n\t\tgl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );\n\t#elif DEPTH_PACKING == 3201\n\t\tgl_FragColor = packDepthToRGBA( fragCoordZ );\n\t#endif\n}";
@@ -10037,8 +10055,10 @@
10037
10055
  uv2_pars_vertex: uv2_pars_vertex,
10038
10056
  uv2_vertex: uv2_vertex,
10039
10057
  worldpos_vertex: worldpos_vertex,
10040
- background_vert: vertex$g,
10041
- background_frag: fragment$g,
10058
+ background_vert: vertex$h,
10059
+ background_frag: fragment$h,
10060
+ backgroundCube_vert: vertex$g,
10061
+ backgroundCube_frag: fragment$g,
10042
10062
  cube_vert: vertex$f,
10043
10063
  cube_frag: fragment$f,
10044
10064
  depth_vert: vertex$e,
@@ -10478,17 +10498,44 @@
10478
10498
  },
10479
10499
  t2D: {
10480
10500
  value: null
10501
+ },
10502
+ backgroundIntensity: {
10503
+ value: 1
10481
10504
  }
10482
10505
  },
10483
10506
  vertexShader: ShaderChunk.background_vert,
10484
10507
  fragmentShader: ShaderChunk.background_frag
10485
10508
  },
10509
+ backgroundCube: {
10510
+ uniforms: {
10511
+ envMap: {
10512
+ value: null
10513
+ },
10514
+ flipEnvMap: {
10515
+ value: -1
10516
+ },
10517
+ backgroundBlurriness: {
10518
+ value: 0
10519
+ },
10520
+ backgroundIntensity: {
10521
+ value: 1
10522
+ }
10523
+ },
10524
+ vertexShader: ShaderChunk.backgroundCube_vert,
10525
+ fragmentShader: ShaderChunk.backgroundCube_frag
10526
+ },
10486
10527
  cube: {
10487
- uniforms: /*@__PURE__*/mergeUniforms([UniformsLib.envmap, {
10528
+ uniforms: {
10529
+ tCube: {
10530
+ value: null
10531
+ },
10532
+ tFlip: {
10533
+ value: -1
10534
+ },
10488
10535
  opacity: {
10489
10536
  value: 1.0
10490
10537
  }
10491
- }]),
10538
+ },
10492
10539
  vertexShader: ShaderChunk.cube_vert,
10493
10540
  fragmentShader: ShaderChunk.cube_frag
10494
10541
  },
@@ -10623,7 +10670,13 @@
10623
10670
  fragmentShader: ShaderChunk.meshphysical_frag
10624
10671
  };
10625
10672
 
10626
- function WebGLBackground(renderer, cubemaps, state, objects, alpha, premultipliedAlpha) {
10673
+ const _rgb = {
10674
+ r: 0,
10675
+ b: 0,
10676
+ g: 0
10677
+ };
10678
+
10679
+ function WebGLBackground(renderer, cubemaps, cubeuvmaps, state, objects, alpha, premultipliedAlpha) {
10627
10680
  const clearColor = new Color(0x000000);
10628
10681
  let clearAlpha = alpha === true ? 0 : 1;
10629
10682
  let planeMesh;
@@ -10637,7 +10690,9 @@
10637
10690
  let background = scene.isScene === true ? scene.background : null;
10638
10691
 
10639
10692
  if (background && background.isTexture) {
10640
- background = cubemaps.get(background);
10693
+ const usePMREM = scene.backgroundBlurriness > 0; // use PMREM if the user wants to blur the background
10694
+
10695
+ background = (usePMREM ? cubeuvmaps : cubemaps).get(background);
10641
10696
  } // Ignore background in AR
10642
10697
  // TODO: Reconsider this.
10643
10698
 
@@ -10664,9 +10719,9 @@
10664
10719
  if (boxMesh === undefined) {
10665
10720
  boxMesh = new Mesh(new BoxGeometry(1, 1, 1), new ShaderMaterial({
10666
10721
  name: 'BackgroundCubeMaterial',
10667
- uniforms: cloneUniforms(ShaderLib.cube.uniforms),
10668
- vertexShader: ShaderLib.cube.vertexShader,
10669
- fragmentShader: ShaderLib.cube.fragmentShader,
10722
+ uniforms: cloneUniforms(ShaderLib.backgroundCube.uniforms),
10723
+ vertexShader: ShaderLib.backgroundCube.vertexShader,
10724
+ fragmentShader: ShaderLib.backgroundCube.fragmentShader,
10670
10725
  side: BackSide,
10671
10726
  depthTest: false,
10672
10727
  depthWrite: false,
@@ -10690,6 +10745,8 @@
10690
10745
 
10691
10746
  boxMesh.material.uniforms.envMap.value = background;
10692
10747
  boxMesh.material.uniforms.flipEnvMap.value = background.isCubeTexture && background.isRenderTargetTexture === false ? -1 : 1;
10748
+ boxMesh.material.uniforms.backgroundBlurriness.value = scene.backgroundBlurriness;
10749
+ boxMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
10693
10750
 
10694
10751
  if (currentBackground !== background || currentBackgroundVersion !== background.version || currentTonemapping !== renderer.toneMapping) {
10695
10752
  boxMesh.material.needsUpdate = true;
@@ -10724,6 +10781,7 @@
10724
10781
  }
10725
10782
 
10726
10783
  planeMesh.material.uniforms.t2D.value = background;
10784
+ planeMesh.material.uniforms.backgroundIntensity.value = scene.backgroundIntensity;
10727
10785
 
10728
10786
  if (background.matrixAutoUpdate === true) {
10729
10787
  background.updateMatrix();
@@ -10745,7 +10803,8 @@
10745
10803
  }
10746
10804
 
10747
10805
  function setClear(color, alpha) {
10748
- state.buffers.color.setClear(color.r, color.g, color.b, alpha, premultipliedAlpha);
10806
+ color.getRGB(_rgb, getUnlitUniformColorSpace(renderer));
10807
+ state.buffers.color.setClear(_rgb.r, _rgb.g, _rgb.b, alpha, premultipliedAlpha);
10749
10808
  }
10750
10809
 
10751
10810
  return {
@@ -13170,28 +13229,58 @@
13170
13229
  if (cache[0] === v) return;
13171
13230
  gl.uniform1i(this.addr, v);
13172
13231
  cache[0] = v;
13173
- } // Single integer / boolean vector (from flat array)
13232
+ } // Single integer / boolean vector (from flat array or THREE.VectorN)
13174
13233
 
13175
13234
 
13176
13235
  function setValueV2i(gl, v) {
13177
13236
  const cache = this.cache;
13178
- if (arraysEqual(cache, v)) return;
13179
- gl.uniform2iv(this.addr, v);
13180
- copyArray(cache, v);
13237
+
13238
+ if (v.x !== undefined) {
13239
+ if (cache[0] !== v.x || cache[1] !== v.y) {
13240
+ gl.uniform2i(this.addr, v.x, v.y);
13241
+ cache[0] = v.x;
13242
+ cache[1] = v.y;
13243
+ }
13244
+ } else {
13245
+ if (arraysEqual(cache, v)) return;
13246
+ gl.uniform2iv(this.addr, v);
13247
+ copyArray(cache, v);
13248
+ }
13181
13249
  }
13182
13250
 
13183
13251
  function setValueV3i(gl, v) {
13184
13252
  const cache = this.cache;
13185
- if (arraysEqual(cache, v)) return;
13186
- gl.uniform3iv(this.addr, v);
13187
- copyArray(cache, v);
13253
+
13254
+ if (v.x !== undefined) {
13255
+ if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {
13256
+ gl.uniform3i(this.addr, v.x, v.y, v.z);
13257
+ cache[0] = v.x;
13258
+ cache[1] = v.y;
13259
+ cache[2] = v.z;
13260
+ }
13261
+ } else {
13262
+ if (arraysEqual(cache, v)) return;
13263
+ gl.uniform3iv(this.addr, v);
13264
+ copyArray(cache, v);
13265
+ }
13188
13266
  }
13189
13267
 
13190
13268
  function setValueV4i(gl, v) {
13191
13269
  const cache = this.cache;
13192
- if (arraysEqual(cache, v)) return;
13193
- gl.uniform4iv(this.addr, v);
13194
- copyArray(cache, v);
13270
+
13271
+ if (v.x !== undefined) {
13272
+ if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {
13273
+ gl.uniform4i(this.addr, v.x, v.y, v.z, v.w);
13274
+ cache[0] = v.x;
13275
+ cache[1] = v.y;
13276
+ cache[2] = v.z;
13277
+ cache[3] = v.w;
13278
+ }
13279
+ } else {
13280
+ if (arraysEqual(cache, v)) return;
13281
+ gl.uniform4iv(this.addr, v);
13282
+ copyArray(cache, v);
13283
+ }
13195
13284
  } // Single unsigned integer
13196
13285
 
13197
13286
 
@@ -13200,28 +13289,58 @@
13200
13289
  if (cache[0] === v) return;
13201
13290
  gl.uniform1ui(this.addr, v);
13202
13291
  cache[0] = v;
13203
- } // Single unsigned integer vector (from flat array)
13292
+ } // Single unsigned integer vector (from flat array or THREE.VectorN)
13204
13293
 
13205
13294
 
13206
13295
  function setValueV2ui(gl, v) {
13207
13296
  const cache = this.cache;
13208
- if (arraysEqual(cache, v)) return;
13209
- gl.uniform2uiv(this.addr, v);
13210
- copyArray(cache, v);
13297
+
13298
+ if (v.x !== undefined) {
13299
+ if (cache[0] !== v.x || cache[1] !== v.y) {
13300
+ gl.uniform2ui(this.addr, v.x, v.y);
13301
+ cache[0] = v.x;
13302
+ cache[1] = v.y;
13303
+ }
13304
+ } else {
13305
+ if (arraysEqual(cache, v)) return;
13306
+ gl.uniform2uiv(this.addr, v);
13307
+ copyArray(cache, v);
13308
+ }
13211
13309
  }
13212
13310
 
13213
13311
  function setValueV3ui(gl, v) {
13214
13312
  const cache = this.cache;
13215
- if (arraysEqual(cache, v)) return;
13216
- gl.uniform3uiv(this.addr, v);
13217
- copyArray(cache, v);
13313
+
13314
+ if (v.x !== undefined) {
13315
+ if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z) {
13316
+ gl.uniform3ui(this.addr, v.x, v.y, v.z);
13317
+ cache[0] = v.x;
13318
+ cache[1] = v.y;
13319
+ cache[2] = v.z;
13320
+ }
13321
+ } else {
13322
+ if (arraysEqual(cache, v)) return;
13323
+ gl.uniform3uiv(this.addr, v);
13324
+ copyArray(cache, v);
13325
+ }
13218
13326
  }
13219
13327
 
13220
13328
  function setValueV4ui(gl, v) {
13221
13329
  const cache = this.cache;
13222
- if (arraysEqual(cache, v)) return;
13223
- gl.uniform4uiv(this.addr, v);
13224
- copyArray(cache, v);
13330
+
13331
+ if (v.x !== undefined) {
13332
+ if (cache[0] !== v.x || cache[1] !== v.y || cache[2] !== v.z || cache[3] !== v.w) {
13333
+ gl.uniform4ui(this.addr, v.x, v.y, v.z, v.w);
13334
+ cache[0] = v.x;
13335
+ cache[1] = v.y;
13336
+ cache[2] = v.z;
13337
+ cache[3] = v.w;
13338
+ }
13339
+ } else {
13340
+ if (arraysEqual(cache, v)) return;
13341
+ gl.uniform4uiv(this.addr, v);
13342
+ copyArray(cache, v);
13343
+ }
13225
13344
  } // Single texture (2D / Cube)
13226
13345
 
13227
13346
 
@@ -13457,9 +13576,14 @@
13457
13576
 
13458
13577
 
13459
13578
  function setValueT1Array(gl, v, textures) {
13579
+ const cache = this.cache;
13460
13580
  const n = v.length;
13461
13581
  const units = allocTexUnits(textures, n);
13462
- gl.uniform1iv(this.addr, units);
13582
+
13583
+ if (!arraysEqual(cache, units)) {
13584
+ gl.uniform1iv(this.addr, units);
13585
+ copyArray(cache, units);
13586
+ }
13463
13587
 
13464
13588
  for (let i = 0; i !== n; ++i) {
13465
13589
  textures.setTexture2D(v[i] || emptyTexture, units[i]);
@@ -13467,9 +13591,14 @@
13467
13591
  }
13468
13592
 
13469
13593
  function setValueT3DArray(gl, v, textures) {
13594
+ const cache = this.cache;
13470
13595
  const n = v.length;
13471
13596
  const units = allocTexUnits(textures, n);
13472
- gl.uniform1iv(this.addr, units);
13597
+
13598
+ if (!arraysEqual(cache, units)) {
13599
+ gl.uniform1iv(this.addr, units);
13600
+ copyArray(cache, units);
13601
+ }
13473
13602
 
13474
13603
  for (let i = 0; i !== n; ++i) {
13475
13604
  textures.setTexture3D(v[i] || empty3dTexture, units[i]);
@@ -13477,9 +13606,14 @@
13477
13606
  }
13478
13607
 
13479
13608
  function setValueT6Array(gl, v, textures) {
13609
+ const cache = this.cache;
13480
13610
  const n = v.length;
13481
13611
  const units = allocTexUnits(textures, n);
13482
- gl.uniform1iv(this.addr, units);
13612
+
13613
+ if (!arraysEqual(cache, units)) {
13614
+ gl.uniform1iv(this.addr, units);
13615
+ copyArray(cache, units);
13616
+ }
13483
13617
 
13484
13618
  for (let i = 0; i !== n; ++i) {
13485
13619
  textures.setTextureCube(v[i] || emptyCubeTexture, units[i]);
@@ -13487,9 +13621,14 @@
13487
13621
  }
13488
13622
 
13489
13623
  function setValueT2DArrayArray(gl, v, textures) {
13624
+ const cache = this.cache;
13490
13625
  const n = v.length;
13491
13626
  const units = allocTexUnits(textures, n);
13492
- gl.uniform1iv(this.addr, units);
13627
+
13628
+ if (!arraysEqual(cache, units)) {
13629
+ gl.uniform1iv(this.addr, units);
13630
+ copyArray(cache, units);
13631
+ }
13493
13632
 
13494
13633
  for (let i = 0; i !== n; ++i) {
13495
13634
  textures.setTexture2DArray(v[i] || emptyArrayTexture, units[i]);
@@ -15070,10 +15209,7 @@
15070
15209
 
15071
15210
  spotLength++;
15072
15211
  } else if (light.isRectAreaLight) {
15073
- const uniforms = cache.get(light); // (a) intensity is the total visible light emitted
15074
- //uniforms.color.copy( color ).multiplyScalar( intensity / ( light.width * light.height * Math.PI ) );
15075
- // (b) intensity is the brightness of the light
15076
-
15212
+ const uniforms = cache.get(light);
15077
15213
  uniforms.color.copy(color).multiplyScalar(intensity);
15078
15214
  uniforms.halfWidth.set(light.width * 0.5, 0.0, 0.0);
15079
15215
  uniforms.halfHeight.set(0.0, light.height * 0.5, 0.0);
@@ -15555,7 +15691,7 @@
15555
15691
  result = light.isPointLight === true ? _distanceMaterial : _depthMaterial;
15556
15692
  }
15557
15693
 
15558
- if (_renderer.localClippingEnabled && material.clipShadows === true && Array.isArray(material.clippingPlanes) && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0) {
15694
+ if (_renderer.localClippingEnabled && material.clipShadows === true && Array.isArray(material.clippingPlanes) && material.clippingPlanes.length !== 0 || material.displacementMap && material.displacementScale !== 0 || material.alphaMap && material.alphaTest > 0 || material.map && material.alphaTest > 0) {
15559
15695
  // in this case we need a unique material instance reflecting the
15560
15696
  // appropriate state
15561
15697
  const keyA = result.uuid,
@@ -15588,6 +15724,7 @@
15588
15724
 
15589
15725
  result.alphaMap = material.alphaMap;
15590
15726
  result.alphaTest = material.alphaTest;
15727
+ result.map = material.map;
15591
15728
  result.clipShadows = material.clipShadows;
15592
15729
  result.clippingPlanes = material.clippingPlanes;
15593
15730
  result.clipIntersection = material.clipIntersection;
@@ -15708,45 +15845,41 @@
15708
15845
  },
15709
15846
  setFunc: function (depthFunc) {
15710
15847
  if (currentDepthFunc !== depthFunc) {
15711
- if (depthFunc) {
15712
- switch (depthFunc) {
15713
- case NeverDepth:
15714
- gl.depthFunc(gl.NEVER);
15715
- break;
15848
+ switch (depthFunc) {
15849
+ case NeverDepth:
15850
+ gl.depthFunc(gl.NEVER);
15851
+ break;
15716
15852
 
15717
- case AlwaysDepth:
15718
- gl.depthFunc(gl.ALWAYS);
15719
- break;
15853
+ case AlwaysDepth:
15854
+ gl.depthFunc(gl.ALWAYS);
15855
+ break;
15720
15856
 
15721
- case LessDepth:
15722
- gl.depthFunc(gl.LESS);
15723
- break;
15857
+ case LessDepth:
15858
+ gl.depthFunc(gl.LESS);
15859
+ break;
15724
15860
 
15725
- case LessEqualDepth:
15726
- gl.depthFunc(gl.LEQUAL);
15727
- break;
15861
+ case LessEqualDepth:
15862
+ gl.depthFunc(gl.LEQUAL);
15863
+ break;
15728
15864
 
15729
- case EqualDepth:
15730
- gl.depthFunc(gl.EQUAL);
15731
- break;
15865
+ case EqualDepth:
15866
+ gl.depthFunc(gl.EQUAL);
15867
+ break;
15732
15868
 
15733
- case GreaterEqualDepth:
15734
- gl.depthFunc(gl.GEQUAL);
15735
- break;
15869
+ case GreaterEqualDepth:
15870
+ gl.depthFunc(gl.GEQUAL);
15871
+ break;
15736
15872
 
15737
- case GreaterDepth:
15738
- gl.depthFunc(gl.GREATER);
15739
- break;
15873
+ case GreaterDepth:
15874
+ gl.depthFunc(gl.GREATER);
15875
+ break;
15740
15876
 
15741
- case NotEqualDepth:
15742
- gl.depthFunc(gl.NOTEQUAL);
15743
- break;
15877
+ case NotEqualDepth:
15878
+ gl.depthFunc(gl.NOTEQUAL);
15879
+ break;
15744
15880
 
15745
- default:
15746
- gl.depthFunc(gl.LEQUAL);
15747
- }
15748
- } else {
15749
- gl.depthFunc(gl.LEQUAL);
15881
+ default:
15882
+ gl.depthFunc(gl.LEQUAL);
15750
15883
  }
15751
15884
 
15752
15885
  currentDepthFunc = depthFunc;
@@ -16132,7 +16265,7 @@
16132
16265
  }
16133
16266
 
16134
16267
  currentBlending = blending;
16135
- currentPremultipledAlpha = null;
16268
+ currentPremultipledAlpha = false;
16136
16269
  }
16137
16270
 
16138
16271
  function setMaterial(material, frontFaceCW) {
@@ -16230,22 +16363,31 @@
16230
16363
  }
16231
16364
  }
16232
16365
 
16233
- function bindTexture(webglType, webglTexture) {
16234
- if (currentTextureSlot === null) {
16235
- activeTexture();
16366
+ function bindTexture(webglType, webglTexture, webglSlot) {
16367
+ if (webglSlot === undefined) {
16368
+ if (currentTextureSlot === null) {
16369
+ webglSlot = gl.TEXTURE0 + maxTextures - 1;
16370
+ } else {
16371
+ webglSlot = currentTextureSlot;
16372
+ }
16236
16373
  }
16237
16374
 
16238
- let boundTexture = currentBoundTextures[currentTextureSlot];
16375
+ let boundTexture = currentBoundTextures[webglSlot];
16239
16376
 
16240
16377
  if (boundTexture === undefined) {
16241
16378
  boundTexture = {
16242
16379
  type: undefined,
16243
16380
  texture: undefined
16244
16381
  };
16245
- currentBoundTextures[currentTextureSlot] = boundTexture;
16382
+ currentBoundTextures[webglSlot] = boundTexture;
16246
16383
  }
16247
16384
 
16248
16385
  if (boundTexture.type !== webglType || boundTexture.texture !== webglTexture) {
16386
+ if (currentTextureSlot !== webglSlot) {
16387
+ gl.activeTexture(webglSlot);
16388
+ currentTextureSlot = webglSlot;
16389
+ }
16390
+
16249
16391
  gl.bindTexture(webglType, webglTexture || emptyTextures[webglType]);
16250
16392
  boundTexture.type = webglType;
16251
16393
  boundTexture.texture = webglTexture;
@@ -16270,6 +16412,14 @@
16270
16412
  }
16271
16413
  }
16272
16414
 
16415
+ function compressedTexImage3D() {
16416
+ try {
16417
+ gl.compressedTexImage3D.apply(gl, arguments);
16418
+ } catch (error) {
16419
+ console.error('THREE.WebGLState:', error);
16420
+ }
16421
+ }
16422
+
16273
16423
  function texSubImage2D() {
16274
16424
  try {
16275
16425
  gl.texSubImage2D.apply(gl, arguments);
@@ -16294,6 +16444,14 @@
16294
16444
  }
16295
16445
  }
16296
16446
 
16447
+ function compressedTexSubImage3D() {
16448
+ try {
16449
+ gl.compressedTexSubImage3D.apply(gl, arguments);
16450
+ } catch (error) {
16451
+ console.error('THREE.WebGLState:', error);
16452
+ }
16453
+ }
16454
+
16297
16455
  function texStorage2D() {
16298
16456
  try {
16299
16457
  gl.texStorage2D.apply(gl, arguments);
@@ -16456,6 +16614,7 @@
16456
16614
  bindTexture: bindTexture,
16457
16615
  unbindTexture: unbindTexture,
16458
16616
  compressedTexImage2D: compressedTexImage2D,
16617
+ compressedTexImage3D: compressedTexImage3D,
16459
16618
  texImage2D: texImage2D,
16460
16619
  texImage3D: texImage3D,
16461
16620
  updateUBOMapping: updateUBOMapping,
@@ -16465,6 +16624,7 @@
16465
16624
  texSubImage2D: texSubImage2D,
16466
16625
  texSubImage3D: texSubImage3D,
16467
16626
  compressedTexSubImage2D: compressedTexSubImage2D,
16627
+ compressedTexSubImage3D: compressedTexSubImage3D,
16468
16628
  scissor: scissor,
16469
16629
  viewport: viewport,
16470
16630
  reset: reset
@@ -16478,7 +16638,7 @@
16478
16638
  const maxTextureSize = capabilities.maxTextureSize;
16479
16639
  const maxSamples = capabilities.maxSamples;
16480
16640
  const multisampledRTTExt = extensions.has('WEBGL_multisampled_render_to_texture') ? extensions.get('WEBGL_multisampled_render_to_texture') : null;
16481
- const supportsInvalidateFramebuffer = /OculusBrowser/g.test(navigator.userAgent);
16641
+ const supportsInvalidateFramebuffer = typeof navigator === 'undefined' ? false : /OculusBrowser/g.test(navigator.userAgent);
16482
16642
 
16483
16643
  const _videoTextures = new WeakMap();
16484
16644
 
@@ -16556,7 +16716,7 @@
16556
16716
  _gl.generateMipmap(target);
16557
16717
  }
16558
16718
 
16559
- function getInternalFormat(internalFormatName, glFormat, glType, encoding, isVideoTexture = false) {
16719
+ function getInternalFormat(internalFormatName, glFormat, glType, encoding, forceLinearEncoding = false) {
16560
16720
  if (isWebGL2 === false) return glFormat;
16561
16721
 
16562
16722
  if (internalFormatName !== null) {
@@ -16581,7 +16741,7 @@
16581
16741
  if (glFormat === _gl.RGBA) {
16582
16742
  if (glType === _gl.FLOAT) internalFormat = _gl.RGBA32F;
16583
16743
  if (glType === _gl.HALF_FLOAT) internalFormat = _gl.RGBA16F;
16584
- if (glType === _gl.UNSIGNED_BYTE) internalFormat = encoding === sRGBEncoding && isVideoTexture === false ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
16744
+ if (glType === _gl.UNSIGNED_BYTE) internalFormat = encoding === sRGBEncoding && forceLinearEncoding === false ? _gl.SRGB8_ALPHA8 : _gl.RGBA8;
16585
16745
  if (glType === _gl.UNSIGNED_SHORT_4_4_4_4) internalFormat = _gl.RGBA4;
16586
16746
  if (glType === _gl.UNSIGNED_SHORT_5_5_5_1) internalFormat = _gl.RGB5_A1;
16587
16747
  }
@@ -16748,6 +16908,7 @@
16748
16908
  const array = [];
16749
16909
  array.push(texture.wrapS);
16750
16910
  array.push(texture.wrapT);
16911
+ array.push(texture.wrapR || 0);
16751
16912
  array.push(texture.magFilter);
16752
16913
  array.push(texture.minFilter);
16753
16914
  array.push(texture.anisotropy);
@@ -16780,8 +16941,7 @@
16780
16941
  }
16781
16942
  }
16782
16943
 
16783
- state.activeTexture(_gl.TEXTURE0 + slot);
16784
- state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture);
16944
+ state.bindTexture(_gl.TEXTURE_2D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
16785
16945
  }
16786
16946
 
16787
16947
  function setTexture2DArray(texture, slot) {
@@ -16792,8 +16952,7 @@
16792
16952
  return;
16793
16953
  }
16794
16954
 
16795
- state.activeTexture(_gl.TEXTURE0 + slot);
16796
- state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture);
16955
+ state.bindTexture(_gl.TEXTURE_2D_ARRAY, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
16797
16956
  }
16798
16957
 
16799
16958
  function setTexture3D(texture, slot) {
@@ -16804,8 +16963,7 @@
16804
16963
  return;
16805
16964
  }
16806
16965
 
16807
- state.activeTexture(_gl.TEXTURE0 + slot);
16808
- state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture);
16966
+ state.bindTexture(_gl.TEXTURE_3D, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
16809
16967
  }
16810
16968
 
16811
16969
  function setTextureCube(texture, slot) {
@@ -16816,8 +16974,7 @@
16816
16974
  return;
16817
16975
  }
16818
16976
 
16819
- state.activeTexture(_gl.TEXTURE0 + slot);
16820
- state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);
16977
+ state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
16821
16978
  }
16822
16979
 
16823
16980
  const wrappingToGL = {
@@ -16942,14 +17099,16 @@
16942
17099
 
16943
17100
  function uploadTexture(textureProperties, texture, slot) {
16944
17101
  let textureType = _gl.TEXTURE_2D;
16945
- if (texture.isDataArrayTexture) textureType = _gl.TEXTURE_2D_ARRAY;
17102
+ if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) textureType = _gl.TEXTURE_2D_ARRAY;
16946
17103
  if (texture.isData3DTexture) textureType = _gl.TEXTURE_3D;
16947
17104
  const forceUpload = initTexture(textureProperties, texture);
16948
17105
  const source = texture.source;
16949
- state.activeTexture(_gl.TEXTURE0 + slot);
16950
- state.bindTexture(textureType, textureProperties.__webglTexture);
17106
+ state.bindTexture(textureType, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
17107
+ const sourceProperties = properties.get(source);
17108
+
17109
+ if (source.version !== sourceProperties.__version || forceUpload === true) {
17110
+ state.activeTexture(_gl.TEXTURE0 + slot);
16951
17111
 
16952
- if (source.version !== source.__currentVersion || forceUpload === true) {
16953
17112
  _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
16954
17113
 
16955
17114
  _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
@@ -16969,7 +17128,7 @@
16969
17128
  let mipmap;
16970
17129
  const mipmaps = texture.mipmaps;
16971
17130
  const useTexStorage = isWebGL2 && texture.isVideoTexture !== true;
16972
- const allocateMemory = source.__currentVersion === undefined || forceUpload === true;
17131
+ const allocateMemory = sourceProperties.__version === undefined || forceUpload === true;
16973
17132
  const levels = getMipLevels(texture, image, supportsMips);
16974
17133
 
16975
17134
  if (texture.isDepthTexture) {
@@ -17058,28 +17217,56 @@
17058
17217
  }
17059
17218
  }
17060
17219
  } else if (texture.isCompressedTexture) {
17061
- if (useTexStorage && allocateMemory) {
17062
- state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);
17063
- }
17220
+ if (texture.isCompressedArrayTexture) {
17221
+ if (useTexStorage && allocateMemory) {
17222
+ state.texStorage3D(_gl.TEXTURE_2D_ARRAY, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height, image.depth);
17223
+ }
17064
17224
 
17065
- for (let i = 0, il = mipmaps.length; i < il; i++) {
17066
- mipmap = mipmaps[i];
17225
+ for (let i = 0, il = mipmaps.length; i < il; i++) {
17226
+ mipmap = mipmaps[i];
17067
17227
 
17068
- if (texture.format !== RGBAFormat) {
17069
- if (glFormat !== null) {
17070
- if (useTexStorage) {
17071
- state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);
17228
+ if (texture.format !== RGBAFormat) {
17229
+ if (glFormat !== null) {
17230
+ if (useTexStorage) {
17231
+ state.compressedTexSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, mipmap.data, 0, 0);
17232
+ } else {
17233
+ state.compressedTexImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, mipmap.data, 0, 0);
17234
+ }
17072
17235
  } else {
17073
- state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
17236
+ console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
17074
17237
  }
17075
17238
  } else {
17076
- console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
17239
+ if (useTexStorage) {
17240
+ state.texSubImage3D(_gl.TEXTURE_2D_ARRAY, i, 0, 0, 0, mipmap.width, mipmap.height, image.depth, glFormat, glType, mipmap.data);
17241
+ } else {
17242
+ state.texImage3D(_gl.TEXTURE_2D_ARRAY, i, glInternalFormat, mipmap.width, mipmap.height, image.depth, 0, glFormat, glType, mipmap.data);
17243
+ }
17077
17244
  }
17078
- } else {
17079
- if (useTexStorage) {
17080
- state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);
17245
+ }
17246
+ } else {
17247
+ if (useTexStorage && allocateMemory) {
17248
+ state.texStorage2D(_gl.TEXTURE_2D, levels, glInternalFormat, mipmaps[0].width, mipmaps[0].height);
17249
+ }
17250
+
17251
+ for (let i = 0, il = mipmaps.length; i < il; i++) {
17252
+ mipmap = mipmaps[i];
17253
+
17254
+ if (texture.format !== RGBAFormat) {
17255
+ if (glFormat !== null) {
17256
+ if (useTexStorage) {
17257
+ state.compressedTexSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, mipmap.data);
17258
+ } else {
17259
+ state.compressedTexImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, mipmap.data);
17260
+ }
17261
+ } else {
17262
+ console.warn('THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()');
17263
+ }
17081
17264
  } else {
17082
- state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
17265
+ if (useTexStorage) {
17266
+ state.texSubImage2D(_gl.TEXTURE_2D, i, 0, 0, mipmap.width, mipmap.height, glFormat, glType, mipmap.data);
17267
+ } else {
17268
+ state.texImage2D(_gl.TEXTURE_2D, i, glInternalFormat, mipmap.width, mipmap.height, 0, glFormat, glType, mipmap.data);
17269
+ }
17083
17270
  }
17084
17271
  }
17085
17272
  }
@@ -17156,7 +17343,7 @@
17156
17343
  generateMipmap(textureType);
17157
17344
  }
17158
17345
 
17159
- source.__currentVersion = source.version;
17346
+ sourceProperties.__version = source.version;
17160
17347
  if (texture.onUpdate) texture.onUpdate(texture);
17161
17348
  }
17162
17349
 
@@ -17167,10 +17354,12 @@
17167
17354
  if (texture.image.length !== 6) return;
17168
17355
  const forceUpload = initTexture(textureProperties, texture);
17169
17356
  const source = texture.source;
17170
- state.activeTexture(_gl.TEXTURE0 + slot);
17171
- state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture);
17357
+ state.bindTexture(_gl.TEXTURE_CUBE_MAP, textureProperties.__webglTexture, _gl.TEXTURE0 + slot);
17358
+ const sourceProperties = properties.get(source);
17359
+
17360
+ if (source.version !== sourceProperties.__version || forceUpload === true) {
17361
+ state.activeTexture(_gl.TEXTURE0 + slot);
17172
17362
 
17173
- if (source.version !== source.__currentVersion || forceUpload === true) {
17174
17363
  _gl.pixelStorei(_gl.UNPACK_FLIP_Y_WEBGL, texture.flipY);
17175
17364
 
17176
17365
  _gl.pixelStorei(_gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, texture.premultiplyAlpha);
@@ -17199,7 +17388,7 @@
17199
17388
  glType = utils.convert(texture.type),
17200
17389
  glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding);
17201
17390
  const useTexStorage = isWebGL2 && texture.isVideoTexture !== true;
17202
- const allocateMemory = source.__currentVersion === undefined || forceUpload === true;
17391
+ const allocateMemory = sourceProperties.__version === undefined || forceUpload === true;
17203
17392
  let levels = getMipLevels(texture, image, supportsMips);
17204
17393
  setTextureParameters(_gl.TEXTURE_CUBE_MAP, texture, supportsMips);
17205
17394
  let mipmaps;
@@ -17288,7 +17477,7 @@
17288
17477
  generateMipmap(_gl.TEXTURE_CUBE_MAP);
17289
17478
  }
17290
17479
 
17291
- source.__currentVersion = source.version;
17480
+ sourceProperties.__version = source.version;
17292
17481
  if (texture.onUpdate) texture.onUpdate(texture);
17293
17482
  }
17294
17483
 
@@ -17315,7 +17504,8 @@
17315
17504
 
17316
17505
  if (useMultisampledRTT(renderTarget)) {
17317
17506
  multisampledRTTExt.framebufferTexture2DMultisampleEXT(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, 0, getRenderTargetSamples(renderTarget));
17318
- } else {
17507
+ } else if (textureTarget === _gl.TEXTURE_2D || textureTarget >= _gl.TEXTURE_CUBE_MAP_POSITIVE_X && textureTarget <= _gl.TEXTURE_CUBE_MAP_NEGATIVE_Z) {
17508
+ // see #24753
17319
17509
  _gl.framebufferTexture2D(_gl.FRAMEBUFFER, attachment, textureTarget, properties.get(texture).__webglTexture, 0);
17320
17510
  }
17321
17511
 
@@ -17527,7 +17717,7 @@
17527
17717
 
17528
17718
  const glFormat = utils.convert(texture.format, texture.encoding);
17529
17719
  const glType = utils.convert(texture.type);
17530
- const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding);
17720
+ const glInternalFormat = getInternalFormat(texture.internalFormat, glFormat, glType, texture.encoding, renderTarget.isXRRenderTarget === true);
17531
17721
  const samples = getRenderTargetSamples(renderTarget);
17532
17722
 
17533
17723
  _gl.renderbufferStorageMultisample(_gl.RENDERBUFFER, samples, glInternalFormat, renderTarget.width, renderTarget.height);
@@ -17807,8 +17997,7 @@
17807
17997
  if (p === LuminanceFormat) return gl.LUMINANCE;
17808
17998
  if (p === LuminanceAlphaFormat) return gl.LUMINANCE_ALPHA;
17809
17999
  if (p === DepthFormat) return gl.DEPTH_COMPONENT;
17810
- if (p === DepthStencilFormat) return gl.DEPTH_STENCIL;
17811
- if (p === RedFormat) return gl.RED; // @deprecated since r137
18000
+ if (p === DepthStencilFormat) return gl.DEPTH_STENCIL; // @deprecated since r137
17812
18001
 
17813
18002
  if (p === RGBFormat) {
17814
18003
  console.warn('THREE.WebGLRenderer: THREE.RGBFormat has been removed. Use THREE.RGBAFormat instead. https://github.com/mrdoob/three.js/pull/23228');
@@ -17827,6 +18016,7 @@
17827
18016
  } // WebGL2 formats.
17828
18017
 
17829
18018
 
18019
+ if (p === RedFormat) return gl.RED;
17830
18020
  if (p === RedIntegerFormat) return gl.RED_INTEGER;
17831
18021
  if (p === RGFormat) return gl.RG;
17832
18022
  if (p === RGIntegerFormat) return gl.RG_INTEGER;
@@ -18419,6 +18609,25 @@
18419
18609
  return this;
18420
18610
  }
18421
18611
 
18612
+ connect(inputSource) {
18613
+ if (inputSource && inputSource.hand) {
18614
+ const hand = this._hand;
18615
+
18616
+ if (hand) {
18617
+ for (const inputjoint of inputSource.hand.values()) {
18618
+ // Initialize hand with joints when connected
18619
+ this._getHandJoint(hand, inputjoint);
18620
+ }
18621
+ }
18622
+ }
18623
+
18624
+ this.dispatchEvent({
18625
+ type: 'connected',
18626
+ data: inputSource
18627
+ });
18628
+ return this;
18629
+ }
18630
+
18422
18631
  disconnect(inputSource) {
18423
18632
  this.dispatchEvent({
18424
18633
  type: 'disconnected',
@@ -18454,19 +18663,9 @@
18454
18663
 
18455
18664
  for (const inputjoint of inputSource.hand.values()) {
18456
18665
  // Update the joints groups with the XRJoint poses
18457
- const jointPose = frame.getJointPose(inputjoint, referenceSpace);
18666
+ const jointPose = frame.getJointPose(inputjoint, referenceSpace); // The transform of this joint will be updated with the joint pose on each frame
18458
18667
 
18459
- if (hand.joints[inputjoint.jointName] === undefined) {
18460
- // The transform of this joint will be updated with the joint pose on each frame
18461
- const joint = new Group();
18462
- joint.matrixAutoUpdate = false;
18463
- joint.visible = false;
18464
- hand.joints[inputjoint.jointName] = joint; // ??
18465
-
18466
- hand.add(joint);
18467
- }
18468
-
18469
- const joint = hand.joints[inputjoint.jointName];
18668
+ const joint = this._getHandJoint(hand, inputjoint);
18470
18669
 
18471
18670
  if (jointPose !== null) {
18472
18671
  joint.matrix.fromArray(jointPose.transform.matrix);
@@ -18568,6 +18767,19 @@
18568
18767
  }
18569
18768
 
18570
18769
  return this;
18770
+ } // private method
18771
+
18772
+
18773
+ _getHandJoint(hand, inputjoint) {
18774
+ if (hand.joints[inputjoint.jointName] === undefined) {
18775
+ const joint = new Group();
18776
+ joint.matrixAutoUpdate = false;
18777
+ joint.visible = false;
18778
+ hand.joints[inputjoint.jointName] = joint;
18779
+ hand.add(joint);
18780
+ }
18781
+
18782
+ return hand.joints[inputjoint.jointName];
18571
18783
  }
18572
18784
 
18573
18785
  }
@@ -18616,7 +18828,9 @@
18616
18828
  let initialRenderTarget = null;
18617
18829
  let newRenderTarget = null;
18618
18830
  const controllers = [];
18619
- const controllerInputSources = []; //
18831
+ const controllerInputSources = [];
18832
+ const planes = new Set();
18833
+ const planesLastChangedTimes = new Map(); //
18620
18834
 
18621
18835
  const cameraL = new PerspectiveCamera();
18622
18836
  cameraL.layers.enable(1);
@@ -18885,10 +19099,7 @@
18885
19099
 
18886
19100
  if (index >= 0) {
18887
19101
  controllerInputSources[index] = null;
18888
- controllers[index].dispatchEvent({
18889
- type: 'disconnected',
18890
- data: inputSource
18891
- });
19102
+ controllers[index].disconnect(inputSource);
18892
19103
  }
18893
19104
  } // Notify connected
18894
19105
 
@@ -18918,10 +19129,7 @@
18918
19129
  const controller = controllers[controllerIndex];
18919
19130
 
18920
19131
  if (controller) {
18921
- controller.dispatchEvent({
18922
- type: 'connected',
18923
- data: inputSource
18924
- });
19132
+ controller.connect(inputSource);
18925
19133
  }
18926
19134
  }
18927
19135
  } //
@@ -19059,6 +19267,10 @@
19059
19267
  if (glBaseLayer !== null && glBaseLayer.fixedFoveation !== undefined) {
19060
19268
  glBaseLayer.fixedFoveation = foveation;
19061
19269
  }
19270
+ };
19271
+
19272
+ this.getPlanes = function () {
19273
+ return planes;
19062
19274
  }; // Animation Loop
19063
19275
 
19064
19276
 
@@ -19133,6 +19345,57 @@
19133
19345
  }
19134
19346
 
19135
19347
  if (onAnimationFrameCallback) onAnimationFrameCallback(time, frame);
19348
+
19349
+ if (frame.detectedPlanes) {
19350
+ scope.dispatchEvent({
19351
+ type: 'planesdetected',
19352
+ data: frame.detectedPlanes
19353
+ });
19354
+ let planesToRemove = null;
19355
+
19356
+ for (const plane of planes) {
19357
+ if (!frame.detectedPlanes.has(plane)) {
19358
+ if (planesToRemove === null) {
19359
+ planesToRemove = [];
19360
+ }
19361
+
19362
+ planesToRemove.push(plane);
19363
+ }
19364
+ }
19365
+
19366
+ if (planesToRemove !== null) {
19367
+ for (const plane of planesToRemove) {
19368
+ planes.delete(plane);
19369
+ planesLastChangedTimes.delete(plane);
19370
+ scope.dispatchEvent({
19371
+ type: 'planeremoved',
19372
+ data: plane
19373
+ });
19374
+ }
19375
+ }
19376
+
19377
+ for (const plane of frame.detectedPlanes) {
19378
+ if (!planes.has(plane)) {
19379
+ planes.add(plane);
19380
+ planesLastChangedTimes.set(plane, frame.lastChangedTime);
19381
+ scope.dispatchEvent({
19382
+ type: 'planeadded',
19383
+ data: plane
19384
+ });
19385
+ } else {
19386
+ const lastKnownTime = planesLastChangedTimes.get(plane);
19387
+
19388
+ if (plane.lastChangedTime > lastKnownTime) {
19389
+ planesLastChangedTimes.set(plane, plane.lastChangedTime);
19390
+ scope.dispatchEvent({
19391
+ type: 'planechanged',
19392
+ data: plane
19393
+ });
19394
+ }
19395
+ }
19396
+ }
19397
+ }
19398
+
19136
19399
  xrFrame = null;
19137
19400
  }
19138
19401
 
@@ -19150,7 +19413,7 @@
19150
19413
 
19151
19414
  function WebGLMaterials(renderer, properties) {
19152
19415
  function refreshFogUniforms(uniforms, fog) {
19153
- uniforms.fogColor.value.copy(fog.color);
19416
+ fog.color.getRGB(uniforms.fogColor.value, getUnlitUniformColorSpace(renderer));
19154
19417
 
19155
19418
  if (fog.isFog) {
19156
19419
  uniforms.fogNear.value = fog.near;
@@ -19899,20 +20162,7 @@
19899
20162
  this.physicallyCorrectLights = false; // tone mapping
19900
20163
 
19901
20164
  this.toneMapping = NoToneMapping;
19902
- this.toneMappingExposure = 1.0; //
19903
-
19904
- Object.defineProperties(this, {
19905
- // @deprecated since r136, 0e21088102b4de7e0a0a33140620b7a3424b9e6d
19906
- gammaFactor: {
19907
- get: function () {
19908
- console.warn('THREE.WebGLRenderer: .gammaFactor has been removed.');
19909
- return 2;
19910
- },
19911
- set: function () {
19912
- console.warn('THREE.WebGLRenderer: .gammaFactor has been removed.');
19913
- }
19914
- }
19915
- }); // internal properties
20165
+ this.toneMappingExposure = 1.0; // internal properties
19916
20166
 
19917
20167
  const _this = this;
19918
20168
 
@@ -20065,7 +20315,7 @@
20065
20315
  materials = new WebGLMaterials(_this, properties);
20066
20316
  renderLists = new WebGLRenderLists();
20067
20317
  renderStates = new WebGLRenderStates(extensions, capabilities);
20068
- background = new WebGLBackground(_this, cubemaps, state, objects, _alpha, _premultipliedAlpha);
20318
+ background = new WebGLBackground(_this, cubemaps, cubeuvmaps, state, objects, _alpha, _premultipliedAlpha);
20069
20319
  shadowMap = new WebGLShadowMap(_this, objects, capabilities);
20070
20320
  uniformsGroups = new WebGLUniformsGroups(_gl, info, capabilities, state);
20071
20321
  bufferRenderer = new WebGLBufferRenderer(_gl, extensions, info, capabilities);
@@ -20328,22 +20578,35 @@
20328
20578
  state.setMaterial(material, frontFaceCW); //
20329
20579
 
20330
20580
  let index = geometry.index;
20331
- const position = geometry.attributes.position; //
20332
-
20333
- if (index === null) {
20334
- if (position === undefined || position.count === 0) return;
20335
- } else if (index.count === 0) {
20336
- return;
20337
- } //
20338
-
20339
-
20340
20581
  let rangeFactor = 1;
20341
20582
 
20342
20583
  if (material.wireframe === true) {
20343
20584
  index = geometries.getWireframeAttribute(geometry);
20344
20585
  rangeFactor = 2;
20586
+ } //
20587
+
20588
+
20589
+ const drawRange = geometry.drawRange;
20590
+ const position = geometry.attributes.position;
20591
+ let drawStart = drawRange.start * rangeFactor;
20592
+ let drawEnd = (drawRange.start + drawRange.count) * rangeFactor;
20593
+
20594
+ if (group !== null) {
20595
+ drawStart = Math.max(drawStart, group.start * rangeFactor);
20596
+ drawEnd = Math.min(drawEnd, (group.start + group.count) * rangeFactor);
20345
20597
  }
20346
20598
 
20599
+ if (index !== null) {
20600
+ drawStart = Math.max(drawStart, 0);
20601
+ drawEnd = Math.min(drawEnd, index.count);
20602
+ } else if (position !== undefined && position !== null) {
20603
+ drawStart = Math.max(drawStart, 0);
20604
+ drawEnd = Math.min(drawEnd, position.count);
20605
+ }
20606
+
20607
+ const drawCount = drawEnd - drawStart;
20608
+ if (drawCount < 0 || drawCount === Infinity) return; //
20609
+
20347
20610
  bindingStates.setup(object, material, program, geometry, index);
20348
20611
  let attribute;
20349
20612
  let renderer = bufferRenderer;
@@ -20355,16 +20618,6 @@
20355
20618
  } //
20356
20619
 
20357
20620
 
20358
- const dataCount = index !== null ? index.count : position.count;
20359
- const rangeStart = geometry.drawRange.start * rangeFactor;
20360
- const rangeCount = geometry.drawRange.count * rangeFactor;
20361
- const groupStart = group !== null ? group.start * rangeFactor : 0;
20362
- const groupCount = group !== null ? group.count * rangeFactor : Infinity;
20363
- const drawStart = Math.max(rangeStart, groupStart);
20364
- const drawEnd = Math.min(dataCount, rangeStart + rangeCount, groupStart + groupCount) - 1;
20365
- const drawCount = Math.max(0, drawEnd - drawStart + 1);
20366
- if (drawCount === 0) return; //
20367
-
20368
20621
  if (object.isMesh) {
20369
20622
  if (material.wireframe === true) {
20370
20623
  state.setLineWidth(material.wireframeLinewidth * getTargetPixelRatio());
@@ -20394,7 +20647,8 @@
20394
20647
  if (object.isInstancedMesh) {
20395
20648
  renderer.renderInstances(drawStart, drawCount, object.count);
20396
20649
  } else if (geometry.isInstancedBufferGeometry) {
20397
- const instanceCount = Math.min(geometry.instanceCount, geometry._maxInstanceCount);
20650
+ const maxInstanceCount = geometry._maxInstanceCount !== undefined ? geometry._maxInstanceCount : Infinity;
20651
+ const instanceCount = Math.min(geometry.instanceCount, maxInstanceCount);
20398
20652
  renderer.renderInstances(drawStart, drawCount, instanceCount);
20399
20653
  } else {
20400
20654
  renderer.render(drawStart, drawCount);
@@ -21136,6 +21390,9 @@
21136
21390
  _currentActiveCubeFace = activeCubeFace;
21137
21391
  _currentActiveMipmapLevel = activeMipmapLevel;
21138
21392
  let useDefaultFramebuffer = true;
21393
+ let framebuffer = null;
21394
+ let isCube = false;
21395
+ let isRenderTarget3D = false;
21139
21396
 
21140
21397
  if (renderTarget) {
21141
21398
  const renderTargetProperties = properties.get(renderTarget);
@@ -21150,16 +21407,10 @@
21150
21407
  // Color and depth texture must be rebound in order for the swapchain to update.
21151
21408
  textures.rebindTextures(renderTarget, properties.get(renderTarget.texture).__webglTexture, properties.get(renderTarget.depthTexture).__webglTexture);
21152
21409
  }
21153
- }
21154
21410
 
21155
- let framebuffer = null;
21156
- let isCube = false;
21157
- let isRenderTarget3D = false;
21158
-
21159
- if (renderTarget) {
21160
21411
  const texture = renderTarget.texture;
21161
21412
 
21162
- if (texture.isData3DTexture || texture.isDataArrayTexture) {
21413
+ if (texture.isData3DTexture || texture.isDataArrayTexture || texture.isCompressedArrayTexture) {
21163
21414
  isRenderTarget3D = true;
21164
21415
  }
21165
21416
 
@@ -21352,7 +21603,7 @@
21352
21603
  if (srcTexture.isDataTexture || srcTexture.isData3DTexture) {
21353
21604
  _gl.texSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, glType, image.data);
21354
21605
  } else {
21355
- if (srcTexture.isCompressedTexture) {
21606
+ if (srcTexture.isCompressedArrayTexture) {
21356
21607
  console.warn('THREE.WebGLRenderer.copyTextureToTexture3D: untested support for compressed srcTexture.');
21357
21608
 
21358
21609
  _gl.compressedTexSubImage3D(glTarget, level, position.x, position.y, position.z, width, height, depth, glFormat, image.data);
@@ -21381,7 +21632,7 @@
21381
21632
  textures.setTextureCube(texture, 0);
21382
21633
  } else if (texture.isData3DTexture) {
21383
21634
  textures.setTexture3D(texture, 0);
21384
- } else if (texture.isDataArrayTexture) {
21635
+ } else if (texture.isDataArrayTexture || texture.isCompressedArrayTexture) {
21385
21636
  textures.setTexture2DArray(texture, 0);
21386
21637
  } else {
21387
21638
  textures.setTexture2D(texture, 0);
@@ -21463,6 +21714,8 @@
21463
21714
  this.background = null;
21464
21715
  this.environment = null;
21465
21716
  this.fog = null;
21717
+ this.backgroundBlurriness = 0;
21718
+ this.backgroundIntensity = 1;
21466
21719
  this.overrideMaterial = null;
21467
21720
 
21468
21721
  if (typeof __THREE_DEVTOOLS__ !== 'undefined') {
@@ -21477,6 +21730,8 @@
21477
21730
  if (source.background !== null) this.background = source.background.clone();
21478
21731
  if (source.environment !== null) this.environment = source.environment.clone();
21479
21732
  if (source.fog !== null) this.fog = source.fog.clone();
21733
+ this.backgroundBlurriness = source.backgroundBlurriness;
21734
+ this.backgroundIntensity = source.backgroundIntensity;
21480
21735
  if (source.overrideMaterial !== null) this.overrideMaterial = source.overrideMaterial.clone();
21481
21736
  this.matrixAutoUpdate = source.matrixAutoUpdate;
21482
21737
  return this;
@@ -21485,6 +21740,8 @@
21485
21740
  toJSON(meta) {
21486
21741
  const data = super.toJSON(meta);
21487
21742
  if (this.fog !== null) data.object.fog = this.fog.toJSON();
21743
+ if (this.backgroundBlurriness > 0) data.backgroundBlurriness = this.backgroundBlurriness;
21744
+ if (this.backgroundIntensity !== 1) data.backgroundIntensity = this.backgroundIntensity;
21488
21745
  return data;
21489
21746
  } // @deprecated
21490
21747
 
@@ -21755,7 +22012,7 @@
21755
22012
 
21756
22013
  clone(data) {
21757
22014
  if (data === undefined) {
21758
- console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will deinterleave buffer data.');
22015
+ console.log('THREE.InterleavedBufferAttribute.clone(): Cloning an interleaved buffer attribute will de-interleave buffer data.');
21759
22016
  const array = [];
21760
22017
 
21761
22018
  for (let i = 0; i < this.count; i++) {
@@ -21782,7 +22039,7 @@
21782
22039
 
21783
22040
  toJSON(data) {
21784
22041
  if (data === undefined) {
21785
- console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will deinterleave buffer data.');
22042
+ console.log('THREE.InterleavedBufferAttribute.toJSON(): Serializing an interleaved buffer attribute will de-interleave buffer data.');
21786
22043
  const array = [];
21787
22044
 
21788
22045
  for (let i = 0; i < this.count; i++) {
@@ -21791,7 +22048,7 @@
21791
22048
  for (let j = 0; j < this.itemSize; j++) {
21792
22049
  array.push(this.data.array[index + j]);
21793
22050
  }
21794
- } // deinterleave data and save it as an ordinary buffer attribute for now
22051
+ } // de-interleave data and save it as an ordinary buffer attribute for now
21795
22052
 
21796
22053
 
21797
22054
  return {
@@ -21801,7 +22058,7 @@
21801
22058
  normalized: this.normalized
21802
22059
  };
21803
22060
  } else {
21804
- // save as true interleaved attribtue
22061
+ // save as true interleaved attribute
21805
22062
  if (data.interleavedBuffers === undefined) {
21806
22063
  data.interleavedBuffers = {};
21807
22064
  }
@@ -22017,14 +22274,14 @@
22017
22274
 
22018
22275
  for (let i = 0, l = levels.length; i < l; i++) {
22019
22276
  const level = levels[i];
22020
- this.addLevel(level.object.clone(), level.distance);
22277
+ this.addLevel(level.object.clone(), level.distance, level.hysteresis);
22021
22278
  }
22022
22279
 
22023
22280
  this.autoUpdate = source.autoUpdate;
22024
22281
  return this;
22025
22282
  }
22026
22283
 
22027
- addLevel(object, distance = 0) {
22284
+ addLevel(object, distance = 0, hysteresis = 0) {
22028
22285
  distance = Math.abs(distance);
22029
22286
  const levels = this.levels;
22030
22287
  let l;
@@ -22037,6 +22294,7 @@
22037
22294
 
22038
22295
  levels.splice(l, 0, {
22039
22296
  distance: distance,
22297
+ hysteresis: hysteresis,
22040
22298
  object: object
22041
22299
  });
22042
22300
  this.add(object);
@@ -22054,7 +22312,13 @@
22054
22312
  let i, l;
22055
22313
 
22056
22314
  for (i = 1, l = levels.length; i < l; i++) {
22057
- if (distance < levels[i].distance) {
22315
+ let levelDistance = levels[i].distance;
22316
+
22317
+ if (levels[i].object.visible) {
22318
+ levelDistance -= levelDistance * levels[i].hysteresis;
22319
+ }
22320
+
22321
+ if (distance < levelDistance) {
22058
22322
  break;
22059
22323
  }
22060
22324
  }
@@ -22089,7 +22353,13 @@
22089
22353
  let i, l;
22090
22354
 
22091
22355
  for (i = 1, l = levels.length; i < l; i++) {
22092
- if (distance >= levels[i].distance) {
22356
+ let levelDistance = levels[i].distance;
22357
+
22358
+ if (levels[i].object.visible) {
22359
+ levelDistance -= levelDistance * levels[i].hysteresis;
22360
+ }
22361
+
22362
+ if (distance >= levelDistance) {
22093
22363
  levels[i - 1].object.visible = false;
22094
22364
  levels[i].object.visible = true;
22095
22365
  } else {
@@ -22115,7 +22385,8 @@
22115
22385
  const level = levels[i];
22116
22386
  data.object.levels.push({
22117
22387
  object: level.object.uuid,
22118
- distance: level.distance
22388
+ distance: level.distance,
22389
+ hysteresis: level.hysteresis
22119
22390
  });
22120
22391
  }
22121
22392
 
@@ -22471,6 +22742,8 @@
22471
22742
 
22472
22743
  const _instanceIntersects = [];
22473
22744
 
22745
+ const _identity = /*@__PURE__*/new Matrix4();
22746
+
22474
22747
  const _mesh = /*@__PURE__*/new Mesh();
22475
22748
 
22476
22749
  class InstancedMesh extends Mesh {
@@ -22481,6 +22754,10 @@
22481
22754
  this.instanceColor = null;
22482
22755
  this.count = count;
22483
22756
  this.frustumCulled = false;
22757
+
22758
+ for (let i = 0; i < count; i++) {
22759
+ this.setMatrixAt(i, _identity);
22760
+ }
22484
22761
  }
22485
22762
 
22486
22763
  copy(source, recursive) {
@@ -22997,6 +23274,16 @@
22997
23274
 
22998
23275
  }
22999
23276
 
23277
+ class CompressedArrayTexture extends CompressedTexture {
23278
+ constructor(mipmaps, width, height, depth, format, type) {
23279
+ super(mipmaps, width, height, format, type);
23280
+ this.isCompressedArrayTexture = true;
23281
+ this.image.depth = depth;
23282
+ this.wrapR = ClampToEdgeWrapping;
23283
+ }
23284
+
23285
+ }
23286
+
23000
23287
  class CanvasTexture extends Texture {
23001
23288
  constructor(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy) {
23002
23289
  super(canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy);
@@ -24716,7 +25003,7 @@
24716
25003
  function subdivide(detail) {
24717
25004
  const a = new Vector3();
24718
25005
  const b = new Vector3();
24719
- const c = new Vector3(); // iterate over all faces and apply a subdivison with the given detail value
25006
+ const c = new Vector3(); // iterate over all faces and apply a subdivision with the given detail value
24720
25007
 
24721
25008
  for (let i = 0; i < indices.length; i += 3) {
24722
25009
  // get the vertices of the face
@@ -25082,7 +25369,7 @@
25082
25369
  }
25083
25370
 
25084
25371
  /**
25085
- * Port from https://github.com/mapbox/earcut (v2.2.2)
25372
+ * Port from https://github.com/mapbox/earcut (v2.2.4)
25086
25373
  */
25087
25374
  const Earcut = {
25088
25375
  triangulate: function (data, holeIndices, dim = 2) {
@@ -25109,10 +25396,10 @@
25109
25396
 
25110
25397
 
25111
25398
  invSize = Math.max(maxX - minX, maxY - minY);
25112
- invSize = invSize !== 0 ? 1 / invSize : 0;
25399
+ invSize = invSize !== 0 ? 32767 / invSize : 0;
25113
25400
  }
25114
25401
 
25115
- earcutLinked(outerNode, triangles, dim, minX, minY, invSize);
25402
+ earcutLinked(outerNode, triangles, dim, minX, minY, invSize, 0);
25116
25403
  return triangles;
25117
25404
  }
25118
25405
  }; // create a circular doubly linked list from polygon points in the specified winding order
@@ -25172,9 +25459,9 @@
25172
25459
 
25173
25460
  if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) {
25174
25461
  // cut off the triangle
25175
- triangles.push(prev.i / dim);
25176
- triangles.push(ear.i / dim);
25177
- triangles.push(next.i / dim);
25462
+ triangles.push(prev.i / dim | 0);
25463
+ triangles.push(ear.i / dim | 0);
25464
+ triangles.push(next.i / dim | 0);
25178
25465
  removeNode(ear); // skipping the next vertex leads to less sliver triangles
25179
25466
 
25180
25467
  ear = next.next;
@@ -25208,10 +25495,21 @@
25208
25495
  if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
25209
25496
  // now make sure we don't have other points inside the potential ear
25210
25497
 
25211
- let p = ear.next.next;
25212
-
25213
- while (p !== ear.prev) {
25214
- if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
25498
+ const ax = a.x,
25499
+ bx = b.x,
25500
+ cx = c.x,
25501
+ ay = a.y,
25502
+ by = b.y,
25503
+ cy = c.y; // triangle bbox; min & max are calculated like this for speed
25504
+
25505
+ const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx,
25506
+ y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy,
25507
+ x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx,
25508
+ y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy;
25509
+ let p = c.next;
25510
+
25511
+ while (p !== a) {
25512
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
25215
25513
  p = p.next;
25216
25514
  }
25217
25515
 
@@ -25223,34 +25521,40 @@
25223
25521
  b = ear,
25224
25522
  c = ear.next;
25225
25523
  if (area(a, b, c) >= 0) return false; // reflex, can't be an ear
25226
- // triangle bbox; min & max are calculated like this for speed
25227
25524
 
25228
- const minTX = a.x < b.x ? a.x < c.x ? a.x : c.x : b.x < c.x ? b.x : c.x,
25229
- minTY = a.y < b.y ? a.y < c.y ? a.y : c.y : b.y < c.y ? b.y : c.y,
25230
- maxTX = a.x > b.x ? a.x > c.x ? a.x : c.x : b.x > c.x ? b.x : c.x,
25231
- maxTY = a.y > b.y ? a.y > c.y ? a.y : c.y : b.y > c.y ? b.y : c.y; // z-order range for the current triangle bbox;
25525
+ const ax = a.x,
25526
+ bx = b.x,
25527
+ cx = c.x,
25528
+ ay = a.y,
25529
+ by = b.y,
25530
+ cy = c.y; // triangle bbox; min & max are calculated like this for speed
25531
+
25532
+ const x0 = ax < bx ? ax < cx ? ax : cx : bx < cx ? bx : cx,
25533
+ y0 = ay < by ? ay < cy ? ay : cy : by < cy ? by : cy,
25534
+ x1 = ax > bx ? ax > cx ? ax : cx : bx > cx ? bx : cx,
25535
+ y1 = ay > by ? ay > cy ? ay : cy : by > cy ? by : cy; // z-order range for the current triangle bbox;
25232
25536
 
25233
- const minZ = zOrder(minTX, minTY, minX, minY, invSize),
25234
- maxZ = zOrder(maxTX, maxTY, minX, minY, invSize);
25537
+ const minZ = zOrder(x0, y0, minX, minY, invSize),
25538
+ maxZ = zOrder(x1, y1, minX, minY, invSize);
25235
25539
  let p = ear.prevZ,
25236
25540
  n = ear.nextZ; // look for points inside the triangle in both directions
25237
25541
 
25238
25542
  while (p && p.z >= minZ && n && n.z <= maxZ) {
25239
- if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
25543
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
25240
25544
  p = p.prevZ;
25241
- if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
25545
+ if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
25242
25546
  n = n.nextZ;
25243
25547
  } // look for remaining points in decreasing z-order
25244
25548
 
25245
25549
 
25246
25550
  while (p && p.z >= minZ) {
25247
- if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
25551
+ if (p.x >= x0 && p.x <= x1 && p.y >= y0 && p.y <= y1 && p !== a && p !== c && pointInTriangle(ax, ay, bx, by, cx, cy, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false;
25248
25552
  p = p.prevZ;
25249
25553
  } // look for remaining points in increasing z-order
25250
25554
 
25251
25555
 
25252
25556
  while (n && n.z <= maxZ) {
25253
- if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
25557
+ if (n.x >= x0 && n.x <= x1 && n.y >= y0 && n.y <= y1 && n !== a && n !== c && pointInTriangle(ax, ay, bx, by, cx, cy, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false;
25254
25558
  n = n.nextZ;
25255
25559
  }
25256
25560
 
@@ -25266,9 +25570,9 @@
25266
25570
  b = p.next.next;
25267
25571
 
25268
25572
  if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) {
25269
- triangles.push(a.i / dim);
25270
- triangles.push(p.i / dim);
25271
- triangles.push(b.i / dim); // remove two nodes involved
25573
+ triangles.push(a.i / dim | 0);
25574
+ triangles.push(p.i / dim | 0);
25575
+ triangles.push(b.i / dim | 0); // remove two nodes involved
25272
25576
 
25273
25577
  removeNode(p);
25274
25578
  removeNode(p.next);
@@ -25297,8 +25601,8 @@
25297
25601
  a = filterPoints(a, a.next);
25298
25602
  c = filterPoints(c, c.next); // run earcut on each half
25299
25603
 
25300
- earcutLinked(a, triangles, dim, minX, minY, invSize);
25301
- earcutLinked(c, triangles, dim, minX, minY, invSize);
25604
+ earcutLinked(a, triangles, dim, minX, minY, invSize, 0);
25605
+ earcutLinked(c, triangles, dim, minX, minY, invSize, 0);
25302
25606
  return;
25303
25607
  }
25304
25608
 
@@ -25325,8 +25629,7 @@
25325
25629
  queue.sort(compareX); // process holes from left to right
25326
25630
 
25327
25631
  for (i = 0; i < queue.length; i++) {
25328
- eliminateHole(queue[i], outerNode);
25329
- outerNode = filterPoints(outerNode, outerNode.next);
25632
+ outerNode = eliminateHole(queue[i], outerNode);
25330
25633
  }
25331
25634
 
25332
25635
  return outerNode;
@@ -25338,23 +25641,25 @@
25338
25641
 
25339
25642
 
25340
25643
  function eliminateHole(hole, outerNode) {
25341
- outerNode = findHoleBridge(hole, outerNode);
25644
+ const bridge = findHoleBridge(hole, outerNode);
25342
25645
 
25343
- if (outerNode) {
25344
- const b = splitPolygon(outerNode, hole); // filter collinear points around the cuts
25345
-
25346
- filterPoints(outerNode, outerNode.next);
25347
- filterPoints(b, b.next);
25646
+ if (!bridge) {
25647
+ return outerNode;
25348
25648
  }
25649
+
25650
+ const bridgeReverse = splitPolygon(bridge, hole); // filter collinear points around the cuts
25651
+
25652
+ filterPoints(bridgeReverse, bridgeReverse.next);
25653
+ return filterPoints(bridge, bridge.next);
25349
25654
  } // David Eberly's algorithm for finding a bridge between hole and outer polygon
25350
25655
 
25351
25656
 
25352
25657
  function findHoleBridge(hole, outerNode) {
25353
- let p = outerNode;
25354
- const hx = hole.x;
25355
- const hy = hole.y;
25356
- let qx = -Infinity,
25357
- m; // find a segment intersected by a ray from the hole's leftmost point to the left;
25658
+ let p = outerNode,
25659
+ qx = -Infinity,
25660
+ m;
25661
+ const hx = hole.x,
25662
+ hy = hole.y; // find a segment intersected by a ray from the hole's leftmost point to the left;
25358
25663
  // segment's endpoint with lesser x will be potential connection point
25359
25664
 
25360
25665
  do {
@@ -25363,22 +25668,15 @@
25363
25668
 
25364
25669
  if (x <= hx && x > qx) {
25365
25670
  qx = x;
25366
-
25367
- if (x === hx) {
25368
- if (hy === p.y) return p;
25369
- if (hy === p.next.y) return p.next;
25370
- }
25371
-
25372
25671
  m = p.x < p.next.x ? p : p.next;
25672
+ if (x === hx) return m; // hole touches outer segment; pick leftmost endpoint
25373
25673
  }
25374
25674
  }
25375
25675
 
25376
25676
  p = p.next;
25377
25677
  } while (p !== outerNode);
25378
25678
 
25379
- if (!m) return null;
25380
- if (hx === qx) return m; // hole touches outer segment; pick leftmost endpoint
25381
- // look for points inside the triangle of hole point, segment intersection and endpoint;
25679
+ if (!m) return null; // look for points inside the triangle of hole point, segment intersection and endpoint;
25382
25680
  // if there are no points found, we have a valid connection;
25383
25681
  // otherwise choose the point of the minimum angle with the ray as connection point
25384
25682
 
@@ -25415,7 +25713,7 @@
25415
25713
  let p = start;
25416
25714
 
25417
25715
  do {
25418
- if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize);
25716
+ if (p.z === 0) p.z = zOrder(p.x, p.y, minX, minY, invSize);
25419
25717
  p.prevZ = p.prev;
25420
25718
  p.nextZ = p.next;
25421
25719
  p = p.next;
@@ -25487,8 +25785,8 @@
25487
25785
 
25488
25786
  function zOrder(x, y, minX, minY, invSize) {
25489
25787
  // coords are transformed into non-negative 15-bit integer range
25490
- x = 32767 * (x - minX) * invSize;
25491
- y = 32767 * (y - minY) * invSize;
25788
+ x = (x - minX) * invSize | 0;
25789
+ y = (y - minY) * invSize | 0;
25492
25790
  x = (x | x << 8) & 0x00FF00FF;
25493
25791
  x = (x | x << 4) & 0x0F0F0F0F;
25494
25792
  x = (x | x << 2) & 0x33333333;
@@ -25515,12 +25813,12 @@
25515
25813
 
25516
25814
 
25517
25815
  function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
25518
- return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0;
25816
+ return (cx - px) * (ay - py) >= (ax - px) * (cy - py) && (ax - px) * (by - py) >= (bx - px) * (ay - py) && (bx - px) * (cy - py) >= (cx - px) * (by - py);
25519
25817
  } // check if a diagonal between two polygon nodes is valid (lies in polygon interior)
25520
25818
 
25521
25819
 
25522
25820
  function isValidDiagonal(a, b) {
25523
- return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && ( // doesn't intersect other edges
25821
+ return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && ( // dones't intersect other edges
25524
25822
  locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b) && ( // locally visible
25525
25823
  area(a.prev, a, b.prev) || area(a, b.prev, b)) || // does not create opposite-facing sectors
25526
25824
  equals(a, b) && area(a.prev, a, a.next) > 0 && area(b.prev, b, b.next) > 0); // special zero-length case
@@ -25648,7 +25946,7 @@
25648
25946
  this.prev = null;
25649
25947
  this.next = null; // z-order curve value
25650
25948
 
25651
- this.z = null; // previous and next nodes in z-order
25949
+ this.z = 0; // previous and next nodes in z-order
25652
25950
 
25653
25951
  this.prevZ = null;
25654
25952
  this.nextZ = null; // indicates whether this is a steiner point
@@ -26426,7 +26724,7 @@
26426
26724
  vertices.push(vertex.x, vertex.y, 0);
26427
26725
  normals.push(0, 0, 1);
26428
26726
  uvs.push(vertex.x, vertex.y); // world uvs
26429
- } // incides
26727
+ } // indices
26430
26728
 
26431
26729
 
26432
26730
  for (let i = 0, l = faces.length; i < l; i++) {
@@ -27121,7 +27419,7 @@
27121
27419
  this.transmissionMap = null;
27122
27420
  this.thickness = 0;
27123
27421
  this.thicknessMap = null;
27124
- this.attenuationDistance = 0.0;
27422
+ this.attenuationDistance = Infinity;
27125
27423
  this.attenuationColor = new Color(1, 1, 1);
27126
27424
  this.specularIntensity = 1.0;
27127
27425
  this.specularIntensityMap = null;
@@ -29063,8 +29361,10 @@
29063
29361
  }
29064
29362
 
29065
29363
  const callbacks = loading[url];
29066
- const reader = response.body.getReader();
29067
- const contentLength = response.headers.get('Content-Length');
29364
+ const reader = response.body.getReader(); // Nginx needs X-File-Size check
29365
+ // https://serverfault.com/questions/482875/why-does-nginx-remove-content-length-header-for-chunked-content
29366
+
29367
+ const contentLength = response.headers.get('Content-Length') || response.headers.get('X-File-Size');
29068
29368
  const total = contentLength ? parseInt(contentLength) : 0;
29069
29369
  const lengthComputable = total !== 0;
29070
29370
  let loaded = 0; // periodically read data into the new stream tracking while download progress
@@ -29599,8 +29899,7 @@
29599
29899
  this._frustum.setFromProjectionMatrix(_projScreenMatrix$1);
29600
29900
 
29601
29901
  shadowMatrix.set(0.5, 0.0, 0.0, 0.5, 0.0, 0.5, 0.0, 0.5, 0.0, 0.0, 0.5, 0.5, 0.0, 0.0, 0.0, 1.0);
29602
- shadowMatrix.multiply(shadowCamera.projectionMatrix);
29603
- shadowMatrix.multiply(shadowCamera.matrixWorldInverse);
29902
+ shadowMatrix.multiply(_projScreenMatrix$1);
29604
29903
  }
29605
29904
 
29606
29905
  getViewport(viewportIndex) {
@@ -29678,7 +29977,7 @@
29678
29977
  }
29679
29978
 
29680
29979
  class SpotLight extends Light {
29681
- constructor(color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 1) {
29980
+ constructor(color, intensity, distance = 0, angle = Math.PI / 3, penumbra = 0, decay = 2) {
29682
29981
  super(color, intensity);
29683
29982
  this.isSpotLight = true;
29684
29983
  this.type = 'SpotLight';
@@ -29688,8 +29987,7 @@
29688
29987
  this.distance = distance;
29689
29988
  this.angle = angle;
29690
29989
  this.penumbra = penumbra;
29691
- this.decay = decay; // for physically correct lights, should be 2.
29692
-
29990
+ this.decay = decay;
29693
29991
  this.map = null;
29694
29992
  this.shadow = new SpotLightShadow();
29695
29993
  }
@@ -29788,13 +30086,12 @@
29788
30086
  }
29789
30087
 
29790
30088
  class PointLight extends Light {
29791
- constructor(color, intensity, distance = 0, decay = 1) {
30089
+ constructor(color, intensity, distance = 0, decay = 2) {
29792
30090
  super(color, intensity);
29793
30091
  this.isPointLight = true;
29794
30092
  this.type = 'PointLight';
29795
30093
  this.distance = distance;
29796
- this.decay = decay; // for physically correct lights, should be 2.
29797
-
30094
+ this.decay = decay;
29798
30095
  this.shadow = new PointLightShadow();
29799
30096
  }
29800
30097
 
@@ -30417,12 +30714,8 @@
30417
30714
  return this;
30418
30715
  }
30419
30716
 
30420
- clone() {
30421
- return new this.constructor().copy(this);
30422
- }
30423
-
30424
30717
  toJSON() {
30425
- const data = super.toJSON(this);
30718
+ const data = super.toJSON();
30426
30719
  data.instanceCount = this.instanceCount;
30427
30720
  data.isInstancedBufferGeometry = true;
30428
30721
  return data;
@@ -30603,6 +30896,7 @@
30603
30896
  const metadata = json.metadata;
30604
30897
 
30605
30898
  if (metadata === undefined || metadata.type === undefined || metadata.type.toLowerCase() === 'geometry') {
30899
+ if (onError !== undefined) onError(new Error('THREE.ObjectLoader: Can\'t load ' + url));
30606
30900
  console.error('THREE.ObjectLoader: Can\'t load ' + url);
30607
30901
  return;
30608
30902
  }
@@ -31058,6 +31352,7 @@
31058
31352
  }
31059
31353
  }
31060
31354
 
31355
+ if (data.backgroundBlurriness !== undefined) object.backgroundBlurriness = data.backgroundBlurriness;
31061
31356
  break;
31062
31357
 
31063
31358
  case 'PerspectiveCamera':
@@ -31223,7 +31518,7 @@
31223
31518
  const child = object.getObjectByProperty('uuid', level.object);
31224
31519
 
31225
31520
  if (child !== undefined) {
31226
- object.addLevel(child, level.distance);
31521
+ object.addLevel(child, level.distance, level.hysteresis);
31227
31522
  }
31228
31523
  }
31229
31524
  }
@@ -31334,18 +31629,20 @@
31334
31629
 
31335
31630
  let _context;
31336
31631
 
31337
- const AudioContext = {
31338
- getContext: function () {
31632
+ class AudioContext {
31633
+ static getContext() {
31339
31634
  if (_context === undefined) {
31340
31635
  _context = new (window.AudioContext || window.webkitAudioContext)();
31341
31636
  }
31342
31637
 
31343
31638
  return _context;
31344
- },
31345
- setContext: function (value) {
31639
+ }
31640
+
31641
+ static setContext(value) {
31346
31642
  _context = value;
31347
31643
  }
31348
- };
31644
+
31645
+ }
31349
31646
 
31350
31647
  class AudioLoader extends Loader {
31351
31648
  constructor(manager) {
@@ -32589,6 +32886,11 @@
32589
32886
  break;
32590
32887
 
32591
32888
  case 'map':
32889
+ if ('map' in targetObject) {
32890
+ targetObject = targetObject.map;
32891
+ break;
32892
+ }
32893
+
32592
32894
  if (!targetObject.material) {
32593
32895
  console.error('THREE.PropertyBinding: Can not bind to material as node does not have a material.', this);
32594
32896
  return;
@@ -34577,10 +34879,10 @@
34577
34879
  constructor(light, color) {
34578
34880
  super();
34579
34881
  this.light = light;
34580
- this.light.updateMatrixWorld();
34581
34882
  this.matrix = light.matrixWorld;
34582
34883
  this.matrixAutoUpdate = false;
34583
34884
  this.color = color;
34885
+ this.type = 'SpotLightHelper';
34584
34886
  const geometry = new BufferGeometry();
34585
34887
  const positions = [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, -1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, -1, 1];
34586
34888
 
@@ -34606,7 +34908,8 @@
34606
34908
  }
34607
34909
 
34608
34910
  update() {
34609
- this.light.updateMatrixWorld();
34911
+ this.light.updateWorldMatrix(true, false);
34912
+ this.light.target.updateWorldMatrix(true, false);
34610
34913
  const coneLength = this.light.distance ? this.light.distance : 1000;
34611
34914
  const coneWidth = coneLength * Math.tan(this.light.angle);
34612
34915
  this.cone.scale.set(coneWidth, coneWidth, coneLength);
@@ -34698,6 +35001,11 @@
34698
35001
  super.updateMatrixWorld(force);
34699
35002
  }
34700
35003
 
35004
+ dispose() {
35005
+ this.geometry.dispose();
35006
+ this.material.dispose();
35007
+ }
35008
+
34701
35009
  }
34702
35010
 
34703
35011
  function getBoneList(object) {
@@ -34724,7 +35032,6 @@
34724
35032
  });
34725
35033
  super(geometry, material);
34726
35034
  this.light = light;
34727
- this.light.updateMatrixWorld();
34728
35035
  this.color = color;
34729
35036
  this.type = 'PointLightHelper';
34730
35037
  this.matrix = this.light.matrixWorld;
@@ -34752,6 +35059,8 @@
34752
35059
  }
34753
35060
 
34754
35061
  update() {
35062
+ this.light.updateWorldMatrix(true, false);
35063
+
34755
35064
  if (this.color !== undefined) {
34756
35065
  this.material.color.set(this.color);
34757
35066
  } else {
@@ -34781,10 +35090,10 @@
34781
35090
  constructor(light, size, color) {
34782
35091
  super();
34783
35092
  this.light = light;
34784
- this.light.updateMatrixWorld();
34785
35093
  this.matrix = light.matrixWorld;
34786
35094
  this.matrixAutoUpdate = false;
34787
35095
  this.color = color;
35096
+ this.type = 'HemisphereLightHelper';
34788
35097
  const geometry = new OctahedronGeometry(size);
34789
35098
  geometry.rotateY(Math.PI * 0.5);
34790
35099
  this.material = new MeshBasicMaterial({
@@ -34825,6 +35134,7 @@
34825
35134
  colors.needsUpdate = true;
34826
35135
  }
34827
35136
 
35137
+ this.light.updateWorldMatrix(true, false);
34828
35138
  mesh.lookAt(_vector$1.setFromMatrixPosition(this.light.matrixWorld).negate());
34829
35139
  }
34830
35140
 
@@ -34865,6 +35175,11 @@
34865
35175
  this.type = 'GridHelper';
34866
35176
  }
34867
35177
 
35178
+ dispose() {
35179
+ this.geometry.dispose();
35180
+ this.material.dispose();
35181
+ }
35182
+
34868
35183
  }
34869
35184
 
34870
35185
  class PolarGridHelper extends LineSegments {
@@ -34919,6 +35234,11 @@
34919
35234
  this.type = 'PolarGridHelper';
34920
35235
  }
34921
35236
 
35237
+ dispose() {
35238
+ this.geometry.dispose();
35239
+ this.material.dispose();
35240
+ }
35241
+
34922
35242
  }
34923
35243
 
34924
35244
  const _v1 = /*@__PURE__*/new Vector3();
@@ -34931,10 +35251,10 @@
34931
35251
  constructor(light, size, color) {
34932
35252
  super();
34933
35253
  this.light = light;
34934
- this.light.updateMatrixWorld();
34935
35254
  this.matrix = light.matrixWorld;
34936
35255
  this.matrixAutoUpdate = false;
34937
35256
  this.color = color;
35257
+ this.type = 'DirectionalLightHelper';
34938
35258
  if (size === undefined) size = 1;
34939
35259
  let geometry = new BufferGeometry();
34940
35260
  geometry.setAttribute('position', new Float32BufferAttribute([-size, size, 0, size, size, 0, size, -size, 0, -size, -size, 0, -size, size, 0], 3));
@@ -34959,6 +35279,9 @@
34959
35279
  }
34960
35280
 
34961
35281
  update() {
35282
+ this.light.updateWorldMatrix(true, false);
35283
+ this.light.target.updateWorldMatrix(true, false);
35284
+
34962
35285
  _v1.setFromMatrixPosition(this.light.matrixWorld);
34963
35286
 
34964
35287
  _v2.setFromMatrixPosition(this.light.target.matrixWorld);
@@ -35306,6 +35629,11 @@
35306
35629
  return this;
35307
35630
  }
35308
35631
 
35632
+ dispose() {
35633
+ this.geometry.dispose();
35634
+ this.material.dispose();
35635
+ }
35636
+
35309
35637
  }
35310
35638
 
35311
35639
  class Box3Helper extends LineSegments {
@@ -35333,6 +35661,11 @@
35333
35661
  super.updateMatrixWorld(force);
35334
35662
  }
35335
35663
 
35664
+ dispose() {
35665
+ this.geometry.dispose();
35666
+ this.material.dispose();
35667
+ }
35668
+
35336
35669
  }
35337
35670
 
35338
35671
  class PlaneHelper extends Line {
@@ -35370,6 +35703,13 @@
35370
35703
  super.updateMatrixWorld(force);
35371
35704
  }
35372
35705
 
35706
+ dispose() {
35707
+ this.geometry.dispose();
35708
+ this.material.dispose();
35709
+ this.children[0].geometry.dispose();
35710
+ this.children[0].material.dispose();
35711
+ }
35712
+
35373
35713
  }
35374
35714
 
35375
35715
  const _axis = /*@__PURE__*/new Vector3();
@@ -35444,6 +35784,13 @@
35444
35784
  return this;
35445
35785
  }
35446
35786
 
35787
+ dispose() {
35788
+ this.line.geometry.dispose();
35789
+ this.line.material.dispose();
35790
+ this.cone.geometry.dispose();
35791
+ this.cone.material.dispose();
35792
+ }
35793
+
35447
35794
  }
35448
35795
 
35449
35796
  class AxesHelper extends LineSegments {
@@ -36061,6 +36408,7 @@
36061
36408
  exports.Color = Color;
36062
36409
  exports.ColorKeyframeTrack = ColorKeyframeTrack;
36063
36410
  exports.ColorManagement = ColorManagement;
36411
+ exports.CompressedArrayTexture = CompressedArrayTexture;
36064
36412
  exports.CompressedTexture = CompressedTexture;
36065
36413
  exports.CompressedTextureLoader = CompressedTextureLoader;
36066
36414
  exports.ConeBufferGeometry = ConeBufferGeometry;