@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
@@ -0,0 +1,430 @@
1
+ import { BC7_ANCHOR_2, BC7_PARTITIONS_2 } from "./bc7_tables.js";
2
+
3
+ /**
4
+ * Table.MF and Table.F of the BPTC specification: for each mode number, whether its endpoints are
5
+ * transformed, its partition bits, its endpoint bits, its delta bits for R, G and B, and the layout
6
+ * of its mode and endpoint bits.
7
+ *
8
+ * A layout is read from the block's bit 0 up. `v[a:b]` takes the next `|a - b| + 1` bits into bits
9
+ * `b` to `a` of `v`, the first of them into bit `b` — so with `a < b` the bits are reversed. `r0`,
10
+ * `g0`, `b0` are the first endpoint, `r1`... the second, and in a two-region mode `r2`... and `r3`...
11
+ * are the second region's. The partition, in a two-region mode, is the five bits after the layout.
12
+ *
13
+ * Mode numbers absent here (19, 23, 27 and 31) are reserved.
14
+ *
15
+ * @readonly
16
+ * @type {Array<[number, number, number, number, number, number, number, string]>}
17
+ */
18
+ const MODES = [
19
+ [0, 1, 5, 10, 5, 5, 5,
20
+ "m[1:0],g2[4],b2[4],b3[4],r0[9:0],g0[9:0],b0[9:0],r1[4:0],g3[4],g2[3:0],"
21
+ + "g1[4:0],b3[0],g3[3:0],b1[4:0],b3[1],b2[3:0],r2[4:0],b3[2],r3[4:0],b3[3]"],
22
+ [1, 1, 5, 7, 6, 6, 6,
23
+ "m[1:0],g2[5],g3[4],g3[5],r0[6:0],b3[0],b3[1],b2[4],g0[6:0],b2[5],b3[2],"
24
+ + "g2[4],b0[6:0],b3[3],b3[5],b3[4],r1[5:0],g2[3:0],g1[5:0],g3[3:0],b1[5:0],"
25
+ + "b2[3:0],r2[5:0],r3[5:0]"],
26
+ [2, 1, 5, 11, 5, 4, 4,
27
+ "m[4:0],r0[9:0],g0[9:0],b0[9:0],r1[4:0],r0[10],g2[3:0],g1[3:0],g0[10],"
28
+ + "b3[0],g3[3:0],b1[3:0],b0[10],b3[1],b2[3:0],r2[4:0],b3[2],r3[4:0],b3[3]"],
29
+ [6, 1, 5, 11, 4, 5, 4,
30
+ "m[4:0],r0[9:0],g0[9:0],b0[9:0],r1[3:0],r0[10],g3[4],g2[3:0],g1[4:0],"
31
+ + "g0[10],g3[3:0],b1[3:0],b0[10],b3[1],b2[3:0],r2[3:0],b3[0],b3[2],r3[3:0],"
32
+ + "g2[4],b3[3]"],
33
+ [10, 1, 5, 11, 4, 4, 5,
34
+ "m[4:0],r0[9:0],g0[9:0],b0[9:0],r1[3:0],r0[10],b2[4],g2[3:0],g1[3:0],"
35
+ + "g0[10],b3[0],g3[3:0],b1[4:0],b0[10],b2[3:0],r2[3:0],b3[1],b3[2],r3[3:0],"
36
+ + "b3[4],b3[3]"],
37
+ [14, 1, 5, 9, 5, 5, 5,
38
+ "m[4:0],r0[8:0],b2[4],g0[8:0],g2[4],b0[8:0],b3[4],r1[4:0],g3[4],g2[3:0],"
39
+ + "g1[4:0],b3[0],g3[3:0],b1[4:0],b3[1],b2[3:0],r2[4:0],b3[2],r3[4:0],b3[3]"],
40
+ [18, 1, 5, 8, 6, 5, 5,
41
+ "m[4:0],r0[7:0],g3[4],b2[4],g0[7:0],b3[2],g2[4],b0[7:0],b3[3],b3[4],"
42
+ + "r1[5:0],g2[3:0],g1[4:0],b3[0],g3[3:0],b1[4:0],b3[1],b2[3:0],r2[5:0],"
43
+ + "r3[5:0]"],
44
+ [22, 1, 5, 8, 5, 6, 5,
45
+ "m[4:0],r0[7:0],b3[0],b2[4],g0[7:0],g2[5],g2[4],b0[7:0],g3[5],b3[4],"
46
+ + "r1[4:0],g3[4],g2[3:0],g1[5:0],g3[3:0],b1[4:0],b3[1],b2[3:0],r2[4:0],"
47
+ + "b3[2],r3[4:0],b3[3]"],
48
+ [26, 1, 5, 8, 5, 5, 6,
49
+ "m[4:0],r0[7:0],b3[1],b2[4],g0[7:0],b2[5],g2[4],b0[7:0],b3[5],b3[4],"
50
+ + "r1[4:0],g3[4],g2[3:0],g1[4:0],b3[0],g3[3:0],b1[5:0],b2[3:0],r2[4:0],"
51
+ + "b3[2],r3[4:0],b3[3]"],
52
+ [30, 0, 5, 6, 6, 6, 6,
53
+ "m[4:0],r0[5:0],g3[4],b3[0],b3[1],b2[4],g0[5:0],g2[5],b2[5],b3[2],"
54
+ + "g2[4],b0[5:0],g3[5],b3[3],b3[5],b3[4],r1[5:0],g2[3:0],g1[5:0],g3[3:0],"
55
+ + "b1[5:0],b2[3:0],r2[5:0],r3[5:0]"],
56
+ [3, 0, 0, 10, 10, 10, 10,
57
+ "m[4:0],r0[9:0],g0[9:0],b0[9:0],r1[9:0],g1[9:0],b1[9:0]"],
58
+ [7, 1, 0, 11, 9, 9, 9,
59
+ "m[4:0],r0[9:0],g0[9:0],b0[9:0],r1[8:0],r0[10],g1[8:0],g0[10],b1[8:0],"
60
+ + "b0[10]"],
61
+ [11, 1, 0, 12, 8, 8, 8,
62
+ "m[4:0],r0[9:0],g0[9:0],b0[9:0],r1[7:0],r0[10:11],g1[7:0],g0[10:11],"
63
+ + "b1[7:0],b0[10:11]"],
64
+ [15, 1, 0, 16, 4, 4, 4,
65
+ "m[4:0],r0[9:0],g0[9:0],b0[9:0],r1[3:0],r0[10:15],g1[3:0],g0[10:15],"
66
+ + "b1[3:0],b0[10:15]"],
67
+ ];
68
+
69
+ /**
70
+ * A layout entry for a mode bit, which carries no endpoint data.
71
+ *
72
+ * @readonly
73
+ * @type {number}
74
+ */
75
+ const MODE_BIT = 0xFF;
76
+
77
+ /**
78
+ * Endpoint bits by mode number; zero for a reserved mode.
79
+ *
80
+ * @type {Uint8Array}
81
+ */
82
+ const ENDPOINT_BITS = new Uint8Array(32);
83
+
84
+ /**
85
+ * @type {Uint8Array}
86
+ */
87
+ const TRANSFORMED = new Uint8Array(32);
88
+
89
+ /**
90
+ * @type {Uint8Array}
91
+ */
92
+ const TWO_REGIONS = new Uint8Array(32);
93
+
94
+ /**
95
+ * Delta bits by mode number, R G B.
96
+ *
97
+ * @type {Uint8Array}
98
+ */
99
+ const DELTA_BITS = new Uint8Array(32 * 3);
100
+
101
+ /**
102
+ * For each mode number, what each block bit from bit 0 up to the end of the endpoints holds: the
103
+ * field `e * 3 + channel` in the high nibble and the bit of it in the low one, or {@link MODE_BIT}.
104
+ *
105
+ * @type {Uint8Array[]}
106
+ */
107
+ const LAYOUTS = new Array(32);
108
+
109
+ for (const [mode, transformed, partition_bits, endpoint_bits, delta_r, delta_g, delta_b, layout] of MODES) {
110
+ ENDPOINT_BITS[mode] = endpoint_bits;
111
+ TRANSFORMED[mode] = transformed;
112
+ TWO_REGIONS[mode] = partition_bits > 0 ? 1 : 0;
113
+
114
+ DELTA_BITS[mode * 3] = delta_r;
115
+ DELTA_BITS[mode * 3 + 1] = delta_g;
116
+ DELTA_BITS[mode * 3 + 2] = delta_b;
117
+
118
+ const entries = [];
119
+
120
+ for (const element of layout.split(",")) {
121
+ const [, variable, endpoint, high, low] = /^([mrgb])(\d?)\[(\d+)(?::(\d+))?]$/.exec(element);
122
+
123
+ const a = Number(high);
124
+ const b = low === undefined ? a : Number(low);
125
+
126
+ const step = a >= b ? 1 : -1;
127
+
128
+ for (let k = b; ; k += step) {
129
+ entries.push(variable === "m" ? MODE_BIT : ((Number(endpoint) * 3 + "rgb".indexOf(variable)) << 4) | k);
130
+
131
+ if (k === a) {
132
+ break;
133
+ }
134
+ }
135
+ }
136
+
137
+ LAYOUTS[mode] = new Uint8Array(entries);
138
+ }
139
+
140
+ /**
141
+ * Interpolation factors out of 64 for the three-bit indices of a two-region block.
142
+ *
143
+ * @readonly
144
+ * @type {Uint8Array}
145
+ */
146
+ const WEIGHTS_3 = new Uint8Array([0, 9, 18, 27, 37, 46, 55, 64]);
147
+
148
+ /**
149
+ * Interpolation factors out of 64 for the four-bit indices of a one-region block.
150
+ *
151
+ * @readonly
152
+ * @type {Uint8Array}
153
+ */
154
+ const WEIGHTS_4 = new Uint8Array([0, 4, 9, 13, 17, 21, 26, 30, 34, 38, 43, 47, 51, 55, 60, 64]);
155
+
156
+ /**
157
+ * `2 ** (exponent - 25)` for a half's biased exponent: what one unit of the eleven-bit significand
158
+ * is worth.
159
+ *
160
+ * @readonly
161
+ * @type {Float64Array}
162
+ */
163
+ const SIGNIFICAND_UNIT = new Float64Array(32);
164
+
165
+ for (let exponent = 1; exponent < 31; exponent++) {
166
+ SIGNIFICAND_UNIT[exponent] = 2 ** (exponent - 25);
167
+ }
168
+
169
+ /**
170
+ * What one unit of a subnormal half's ten-bit significand is worth, `2 ** -24`.
171
+ *
172
+ * @readonly
173
+ * @type {number}
174
+ */
175
+ const SUBNORMAL_UNIT = 2 ** -24;
176
+
177
+ /**
178
+ * The block being decoded, with a zero byte past its end so a field read never leaves the array.
179
+ *
180
+ * @type {Uint8Array}
181
+ */
182
+ const BLOCK = new Uint8Array(17);
183
+
184
+ /**
185
+ * The endpoint fields as stored, `e * 3 + channel`.
186
+ *
187
+ * @type {Int32Array}
188
+ */
189
+ const FIELDS = new Int32Array(12);
190
+
191
+ /**
192
+ * The endpoints after sign extension, the inverse transform and unquantisation, `e * 3 + channel`.
193
+ *
194
+ * @type {Int32Array}
195
+ */
196
+ const ENDPOINTS = new Int32Array(12);
197
+
198
+ /**
199
+ * A field of at most nine bits of {@link BLOCK}, the block's bits counted little-endian.
200
+ *
201
+ * @param {number} position of the field's lowest bit
202
+ * @param {number} count
203
+ * @returns {number}
204
+ */
205
+ function bits_at(position, count) {
206
+ const byte = position >> 3;
207
+
208
+ return ((BLOCK[byte] | (BLOCK[byte + 1] << 8)) >> (position & 7)) & ((1 << count) - 1);
209
+ }
210
+
211
+ /**
212
+ * @param {number} value
213
+ * @param {number} bits
214
+ * @returns {number} the low `bits` of `value` read as two's complement
215
+ */
216
+ function sign_extend(value, bits) {
217
+ return (value << (32 - bits)) >> (32 - bits);
218
+ }
219
+
220
+ /**
221
+ * The specification's unquantisation of an unsigned endpoint to sixteen bits.
222
+ *
223
+ * @param {number} x
224
+ * @param {number} bits the mode's endpoint bits
225
+ * @returns {number}
226
+ */
227
+ function unquantize_unsigned(x, bits) {
228
+ if (bits >= 15) {
229
+ return x;
230
+ }
231
+
232
+ if (x === 0) {
233
+ return 0;
234
+ }
235
+
236
+ if (x === (1 << bits) - 1) {
237
+ return 0xFFFF;
238
+ }
239
+
240
+ return ((x << 15) + 0x4000) >> (bits - 1);
241
+ }
242
+
243
+ /**
244
+ * The specification's unquantisation of a signed endpoint to a signed sixteen-bit magnitude.
245
+ *
246
+ * @param {number} x
247
+ * @param {number} bits the mode's endpoint bits
248
+ * @returns {number}
249
+ */
250
+ function unquantize_signed(x, bits) {
251
+ if (bits >= 16) {
252
+ return x;
253
+ }
254
+
255
+ const magnitude = x < 0 ? -x : x;
256
+
257
+ let unq;
258
+
259
+ if (magnitude === 0) {
260
+ unq = 0;
261
+ } else if (magnitude >= (1 << (bits - 1)) - 1) {
262
+ unq = 0x7FFF;
263
+ } else {
264
+ unq = ((magnitude << 15) + 0x4000) >> (bits - 1);
265
+ }
266
+
267
+ return x < 0 ? -unq : unq;
268
+ }
269
+
270
+ /**
271
+ * Store the value of a half float, given its bit pattern. A sign bit with a zero magnitude stores
272
+ * negative zero.
273
+ *
274
+ * @param {Float32Array} out
275
+ * @param {number} index
276
+ * @param {number} half sixteen bits
277
+ */
278
+ function store_half(out, index, half) {
279
+ const exponent = (half >> 10) & 31;
280
+ const mantissa = half & 1023;
281
+
282
+ // a multiplier rather than a negation, which keeps every value here a float in optimised code
283
+ const sign = (half & 0x8000) !== 0 ? -1 : 1;
284
+
285
+ if (exponent === 0) {
286
+ out[index] = sign * mantissa * SUBNORMAL_UNIT;
287
+ } else if (exponent === 31) {
288
+ out[index] = mantissa === 0 ? sign * Infinity : NaN;
289
+ } else {
290
+ out[index] = sign * (mantissa + 1024) * SIGNIFICAND_UNIT[exponent];
291
+ }
292
+ }
293
+
294
+ /**
295
+ * Decode one BC6H block into sixteen RGBA texels, signed or unsigned. The shared body of
296
+ * `bc6h_ufloat_decode_block` and `bc6h_sfloat_decode_block`, which a caller uses instead.
297
+ *
298
+ * Bit-exact to the BPTC specification, which requires that of a decoder. The mode is the low two
299
+ * bits when they are below two, otherwise the low five. Its endpoints are gathered from the layout,
300
+ * then: the first endpoint is sign-extended at the endpoint bits if the format is signed; the others
301
+ * are sign-extended at the delta bits if the format is signed or the mode transformed; in a
302
+ * transformed mode they are added to the first endpoint and wrapped at the endpoint bits, then
303
+ * sign-extended again if the format is signed. Each endpoint is unquantised, the texels interpolate
304
+ * as `(a * (64 - w) + b * w + 32) >> 6` with three-bit indices over two regions (the first 32
305
+ * partitions of BC7's two-subset table, with its anchors) or four-bit indices over one, and the
306
+ * result is scaled by 31/64 unsigned, or in magnitude by 31/32 with the sign bit set where the
307
+ * interpolated value is negative, and read as a half. Alpha is 1.
308
+ *
309
+ * A reserved mode (19, 23, 27, 31) decodes to (0, 0, 0, 1) at every texel, as the specification
310
+ * says. Any other sixteen bytes are a valid block.
311
+ *
312
+ * @param {Uint8Array} source
313
+ * @param {number} offset of the sixteen-byte block in `source`
314
+ * @param {Float32Array} out sixteen RGBA texels, raster order, written from index 0
315
+ * @param {boolean} signed `true` for `bc6h-rgb-float`, `false` for `bc6h-rgb-ufloat`
316
+ *
317
+ * @see the BPTC specification (ARB_texture_compression_bptc), and the BPTC section of the Khronos
318
+ * Data Format Specification
319
+ * @author Alex Goldring
320
+ * @copyright Company Named Limited (c) 2026
321
+ */
322
+ export function bc6h_decode_texels(source, offset, out, signed) {
323
+ for (let i = 0; i < 16; i++) {
324
+ BLOCK[i] = source[offset + i];
325
+ }
326
+
327
+ const low_bits = BLOCK[0];
328
+ const mode = (low_bits & 3) < 2 ? low_bits & 3 : low_bits & 31;
329
+
330
+ const endpoint_bits = ENDPOINT_BITS[mode];
331
+
332
+ if (endpoint_bits === 0) {
333
+ for (let t = 0; t < 16; t++) {
334
+ out[t * 4] = 0;
335
+ out[t * 4 + 1] = 0;
336
+ out[t * 4 + 2] = 0;
337
+ out[t * 4 + 3] = 1;
338
+ }
339
+
340
+ return;
341
+ }
342
+
343
+ const layout = LAYOUTS[mode];
344
+
345
+ FIELDS.fill(0);
346
+
347
+ for (let bit = 0; bit < layout.length; bit++) {
348
+ const entry = layout[bit];
349
+
350
+ if (entry !== MODE_BIT && ((BLOCK[bit >> 3] >> (bit & 7)) & 1) !== 0) {
351
+ FIELDS[entry >> 4] |= 1 << (entry & 15);
352
+ }
353
+ }
354
+
355
+ const two_regions = TWO_REGIONS[mode] !== 0;
356
+ const transformed = TRANSFORMED[mode] !== 0;
357
+
358
+ const endpoint_count = two_regions ? 4 : 2;
359
+ const wrap = (1 << endpoint_bits) - 1;
360
+
361
+ for (let channel = 0; channel < 3; channel++) {
362
+ const delta_bits = DELTA_BITS[mode * 3 + channel];
363
+
364
+ const base = signed ? sign_extend(FIELDS[channel], endpoint_bits) : FIELDS[channel];
365
+
366
+ ENDPOINTS[channel] = base;
367
+
368
+ for (let e = 1; e < endpoint_count; e++) {
369
+ let value = FIELDS[e * 3 + channel];
370
+
371
+ if (signed || transformed) {
372
+ value = sign_extend(value, delta_bits);
373
+ }
374
+
375
+ if (transformed) {
376
+ value = (base + value) & wrap;
377
+
378
+ if (signed) {
379
+ value = sign_extend(value, endpoint_bits);
380
+ }
381
+ }
382
+
383
+ ENDPOINTS[e * 3 + channel] = value;
384
+ }
385
+ }
386
+
387
+ for (let i = 0; i < endpoint_count * 3; i++) {
388
+ ENDPOINTS[i] = signed
389
+ ? unquantize_signed(ENDPOINTS[i], endpoint_bits)
390
+ : unquantize_unsigned(ENDPOINTS[i], endpoint_bits);
391
+ }
392
+
393
+ const partition = two_regions ? bits_at(layout.length, 5) : 0;
394
+ const anchor = two_regions ? BC7_ANCHOR_2[partition] : 0;
395
+
396
+ const index_bits = two_regions ? 3 : 4;
397
+ const weights = two_regions ? WEIGHTS_3 : WEIGHTS_4;
398
+
399
+ let bit = two_regions ? layout.length + 5 : layout.length;
400
+
401
+ for (let t = 0; t < 16; t++) {
402
+ const count = t === 0 || t === anchor ? index_bits - 1 : index_bits;
403
+
404
+ const weight = weights[bits_at(bit, count)];
405
+ bit += count;
406
+
407
+ const first = two_regions ? BC7_PARTITIONS_2[partition * 16 + t] * 6 : 0;
408
+
409
+ for (let channel = 0; channel < 3; channel++) {
410
+ const a = ENDPOINTS[first + channel];
411
+ const b = ENDPOINTS[first + 3 + channel];
412
+
413
+ const interpolated = (a * (64 - weight) + b * weight + 32) >> 6;
414
+
415
+ let half;
416
+
417
+ if (!signed) {
418
+ half = (interpolated * 31) >> 6;
419
+ } else if (interpolated < 0) {
420
+ half = (((-interpolated) * 31) >> 5) | 0x8000;
421
+ } else {
422
+ half = (interpolated * 31) >> 5;
423
+ }
424
+
425
+ store_half(out, t * 4 + channel, half);
426
+ }
427
+
428
+ out[t * 4 + 3] = 1;
429
+ }
430
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Decode one signed BC6H block (`bc6h-rgb-float`) into sixteen RGBA float texels, alpha 1.
3
+ *
4
+ * All fourteen modes, bit-exact to the specification: endpoints sign-extended, transformed,
5
+ * unquantised, the magnitude scaled by 31/32 with the sign restored, and the half read as a float —
6
+ * from -65504 to 65504, plus negative infinity, which the sixteen-bit mode can reach, and negative
7
+ * zero where an interpolated value of -1 scales to a magnitude of 0. A reserved mode decodes to
8
+ * (0, 0, 0, 1). See {@link bc6h_decode_texels} for the arithmetic. Any sixteen bytes are a valid
9
+ * block.
10
+ *
11
+ * @param {Uint8Array} source
12
+ * @param {number} offset of the sixteen-byte block in `source`
13
+ * @param {Float32Array} out sixteen RGBA texels, raster order, written from index 0
14
+ *
15
+ * @see the BPTC specification (ARB_texture_compression_bptc), BPTC_FLOAT
16
+ * @author Alex Goldring
17
+ * @copyright Company Named Limited (c) 2026
18
+ */
19
+ export function bc6h_sfloat_decode_block(source: Uint8Array, offset: number, out: Float32Array): void;
20
+ //# sourceMappingURL=bc6h_sfloat_decode_block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bc6h_sfloat_decode_block.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/bc/bc6h_sfloat_decode_block.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;GAiBG;AACH,iDARW,UAAU,UACV,MAAM,OACN,YAAY,QAQtB"}
@@ -0,0 +1,23 @@
1
+ import { bc6h_decode_texels } from "./bc6h_decode_texels.js";
2
+
3
+ /**
4
+ * Decode one signed BC6H block (`bc6h-rgb-float`) into sixteen RGBA float texels, alpha 1.
5
+ *
6
+ * All fourteen modes, bit-exact to the specification: endpoints sign-extended, transformed,
7
+ * unquantised, the magnitude scaled by 31/32 with the sign restored, and the half read as a float —
8
+ * from -65504 to 65504, plus negative infinity, which the sixteen-bit mode can reach, and negative
9
+ * zero where an interpolated value of -1 scales to a magnitude of 0. A reserved mode decodes to
10
+ * (0, 0, 0, 1). See {@link bc6h_decode_texels} for the arithmetic. Any sixteen bytes are a valid
11
+ * block.
12
+ *
13
+ * @param {Uint8Array} source
14
+ * @param {number} offset of the sixteen-byte block in `source`
15
+ * @param {Float32Array} out sixteen RGBA texels, raster order, written from index 0
16
+ *
17
+ * @see the BPTC specification (ARB_texture_compression_bptc), BPTC_FLOAT
18
+ * @author Alex Goldring
19
+ * @copyright Company Named Limited (c) 2026
20
+ */
21
+ export function bc6h_sfloat_decode_block(source, offset, out) {
22
+ bc6h_decode_texels(source, offset, out, true);
23
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Decode one unsigned BC6H block (`bc6h-rgb-ufloat`) into sixteen RGBA float texels, alpha 1.
3
+ *
4
+ * All fourteen modes, bit-exact to the specification: transformed endpoints, unquantisation, the
5
+ * final scale by 31/64 and the half read as a float, never negative and at most 65504. A reserved
6
+ * mode decodes to (0, 0, 0, 1). See {@link bc6h_decode_texels} for the arithmetic. Any sixteen bytes
7
+ * are a valid block.
8
+ *
9
+ * @param {Uint8Array} source
10
+ * @param {number} offset of the sixteen-byte block in `source`
11
+ * @param {Float32Array} out sixteen RGBA texels, raster order, written from index 0
12
+ *
13
+ * @see the BPTC specification (ARB_texture_compression_bptc), BPTC_FLOAT
14
+ * @author Alex Goldring
15
+ * @copyright Company Named Limited (c) 2026
16
+ */
17
+ export function bc6h_ufloat_decode_block(source: Uint8Array, offset: number, out: Float32Array): void;
18
+ //# sourceMappingURL=bc6h_ufloat_decode_block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bc6h_ufloat_decode_block.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/bc/bc6h_ufloat_decode_block.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,iDARW,UAAU,UACV,MAAM,OACN,YAAY,QAQtB"}
@@ -0,0 +1,21 @@
1
+ import { bc6h_decode_texels } from "./bc6h_decode_texels.js";
2
+
3
+ /**
4
+ * Decode one unsigned BC6H block (`bc6h-rgb-ufloat`) into sixteen RGBA float texels, alpha 1.
5
+ *
6
+ * All fourteen modes, bit-exact to the specification: transformed endpoints, unquantisation, the
7
+ * final scale by 31/64 and the half read as a float, never negative and at most 65504. A reserved
8
+ * mode decodes to (0, 0, 0, 1). See {@link bc6h_decode_texels} for the arithmetic. Any sixteen bytes
9
+ * are a valid block.
10
+ *
11
+ * @param {Uint8Array} source
12
+ * @param {number} offset of the sixteen-byte block in `source`
13
+ * @param {Float32Array} out sixteen RGBA texels, raster order, written from index 0
14
+ *
15
+ * @see the BPTC specification (ARB_texture_compression_bptc), BPTC_FLOAT
16
+ * @author Alex Goldring
17
+ * @copyright Company Named Limited (c) 2026
18
+ */
19
+ export function bc6h_ufloat_decode_block(source, offset, out) {
20
+ bc6h_decode_texels(source, offset, out, false);
21
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Decode one BC7 block (`bc7-rgba-unorm`, and its `-srgb` twin, whose bytes are the same) into
3
+ * sixteen RGBA texels.
4
+ *
5
+ * All eight modes of the BPTC specification, read from its Table.M: the mode is the position of the
6
+ * lowest set bit of the first byte, and the fields follow in the order every mode shares —
7
+ * partition, rotation, index selection, colour, alpha, per-endpoint parity, shared parity, primary
8
+ * indices, secondary indices. A parity bit sits below its endpoint's stored bits; the result widens
9
+ * to eight bits by replicating its top bits, and a mode without alpha has alpha 255. Each subset's
10
+ * anchor index — texel 0 for the first, the partition's entry in Table.A2, A3a or A3b for the others
11
+ * — is stored one bit short, its top bit zero. Texels interpolate as
12
+ * `((64 - w) * e0 + w * e1 + 32) >> 6` with the factor `w` for their index's width. With an index
13
+ * selection bit of 1 (mode 4) colour takes the secondary indices and alpha the primary ones;
14
+ * otherwise colour takes the primary indices and alpha the secondary ones where there are any. The
15
+ * rotation then swaps alpha with red (1), green (2) or blue (3).
16
+ *
17
+ * A block whose first byte is zero names no mode, which the specification reserves: it decodes to
18
+ * zero in every channel of every texel. Any other sixteen bytes are a valid block.
19
+ *
20
+ * @param {Uint8Array} source
21
+ * @param {number} offset of the sixteen-byte block in `source`
22
+ * @param {Uint8Array} out sixteen RGBA texels, raster order, written from index 0
23
+ *
24
+ * @see the BPTC specification (ARB_texture_compression_bptc), and the BPTC section of the Khronos
25
+ * Data Format Specification
26
+ * @author Alex Goldring
27
+ * @copyright Company Named Limited (c) 2026
28
+ */
29
+ export function bc7_decode_block(source: Uint8Array, offset: number, out: Uint8Array): void;
30
+ //# sourceMappingURL=bc7_decode_block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bc7_decode_block.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/bc/bc7_decode_block.js"],"names":[],"mappings":"AAwDA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,yCATW,UAAU,UACV,MAAM,OACN,UAAU,QA0JpB"}