three-stdlib 2.35.4 → 2.35.5

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 +17 -20
  2. package/_polyfill/CapsuleGeometry.cjs.map +1 -1
  3. package/_polyfill/CapsuleGeometry.js +17 -20
  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 +715 -722
  50. package/deprecated/Geometry.cjs.map +1 -1
  51. package/deprecated/Geometry.js +716 -723
  52. package/deprecated/Geometry.js.map +1 -1
  53. package/effects/AnaglyphEffect.cjs +1 -2
  54. package/effects/AnaglyphEffect.cjs.map +1 -1
  55. package/effects/AnaglyphEffect.js +2 -3
  56. package/effects/AnaglyphEffect.js.map +1 -1
  57. package/effects/OutlineEffect.cjs +1 -2
  58. package/effects/OutlineEffect.cjs.map +1 -1
  59. package/effects/OutlineEffect.js +2 -3
  60. package/effects/OutlineEffect.js.map +1 -1
  61. package/effects/ParallaxBarrierEffect.cjs +1 -2
  62. package/effects/ParallaxBarrierEffect.cjs.map +1 -1
  63. package/effects/ParallaxBarrierEffect.js +2 -3
  64. package/effects/ParallaxBarrierEffect.js.map +1 -1
  65. package/exporters/DRACOExporter.cjs +122 -133
  66. package/exporters/DRACOExporter.cjs.map +1 -1
  67. package/exporters/DRACOExporter.d.ts +21 -23
  68. package/exporters/DRACOExporter.js +122 -133
  69. package/exporters/DRACOExporter.js.map +1 -1
  70. package/exporters/GLTFExporter.cjs +167 -170
  71. package/exporters/GLTFExporter.cjs.map +1 -1
  72. package/exporters/GLTFExporter.js +167 -170
  73. package/exporters/GLTFExporter.js.map +1 -1
  74. package/geometries/LightningStrike.cjs +515 -524
  75. package/geometries/LightningStrike.cjs.map +1 -1
  76. package/geometries/LightningStrike.js +515 -524
  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 +1 -2
  123. package/lines/LineMaterial.cjs.map +1 -1
  124. package/lines/LineMaterial.js +2 -3
  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 +435 -441
  139. package/loaders/BasisTextureLoader.cjs.map +1 -1
  140. package/loaders/BasisTextureLoader.js +435 -441
  141. package/loaders/BasisTextureLoader.js.map +1 -1
  142. package/loaders/EXRLoader.cjs +1 -2
  143. package/loaders/EXRLoader.cjs.map +1 -1
  144. package/loaders/EXRLoader.js +2 -3
  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 +374 -377
  160. package/loaders/KTX2Loader.cjs.map +1 -1
  161. package/loaders/KTX2Loader.js +374 -377
  162. package/loaders/KTX2Loader.js.map +1 -1
  163. package/loaders/LDrawLoader.cjs +4 -5
  164. package/loaders/LDrawLoader.cjs.map +1 -1
  165. package/loaders/LDrawLoader.js +5 -6
  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 +43 -46
  172. package/loaders/PRWMLoader.cjs.map +1 -1
  173. package/loaders/PRWMLoader.js +43 -46
  174. package/loaders/PRWMLoader.js.map +1 -1
  175. package/loaders/SVGLoader.cjs +1688 -1694
  176. package/loaders/SVGLoader.cjs.map +1 -1
  177. package/loaders/SVGLoader.js +1688 -1694
  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 +50 -53
  192. package/math/ConvexHull.cjs.map +1 -1
  193. package/math/ConvexHull.js +50 -53
  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 +268 -271
  212. package/misc/ConvexObjectBreaker.cjs.map +1 -1
  213. package/misc/ConvexObjectBreaker.js +269 -272
  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 +1 -2
  232. package/objects/GroundProjectedEnv.cjs.map +1 -1
  233. package/objects/GroundProjectedEnv.js +2 -3
  234. package/objects/GroundProjectedEnv.js.map +1 -1
  235. package/objects/Lensflare.cjs +206 -209
  236. package/objects/Lensflare.cjs.map +1 -1
  237. package/objects/Lensflare.js +206 -209
  238. package/objects/Lensflare.js.map +1 -1
  239. package/objects/Reflector.cjs +146 -154
  240. package/objects/Reflector.cjs.map +1 -1
  241. package/objects/Reflector.js +146 -154
  242. package/objects/Reflector.js.map +1 -1
  243. package/objects/ReflectorForSSRPass.cjs +180 -183
  244. package/objects/ReflectorForSSRPass.cjs.map +1 -1
  245. package/objects/ReflectorForSSRPass.js +180 -183
  246. package/objects/ReflectorForSSRPass.js.map +1 -1
  247. package/objects/Refractor.cjs +161 -164
  248. package/objects/Refractor.cjs.map +1 -1
  249. package/objects/Refractor.js +161 -164
  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 +32 -35
  256. package/objects/Sky.cjs.map +1 -1
  257. package/objects/Sky.d.ts +6 -100
  258. package/objects/Sky.js +32 -35
  259. package/objects/Sky.js.map +1 -1
  260. package/objects/Water.cjs +1 -2
  261. package/objects/Water.cjs.map +1 -1
  262. package/objects/Water.js +2 -3
  263. package/objects/Water.js.map +1 -1
  264. package/objects/Water2.cjs +140 -143
  265. package/objects/Water2.cjs.map +1 -1
  266. package/objects/Water2.js +140 -143
  267. package/objects/Water2.js.map +1 -1
  268. package/package.json +1 -1
  269. package/postprocessing/SAOPass.cjs +264 -267
  270. package/postprocessing/SAOPass.cjs.map +1 -1
  271. package/postprocessing/SAOPass.js +264 -267
  272. package/postprocessing/SAOPass.js.map +1 -1
  273. package/postprocessing/SSAOPass.cjs +250 -253
  274. package/postprocessing/SSAOPass.cjs.map +1 -1
  275. package/postprocessing/SSAOPass.js +250 -253
  276. package/postprocessing/SSAOPass.js.map +1 -1
  277. package/postprocessing/SSRPass.cjs +376 -379
  278. package/postprocessing/SSRPass.cjs.map +1 -1
  279. package/postprocessing/SSRPass.js +376 -379
  280. package/postprocessing/SSRPass.js.map +1 -1
  281. package/postprocessing/UnrealBloomPass.cjs +202 -205
  282. package/postprocessing/UnrealBloomPass.cjs.map +1 -1
  283. package/postprocessing/UnrealBloomPass.js +202 -205
  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 +46 -71
  294. package/shaders/ACESFilmicToneMappingShader.cjs.map +1 -1
  295. package/shaders/ACESFilmicToneMappingShader.js +46 -71
  296. package/shaders/ACESFilmicToneMappingShader.js.map +1 -1
  297. package/shaders/AfterimageShader.cjs +22 -41
  298. package/shaders/AfterimageShader.cjs.map +1 -1
  299. package/shaders/AfterimageShader.js +22 -41
  300. package/shaders/AfterimageShader.js.map +1 -1
  301. package/shaders/BasicShader.cjs +6 -20
  302. package/shaders/BasicShader.cjs.map +1 -1
  303. package/shaders/BasicShader.js +6 -20
  304. package/shaders/BasicShader.js.map +1 -1
  305. package/shaders/BleachBypassShader.cjs +26 -46
  306. package/shaders/BleachBypassShader.cjs.map +1 -1
  307. package/shaders/BleachBypassShader.js +26 -46
  308. package/shaders/BleachBypassShader.js.map +1 -1
  309. package/shaders/BlendShader.cjs +19 -33
  310. package/shaders/BlendShader.cjs.map +1 -1
  311. package/shaders/BlendShader.js +19 -33
  312. package/shaders/BlendShader.js.map +1 -1
  313. package/shaders/BokehShader.cjs +90 -117
  314. package/shaders/BokehShader.cjs.map +1 -1
  315. package/shaders/BokehShader.js +90 -117
  316. package/shaders/BokehShader.js.map +1 -1
  317. package/shaders/BokehShader2.cjs +232 -333
  318. package/shaders/BokehShader2.cjs.map +1 -1
  319. package/shaders/BokehShader2.js +232 -333
  320. package/shaders/BokehShader2.js.map +1 -1
  321. package/shaders/BrightnessContrastShader.cjs +22 -38
  322. package/shaders/BrightnessContrastShader.cjs.map +1 -1
  323. package/shaders/BrightnessContrastShader.js +22 -38
  324. package/shaders/BrightnessContrastShader.js.map +1 -1
  325. package/shaders/ColorCorrectionShader.cjs +21 -35
  326. package/shaders/ColorCorrectionShader.cjs.map +1 -1
  327. package/shaders/ColorCorrectionShader.js +21 -35
  328. package/shaders/ColorCorrectionShader.js.map +1 -1
  329. package/shaders/ColorifyShader.cjs +19 -34
  330. package/shaders/ColorifyShader.cjs.map +1 -1
  331. package/shaders/ColorifyShader.js +19 -34
  332. package/shaders/ColorifyShader.js.map +1 -1
  333. package/shaders/ConvolutionShader.cjs +24 -43
  334. package/shaders/ConvolutionShader.cjs.map +1 -1
  335. package/shaders/ConvolutionShader.js +24 -43
  336. package/shaders/ConvolutionShader.js.map +1 -1
  337. package/shaders/CopyShader.cjs +16 -30
  338. package/shaders/CopyShader.cjs.map +1 -1
  339. package/shaders/CopyShader.js +16 -30
  340. package/shaders/CopyShader.js.map +1 -1
  341. package/shaders/DOFMipMapShader.cjs +21 -38
  342. package/shaders/DOFMipMapShader.cjs.map +1 -1
  343. package/shaders/DOFMipMapShader.js +21 -38
  344. package/shaders/DOFMipMapShader.js.map +1 -1
  345. package/shaders/DepthLimitedBlurShader.cjs +69 -98
  346. package/shaders/DepthLimitedBlurShader.cjs.map +1 -1
  347. package/shaders/DepthLimitedBlurShader.js +69 -98
  348. package/shaders/DepthLimitedBlurShader.js.map +1 -1
  349. package/shaders/DigitalGlitch.cjs +59 -70
  350. package/shaders/DigitalGlitch.cjs.map +1 -1
  351. package/shaders/DigitalGlitch.js +59 -70
  352. package/shaders/DigitalGlitch.js.map +1 -1
  353. package/shaders/DotScreenShader.cjs +28 -49
  354. package/shaders/DotScreenShader.cjs.map +1 -1
  355. package/shaders/DotScreenShader.js +28 -49
  356. package/shaders/DotScreenShader.js.map +1 -1
  357. package/shaders/FXAAShader.cjs +1089 -1098
  358. package/shaders/FXAAShader.cjs.map +1 -1
  359. package/shaders/FXAAShader.js +1089 -1098
  360. package/shaders/FXAAShader.js.map +1 -1
  361. package/shaders/FilmShader.cjs +29 -57
  362. package/shaders/FilmShader.cjs.map +1 -1
  363. package/shaders/FilmShader.js +29 -57
  364. package/shaders/FilmShader.js.map +1 -1
  365. package/shaders/FocusShader.cjs +43 -70
  366. package/shaders/FocusShader.cjs.map +1 -1
  367. package/shaders/FocusShader.js +43 -70
  368. package/shaders/FocusShader.js.map +1 -1
  369. package/shaders/FreiChenShader.cjs +53 -74
  370. package/shaders/FreiChenShader.cjs.map +1 -1
  371. package/shaders/FreiChenShader.js +53 -74
  372. package/shaders/FreiChenShader.js.map +1 -1
  373. package/shaders/FresnelShader.cjs +35 -55
  374. package/shaders/FresnelShader.cjs.map +1 -1
  375. package/shaders/FresnelShader.js +35 -55
  376. package/shaders/FresnelShader.js.map +1 -1
  377. package/shaders/GammaCorrectionShader.cjs +19 -33
  378. package/shaders/GammaCorrectionShader.cjs.map +1 -1
  379. package/shaders/GammaCorrectionShader.js +19 -33
  380. package/shaders/GammaCorrectionShader.js.map +1 -1
  381. package/shaders/GodRaysShader.cjs +116 -193
  382. package/shaders/GodRaysShader.cjs.map +1 -1
  383. package/shaders/GodRaysShader.js +116 -193
  384. package/shaders/GodRaysShader.js.map +1 -1
  385. package/shaders/HalftoneShader.cjs +192 -270
  386. package/shaders/HalftoneShader.cjs.map +1 -1
  387. package/shaders/HalftoneShader.js +192 -270
  388. package/shaders/HalftoneShader.js.map +1 -1
  389. package/shaders/HorizontalTiltShiftShader.cjs +27 -43
  390. package/shaders/HorizontalTiltShiftShader.cjs.map +1 -1
  391. package/shaders/HorizontalTiltShiftShader.js +27 -43
  392. package/shaders/HorizontalTiltShiftShader.js.map +1 -1
  393. package/shaders/HueSaturationShader.cjs +31 -47
  394. package/shaders/HueSaturationShader.cjs.map +1 -1
  395. package/shaders/HueSaturationShader.js +31 -47
  396. package/shaders/HueSaturationShader.js.map +1 -1
  397. package/shaders/KaleidoShader.cjs +24 -37
  398. package/shaders/KaleidoShader.cjs.map +1 -1
  399. package/shaders/KaleidoShader.js +24 -37
  400. package/shaders/KaleidoShader.js.map +1 -1
  401. package/shaders/LuminosityHighPassShader.cjs +24 -43
  402. package/shaders/LuminosityHighPassShader.cjs.map +1 -1
  403. package/shaders/LuminosityHighPassShader.js +24 -43
  404. package/shaders/LuminosityHighPassShader.js.map +1 -1
  405. package/shaders/LuminosityShader.cjs +17 -34
  406. package/shaders/LuminosityShader.cjs.map +1 -1
  407. package/shaders/LuminosityShader.js +17 -34
  408. package/shaders/LuminosityShader.js.map +1 -1
  409. package/shaders/MirrorShader.cjs +26 -39
  410. package/shaders/MirrorShader.cjs.map +1 -1
  411. package/shaders/MirrorShader.js +26 -39
  412. package/shaders/MirrorShader.js.map +1 -1
  413. package/shaders/NormalMapShader.cjs +21 -36
  414. package/shaders/NormalMapShader.cjs.map +1 -1
  415. package/shaders/NormalMapShader.js +21 -36
  416. package/shaders/NormalMapShader.js.map +1 -1
  417. package/shaders/ParallaxShader.cjs +97 -147
  418. package/shaders/ParallaxShader.cjs.map +1 -1
  419. package/shaders/ParallaxShader.js +97 -147
  420. package/shaders/ParallaxShader.js.map +1 -1
  421. package/shaders/PixelShader.cjs +18 -31
  422. package/shaders/PixelShader.cjs.map +1 -1
  423. package/shaders/PixelShader.js +18 -31
  424. package/shaders/PixelShader.js.map +1 -1
  425. package/shaders/RGBShiftShader.cjs +20 -33
  426. package/shaders/RGBShiftShader.cjs.map +1 -1
  427. package/shaders/RGBShiftShader.js +20 -33
  428. package/shaders/RGBShiftShader.js.map +1 -1
  429. package/shaders/SAOShader.cjs +117 -154
  430. package/shaders/SAOShader.cjs.map +1 -1
  431. package/shaders/SAOShader.js +117 -154
  432. package/shaders/SAOShader.js.map +1 -1
  433. package/shaders/SMAAShader.cjs +270 -358
  434. package/shaders/SMAAShader.cjs.map +1 -1
  435. package/shaders/SMAAShader.js +270 -358
  436. package/shaders/SMAAShader.js.map +1 -1
  437. package/shaders/SSAOShader.cjs +142 -236
  438. package/shaders/SSAOShader.cjs.map +1 -1
  439. package/shaders/SSAOShader.js +142 -236
  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 +20 -36
  446. package/shaders/SepiaShader.cjs.map +1 -1
  447. package/shaders/SepiaShader.js +20 -36
  448. package/shaders/SepiaShader.js.map +1 -1
  449. package/shaders/SobelOperatorShader.cjs +37 -64
  450. package/shaders/SobelOperatorShader.cjs.map +1 -1
  451. package/shaders/SobelOperatorShader.js +37 -64
  452. package/shaders/SobelOperatorShader.js.map +1 -1
  453. package/shaders/TechnicolorShader.cjs +16 -29
  454. package/shaders/TechnicolorShader.cjs.map +1 -1
  455. package/shaders/TechnicolorShader.js +16 -29
  456. package/shaders/TechnicolorShader.js.map +1 -1
  457. package/shaders/ToneMapShader.cjs +35 -55
  458. package/shaders/ToneMapShader.cjs.map +1 -1
  459. package/shaders/ToneMapShader.js +35 -55
  460. package/shaders/ToneMapShader.js.map +1 -1
  461. package/shaders/ToonShader.cjs +165 -275
  462. package/shaders/ToonShader.cjs.map +1 -1
  463. package/shaders/ToonShader.js +165 -275
  464. package/shaders/ToonShader.js.map +1 -1
  465. package/shaders/TriangleBlurShader.cjs +27 -50
  466. package/shaders/TriangleBlurShader.cjs.map +1 -1
  467. package/shaders/TriangleBlurShader.js +27 -50
  468. package/shaders/TriangleBlurShader.js.map +1 -1
  469. package/shaders/UnpackDepthRGBAShader.cjs +17 -32
  470. package/shaders/UnpackDepthRGBAShader.cjs.map +1 -1
  471. package/shaders/UnpackDepthRGBAShader.js +17 -32
  472. package/shaders/UnpackDepthRGBAShader.js.map +1 -1
  473. package/shaders/VerticalTiltShiftShader.cjs +27 -43
  474. package/shaders/VerticalTiltShiftShader.cjs.map +1 -1
  475. package/shaders/VerticalTiltShiftShader.js +27 -43
  476. package/shaders/VerticalTiltShiftShader.js.map +1 -1
  477. package/shaders/VignetteShader.cjs +27 -43
  478. package/shaders/VignetteShader.cjs.map +1 -1
  479. package/shaders/VignetteShader.js +27 -43
  480. package/shaders/VignetteShader.js.map +1 -1
  481. package/shaders/VolumeShader.cjs +213 -264
  482. package/shaders/VolumeShader.cjs.map +1 -1
  483. package/shaders/VolumeShader.js +213 -264
  484. package/shaders/VolumeShader.js.map +1 -1
  485. package/shaders/WaterRefractionShader.cjs +35 -63
  486. package/shaders/WaterRefractionShader.cjs.map +1 -1
  487. package/shaders/WaterRefractionShader.js +35 -63
  488. package/shaders/WaterRefractionShader.js.map +1 -1
  489. package/utils/GeometryCompressionUtils.cjs +1 -2
  490. package/utils/GeometryCompressionUtils.cjs.map +1 -1
  491. package/utils/GeometryCompressionUtils.js +2 -3
  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 +106 -109
  498. package/webxr/ARButton.cjs.map +1 -1
  499. package/webxr/ARButton.d.ts +3 -4
  500. package/webxr/ARButton.js +106 -109
  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 +95 -98
  507. package/webxr/VRButton.cjs.map +1 -1
  508. package/webxr/VRButton.d.ts +5 -6
  509. package/webxr/VRButton.js +95 -98
  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
