three-stdlib 2.35.5 → 2.35.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (514) hide show
  1. package/_polyfill/CapsuleGeometry.cjs +20 -17
  2. package/_polyfill/CapsuleGeometry.cjs.map +1 -1
  3. package/_polyfill/CapsuleGeometry.js +20 -17
  4. package/_polyfill/CapsuleGeometry.js.map +1 -1
  5. package/_polyfill/constants.cjs +1 -1
  6. package/_polyfill/constants.cjs.map +1 -1
  7. package/_polyfill/constants.js +1 -1
  8. package/_polyfill/constants.js.map +1 -1
  9. package/animation/AnimationClipCreator.cjs +13 -13
  10. package/animation/AnimationClipCreator.cjs.map +1 -1
  11. package/animation/AnimationClipCreator.js +13 -13
  12. package/animation/AnimationClipCreator.js.map +1 -1
  13. package/animation/CCDIKSolver.cjs +11 -11
  14. package/animation/CCDIKSolver.cjs.map +1 -1
  15. package/animation/CCDIKSolver.js +12 -12
  16. package/animation/CCDIKSolver.js.map +1 -1
  17. package/animation/MMDAnimationHelper.cjs +1 -1
  18. package/animation/MMDAnimationHelper.cjs.map +1 -1
  19. package/animation/MMDAnimationHelper.js +1 -1
  20. package/animation/MMDAnimationHelper.js.map +1 -1
  21. package/animation/MMDPhysics.cjs +4 -4
  22. package/animation/MMDPhysics.cjs.map +1 -1
  23. package/animation/MMDPhysics.js +4 -4
  24. package/animation/MMDPhysics.js.map +1 -1
  25. package/controls/ArcballControls.cjs +2 -2
  26. package/controls/ArcballControls.cjs.map +1 -1
  27. package/controls/ArcballControls.js +3 -3
  28. package/controls/ArcballControls.js.map +1 -1
  29. package/controls/FirstPersonControls.cjs +1 -1
  30. package/controls/FirstPersonControls.cjs.map +1 -1
  31. package/controls/FirstPersonControls.js +1 -1
  32. package/controls/FirstPersonControls.js.map +1 -1
  33. package/controls/OrbitControls.cjs +2 -2
  34. package/controls/OrbitControls.cjs.map +1 -1
  35. package/controls/OrbitControls.js +3 -3
  36. package/controls/OrbitControls.js.map +1 -1
  37. package/controls/PointerLockControls.cjs +2 -2
  38. package/controls/PointerLockControls.cjs.map +1 -1
  39. package/controls/PointerLockControls.js +3 -3
  40. package/controls/PointerLockControls.js.map +1 -1
  41. package/csm/CSM.cjs +4 -4
  42. package/csm/CSM.cjs.map +1 -1
  43. package/csm/CSM.js +5 -5
  44. package/csm/CSM.js.map +1 -1
  45. package/csm/CSMFrustum.cjs +1 -1
  46. package/csm/CSMFrustum.cjs.map +1 -1
  47. package/csm/CSMFrustum.js +2 -2
  48. package/csm/CSMFrustum.js.map +1 -1
  49. package/deprecated/Geometry.cjs +722 -715
  50. package/deprecated/Geometry.cjs.map +1 -1
  51. package/deprecated/Geometry.js +723 -716
  52. package/deprecated/Geometry.js.map +1 -1
  53. package/effects/AnaglyphEffect.cjs +2 -1
  54. package/effects/AnaglyphEffect.cjs.map +1 -1
  55. package/effects/AnaglyphEffect.js +3 -2
  56. package/effects/AnaglyphEffect.js.map +1 -1
  57. package/effects/OutlineEffect.cjs +2 -1
  58. package/effects/OutlineEffect.cjs.map +1 -1
  59. package/effects/OutlineEffect.js +3 -2
  60. package/effects/OutlineEffect.js.map +1 -1
  61. package/effects/ParallaxBarrierEffect.cjs +2 -1
  62. package/effects/ParallaxBarrierEffect.cjs.map +1 -1
  63. package/effects/ParallaxBarrierEffect.js +3 -2
  64. package/effects/ParallaxBarrierEffect.js.map +1 -1
  65. package/exporters/DRACOExporter.cjs +133 -122
  66. package/exporters/DRACOExporter.cjs.map +1 -1
  67. package/exporters/DRACOExporter.d.ts +34 -21
  68. package/exporters/DRACOExporter.js +133 -122
  69. package/exporters/DRACOExporter.js.map +1 -1
  70. package/exporters/GLTFExporter.cjs +170 -167
  71. package/exporters/GLTFExporter.cjs.map +1 -1
  72. package/exporters/GLTFExporter.js +170 -167
  73. package/exporters/GLTFExporter.js.map +1 -1
  74. package/geometries/LightningStrike.cjs +524 -515
  75. package/geometries/LightningStrike.cjs.map +1 -1
  76. package/geometries/LightningStrike.js +524 -515
  77. package/geometries/LightningStrike.js.map +1 -1
  78. package/geometries/RoundedBoxGeometry.cjs +1 -1
  79. package/geometries/RoundedBoxGeometry.cjs.map +1 -1
  80. package/geometries/RoundedBoxGeometry.js +2 -2
  81. package/geometries/RoundedBoxGeometry.js.map +1 -1
  82. package/helpers/RaycasterHelper.cjs +2 -2
  83. package/helpers/RaycasterHelper.cjs.map +1 -1
  84. package/helpers/RaycasterHelper.js +3 -3
  85. package/helpers/RaycasterHelper.js.map +1 -1
  86. package/helpers/VertexNormalsHelper.cjs +3 -3
  87. package/helpers/VertexNormalsHelper.cjs.map +1 -1
  88. package/helpers/VertexNormalsHelper.js +4 -4
  89. package/helpers/VertexNormalsHelper.js.map +1 -1
  90. package/helpers/VertexTangentsHelper.cjs +2 -2
  91. package/helpers/VertexTangentsHelper.cjs.map +1 -1
  92. package/helpers/VertexTangentsHelper.js +3 -3
  93. package/helpers/VertexTangentsHelper.js.map +1 -1
  94. package/interactive/InteractiveGroup.cjs +1 -1
  95. package/interactive/InteractiveGroup.cjs.map +1 -1
  96. package/interactive/InteractiveGroup.js +2 -2
  97. package/interactive/InteractiveGroup.js.map +1 -1
  98. package/interactive/SelectionBox.cjs +15 -15
  99. package/interactive/SelectionBox.cjs.map +1 -1
  100. package/interactive/SelectionBox.js +16 -16
  101. package/interactive/SelectionBox.js.map +1 -1
  102. package/libs/chevrotain.cjs +1 -1
  103. package/libs/chevrotain.cjs.map +1 -1
  104. package/libs/chevrotain.js +1 -1
  105. package/libs/chevrotain.js.map +1 -1
  106. package/libs/lottie.cjs +1 -1
  107. package/libs/lottie.cjs.map +1 -1
  108. package/libs/lottie.js +1 -1
  109. package/libs/lottie.js.map +1 -1
  110. package/libs/opentype.cjs +1 -1
  111. package/libs/opentype.cjs.map +1 -1
  112. package/libs/opentype.js +1 -1
  113. package/libs/opentype.js.map +1 -1
  114. package/lights/LightProbeGenerator.cjs +5 -5
  115. package/lights/LightProbeGenerator.cjs.map +1 -1
  116. package/lights/LightProbeGenerator.js +5 -5
  117. package/lights/LightProbeGenerator.js.map +1 -1
  118. package/lights/RectAreaLightUniformsLib.cjs +3 -3
  119. package/lights/RectAreaLightUniformsLib.cjs.map +1 -1
  120. package/lights/RectAreaLightUniformsLib.js +3 -3
  121. package/lights/RectAreaLightUniformsLib.js.map +1 -1
  122. package/lines/LineMaterial.cjs +2 -1
  123. package/lines/LineMaterial.cjs.map +1 -1
  124. package/lines/LineMaterial.js +3 -2
  125. package/lines/LineMaterial.js.map +1 -1
  126. package/lines/LineSegments2.cjs +13 -13
  127. package/lines/LineSegments2.cjs.map +1 -1
  128. package/lines/LineSegments2.js +14 -14
  129. package/lines/LineSegments2.js.map +1 -1
  130. package/lines/LineSegmentsGeometry.cjs +2 -2
  131. package/lines/LineSegmentsGeometry.cjs.map +1 -1
  132. package/lines/LineSegmentsGeometry.js +3 -3
  133. package/lines/LineSegmentsGeometry.js.map +1 -1
  134. package/lines/Wireframe.cjs +3 -3
  135. package/lines/Wireframe.cjs.map +1 -1
  136. package/lines/Wireframe.js +4 -4
  137. package/lines/Wireframe.js.map +1 -1
  138. package/loaders/BasisTextureLoader.cjs +441 -435
  139. package/loaders/BasisTextureLoader.cjs.map +1 -1
  140. package/loaders/BasisTextureLoader.js +441 -435
  141. package/loaders/BasisTextureLoader.js.map +1 -1
  142. package/loaders/EXRLoader.cjs +2 -1
  143. package/loaders/EXRLoader.cjs.map +1 -1
  144. package/loaders/EXRLoader.js +3 -2
  145. package/loaders/EXRLoader.js.map +1 -1
  146. package/loaders/FBXLoader.cjs +2 -2
  147. package/loaders/FBXLoader.cjs.map +1 -1
  148. package/loaders/FBXLoader.js +2 -2
  149. package/loaders/FBXLoader.js.map +1 -1
  150. package/loaders/FontLoader.cjs +2 -2
  151. package/loaders/FontLoader.cjs.map +1 -1
  152. package/loaders/FontLoader.d.ts +2 -2
  153. package/loaders/FontLoader.js +2 -2
  154. package/loaders/FontLoader.js.map +1 -1
  155. package/loaders/GLTFLoader.cjs +2 -2
  156. package/loaders/GLTFLoader.cjs.map +1 -1
  157. package/loaders/GLTFLoader.js +2 -2
  158. package/loaders/GLTFLoader.js.map +1 -1
  159. package/loaders/KTX2Loader.cjs +377 -374
  160. package/loaders/KTX2Loader.cjs.map +1 -1
  161. package/loaders/KTX2Loader.js +377 -374
  162. package/loaders/KTX2Loader.js.map +1 -1
  163. package/loaders/LDrawLoader.cjs +5 -4
  164. package/loaders/LDrawLoader.cjs.map +1 -1
  165. package/loaders/LDrawLoader.js +6 -5
  166. package/loaders/LDrawLoader.js.map +1 -1
  167. package/loaders/OBJLoader.cjs +5 -5
  168. package/loaders/OBJLoader.cjs.map +1 -1
  169. package/loaders/OBJLoader.js +6 -6
  170. package/loaders/OBJLoader.js.map +1 -1
  171. package/loaders/PRWMLoader.cjs +46 -43
  172. package/loaders/PRWMLoader.cjs.map +1 -1
  173. package/loaders/PRWMLoader.js +46 -43
  174. package/loaders/PRWMLoader.js.map +1 -1
  175. package/loaders/SVGLoader.cjs +1694 -1688
  176. package/loaders/SVGLoader.cjs.map +1 -1
  177. package/loaders/SVGLoader.js +1694 -1688
  178. package/loaders/SVGLoader.js.map +1 -1
  179. package/loaders/XLoader.cjs +1 -1
  180. package/loaders/XLoader.cjs.map +1 -1
  181. package/loaders/XLoader.js +1 -1
  182. package/loaders/XLoader.js.map +1 -1
  183. package/math/Capsule.cjs +3 -3
  184. package/math/Capsule.cjs.map +1 -1
  185. package/math/Capsule.js +3 -3
  186. package/math/Capsule.js.map +1 -1
  187. package/math/ColorConverter.cjs +9 -9
  188. package/math/ColorConverter.cjs.map +1 -1
  189. package/math/ColorConverter.js +9 -9
  190. package/math/ColorConverter.js.map +1 -1
  191. package/math/ConvexHull.cjs +53 -50
  192. package/math/ConvexHull.cjs.map +1 -1
  193. package/math/ConvexHull.js +53 -50
  194. package/math/ConvexHull.js.map +1 -1
  195. package/math/ImprovedNoise.cjs +1 -1
  196. package/math/ImprovedNoise.cjs.map +1 -1
  197. package/math/ImprovedNoise.js +1 -1
  198. package/math/ImprovedNoise.js.map +1 -1
  199. package/math/MeshSurfaceSampler.cjs +2 -2
  200. package/math/MeshSurfaceSampler.cjs.map +1 -1
  201. package/math/MeshSurfaceSampler.js +2 -2
  202. package/math/MeshSurfaceSampler.js.map +1 -1
  203. package/math/OBB.cjs +14 -14
  204. package/math/OBB.cjs.map +1 -1
  205. package/math/OBB.js +15 -15
  206. package/math/OBB.js.map +1 -1
  207. package/math/Octree.cjs +7 -7
  208. package/math/Octree.cjs.map +1 -1
  209. package/math/Octree.js +8 -8
  210. package/math/Octree.js.map +1 -1
  211. package/misc/ConvexObjectBreaker.cjs +271 -268
  212. package/misc/ConvexObjectBreaker.cjs.map +1 -1
  213. package/misc/ConvexObjectBreaker.js +272 -269
  214. package/misc/ConvexObjectBreaker.js.map +1 -1
  215. package/misc/Gyroscope.cjs +6 -6
  216. package/misc/Gyroscope.cjs.map +1 -1
  217. package/misc/Gyroscope.js +7 -7
  218. package/misc/Gyroscope.js.map +1 -1
  219. package/modifiers/CurveModifier.cjs +1 -1
  220. package/modifiers/CurveModifier.cjs.map +1 -1
  221. package/modifiers/CurveModifier.js +2 -2
  222. package/modifiers/CurveModifier.js.map +1 -1
  223. package/modifiers/SimplifyModifier.cjs +2 -2
  224. package/modifiers/SimplifyModifier.cjs.map +1 -1
  225. package/modifiers/SimplifyModifier.js +2 -2
  226. package/modifiers/SimplifyModifier.js.map +1 -1
  227. package/objects/BatchedMesh.cjs +2 -2
  228. package/objects/BatchedMesh.cjs.map +1 -1
  229. package/objects/BatchedMesh.js +3 -3
  230. package/objects/BatchedMesh.js.map +1 -1
  231. package/objects/GroundProjectedEnv.cjs +2 -1
  232. package/objects/GroundProjectedEnv.cjs.map +1 -1
  233. package/objects/GroundProjectedEnv.js +3 -2
  234. package/objects/GroundProjectedEnv.js.map +1 -1
  235. package/objects/Lensflare.cjs +211 -206
  236. package/objects/Lensflare.cjs.map +1 -1
  237. package/objects/Lensflare.js +212 -207
  238. package/objects/Lensflare.js.map +1 -1
  239. package/objects/Reflector.cjs +154 -146
  240. package/objects/Reflector.cjs.map +1 -1
  241. package/objects/Reflector.js +154 -146
  242. package/objects/Reflector.js.map +1 -1
  243. package/objects/ReflectorForSSRPass.cjs +183 -180
  244. package/objects/ReflectorForSSRPass.cjs.map +1 -1
  245. package/objects/ReflectorForSSRPass.js +183 -180
  246. package/objects/ReflectorForSSRPass.js.map +1 -1
  247. package/objects/Refractor.cjs +164 -161
  248. package/objects/Refractor.cjs.map +1 -1
  249. package/objects/Refractor.js +164 -161
  250. package/objects/Refractor.js.map +1 -1
  251. package/objects/ShadowMesh.cjs +1 -1
  252. package/objects/ShadowMesh.cjs.map +1 -1
  253. package/objects/ShadowMesh.js +2 -2
  254. package/objects/ShadowMesh.js.map +1 -1
  255. package/objects/Sky.cjs +35 -32
  256. package/objects/Sky.cjs.map +1 -1
  257. package/objects/Sky.d.ts +17 -42
  258. package/objects/Sky.js +35 -32
  259. package/objects/Sky.js.map +1 -1
  260. package/objects/Water.cjs +2 -1
  261. package/objects/Water.cjs.map +1 -1
  262. package/objects/Water.js +3 -2
  263. package/objects/Water.js.map +1 -1
  264. package/objects/Water2.cjs +143 -140
  265. package/objects/Water2.cjs.map +1 -1
  266. package/objects/Water2.js +143 -140
  267. package/objects/Water2.js.map +1 -1
  268. package/package.json +1 -1
  269. package/postprocessing/SAOPass.cjs +267 -264
  270. package/postprocessing/SAOPass.cjs.map +1 -1
  271. package/postprocessing/SAOPass.js +267 -264
  272. package/postprocessing/SAOPass.js.map +1 -1
  273. package/postprocessing/SSAOPass.cjs +253 -250
  274. package/postprocessing/SSAOPass.cjs.map +1 -1
  275. package/postprocessing/SSAOPass.js +253 -250
  276. package/postprocessing/SSAOPass.js.map +1 -1
  277. package/postprocessing/SSRPass.cjs +379 -376
  278. package/postprocessing/SSRPass.cjs.map +1 -1
  279. package/postprocessing/SSRPass.js +379 -376
  280. package/postprocessing/SSRPass.js.map +1 -1
  281. package/postprocessing/UnrealBloomPass.cjs +205 -202
  282. package/postprocessing/UnrealBloomPass.cjs.map +1 -1
  283. package/postprocessing/UnrealBloomPass.js +205 -202
  284. package/postprocessing/UnrealBloomPass.js.map +1 -1
  285. package/renderers/CSS2DRenderer.cjs +5 -5
  286. package/renderers/CSS2DRenderer.cjs.map +1 -1
  287. package/renderers/CSS2DRenderer.js +5 -5
  288. package/renderers/CSS2DRenderer.js.map +1 -1
  289. package/renderers/CSS3DRenderer.cjs +5 -5
  290. package/renderers/CSS3DRenderer.cjs.map +1 -1
  291. package/renderers/CSS3DRenderer.js +6 -6
  292. package/renderers/CSS3DRenderer.js.map +1 -1
  293. package/shaders/ACESFilmicToneMappingShader.cjs +71 -46
  294. package/shaders/ACESFilmicToneMappingShader.cjs.map +1 -1
  295. package/shaders/ACESFilmicToneMappingShader.js +71 -46
  296. package/shaders/ACESFilmicToneMappingShader.js.map +1 -1
  297. package/shaders/AfterimageShader.cjs +41 -22
  298. package/shaders/AfterimageShader.cjs.map +1 -1
  299. package/shaders/AfterimageShader.js +41 -22
  300. package/shaders/AfterimageShader.js.map +1 -1
  301. package/shaders/BasicShader.cjs +20 -6
  302. package/shaders/BasicShader.cjs.map +1 -1
  303. package/shaders/BasicShader.js +20 -6
  304. package/shaders/BasicShader.js.map +1 -1
  305. package/shaders/BleachBypassShader.cjs +46 -26
  306. package/shaders/BleachBypassShader.cjs.map +1 -1
  307. package/shaders/BleachBypassShader.js +46 -26
  308. package/shaders/BleachBypassShader.js.map +1 -1
  309. package/shaders/BlendShader.cjs +33 -19
  310. package/shaders/BlendShader.cjs.map +1 -1
  311. package/shaders/BlendShader.js +33 -19
  312. package/shaders/BlendShader.js.map +1 -1
  313. package/shaders/BokehShader.cjs +117 -90
  314. package/shaders/BokehShader.cjs.map +1 -1
  315. package/shaders/BokehShader.js +117 -90
  316. package/shaders/BokehShader.js.map +1 -1
  317. package/shaders/BokehShader2.cjs +333 -232
  318. package/shaders/BokehShader2.cjs.map +1 -1
  319. package/shaders/BokehShader2.js +333 -232
  320. package/shaders/BokehShader2.js.map +1 -1
  321. package/shaders/BrightnessContrastShader.cjs +38 -22
  322. package/shaders/BrightnessContrastShader.cjs.map +1 -1
  323. package/shaders/BrightnessContrastShader.js +38 -22
  324. package/shaders/BrightnessContrastShader.js.map +1 -1
  325. package/shaders/ColorCorrectionShader.cjs +35 -21
  326. package/shaders/ColorCorrectionShader.cjs.map +1 -1
  327. package/shaders/ColorCorrectionShader.js +35 -21
  328. package/shaders/ColorCorrectionShader.js.map +1 -1
  329. package/shaders/ColorifyShader.cjs +34 -19
  330. package/shaders/ColorifyShader.cjs.map +1 -1
  331. package/shaders/ColorifyShader.js +34 -19
  332. package/shaders/ColorifyShader.js.map +1 -1
  333. package/shaders/ConvolutionShader.cjs +43 -24
  334. package/shaders/ConvolutionShader.cjs.map +1 -1
  335. package/shaders/ConvolutionShader.js +43 -24
  336. package/shaders/ConvolutionShader.js.map +1 -1
  337. package/shaders/CopyShader.cjs +30 -16
  338. package/shaders/CopyShader.cjs.map +1 -1
  339. package/shaders/CopyShader.js +30 -16
  340. package/shaders/CopyShader.js.map +1 -1
  341. package/shaders/DOFMipMapShader.cjs +38 -21
  342. package/shaders/DOFMipMapShader.cjs.map +1 -1
  343. package/shaders/DOFMipMapShader.js +38 -21
  344. package/shaders/DOFMipMapShader.js.map +1 -1
  345. package/shaders/DepthLimitedBlurShader.cjs +98 -69
  346. package/shaders/DepthLimitedBlurShader.cjs.map +1 -1
  347. package/shaders/DepthLimitedBlurShader.js +98 -69
  348. package/shaders/DepthLimitedBlurShader.js.map +1 -1
  349. package/shaders/DigitalGlitch.cjs +70 -59
  350. package/shaders/DigitalGlitch.cjs.map +1 -1
  351. package/shaders/DigitalGlitch.js +70 -59
  352. package/shaders/DigitalGlitch.js.map +1 -1
  353. package/shaders/DotScreenShader.cjs +49 -28
  354. package/shaders/DotScreenShader.cjs.map +1 -1
  355. package/shaders/DotScreenShader.js +49 -28
  356. package/shaders/DotScreenShader.js.map +1 -1
  357. package/shaders/FXAAShader.cjs +1098 -1089
  358. package/shaders/FXAAShader.cjs.map +1 -1
  359. package/shaders/FXAAShader.js +1098 -1089
  360. package/shaders/FXAAShader.js.map +1 -1
  361. package/shaders/FilmShader.cjs +57 -29
  362. package/shaders/FilmShader.cjs.map +1 -1
  363. package/shaders/FilmShader.js +57 -29
  364. package/shaders/FilmShader.js.map +1 -1
  365. package/shaders/FocusShader.cjs +70 -43
  366. package/shaders/FocusShader.cjs.map +1 -1
  367. package/shaders/FocusShader.js +70 -43
  368. package/shaders/FocusShader.js.map +1 -1
  369. package/shaders/FreiChenShader.cjs +74 -53
  370. package/shaders/FreiChenShader.cjs.map +1 -1
  371. package/shaders/FreiChenShader.js +74 -53
  372. package/shaders/FreiChenShader.js.map +1 -1
  373. package/shaders/FresnelShader.cjs +55 -35
  374. package/shaders/FresnelShader.cjs.map +1 -1
  375. package/shaders/FresnelShader.js +55 -35
  376. package/shaders/FresnelShader.js.map +1 -1
  377. package/shaders/GammaCorrectionShader.cjs +33 -19
  378. package/shaders/GammaCorrectionShader.cjs.map +1 -1
  379. package/shaders/GammaCorrectionShader.js +33 -19
  380. package/shaders/GammaCorrectionShader.js.map +1 -1
  381. package/shaders/GodRaysShader.cjs +193 -116
  382. package/shaders/GodRaysShader.cjs.map +1 -1
  383. package/shaders/GodRaysShader.js +193 -116
  384. package/shaders/GodRaysShader.js.map +1 -1
  385. package/shaders/HalftoneShader.cjs +270 -192
  386. package/shaders/HalftoneShader.cjs.map +1 -1
  387. package/shaders/HalftoneShader.js +270 -192
  388. package/shaders/HalftoneShader.js.map +1 -1
  389. package/shaders/HorizontalTiltShiftShader.cjs +43 -27
  390. package/shaders/HorizontalTiltShiftShader.cjs.map +1 -1
  391. package/shaders/HorizontalTiltShiftShader.js +43 -27
  392. package/shaders/HorizontalTiltShiftShader.js.map +1 -1
  393. package/shaders/HueSaturationShader.cjs +47 -31
  394. package/shaders/HueSaturationShader.cjs.map +1 -1
  395. package/shaders/HueSaturationShader.js +47 -31
  396. package/shaders/HueSaturationShader.js.map +1 -1
  397. package/shaders/KaleidoShader.cjs +37 -24
  398. package/shaders/KaleidoShader.cjs.map +1 -1
  399. package/shaders/KaleidoShader.js +37 -24
  400. package/shaders/KaleidoShader.js.map +1 -1
  401. package/shaders/LuminosityHighPassShader.cjs +43 -24
  402. package/shaders/LuminosityHighPassShader.cjs.map +1 -1
  403. package/shaders/LuminosityHighPassShader.js +43 -24
  404. package/shaders/LuminosityHighPassShader.js.map +1 -1
  405. package/shaders/LuminosityShader.cjs +34 -17
  406. package/shaders/LuminosityShader.cjs.map +1 -1
  407. package/shaders/LuminosityShader.js +34 -17
  408. package/shaders/LuminosityShader.js.map +1 -1
  409. package/shaders/MirrorShader.cjs +39 -26
  410. package/shaders/MirrorShader.cjs.map +1 -1
  411. package/shaders/MirrorShader.js +39 -26
  412. package/shaders/MirrorShader.js.map +1 -1
  413. package/shaders/NormalMapShader.cjs +36 -21
  414. package/shaders/NormalMapShader.cjs.map +1 -1
  415. package/shaders/NormalMapShader.js +36 -21
  416. package/shaders/NormalMapShader.js.map +1 -1
  417. package/shaders/ParallaxShader.cjs +147 -97
  418. package/shaders/ParallaxShader.cjs.map +1 -1
  419. package/shaders/ParallaxShader.js +147 -97
  420. package/shaders/ParallaxShader.js.map +1 -1
  421. package/shaders/PixelShader.cjs +31 -18
  422. package/shaders/PixelShader.cjs.map +1 -1
  423. package/shaders/PixelShader.js +31 -18
  424. package/shaders/PixelShader.js.map +1 -1
  425. package/shaders/RGBShiftShader.cjs +33 -20
  426. package/shaders/RGBShiftShader.cjs.map +1 -1
  427. package/shaders/RGBShiftShader.js +33 -20
  428. package/shaders/RGBShiftShader.js.map +1 -1
  429. package/shaders/SAOShader.cjs +154 -117
  430. package/shaders/SAOShader.cjs.map +1 -1
  431. package/shaders/SAOShader.js +154 -117
  432. package/shaders/SAOShader.js.map +1 -1
  433. package/shaders/SMAAShader.cjs +358 -270
  434. package/shaders/SMAAShader.cjs.map +1 -1
  435. package/shaders/SMAAShader.js +358 -270
  436. package/shaders/SMAAShader.js.map +1 -1
  437. package/shaders/SSAOShader.cjs +236 -142
  438. package/shaders/SSAOShader.cjs.map +1 -1
  439. package/shaders/SSAOShader.js +236 -142
  440. package/shaders/SSAOShader.js.map +1 -1
  441. package/shaders/SSRShader.cjs +4 -4
  442. package/shaders/SSRShader.cjs.map +1 -1
  443. package/shaders/SSRShader.js +4 -4
  444. package/shaders/SSRShader.js.map +1 -1
  445. package/shaders/SepiaShader.cjs +36 -20
  446. package/shaders/SepiaShader.cjs.map +1 -1
  447. package/shaders/SepiaShader.js +36 -20
  448. package/shaders/SepiaShader.js.map +1 -1
  449. package/shaders/SobelOperatorShader.cjs +64 -37
  450. package/shaders/SobelOperatorShader.cjs.map +1 -1
  451. package/shaders/SobelOperatorShader.js +64 -37
  452. package/shaders/SobelOperatorShader.js.map +1 -1
  453. package/shaders/TechnicolorShader.cjs +29 -16
  454. package/shaders/TechnicolorShader.cjs.map +1 -1
  455. package/shaders/TechnicolorShader.js +29 -16
  456. package/shaders/TechnicolorShader.js.map +1 -1
  457. package/shaders/ToneMapShader.cjs +55 -35
  458. package/shaders/ToneMapShader.cjs.map +1 -1
  459. package/shaders/ToneMapShader.js +55 -35
  460. package/shaders/ToneMapShader.js.map +1 -1
  461. package/shaders/ToonShader.cjs +275 -165
  462. package/shaders/ToonShader.cjs.map +1 -1
  463. package/shaders/ToonShader.js +275 -165
  464. package/shaders/ToonShader.js.map +1 -1
  465. package/shaders/TriangleBlurShader.cjs +50 -27
  466. package/shaders/TriangleBlurShader.cjs.map +1 -1
  467. package/shaders/TriangleBlurShader.js +50 -27
  468. package/shaders/TriangleBlurShader.js.map +1 -1
  469. package/shaders/UnpackDepthRGBAShader.cjs +32 -17
  470. package/shaders/UnpackDepthRGBAShader.cjs.map +1 -1
  471. package/shaders/UnpackDepthRGBAShader.js +32 -17
  472. package/shaders/UnpackDepthRGBAShader.js.map +1 -1
  473. package/shaders/VerticalTiltShiftShader.cjs +43 -27
  474. package/shaders/VerticalTiltShiftShader.cjs.map +1 -1
  475. package/shaders/VerticalTiltShiftShader.js +43 -27
  476. package/shaders/VerticalTiltShiftShader.js.map +1 -1
  477. package/shaders/VignetteShader.cjs +43 -27
  478. package/shaders/VignetteShader.cjs.map +1 -1
  479. package/shaders/VignetteShader.js +43 -27
  480. package/shaders/VignetteShader.js.map +1 -1
  481. package/shaders/VolumeShader.cjs +264 -213
  482. package/shaders/VolumeShader.cjs.map +1 -1
  483. package/shaders/VolumeShader.js +264 -213
  484. package/shaders/VolumeShader.js.map +1 -1
  485. package/shaders/WaterRefractionShader.cjs +63 -35
  486. package/shaders/WaterRefractionShader.cjs.map +1 -1
  487. package/shaders/WaterRefractionShader.js +63 -35
  488. package/shaders/WaterRefractionShader.js.map +1 -1
  489. package/utils/GeometryCompressionUtils.cjs +2 -1
  490. package/utils/GeometryCompressionUtils.cjs.map +1 -1
  491. package/utils/GeometryCompressionUtils.js +3 -2
  492. package/utils/GeometryCompressionUtils.js.map +1 -1
  493. package/utils/RoughnessMipmapper.cjs +3 -3
  494. package/utils/RoughnessMipmapper.cjs.map +1 -1
  495. package/utils/RoughnessMipmapper.js +4 -4
  496. package/utils/RoughnessMipmapper.js.map +1 -1
  497. package/webxr/ARButton.cjs +3 -3
  498. package/webxr/ARButton.cjs.map +1 -1
  499. package/webxr/ARButton.d.ts +3 -3
  500. package/webxr/ARButton.js +3 -3
  501. package/webxr/ARButton.js.map +1 -1
  502. package/webxr/OculusHandPointerModel.cjs +2 -2
  503. package/webxr/OculusHandPointerModel.cjs.map +1 -1
  504. package/webxr/OculusHandPointerModel.js +2 -2
  505. package/webxr/OculusHandPointerModel.js.map +1 -1
  506. package/webxr/VRButton.cjs +98 -95
  507. package/webxr/VRButton.cjs.map +1 -1
  508. package/webxr/VRButton.d.ts +9 -6
  509. package/webxr/VRButton.js +98 -95
  510. package/webxr/VRButton.js.map +1 -1
  511. package/webxr/XRHandPrimitiveModel.cjs +2 -2
  512. package/webxr/XRHandPrimitiveModel.cjs.map +1 -1
  513. package/webxr/XRHandPrimitiveModel.js +3 -3
  514. package/webxr/XRHandPrimitiveModel.js.map +1 -1
