three-stdlib 2.35.5 → 2.35.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (514) hide show
  1. package/_polyfill/CapsuleGeometry.cjs +20 -17
  2. package/_polyfill/CapsuleGeometry.cjs.map +1 -1
  3. package/_polyfill/CapsuleGeometry.js +20 -17
  4. package/_polyfill/CapsuleGeometry.js.map +1 -1
  5. package/_polyfill/constants.cjs +1 -1
  6. package/_polyfill/constants.cjs.map +1 -1
  7. package/_polyfill/constants.js +1 -1
  8. package/_polyfill/constants.js.map +1 -1
  9. package/animation/AnimationClipCreator.cjs +13 -13
  10. package/animation/AnimationClipCreator.cjs.map +1 -1
  11. package/animation/AnimationClipCreator.js +13 -13
  12. package/animation/AnimationClipCreator.js.map +1 -1
  13. package/animation/CCDIKSolver.cjs +11 -11
  14. package/animation/CCDIKSolver.cjs.map +1 -1
  15. package/animation/CCDIKSolver.js +12 -12
  16. package/animation/CCDIKSolver.js.map +1 -1
  17. package/animation/MMDAnimationHelper.cjs +1 -1
  18. package/animation/MMDAnimationHelper.cjs.map +1 -1
  19. package/animation/MMDAnimationHelper.js +1 -1
  20. package/animation/MMDAnimationHelper.js.map +1 -1
  21. package/animation/MMDPhysics.cjs +4 -4
  22. package/animation/MMDPhysics.cjs.map +1 -1
  23. package/animation/MMDPhysics.js +4 -4
  24. package/animation/MMDPhysics.js.map +1 -1
  25. package/controls/ArcballControls.cjs +2 -2
  26. package/controls/ArcballControls.cjs.map +1 -1
  27. package/controls/ArcballControls.js +3 -3
  28. package/controls/ArcballControls.js.map +1 -1
  29. package/controls/FirstPersonControls.cjs +1 -1
  30. package/controls/FirstPersonControls.cjs.map +1 -1
  31. package/controls/FirstPersonControls.js +1 -1
  32. package/controls/FirstPersonControls.js.map +1 -1
  33. package/controls/OrbitControls.cjs +2 -2
  34. package/controls/OrbitControls.cjs.map +1 -1
  35. package/controls/OrbitControls.js +3 -3
  36. package/controls/OrbitControls.js.map +1 -1
  37. package/controls/PointerLockControls.cjs +2 -2
  38. package/controls/PointerLockControls.cjs.map +1 -1
  39. package/controls/PointerLockControls.js +3 -3
  40. package/controls/PointerLockControls.js.map +1 -1
  41. package/csm/CSM.cjs +4 -4
  42. package/csm/CSM.cjs.map +1 -1
  43. package/csm/CSM.js +5 -5
  44. package/csm/CSM.js.map +1 -1
  45. package/csm/CSMFrustum.cjs +1 -1
  46. package/csm/CSMFrustum.cjs.map +1 -1
  47. package/csm/CSMFrustum.js +2 -2
  48. package/csm/CSMFrustum.js.map +1 -1
  49. package/deprecated/Geometry.cjs +722 -715
  50. package/deprecated/Geometry.cjs.map +1 -1
  51. package/deprecated/Geometry.js +723 -716
  52. package/deprecated/Geometry.js.map +1 -1
  53. package/effects/AnaglyphEffect.cjs +2 -1
  54. package/effects/AnaglyphEffect.cjs.map +1 -1
  55. package/effects/AnaglyphEffect.js +3 -2
  56. package/effects/AnaglyphEffect.js.map +1 -1
  57. package/effects/OutlineEffect.cjs +2 -1
  58. package/effects/OutlineEffect.cjs.map +1 -1
  59. package/effects/OutlineEffect.js +3 -2
  60. package/effects/OutlineEffect.js.map +1 -1
  61. package/effects/ParallaxBarrierEffect.cjs +2 -1
  62. package/effects/ParallaxBarrierEffect.cjs.map +1 -1
  63. package/effects/ParallaxBarrierEffect.js +3 -2
  64. package/effects/ParallaxBarrierEffect.js.map +1 -1
  65. package/exporters/DRACOExporter.cjs +133 -122
  66. package/exporters/DRACOExporter.cjs.map +1 -1
  67. package/exporters/DRACOExporter.d.ts +34 -21
  68. package/exporters/DRACOExporter.js +133 -122
  69. package/exporters/DRACOExporter.js.map +1 -1
  70. package/exporters/GLTFExporter.cjs +170 -167
  71. package/exporters/GLTFExporter.cjs.map +1 -1
  72. package/exporters/GLTFExporter.js +170 -167
  73. package/exporters/GLTFExporter.js.map +1 -1
  74. package/geometries/LightningStrike.cjs +524 -515
  75. package/geometries/LightningStrike.cjs.map +1 -1
  76. package/geometries/LightningStrike.js +524 -515
  77. package/geometries/LightningStrike.js.map +1 -1
  78. package/geometries/RoundedBoxGeometry.cjs +1 -1
  79. package/geometries/RoundedBoxGeometry.cjs.map +1 -1
  80. package/geometries/RoundedBoxGeometry.js +2 -2
  81. package/geometries/RoundedBoxGeometry.js.map +1 -1
  82. package/helpers/RaycasterHelper.cjs +2 -2
  83. package/helpers/RaycasterHelper.cjs.map +1 -1
  84. package/helpers/RaycasterHelper.js +3 -3
  85. package/helpers/RaycasterHelper.js.map +1 -1
  86. package/helpers/VertexNormalsHelper.cjs +3 -3
  87. package/helpers/VertexNormalsHelper.cjs.map +1 -1
  88. package/helpers/VertexNormalsHelper.js +4 -4
  89. package/helpers/VertexNormalsHelper.js.map +1 -1
  90. package/helpers/VertexTangentsHelper.cjs +2 -2
  91. package/helpers/VertexTangentsHelper.cjs.map +1 -1
  92. package/helpers/VertexTangentsHelper.js +3 -3
  93. package/helpers/VertexTangentsHelper.js.map +1 -1
  94. package/interactive/InteractiveGroup.cjs +1 -1
  95. package/interactive/InteractiveGroup.cjs.map +1 -1
  96. package/interactive/InteractiveGroup.js +2 -2
  97. package/interactive/InteractiveGroup.js.map +1 -1
  98. package/interactive/SelectionBox.cjs +15 -15
  99. package/interactive/SelectionBox.cjs.map +1 -1
  100. package/interactive/SelectionBox.js +16 -16
  101. package/interactive/SelectionBox.js.map +1 -1
  102. package/libs/chevrotain.cjs +1 -1
  103. package/libs/chevrotain.cjs.map +1 -1
  104. package/libs/chevrotain.js +1 -1
  105. package/libs/chevrotain.js.map +1 -1
  106. package/libs/lottie.cjs +1 -1
  107. package/libs/lottie.cjs.map +1 -1
  108. package/libs/lottie.js +1 -1
  109. package/libs/lottie.js.map +1 -1
  110. package/libs/opentype.cjs +1 -1
  111. package/libs/opentype.cjs.map +1 -1
  112. package/libs/opentype.js +1 -1
  113. package/libs/opentype.js.map +1 -1
  114. package/lights/LightProbeGenerator.cjs +5 -5
  115. package/lights/LightProbeGenerator.cjs.map +1 -1
  116. package/lights/LightProbeGenerator.js +5 -5
  117. package/lights/LightProbeGenerator.js.map +1 -1
  118. package/lights/RectAreaLightUniformsLib.cjs +3 -3
  119. package/lights/RectAreaLightUniformsLib.cjs.map +1 -1
  120. package/lights/RectAreaLightUniformsLib.js +3 -3
  121. package/lights/RectAreaLightUniformsLib.js.map +1 -1
  122. package/lines/LineMaterial.cjs +2 -1
  123. package/lines/LineMaterial.cjs.map +1 -1
  124. package/lines/LineMaterial.js +3 -2
  125. package/lines/LineMaterial.js.map +1 -1
  126. package/lines/LineSegments2.cjs +13 -13
  127. package/lines/LineSegments2.cjs.map +1 -1
  128. package/lines/LineSegments2.js +14 -14
  129. package/lines/LineSegments2.js.map +1 -1
  130. package/lines/LineSegmentsGeometry.cjs +2 -2
  131. package/lines/LineSegmentsGeometry.cjs.map +1 -1
  132. package/lines/LineSegmentsGeometry.js +3 -3
  133. package/lines/LineSegmentsGeometry.js.map +1 -1
  134. package/lines/Wireframe.cjs +3 -3
  135. package/lines/Wireframe.cjs.map +1 -1
  136. package/lines/Wireframe.js +4 -4
  137. package/lines/Wireframe.js.map +1 -1
  138. package/loaders/BasisTextureLoader.cjs +441 -435
  139. package/loaders/BasisTextureLoader.cjs.map +1 -1
  140. package/loaders/BasisTextureLoader.js +441 -435
  141. package/loaders/BasisTextureLoader.js.map +1 -1
  142. package/loaders/EXRLoader.cjs +2 -1
  143. package/loaders/EXRLoader.cjs.map +1 -1
  144. package/loaders/EXRLoader.js +3 -2
  145. package/loaders/EXRLoader.js.map +1 -1
  146. package/loaders/FBXLoader.cjs +2 -2
  147. package/loaders/FBXLoader.cjs.map +1 -1
  148. package/loaders/FBXLoader.js +2 -2
  149. package/loaders/FBXLoader.js.map +1 -1
  150. package/loaders/FontLoader.cjs +2 -2
  151. package/loaders/FontLoader.cjs.map +1 -1
  152. package/loaders/FontLoader.d.ts +2 -2
  153. package/loaders/FontLoader.js +2 -2
  154. package/loaders/FontLoader.js.map +1 -1
  155. package/loaders/GLTFLoader.cjs +2 -2
  156. package/loaders/GLTFLoader.cjs.map +1 -1
  157. package/loaders/GLTFLoader.js +2 -2
  158. package/loaders/GLTFLoader.js.map +1 -1
  159. package/loaders/KTX2Loader.cjs +377 -374
  160. package/loaders/KTX2Loader.cjs.map +1 -1
  161. package/loaders/KTX2Loader.js +377 -374
  162. package/loaders/KTX2Loader.js.map +1 -1
  163. package/loaders/LDrawLoader.cjs +5 -4
  164. package/loaders/LDrawLoader.cjs.map +1 -1
  165. package/loaders/LDrawLoader.js +6 -5
  166. package/loaders/LDrawLoader.js.map +1 -1
  167. package/loaders/OBJLoader.cjs +5 -5
  168. package/loaders/OBJLoader.cjs.map +1 -1
  169. package/loaders/OBJLoader.js +6 -6
  170. package/loaders/OBJLoader.js.map +1 -1
  171. package/loaders/PRWMLoader.cjs +46 -43
  172. package/loaders/PRWMLoader.cjs.map +1 -1
  173. package/loaders/PRWMLoader.js +46 -43
  174. package/loaders/PRWMLoader.js.map +1 -1
  175. package/loaders/SVGLoader.cjs +1694 -1688
  176. package/loaders/SVGLoader.cjs.map +1 -1
  177. package/loaders/SVGLoader.js +1694 -1688
  178. package/loaders/SVGLoader.js.map +1 -1
  179. package/loaders/XLoader.cjs +1 -1
  180. package/loaders/XLoader.cjs.map +1 -1
  181. package/loaders/XLoader.js +1 -1
  182. package/loaders/XLoader.js.map +1 -1
  183. package/math/Capsule.cjs +3 -3
  184. package/math/Capsule.cjs.map +1 -1
  185. package/math/Capsule.js +3 -3
  186. package/math/Capsule.js.map +1 -1
  187. package/math/ColorConverter.cjs +9 -9
  188. package/math/ColorConverter.cjs.map +1 -1
  189. package/math/ColorConverter.js +9 -9
  190. package/math/ColorConverter.js.map +1 -1
  191. package/math/ConvexHull.cjs +53 -50
  192. package/math/ConvexHull.cjs.map +1 -1
  193. package/math/ConvexHull.js +53 -50
  194. package/math/ConvexHull.js.map +1 -1
  195. package/math/ImprovedNoise.cjs +1 -1
  196. package/math/ImprovedNoise.cjs.map +1 -1
  197. package/math/ImprovedNoise.js +1 -1
  198. package/math/ImprovedNoise.js.map +1 -1
  199. package/math/MeshSurfaceSampler.cjs +2 -2
  200. package/math/MeshSurfaceSampler.cjs.map +1 -1
  201. package/math/MeshSurfaceSampler.js +2 -2
  202. package/math/MeshSurfaceSampler.js.map +1 -1
  203. package/math/OBB.cjs +14 -14
  204. package/math/OBB.cjs.map +1 -1
  205. package/math/OBB.js +15 -15
  206. package/math/OBB.js.map +1 -1
  207. package/math/Octree.cjs +7 -7
  208. package/math/Octree.cjs.map +1 -1
  209. package/math/Octree.js +8 -8
  210. package/math/Octree.js.map +1 -1
  211. package/misc/ConvexObjectBreaker.cjs +271 -268
  212. package/misc/ConvexObjectBreaker.cjs.map +1 -1
  213. package/misc/ConvexObjectBreaker.js +272 -269
  214. package/misc/ConvexObjectBreaker.js.map +1 -1
  215. package/misc/Gyroscope.cjs +6 -6
  216. package/misc/Gyroscope.cjs.map +1 -1
  217. package/misc/Gyroscope.js +7 -7
  218. package/misc/Gyroscope.js.map +1 -1
  219. package/modifiers/CurveModifier.cjs +1 -1
  220. package/modifiers/CurveModifier.cjs.map +1 -1
  221. package/modifiers/CurveModifier.js +2 -2
  222. package/modifiers/CurveModifier.js.map +1 -1
  223. package/modifiers/SimplifyModifier.cjs +2 -2
  224. package/modifiers/SimplifyModifier.cjs.map +1 -1
  225. package/modifiers/SimplifyModifier.js +2 -2
  226. package/modifiers/SimplifyModifier.js.map +1 -1
  227. package/objects/BatchedMesh.cjs +2 -2
  228. package/objects/BatchedMesh.cjs.map +1 -1
  229. package/objects/BatchedMesh.js +3 -3
  230. package/objects/BatchedMesh.js.map +1 -1
  231. package/objects/GroundProjectedEnv.cjs +2 -1
  232. package/objects/GroundProjectedEnv.cjs.map +1 -1
  233. package/objects/GroundProjectedEnv.js +3 -2
  234. package/objects/GroundProjectedEnv.js.map +1 -1
  235. package/objects/Lensflare.cjs +209 -206
  236. package/objects/Lensflare.cjs.map +1 -1
  237. package/objects/Lensflare.js +209 -206
  238. package/objects/Lensflare.js.map +1 -1
  239. package/objects/Reflector.cjs +154 -146
  240. package/objects/Reflector.cjs.map +1 -1
  241. package/objects/Reflector.js +154 -146
  242. package/objects/Reflector.js.map +1 -1
  243. package/objects/ReflectorForSSRPass.cjs +183 -180
  244. package/objects/ReflectorForSSRPass.cjs.map +1 -1
  245. package/objects/ReflectorForSSRPass.js +183 -180
  246. package/objects/ReflectorForSSRPass.js.map +1 -1
  247. package/objects/Refractor.cjs +164 -161
  248. package/objects/Refractor.cjs.map +1 -1
  249. package/objects/Refractor.js +164 -161
  250. package/objects/Refractor.js.map +1 -1
  251. package/objects/ShadowMesh.cjs +1 -1
  252. package/objects/ShadowMesh.cjs.map +1 -1
  253. package/objects/ShadowMesh.js +2 -2
  254. package/objects/ShadowMesh.js.map +1 -1
  255. package/objects/Sky.cjs +35 -32
  256. package/objects/Sky.cjs.map +1 -1
  257. package/objects/Sky.d.ts +17 -42
  258. package/objects/Sky.js +35 -32
  259. package/objects/Sky.js.map +1 -1
  260. package/objects/Water.cjs +2 -1
  261. package/objects/Water.cjs.map +1 -1
  262. package/objects/Water.js +3 -2
  263. package/objects/Water.js.map +1 -1
  264. package/objects/Water2.cjs +143 -140
  265. package/objects/Water2.cjs.map +1 -1
  266. package/objects/Water2.js +143 -140
  267. package/objects/Water2.js.map +1 -1
  268. package/package.json +1 -1
  269. package/postprocessing/SAOPass.cjs +267 -264
  270. package/postprocessing/SAOPass.cjs.map +1 -1
  271. package/postprocessing/SAOPass.js +267 -264
  272. package/postprocessing/SAOPass.js.map +1 -1
  273. package/postprocessing/SSAOPass.cjs +253 -250
  274. package/postprocessing/SSAOPass.cjs.map +1 -1
  275. package/postprocessing/SSAOPass.js +253 -250
  276. package/postprocessing/SSAOPass.js.map +1 -1
  277. package/postprocessing/SSRPass.cjs +379 -376
  278. package/postprocessing/SSRPass.cjs.map +1 -1
  279. package/postprocessing/SSRPass.js +379 -376
  280. package/postprocessing/SSRPass.js.map +1 -1
  281. package/postprocessing/UnrealBloomPass.cjs +205 -202
  282. package/postprocessing/UnrealBloomPass.cjs.map +1 -1
  283. package/postprocessing/UnrealBloomPass.js +205 -202
  284. package/postprocessing/UnrealBloomPass.js.map +1 -1
  285. package/renderers/CSS2DRenderer.cjs +5 -5
  286. package/renderers/CSS2DRenderer.cjs.map +1 -1
  287. package/renderers/CSS2DRenderer.js +5 -5
  288. package/renderers/CSS2DRenderer.js.map +1 -1
  289. package/renderers/CSS3DRenderer.cjs +5 -5
  290. package/renderers/CSS3DRenderer.cjs.map +1 -1
  291. package/renderers/CSS3DRenderer.js +6 -6
  292. package/renderers/CSS3DRenderer.js.map +1 -1
  293. package/shaders/ACESFilmicToneMappingShader.cjs +71 -46
  294. package/shaders/ACESFilmicToneMappingShader.cjs.map +1 -1
  295. package/shaders/ACESFilmicToneMappingShader.js +71 -46
  296. package/shaders/ACESFilmicToneMappingShader.js.map +1 -1
  297. package/shaders/AfterimageShader.cjs +41 -22
  298. package/shaders/AfterimageShader.cjs.map +1 -1
  299. package/shaders/AfterimageShader.js +41 -22
  300. package/shaders/AfterimageShader.js.map +1 -1
  301. package/shaders/BasicShader.cjs +20 -6
  302. package/shaders/BasicShader.cjs.map +1 -1
  303. package/shaders/BasicShader.js +20 -6
  304. package/shaders/BasicShader.js.map +1 -1
  305. package/shaders/BleachBypassShader.cjs +46 -26
  306. package/shaders/BleachBypassShader.cjs.map +1 -1
  307. package/shaders/BleachBypassShader.js +46 -26
  308. package/shaders/BleachBypassShader.js.map +1 -1
  309. package/shaders/BlendShader.cjs +33 -19
  310. package/shaders/BlendShader.cjs.map +1 -1
  311. package/shaders/BlendShader.js +33 -19
  312. package/shaders/BlendShader.js.map +1 -1
  313. package/shaders/BokehShader.cjs +117 -90
  314. package/shaders/BokehShader.cjs.map +1 -1
  315. package/shaders/BokehShader.js +117 -90
  316. package/shaders/BokehShader.js.map +1 -1
  317. package/shaders/BokehShader2.cjs +333 -232
  318. package/shaders/BokehShader2.cjs.map +1 -1
  319. package/shaders/BokehShader2.js +333 -232
  320. package/shaders/BokehShader2.js.map +1 -1
  321. package/shaders/BrightnessContrastShader.cjs +38 -22
  322. package/shaders/BrightnessContrastShader.cjs.map +1 -1
  323. package/shaders/BrightnessContrastShader.js +38 -22
  324. package/shaders/BrightnessContrastShader.js.map +1 -1
  325. package/shaders/ColorCorrectionShader.cjs +35 -21
  326. package/shaders/ColorCorrectionShader.cjs.map +1 -1
  327. package/shaders/ColorCorrectionShader.js +35 -21
  328. package/shaders/ColorCorrectionShader.js.map +1 -1
  329. package/shaders/ColorifyShader.cjs +34 -19
  330. package/shaders/ColorifyShader.cjs.map +1 -1
  331. package/shaders/ColorifyShader.js +34 -19
  332. package/shaders/ColorifyShader.js.map +1 -1
  333. package/shaders/ConvolutionShader.cjs +43 -24
  334. package/shaders/ConvolutionShader.cjs.map +1 -1
  335. package/shaders/ConvolutionShader.js +43 -24
  336. package/shaders/ConvolutionShader.js.map +1 -1
  337. package/shaders/CopyShader.cjs +30 -16
  338. package/shaders/CopyShader.cjs.map +1 -1
  339. package/shaders/CopyShader.js +30 -16
  340. package/shaders/CopyShader.js.map +1 -1
  341. package/shaders/DOFMipMapShader.cjs +38 -21
  342. package/shaders/DOFMipMapShader.cjs.map +1 -1
  343. package/shaders/DOFMipMapShader.js +38 -21
  344. package/shaders/DOFMipMapShader.js.map +1 -1
  345. package/shaders/DepthLimitedBlurShader.cjs +98 -69
  346. package/shaders/DepthLimitedBlurShader.cjs.map +1 -1
  347. package/shaders/DepthLimitedBlurShader.js +98 -69
  348. package/shaders/DepthLimitedBlurShader.js.map +1 -1
  349. package/shaders/DigitalGlitch.cjs +70 -59
  350. package/shaders/DigitalGlitch.cjs.map +1 -1
  351. package/shaders/DigitalGlitch.js +70 -59
  352. package/shaders/DigitalGlitch.js.map +1 -1
  353. package/shaders/DotScreenShader.cjs +49 -28
  354. package/shaders/DotScreenShader.cjs.map +1 -1
  355. package/shaders/DotScreenShader.js +49 -28
  356. package/shaders/DotScreenShader.js.map +1 -1
  357. package/shaders/FXAAShader.cjs +1098 -1089
  358. package/shaders/FXAAShader.cjs.map +1 -1
  359. package/shaders/FXAAShader.js +1098 -1089
  360. package/shaders/FXAAShader.js.map +1 -1
  361. package/shaders/FilmShader.cjs +57 -29
  362. package/shaders/FilmShader.cjs.map +1 -1
  363. package/shaders/FilmShader.js +57 -29
  364. package/shaders/FilmShader.js.map +1 -1
  365. package/shaders/FocusShader.cjs +70 -43
  366. package/shaders/FocusShader.cjs.map +1 -1
  367. package/shaders/FocusShader.js +70 -43
  368. package/shaders/FocusShader.js.map +1 -1
  369. package/shaders/FreiChenShader.cjs +74 -53
  370. package/shaders/FreiChenShader.cjs.map +1 -1
  371. package/shaders/FreiChenShader.js +74 -53
  372. package/shaders/FreiChenShader.js.map +1 -1
  373. package/shaders/FresnelShader.cjs +55 -35
  374. package/shaders/FresnelShader.cjs.map +1 -1
  375. package/shaders/FresnelShader.js +55 -35
  376. package/shaders/FresnelShader.js.map +1 -1
  377. package/shaders/GammaCorrectionShader.cjs +33 -19
  378. package/shaders/GammaCorrectionShader.cjs.map +1 -1
  379. package/shaders/GammaCorrectionShader.js +33 -19
  380. package/shaders/GammaCorrectionShader.js.map +1 -1
  381. package/shaders/GodRaysShader.cjs +193 -116
  382. package/shaders/GodRaysShader.cjs.map +1 -1
  383. package/shaders/GodRaysShader.js +193 -116
  384. package/shaders/GodRaysShader.js.map +1 -1
  385. package/shaders/HalftoneShader.cjs +270 -192
  386. package/shaders/HalftoneShader.cjs.map +1 -1
  387. package/shaders/HalftoneShader.js +270 -192
  388. package/shaders/HalftoneShader.js.map +1 -1
  389. package/shaders/HorizontalTiltShiftShader.cjs +43 -27
  390. package/shaders/HorizontalTiltShiftShader.cjs.map +1 -1
  391. package/shaders/HorizontalTiltShiftShader.js +43 -27
  392. package/shaders/HorizontalTiltShiftShader.js.map +1 -1
  393. package/shaders/HueSaturationShader.cjs +47 -31
  394. package/shaders/HueSaturationShader.cjs.map +1 -1
  395. package/shaders/HueSaturationShader.js +47 -31
  396. package/shaders/HueSaturationShader.js.map +1 -1
  397. package/shaders/KaleidoShader.cjs +37 -24
  398. package/shaders/KaleidoShader.cjs.map +1 -1
  399. package/shaders/KaleidoShader.js +37 -24
  400. package/shaders/KaleidoShader.js.map +1 -1
  401. package/shaders/LuminosityHighPassShader.cjs +43 -24
  402. package/shaders/LuminosityHighPassShader.cjs.map +1 -1
  403. package/shaders/LuminosityHighPassShader.js +43 -24
  404. package/shaders/LuminosityHighPassShader.js.map +1 -1
  405. package/shaders/LuminosityShader.cjs +34 -17
  406. package/shaders/LuminosityShader.cjs.map +1 -1
  407. package/shaders/LuminosityShader.js +34 -17
  408. package/shaders/LuminosityShader.js.map +1 -1
  409. package/shaders/MirrorShader.cjs +39 -26
  410. package/shaders/MirrorShader.cjs.map +1 -1
  411. package/shaders/MirrorShader.js +39 -26
  412. package/shaders/MirrorShader.js.map +1 -1
  413. package/shaders/NormalMapShader.cjs +36 -21
  414. package/shaders/NormalMapShader.cjs.map +1 -1
  415. package/shaders/NormalMapShader.js +36 -21
  416. package/shaders/NormalMapShader.js.map +1 -1
  417. package/shaders/ParallaxShader.cjs +147 -97
  418. package/shaders/ParallaxShader.cjs.map +1 -1
  419. package/shaders/ParallaxShader.js +147 -97
  420. package/shaders/ParallaxShader.js.map +1 -1
  421. package/shaders/PixelShader.cjs +31 -18
  422. package/shaders/PixelShader.cjs.map +1 -1
  423. package/shaders/PixelShader.js +31 -18
  424. package/shaders/PixelShader.js.map +1 -1
  425. package/shaders/RGBShiftShader.cjs +33 -20
  426. package/shaders/RGBShiftShader.cjs.map +1 -1
  427. package/shaders/RGBShiftShader.js +33 -20
  428. package/shaders/RGBShiftShader.js.map +1 -1
  429. package/shaders/SAOShader.cjs +154 -117
  430. package/shaders/SAOShader.cjs.map +1 -1
  431. package/shaders/SAOShader.js +154 -117
  432. package/shaders/SAOShader.js.map +1 -1
  433. package/shaders/SMAAShader.cjs +358 -270
  434. package/shaders/SMAAShader.cjs.map +1 -1
  435. package/shaders/SMAAShader.js +358 -270
  436. package/shaders/SMAAShader.js.map +1 -1
  437. package/shaders/SSAOShader.cjs +236 -142
  438. package/shaders/SSAOShader.cjs.map +1 -1
  439. package/shaders/SSAOShader.js +236 -142
  440. package/shaders/SSAOShader.js.map +1 -1
  441. package/shaders/SSRShader.cjs +4 -4
  442. package/shaders/SSRShader.cjs.map +1 -1
  443. package/shaders/SSRShader.js +4 -4
  444. package/shaders/SSRShader.js.map +1 -1
  445. package/shaders/SepiaShader.cjs +36 -20
  446. package/shaders/SepiaShader.cjs.map +1 -1
  447. package/shaders/SepiaShader.js +36 -20
  448. package/shaders/SepiaShader.js.map +1 -1
  449. package/shaders/SobelOperatorShader.cjs +64 -37
  450. package/shaders/SobelOperatorShader.cjs.map +1 -1
  451. package/shaders/SobelOperatorShader.js +64 -37
  452. package/shaders/SobelOperatorShader.js.map +1 -1
  453. package/shaders/TechnicolorShader.cjs +29 -16
  454. package/shaders/TechnicolorShader.cjs.map +1 -1
  455. package/shaders/TechnicolorShader.js +29 -16
  456. package/shaders/TechnicolorShader.js.map +1 -1
  457. package/shaders/ToneMapShader.cjs +55 -35
  458. package/shaders/ToneMapShader.cjs.map +1 -1
  459. package/shaders/ToneMapShader.js +55 -35
  460. package/shaders/ToneMapShader.js.map +1 -1
  461. package/shaders/ToonShader.cjs +275 -165
  462. package/shaders/ToonShader.cjs.map +1 -1
  463. package/shaders/ToonShader.js +275 -165
  464. package/shaders/ToonShader.js.map +1 -1
  465. package/shaders/TriangleBlurShader.cjs +50 -27
  466. package/shaders/TriangleBlurShader.cjs.map +1 -1
  467. package/shaders/TriangleBlurShader.js +50 -27
  468. package/shaders/TriangleBlurShader.js.map +1 -1
  469. package/shaders/UnpackDepthRGBAShader.cjs +32 -17
  470. package/shaders/UnpackDepthRGBAShader.cjs.map +1 -1
  471. package/shaders/UnpackDepthRGBAShader.js +32 -17
  472. package/shaders/UnpackDepthRGBAShader.js.map +1 -1
  473. package/shaders/VerticalTiltShiftShader.cjs +43 -27
  474. package/shaders/VerticalTiltShiftShader.cjs.map +1 -1
  475. package/shaders/VerticalTiltShiftShader.js +43 -27
  476. package/shaders/VerticalTiltShiftShader.js.map +1 -1
  477. package/shaders/VignetteShader.cjs +43 -27
  478. package/shaders/VignetteShader.cjs.map +1 -1
  479. package/shaders/VignetteShader.js +43 -27
  480. package/shaders/VignetteShader.js.map +1 -1
  481. package/shaders/VolumeShader.cjs +264 -213
  482. package/shaders/VolumeShader.cjs.map +1 -1
  483. package/shaders/VolumeShader.js +264 -213
  484. package/shaders/VolumeShader.js.map +1 -1
  485. package/shaders/WaterRefractionShader.cjs +63 -35
  486. package/shaders/WaterRefractionShader.cjs.map +1 -1
  487. package/shaders/WaterRefractionShader.js +63 -35
  488. package/shaders/WaterRefractionShader.js.map +1 -1
  489. package/utils/GeometryCompressionUtils.cjs +2 -1
  490. package/utils/GeometryCompressionUtils.cjs.map +1 -1
  491. package/utils/GeometryCompressionUtils.js +3 -2
  492. package/utils/GeometryCompressionUtils.js.map +1 -1
  493. package/utils/RoughnessMipmapper.cjs +3 -3
  494. package/utils/RoughnessMipmapper.cjs.map +1 -1
  495. package/utils/RoughnessMipmapper.js +4 -4
  496. package/utils/RoughnessMipmapper.js.map +1 -1
  497. package/webxr/ARButton.cjs +3 -3
  498. package/webxr/ARButton.cjs.map +1 -1
  499. package/webxr/ARButton.d.ts +3 -3
  500. package/webxr/ARButton.js +3 -3
  501. package/webxr/ARButton.js.map +1 -1
  502. package/webxr/OculusHandPointerModel.cjs +2 -2
  503. package/webxr/OculusHandPointerModel.cjs.map +1 -1
  504. package/webxr/OculusHandPointerModel.js +2 -2
  505. package/webxr/OculusHandPointerModel.js.map +1 -1
  506. package/webxr/VRButton.cjs +98 -95
  507. package/webxr/VRButton.cjs.map +1 -1
  508. package/webxr/VRButton.d.ts +9 -6
  509. package/webxr/VRButton.js +98 -95
  510. package/webxr/VRButton.js.map +1 -1
  511. package/webxr/XRHandPrimitiveModel.cjs +2 -2
  512. package/webxr/XRHandPrimitiveModel.cjs.map +1 -1
  513. package/webxr/XRHandPrimitiveModel.js +3 -3
  514. package/webxr/XRHandPrimitiveModel.js.map +1 -1
