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