@@ -21,402 +21,405 @@ const SRGBColorSpace = "srgb";
21
21
  const _taskCache = /* @__PURE__ */ new WeakMap();
22
22
  let _activeLoaders = 0;
23
23
  let _zstd;
24
- const _KTX2Loader = class extends Loader {
25
- constructor(manager) {
26
- super(manager);
27
- this.transcoderPath = "";
28
- this.transcoderBinary = null;
29
- this.transcoderPending = null;
30
- this.workerPool = new WorkerPool();
31
- this.workerSourceURL = "";
32
- this.workerConfig = null;
33
- if (typeof MSC_TRANSCODER !== "undefined") {
34
- console.warn(
35
- 'THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'
36
- );
37
- }
38
- }
39
- setTranscoderPath(path) {
40
- this.transcoderPath = path;
41
- return this;
42
- }
43
- setWorkerLimit(num) {
44
- this.workerPool.setWorkerLimit(num);
45
- return this;
46
- }
47
- detectSupport(renderer) {
48
- this.workerConfig = {
49
- astcSupported: renderer.extensions.has("WEBGL_compressed_texture_astc"),
50
- etc1Supported: renderer.extensions.has("WEBGL_compressed_texture_etc1"),
51
- etc2Supported: renderer.extensions.has("WEBGL_compressed_texture_etc"),
52
- dxtSupported: renderer.extensions.has("WEBGL_compressed_texture_s3tc"),
53
- bptcSupported: renderer.extensions.has("EXT_texture_compression_bptc"),
54
- pvrtcSupported: renderer.extensions.has("WEBGL_compressed_texture_pvrtc") || renderer.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")
55
- };
56
- if (renderer.capabilities.isWebGL2) {
57
- this.workerConfig.etc1Supported = false;
58
- }
59
- return this;
60
- }
61
- init() {
62
- if (!this.transcoderPending) {
63
- const jsLoader = new FileLoader(this.manager);
64
- jsLoader.setPath(this.transcoderPath);
65
- jsLoader.setWithCredentials(this.withCredentials);
66
- const jsContent = jsLoader.loadAsync("basis_transcoder.js");
67
- const binaryLoader = new FileLoader(this.manager);
68
- binaryLoader.setPath(this.transcoderPath);
69
- binaryLoader.setResponseType("arraybuffer");
70
- binaryLoader.setWithCredentials(this.withCredentials);
71
- const binaryContent = binaryLoader.loadAsync("basis_transcoder.wasm");
72
- this.transcoderPending = Promise.all([jsContent, binaryContent]).then(([jsContent2, binaryContent2]) => {
73
- const fn = _KTX2Loader.BasisWorker.toString();
74
- const body = [
75
- "/* constants */",
76
- "let _EngineFormat = " + JSON.stringify(_KTX2Loader.EngineFormat),
77
- "let _TranscoderFormat = " + JSON.stringify(_KTX2Loader.TranscoderFormat),
78
- "let _BasisFormat = " + JSON.stringify(_KTX2Loader.BasisFormat),
79
- "/* basis_transcoder.js */",
80
- jsContent2,
81
- "/* worker */",
82
- fn.substring(fn.indexOf("{") + 1, fn.lastIndexOf("}"))
83
- ].join("\n");
84
- this.workerSourceURL = URL.createObjectURL(new Blob([body]));
85
- this.transcoderBinary = binaryContent2;
86
- this.workerPool.setWorkerCreator(() => {
87
- const worker = new Worker(this.workerSourceURL);
88
- const transcoderBinary = this.transcoderBinary.slice(0);
89
- worker.postMessage({ type: "init", config: this.workerConfig, transcoderBinary }, [transcoderBinary]);
90
- return worker;
91
- });
92
- });
93
- if (_activeLoaders > 0) {
24
+ const KTX2Loader = /* @__PURE__ */ (() => {
25
+ const _KTX2Loader = class extends Loader {
26
+ constructor(manager) {
27
+ super(manager);
28
+ this.transcoderPath = "";
29
+ this.transcoderBinary = null;
30
+ this.transcoderPending = null;
31
+ this.workerPool = new WorkerPool();
32
+ this.workerSourceURL = "";
33
+ this.workerConfig = null;
34
+ if (typeof MSC_TRANSCODER !== "undefined") {
94
35
  console.warn(
95
- "THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."
36
+ 'THREE.KTX2Loader: Please update to latest "basis_transcoder". "msc_basis_transcoder" is no longer supported in three.js r125+.'
96
37
  );
97
38
  }
98
- _activeLoaders++;
99
39
  }
100
- return this.transcoderPending;
101
- }
102
- load(url, onLoad, onProgress, onError) {
103
- if (this.workerConfig === null) {
104
- throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");
40
+ setTranscoderPath(path) {
41
+ this.transcoderPath = path;
42
+ return this;
105
43
  }
106
- const loader = new FileLoader(this.manager);
107
- loader.setResponseType("arraybuffer");
108
- loader.setWithCredentials(this.withCredentials);
109
- loader.load(
110
- url,
111
- (buffer) => {
112
- if (_taskCache.has(buffer)) {
113
- const cachedTask = _taskCache.get(buffer);
114
- return cachedTask.promise.then(onLoad).catch(onError);
115
- }
116
- this._createTexture(buffer).then((texture) => onLoad ? onLoad(texture) : null).catch(onError);
117
- },
118
- onProgress,
119
- onError
120
- );
121
- }
122
- _createTextureFrom(transcodeResult, container) {
123
- const { faces, width, height, format, type, error, dfdFlags } = transcodeResult;
124
- if (type === "error")
125
- return Promise.reject(error);
126
- let texture;
127
- if (container.faceCount === 6) {
128
- texture = new CompressedCubeTexture(faces, format, UnsignedByteType);
129
- } else {
130
- const mipmaps = faces[0].mipmaps;
131
- texture = container.layerCount > 1 ? new CompressedArrayTexture(mipmaps, width, height, container.layerCount, format, UnsignedByteType) : new CompressedTexture(mipmaps, width, height, format, UnsignedByteType);
44
+ setWorkerLimit(num) {
45
+ this.workerPool.setWorkerLimit(num);
46
+ return this;
132
47
  }
133
- texture.minFilter = faces[0].mipmaps.length === 1 ? LinearFilter : LinearMipmapLinearFilter;
134
- texture.magFilter = LinearFilter;
135
- texture.generateMipmaps = false;
136
- texture.needsUpdate = true;
137
- const colorSpace = parseColorSpace(container);
138
- if ("colorSpace" in texture)
139
- texture.colorSpace = colorSpace;
140
- else
141
- texture.encoding = colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
142
- texture.premultiplyAlpha = !!(dfdFlags & KHR_DF_FLAG_ALPHA_PREMULTIPLIED);
143
- return texture;
144
- }
145
- /**
146
- * @param {ArrayBuffer} buffer
147
- * @param {object?} config
148
- * @return {Promise<CompressedTexture|CompressedArrayTexture|DataTexture|Data3DTexture>}
149
- */
150
- async _createTexture(buffer, config = {}) {
151
- const container = read(new Uint8Array(buffer));
152
- if (container.vkFormat !== VK_FORMAT_UNDEFINED) {
153
- return createRawTexture(container);
48
+ detectSupport(renderer) {
49
+ this.workerConfig = {
50
+ astcSupported: renderer.extensions.has("WEBGL_compressed_texture_astc"),
51
+ etc1Supported: renderer.extensions.has("WEBGL_compressed_texture_etc1"),
52
+ etc2Supported: renderer.extensions.has("WEBGL_compressed_texture_etc"),
53
+ dxtSupported: renderer.extensions.has("WEBGL_compressed_texture_s3tc"),
54
+ bptcSupported: renderer.extensions.has("EXT_texture_compression_bptc"),
55
+ pvrtcSupported: renderer.extensions.has("WEBGL_compressed_texture_pvrtc") || renderer.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")
56
+ };
57
+ if (renderer.capabilities.isWebGL2) {
58
+ this.workerConfig.etc1Supported = false;
59
+ }
60
+ return this;
154
61
  }
155
- const taskConfig = config;
156
- const texturePending = this.init().then(() => {
157
- return this.workerPool.postMessage({ type: "transcode", buffer, taskConfig }, [buffer]);
158
- }).then((e) => this._createTextureFrom(e.data, container));
159
- _taskCache.set(buffer, { promise: texturePending });
160
- return texturePending;
161
- }
162
- dispose() {
163
- this.workerPool.dispose();
164
- if (this.workerSourceURL)
165
- URL.revokeObjectURL(this.workerSourceURL);
166
- _activeLoaders--;
167
- return this;
168
- }
169
- };
170
- let KTX2Loader = _KTX2Loader;
171
- /* CONSTANTS */
172
- __publicField(KTX2Loader, "BasisFormat", {
173
- ETC1S: 0,
174
- UASTC_4x4: 1
175
- });
176
- __publicField(KTX2Loader, "TranscoderFormat", {
177
- ETC1: 0,
178
- ETC2: 1,
179
- BC1: 2,
180
- BC3: 3,
181
- BC4: 4,
182
- BC5: 5,
183
- BC7_M6_OPAQUE_ONLY: 6,
184
- BC7_M5: 7,
185
- PVRTC1_4_RGB: 8,
186
- PVRTC1_4_RGBA: 9,
187
- ASTC_4x4: 10,
188
- ATC_RGB: 11,
189
- ATC_RGBA_INTERPOLATED_ALPHA: 12,
190
- RGBA32: 13,
191
- RGB565: 14,
192
- BGR565: 15,
193
- RGBA4444: 16
194
- });
195
- __publicField(KTX2Loader, "EngineFormat", {
196
- RGBAFormat,
197
- RGBA_ASTC_4x4_Format,
198
- RGBA_BPTC_Format,
199
- RGBA_ETC2_EAC_Format,
200
- RGBA_PVRTC_4BPPV1_Format,
201
- RGBA_S3TC_DXT5_Format,
202
- RGB_ETC1_Format,
203
- RGB_ETC2_Format,
204
- RGB_PVRTC_4BPPV1_Format,
205
- RGB_S3TC_DXT1_Format
206
- });
207
- /* WEB WORKER */
208
- __publicField(KTX2Loader, "BasisWorker", function() {
209
- let config;
210
- let transcoderPending;
211
- let BasisModule;
212
- const EngineFormat = _EngineFormat;
213
- const TranscoderFormat = _TranscoderFormat;
214
- const BasisFormat = _BasisFormat;
215
- self.addEventListener("message", function(e) {
216
- const message = e.data;
217
- switch (message.type) {
218
- case "init":
219
- config = message.config;
220
- init(message.transcoderBinary);
221
- break;
222
- case "transcode":
223
- transcoderPending.then(() => {
224
- try {
225
- const { faces, buffers, width, height, hasAlpha, format, dfdFlags } = transcode(message.buffer);
226
- self.postMessage(
227
- { type: "transcode", id: message.id, faces, width, height, hasAlpha, format, dfdFlags },
228
- buffers
229
- );
230
- } catch (error) {
231
- console.error(error);
232
- self.postMessage({ type: "error", id: message.id, error: error.message });
233
- }
62
+ init() {
63
+ if (!this.transcoderPending) {
64
+ const jsLoader = new FileLoader(this.manager);
65
+ jsLoader.setPath(this.transcoderPath);
66
+ jsLoader.setWithCredentials(this.withCredentials);
67
+ const jsContent = jsLoader.loadAsync("basis_transcoder.js");
68
+ const binaryLoader = new FileLoader(this.manager);
69
+ binaryLoader.setPath(this.transcoderPath);
70
+ binaryLoader.setResponseType("arraybuffer");
71
+ binaryLoader.setWithCredentials(this.withCredentials);
72
+ const binaryContent = binaryLoader.loadAsync("basis_transcoder.wasm");
73
+ this.transcoderPending = Promise.all([jsContent, binaryContent]).then(([jsContent2, binaryContent2]) => {
74
+ const fn = _KTX2Loader.BasisWorker.toString();
75
+ const body = [
76
+ "/* constants */",
77
+ "let _EngineFormat = " + JSON.stringify(_KTX2Loader.EngineFormat),
78
+ "let _TranscoderFormat = " + JSON.stringify(_KTX2Loader.TranscoderFormat),
79
+ "let _BasisFormat = " + JSON.stringify(_KTX2Loader.BasisFormat),
80
+ "/* basis_transcoder.js */",
81
+ jsContent2,
82
+ "/* worker */",
83
+ fn.substring(fn.indexOf("{") + 1, fn.lastIndexOf("}"))
84
+ ].join("\n");
85
+ this.workerSourceURL = URL.createObjectURL(new Blob([body]));
86
+ this.transcoderBinary = binaryContent2;
87
+ this.workerPool.setWorkerCreator(() => {
88
+ const worker = new Worker(this.workerSourceURL);
89
+ const transcoderBinary = this.transcoderBinary.slice(0);
90
+ worker.postMessage({ type: "init", config: this.workerConfig, transcoderBinary }, [transcoderBinary]);
91
+ return worker;
92
+ });
234
93
  });
235
- break;
94
+ if (_activeLoaders > 0) {
95
+ console.warn(
96
+ "THREE.KTX2Loader: Multiple active KTX2 loaders may cause performance issues. Use a single KTX2Loader instance, or call .dispose() on old instances."
97
+ );
98
+ }
99
+ _activeLoaders++;
100
+ }
101
+ return this.transcoderPending;
236
102
  }
237
- });
238
- function init(wasmBinary) {
239
- transcoderPending = new Promise((resolve) => {
240
- BasisModule = { wasmBinary, onRuntimeInitialized: resolve };
241
- BASIS(BasisModule);
242
- }).then(() => {
243
- BasisModule.initializeBasis();
244
- if (BasisModule.KTX2File === void 0) {
245
- console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.");
103
+ load(url, onLoad, onProgress, onError) {
104
+ if (this.workerConfig === null) {
105
+ throw new Error("THREE.KTX2Loader: Missing initialization with `.detectSupport( renderer )`.");
246
106
  }
247
- });
248
- }
249
- function transcode(buffer) {
250
- const ktx2File = new BasisModule.KTX2File(new Uint8Array(buffer));
251
- function cleanup() {
252
- ktx2File.close();
253
- ktx2File.delete();
107
+ const loader = new FileLoader(this.manager);
108
+ loader.setResponseType("arraybuffer");
109
+ loader.setWithCredentials(this.withCredentials);
110
+ loader.load(
111
+ url,
112
+ (buffer) => {
113
+ if (_taskCache.has(buffer)) {
114
+ const cachedTask = _taskCache.get(buffer);
115
+ return cachedTask.promise.then(onLoad).catch(onError);
116
+ }
117
+ this._createTexture(buffer).then((texture) => onLoad ? onLoad(texture) : null).catch(onError);
118
+ },
119
+ onProgress,
120
+ onError
121
+ );
254
122
  }
255
- if (!ktx2File.isValid()) {
256
- cleanup();
257
- throw new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");
123
+ _createTextureFrom(transcodeResult, container) {
124
+ const { faces, width, height, format, type, error, dfdFlags } = transcodeResult;
125
+ if (type === "error")
126
+ return Promise.reject(error);
127
+ let texture;
128
+ if (container.faceCount === 6) {
129
+ texture = new CompressedCubeTexture(faces, format, UnsignedByteType);
130
+ } else {
131
+ const mipmaps = faces[0].mipmaps;
132
+ texture = container.layerCount > 1 ? new CompressedArrayTexture(mipmaps, width, height, container.layerCount, format, UnsignedByteType) : new CompressedTexture(mipmaps, width, height, format, UnsignedByteType);
133
+ }
134
+ texture.minFilter = faces[0].mipmaps.length === 1 ? LinearFilter : LinearMipmapLinearFilter;
135
+ texture.magFilter = LinearFilter;
136
+ texture.generateMipmaps = false;
137
+ texture.needsUpdate = true;
138
+ const colorSpace = parseColorSpace(container);
139
+ if ("colorSpace" in texture)
140
+ texture.colorSpace = colorSpace;
141
+ else
142
+ texture.encoding = colorSpace === SRGBColorSpace ? sRGBEncoding : LinearEncoding;
143
+ texture.premultiplyAlpha = !!(dfdFlags & KHR_DF_FLAG_ALPHA_PREMULTIPLIED);
144
+ return texture;
258
145
  }
259
- const basisFormat = ktx2File.isUASTC() ? BasisFormat.UASTC_4x4 : BasisFormat.ETC1S;
260
- const width = ktx2File.getWidth();
261
- const height = ktx2File.getHeight();
262
- const layerCount = ktx2File.getLayers() || 1;
263
- const levelCount = ktx2File.getLevels();
264
- const faceCount = ktx2File.getFaces();
265
- const hasAlpha = ktx2File.getHasAlpha();
266
- const dfdFlags = ktx2File.getDFDFlags();
267
- const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha);
268
- if (!width || !height || !levelCount) {
269
- cleanup();
270
- throw new Error("THREE.KTX2Loader: Invalid texture");
146
+ /**
147
+ * @param {ArrayBuffer} buffer
148
+ * @param {object?} config
149
+ * @return {Promise<CompressedTexture|CompressedArrayTexture|DataTexture|Data3DTexture>}
150
+ */
151
+ async _createTexture(buffer, config = {}) {
152
+ const container = read(new Uint8Array(buffer));
153
+ if (container.vkFormat !== VK_FORMAT_UNDEFINED) {
154
+ return createRawTexture(container);
155
+ }
156
+ const taskConfig = config;
157
+ const texturePending = this.init().then(() => {
158
+ return this.workerPool.postMessage({ type: "transcode", buffer, taskConfig }, [buffer]);
159
+ }).then((e) => this._createTextureFrom(e.data, container));
160
+ _taskCache.set(buffer, { promise: texturePending });
161
+ return texturePending;
271
162
  }
272
- if (!ktx2File.startTranscoding()) {
273
- cleanup();
274
- throw new Error("THREE.KTX2Loader: .startTranscoding failed");
163
+ dispose() {
164
+ this.workerPool.dispose();
165
+ if (this.workerSourceURL)
166
+ URL.revokeObjectURL(this.workerSourceURL);
167
+ _activeLoaders--;
168
+ return this;
275
169
  }
276
- const faces = [];
277
- const buffers = [];
278
- for (let face = 0; face < faceCount; face++) {
279
- const mipmaps = [];
280
- for (let mip = 0; mip < levelCount; mip++) {
281
- const layerMips = [];
282
- let mipWidth, mipHeight;
283
- for (let layer = 0; layer < layerCount; layer++) {
284
- const levelInfo = ktx2File.getImageLevelInfo(mip, layer, face);
285
- if (face === 0 && mip === 0 && layer === 0 && (levelInfo.origWidth % 4 !== 0 || levelInfo.origHeight % 4 !== 0)) {
286
- console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions.");
287
- }
288
- if (levelCount > 1) {
289
- mipWidth = levelInfo.origWidth;
290
- mipHeight = levelInfo.origHeight;
291
- } else {
292
- mipWidth = levelInfo.width;
293
- mipHeight = levelInfo.height;
294
- }
295
- const dst = new Uint8Array(ktx2File.getImageTranscodedSizeInBytes(mip, layer, 0, transcoderFormat));
296
- const status = ktx2File.transcodeImage(dst, mip, layer, face, transcoderFormat, 0, -1, -1);
297
- if (!status) {
298
- cleanup();
299
- throw new Error("THREE.KTX2Loader: .transcodeImage failed.");
170
+ };
171
+ let KTX2Loader2 = _KTX2Loader;
172
+ /* CONSTANTS */
173
+ __publicField(KTX2Loader2, "BasisFormat", {
174
+ ETC1S: 0,
175
+ UASTC_4x4: 1
176
+ });
177
+ __publicField(KTX2Loader2, "TranscoderFormat", {
178
+ ETC1: 0,
179
+ ETC2: 1,
180
+ BC1: 2,
181
+ BC3: 3,
182
+ BC4: 4,
183
+ BC5: 5,
184
+ BC7_M6_OPAQUE_ONLY: 6,
185
+ BC7_M5: 7,
186
+ PVRTC1_4_RGB: 8,
187
+ PVRTC1_4_RGBA: 9,
188
+ ASTC_4x4: 10,
189
+ ATC_RGB: 11,
190
+ ATC_RGBA_INTERPOLATED_ALPHA: 12,
191
+ RGBA32: 13,
192
+ RGB565: 14,
193
+ BGR565: 15,
194
+ RGBA4444: 16
195
+ });
196
+ __publicField(KTX2Loader2, "EngineFormat", {
197
+ RGBAFormat,
198
+ RGBA_ASTC_4x4_Format,
199
+ RGBA_BPTC_Format,
200
+ RGBA_ETC2_EAC_Format,
201
+ RGBA_PVRTC_4BPPV1_Format,
202
+ RGBA_S3TC_DXT5_Format,
203
+ RGB_ETC1_Format,
204
+ RGB_ETC2_Format,
205
+ RGB_PVRTC_4BPPV1_Format,
206
+ RGB_S3TC_DXT1_Format
207
+ });
208
+ /* WEB WORKER */
209
+ __publicField(KTX2Loader2, "BasisWorker", function() {
210
+ let config;
211
+ let transcoderPending;
212
+ let BasisModule;
213
+ const EngineFormat = _EngineFormat;
214
+ const TranscoderFormat = _TranscoderFormat;
215
+ const BasisFormat = _BasisFormat;
216
+ self.addEventListener("message", function(e) {
217
+ const message = e.data;
218
+ switch (message.type) {
219
+ case "init":
220
+ config = message.config;
221
+ init(message.transcoderBinary);
222
+ break;
223
+ case "transcode":
224
+ transcoderPending.then(() => {
225
+ try {
226
+ const { faces, buffers, width, height, hasAlpha, format, dfdFlags } = transcode(message.buffer);
227
+ self.postMessage(
228
+ { type: "transcode", id: message.id, faces, width, height, hasAlpha, format, dfdFlags },
229
+ buffers
230
+ );
231
+ } catch (error) {
232
+ console.error(error);
233
+ self.postMessage({ type: "error", id: message.id, error: error.message });
234
+ }
235
+ });
236
+ break;
237
+ }
238
+ });
239
+ function init(wasmBinary) {
240
+ transcoderPending = new Promise((resolve) => {
241
+ BasisModule = { wasmBinary, onRuntimeInitialized: resolve };
242
+ BASIS(BasisModule);
243
+ }).then(() => {
244
+ BasisModule.initializeBasis();
245
+ if (BasisModule.KTX2File === void 0) {
246
+ console.warn("THREE.KTX2Loader: Please update Basis Universal transcoder.");
247
+ }
248
+ });
249
+ }
250
+ function transcode(buffer) {
251
+ const ktx2File = new BasisModule.KTX2File(new Uint8Array(buffer));
252
+ function cleanup() {
253
+ ktx2File.close();
254
+ ktx2File.delete();
255
+ }
256
+ if (!ktx2File.isValid()) {
257
+ cleanup();
258
+ throw new Error("THREE.KTX2Loader: Invalid or unsupported .ktx2 file");
259
+ }
260
+ const basisFormat = ktx2File.isUASTC() ? BasisFormat.UASTC_4x4 : BasisFormat.ETC1S;
261
+ const width = ktx2File.getWidth();
262
+ const height = ktx2File.getHeight();
263
+ const layerCount = ktx2File.getLayers() || 1;
264
+ const levelCount = ktx2File.getLevels();
265
+ const faceCount = ktx2File.getFaces();
266
+ const hasAlpha = ktx2File.getHasAlpha();
267
+ const dfdFlags = ktx2File.getDFDFlags();
268
+ const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha);
269
+ if (!width || !height || !levelCount) {
270
+ cleanup();
271
+ throw new Error("THREE.KTX2Loader: Invalid texture");
272
+ }
273
+ if (!ktx2File.startTranscoding()) {
274
+ cleanup();
275
+ throw new Error("THREE.KTX2Loader: .startTranscoding failed");
276
+ }
277
+ const faces = [];
278
+ const buffers = [];
279
+ for (let face = 0; face < faceCount; face++) {
280
+ const mipmaps = [];
281
+ for (let mip = 0; mip < levelCount; mip++) {
282
+ const layerMips = [];
283
+ let mipWidth, mipHeight;
284
+ for (let layer = 0; layer < layerCount; layer++) {
285
+ const levelInfo = ktx2File.getImageLevelInfo(mip, layer, face);
286
+ if (face === 0 && mip === 0 && layer === 0 && (levelInfo.origWidth % 4 !== 0 || levelInfo.origHeight % 4 !== 0)) {
287
+ console.warn("THREE.KTX2Loader: ETC1S and UASTC textures should use multiple-of-four dimensions.");
288
+ }
289
+ if (levelCount > 1) {
290
+ mipWidth = levelInfo.origWidth;
291
+ mipHeight = levelInfo.origHeight;
292
+ } else {
293
+ mipWidth = levelInfo.width;
294
+ mipHeight = levelInfo.height;
295
+ }
296
+ const dst = new Uint8Array(ktx2File.getImageTranscodedSizeInBytes(mip, layer, 0, transcoderFormat));
297
+ const status = ktx2File.transcodeImage(dst, mip, layer, face, transcoderFormat, 0, -1, -1);
298
+ if (!status) {
299
+ cleanup();
300
+ throw new Error("THREE.KTX2Loader: .transcodeImage failed.");
301
+ }
302
+ layerMips.push(dst);
300
303
  }
301
- layerMips.push(dst);
304
+ const mipData = concat(layerMips);
305
+ mipmaps.push({ data: mipData, width: mipWidth, height: mipHeight });
306
+ buffers.push(mipData.buffer);
302
307
  }
303
- const mipData = concat(layerMips);
304
- mipmaps.push({ data: mipData, width: mipWidth, height: mipHeight });
305
- buffers.push(mipData.buffer);
308
+ faces.push({ mipmaps, width, height, format: engineFormat });
306
309
  }
307
- faces.push({ mipmaps, width, height, format: engineFormat });
308
- }
309
- cleanup();
310
- return { faces, buffers, width, height, hasAlpha, format: engineFormat, dfdFlags };
311
- }
312
- const FORMAT_OPTIONS = [
313
- {
314
- if: "astcSupported",
315
- basisFormat: [BasisFormat.UASTC_4x4],
316
- transcoderFormat: [TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4],
317
- engineFormat: [EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format],
318
- priorityETC1S: Infinity,
319
- priorityUASTC: 1,
320
- needsPowerOfTwo: false
321
- },
322
- {
323
- if: "bptcSupported",
324
- basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
325
- transcoderFormat: [TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5],
326
- engineFormat: [EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format],
327
- priorityETC1S: 3,
328
- priorityUASTC: 2,
329
- needsPowerOfTwo: false
330
- },
331
- {
332
- if: "dxtSupported",
333
- basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
334
- transcoderFormat: [TranscoderFormat.BC1, TranscoderFormat.BC3],
335
- engineFormat: [EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],
336
- priorityETC1S: 4,
337
- priorityUASTC: 5,
338
- needsPowerOfTwo: false
339
- },
340
- {
341
- if: "etc2Supported",
342
- basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
343
- transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC2],
344
- engineFormat: [EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format],
345
- priorityETC1S: 1,
346
- priorityUASTC: 3,
347
- needsPowerOfTwo: false
348
- },
349
- {
350
- if: "etc1Supported",
351
- basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
352
- transcoderFormat: [TranscoderFormat.ETC1],
353
- engineFormat: [EngineFormat.RGB_ETC1_Format],
354
- priorityETC1S: 2,
355
- priorityUASTC: 4,
356
- needsPowerOfTwo: false
357
- },
358
- {
359
- if: "pvrtcSupported",
360
- basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
361
- transcoderFormat: [TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA],
362
- engineFormat: [EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format],
363
- priorityETC1S: 5,
364
- priorityUASTC: 6,
365
- needsPowerOfTwo: true
310
+ cleanup();
311
+ return { faces, buffers, width, height, hasAlpha, format: engineFormat, dfdFlags };
366
312
  }
367
- ];
368
- const ETC1S_OPTIONS = FORMAT_OPTIONS.sort(function(a, b) {
369
- return a.priorityETC1S - b.priorityETC1S;
370
- });
371
- const UASTC_OPTIONS = FORMAT_OPTIONS.sort(function(a, b) {
372
- return a.priorityUASTC - b.priorityUASTC;
373
- });
374
- function getTranscoderFormat(basisFormat, width, height, hasAlpha) {
375
- let transcoderFormat;
376
- let engineFormat;
377
- const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS;
378
- for (let i = 0; i < options.length; i++) {
379
- const opt = options[i];
380
- if (!config[opt.if])
381
- continue;
382
- if (!opt.basisFormat.includes(basisFormat))
383
- continue;
384
- if (hasAlpha && opt.transcoderFormat.length < 2)
385
- continue;
386
- if (opt.needsPowerOfTwo && !(isPowerOfTwo(width) && isPowerOfTwo(height)))
387
- continue;
388
- transcoderFormat = opt.transcoderFormat[hasAlpha ? 1 : 0];
389
- engineFormat = opt.engineFormat[hasAlpha ? 1 : 0];
313
+ const FORMAT_OPTIONS = [
314
+ {
315
+ if: "astcSupported",
316
+ basisFormat: [BasisFormat.UASTC_4x4],
317
+ transcoderFormat: [TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4],
318
+ engineFormat: [EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format],
319
+ priorityETC1S: Infinity,
320
+ priorityUASTC: 1,
321
+ needsPowerOfTwo: false
322
+ },
323
+ {
324
+ if: "bptcSupported",
325
+ basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
326
+ transcoderFormat: [TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5],
327
+ engineFormat: [EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format],
328
+ priorityETC1S: 3,
329
+ priorityUASTC: 2,
330
+ needsPowerOfTwo: false
331
+ },
332
+ {
333
+ if: "dxtSupported",
334
+ basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
335
+ transcoderFormat: [TranscoderFormat.BC1, TranscoderFormat.BC3],
336
+ engineFormat: [EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],
337
+ priorityETC1S: 4,
338
+ priorityUASTC: 5,
339
+ needsPowerOfTwo: false
340
+ },
341
+ {
342
+ if: "etc2Supported",
343
+ basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
344
+ transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC2],
345
+ engineFormat: [EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format],
346
+ priorityETC1S: 1,
347
+ priorityUASTC: 3,
348
+ needsPowerOfTwo: false
349
+ },
350
+ {
351
+ if: "etc1Supported",
352
+ basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
353
+ transcoderFormat: [TranscoderFormat.ETC1],
354
+ engineFormat: [EngineFormat.RGB_ETC1_Format],
355
+ priorityETC1S: 2,
356
+ priorityUASTC: 4,
357
+ needsPowerOfTwo: false
358
+ },
359
+ {
360
+ if: "pvrtcSupported",
361
+ basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
362
+ transcoderFormat: [TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA],
363
+ engineFormat: [EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format],
364
+ priorityETC1S: 5,
365
+ priorityUASTC: 6,
366
+ needsPowerOfTwo: true
367
+ }
368
+ ];
369
+ const ETC1S_OPTIONS = FORMAT_OPTIONS.sort(function(a, b) {
370
+ return a.priorityETC1S - b.priorityETC1S;
371
+ });
372
+ const UASTC_OPTIONS = FORMAT_OPTIONS.sort(function(a, b) {
373
+ return a.priorityUASTC - b.priorityUASTC;
374
+ });
375
+ function getTranscoderFormat(basisFormat, width, height, hasAlpha) {
376
+ let transcoderFormat;
377
+ let engineFormat;
378
+ const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS;
379
+ for (let i = 0; i < options.length; i++) {
380
+ const opt = options[i];
381
+ if (!config[opt.if])
382
+ continue;
383
+ if (!opt.basisFormat.includes(basisFormat))
384
+ continue;
385
+ if (hasAlpha && opt.transcoderFormat.length < 2)
386
+ continue;
387
+ if (opt.needsPowerOfTwo && !(isPowerOfTwo(width) && isPowerOfTwo(height)))
388
+ continue;
389
+ transcoderFormat = opt.transcoderFormat[hasAlpha ? 1 : 0];
390
+ engineFormat = opt.engineFormat[hasAlpha ? 1 : 0];
391
+ return { transcoderFormat, engineFormat };
392
+ }
393
+ console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32.");
394
+ transcoderFormat = TranscoderFormat.RGBA32;
395
+ engineFormat = EngineFormat.RGBAFormat;
390
396
  return { transcoderFormat, engineFormat };
391
397
  }
392
- console.warn("THREE.KTX2Loader: No suitable compressed texture format found. Decoding to RGBA32.");
393
- transcoderFormat = TranscoderFormat.RGBA32;
394
- engineFormat = EngineFormat.RGBAFormat;
395
- return { transcoderFormat, engineFormat };
396
- }
397
- function isPowerOfTwo(value) {
398
- if (value <= 2)
399
- return true;
400
- return (value & value - 1) === 0 && value !== 0;
401
- }
402
- function concat(arrays) {
403
- if (arrays.length === 1)
404
- return arrays[0];
405
- let totalByteLength = 0;
406
- for (let i = 0; i < arrays.length; i++) {
407
- const array = arrays[i];
408
- totalByteLength += array.byteLength;
398
+ function isPowerOfTwo(value) {
399
+ if (value <= 2)
400
+ return true;
401
+ return (value & value - 1) === 0 && value !== 0;
409
402
  }
410
- const result = new Uint8Array(totalByteLength);
411
- let byteOffset = 0;
412
- for (let i = 0; i < arrays.length; i++) {
413
- const array = arrays[i];
414
- result.set(array, byteOffset);
415
- byteOffset += array.byteLength;
403
+ function concat(arrays) {
404
+ if (arrays.length === 1)
405
+ return arrays[0];
406
+ let totalByteLength = 0;
407
+ for (let i = 0; i < arrays.length; i++) {
408
+ const array = arrays[i];
409
+ totalByteLength += array.byteLength;
410
+ }
411
+ const result = new Uint8Array(totalByteLength);
412
+ let byteOffset = 0;
413
+ for (let i = 0; i < arrays.length; i++) {
414
+ const array = arrays[i];
415
+ result.set(array, byteOffset);
416
+ byteOffset += array.byteLength;
417
+ }
418
+ return result;
416
419
  }
417
- return result;
418
- }
419
- });
420
+ });
421
+ return KTX2Loader2;
422
+ })();
420
423
  const UNCOMPRESSED_FORMATS = /* @__PURE__ */ new Set([RGBAFormat, RGFormat, RedFormat]);
421
424
  const FORMAT_MAP = {
422
425
  [VK_FORMAT_R32G32B32A32_SFLOAT]: RGBAFormat,