@@ -8,282 +8,317 @@ 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 = 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);
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;
72
23
  }
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;
24
+ setTranscoderPath(path) {
25
+ this.transcoderPath = path;
26
+ return this;
87
27
  }
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;
28
+ setWorkerLimit(workerLimit) {
29
+ this.workerLimit = workerLimit;
30
+ return this;
31
+ }
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;
42
+ }
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
+ );
102
65
  return texture;
103
- });
104
- texturePending.catch(() => true).then(() => {
105
- if (worker && taskID) {
106
- worker._taskLoad -= taskCost;
107
- delete worker._callbacks[taskID];
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);
108
73
  }
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);
120
- });
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);
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;
88
+ }
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;
127
104
  });
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;
105
+ texturePending.catch(() => true).then(() => {
106
+ if (worker && taskID) {
107
+ worker._taskLoad -= taskCost;
108
+ delete worker._callbacks[taskID];
109
+ }
142
110
  });
111
+ _taskCache.set(buffers[0], { promise: texturePending });
112
+ return texturePending;
143
113
  }
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
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);
156
121
  });
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;
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);
128
+ });
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;
174
143
  });
175
144
  }
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();
145
+ return this.transcoderPending;
184
146
  }
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);
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 + '"');
248
169
  }
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;
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;
256
188
  }
