@woosh/meep-engine 3.79.0 → 3.80.1

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,276 +1,225 @@
1
- /**
2
- * BC7's own partition and anchor tables, and how UASTC's patterns map onto them.
3
- *
4
- * **Two specifications meet here.** The partition and anchor tables are BC7's, transcribed from the
5
- * BPTC specification; the three mapping tables are UASTC's, which name for each of its patterns the
6
- * BC7 pattern that draws the same subsets and how the two number them differently.
7
- *
8
- * They are checked against each other by `bc7_tables.spec.js` rather than trusted: for every UASTC
9
- * pattern, applying the stated relabelling to BC7's own pattern must reproduce UASTC's texel for
10
- * texel. That check is what makes a transcription error here impossible to miss, and it passes for
11
- * all sixty patterns.
12
- *
13
- * @see the BPTC specification (ARB_texture_compression_bptc), tables P2, P3, A2, A3a and A3b
14
- * @see the UASTC LDR 4x4 specification, "Partition Pattern Table" sections
15
- * @author Alex Goldring
16
- * @copyright Company Named Limited (c) 2026
17
- */
18
-
19
- /**
20
- * BC7's two-subset partitions: one subset index per texel, sixty-four patterns of sixteen.
21
- *
22
- * @readonly
23
- * @type {Uint8Array}
24
- */
25
- export const BC7_PARTITIONS_2 = new Uint8Array([
26
- 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
27
- 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1,
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, 1, 0, 2, 2, 2, 1, 2, 2, 2, 0, 2, 2, 2, 1, 2, 2, 2,
98
- 0, 1, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 2, 2, 0, 1, 2, 2, 2, 0,
99
- ]);
100
-
101
- /**
102
- * The texel whose index is stored a bit short for the second subset of a two-subset partition.
103
- *
104
- * Subset zero's anchor is always texel zero, so only the others are tabulated. The anchor is *not*
105
- * the first texel of its subset — BC7 chose these positions for the encoder's benefit and a decoder
106
- * has to read them from the table.
107
- *
108
- * @readonly
109
- * @type {Uint8Array}
110
- */
111
- export const BC7_ANCHOR_2 = new Uint8Array([
112
- 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 8, 2, 2, 8, 8, 15, 2, 8,
113
- 2, 2, 8, 8, 2, 2, 15, 15, 6, 8, 2, 8, 15, 15, 2, 8, 2, 2, 2, 15, 15, 6, 6, 2, 6, 8, 15, 15, 2,
114
- 2, 15, 15, 15, 15, 15, 2, 2, 15,
115
- ]);
116
-
117
- /**
118
- * The same for the second subset of a three-subset partition.
119
- *
120
- * @readonly
121
- * @type {Uint8Array}
122
- */
123
- export const BC7_ANCHOR_3_SECOND = new Uint8Array([
124
- 3, 3, 15, 15, 8, 3, 15, 15, 8, 8, 6, 6, 6, 5, 3, 3, 3, 3, 8, 15, 3, 3, 6, 10, 5, 8, 8, 6, 8, 5,
125
- 15, 15, 8, 15, 3, 5, 6, 10, 8, 15, 15, 3, 15, 5, 15, 15, 15, 15, 3, 15, 5, 5, 5, 8, 5, 10, 5,
126
- 10, 8, 13, 15, 12, 3, 3,
127
- ]);
128
-
129
- /**
130
- * The same for the third subset of a three-subset partition.
131
- *
132
- * @readonly
133
- * @type {Uint8Array}
134
- */
135
- export const BC7_ANCHOR_3_THIRD = new Uint8Array([
136
- 15, 8, 8, 3, 15, 15, 3, 8, 15, 15, 15, 15, 15, 15, 15, 8, 15, 8, 15, 3, 15, 8, 15, 8, 3, 15, 6,
137
- 10, 15, 15, 10, 8, 15, 3, 15, 10, 10, 8, 9, 10, 6, 15, 8, 15, 3, 6, 6, 8, 15, 3, 15, 15, 15,
138
- 15, 15, 15, 15, 15, 15, 15, 3, 15, 15, 8,
139
- ]);
140
-
141
- /**
142
- * For each UASTC two-subset pattern, the BC7 pattern drawing the same shape.
143
- *
144
- * `invert` says the two number their subsets oppositely, so a UASTC subset `s` is BC7's `1 - s`.
145
- *
146
- * @readonly
147
- * @type {{bc7: number, invert: boolean}[]}
148
- */
149
- export const UASTC_TO_BC7_2 = [
150
- { bc7: 0, invert: false },
151
- { bc7: 1, invert: false },
152
- { bc7: 2, invert: true },
153
- { bc7: 3, invert: false },
154
- { bc7: 4, invert: true },
155
- { bc7: 5, invert: false },
156
- { bc7: 6, invert: true },
157
- { bc7: 7, invert: true },
158
- { bc7: 8, invert: false },
159
- { bc7: 9, invert: true },
160
- { bc7: 10, invert: false },
161
- { bc7: 11, invert: true },
162
- { bc7: 12, invert: true },
163
- { bc7: 13, invert: true },
164
- { bc7: 14, invert: false },
165
- { bc7: 15, invert: true },
166
- { bc7: 17, invert: true },
167
- { bc7: 18, invert: true },
168
- { bc7: 19, invert: false },
169
- { bc7: 20, invert: false },
170
- { bc7: 21, invert: false },
171
- { bc7: 22, invert: true },
172
- { bc7: 23, invert: true },
173
- { bc7: 24, invert: false },
174
- { bc7: 25, invert: true },
175
- { bc7: 26, invert: false },
176
- { bc7: 29, invert: true },
177
- { bc7: 32, invert: true },
178
- { bc7: 33, invert: true },
179
- { bc7: 52, invert: true },
180
- ];
181
-
182
- /**
183
- * For each UASTC three-subset pattern, the BC7 pattern and which relabelling of the three subsets
184
- * takes UASTC's numbering to BC7's.
185
- *
186
- * @readonly
187
- * @type {{bc7: number, permutation: number}[]}
188
- */
189
- export const UASTC_TO_BC7_3 = [
190
- { bc7: 4, permutation: 0 },
191
- { bc7: 8, permutation: 5 },
192
- { bc7: 9, permutation: 5 },
193
- { bc7: 10, permutation: 2 },
194
- { bc7: 11, permutation: 2 },
195
- { bc7: 12, permutation: 0 },
196
- { bc7: 13, permutation: 4 },
197
- { bc7: 20, permutation: 1 },
198
- { bc7: 35, permutation: 1 },
199
- { bc7: 36, permutation: 5 },
200
- { bc7: 57, permutation: 0 },
201
- ];
202
-
203
- /**
204
- * The relabellings {@link UASTC_TO_BC7_3} refers to: entry `p` of a row is the BC7 subset that
205
- * UASTC's subset `p` becomes.
206
- *
207
- * @readonly
208
- * @type {number[][]}
209
- */
210
- export const SUBSET_PERMUTATIONS = [
211
- [0, 1, 2],
212
- [1, 2, 0],
213
- [2, 0, 1],
214
- [2, 1, 0],
215
- [0, 2, 1],
216
- [1, 0, 2],
217
- ];
218
-
219
- /**
220
- * For each of mode 7's patterns, the BC7 *three*-subset pattern to use and the rule folding its
221
- * three subsets back down to UASTC's two.
222
- *
223
- * Mode 7 is the odd one: two subsets in UASTC and three in BC7, which works because two of BC7's
224
- * three endpoint pairs are written identically. `fold` is the rule, applied by
225
- * {@link bc7_fold_subset_3_to_2}.
226
- *
227
- * @readonly
228
- * @type {{bc7: number, fold: number}[]}
229
- */
230
- export const UASTC_TO_BC7_2_VIA_3 = [
231
- { bc7: 10, fold: 4 },
232
- { bc7: 11, fold: 4 },
233
- { bc7: 0, fold: 3 },
234
- { bc7: 2, fold: 4 },
235
- { bc7: 8, fold: 5 },
236
- { bc7: 13, fold: 4 },
237
- { bc7: 1, fold: 2 },
238
- { bc7: 33, fold: 2 },
239
- { bc7: 40, fold: 3 },
240
- { bc7: 20, fold: 4 },
241
- { bc7: 21, fold: 0 },
242
- { bc7: 58, fold: 3 },
243
- { bc7: 3, fold: 0 },
244
- { bc7: 32, fold: 2 },
245
- { bc7: 59, fold: 1 },
246
- { bc7: 34, fold: 3 },
247
- { bc7: 20, fold: 1 },
248
- { bc7: 14, fold: 4 },
249
- { bc7: 31, fold: 3 },
250
- ];
251
-
252
- /**
253
- * Which of UASTC's two subsets a BC7 three-subset index belongs to, under one of the six folds.
254
- *
255
- * @param {number} subset BC7's, `0` to `2`
256
- * @param {number} fold
257
- * @returns {number} UASTC's, `0` or `1`
258
- */
259
- export function bc7_fold_subset_3_to_2(subset, fold) {
260
- let folded;
261
-
262
- switch (fold >> 1) {
263
- case 0:
264
- folded = subset <= 1 ? 0 : 1;
265
- break;
266
- case 1:
267
- folded = subset === 0 ? 0 : 1;
268
- break;
269
- default:
270
- folded = (subset === 0 || subset === 2) ? 0 : 1;
271
- break;
272
- }
273
-
274
- // the low bit of the fold swaps the two
275
- return (fold & 1) ? 1 - folded : folded;
276
- }
1
+ /**
2
+ * BC7's partition and anchor tables, transcribed from the BPTC specification.
3
+ *
4
+ * Checked against UASTC's own description of the same shapes by `uastc_bc7_tables.spec.js`: the two
5
+ * specifications draw the same subsets, so a wrong digit in either set breaks the agreement.
6
+ *
7
+ * @see the BPTC specification (ARB_texture_compression_bptc), tables P2, P3, A2, A3a and A3b
8
+ * @author Alex Goldring
9
+ * @copyright Company Named Limited (c) 2026
10
+ */
11
+
12
+ /**
13
+ * BC7's two-subset partitions: one subset index per texel, sixty-four patterns of sixteen.
14
+ *
15
+ * @readonly
16
+ * @type {Uint8Array}
17
+ */
18
+ export const BC7_PARTITIONS_2 = new Uint8Array([
19
+ 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
20
+ 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1,
21
+ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1,
22
+ 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0,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 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 0, 1, 1, 2, 2, 0, 1, 2, 2, 2, 0,
92
+ ]);
93
+
94
+ /**
95
+ * The texel whose index is stored a bit short for the second subset of a two-subset partition.
96
+ *
97
+ * Subset zero's anchor is always texel zero, so only the others are tabulated. The anchor is *not*
98
+ * the first texel of its subset — BC7 chose these positions for the encoder's benefit and a decoder
99
+ * has to read them from the table.
100
+ *
101
+ * @readonly
102
+ * @type {Uint8Array}
103
+ */
104
+ export const BC7_ANCHOR_2 = new Uint8Array([
105
+ 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 2, 8, 2, 2, 8, 8, 15, 2, 8,
106
+ 2, 2, 8, 8, 2, 2, 15, 15, 6, 8, 2, 8, 15, 15, 2, 8, 2, 2, 2, 15, 15, 6, 6, 2, 6, 8, 15, 15, 2,
107
+ 2, 15, 15, 15, 15, 15, 2, 2, 15,
108
+ ]);
109
+
110
+ /**
111
+ * The same for the second subset of a three-subset partition.
112
+ *
113
+ * @readonly
114
+ * @type {Uint8Array}
115
+ */
116
+ export const BC7_ANCHOR_3_SECOND = new Uint8Array([
117
+ 3, 3, 15, 15, 8, 3, 15, 15, 8, 8, 6, 6, 6, 5, 3, 3, 3, 3, 8, 15, 3, 3, 6, 10, 5, 8, 8, 6, 8, 5,
118
+ 15, 15, 8, 15, 3, 5, 6, 10, 8, 15, 15, 3, 15, 5, 15, 15, 15, 15, 3, 15, 5, 5, 5, 8, 5, 10, 5,
119
+ 10, 8, 13, 15, 12, 3, 3,
120
+ ]);
121
+
122
+ /**
123
+ * The same for the third subset of a three-subset partition.
124
+ *
125
+ * @readonly
126
+ * @type {Uint8Array}
127
+ */
128
+ export const BC7_ANCHOR_3_THIRD = new Uint8Array([
129
+ 15, 8, 8, 3, 15, 15, 3, 8, 15, 15, 15, 15, 15, 15, 15, 8, 15, 8, 15, 3, 15, 8, 15, 8, 3, 15, 6,
130
+ 10, 15, 15, 10, 8, 15, 3, 15, 10, 10, 8, 9, 10, 6, 15, 8, 15, 3, 6, 6, 8, 15, 3, 15, 15, 15,
131
+ 15, 15, 15, 15, 15, 15, 15, 3, 15, 15, 8,
132
+ ]);
133
+
134
+ /**
135
+ * What one BC7 mode stores, from Table.M of the BPTC specification.
136
+ *
137
+ * The field *order* is the same for every mode — partition, rotation, index selection, colour, alpha, per-endpoint
138
+ * parity, shared parity, indices, secondary indices — so a mode is entirely described by how many bits it gives
139
+ * each.
140
+ *
141
+ * @typedef {object} Bc7Mode
142
+ * @property {number} subsets
143
+ * @property {number} partition_bits
144
+ * @property {number} rotation_bits
145
+ * @property {number} index_selection_bits `1` for mode 4, whose colour and alpha may swap index sets
146
+ * @property {number} color_bits
147
+ * @property {number} alpha_bits `0` where the mode has no alpha, which then decodes as opaque
148
+ * @property {number} endpoint_parity_bits one parity bit per endpoint, `0` or `1`
149
+ * @property {number} shared_parity_bits one parity bit per *subset*, shared by both its endpoints
150
+ * @property {number} index_bits
151
+ * @property {number} secondary_index_bits `0` unless the mode has a second index set
152
+ */
153
+
154
+ /**
155
+ * Every BC7 mode, indexed by mode number.
156
+ *
157
+ * @readonly
158
+ * @type {Bc7Mode[]}
159
+ */
160
+ export const BC7_MODES = [
161
+ {
162
+ subsets: 3, partition_bits: 4, rotation_bits: 0, index_selection_bits: 0, color_bits: 4, alpha_bits: 0,
163
+ endpoint_parity_bits: 1, shared_parity_bits: 0, index_bits: 3, secondary_index_bits: 0,
164
+ },
165
+ {
166
+ subsets: 2, partition_bits: 6, rotation_bits: 0, index_selection_bits: 0, color_bits: 6, alpha_bits: 0,
167
+ endpoint_parity_bits: 0, shared_parity_bits: 1, index_bits: 3, secondary_index_bits: 0,
168
+ },
169
+ {
170
+ subsets: 3, partition_bits: 6, rotation_bits: 0, index_selection_bits: 0, color_bits: 5, alpha_bits: 0,
171
+ endpoint_parity_bits: 0, shared_parity_bits: 0, index_bits: 2, secondary_index_bits: 0,
172
+ },
173
+ {
174
+ subsets: 2, partition_bits: 6, rotation_bits: 0, index_selection_bits: 0, color_bits: 7, alpha_bits: 0,
175
+ endpoint_parity_bits: 1, shared_parity_bits: 0, index_bits: 2, secondary_index_bits: 0,
176
+ },
177
+ {
178
+ subsets: 1, partition_bits: 0, rotation_bits: 2, index_selection_bits: 1, color_bits: 5, alpha_bits: 6,
179
+ endpoint_parity_bits: 0, shared_parity_bits: 0, index_bits: 2, secondary_index_bits: 3,
180
+ },
181
+ {
182
+ subsets: 1, partition_bits: 0, rotation_bits: 2, index_selection_bits: 0, color_bits: 7, alpha_bits: 8,
183
+ endpoint_parity_bits: 0, shared_parity_bits: 0, index_bits: 2, secondary_index_bits: 2,
184
+ },
185
+ {
186
+ subsets: 1, partition_bits: 0, rotation_bits: 0, index_selection_bits: 0, color_bits: 7, alpha_bits: 7,
187
+ endpoint_parity_bits: 1, shared_parity_bits: 0, index_bits: 4, secondary_index_bits: 0,
188
+ },
189
+ {
190
+ subsets: 2, partition_bits: 6, rotation_bits: 0, index_selection_bits: 0, color_bits: 5, alpha_bits: 5,
191
+ endpoint_parity_bits: 1, shared_parity_bits: 0, index_bits: 2, secondary_index_bits: 0,
192
+ },
193
+ ];
194
+
195
+ /**
196
+ * Interpolation factors out of 64, for two-, three- and four-bit indices.
197
+ *
198
+ * @readonly
199
+ * @type {Uint8Array}
200
+ */
201
+ const WEIGHTS_2 = new Uint8Array([0, 21, 43, 64]);
202
+ const WEIGHTS_3 = new Uint8Array([0, 9, 18, 27, 37, 46, 55, 64]);
203
+ const WEIGHTS_4 = new Uint8Array([0, 4, 9, 13, 17, 21, 26, 30, 34, 38, 43, 47, 51, 55, 60, 64]);
204
+
205
+ /**
206
+ * The interpolation factors, out of 64, an index of this width selects.
207
+ *
208
+ * @param {number} bits `2`, `3` or `4`
209
+ * @returns {Uint8Array} one factor per index value
210
+ */
211
+ export function bc7_weights(bits) {
212
+ return bits === 2 ? WEIGHTS_2 : bits === 3 ? WEIGHTS_3 : WEIGHTS_4;
213
+ }
214
+
215
+ /**
216
+ * One channel of a texel between two eight-bit endpoints, as a decoder computes it.
217
+ *
218
+ * @param {number} e0 eight bits
219
+ * @param {number} e1 eight bits
220
+ * @param {number} weight out of 64, from {@link bc7_weights}
221
+ * @returns {number} eight bits
222
+ */
223
+ export function bc7_interpolate(e0, e1, weight) {
224
+ return ((64 - weight) * e0 + weight * e1 + 32) >> 6;
225
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * The eight-bit value a stored endpoint component decodes to.
3
+ *
4
+ * The parity bit, where the mode has one, sits *below* the stored bits — so a five-bit component
5
+ * with a parity bit is a six-bit value — and the result is then widened to eight by replicating its
6
+ * top bits downward.
7
+ *
8
+ * @param {number} stored
9
+ * @param {number} bits including the parity bit
10
+ * @returns {number}
11
+ */
12
+ export function bc7_expand_endpoint(stored: number, bits: number): number;
13
+ /**
14
+ * Quantise an eight-bit value to what a mode can store, optionally forced to a parity.
15
+ *
16
+ * @param {number} value
17
+ * @param {number} bits including the parity bit, where there is one
18
+ * @param {number} parity `-1` when the mode has none
19
+ * @returns {number} the value including its parity bit, so `bits` wide
20
+ */
21
+ export function bc7_quantise_endpoint(value: number, bits: number, parity: number): number;
22
+ /**
23
+ * Write one BC7 block, all sixteen of its bytes.
24
+ *
25
+ * **One writer for every mode** ({@link BC7_MODES}), because the specification says the fields are always in the
26
+ * same order and only their widths change.
27
+ *
28
+ * Endpoints are ordered as the specification stores them: by channel, then by subset, then by
29
+ * endpoint — so red for both ends of subset 0, then both ends of subset 1, then green, and so on.
30
+ *
31
+ * @param {Uint8Array} out
32
+ * @param {number} byte_offset of the block
33
+ * @param {number} mode
34
+ * @param {object} block
35
+ * @param {number} [block.partition] index into BC7's partition table
36
+ * @param {number} [block.rotation]
37
+ * @param {number} [block.index_selection] mode 4's: `1` gives colour the secondary indices and alpha the primary
38
+ * @param {Uint8Array} block.endpoints `subsets * 2 * 4` stored fields, low then high RGBA per
39
+ * subset — already quantised to the mode's width, with any parity bit held separately
40
+ * @param {Uint8Array} block.indices sixteen
41
+ * @param {Uint8Array} [block.secondary_indices] sixteen, for a mode with two index sets
42
+ * @param {Uint8Array} block.anchors one texel index per subset
43
+ * @param {Int8Array} [block.parity] one bit per endpoint, or per subset for a shared-parity mode
44
+ *
45
+ * @author Alex Goldring
46
+ * @copyright Company Named Limited (c) 2026
47
+ */
48
+ export function bc7_write_block(out: Uint8Array, byte_offset: number, mode: number, block: {
49
+ partition?: number;
50
+ rotation?: number;
51
+ index_selection?: number;
52
+ endpoints: Uint8Array;
53
+ indices: Uint8Array;
54
+ secondary_indices?: Uint8Array;
55
+ anchors: Uint8Array;
56
+ parity?: Int8Array;
57
+ }): void;
58
+ /**
59
+ * Bytes one BC7 block occupies.
60
+ *
61
+ * @readonly
62
+ * @type {number}
63
+ */
64
+ export const BC7_BLOCK_BYTES: number;
65
+ //# sourceMappingURL=bc7_write_block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bc7_write_block.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/bc/bc7_write_block.js"],"names":[],"mappings":"AAUA;;;;;;;;;;GAUG;AACH,4CAJW,MAAM,QACN,MAAM,GACJ,MAAM,CAQlB;AAED;;;;;;;GAOG;AACH,6CALW,MAAM,QACN,MAAM,UACN,MAAM,GACJ,MAAM,CAyBlB;AA0BD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qCAjBW,UAAU,eACV,MAAM,QACN,MAAM;IAES,SAAS,GAAxB,MAAM;IACS,QAAQ,GAAvB,MAAM;IACS,eAAe,GAA9B,MAAM;IACY,SAAS,EAA3B,UAAU;IAEQ,OAAO,EAAzB,UAAU;IACS,iBAAiB,GAApC,UAAU;IACQ,OAAO,EAAzB,UAAU;IACQ,MAAM,GAAxB,SAAS;SAsDnB;AA/JD;;;;;GAKG;AACH,8BAFU,MAAM,CAEkB"}