three-stdlib 2.35.2 → 2.35.4

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