257
189
  };
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.");
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 {
281
317
  for (let i = 0; i < taskConfig.levels.length; i++) {
282
318
  const level = taskConfig.levels[i];
283
- const imageDesc = taskConfig.globalData.imageDescs[i];
284
319
  const dstByteLength = getTranscodedImageByteLength(transcoderFormat, level.width, level.height);
285
320
  const dst = new Uint8Array(dstByteLength);
286
- ok = transcoder.transcodeImage(
321
+ const ok = BasisModule.transcodeUASTCImage(
287
322
  transcoderFormat,
288
323
  dst,
289
324
  dstByteLength / blockByteLength,
@@ -293,198 +328,169 @@ __publicField(BasisTextureLoader, "BasisWorker", function() {
293
328
  level.width,
294
329
  level.height,
295
330
  level.index,
296
- imageDesc.rgbSliceByteOffset,
297
- imageDesc.rgbSliceByteLength,
298
- imageDesc.alphaSliceByteOffset,
299
- imageDesc.alphaSliceByteLength,
300
- imageDesc.imageFlags,
331
+ 0,
332
+ level.data.byteLength,
333
+ 0,
301
334
  hasAlpha,
302
335
  false,
303
336
  0,
304
- 0
337
+ 0,
338
+ -1,
339
+ -1
305
340
  );
306
- assert(ok, "THREE.BasisTextureLoader: transcodeImage() failed for level " + level.index + ".");
341
+ assert(ok, "THREE.BasisTextureLoader: transcodeUASTCImage() failed for level " + level.index + ".");
307
342
  mipmaps.push({ data: dst, width: level.width, height: level.height });
308
343
  }
309
- } finally {
310
- transcoder.delete();
311
- }
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 });
339
344
  }
