@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
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Decode one BC1 block (`bc1-rgba-unorm`, and its `-srgb` twin, whose bytes are the same) into
3
+ * sixteen RGBA texels.
4
+ *
5
+ * Both of the format's modes: `color0 > color1` as sixteen-bit words gives four opaque colours, the
6
+ * endpoints and the two thirds between them; otherwise three opaque colours, the endpoints and their
7
+ * midpoint, and code 3 is transparent black, (0, 0, 0, 0). See {@link bc1_decode_colors} for the
8
+ * eight-bit arithmetic. Any eight bytes are a valid block.
9
+ *
10
+ * @param {Uint8Array} source
11
+ * @param {number} offset of the eight-byte block in `source`
12
+ * @param {Uint8Array} out sixteen RGBA texels, raster order, written from index 0
13
+ *
14
+ * @see Khronos Data Format Specification, S3TC, "BC1 with alpha"
15
+ * @author Alex Goldring
16
+ * @copyright Company Named Limited (c) 2026
17
+ */
18
+ export function bc1_decode_block(source: Uint8Array, offset: number, out: Uint8Array): void;
19
+ //# sourceMappingURL=bc1_decode_block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bc1_decode_block.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/bc/bc1_decode_block.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,yCARW,UAAU,UACV,MAAM,OACN,UAAU,QAQpB"}
@@ -0,0 +1,22 @@
1
+ import { bc1_decode_colors } from "./bc1_decode_colors.js";
2
+
3
+ /**
4
+ * Decode one BC1 block (`bc1-rgba-unorm`, and its `-srgb` twin, whose bytes are the same) into
5
+ * sixteen RGBA texels.
6
+ *
7
+ * Both of the format's modes: `color0 > color1` as sixteen-bit words gives four opaque colours, the
8
+ * endpoints and the two thirds between them; otherwise three opaque colours, the endpoints and their
9
+ * midpoint, and code 3 is transparent black, (0, 0, 0, 0). See {@link bc1_decode_colors} for the
10
+ * eight-bit arithmetic. Any eight bytes are a valid block.
11
+ *
12
+ * @param {Uint8Array} source
13
+ * @param {number} offset of the eight-byte block in `source`
14
+ * @param {Uint8Array} out sixteen RGBA texels, raster order, written from index 0
15
+ *
16
+ * @see Khronos Data Format Specification, S3TC, "BC1 with alpha"
17
+ * @author Alex Goldring
18
+ * @copyright Company Named Limited (c) 2026
19
+ */
20
+ export function bc1_decode_block(source, offset, out) {
21
+ bc1_decode_colors(source, offset, out, false);
22
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Decode the eight-byte colour block shared by BC1, BC2 and BC3 into sixteen RGBA texels.
3
+ *
4
+ * From the S3TC section of the Khronos Data Format Specification: two little-endian 5:6:5 endpoint
5
+ * words, then thirty-two bits of two-bit codes with texel 0 lowest, so each byte is one row. With
6
+ * `color0 > color1` as words — or always, for BC2 and BC3, whose colour block "always uses the
7
+ * non-transparent encodings" — code 2 is two thirds of the way from `color1` to `color0` and code 3
8
+ * one third; otherwise code 2 is the midpoint and code 3 is transparent black, (0, 0, 0, 0).
9
+ *
10
+ * The specification gives the endpoints and interpolants as real values and fixes no conversion to
11
+ * eight bits. Here each endpoint widens to eight bits by replicating its top bits into the low ones,
12
+ * and an interpolant is the integer quotient of the widened values' weighted sum: `(2a + b) / 3`,
13
+ * `(a + 2b) / 3` and `(a + b) / 2`, truncated. That is the arithmetic of the reference decoder whose
14
+ * published texels these reproduce; a device may round an interpolant to the other neighbour.
15
+ *
16
+ * Writes all sixteen texels' red, green, blue and alpha; alpha is 255 except at a transparent code 3.
17
+ *
18
+ * @param {Uint8Array} source
19
+ * @param {number} offset of the colour block in `source`
20
+ * @param {Uint8Array} out sixteen RGBA texels, raster order, from index 0
21
+ * @param {boolean} four_color_only `true` to read every block as four colours, as BC2 and BC3 do
22
+ *
23
+ * @author Alex Goldring
24
+ * @copyright Company Named Limited (c) 2026
25
+ */
26
+ export function bc1_decode_colors(source: Uint8Array, offset: number, out: Uint8Array, four_color_only: boolean): void;
27
+ //# sourceMappingURL=bc1_decode_colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bc1_decode_colors.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/bc/bc1_decode_colors.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,0CARW,UAAU,UACV,MAAM,OACN,UAAU,mBACV,OAAO,QAwEjB"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * The four RGBA colours of the block being decoded, index by index.
3
+ *
4
+ * @type {Uint8Array}
5
+ */
6
+ const PALETTE = new Uint8Array(16);
7
+
8
+ /**
9
+ * Decode the eight-byte colour block shared by BC1, BC2 and BC3 into sixteen RGBA texels.
10
+ *
11
+ * From the S3TC section of the Khronos Data Format Specification: two little-endian 5:6:5 endpoint
12
+ * words, then thirty-two bits of two-bit codes with texel 0 lowest, so each byte is one row. With
13
+ * `color0 > color1` as words — or always, for BC2 and BC3, whose colour block "always uses the
14
+ * non-transparent encodings" — code 2 is two thirds of the way from `color1` to `color0` and code 3
15
+ * one third; otherwise code 2 is the midpoint and code 3 is transparent black, (0, 0, 0, 0).
16
+ *
17
+ * The specification gives the endpoints and interpolants as real values and fixes no conversion to
18
+ * eight bits. Here each endpoint widens to eight bits by replicating its top bits into the low ones,
19
+ * and an interpolant is the integer quotient of the widened values' weighted sum: `(2a + b) / 3`,
20
+ * `(a + 2b) / 3` and `(a + b) / 2`, truncated. That is the arithmetic of the reference decoder whose
21
+ * published texels these reproduce; a device may round an interpolant to the other neighbour.
22
+ *
23
+ * Writes all sixteen texels' red, green, blue and alpha; alpha is 255 except at a transparent code 3.
24
+ *
25
+ * @param {Uint8Array} source
26
+ * @param {number} offset of the colour block in `source`
27
+ * @param {Uint8Array} out sixteen RGBA texels, raster order, from index 0
28
+ * @param {boolean} four_color_only `true` to read every block as four colours, as BC2 and BC3 do
29
+ *
30
+ * @author Alex Goldring
31
+ * @copyright Company Named Limited (c) 2026
32
+ */
33
+ export function bc1_decode_colors(source, offset, out, four_color_only) {
34
+ const color0 = source[offset] | (source[offset + 1] << 8);
35
+ const color1 = source[offset + 2] | (source[offset + 3] << 8);
36
+
37
+ const r5_0 = color0 >> 11;
38
+ const g6_0 = (color0 >> 5) & 63;
39
+ const b5_0 = color0 & 31;
40
+
41
+ const r5_1 = color1 >> 11;
42
+ const g6_1 = (color1 >> 5) & 63;
43
+ const b5_1 = color1 & 31;
44
+
45
+ const r0 = (r5_0 << 3) | (r5_0 >> 2);
46
+ const g0 = (g6_0 << 2) | (g6_0 >> 4);
47
+ const b0 = (b5_0 << 3) | (b5_0 >> 2);
48
+
49
+ const r1 = (r5_1 << 3) | (r5_1 >> 2);
50
+ const g1 = (g6_1 << 2) | (g6_1 >> 4);
51
+ const b1 = (b5_1 << 3) | (b5_1 >> 2);
52
+
53
+ PALETTE[0] = r0;
54
+ PALETTE[1] = g0;
55
+ PALETTE[2] = b0;
56
+ PALETTE[3] = 255;
57
+
58
+ PALETTE[4] = r1;
59
+ PALETTE[5] = g1;
60
+ PALETTE[6] = b1;
61
+ PALETTE[7] = 255;
62
+
63
+ if (four_color_only || color0 > color1) {
64
+ PALETTE[8] = ((2 * r0 + r1) / 3) | 0;
65
+ PALETTE[9] = ((2 * g0 + g1) / 3) | 0;
66
+ PALETTE[10] = ((2 * b0 + b1) / 3) | 0;
67
+ PALETTE[11] = 255;
68
+
69
+ PALETTE[12] = ((r0 + 2 * r1) / 3) | 0;
70
+ PALETTE[13] = ((g0 + 2 * g1) / 3) | 0;
71
+ PALETTE[14] = ((b0 + 2 * b1) / 3) | 0;
72
+ PALETTE[15] = 255;
73
+ } else {
74
+ PALETTE[8] = (r0 + r1) >> 1;
75
+ PALETTE[9] = (g0 + g1) >> 1;
76
+ PALETTE[10] = (b0 + b1) >> 1;
77
+ PALETTE[11] = 255;
78
+
79
+ PALETTE[12] = 0;
80
+ PALETTE[13] = 0;
81
+ PALETTE[14] = 0;
82
+ PALETTE[15] = 0;
83
+ }
84
+
85
+ for (let row = 0; row < 4; row++) {
86
+ let codes = source[offset + 4 + row];
87
+
88
+ for (let column = 0; column < 4; column++) {
89
+ const from = (codes & 3) << 2;
90
+ const to = (row * 4 + column) << 2;
91
+
92
+ out[to] = PALETTE[from];
93
+ out[to + 1] = PALETTE[from + 1];
94
+ out[to + 2] = PALETTE[from + 2];
95
+ out[to + 3] = PALETTE[from + 3];
96
+
97
+ codes >>= 2;
98
+ }
99
+ }
100
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Decode one BC2 block (`bc2-rgba-unorm`, and its `-srgb` twin) into sixteen RGBA texels.
3
+ *
4
+ * Sixty-four bits of explicit alpha, four per texel with texel 0 in the low nibble of the first byte,
5
+ * then a BC1 colour block that always decodes as four colours whatever its endpoints' order. A
6
+ * stored alpha `a` of fifteen is `a / 15`, which as a byte is exactly `17a`. Any sixteen bytes are a
7
+ * valid block.
8
+ *
9
+ * @param {Uint8Array} source
10
+ * @param {number} offset of the sixteen-byte block in `source`
11
+ * @param {Uint8Array} out sixteen RGBA texels, raster order, written from index 0
12
+ *
13
+ * @see Khronos Data Format Specification, S3TC, "BC2"
14
+ * @author Alex Goldring
15
+ * @copyright Company Named Limited (c) 2026
16
+ */
17
+ export function bc2_decode_block(source: Uint8Array, offset: number, out: Uint8Array): void;
18
+ //# sourceMappingURL=bc2_decode_block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bc2_decode_block.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/bc/bc2_decode_block.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,yCARW,UAAU,UACV,MAAM,OACN,UAAU,QAepB"}
@@ -0,0 +1,28 @@
1
+ import { bc1_decode_colors } from "./bc1_decode_colors.js";
2
+
3
+ /**
4
+ * Decode one BC2 block (`bc2-rgba-unorm`, and its `-srgb` twin) into sixteen RGBA texels.
5
+ *
6
+ * Sixty-four bits of explicit alpha, four per texel with texel 0 in the low nibble of the first byte,
7
+ * then a BC1 colour block that always decodes as four colours whatever its endpoints' order. A
8
+ * stored alpha `a` of fifteen is `a / 15`, which as a byte is exactly `17a`. Any sixteen bytes are a
9
+ * valid block.
10
+ *
11
+ * @param {Uint8Array} source
12
+ * @param {number} offset of the sixteen-byte block in `source`
13
+ * @param {Uint8Array} out sixteen RGBA texels, raster order, written from index 0
14
+ *
15
+ * @see Khronos Data Format Specification, S3TC, "BC2"
16
+ * @author Alex Goldring
17
+ * @copyright Company Named Limited (c) 2026
18
+ */
19
+ export function bc2_decode_block(source, offset, out) {
20
+ bc1_decode_colors(source, offset + 8, out, true);
21
+
22
+ for (let pair = 0; pair < 8; pair++) {
23
+ const alphas = source[offset + pair];
24
+
25
+ out[pair * 8 + 3] = (alphas & 15) * 17;
26
+ out[pair * 8 + 7] = (alphas >> 4) * 17;
27
+ }
28
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Decode one BC3 block (`bc3-rgba-unorm`, and its `-srgb` twin) into sixteen RGBA texels.
3
+ *
4
+ * Sixty-four bits of alpha laid out and interpolated exactly as an unsigned BC4 block, then a BC1
5
+ * colour block that always decodes as four colours whatever its endpoints' order. See
6
+ * {@link bc4_unorm_decode_channel} for how the alpha reaches a byte. Any sixteen bytes are a valid
7
+ * block.
8
+ *
9
+ * @param {Uint8Array} source
10
+ * @param {number} offset of the sixteen-byte block in `source`
11
+ * @param {Uint8Array} out sixteen RGBA texels, raster order, written from index 0
12
+ *
13
+ * @see Khronos Data Format Specification, S3TC, "BC3"
14
+ * @author Alex Goldring
15
+ * @copyright Company Named Limited (c) 2026
16
+ */
17
+ export function bc3_decode_block(source: Uint8Array, offset: number, out: Uint8Array): void;
18
+ //# sourceMappingURL=bc3_decode_block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bc3_decode_block.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/bc/bc3_decode_block.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AACH,yCARW,UAAU,UACV,MAAM,OACN,UAAU,QASpB"}
@@ -0,0 +1,23 @@
1
+ import { bc1_decode_colors } from "./bc1_decode_colors.js";
2
+ import { bc4_unorm_decode_channel } from "./bc4_decode_channel.js";
3
+
4
+ /**
5
+ * Decode one BC3 block (`bc3-rgba-unorm`, and its `-srgb` twin) into sixteen RGBA texels.
6
+ *
7
+ * Sixty-four bits of alpha laid out and interpolated exactly as an unsigned BC4 block, then a BC1
8
+ * colour block that always decodes as four colours whatever its endpoints' order. See
9
+ * {@link bc4_unorm_decode_channel} for how the alpha reaches a byte. Any sixteen bytes are a valid
10
+ * block.
11
+ *
12
+ * @param {Uint8Array} source
13
+ * @param {number} offset of the sixteen-byte block in `source`
14
+ * @param {Uint8Array} out sixteen RGBA texels, raster order, written from index 0
15
+ *
16
+ * @see Khronos Data Format Specification, S3TC, "BC3"
17
+ * @author Alex Goldring
18
+ * @copyright Company Named Limited (c) 2026
19
+ */
20
+ export function bc3_decode_block(source, offset, out) {
21
+ bc1_decode_colors(source, offset + 8, out, true);
22
+ bc4_unorm_decode_channel(source, offset, out, 3);
23
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Decode an unsigned BC4 block into one channel of sixteen RGBA texels, leaving the other channels.
3
+ *
4
+ * From the RGTC section of the Khronos Data Format Specification: endpoints `red0` and `red1` are
5
+ * bytes read as `/ 255`. With `red0 > red1` code `k` from 2 to 7 is `((8 - k) * red0 + (k - 1) *
6
+ * red1) / 7`; otherwise codes 2 to 5 are `((6 - k) * red0 + (k - 1) * red1) / 5`, code 6 is 0 and
7
+ * code 7 is 1. The specification interpolates in real numbers; each value is written as the nearest
8
+ * byte, `round(x * 255)`, which is never a tie because the sums are integers divided by 7 or 5.
9
+ *
10
+ * This is also BC3's alpha block and each half of a BC5 block.
11
+ *
12
+ * @param {Uint8Array} source
13
+ * @param {number} offset of the eight-byte block in `source`
14
+ * @param {Uint8Array} out sixteen RGBA texels, raster order, from index 0
15
+ * @param {number} channel `0` to `3`, the one written
16
+ *
17
+ * @author Alex Goldring
18
+ * @copyright Company Named Limited (c) 2026
19
+ */
20
+ export function bc4_unorm_decode_channel(source: Uint8Array, offset: number, out: Uint8Array, channel: number): void;
21
+ /**
22
+ * Decode a signed BC4 block into one channel of sixteen RGBA texels, leaving the other channels.
23
+ *
24
+ * As {@link bc4_unorm_decode_channel}, over two's complement endpoints read as `/ 127`, with -128
25
+ * reading as -127 (-1), and the six-value mode's hard entries at -1 and 1. Which mode applies is
26
+ * decided by comparing the endpoints as the values they decode to, so `red0 = -127, red1 = -128`, the one pair
27
+ * whose mode the specification leaves to the implementation, is the six-value mode, as a GPU's hardware decode
28
+ * reads it. Each value is written as the nearest of -127..127, `round(x * 127)`, which is never a tie.
29
+ *
30
+ * @param {Uint8Array} source
31
+ * @param {number} offset of the eight-byte block in `source`
32
+ * @param {Int8Array} out sixteen RGBA texels, raster order, from index 0
33
+ * @param {number} channel `0` to `3`, the one written
34
+ *
35
+ * @author Alex Goldring
36
+ * @copyright Company Named Limited (c) 2026
37
+ */
38
+ export function bc4_snorm_decode_channel(source: Uint8Array, offset: number, out: Int8Array, channel: number): void;
39
+ /**
40
+ * The eight bytes an unsigned BC4 block's codes select, as {@link bc4_unorm_decode_channel} decodes them.
41
+ *
42
+ * @param {number} red0 the first endpoint, a byte
43
+ * @param {number} red1 the second
44
+ * @param {Uint8Array|Int32Array} out eight, by code
45
+ */
46
+ export function bc4_unorm_palette(red0: number, red1: number, out: Uint8Array | Int32Array): void;
47
+ /**
48
+ * The eight values, `-127` to `127`, a signed BC4 block's codes select, as {@link bc4_snorm_decode_channel} decodes
49
+ * them: an endpoint of -128 reads as -127, and the mode follows the values so read.
50
+ *
51
+ * @param {number} red0 the first endpoint as stored, two's complement, `-128` to `127`
52
+ * @param {number} red1 the second
53
+ * @param {Int8Array|Int32Array} out eight, by code
54
+ */
55
+ export function bc4_snorm_palette(red0: number, red1: number, out: Int8Array | Int32Array): void;
56
+ //# sourceMappingURL=bc4_decode_channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bc4_decode_channel.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/bc/bc4_decode_channel.js"],"names":[],"mappings":"AAuCA;;;;;;;;;;;;;;;;;;GAkBG;AACH,iDARW,UAAU,UACV,MAAM,OACN,UAAU,WACV,MAAM,QAShB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,iDARW,UAAU,UACV,MAAM,OACN,SAAS,WACT,MAAM,QAShB;AA+BD;;;;;;GAMG;AACH,wCAJW,MAAM,QACN,MAAM,OACN,UAAU,GAAC,UAAU,QAI/B;AAED;;;;;;;GAOG;AACH,wCAJW,MAAM,QACN,MAAM,OACN,SAAS,GAAC,UAAU,QAI9B"}
@@ -0,0 +1,138 @@
1
+ /**
2
+ * The eight values an unsigned block's codes select.
3
+ *
4
+ * @type {Uint8Array}
5
+ */
6
+ const PALETTE_UNORM = new Uint8Array(8);
7
+
8
+ /**
9
+ * The eight values a signed block's codes select.
10
+ *
11
+ * @type {Int8Array}
12
+ */
13
+ const PALETTE_SNORM = new Int8Array(8);
14
+
15
+ /**
16
+ * Write the sixteen three-bit codes of a BC4 block, looked up in `palette`, into one channel of
17
+ * sixteen four-channel texels. The codes are forty-eight little-endian bits from byte 2 of the block,
18
+ * texel 0 lowest, so each half of the block's codes is exactly three bytes.
19
+ *
20
+ * @param {Uint8Array} source
21
+ * @param {number} offset of the BC4 block
22
+ * @param {Uint8Array|Int8Array} palette eight values
23
+ * @param {Uint8Array|Int8Array} out
24
+ * @param {number} channel
25
+ */
26
+ function write_codes(source, offset, palette, out, channel) {
27
+ for (let half = 0; half < 2; half++) {
28
+ const at = offset + 2 + half * 3;
29
+
30
+ let codes = source[at] | (source[at + 1] << 8) | (source[at + 2] << 16);
31
+
32
+ for (let t = half * 8; t < half * 8 + 8; t++) {
33
+ out[t * 4 + channel] = palette[codes & 7];
34
+
35
+ codes >>= 3;
36
+ }
37
+ }
38
+ }
39
+
40
+ /**
41
+ * Decode an unsigned BC4 block into one channel of sixteen RGBA texels, leaving the other channels.
42
+ *
43
+ * From the RGTC section of the Khronos Data Format Specification: endpoints `red0` and `red1` are
44
+ * bytes read as `/ 255`. With `red0 > red1` code `k` from 2 to 7 is `((8 - k) * red0 + (k - 1) *
45
+ * red1) / 7`; otherwise codes 2 to 5 are `((6 - k) * red0 + (k - 1) * red1) / 5`, code 6 is 0 and
46
+ * code 7 is 1. The specification interpolates in real numbers; each value is written as the nearest
47
+ * byte, `round(x * 255)`, which is never a tie because the sums are integers divided by 7 or 5.
48
+ *
49
+ * This is also BC3's alpha block and each half of a BC5 block.
50
+ *
51
+ * @param {Uint8Array} source
52
+ * @param {number} offset of the eight-byte block in `source`
53
+ * @param {Uint8Array} out sixteen RGBA texels, raster order, from index 0
54
+ * @param {number} channel `0` to `3`, the one written
55
+ *
56
+ * @author Alex Goldring
57
+ * @copyright Company Named Limited (c) 2026
58
+ */
59
+ export function bc4_unorm_decode_channel(source, offset, out, channel) {
60
+ bc4_unorm_palette(source[offset], source[offset + 1], PALETTE_UNORM);
61
+
62
+ write_codes(source, offset, PALETTE_UNORM, out, channel);
63
+ }
64
+
65
+ /**
66
+ * Decode a signed BC4 block into one channel of sixteen RGBA texels, leaving the other channels.
67
+ *
68
+ * As {@link bc4_unorm_decode_channel}, over two's complement endpoints read as `/ 127`, with -128
69
+ * reading as -127 (-1), and the six-value mode's hard entries at -1 and 1. Which mode applies is
70
+ * decided by comparing the endpoints as the values they decode to, so `red0 = -127, red1 = -128`, the one pair
71
+ * whose mode the specification leaves to the implementation, is the six-value mode, as a GPU's hardware decode
72
+ * reads it. Each value is written as the nearest of -127..127, `round(x * 127)`, which is never a tie.
73
+ *
74
+ * @param {Uint8Array} source
75
+ * @param {number} offset of the eight-byte block in `source`
76
+ * @param {Int8Array} out sixteen RGBA texels, raster order, from index 0
77
+ * @param {number} channel `0` to `3`, the one written
78
+ *
79
+ * @author Alex Goldring
80
+ * @copyright Company Named Limited (c) 2026
81
+ */
82
+ export function bc4_snorm_decode_channel(source, offset, out, channel) {
83
+ bc4_snorm_palette((source[offset] << 24) >> 24, (source[offset + 1] << 24) >> 24, PALETTE_SNORM);
84
+
85
+ write_codes(source, offset, PALETTE_SNORM, out, channel);
86
+ }
87
+
88
+ /**
89
+ * The eight values a block's codes select, from its two endpoints' values: with the first above the second, eight
90
+ * along the line between them; otherwise six along it and the domain's two extremes. Each is the nearest whole
91
+ * value, which is never a tie.
92
+ *
93
+ * @param {number} value0
94
+ * @param {number} value1
95
+ * @param {number} floor the domain's least value, code 6 of the six-value mode
96
+ * @param {number} ceil the domain's greatest, code 7
97
+ * @param {Uint8Array|Int8Array|Int32Array} out eight
98
+ */
99
+ function bc4_palette(value0, value1, floor, ceil, out) {
100
+ out[0] = value0;
101
+ out[1] = value1;
102
+
103
+ if (value0 > value1) {
104
+ for (let k = 2; k < 8; k++) {
105
+ out[k] = Math.round(((8 - k) * value0 + (k - 1) * value1) / 7);
106
+ }
107
+ } else {
108
+ for (let k = 2; k < 6; k++) {
109
+ out[k] = Math.round(((6 - k) * value0 + (k - 1) * value1) / 5);
110
+ }
111
+
112
+ out[6] = floor;
113
+ out[7] = ceil;
114
+ }
115
+ }
116
+
117
+ /**
118
+ * The eight bytes an unsigned BC4 block's codes select, as {@link bc4_unorm_decode_channel} decodes them.
119
+ *
120
+ * @param {number} red0 the first endpoint, a byte
121
+ * @param {number} red1 the second
122
+ * @param {Uint8Array|Int32Array} out eight, by code
123
+ */
124
+ export function bc4_unorm_palette(red0, red1, out) {
125
+ bc4_palette(red0, red1, 0, 255, out);
126
+ }
127
+
128
+ /**
129
+ * The eight values, `-127` to `127`, a signed BC4 block's codes select, as {@link bc4_snorm_decode_channel} decodes
130
+ * them: an endpoint of -128 reads as -127, and the mode follows the values so read.
131
+ *
132
+ * @param {number} red0 the first endpoint as stored, two's complement, `-128` to `127`
133
+ * @param {number} red1 the second
134
+ * @param {Int8Array|Int32Array} out eight, by code
135
+ */
136
+ export function bc4_snorm_palette(red0, red1, out) {
137
+ bc4_palette(red0 === -128 ? -127 : red0, red1 === -128 ? -127 : red1, -127, 127, out);
138
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Encode one channel of sixteen RGBA texels as an unsigned BC4 block (`bc4-r-unorm`), the red half or the green half
3
+ * of a BC5 block.
4
+ *
5
+ * @param {Uint8Array} texels sixty-four bytes: sixteen RGBA texels in raster order
6
+ * @param {number} channel which channel is encoded, `0` to `3`
7
+ * @param {Uint8Array} out
8
+ * @param {number} offset of the block's eight bytes in `out`
9
+ */
10
+ export function bc4_unorm_encode_channel(texels: Uint8Array, channel: number, out: Uint8Array, offset: number): void;
11
+ /**
12
+ * Encode one channel of sixteen RGBA texels as a signed BC4 block (`bc4-r-snorm`), the red half or the green half of
13
+ * a BC5 block. A value of -128 is taken as the -127 it samples as.
14
+ *
15
+ * @param {Int8Array} texels sixty-four signed bytes: sixteen RGBA texels in raster order
16
+ * @param {number} channel which channel is encoded, `0` to `3`
17
+ * @param {Uint8Array} out
18
+ * @param {number} offset of the block's eight bytes in `out`
19
+ */
20
+ export function bc4_snorm_encode_channel(texels: Int8Array, channel: number, out: Uint8Array, offset: number): void;
21
+ /**
22
+ * Encode sixteen RGBA texels' red as one `bc4-r-unorm` block.
23
+ *
24
+ * @param {Uint8Array} texels sixty-four bytes: sixteen RGBA texels in raster order
25
+ * @param {Uint8Array} out
26
+ * @param {number} offset of the block's eight bytes in `out`
27
+ *
28
+ * @author Alex Goldring
29
+ * @copyright Company Named Limited (c) 2026
30
+ */
31
+ export function bc4_unorm_encode_block(texels: Uint8Array, out: Uint8Array, offset: number): void;
32
+ /**
33
+ * Encode sixteen RGBA texels' red as one `bc4-r-snorm` block.
34
+ *
35
+ * @param {Int8Array} texels sixty-four signed bytes: sixteen RGBA texels in raster order
36
+ * @param {Uint8Array} out
37
+ * @param {number} offset of the block's eight bytes in `out`
38
+ *
39
+ * @author Alex Goldring
40
+ * @copyright Company Named Limited (c) 2026
41
+ */
42
+ export function bc4_snorm_encode_block(texels: Int8Array, out: Uint8Array, offset: number): void;
43
+ //# sourceMappingURL=bc4_encode_block.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bc4_encode_block.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/bc/bc4_encode_block.js"],"names":[],"mappings":"AAuQA;;;;;;;;GAQG;AACH,iDALW,UAAU,WACV,MAAM,OACN,UAAU,UACV,MAAM,QAQhB;AAED;;;;;;;;GAQG;AACH,iDALW,SAAS,WACT,MAAM,OACN,UAAU,UACV,MAAM,QAQhB;AAED;;;;;;;;;GASG;AACH,+CAPW,UAAU,OACV,UAAU,UACV,MAAM,QAOhB;AAED;;;;;;;;;GASG;AACH,+CAPW,SAAS,OACT,UAAU,UACV,MAAM,QAOhB"}