@woosh/meep-engine 3.79.0 → 3.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. package/CHANGELOG.md +62 -3
  2. package/README.md +1 -1
  3. package/package.json +1 -1
  4. package/src/format/image/webp/vp8/VP8BoolDecoder.d.ts +45 -0
  5. package/src/format/image/webp/vp8/VP8BoolDecoder.d.ts.map +1 -0
  6. package/src/format/image/webp/vp8/VP8BoolDecoder.js +137 -0
  7. package/src/format/image/webp/vp8/vp8_decode.d.ts +21 -0
  8. package/src/format/image/webp/vp8/vp8_decode.d.ts.map +1 -0
  9. package/src/format/image/webp/vp8/vp8_decode.js +756 -0
  10. package/src/format/image/webp/vp8/vp8_loop_filter.d.ts +31 -0
  11. package/src/format/image/webp/vp8/vp8_loop_filter.d.ts.map +1 -0
  12. package/src/format/image/webp/vp8/vp8_loop_filter.js +189 -0
  13. package/src/format/image/webp/vp8/vp8_predict.d.ts +48 -0
  14. package/src/format/image/webp/vp8/vp8_predict.d.ts.map +1 -0
  15. package/src/format/image/webp/vp8/vp8_predict.js +290 -0
  16. package/src/format/image/webp/vp8/vp8_tables.d.ts +34 -0
  17. package/src/format/image/webp/vp8/vp8_tables.d.ts.map +1 -0
  18. package/src/format/image/webp/vp8/vp8_tables.js +350 -0
  19. package/src/format/image/webp/vp8/vp8_transform.d.ts +22 -0
  20. package/src/format/image/webp/vp8/vp8_transform.d.ts.map +1 -0
  21. package/src/format/image/webp/vp8/vp8_transform.js +114 -0
  22. package/src/format/image/webp/vp8/vp8_yuv_to_rgba.d.ts +23 -0
  23. package/src/format/image/webp/vp8/vp8_yuv_to_rgba.d.ts.map +1 -0
  24. package/src/format/image/webp/vp8/vp8_yuv_to_rgba.js +133 -0
  25. package/src/format/image/webp/vp8l/VP8LBitReader.d.ts +47 -0
  26. package/src/format/image/webp/vp8l/VP8LBitReader.d.ts.map +1 -0
  27. package/src/format/image/webp/vp8l/VP8LBitReader.js +84 -0
  28. package/src/format/image/webp/vp8l/VP8LPrefixCode.d.ts +27 -0
  29. package/src/format/image/webp/vp8l/VP8LPrefixCode.d.ts.map +1 -0
  30. package/src/format/image/webp/vp8l/VP8LPrefixCode.js +184 -0
  31. package/src/format/image/webp/vp8l/vp8l_decode.d.ts +28 -0
  32. package/src/format/image/webp/vp8l/vp8l_decode.d.ts.map +1 -0
  33. package/src/format/image/webp/vp8l/vp8l_decode.js +261 -0
  34. package/src/format/image/webp/vp8l/vp8l_distance.d.ts +22 -0
  35. package/src/format/image/webp/vp8l/vp8l_distance.d.ts.map +1 -0
  36. package/src/format/image/webp/vp8l/vp8l_distance.js +62 -0
  37. package/src/format/image/webp/vp8l/vp8l_inverse_transforms.d.ts +50 -0
  38. package/src/format/image/webp/vp8l/vp8l_inverse_transforms.d.ts.map +1 -0
  39. package/src/format/image/webp/vp8l/vp8l_inverse_transforms.js +267 -0
  40. package/src/format/image/webp/vp8l/vp8l_read_prefix_code.d.ts +14 -0
  41. package/src/format/image/webp/vp8l/vp8l_read_prefix_code.d.ts.map +1 -0
  42. package/src/format/image/webp/vp8l/vp8l_read_prefix_code.js +99 -0
  43. package/src/format/image/webp/webp_decode.d.ts +23 -0
  44. package/src/format/image/webp/webp_decode.d.ts.map +1 -0
  45. package/src/format/image/webp/webp_decode.js +179 -0
  46. package/src/format/image/webp/webp_decode_alpha.d.ts +18 -0
  47. package/src/format/image/webp/webp_decode_alpha.d.ts.map +1 -0
  48. package/src/format/image/webp/webp_decode_alpha.js +84 -0
  49. package/src/format/texture/{basis → astc}/astc_block.d.ts +41 -0
  50. package/src/format/texture/astc/astc_block.d.ts.map +1 -0
  51. package/src/format/texture/{basis → astc}/astc_block.js +284 -164
  52. package/src/format/texture/astc/astc_decode_block.d.ts +68 -0
  53. package/src/format/texture/astc/astc_decode_block.d.ts.map +1 -0
  54. package/src/format/texture/astc/astc_decode_block.js +1119 -0
  55. package/src/format/texture/astc/astc_encode_block_4x4.d.ts +32 -0
  56. package/src/format/texture/astc/astc_encode_block_4x4.d.ts.map +1 -0
  57. package/src/format/texture/astc/astc_encode_block_4x4.js +181 -0
  58. package/src/format/texture/astc/astc_encode_block_4x4_rgba.d.ts +32 -0
  59. package/src/format/texture/astc/astc_encode_block_4x4_rgba.d.ts.map +1 -0
  60. package/src/format/texture/astc/astc_encode_block_4x4_rgba.js +337 -0
  61. package/src/format/texture/astc/astc_integer_sequence.d.ts.map +1 -0
  62. package/src/format/texture/{basis → astc}/astc_integer_sequence.js +251 -251
  63. package/src/format/texture/astc/astc_partition.d.ts.map +1 -0
  64. package/src/format/texture/{basis → astc}/astc_partition.js +199 -199
  65. package/src/format/texture/basis/transcode/etc1s_to_astc.js +329 -329
  66. package/src/format/texture/basis/transcode/etc1s_to_etc2.d.ts.map +1 -1
  67. package/src/format/texture/basis/transcode/etc1s_to_etc2.js +305 -332
  68. package/src/format/texture/basis/transcode/fit_endpoints.d.ts.map +1 -1
  69. package/src/format/texture/basis/transcode/fit_endpoints.js +14 -27
  70. package/src/format/texture/basis/uastc/uastc_bc7_tables.d.ts +66 -0
  71. package/src/format/texture/basis/uastc/uastc_bc7_tables.d.ts.map +1 -0
  72. package/src/format/texture/basis/uastc/uastc_bc7_tables.js +148 -0
  73. package/src/format/texture/basis/uastc/uastc_decode_block.js +463 -463
  74. package/src/format/texture/basis/uastc/uastc_to_astc.js +421 -421
  75. package/src/format/texture/basis/uastc/uastc_to_bc5.d.ts +1 -6
  76. package/src/format/texture/basis/uastc/uastc_to_bc5.d.ts.map +1 -1
  77. package/src/format/texture/basis/uastc/uastc_to_bc5.js +48 -115
  78. package/src/format/texture/basis/uastc/uastc_to_bc7.d.ts.map +1 -1
  79. package/src/format/texture/basis/uastc/uastc_to_bc7.js +604 -602
  80. package/src/format/texture/bc/bc1_decode_block.d.ts +19 -0
  81. package/src/format/texture/bc/bc1_decode_block.d.ts.map +1 -0
  82. package/src/format/texture/bc/bc1_decode_block.js +22 -0
  83. package/src/format/texture/bc/bc1_decode_colors.d.ts +27 -0
  84. package/src/format/texture/bc/bc1_decode_colors.d.ts.map +1 -0
  85. package/src/format/texture/bc/bc1_decode_colors.js +100 -0
  86. package/src/format/texture/bc/bc2_decode_block.d.ts +18 -0
  87. package/src/format/texture/bc/bc2_decode_block.d.ts.map +1 -0
  88. package/src/format/texture/bc/bc2_decode_block.js +28 -0
  89. package/src/format/texture/bc/bc3_decode_block.d.ts +18 -0
  90. package/src/format/texture/bc/bc3_decode_block.d.ts.map +1 -0
  91. package/src/format/texture/bc/bc3_decode_block.js +23 -0
  92. package/src/format/texture/bc/bc4_decode_channel.d.ts +56 -0
  93. package/src/format/texture/bc/bc4_decode_channel.d.ts.map +1 -0
  94. package/src/format/texture/bc/bc4_decode_channel.js +138 -0
  95. package/src/format/texture/bc/bc4_encode_block.d.ts +43 -0
  96. package/src/format/texture/bc/bc4_encode_block.d.ts.map +1 -0
  97. package/src/format/texture/bc/bc4_encode_block.js +324 -0
  98. package/src/format/texture/bc/bc4_snorm_decode_block.d.ts +18 -0
  99. package/src/format/texture/bc/bc4_snorm_decode_block.d.ts.map +1 -0
  100. package/src/format/texture/bc/bc4_snorm_decode_block.js +27 -0
  101. package/src/format/texture/bc/bc4_unorm_decode_block.d.ts +17 -0
  102. package/src/format/texture/bc/bc4_unorm_decode_block.d.ts.map +1 -0
  103. package/src/format/texture/bc/bc4_unorm_decode_block.js +26 -0
  104. package/src/format/texture/bc/bc5_encode_block.d.ts +25 -0
  105. package/src/format/texture/bc/bc5_encode_block.d.ts.map +1 -0
  106. package/src/format/texture/bc/bc5_encode_block.js +34 -0
  107. package/src/format/texture/bc/bc5_snorm_decode_block.d.ts +18 -0
  108. package/src/format/texture/bc/bc5_snorm_decode_block.d.ts.map +1 -0
  109. package/src/format/texture/bc/bc5_snorm_decode_block.js +27 -0
  110. package/src/format/texture/bc/bc5_unorm_decode_block.d.ts +17 -0
  111. package/src/format/texture/bc/bc5_unorm_decode_block.d.ts.map +1 -0
  112. package/src/format/texture/bc/bc5_unorm_decode_block.js +26 -0
  113. package/src/format/texture/bc/bc6h_decode_texels.d.ts +30 -0
  114. package/src/format/texture/bc/bc6h_decode_texels.d.ts.map +1 -0
  115. package/src/format/texture/bc/bc6h_decode_texels.js +430 -0
  116. package/src/format/texture/bc/bc6h_sfloat_decode_block.d.ts +20 -0
  117. package/src/format/texture/bc/bc6h_sfloat_decode_block.d.ts.map +1 -0
  118. package/src/format/texture/bc/bc6h_sfloat_decode_block.js +23 -0
  119. package/src/format/texture/bc/bc6h_ufloat_decode_block.d.ts +18 -0
  120. package/src/format/texture/bc/bc6h_ufloat_decode_block.d.ts.map +1 -0
  121. package/src/format/texture/bc/bc6h_ufloat_decode_block.js +21 -0
  122. package/src/format/texture/bc/bc7_decode_block.d.ts +30 -0
  123. package/src/format/texture/bc/bc7_decode_block.d.ts.map +1 -0
  124. package/src/format/texture/bc/bc7_decode_block.js +232 -0
  125. package/src/format/texture/bc/bc7_encode_block.d.ts +39 -0
  126. package/src/format/texture/bc/bc7_encode_block.d.ts.map +1 -0
  127. package/src/format/texture/bc/bc7_encode_block.js +423 -0
  128. package/src/format/texture/bc/bc7_tables.d.ts +126 -0
  129. package/src/format/texture/bc/bc7_tables.d.ts.map +1 -0
  130. package/src/format/texture/{basis/uastc → bc}/bc7_tables.js +225 -276
  131. package/src/format/texture/bc/bc7_write_block.d.ts +65 -0
  132. package/src/format/texture/bc/bc7_write_block.d.ts.map +1 -0
  133. package/src/format/texture/{basis/uastc → bc}/bc7_write_block.js +185 -227
  134. package/src/format/texture/etc/eac_decode_channel.d.ts +50 -0
  135. package/src/format/texture/etc/eac_decode_channel.d.ts.map +1 -0
  136. package/src/format/texture/etc/eac_decode_channel.js +142 -0
  137. package/src/format/texture/etc/eac_modifiers.d.ts +15 -0
  138. package/src/format/texture/etc/eac_modifiers.d.ts.map +1 -0
  139. package/src/format/texture/etc/eac_modifiers.js +31 -0
  140. package/src/format/texture/etc/eac_r11_snorm_decode_block.d.ts +21 -0
  141. package/src/format/texture/etc/eac_r11_snorm_decode_block.d.ts.map +1 -0
  142. package/src/format/texture/etc/eac_r11_snorm_decode_block.js +30 -0
  143. package/src/format/texture/etc/eac_r11_unorm_decode_block.d.ts +20 -0
  144. package/src/format/texture/etc/eac_r11_unorm_decode_block.d.ts.map +1 -0
  145. package/src/format/texture/etc/eac_r11_unorm_decode_block.js +29 -0
  146. package/src/format/texture/etc/eac_rg11_snorm_decode_block.d.ts +19 -0
  147. package/src/format/texture/etc/eac_rg11_snorm_decode_block.d.ts.map +1 -0
  148. package/src/format/texture/etc/eac_rg11_snorm_decode_block.js +28 -0
  149. package/src/format/texture/etc/eac_rg11_unorm_decode_block.d.ts +19 -0
  150. package/src/format/texture/etc/eac_rg11_unorm_decode_block.d.ts.map +1 -0
  151. package/src/format/texture/etc/eac_rg11_unorm_decode_block.js +28 -0
  152. package/src/format/texture/etc/etc2_decode_color.d.ts +25 -0
  153. package/src/format/texture/etc/etc2_decode_color.d.ts.map +1 -0
  154. package/src/format/texture/etc/etc2_decode_color.js +370 -0
  155. package/src/format/texture/etc/etc2_rgb8_decode_block.d.ts +18 -0
  156. package/src/format/texture/etc/etc2_rgb8_decode_block.d.ts.map +1 -0
  157. package/src/format/texture/etc/etc2_rgb8_decode_block.js +21 -0
  158. package/src/format/texture/etc/etc2_rgb8a1_decode_block.d.ts +21 -0
  159. package/src/format/texture/etc/etc2_rgb8a1_decode_block.d.ts.map +1 -0
  160. package/src/format/texture/etc/etc2_rgb8a1_decode_block.js +24 -0
  161. package/src/format/texture/etc/etc2_rgba8_decode_block.d.ts +18 -0
  162. package/src/format/texture/etc/etc2_rgba8_decode_block.d.ts.map +1 -0
  163. package/src/format/texture/etc/etc2_rgba8_decode_block.js +24 -0
  164. package/src/format/texture/fit/fit_line.d.ts +23 -0
  165. package/src/format/texture/fit/fit_line.d.ts.map +1 -0
  166. package/src/format/texture/fit/fit_line.js +123 -0
  167. package/src/format/texture/fit/fit_line_refine.d.ts +21 -0
  168. package/src/format/texture/fit/fit_line_refine.d.ts.map +1 -0
  169. package/src/format/texture/fit/fit_line_refine.js +69 -0
  170. package/src/format/texture/fit/fit_line_solve.d.ts +23 -0
  171. package/src/format/texture/fit/fit_line_solve.d.ts.map +1 -0
  172. package/src/format/texture/fit/fit_line_solve.js +71 -0
  173. package/src/format/texture/texel_decode_image.d.ts +44 -0
  174. package/src/format/texture/texel_decode_image.d.ts.map +1 -0
  175. package/src/format/texture/texel_decode_image.js +251 -0
  176. package/src/format/texture/texel_encode_image.d.ts +77 -0
  177. package/src/format/texture/texel_encode_image.d.ts.map +1 -0
  178. package/src/format/texture/texel_encode_image.js +187 -0
  179. package/src/shade/renderer/ShadeIndirectLightingMode.js +2 -0
  180. package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
  181. package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
  182. package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts +1 -0
  183. package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts.map +1 -1
  184. package/src/shade/renderer/loader/mtf/mtf_encode_texture.js +102 -28
  185. package/src/shade/renderer/loader/mtf/mtf_replace_textures.d.ts +19 -0
  186. package/src/shade/renderer/loader/mtf/mtf_replace_textures.d.ts.map +1 -0
  187. package/src/shade/renderer/loader/mtf/mtf_replace_textures.js +60 -0
  188. package/src/shade/renderer/loader/mtf/mtf_write.d.ts.map +1 -1
  189. package/src/shade/renderer/loader/mtf/mtf_write.js +7 -31
  190. package/src/shade/renderer/loader/mtf/mtf_write_collection.d.ts +23 -0
  191. package/src/shade/renderer/loader/mtf/mtf_write_collection.d.ts.map +1 -0
  192. package/src/shade/renderer/loader/mtf/mtf_write_collection.js +36 -0
  193. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.d.ts +13 -0
  194. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.d.ts.map +1 -0
  195. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.js +39 -0
  196. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts +3 -2
  197. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
  198. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +6 -21
  199. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.d.ts +42 -0
  200. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.d.ts.map +1 -0
  201. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.js +612 -0
  202. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +5 -4
  203. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
  204. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +8 -25
  205. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
  206. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +3 -19
  207. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +14 -4
  208. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -1
  209. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +65 -54
  210. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +2 -2
  211. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
  212. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +5 -22
  213. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +1 -1
  214. package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.d.ts +27 -0
  215. package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.d.ts.map +1 -0
  216. package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.js +147 -0
  217. package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.d.ts +3 -4
  218. package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.d.ts.map +1 -1
  219. package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.js +6 -13
  220. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.d.ts +13 -0
  221. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.d.ts.map +1 -0
  222. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.js +66 -0
  223. package/src/shade/renderer/texture/encode/texture_encode.d.ts +28 -1
  224. package/src/shade/renderer/texture/encode/texture_encode.d.ts.map +1 -1
  225. package/src/shade/renderer/texture/encode/texture_encode.js +202 -168
  226. package/src/shade/renderer/texture/encode/texture_encode_shader.d.ts +13 -1
  227. package/src/shade/renderer/texture/encode/texture_encode_shader.d.ts.map +1 -1
  228. package/src/shade/renderer/texture/encode/texture_encode_shader.js +146 -108
  229. package/src/shade/renderer/texture/format/texture_formats_to_build.d.ts +20 -0
  230. package/src/shade/renderer/texture/format/texture_formats_to_build.d.ts.map +1 -0
  231. package/src/shade/renderer/texture/format/texture_formats_to_build.js +98 -0
  232. package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.d.ts.map +1 -1
  233. package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +4 -23
  234. package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.d.ts +53 -0
  235. package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.d.ts.map +1 -0
  236. package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.js +76 -0
  237. package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.d.ts +40 -0
  238. package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.d.ts.map +1 -0
  239. package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.js +43 -0
  240. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.d.ts +17 -0
  241. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.d.ts.map +1 -0
  242. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.js +29 -0
  243. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.d.ts +21 -0
  244. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.d.ts.map +1 -0
  245. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.js +91 -0
  246. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.d.ts +32 -0
  247. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.d.ts.map +1 -0
  248. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.js +216 -0
  249. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.d.ts +30 -0
  250. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.d.ts.map +1 -0
  251. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.js +134 -0
  252. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.d.ts +16 -0
  253. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.d.ts.map +1 -0
  254. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.js +33 -0
  255. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.d.ts +18 -0
  256. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.d.ts.map +1 -0
  257. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.js +71 -0
  258. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.d.ts +20 -0
  259. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.d.ts.map +1 -0
  260. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.js +57 -0
  261. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.d.ts +18 -0
  262. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.d.ts.map +1 -0
  263. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.js +111 -0
  264. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.d.ts +16 -0
  265. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.d.ts.map +1 -0
  266. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.js +33 -0
  267. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.d.ts +18 -0
  268. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.d.ts.map +1 -0
  269. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.js +128 -0
  270. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.d.ts +21 -0
  271. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.d.ts.map +1 -0
  272. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.js +169 -0
  273. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.d.ts +21 -0
  274. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.d.ts.map +1 -0
  275. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.js +119 -0
  276. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.d.ts +16 -0
  277. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.d.ts.map +1 -0
  278. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.js +19 -0
  279. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.d.ts +24 -0
  280. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.d.ts.map +1 -0
  281. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.js +41 -0
  282. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.d.ts +24 -0
  283. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.d.ts.map +1 -0
  284. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.js +140 -0
  285. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.d.ts +21 -0
  286. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.d.ts.map +1 -0
  287. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.js +35 -0
  288. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.d.ts +19 -0
  289. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.d.ts.map +1 -0
  290. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.js +27 -0
  291. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_catmull_rom.js +4 -4
  292. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.d.ts +13 -0
  293. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.d.ts.map +1 -1
  294. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.js +54 -4
  295. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mitchell.js +4 -4
  296. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mks.d.ts.map +1 -1
  297. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mks.js +9 -13
  298. package/src/shade/renderer/texture/texture_block_encodings.d.ts +33 -0
  299. package/src/shade/renderer/texture/texture_block_encodings.d.ts.map +1 -0
  300. package/src/shade/renderer/texture/texture_block_encodings.js +89 -0
  301. package/src/format/texture/basis/astc_block.d.ts.map +0 -1
  302. package/src/format/texture/basis/astc_integer_sequence.d.ts.map +0 -1
  303. package/src/format/texture/basis/astc_partition.d.ts.map +0 -1
  304. package/src/format/texture/basis/uastc/bc7_tables.d.ts +0 -111
  305. package/src/format/texture/basis/uastc/bc7_tables.d.ts.map +0 -1
  306. package/src/format/texture/basis/uastc/bc7_write_block.d.ts +0 -124
  307. package/src/format/texture/basis/uastc/bc7_write_block.d.ts.map +0 -1
  308. /package/src/format/texture/{basis → astc}/astc_integer_sequence.d.ts +0 -0
  309. /package/src/format/texture/{basis → astc}/astc_partition.d.ts +0 -0