345
+ return { width, height, hasAlpha, mipmaps, format: engineFormat };
340
346
  }
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();
353
- }
354
- const { transcoderFormat, engineFormat } = getTranscoderFormat(basisFormat, width, height, hasAlpha);
355
- if (!width || !height || !levels) {
356
- cleanup();
357
- throw new Error("THREE.BasisTextureLoader: Invalid texture");
358
- }
359
- if (!basisFile.startTranscoding()) {
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
+ }
360
379
  cleanup();
361
- throw new Error("THREE.BasisTextureLoader: .startTranscoding failed");
380
+ return { width, height, hasAlpha, mipmaps, format: engineFormat };
362
381
  }
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.");
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 };
372
459
  }
373
- mipmaps.push({ data: dst, width: mipWidth, height: mipHeight });
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 };
374
464
  }
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
465
+ function assert(ok, message) {
466
+ if (!ok)
467
+ throw new Error(message);
432
468
  }
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;
439
- });
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 };
469
+ function getWidthInBlocks(transcoderFormat, width) {
470
+ return Math.ceil(width / BasisModule.getFormatBlockWidth(transcoderFormat));
455
471
  }
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;
472
+ function getHeightInBlocks(transcoderFormat, height) {
473
+ return Math.ceil(height / BasisModule.getFormatBlockHeight(transcoderFormat));
475
474
  }
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;
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;
484
+ }
485
+ return getWidthInBlocks(transcoderFormat, width) * getHeightInBlocks(transcoderFormat, height) * blockByteLength;
480
486
  }
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
- });
487
+ function isPowerOfTwo(value) {
488
+ if (value <= 2)
489
+ return true;
490
+ return (value & value - 1) === 0 && value !== 0;
491
+ }
492
+ });
493
+ return BasisTextureLoader2;
494
+ })();
489
495
  exports.BasisTextureLoader = BasisTextureLoader;
490
496
  //# sourceMappingURL=BasisTextureLoader.cjs.map