@@ -6,317 +6,282 @@ var __publicField = (obj, key, value) => {
6
6
  };
7
7
  import { Loader, RGBAFormat, RGBA_ASTC_4x4_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, FileLoader, CompressedTexture, UnsignedByteType, LinearFilter, LinearMipmapLinearFilter } from "three";
8
8
  const _taskCache = /* @__PURE__ */ new WeakMap();
9
- const BasisTextureLoader = /* @__PURE__ */ (() => {
10
- const _BasisTextureLoader = class extends Loader {
11
- constructor(manager) {
12
- super(manager);
13
- this.transcoderPath = "";
14
- this.transcoderBinary = null;
15
- this.transcoderPending = null;
16
- this.workerLimit = 4;
17
- this.workerPool = [];
18
- this.workerNextTaskID = 1;
19
- this.workerSourceURL = "";
20
- this.workerConfig = null;
21
- }
22
- setTranscoderPath(path) {
23
- this.transcoderPath = path;
24
- return this;
25
- }
26
- setWorkerLimit(workerLimit) {
27
- this.workerLimit = workerLimit;
28
- return this;
9
+ const _BasisTextureLoader = class extends Loader {
10
+ constructor(manager) {
11
+ super(manager);
12
+ this.transcoderPath = "";
13
+ this.transcoderBinary = null;
14
+ this.transcoderPending = null;
15
+ this.workerLimit = 4;
16
+ this.workerPool = [];
17
+ this.workerNextTaskID = 1;
18
+ this.workerSourceURL = "";
19
+ this.workerConfig = null;
20
+ }
21
+ setTranscoderPath(path) {
22
+ this.transcoderPath = path;
23
+ return this;
24
+ }
25
+ setWorkerLimit(workerLimit) {
26
+ this.workerLimit = workerLimit;
27
+ return this;
28
+ }
29
+ detectSupport(renderer) {
30
+ this.workerConfig = {
31
+ astcSupported: renderer.extensions.has("WEBGL_compressed_texture_astc"),
32
+ etc1Supported: renderer.extensions.has("WEBGL_compressed_texture_etc1"),
33
+ etc2Supported: renderer.extensions.has("WEBGL_compressed_texture_etc"),
34
+ dxtSupported: renderer.extensions.has("WEBGL_compressed_texture_s3tc"),
35
+ bptcSupported: renderer.extensions.has("EXT_texture_compression_bptc"),
36
+ pvrtcSupported: renderer.extensions.has("WEBGL_compressed_texture_pvrtc") || renderer.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")
37
+ };
38
+ return this;
39
+ }
40
+ load(url, onLoad, onProgress, onError) {
41
+ const loader = new FileLoader(this.manager);
42
+ loader.setResponseType("arraybuffer");
43
+ loader.setWithCredentials(this.withCredentials);
44
+ const texture = new CompressedTexture();
45
+ loader.load(
46
+ url,
47
+ (buffer) => {
48
+ if (_taskCache.has(buffer)) {
49
+ const cachedTask = _taskCache.get(buffer);
50
+ return cachedTask.promise.then(onLoad).catch(onError);
51
+ }
52
+ this._createTexture([buffer]).then(function(_texture) {
53
+ texture.copy(_texture);
54
+ texture.needsUpdate = true;
55
+ if (onLoad)
56
+ onLoad(texture);
57
+ }).catch(onError);
58
+ },
59
+ onProgress,
60
+ onError
61
+ );
62
+ return texture;
63
+ }
64
+ /** Low-level transcoding API, exposed for use by KTX2Loader. */
65
+ parseInternalAsync(options) {
66
+ const { levels } = options;
67
+ const buffers = /* @__PURE__ */ new Set();
68
+ for (let i = 0; i < levels.length; i++) {
69
+ buffers.add(levels[i].data.buffer);
29
70
  }
30
- detectSupport(renderer) {
31
- this.workerConfig = {
32
- astcSupported: renderer.extensions.has("WEBGL_compressed_texture_astc"),
33
- etc1Supported: renderer.extensions.has("WEBGL_compressed_texture_etc1"),
34
- etc2Supported: renderer.extensions.has("WEBGL_compressed_texture_etc"),
35
- dxtSupported: renderer.extensions.has("WEBGL_compressed_texture_s3tc"),
36
- bptcSupported: renderer.extensions.has("EXT_texture_compression_bptc"),
37
- pvrtcSupported: renderer.extensions.has("WEBGL_compressed_texture_pvrtc") || renderer.extensions.has("WEBKIT_WEBGL_compressed_texture_pvrtc")
38
- };
39
- return this;
71
+ return this._createTexture(Array.from(buffers), { ...options, lowLevel: true });
72
+ }
73
+ /**
74
+ * @param {ArrayBuffer[]} buffers
75
+ * @param {object?} config
76
+ * @return {Promise<CompressedTexture>}
77
+ */
78
+ _createTexture(buffers, config = {}) {
79
+ let worker;
80
+ let taskID;
81
+ const taskConfig = config;
82
+ let taskCost = 0;
83
+ for (let i = 0; i < buffers.length; i++) {
84
+ taskCost += buffers[i].byteLength;
40
85
  }
41
- load(url, onLoad, onProgress, onError) {
42
- const loader = new FileLoader(this.manager);
43
- loader.setResponseType("arraybuffer");
44
- loader.setWithCredentials(this.withCredentials);
45
- const texture = new CompressedTexture();
46
- loader.load(
47
- url,
48
- (buffer) => {
49
- if (_taskCache.has(buffer)) {
50
- const cachedTask = _taskCache.get(buffer);
51
- return cachedTask.promise.then(onLoad).catch(onError);
52
- }
53
- this._createTexture([buffer]).then(function(_texture) {
54
- texture.copy(_texture);
55
- texture.needsUpdate = true;
56
- if (onLoad)
57
- onLoad(texture);
58
- }).catch(onError);
59
- },
60
- onProgress,
61
- onError
62
- );
86
+ const texturePending = this._allocateWorker(taskCost).then((_worker) => {
87
+ worker = _worker;
88
+ taskID = this.workerNextTaskID++;
89
+ return new Promise((resolve, reject) => {
90
+ worker._callbacks[taskID] = { resolve, reject };
91
+ worker.postMessage({ type: "transcode", id: taskID, buffers, taskConfig }, buffers);
92
+ });
93
+ }).then((message) => {
94
+ const { mipmaps, width, height, format } = message;
95
+ const texture = new CompressedTexture(mipmaps, width, height, format, UnsignedByteType);
96
+ texture.minFilter = mipmaps.length === 1 ? LinearFilter : LinearMipmapLinearFilter;
97
+ texture.magFilter = LinearFilter;
98
+ texture.generateMipmaps = false;
99
+ texture.needsUpdate = true;
63
100
  return texture;
64
- }
65
- /** Low-level transcoding API, exposed for use by KTX2Loader. */
66
- parseInternalAsync(options) {
67
- const { levels } = options;
68
- const buffers = /* @__PURE__ */ new Set();
69
- for (let i = 0; i < levels.length; i++) {
70
- buffers.add(levels[i].data.buffer);
71
- }
72
- return this._createTexture(Array.from(buffers), { ...options, lowLevel: true });
73
- }
74
- /**
75
- * @param {ArrayBuffer[]} buffers
76
- * @param {object?} config
77
- * @return {Promise<CompressedTexture>}
78
- */
79
- _createTexture(buffers, config = {}) {
80
- let worker;
81
- let taskID;
82
- const taskConfig = config;
83
- let taskCost = 0;
84
- for (let i = 0; i < buffers.length; i++) {
85
- taskCost += buffers[i].byteLength;
101
+ });
102
+ texturePending.catch(() => true).then(() => {
103
+ if (worker && taskID) {
104
+ worker._taskLoad -= taskCost;
105
+ delete worker._callbacks[taskID];
86
106
  }
87
- const texturePending = this._allocateWorker(taskCost).then((_worker) => {
88
- worker = _worker;
89
- taskID = this.workerNextTaskID++;
90
- return new Promise((resolve, reject) => {
91
- worker._callbacks[taskID] = { resolve, reject };
92
- worker.postMessage({ type: "transcode", id: taskID, buffers, taskConfig }, buffers);
93
- });
94
- }).then((message) => {
95
- const { mipmaps, width, height, format } = message;
96
- const texture = new CompressedTexture(mipmaps, width, height, format, UnsignedByteType);
97
- texture.minFilter = mipmaps.length === 1 ? LinearFilter : LinearMipmapLinearFilter;
98
- texture.magFilter = LinearFilter;
99
- texture.generateMipmaps = false;
100
- texture.needsUpdate = true;
101
- return texture;
107
+ });
108
+ _taskCache.set(buffers[0], { promise: texturePending });
109
+ return texturePending;
110
+ }
111
+ _initTranscoder() {
112
+ if (!this.transcoderPending) {
113
+ const jsLoader = new FileLoader(this.manager);
114
+ jsLoader.setPath(this.transcoderPath);
115
+ jsLoader.setWithCredentials(this.withCredentials);
116
+ const jsContent = new Promise((resolve, reject) => {
117
+ jsLoader.load("basis_transcoder.js", resolve, void 0, reject);
102
118
  });
103
- texturePending.catch(() => true).then(() => {
104
- if (worker && taskID) {
105
- worker._taskLoad -= taskCost;
106
- delete worker._callbacks[taskID];
107
- }
119
+ const binaryLoader = new FileLoader(this.manager);
120
+ binaryLoader.setPath(this.transcoderPath);
121
+ binaryLoader.setResponseType("arraybuffer");
122
+ binaryLoader.setWithCredentials(this.withCredentials);
123
+ const binaryContent = new Promise((resolve, reject) => {
124
+ binaryLoader.load("basis_transcoder.wasm", resolve, void 0, reject);
125
+ });
126
+ this.transcoderPending = Promise.all([jsContent, binaryContent]).then(([jsContent2, binaryContent2]) => {
127
+ const fn = _BasisTextureLoader.BasisWorker.toString();
128
+ const body = [
129
+ "/* constants */",
130
+ "let _EngineFormat = " + JSON.stringify(_BasisTextureLoader.EngineFormat),
131
+ "let _TranscoderFormat = " + JSON.stringify(_BasisTextureLoader.TranscoderFormat),
132
+ "let _BasisFormat = " + JSON.stringify(_BasisTextureLoader.BasisFormat),
133
+ "/* basis_transcoder.js */",
134
+ jsContent2,
135
+ "/* worker */",
136
+ fn.substring(fn.indexOf("{") + 1, fn.lastIndexOf("}"))
137
+ ].join("\n");
138
+ this.workerSourceURL = URL.createObjectURL(new Blob([body]));
139
+ this.transcoderBinary = binaryContent2;
108
140
  });
109
- _taskCache.set(buffers[0], { promise: texturePending });
110
- return texturePending;
111
141
  }
112
- _initTranscoder() {
113
- if (!this.transcoderPending) {
114
- const jsLoader = new FileLoader(this.manager);
115
- jsLoader.setPath(this.transcoderPath);
116
- jsLoader.setWithCredentials(this.withCredentials);
117
- const jsContent = new Promise((resolve, reject) => {
118
- jsLoader.load("basis_transcoder.js", resolve, void 0, reject);
119
- });
120
- const binaryLoader = new FileLoader(this.manager);
121
- binaryLoader.setPath(this.transcoderPath);
122
- binaryLoader.setResponseType("arraybuffer");
123
- binaryLoader.setWithCredentials(this.withCredentials);
124
- const binaryContent = new Promise((resolve, reject) => {
125
- binaryLoader.load("basis_transcoder.wasm", resolve, void 0, reject);
142
+ return this.transcoderPending;
143
+ }
144
+ _allocateWorker(taskCost) {
145
+ return this._initTranscoder().then(() => {
146
+ if (this.workerPool.length < this.workerLimit) {
147
+ const worker2 = new Worker(this.workerSourceURL);
148
+ worker2._callbacks = {};
149
+ worker2._taskLoad = 0;
150
+ worker2.postMessage({
151
+ type: "init",
152
+ config: this.workerConfig,
153
+ transcoderBinary: this.transcoderBinary
126
154
  });
127
- this.transcoderPending = Promise.all([jsContent, binaryContent]).then(([jsContent2, binaryContent2]) => {
128
- const fn = _BasisTextureLoader.BasisWorker.toString();
129
- const body = [
130
- "/* constants */",
131
- "let _EngineFormat = " + JSON.stringify(_BasisTextureLoader.EngineFormat),
132
- "let _TranscoderFormat = " + JSON.stringify(_BasisTextureLoader.TranscoderFormat),
133
- "let _BasisFormat = " + JSON.stringify(_BasisTextureLoader.BasisFormat),
134
- "/* basis_transcoder.js */",
135
- jsContent2,
136
- "/* worker */",
137
- fn.substring(fn.indexOf("{") + 1, fn.lastIndexOf("}"))
138
- ].join("\n");
139
- this.workerSourceURL = URL.createObjectURL(new Blob([body]));
140
- this.transcoderBinary = binaryContent2;
155
+ worker2.onmessage = function(e) {
156
+ const message = e.data;
157
+ switch (message.type) {
158
+ case "transcode":
159
+ worker2._callbacks[message.id].resolve(message);
160
+ break;
161
+ case "error":
162
+ worker2._callbacks[message.id].reject(message);
163
+ break;
164
+ default:
165
+ console.error('THREE.BasisTextureLoader: Unexpected message, "' + message.type + '"');
166
+ }
167
+ };
168
+ this.workerPool.push(worker2);
169
+ } else {
170
+ this.workerPool.sort(function(a, b) {
171
+ return a._taskLoad > b._taskLoad ? -1 : 1;
141
172
  });
142
173
  }
143
- return this.transcoderPending;
174
+ const worker = this.workerPool[this.workerPool.length - 1];
175
+ worker._taskLoad += taskCost;
176
+ return worker;
177
+ });
178
+ }
179
+ dispose() {
180
+ for (let i = 0; i < this.workerPool.length; i++) {
181
+ this.workerPool[i].terminate();
144
182
  }
145
- _allocateWorker(taskCost) {
146
- return this._initTranscoder().then(() => {
147
- if (this.workerPool.length < this.workerLimit) {
148
- const worker2 = new Worker(this.workerSourceURL);
149
- worker2._callbacks = {};
150
- worker2._taskLoad = 0;
151
- worker2.postMessage({
152
- type: "init",
153
- config: this.workerConfig,
154
- transcoderBinary: this.transcoderBinary
155
- });
156
- worker2.onmessage = function(e) {
157
- const message = e.data;
158
- switch (message.type) {
159
- case "transcode":
160
- worker2._callbacks[message.id].resolve(message);
161
- break;
162
- case "error":
163
- worker2._callbacks[message.id].reject(message);
164
- break;
165
- default:
166
- console.error('THREE.BasisTextureLoader: Unexpected message, "' + message.type + '"');
183
+ this.workerPool.length = 0;
184
+ return this;
185
+ }
186
+ };
187
+ let BasisTextureLoader = _BasisTextureLoader;
188
+ /* CONSTANTS */
189
+ __publicField(BasisTextureLoader, "BasisFormat", {
190
+ ETC1S: 0,
191
+ UASTC_4x4: 1
192
+ });
193
+ __publicField(BasisTextureLoader, "TranscoderFormat", {
194
+ ETC1: 0,
195
+ ETC2: 1,
196
+ BC1: 2,
197
+ BC3: 3,
198
+ BC4: 4,
199
+ BC5: 5,
200
+ BC7_M6_OPAQUE_ONLY: 6,
201
+ BC7_M5: 7,
202
+ PVRTC1_4_RGB: 8,
203
+ PVRTC1_4_RGBA: 9,
204
+ ASTC_4x4: 10,
205
+ ATC_RGB: 11,
206
+ ATC_RGBA_INTERPOLATED_ALPHA: 12,
207
+ RGBA32: 13,
208
+ RGB565: 14,
209
+ BGR565: 15,
210
+ RGBA4444: 16
211
+ });
212
+ __publicField(BasisTextureLoader, "EngineFormat", {
213
+ RGBAFormat,
214
+ RGBA_ASTC_4x4_Format,
215
+ RGBA_BPTC_Format,
216
+ RGBA_ETC2_EAC_Format,
217
+ RGBA_PVRTC_4BPPV1_Format,
218
+ RGBA_S3TC_DXT5_Format,
219
+ RGB_ETC1_Format,
220
+ RGB_ETC2_Format,
221
+ RGB_PVRTC_4BPPV1_Format,
222
+ RGB_S3TC_DXT1_Format
223
+ });
224
+ /* WEB WORKER */
225
+ __publicField(BasisTextureLoader, "BasisWorker", function() {
226
+ let config;
227
+ let transcoderPending;
228
+ let BasisModule;
229
+ const EngineFormat = _EngineFormat;
230
+ const TranscoderFormat = _TranscoderFormat;
231
+ const BasisFormat = _BasisFormat;
232
+ onmessage = function(e) {
233
+ const message = e.data;
234
+ switch (message.type) {
235
+ case "init":
236
+ config = message.config;
237
+ init(message.transcoderBinary);
238
+ break;
239
+ case "transcode":
240
+ transcoderPending.then(() => {
241
+ try {
242
+ const { width, height, hasAlpha, mipmaps, format } = message.taskConfig.lowLevel ? transcodeLowLevel(message.taskConfig) : transcode(message.buffers[0]);
243
+ const buffers = [];
244
+ for (let i = 0; i < mipmaps.length; ++i) {
245
+ buffers.push(mipmaps[i].data.buffer);
167
246
  }
168
- };
169
- this.workerPool.push(worker2);
170
- } else {
171
- this.workerPool.sort(function(a, b) {
172
- return a._taskLoad > b._taskLoad ? -1 : 1;
173
- });
174
- }
175
- const worker = this.workerPool[this.workerPool.length - 1];
176
- worker._taskLoad += taskCost;
177
- return worker;
178
- });
179
- }
180
- dispose() {
181
- for (let i = 0; i < this.workerPool.length; i++) {
182
- this.workerPool[i].terminate();
183
- }
184
- this.workerPool.length = 0;
185
- return this;
247
+ self.postMessage({ type: "transcode", id: message.id, width, height, hasAlpha, mipmaps, format }, buffers);
248
+ } catch (error) {
249
+ console.error(error);
250
+ self.postMessage({ type: "error", id: message.id, error: error.message });
251
+ }
252
+ });
253
+ break;
186
254
  }
187
255
  };
188
- let BasisTextureLoader2 = _BasisTextureLoader;
189
- /* CONSTANTS */
190
- __publicField(BasisTextureLoader2, "BasisFormat", {
191
- ETC1S: 0,
192
- UASTC_4x4: 1
193
- });
194
- __publicField(BasisTextureLoader2, "TranscoderFormat", {
195
- ETC1: 0,
196
- ETC2: 1,
197
- BC1: 2,
198
- BC3: 3,
199
- BC4: 4,
200
- BC5: 5,
201
- BC7_M6_OPAQUE_ONLY: 6,
202
- BC7_M5: 7,
203
- PVRTC1_4_RGB: 8,
204
- PVRTC1_4_RGBA: 9,
205
- ASTC_4x4: 10,
206
- ATC_RGB: 11,
207
- ATC_RGBA_INTERPOLATED_ALPHA: 12,
208
- RGBA32: 13,
209
- RGB565: 14,
210
- BGR565: 15,
211
- RGBA4444: 16
212
- });
213
- __publicField(BasisTextureLoader2, "EngineFormat", {
214
- RGBAFormat,
215
- RGBA_ASTC_4x4_Format,
216
- RGBA_BPTC_Format,
217
- RGBA_ETC2_EAC_Format,
218
- RGBA_PVRTC_4BPPV1_Format,
219
- RGBA_S3TC_DXT5_Format,
220
- RGB_ETC1_Format,
221
- RGB_ETC2_Format,
222
- RGB_PVRTC_4BPPV1_Format,
223
- RGB_S3TC_DXT1_Format
224
- });
225
- /* WEB WORKER */
226
- __publicField(BasisTextureLoader2, "BasisWorker", function() {
227
- let config;
228
- let transcoderPending;
229
- let BasisModule;
230
- const EngineFormat = _EngineFormat;
231
- const TranscoderFormat = _TranscoderFormat;
232
- const BasisFormat = _BasisFormat;
233
- onmessage = function(e) {
234
- const message = e.data;
235
- switch (message.type) {
236
- case "init":
237
- config = message.config;
238
- init(message.transcoderBinary);
239
- break;
240
- case "transcode":
241
- transcoderPending.then(() => {
242
- try {
243
- const { width, height, hasAlpha, mipmaps, format } = message.taskConfig.lowLevel ? transcodeLowLevel(message.taskConfig) : transcode(message.buffers[0]);
244
- const buffers = [];
245
- for (let i = 0; i < mipmaps.length; ++i) {
246
- buffers.push(mipmaps[i].data.buffer);
247
- }
248
- self.postMessage(
249
- { type: "transcode", id: message.id, width, height, hasAlpha, mipmaps, format },
250
- buffers
251
- );
252
- } catch (error) {
253
- console.error(error);
254
- self.postMessage({ type: "error", id: message.id, error: error.message });
255
- }
256
- });
257
- break;
258
- }
259
- };
260
- function init(wasmBinary) {
261
- transcoderPending = new Promise((resolve) => {
262
- BasisModule = { wasmBinary, onRuntimeInitialized: resolve };
263
- BASIS(BasisModule);
264
- }).then(() => {
265
- BasisModule.initializeBasis();
266
- });
267
- }
268
- function transcodeLowLevel(taskConfig) {
269
- const { basisFormat, width, height, hasAlpha } = taskConfig;
270
- const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha);
271
- const blockByteLength = BasisModule.getBytesPerBlockOrPixel(transcoderFormat);
272
- assert(BasisModule.isFormatSupported(transcoderFormat), "THREE.BasisTextureLoader: Unsupported format.");
273
- const mipmaps = [];
274
- if (basisFormat === BasisFormat.ETC1S) {
275
- const transcoder = new BasisModule.LowLevelETC1SImageTranscoder();
276
- const { endpointCount, endpointsData, selectorCount, selectorsData, tablesData } = taskConfig.globalData;
277
- try {
278
- let ok;
279
- ok = transcoder.decodePalettes(endpointCount, endpointsData, selectorCount, selectorsData);
280
- assert(ok, "THREE.BasisTextureLoader: decodePalettes() failed.");
281
- ok = transcoder.decodeTables(tablesData);
282
- assert(ok, "THREE.BasisTextureLoader: decodeTables() failed.");
283
- for (let i = 0; i < taskConfig.levels.length; i++) {
284
- const level = taskConfig.levels[i];
285
- const imageDesc = taskConfig.globalData.imageDescs[i];
286
- const dstByteLength = getTranscodedImageByteLength(transcoderFormat, level.width, level.height);
287
- const dst = new Uint8Array(dstByteLength);
288
- ok = transcoder.transcodeImage(
289
- transcoderFormat,
290
- dst,
291
- dstByteLength / blockByteLength,
292
- level.data,
293
- getWidthInBlocks(transcoderFormat, level.width),
294
- getHeightInBlocks(transcoderFormat, level.height),
295
- level.width,
296
- level.height,
297
- level.index,
298
- imageDesc.rgbSliceByteOffset,
299
- imageDesc.rgbSliceByteLength,
300
- imageDesc.alphaSliceByteOffset,
301
- imageDesc.alphaSliceByteLength,
302
- imageDesc.imageFlags,
303
- hasAlpha,
304
- false,
305
- 0,
306
- 0
307
- );
308
- assert(ok, "THREE.BasisTextureLoader: transcodeImage() failed for level " + level.index + ".");
309
- mipmaps.push({ data: dst, width: level.width, height: level.height });
310
- }
311
- } finally {
312
- transcoder.delete();
313
- }
314
- } else {
256
+ function init(wasmBinary) {
257
+ transcoderPending = new Promise((resolve) => {
258
+ BasisModule = { wasmBinary, onRuntimeInitialized: resolve };
259
+ BASIS(BasisModule);
260
+ }).then(() => {
261
+ BasisModule.initializeBasis();
262
+ });
263
+ }
264
+ function transcodeLowLevel(taskConfig) {
265
+ const { basisFormat, width, height, hasAlpha } = taskConfig;
266
+ const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha);
267
+ const blockByteLength = BasisModule.getBytesPerBlockOrPixel(transcoderFormat);
268
+ assert(BasisModule.isFormatSupported(transcoderFormat), "THREE.BasisTextureLoader: Unsupported format.");
269
+ const mipmaps = [];
270
+ if (basisFormat === BasisFormat.ETC1S) {
271
+ const transcoder = new BasisModule.LowLevelETC1SImageTranscoder();
272
+ const { endpointCount, endpointsData, selectorCount, selectorsData, tablesData } = taskConfig.globalData;
273
+ try {
274
+ let ok;
275
+ ok = transcoder.decodePalettes(endpointCount, endpointsData, selectorCount, selectorsData);
276
+ assert(ok, "THREE.BasisTextureLoader: decodePalettes() failed.");
277
+ ok = transcoder.decodeTables(tablesData);
278
+ assert(ok, "THREE.BasisTextureLoader: decodeTables() failed.");
315
279
  for (let i = 0; i < taskConfig.levels.length; i++) {
316
280
  const level = taskConfig.levels[i];
281
+ const imageDesc = taskConfig.globalData.imageDescs[i];
317
282
  const dstByteLength = getTranscodedImageByteLength(transcoderFormat, level.width, level.height);
318
283
  const dst = new Uint8Array(dstByteLength);
319
- const ok = BasisModule.transcodeUASTCImage(
284
+ ok = transcoder.transcodeImage(
320
285
  transcoderFormat,
321
286
  dst,
322
287
  dstByteLength / blockByteLength,
@@ -326,170 +291,199 @@ const BasisTextureLoader = /* @__PURE__ */ (() => {
326
291
  level.width,
327
292
  level.height,
328
293
  level.index,
329
- 0,
330
- level.data.byteLength,
331
- 0,
294
+ imageDesc.rgbSliceByteOffset,
295
+ imageDesc.rgbSliceByteLength,
296
+ imageDesc.alphaSliceByteOffset,
297
+ imageDesc.alphaSliceByteLength,
298
+ imageDesc.imageFlags,
332
299
  hasAlpha,
333
300
  false,
334
301
  0,
335
- 0,
336
- -1,
337
- -1
302
+ 0
338
303
  );
339
- assert(ok, "THREE.BasisTextureLoader: transcodeUASTCImage() failed for level " + level.index + ".");
304
+ assert(ok, "THREE.BasisTextureLoader: transcodeImage() failed for level " + level.index + ".");
340
305
  mipmaps.push({ data: dst, width: level.width, height: level.height });
341
306
  }
307
+ } finally {
308
+ transcoder.delete();
342
309
  }
343
- return { width, height, hasAlpha, mipmaps, format: engineFormat };
344
- }
345
- function transcode(buffer) {
346
- const basisFile = new BasisModule.BasisFile(new Uint8Array(buffer));
347
- const basisFormat = basisFile.isUASTC() ? BasisFormat.UASTC_4x4 : BasisFormat.ETC1S;
348
- const width = basisFile.getImageWidth(0, 0);
349
- const height = basisFile.getImageHeight(0, 0);
350
- const levels = basisFile.getNumLevels(0);
351
- const hasAlpha = basisFile.getHasAlpha();
352
- function cleanup() {
353
- basisFile.close();
354
- basisFile.delete();
355
- }
356
- const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha);
357
- if (!width || !height || !levels) {
358
- cleanup();
359
- throw new Error("THREE.BasisTextureLoader: Invalid texture");
360
- }
361
- if (!basisFile.startTranscoding()) {
362
- cleanup();
363
- throw new Error("THREE.BasisTextureLoader: .startTranscoding failed");
364
- }
365
- const mipmaps = [];
366
- for (let mip = 0; mip < levels; mip++) {
367
- const mipWidth = basisFile.getImageWidth(0, mip);
368
- const mipHeight = basisFile.getImageHeight(0, mip);
369
- const dst = new Uint8Array(basisFile.getImageTranscodedSizeInBytes(0, mip, transcoderFormat));
370
- const status = basisFile.transcodeImage(dst, 0, mip, transcoderFormat, 0, hasAlpha);
371
- if (!status) {
372
- cleanup();
373
- throw new Error("THREE.BasisTextureLoader: .transcodeImage failed.");
374
- }
375
- mipmaps.push({ data: dst, width: mipWidth, height: mipHeight });
376
- }
377
- cleanup();
378
- return { width, height, hasAlpha, mipmaps, format: engineFormat };
379
- }
380
- const FORMAT_OPTIONS = [
381
- {
382
- if: "astcSupported",
383
- basisFormat: [BasisFormat.UASTC_4x4],
384
- transcoderFormat: [TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4],
385
- engineFormat: [EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format],
386
- priorityETC1S: Infinity,
387
- priorityUASTC: 1,
388
- needsPowerOfTwo: false
389
- },
390
- {
391
- if: "bptcSupported",
392
- basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
393
- transcoderFormat: [TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5],
394
- engineFormat: [EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format],
395
- priorityETC1S: 3,
396
- priorityUASTC: 2,
397
- needsPowerOfTwo: false
398
- },
399
- {
400
- if: "dxtSupported",
401
- basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
402
- transcoderFormat: [TranscoderFormat.BC1, TranscoderFormat.BC3],
403
- engineFormat: [EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],
404
- priorityETC1S: 4,
405
- priorityUASTC: 5,
406
- needsPowerOfTwo: false
407
- },
408
- {
409
- if: "etc2Supported",
410
- basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
411
- transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC2],
412
- engineFormat: [EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format],
413
- priorityETC1S: 1,
414
- priorityUASTC: 3,
415
- needsPowerOfTwo: false
416
- },
417
- {
418
- if: "etc1Supported",
419
- basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
420
- transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC1],
421
- engineFormat: [EngineFormat.RGB_ETC1_Format, EngineFormat.RGB_ETC1_Format],
422
- priorityETC1S: 2,
423
- priorityUASTC: 4,
424
- needsPowerOfTwo: false
425
- },
426
- {
427
- if: "pvrtcSupported",
428
- basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
429
- transcoderFormat: [TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA],
430
- engineFormat: [EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format],
431
- priorityETC1S: 5,
432
- priorityUASTC: 6,
433
- needsPowerOfTwo: true
434
- }
435
- ];
436
- const ETC1S_OPTIONS = FORMAT_OPTIONS.sort(function(a, b) {
437
- return a.priorityETC1S - b.priorityETC1S;
438
- });
439
- const UASTC_OPTIONS = FORMAT_OPTIONS.sort(function(a, b) {
440
- return a.priorityUASTC - b.priorityUASTC;
441
- });
442
- function getTranscoderFormat(basisFormat, width, height, hasAlpha) {
443
- let transcoderFormat;
444
- let engineFormat;
445
- const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS;
446
- for (let i = 0; i < options.length; i++) {
447
- const opt = options[i];
448
- if (!config[opt.if])
449
- continue;
450
- if (!opt.basisFormat.includes(basisFormat))
451
- continue;
452
- if (opt.needsPowerOfTwo && !(isPowerOfTwo(width) && isPowerOfTwo(height)))
453
- continue;
454
- transcoderFormat = opt.transcoderFormat[hasAlpha ? 1 : 0];
455
- engineFormat = opt.engineFormat[hasAlpha ? 1 : 0];
456
- return { transcoderFormat, engineFormat };
310
+ } else {
311
+ for (let i = 0; i < taskConfig.levels.length; i++) {
312
+ const level = taskConfig.levels[i];
313
+ const dstByteLength = getTranscodedImageByteLength(transcoderFormat, level.width, level.height);
314
+ const dst = new Uint8Array(dstByteLength);
315
+ const ok = BasisModule.transcodeUASTCImage(
316
+ transcoderFormat,
317
+ dst,
318
+ dstByteLength / blockByteLength,
319
+ level.data,
320
+ getWidthInBlocks(transcoderFormat, level.width),
321
+ getHeightInBlocks(transcoderFormat, level.height),
322
+ level.width,
323
+ level.height,
324
+ level.index,
325
+ 0,
326
+ level.data.byteLength,
327
+ 0,
328
+ hasAlpha,
329
+ false,
330
+ 0,
331
+ 0,
332
+ -1,
333
+ -1
334
+ );
335
+ assert(ok, "THREE.BasisTextureLoader: transcodeUASTCImage() failed for level " + level.index + ".");
336
+ mipmaps.push({ data: dst, width: level.width, height: level.height });
457
337
  }
458
- console.warn("THREE.BasisTextureLoader: No suitable compressed texture format found. Decoding to RGBA32.");
459
- transcoderFormat = TranscoderFormat.RGBA32;
460
- engineFormat = EngineFormat.RGBAFormat;
461
- return { transcoderFormat, engineFormat };
462
338
  }
463
- function assert(ok, message) {
464
- if (!ok)
465
- throw new Error(message);
339
+ return { width, height, hasAlpha, mipmaps, format: engineFormat };
340
+ }
341
+ function transcode(buffer) {
342
+ const basisFile = new BasisModule.BasisFile(new Uint8Array(buffer));
343
+ const basisFormat = basisFile.isUASTC() ? BasisFormat.UASTC_4x4 : BasisFormat.ETC1S;
344
+ const width = basisFile.getImageWidth(0, 0);
345
+ const height = basisFile.getImageHeight(0, 0);
346
+ const levels = basisFile.getNumLevels(0);
347
+ const hasAlpha = basisFile.getHasAlpha();
348
+ function cleanup() {
349
+ basisFile.close();
350
+ basisFile.delete();
466
351
  }
467
- function getWidthInBlocks(transcoderFormat, width) {
468
- return Math.ceil(width / BasisModule.getFormatBlockWidth(transcoderFormat));
352
+ const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha);
353
+ if (!width || !height || !levels) {
354
+ cleanup();
355
+ throw new Error("THREE.BasisTextureLoader: Invalid texture");
469
356
  }
470
- function getHeightInBlocks(transcoderFormat, height) {
471
- return Math.ceil(height / BasisModule.getFormatBlockHeight(transcoderFormat));
357
+ if (!basisFile.startTranscoding()) {
358
+ cleanup();
359
+ throw new Error("THREE.BasisTextureLoader: .startTranscoding failed");
472
360
  }
473
- function getTranscodedImageByteLength(transcoderFormat, width, height) {
474
- const blockByteLength = BasisModule.getBytesPerBlockOrPixel(transcoderFormat);
475
- if (BasisModule.formatIsUncompressed(transcoderFormat)) {
476
- return width * height * blockByteLength;
477
- }
478
- if (transcoderFormat === TranscoderFormat.PVRTC1_4_RGB || transcoderFormat === TranscoderFormat.PVRTC1_4_RGBA) {
479
- const paddedWidth = width + 3 & ~3;
480
- const paddedHeight = height + 3 & ~3;
481
- return (Math.max(8, paddedWidth) * Math.max(8, paddedHeight) * 4 + 7) / 8;
361
+ const mipmaps = [];
362
+ for (let mip = 0; mip < levels; mip++) {
363
+ const mipWidth = basisFile.getImageWidth(0, mip);
364
+ const mipHeight = basisFile.getImageHeight(0, mip);
365
+ const dst = new Uint8Array(basisFile.getImageTranscodedSizeInBytes(0, mip, transcoderFormat));
366
+ const status = basisFile.transcodeImage(dst, 0, mip, transcoderFormat, 0, hasAlpha);
367
+ if (!status) {
368
+ cleanup();
369
+ throw new Error("THREE.BasisTextureLoader: .transcodeImage failed.");
482
370
  }
483
- return getWidthInBlocks(transcoderFormat, width) * getHeightInBlocks(transcoderFormat, height) * blockByteLength;
371
+ mipmaps.push({ data: dst, width: mipWidth, height: mipHeight });
484
372
  }
485
- function isPowerOfTwo(value) {
486
- if (value <= 2)
487
- return true;
488
- return (value & value - 1) === 0 && value !== 0;
373
+ cleanup();
374
+ return { width, height, hasAlpha, mipmaps, format: engineFormat };
375
+ }
376
+ const FORMAT_OPTIONS = [
377
+ {
378
+ if: "astcSupported",
379
+ basisFormat: [BasisFormat.UASTC_4x4],
380
+ transcoderFormat: [TranscoderFormat.ASTC_4x4, TranscoderFormat.ASTC_4x4],
381
+ engineFormat: [EngineFormat.RGBA_ASTC_4x4_Format, EngineFormat.RGBA_ASTC_4x4_Format],
382
+ priorityETC1S: Infinity,
383
+ priorityUASTC: 1,
384
+ needsPowerOfTwo: false
385
+ },
386
+ {
387
+ if: "bptcSupported",
388
+ basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
389
+ transcoderFormat: [TranscoderFormat.BC7_M5, TranscoderFormat.BC7_M5],
390
+ engineFormat: [EngineFormat.RGBA_BPTC_Format, EngineFormat.RGBA_BPTC_Format],
391
+ priorityETC1S: 3,
392
+ priorityUASTC: 2,
393
+ needsPowerOfTwo: false
394
+ },
395
+ {
396
+ if: "dxtSupported",
397
+ basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
398
+ transcoderFormat: [TranscoderFormat.BC1, TranscoderFormat.BC3],
399
+ engineFormat: [EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],
400
+ priorityETC1S: 4,
401
+ priorityUASTC: 5,
402
+ needsPowerOfTwo: false
403
+ },
404
+ {
405
+ if: "etc2Supported",
406
+ basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
407
+ transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC2],
408
+ engineFormat: [EngineFormat.RGB_ETC2_Format, EngineFormat.RGBA_ETC2_EAC_Format],
409
+ priorityETC1S: 1,
410
+ priorityUASTC: 3,
411
+ needsPowerOfTwo: false
412
+ },
413
+ {
414
+ if: "etc1Supported",
415
+ basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
416
+ transcoderFormat: [TranscoderFormat.ETC1, TranscoderFormat.ETC1],
417
+ engineFormat: [EngineFormat.RGB_ETC1_Format, EngineFormat.RGB_ETC1_Format],
418
+ priorityETC1S: 2,
419
+ priorityUASTC: 4,
420
+ needsPowerOfTwo: false
421
+ },
422
+ {
423
+ if: "pvrtcSupported",
424
+ basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
425
+ transcoderFormat: [TranscoderFormat.PVRTC1_4_RGB, TranscoderFormat.PVRTC1_4_RGBA],
426
+ engineFormat: [EngineFormat.RGB_PVRTC_4BPPV1_Format, EngineFormat.RGBA_PVRTC_4BPPV1_Format],
427
+ priorityETC1S: 5,
428
+ priorityUASTC: 6,
429
+ needsPowerOfTwo: true
489
430
  }
431
+ ];
432
+ const ETC1S_OPTIONS = FORMAT_OPTIONS.sort(function(a, b) {
433
+ return a.priorityETC1S - b.priorityETC1S;
434
+ });
435
+ const UASTC_OPTIONS = FORMAT_OPTIONS.sort(function(a, b) {
436
+ return a.priorityUASTC - b.priorityUASTC;
490
437
  });
491
- return BasisTextureLoader2;
492
- })();
438
+ function getTranscoderFormat(basisFormat, width, height, hasAlpha) {
439
+ let transcoderFormat;
440
+ let engineFormat;
441
+ const options = basisFormat === BasisFormat.ETC1S ? ETC1S_OPTIONS : UASTC_OPTIONS;
442
+ for (let i = 0; i < options.length; i++) {
443
+ const opt = options[i];
444
+ if (!config[opt.if])
445
+ continue;
446
+ if (!opt.basisFormat.includes(basisFormat))
447
+ continue;
448
+ if (opt.needsPowerOfTwo && !(isPowerOfTwo(width) && isPowerOfTwo(height)))
449
+ continue;
450
+ transcoderFormat = opt.transcoderFormat[hasAlpha ? 1 : 0];
451
+ engineFormat = opt.engineFormat[hasAlpha ? 1 : 0];
452
+ return { transcoderFormat, engineFormat };
453
+ }
454
+ console.warn("THREE.BasisTextureLoader: No suitable compressed texture format found. Decoding to RGBA32.");
455
+ transcoderFormat = TranscoderFormat.RGBA32;
456
+ engineFormat = EngineFormat.RGBAFormat;
457
+ return { transcoderFormat, engineFormat };
458
+ }
459
+ function assert(ok, message) {
460
+ if (!ok)
461
+ throw new Error(message);
462
+ }
463
+ function getWidthInBlocks(transcoderFormat, width) {
464
+ return Math.ceil(width / BasisModule.getFormatBlockWidth(transcoderFormat));
465
+ }
466
+ function getHeightInBlocks(transcoderFormat, height) {
467
+ return Math.ceil(height / BasisModule.getFormatBlockHeight(transcoderFormat));
468
+ }
469
+ function getTranscodedImageByteLength(transcoderFormat, width, height) {
470
+ const blockByteLength = BasisModule.getBytesPerBlockOrPixel(transcoderFormat);
471
+ if (BasisModule.formatIsUncompressed(transcoderFormat)) {
472
+ return width * height * blockByteLength;
473
+ }
474
+ if (transcoderFormat === TranscoderFormat.PVRTC1_4_RGB || transcoderFormat === TranscoderFormat.PVRTC1_4_RGBA) {
475
+ const paddedWidth = width + 3 & ~3;
476
+ const paddedHeight = height + 3 & ~3;
477
+ return (Math.max(8, paddedWidth) * Math.max(8, paddedHeight) * 4 + 7) / 8;
478
+ }
479
+ return getWidthInBlocks(transcoderFormat, width) * getHeightInBlocks(transcoderFormat, height) * blockByteLength;
480
+ }
481
+ function isPowerOfTwo(value) {
482
+ if (value <= 2)
483
+ return true;
484
+ return (value & value - 1) === 0 && value !== 0;
485
+ }
486
+ });
493
487
  export {
494
488
  BasisTextureLoader
495
489
  };