@@ -1,164 +1,284 @@
1
- /**
2
- * Bytes in one ASTC 4x4 block.
3
- *
4
- * @readonly
5
- * @type {number}
6
- */
7
- export const ASTC_BLOCK_BYTES = 16;
8
-
9
- /**
10
- * Colour endpoint mode 8: LDR RGB, direct. Six endpoint values, `R0 R1 G0 G1 B0 B1`.
11
- *
12
- * @readonly
13
- * @type {number}
14
- */
15
- export const CEM_LDR_RGB_DIRECT = 8;
16
-
17
- /**
18
- * Where the endpoint values begin: eleven bits of block mode, two of partition count, four of CEM.
19
- *
20
- * @readonly
21
- * @type {number}
22
- */
23
- const ENDPOINT_BIT = 17;
24
-
25
- /**
26
- * The two single-plane 4x4 block modes this tree writes, by how many bits a weight takes.
27
- *
28
- * **Read out of the specification's block-mode layout, and confirmed against the reference.** The
29
- * low-precision row packs `D` at bit 10, `H` at 9, the height term `B` at 8:7, the width term `A` at
30
- * 6:5, `R0` at 4, two zero bits, then `R2` and `R1` at 1:0 — with the grid `A+2` wide by `B+4` high
31
- * and the weight range read from `R = R2·4 + R1·2 + R0`. So `A = 2`, `B = 0`, `D = H = 0` is a 4x4
32
- * grid on one plane, and `R` picks the range: 4 gives four levels and 7 gives eight.
33
- *
34
- * Both appear in `basisu`'s own output for these files, which is what turns a derivation into a
35
- * check.
36
- *
37
- * @readonly
38
- * @type {Object<number, number>}
39
- */
40
- export const ASTC_BLOCK_MODE = {
41
- 2: 0x42,
42
- 3: 0x53,
43
- };
44
-
45
- /**
46
- * What a weight unquantizes to, out of 64, for each weight-bit count this writes.
47
- *
48
- * **Not evenly spaced, and not a rounding of `v / levels`.** A pure-bit weight is replicated up to
49
- * six bits and then nudged: `if (T > 32) T += 1`, which is what turns the top of the range into
50
- * exactly 64 rather than 63. Two bits gives `0, 21, 43, 64` and three gives `0, 9, 18, 27, 37, 46,
51
- * 55, 64` — note 36 becoming 37, which a thirds-and-sevenths formula does not produce.
52
- *
53
- * @readonly
54
- * @type {Object<number, number[]>}
55
- */
56
- export const ASTC_WEIGHT_UNQUANTIZED = {
57
- 2: [0, 21, 43, 64],
58
- 3: [0, 9, 18, 27, 37, 46, 55, 64],
59
- };
60
-
61
- /**
62
- * Decode one channel the way the format does.
63
- *
64
- * **This is not `c0 + (c1 - c0) * w / 64`.** ASTC widens each 8-bit endpoint to sixteen bits by bit
65
- * replication first, interpolates there with a rounding `+32`, and takes the top eight bits of the
66
- * result — which disagrees with the direct form on about one texel in twenty, always by a level.
67
- * Fitting endpoints against the direct form and letting hardware decode with this one puts that
68
- * disagreement into the output for nothing, so every encoder here scores against this.
69
- *
70
- * @param {number} c0 eight bits
71
- * @param {number} c1 eight bits
72
- * @param {number} weight unquantized, `0..64`
73
- * @returns {number} eight bits
74
- */
75
- export function astc_interpolate(c0, c1, weight) {
76
- const wide0 = (c0 << 8) | c0;
77
- const wide1 = (c1 << 8) | c1;
78
-
79
- return Math.floor((wide0 * (64 - weight) + wide1 * weight + 32) / 64) >> 8;
80
- }
81
-
82
- /**
83
- * Put the endpoints the way round colour endpoint mode 8 requires, inverting the weights to match.
84
- *
85
- * **The rule that makes a wrong-way-round block decode as the wrong colours rather than as a
86
- * mirror.** Mode 8 compares the endpoints by the sum of their channels: with `s1 >= s0` they are
87
- * taken as written, and otherwise the decoder *swaps* them and applies blue contraction —
88
- * `r = (r + b) >> 1`, `g = (g + b) >> 1` — to both. That second path is a different picture, not an
89
- * inverted one, and no bit in the block records that it happened.
90
- *
91
- * A least-squares fit puts the first endpoint at the darker end, so this is nearly always already
92
- * satisfied; nearly is not a guarantee once rounding and clamping have run, and a block that trips
93
- * it is not one any test would think to construct. Swapping the pair and inverting the weights
94
- * leaves the decoded block identical, so it costs nothing where it does nothing.
95
- *
96
- * @param {Int32Array} endpoints six values, `R0 R1 G0 G1 B0 B1`, modified in place
97
- * @param {Uint8Array} weights sixteen weight *levels* (not unquantized), modified in place
98
- * @param {number} top the highest weight level, so the inversion knows its own range
99
- */
100
- export function astc_order_endpoints(endpoints, weights, top) {
101
- const first = endpoints[0] + endpoints[2] + endpoints[4];
102
- const second = endpoints[1] + endpoints[3] + endpoints[5];
103
-
104
- if (second >= first) {
105
- return;
106
- }
107
-
108
- for (let channel = 0; channel < 3; channel++) {
109
- const swap = endpoints[channel * 2];
110
-
111
- endpoints[channel * 2] = endpoints[channel * 2 + 1];
112
- endpoints[channel * 2 + 1] = swap;
113
- }
114
-
115
- for (let texel = 0; texel < 16; texel++) {
116
- weights[texel] = top - weights[texel];
117
- }
118
- }
119
-
120
- /**
121
- * Write one single-partition, mode-8 ASTC block: header and endpoints from the bottom, weights from
122
- * the top.
123
- *
124
- * @param {Uint8Array} out
125
- * @param {number} offset
126
- * @param {Int32Array} endpoints six values, `R0 R1 G0 G1 B0 B1`
127
- * @param {Uint8Array} weights sixteen weight levels, in raster order
128
- * @param {number} weight_bits 2 or 3
129
- */
130
- export function astc_write_block(out, offset, endpoints, weights, weight_bits) {
131
- let block = BigInt(ASTC_BLOCK_MODE[weight_bits]);
132
-
133
- // partition count - 1, at bits 11..12, is zero: one partition
134
-
135
- block |= BigInt(CEM_LDR_RGB_DIRECT) << 13n;
136
-
137
- for (let i = 0; i < 6; i++) {
138
- block |= BigInt(endpoints[i]) << BigInt(ENDPOINT_BIT + i * 8);
139
- }
140
-
141
- /*
142
- The weights fill the top of the block with the whole field's bit order reversed — the first
143
- texel's weight ends up in the block's most significant bits. Building the field the natural way
144
- round and mirroring it once is easier to read than writing each weight to a computed bit, and is
145
- the same thing.
146
- */
147
- let field = 0n;
148
-
149
- for (let texel = 0; texel < 16; texel++) {
150
- field |= BigInt(weights[texel]) << BigInt(texel * weight_bits);
151
- }
152
-
153
- const width = 16 * weight_bits;
154
-
155
- for (let i = 0; i < width; i++) {
156
- if ((field >> BigInt(i)) & 1n) {
157
- block |= 1n << BigInt(127 - i);
158
- }
159
- }
160
-
161
- for (let i = 0; i < ASTC_BLOCK_BYTES; i++) {
162
- out[offset + i] = Number((block >> BigInt(i * 8)) & 0xFFn);
163
- }
164
- }
1
+ import { astc_write_integer_sequence } from "./astc_integer_sequence.js";
2
+
3
+ /**
4
+ * Bytes in one ASTC 4x4 block.
5
+ *
6
+ * @readonly
7
+ * @type {number}
8
+ */
9
+ export const ASTC_BLOCK_BYTES = 16;
10
+
11
+ /**
12
+ * Colour endpoint mode 8: LDR RGB, direct. Six endpoint values, `R0 R1 G0 G1 B0 B1`.
13
+ *
14
+ * @readonly
15
+ * @type {number}
16
+ */
17
+ export const CEM_LDR_RGB_DIRECT = 8;
18
+
19
+ /**
20
+ * Where the endpoint values begin: eleven bits of block mode, two of partition count, four of CEM.
21
+ *
22
+ * @readonly
23
+ * @type {number}
24
+ */
25
+ const ENDPOINT_BIT = 17;
26
+
27
+ /**
28
+ * The two single-plane 4x4 block modes this tree writes, by how many bits a weight takes.
29
+ *
30
+ * **Read out of the specification's block-mode layout, and confirmed against the reference.** The
31
+ * low-precision row packs `D` at bit 10, `H` at 9, the height term `B` at 8:7, the width term `A` at
32
+ * 6:5, `R0` at 4, two zero bits, then `R2` and `R1` at 1:0 — with the grid `A+2` wide by `B+4` high
33
+ * and the weight range read from `R = R2·4 + R1·2 + R0`. So `A = 2`, `B = 0`, `D = H = 0` is a 4x4
34
+ * grid on one plane, and `R` picks the range: 4 gives four levels and 7 gives eight.
35
+ *
36
+ * Both appear in `basisu`'s own output for these files, which is what turns a derivation into a
37
+ * check.
38
+ *
39
+ * @readonly
40
+ * @type {Object<number, number>}
41
+ */
42
+ export const ASTC_BLOCK_MODE = {
43
+ 2: 0x42,
44
+ 3: 0x53,
45
+ };
46
+
47
+ /**
48
+ * What a weight unquantizes to, out of 64, for each weight-bit count this writes.
49
+ *
50
+ * **Not evenly spaced, and not a rounding of `v / levels`.** A pure-bit weight is replicated up to
51
+ * six bits and then nudged: `if (T > 32) T += 1`, which is what turns the top of the range into
52
+ * exactly 64 rather than 63. Two bits gives `0, 21, 43, 64` and three gives `0, 9, 18, 27, 37, 46,
53
+ * 55, 64` — note 36 becoming 37, which a thirds-and-sevenths formula does not produce.
54
+ *
55
+ * @readonly
56
+ * @type {Object<number, number[]>}
57
+ */
58
+ export const ASTC_WEIGHT_UNQUANTIZED = {
59
+ 2: [0, 21, 43, 64],
60
+ 3: [0, 9, 18, 27, 37, 46, 55, 64],
61
+ };
62
+
63
+ /**
64
+ * Decode one channel the way the format does.
65
+ *
66
+ * **This is not `c0 + (c1 - c0) * w / 64`.** ASTC widens each 8-bit endpoint to sixteen bits by bit
67
+ * replication first, interpolates there with a rounding `+32`, and takes the top eight bits of the
68
+ * result — which disagrees with the direct form on about one texel in twenty, always by a level.
69
+ * Fitting endpoints against the direct form and letting hardware decode with this one puts that
70
+ * disagreement into the output for nothing, so every encoder here scores against this.
71
+ *
72
+ * @param {number} c0 eight bits
73
+ * @param {number} c1 eight bits
74
+ * @param {number} weight unquantized, `0..64`
75
+ * @returns {number} eight bits
76
+ */
77
+ export function astc_interpolate(c0, c1, weight) {
78
+ const wide0 = (c0 << 8) | c0;
79
+ const wide1 = (c1 << 8) | c1;
80
+
81
+ return Math.floor((wide0 * (64 - weight) + wide1 * weight + 32) / 64) >> 8;
82
+ }
83
+
84
+ /**
85
+ * Put the endpoints the way round colour endpoint mode 8 requires, inverting the weights to match.
86
+ *
87
+ * **The rule that makes a wrong-way-round block decode as the wrong colours rather than as a
88
+ * mirror.** Mode 8 compares the endpoints by the sum of their channels: with `s1 >= s0` they are
89
+ * taken as written, and otherwise the decoder *swaps* them and applies blue contraction —
90
+ * `r = (r + b) >> 1`, `g = (g + b) >> 1` — to both. That second path is a different picture, not an
91
+ * inverted one, and no bit in the block records that it happened.
92
+ *
93
+ * A least-squares fit puts the first endpoint at the darker end, so this is nearly always already
94
+ * satisfied; nearly is not a guarantee once rounding and clamping have run, and a block that trips
95
+ * it is not one any test would think to construct. Swapping the pair and inverting the weights
96
+ * leaves the decoded block identical, so it costs nothing where it does nothing.
97
+ *
98
+ * @param {Int32Array} endpoints six values, `R0 R1 G0 G1 B0 B1`, modified in place
99
+ * @param {Uint8Array} weights sixteen weight *levels* (not unquantized), modified in place
100
+ * @param {number} top the highest weight level, so the inversion knows its own range
101
+ */
102
+ export function astc_order_endpoints(endpoints, weights, top) {
103
+ const first = endpoints[0] + endpoints[2] + endpoints[4];
104
+ const second = endpoints[1] + endpoints[3] + endpoints[5];
105
+
106
+ if (second >= first) {
107
+ return;
108
+ }
109
+
110
+ for (let channel = 0; channel < 3; channel++) {
111
+ const swap = endpoints[channel * 2];
112
+
113
+ endpoints[channel * 2] = endpoints[channel * 2 + 1];
114
+ endpoints[channel * 2 + 1] = swap;
115
+ }
116
+
117
+ for (let texel = 0; texel < 16; texel++) {
118
+ weights[texel] = top - weights[texel];
119
+ }
120
+ }
121
+
122
+ /**
123
+ * Write one single-partition, mode-8 ASTC block: header and endpoints from the bottom, weights from
124
+ * the top.
125
+ *
126
+ * @param {Uint8Array} out
127
+ * @param {number} offset
128
+ * @param {Int32Array} endpoints six values, `R0 R1 G0 G1 B0 B1`
129
+ * @param {Uint8Array} weights sixteen weight levels, in raster order
130
+ * @param {number} weight_bits 2 or 3
131
+ */
132
+ export function astc_write_block(out, offset, endpoints, weights, weight_bits) {
133
+ out.fill(0, offset, offset + ASTC_BLOCK_BYTES);
134
+
135
+ set_bits(out, offset, 0, ASTC_BLOCK_MODE[weight_bits], 11);
136
+
137
+ // partition count - 1, at bits 11..12, is zero: one partition
138
+
139
+ set_bits(out, offset, 13, CEM_LDR_RGB_DIRECT, 4);
140
+
141
+ for (let i = 0; i < 6; i++) {
142
+ set_bits(out, offset, ENDPOINT_BIT + i * 8, endpoints[i], 8);
143
+ }
144
+
145
+ /*
146
+ The weights fill the top of the block with the whole field's bit order reversed: bit `i` of the field, which
147
+ holds texel `i / weight_bits`'s weight from its lowest bit up, is the block's bit `127 - i`.
148
+ */
149
+ for (let texel = 0; texel < 16; texel++) {
150
+ const weight = weights[texel];
151
+
152
+ for (let b = 0; b < weight_bits; b++) {
153
+ if (((weight >> b) & 1) !== 0) {
154
+ const bit = 127 - (texel * weight_bits + b);
155
+
156
+ out[offset + (bit >> 3)] |= 1 << (bit & 7);
157
+ }
158
+ }
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Colour endpoint mode 12: LDR RGBA, direct. Eight endpoint values, `R0 R1 G0 G1 B0 B1 A0 A1`.
164
+ *
165
+ * @readonly
166
+ * @type {number}
167
+ */
168
+ export const CEM_LDR_RGBA_DIRECT = 12;
169
+
170
+ /**
171
+ * The single-plane mode-12 block: block mode 0x53, sixteen weights of eight levels (48 bits), which leaves the
172
+ * eight endpoints the range of 192 levels (six bits and a trit each, 61 bits). The ranges are indices into
173
+ * `ASTC_RANGE`.
174
+ *
175
+ * @readonly
176
+ */
177
+ export const ASTC_RGBA_SINGLE_WEIGHT_RANGE = 5;
178
+ export const ASTC_RGBA_SINGLE_ENDPOINT_RANGE = 19;
179
+
180
+ /**
181
+ * The dual-plane mode-12 block: block mode 0x452 (the 4x4 grid on two planes), alpha on the second plane (colour
182
+ * component selector 3), thirty-two weights of five levels (quints, 75 bits) and the selector's two bits, which
183
+ * leave the endpoints 16 levels (four bits each). The ranges are indices into `ASTC_RANGE`.
184
+ *
185
+ * @readonly
186
+ */
187
+ export const ASTC_RGBA_DUAL_WEIGHT_RANGE = 3;
188
+ export const ASTC_RGBA_DUAL_ENDPOINT_RANGE = 8;
189
+
190
+ /**
191
+ * Where {@link astc_write_block_rgba} is writing: the block and the next bit of the sequence being written.
192
+ */
193
+ let write_out = null;
194
+ let write_offset = 0;
195
+ let write_cursor = 0;
196
+
197
+ /**
198
+ * Append bits upward from the cursor: the endpoint sequence.
199
+ *
200
+ * @param {number} value
201
+ * @param {number} width
202
+ */
203
+ function write_upward(value, width) {
204
+ set_bits(write_out, write_offset, write_cursor, value, width);
205
+
206
+ write_cursor += width;
207
+ }
208
+
209
+ /**
210
+ * Append bits to the weight field, which fills the top of the block with its bit order reversed: field bit `i` is
211
+ * block bit `127 - i`.
212
+ *
213
+ * @param {number} value
214
+ * @param {number} width
215
+ */
216
+ function write_downward(value, width) {
217
+ for (let i = 0; i < width; i++) {
218
+ if (((value >> i) & 1) !== 0) {
219
+ const bit = 127 - (write_cursor + i);
220
+
221
+ write_out[write_offset + (bit >> 3)] |= 1 << (bit & 7);
222
+ }
223
+ }
224
+
225
+ write_cursor += width;
226
+ }
227
+
228
+ /**
229
+ * Write one single-partition, mode-12 ASTC block (LDR RGBA, direct), on one plane or with alpha on a second.
230
+ *
231
+ * The endpoints are integer sequences from bit 17; the weights fill the top of the block with the field's bit order
232
+ * reversed, and on two planes alternate texel by texel, colour then alpha, with the colour component selector
233
+ * immediately below them. Mode 12 swaps and blue-contracts a pair whose second end has the smaller colour sum, and
234
+ * which way round the pair goes is the caller's.
235
+ *
236
+ * @param {Uint8Array} out
237
+ * @param {number} offset
238
+ * @param {ArrayLike<number>} endpoints eight integers of the layout's endpoint range, `R0 R1 G0 G1 B0 B1 A0 A1`
239
+ * @param {ArrayLike<number>} weights integers of the layout's weight range: sixteen in raster order, or for two planes
240
+ * thirty-two, each texel's colour weight then its alpha weight
241
+ * @param {boolean} dual whether alpha has a plane of its own
242
+ */
243
+ export function astc_write_block_rgba(out, offset, endpoints, weights, dual) {
244
+ out.fill(0, offset, offset + ASTC_BLOCK_BYTES);
245
+
246
+ set_bits(out, offset, 0, dual ? 0x452 : ASTC_BLOCK_MODE[3], 11);
247
+
248
+ // partition count - 1, at bits 11..12, is zero: one partition
249
+
250
+ set_bits(out, offset, 13, CEM_LDR_RGBA_DIRECT, 4);
251
+
252
+ write_out = out;
253
+ write_offset = offset;
254
+
255
+ write_cursor = ENDPOINT_BIT;
256
+ astc_write_integer_sequence(write_upward, endpoints, dual ? ASTC_RGBA_DUAL_ENDPOINT_RANGE : ASTC_RGBA_SINGLE_ENDPOINT_RANGE);
257
+
258
+ write_cursor = 0;
259
+ astc_write_integer_sequence(write_downward, weights, dual ? ASTC_RGBA_DUAL_WEIGHT_RANGE : ASTC_RGBA_SINGLE_WEIGHT_RANGE);
260
+
261
+ if (dual) {
262
+ // selector 3, alpha, below the 75 bits of weights; the last quint group's padding wrote only zeros there
263
+ set_bits(out, offset, 128 - 75 - 2, 3, 2);
264
+ }
265
+
266
+ write_out = null;
267
+ }
268
+
269
+ /**
270
+ * Set the bits of a field in a zeroed block, lowest bit first, the block's bits counted little-endian.
271
+ *
272
+ * @param {Uint8Array} out
273
+ * @param {number} offset of the block
274
+ * @param {number} position of the field's lowest bit
275
+ * @param {number} value
276
+ * @param {number} count
277
+ */
278
+ function set_bits(out, offset, position, value, count) {
279
+ for (let i = 0; i < count; i++) {
280
+ if (((value >> i) & 1) !== 0) {
281
+ out[offset + ((position + i) >> 3)] |= 1 << ((position + i) & 7);
282
+ }
283
+ }
284
+ }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * What a colour endpoint integer unquantizes to, by the decoder's own table.
3
+ *
4
+ * @param {number} range an index into {@link ASTC_RANGE} an endpoint can take, `4` upward
5
+ * @param {number} integer below the range's level count
6
+ * @returns {number} eight bits
7
+ */
8
+ export function astc_unquantize_endpoint(range: number, integer: number): number;
9
+ /**
10
+ * What a weight integer unquantizes to, by the decoder's own table.
11
+ *
12
+ * @param {number} range an index into {@link ASTC_RANGE} a weight can take, `0..11`
13
+ * @param {number} integer below the range's level count
14
+ * @returns {number} `0..64`
15
+ */
16
+ export function astc_unquantize_weight(range: number, integer: number): number;
17
+ /**
18
+ * Decode one ASTC block of a linear (`astc-*-unorm`) texture, in the LDR profile.
19
+ *
20
+ * Complete for the 2D format: every block mode (dual plane included), one to four partitions by the
21
+ * partition hash, every LDR colour endpoint mode with its unquantization and its endpoint-swap and
22
+ * blue-contraction rules, integer sequences at every range, weight unquantization and the bilinear
23
+ * infill of a grid smaller than the block, and void-extent blocks.
24
+ *
25
+ * Endpoints widen to sixteen bits by bit replication and interpolate there; the eight-bit result is
26
+ * the top eight bits of that sixteen-bit value, which is the specification's rule for an eight-bit
27
+ * (`decode_unorm8`) result.
28
+ *
29
+ * Every illegal encoding — a reserved block mode, a weight grid larger than the footprint, more than
30
+ * 64 weights, a weight sequence outside 24 to 96 bits, dual plane with four partitions, more than 18
31
+ * endpoint integers or too few bits for them, a void-extent block breaking its rules — decodes to
32
+ * the error colour, opaque magenta, in every texel. An HDR endpoint mode, or an HDR void-extent
33
+ * block, is outside the LDR profile and decodes to the error colour too: for an endpoint mode, only
34
+ * in the texels of the partition that uses it.
35
+ *
36
+ * @param {Uint8Array} source
37
+ * @param {number} offset byte offset of the block in `source`
38
+ * @param {number} block_width the footprint: 4, 5, 6, 8, 10 or 12
39
+ * @param {number} block_height 4, 5, 6, 8, 10 or 12
40
+ * @param {Uint8Array} out receives `block_width * block_height` texels, RGBA, raster order, from index 0
41
+ *
42
+ * @see Khronos Data Format Specification, "ASTC Compressed Texture Image Formats"
43
+ * @author Alex Goldring
44
+ * @copyright Company Named Limited (c) 2026
45
+ */
46
+ export function astc_decode_block(source: Uint8Array, offset: number, block_width: number, block_height: number, out: Uint8Array): void;
47
+ /**
48
+ * Decode one ASTC block of an sRGB (`astc-*-unorm-srgb`) texture, in the LDR profile, to the
49
+ * sRGB-encoded bytes such a texture holds.
50
+ *
51
+ * Everything as {@link astc_decode_block} except the arithmetic: each eight-bit R, G and B endpoint
52
+ * widens to sixteen bits as `(e << 8) | 0x80` rather than by replication, while alpha is replicated
53
+ * as in the linear arithmetic (KHR_texture_compression_astc_hdr, "Weight Application"), and the result
54
+ * is the top eight bits of the interpolation: the value passed to the sRGB conversion for R, G and B,
55
+ * and used directly for alpha. A void-extent colour is its top eight bits, as for the linear arithmetic.
56
+ *
57
+ * @param {Uint8Array} source
58
+ * @param {number} offset byte offset of the block in `source`
59
+ * @param {number} block_width the footprint: 4, 5, 6, 8, 10 or 12
60
+ * @param {number} block_height 4, 5, 6, 8, 10 or 12
61
+ * @param {Uint8Array} out receives `block_width * block_height` texels, RGBA, raster order, from index 0
62
+ *
63
+ * @see Khronos Data Format Specification, "ASTC Compressed Texture Image Formats"
64
+ * @author Alex Goldring
65
+ * @copyright Company Named Limited (c) 2026
66
+ */
67
+ export function astc_srgb_decode_block(source: Uint8Array, offset: number, block_width: number, block_height: number, out: Uint8Array): void;
68
+ //# sourceMappingURL=astc_decode_block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"astc_decode_block.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/astc/astc_decode_block.js"],"names":[],"mappings":"AAiPA;;;;;;GAMG;AACH,gDAJW,MAAM,WACN,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;GAMG;AACH,8CAJW,MAAM,WACN,MAAM,GACJ,MAAM,CAIlB;AAkyBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,0CAVW,UAAU,UACV,MAAM,eACN,MAAM,gBACN,MAAM,OACN,UAAU,QAQpB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,+CAVW,UAAU,UACV,MAAM,eACN,MAAM,gBACN,MAAM,OACN,UAAU,QAQpB"}