@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,33 @@
1
+ import { cubic_filter_coefficients, mipmap_cubic_filter_cpu } from "./mipmap_cubic_filter_cpu.js";
2
+
3
+ /**
4
+ * The Catmull-Rom cubic, B = 0, C = 1/2.
5
+ * @readonly
6
+ * @type {Float64Array}
7
+ */
8
+ const CATMULL_ROM = cubic_filter_coefficients(0, 0.5);
9
+
10
+ /**
11
+ * One pass of the Catmull-Rom reduction, the CPU twin of `mipmap_shader_code_catmull_rom`; see
12
+ * {@link mipmap_cubic_filter_cpu}.
13
+ *
14
+ * @param {Float32Array} output RGBA, raster order: the fragment outputs, before any store
15
+ * @param {number} output_width
16
+ * @param {number} output_height
17
+ * @param {Float32Array} source RGBA, raster order: the level read, as the shader reads it
18
+ * @param {number} source_width
19
+ * @param {number} source_height
20
+ *
21
+ * @author Alex Goldring
22
+ * @copyright Company Named Limited (c) 2026
23
+ */
24
+ export function mipmap_filter_catmull_rom_cpu(
25
+ output, output_width, output_height,
26
+ source, source_width, source_height
27
+ ) {
28
+ mipmap_cubic_filter_cpu(
29
+ output, output_width, output_height,
30
+ source, source_width, source_height,
31
+ CATMULL_ROM
32
+ );
33
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * One pass of the linear reduction, the CPU twin of `mipmap_shader_code_linear`: each destination
3
+ * texel is the mean of the source over the texel's footprint, every source texel it touches weighed
4
+ * separably by the share of the footprint it covers, all in f32 as that shader computes it — see
5
+ * {@link mipmap_kernel_reduce}. For a source twice the size that is the average of a 2x2 block.
6
+ *
7
+ * @param {Float32Array} output RGBA, raster order: the fragment outputs, before any store
8
+ * @param {number} output_width
9
+ * @param {number} output_height
10
+ * @param {Float32Array} source RGBA, raster order: the level read, as the shader reads it
11
+ * @param {number} source_width
12
+ * @param {number} source_height
13
+ *
14
+ * @author Alex Goldring
15
+ * @copyright Company Named Limited (c) 2026
16
+ */
17
+ export function mipmap_filter_linear_cpu(output: Float32Array, output_width: number, output_height: number, source: Float32Array, source_width: number, source_height: number): void;
18
+ //# sourceMappingURL=mipmap_filter_linear_cpu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mipmap_filter_linear_cpu.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.js"],"names":[],"mappings":"AA0CA;;;;;;;;;;;;;;;GAeG;AACH,iDAVW,YAAY,gBACZ,MAAM,iBACN,MAAM,UACN,YAAY,gBACZ,MAAM,iBACN,MAAM,QAiBhB"}
@@ -0,0 +1,71 @@
1
+ import { MipmapKernelAxis } from "./MipmapKernelAxis.js";
2
+ import { mipmap_kernel_reduce } from "./mipmap_kernel_reduce.js";
3
+
4
+ /**
5
+ * The box footprint of each destination texel along one axis: destination texel `i` covers
6
+ * `[i * source_size, (i + 1) * source_size)` in units of `1 / output_size` of a source texel, and each
7
+ * source texel it touches weighs the share of that it covers, `covered / source_size` as an f32.
8
+ *
9
+ * @param {number} output_size
10
+ * @param {number} source_size
11
+ * @returns {MipmapKernelAxis}
12
+ */
13
+ function box_axis(output_size, source_size) {
14
+ // a footprint source_size / output_size texels long touches at most one texel more than that
15
+ const axis = new MipmapKernelAxis(output_size, Math.ceil(source_size / output_size) + 1);
16
+
17
+ let tap = 0;
18
+
19
+ for (let i = 0; i < output_size; i++) {
20
+ const lo = i * source_size;
21
+ const hi = lo + source_size;
22
+
23
+ const first = Math.floor(lo / output_size);
24
+ const last = Math.floor((hi - 1) / output_size);
25
+
26
+ axis.first[i] = tap;
27
+
28
+ for (let k = first; k <= last; k++) {
29
+ const covered = Math.min(hi, (k + 1) * output_size) - Math.max(lo, k * output_size);
30
+
31
+ axis.index[tap] = k;
32
+ axis.weight[tap] = Math.fround(covered / source_size);
33
+
34
+ tap++;
35
+ }
36
+
37
+ axis.count[i] = tap - axis.first[i];
38
+ }
39
+
40
+ return axis;
41
+ }
42
+
43
+ /**
44
+ * One pass of the linear reduction, the CPU twin of `mipmap_shader_code_linear`: each destination
45
+ * texel is the mean of the source over the texel's footprint, every source texel it touches weighed
46
+ * separably by the share of the footprint it covers, all in f32 as that shader computes it — see
47
+ * {@link mipmap_kernel_reduce}. For a source twice the size that is the average of a 2x2 block.
48
+ *
49
+ * @param {Float32Array} output RGBA, raster order: the fragment outputs, before any store
50
+ * @param {number} output_width
51
+ * @param {number} output_height
52
+ * @param {Float32Array} source RGBA, raster order: the level read, as the shader reads it
53
+ * @param {number} source_width
54
+ * @param {number} source_height
55
+ *
56
+ * @author Alex Goldring
57
+ * @copyright Company Named Limited (c) 2026
58
+ */
59
+ export function mipmap_filter_linear_cpu(
60
+ output, output_width, output_height,
61
+ source, source_width, source_height
62
+ ) {
63
+ mipmap_kernel_reduce(
64
+ output, output_width, output_height,
65
+ source, source_width,
66
+ box_axis(output_width, source_width),
67
+ box_axis(output_height, source_height),
68
+ // the weights are never all zero, and the shader divides by their sum unconditionally
69
+ 0
70
+ );
71
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * One pass of the normal-map reduction, the CPU twin of `mipmap_shader_code_linear_normal`: each
3
+ * destination texel is a bilinear sample of the source at the texel's centre, as
4
+ * {@link mipmap_filter_linear_cpu} takes it, whose colour is read as a vector (`rgb * 2 - 1`),
5
+ * normalised and written back as a colour (`n * 0.5 + 0.5`); alpha is the sample's. In f32 as that
6
+ * shader computes it: the length is the f32 square root of the f32 sum of f32 squares, and each
7
+ * component is divided by it. A zero vector has no direction and comes out NaN.
8
+ *
9
+ * @param {Float32Array} output RGBA, raster order: the fragment outputs, before any store
10
+ * @param {number} output_width
11
+ * @param {number} output_height
12
+ * @param {Float32Array} source RGBA, raster order: the level read, as the shader reads it
13
+ * @param {number} source_width
14
+ * @param {number} source_height
15
+ *
16
+ * @author Alex Goldring
17
+ * @copyright Company Named Limited (c) 2026
18
+ */
19
+ export function mipmap_filter_linear_normal_cpu(output: Float32Array, output_width: number, output_height: number, source: Float32Array, source_width: number, source_height: number): void;
20
+ //# sourceMappingURL=mipmap_filter_linear_normal_cpu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mipmap_filter_linear_normal_cpu.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;GAiBG;AACH,wDAVW,YAAY,gBACZ,MAAM,iBACN,MAAM,UACN,YAAY,gBACZ,MAAM,iBACN,MAAM,QAmChB"}
@@ -0,0 +1,57 @@
1
+ import { mipmap_bilinear_centres } from "./mipmap_bilinear_centres.js";
2
+ import { mipmap_bilinear_sample } from "./mipmap_bilinear_sample.js";
3
+
4
+ /**
5
+ * @type {Float32Array}
6
+ */
7
+ const SAMPLE = new Float32Array(4);
8
+
9
+ /**
10
+ * One pass of the normal-map reduction, the CPU twin of `mipmap_shader_code_linear_normal`: each
11
+ * destination texel is a bilinear sample of the source at the texel's centre, as
12
+ * {@link mipmap_filter_linear_cpu} takes it, whose colour is read as a vector (`rgb * 2 - 1`),
13
+ * normalised and written back as a colour (`n * 0.5 + 0.5`); alpha is the sample's. In f32 as that
14
+ * shader computes it: the length is the f32 square root of the f32 sum of f32 squares, and each
15
+ * component is divided by it. A zero vector has no direction and comes out NaN.
16
+ *
17
+ * @param {Float32Array} output RGBA, raster order: the fragment outputs, before any store
18
+ * @param {number} output_width
19
+ * @param {number} output_height
20
+ * @param {Float32Array} source RGBA, raster order: the level read, as the shader reads it
21
+ * @param {number} source_width
22
+ * @param {number} source_height
23
+ *
24
+ * @author Alex Goldring
25
+ * @copyright Company Named Limited (c) 2026
26
+ */
27
+ export function mipmap_filter_linear_normal_cpu(
28
+ output, output_width, output_height,
29
+ source, source_width, source_height
30
+ ) {
31
+ const fround = Math.fround;
32
+
33
+ const x_axis = mipmap_bilinear_centres(output_width, source_width, false);
34
+ const y_axis = mipmap_bilinear_centres(output_height, source_height, source_height === 1);
35
+
36
+ let out = 0;
37
+
38
+ for (let y = 0; y < output_height; y++) {
39
+ for (let x = 0; x < output_width; x++) {
40
+ mipmap_bilinear_sample(SAMPLE, 0, source, source_width, x_axis, x, y_axis, y);
41
+
42
+ const vx = fround(fround(SAMPLE[0] * 2) - 1);
43
+ const vy = fround(fround(SAMPLE[1] * 2) - 1);
44
+ const vz = fround(fround(SAMPLE[2] * 2) - 1);
45
+
46
+ const length_squared = fround(fround(fround(vx * vx) + fround(vy * vy)) + fround(vz * vz));
47
+ const length = fround(Math.sqrt(length_squared));
48
+
49
+ output[out] = fround(fround(fround(vx / length) * 0.5) + 0.5);
50
+ output[out + 1] = fround(fround(fround(vy / length) * 0.5) + 0.5);
51
+ output[out + 2] = fround(fround(fround(vz / length) * 0.5) + 0.5);
52
+ output[out + 3] = SAMPLE[3];
53
+
54
+ out += 4;
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * One pass of the base Magic Kernel reduction, the CPU twin of `mipmap_shader_code_magic_kernel`:
3
+ * each destination texel is the normalised sum of the source texels within 1.5 destination texels of
4
+ * its centre, weighed separably by the base Magic Kernel at their distance in destination texels, all
5
+ * in f32 as that shader computes it — see {@link mipmap_kernel_reduce}.
6
+ *
7
+ * @param {Float32Array} output RGBA, raster order: the fragment outputs, before any store
8
+ * @param {number} output_width
9
+ * @param {number} output_height
10
+ * @param {Float32Array} source RGBA, raster order: the level read, as the shader reads it
11
+ * @param {number} source_width
12
+ * @param {number} source_height
13
+ *
14
+ * @author Alex Goldring
15
+ * @copyright Company Named Limited (c) 2026
16
+ */
17
+ export function mipmap_filter_magic_kernel_cpu(output: Float32Array, output_width: number, output_height: number, source: Float32Array, source_width: number, source_height: number): void;
18
+ //# sourceMappingURL=mipmap_filter_magic_kernel_cpu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mipmap_filter_magic_kernel_cpu.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.js"],"names":[],"mappings":"AAmFA;;;;;;;;;;;;;;;GAeG;AACH,uDAVW,YAAY,gBACZ,MAAM,iBACN,MAAM,UACN,YAAY,gBACZ,MAAM,iBACN,MAAM,QAgBhB"}
@@ -0,0 +1,111 @@
1
+ import { MipmapKernelAxis } from "./MipmapKernelAxis.js";
2
+ import { mipmap_kernel_reduce } from "./mipmap_kernel_reduce.js";
3
+ import { mipmap_source_centre } from "./mipmap_source_centre.js";
4
+
5
+ /**
6
+ * The base Magic Kernel's support, in destination texels.
7
+ * @type {number}
8
+ */
9
+ const SUPPORT_RADIUS = 1.5;
10
+
11
+ /**
12
+ * @type {number}
13
+ */
14
+ const WEIGHT_SUM_THRESHOLD = Math.fround(0.00001);
15
+
16
+ /**
17
+ * The base Magic Kernel, in f32.
18
+ *
19
+ * @see "Solving the mystery of Magic Kernel Sharp" by John P. Costella, 2021. Eq. 27.
20
+ * @param {number} x an f32
21
+ * @returns {number} an f32
22
+ */
23
+ function magic_kernel(x) {
24
+ const ax = Math.abs(x);
25
+
26
+ if (ax <= 0.5) {
27
+ return Math.fround(0.75 - Math.fround(ax * ax));
28
+ } else if (ax <= 1.5) {
29
+ const t = Math.fround(1.5 - ax);
30
+
31
+ return Math.fround(Math.fround(0.5 * t) * t);
32
+ }
33
+
34
+ return 0;
35
+ }
36
+
37
+ /**
38
+ * @param {number} output_size
39
+ * @param {number} source_size
40
+ * @returns {MipmapKernelAxis}
41
+ */
42
+ function magic_kernel_axis(output_size, source_size) {
43
+ const stride = Math.max(1, Math.fround(source_size / output_size));
44
+ const radius = Math.fround(SUPPORT_RADIUS * stride);
45
+ const last = Math.fround(source_size - 1);
46
+
47
+ const axis = new MipmapKernelAxis(output_size, 2 * Math.ceil(radius) + 3);
48
+
49
+ let tap = 0;
50
+
51
+ for (let i = 0; i < output_size; i++) {
52
+ const centre = mipmap_source_centre(i, output_size, source_size);
53
+
54
+ const start = Math.max(Math.floor(Math.fround(centre - radius)), 0);
55
+ const end = Math.min(Math.ceil(Math.fround(centre + radius)), last);
56
+
57
+ axis.first[i] = tap;
58
+
59
+ for (let s = start; s <= end; s++) {
60
+ const distance = Math.fround(Math.abs(Math.fround(s - centre)) / stride);
61
+
62
+ if (distance >= SUPPORT_RADIUS) {
63
+ continue;
64
+ }
65
+
66
+ const weight = magic_kernel(distance);
67
+
68
+ if (weight === 0) {
69
+ continue;
70
+ }
71
+
72
+ axis.index[tap] = s;
73
+ axis.weight[tap] = weight;
74
+
75
+ tap++;
76
+ }
77
+
78
+ axis.count[i] = tap - axis.first[i];
79
+ }
80
+
81
+ return axis;
82
+ }
83
+
84
+ /**
85
+ * One pass of the base Magic Kernel reduction, the CPU twin of `mipmap_shader_code_magic_kernel`:
86
+ * each destination texel is the normalised sum of the source texels within 1.5 destination texels of
87
+ * its centre, weighed separably by the base Magic Kernel at their distance in destination texels, all
88
+ * in f32 as that shader computes it — see {@link mipmap_kernel_reduce}.
89
+ *
90
+ * @param {Float32Array} output RGBA, raster order: the fragment outputs, before any store
91
+ * @param {number} output_width
92
+ * @param {number} output_height
93
+ * @param {Float32Array} source RGBA, raster order: the level read, as the shader reads it
94
+ * @param {number} source_width
95
+ * @param {number} source_height
96
+ *
97
+ * @author Alex Goldring
98
+ * @copyright Company Named Limited (c) 2026
99
+ */
100
+ export function mipmap_filter_magic_kernel_cpu(
101
+ output, output_width, output_height,
102
+ source, source_width, source_height
103
+ ) {
104
+ mipmap_kernel_reduce(
105
+ output, output_width, output_height,
106
+ source, source_width,
107
+ magic_kernel_axis(output_width, source_width),
108
+ magic_kernel_axis(output_height, source_height),
109
+ WEIGHT_SUM_THRESHOLD
110
+ );
111
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * One pass of the Mitchell reduction, the CPU twin of `mipmap_shader_code_mitchell`; see
3
+ * {@link mipmap_cubic_filter_cpu}.
4
+ *
5
+ * @param {Float32Array} output RGBA, raster order: the fragment outputs, before any store
6
+ * @param {number} output_width
7
+ * @param {number} output_height
8
+ * @param {Float32Array} source RGBA, raster order: the level read, as the shader reads it
9
+ * @param {number} source_width
10
+ * @param {number} source_height
11
+ *
12
+ * @author Alex Goldring
13
+ * @copyright Company Named Limited (c) 2026
14
+ */
15
+ export function mipmap_filter_mitchell_cpu(output: Float32Array, output_width: number, output_height: number, source: Float32Array, source_width: number, source_height: number): void;
16
+ //# sourceMappingURL=mipmap_filter_mitchell_cpu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mipmap_filter_mitchell_cpu.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;GAaG;AACH,mDAVW,YAAY,gBACZ,MAAM,iBACN,MAAM,UACN,YAAY,gBACZ,MAAM,iBACN,MAAM,QAchB"}
@@ -0,0 +1,33 @@
1
+ import { cubic_filter_coefficients, mipmap_cubic_filter_cpu } from "./mipmap_cubic_filter_cpu.js";
2
+
3
+ /**
4
+ * The Mitchell-Netravali cubic, B = C = 1/3, each as an f32.
5
+ * @readonly
6
+ * @type {Float64Array}
7
+ */
8
+ const MITCHELL = cubic_filter_coefficients(Math.fround(1 / 3), Math.fround(1 / 3));
9
+
10
+ /**
11
+ * One pass of the Mitchell reduction, the CPU twin of `mipmap_shader_code_mitchell`; see
12
+ * {@link mipmap_cubic_filter_cpu}.
13
+ *
14
+ * @param {Float32Array} output RGBA, raster order: the fragment outputs, before any store
15
+ * @param {number} output_width
16
+ * @param {number} output_height
17
+ * @param {Float32Array} source RGBA, raster order: the level read, as the shader reads it
18
+ * @param {number} source_width
19
+ * @param {number} source_height
20
+ *
21
+ * @author Alex Goldring
22
+ * @copyright Company Named Limited (c) 2026
23
+ */
24
+ export function mipmap_filter_mitchell_cpu(
25
+ output, output_width, output_height,
26
+ source, source_width, source_height
27
+ ) {
28
+ mipmap_cubic_filter_cpu(
29
+ output, output_width, output_height,
30
+ source, source_width, source_height,
31
+ MITCHELL
32
+ );
33
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * One pass of the Magic Kernel Sharp 2021 reduction, the CPU twin of `mipmap_shader_code_mks`: each
3
+ * destination texel is the normalised sum of the source texels within 4.5 destination texels of its
4
+ * centre, weighed separably by the kernel at their distance in destination texels, all in f32 as that
5
+ * shader computes it — see {@link mipmap_kernel_reduce}.
6
+ *
7
+ * @param {Float32Array} output RGBA, raster order: the fragment outputs, before any store
8
+ * @param {number} output_width
9
+ * @param {number} output_height
10
+ * @param {Float32Array} source RGBA, raster order: the level read, as the shader reads it
11
+ * @param {number} source_width
12
+ * @param {number} source_height
13
+ *
14
+ * @author Alex Goldring
15
+ * @copyright Company Named Limited (c) 2026
16
+ */
17
+ export function mipmap_filter_mks_cpu(output: Float32Array, output_width: number, output_height: number, source: Float32Array, source_width: number, source_height: number): void;
18
+ //# sourceMappingURL=mipmap_filter_mks_cpu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mipmap_filter_mks_cpu.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.js"],"names":[],"mappings":"AAoGA;;;;;;;;;;;;;;;GAeG;AACH,8CAVW,YAAY,gBACZ,MAAM,iBACN,MAAM,UACN,YAAY,gBACZ,MAAM,iBACN,MAAM,QAgBhB"}
@@ -0,0 +1,128 @@
1
+ import { MipmapKernelAxis } from "./MipmapKernelAxis.js";
2
+ import { mipmap_kernel_reduce } from "./mipmap_kernel_reduce.js";
3
+ import { mipmap_source_centre } from "./mipmap_source_centre.js";
4
+
5
+ /**
6
+ * The kernel's support, in destination texels: taps at or beyond it are not read.
7
+ * @type {number}
8
+ */
9
+ const SUPPORT_RADIUS = 4.5;
10
+
11
+ /**
12
+ * @type {number}
13
+ */
14
+ const WEIGHT_SUM_THRESHOLD = Math.fround(1e-7);
15
+
16
+ /*
17
+ The kernel's coefficients as f32, each folded from its fraction first.
18
+ */
19
+ const C_0 = Math.fround(577 / 576);
20
+ const C_1 = Math.fround(239 / 144);
21
+ const C_144 = Math.fround(1 / 144);
22
+ const C_NEGATIVE_144 = Math.fround(-(1 / 144));
23
+ const C_NEGATIVE_1152 = Math.fround(-(1 / 1152));
24
+
25
+ /**
26
+ * Magic Kernel Sharp 2021, in f32, evaluated as `mipmap_shader_code_mks` writes it.
27
+ *
28
+ * @see "Solving the mystery of Magic Kernel Sharp" by John P. Costella, 2021
29
+ * @param {number} x an f32
30
+ * @returns {number} an f32
31
+ */
32
+ function mks_2021(x) {
33
+ const fround = Math.fround;
34
+
35
+ const ax = Math.abs(x);
36
+
37
+ if (ax <= 0.5) {
38
+ return fround(C_0 - fround(fround(C_1 * ax) * ax));
39
+ } else if (ax <= 1.5) {
40
+ return fround(C_144 * fround(fround(fround(fround(140 * ax) * ax) - fround(379 * ax)) + 239));
41
+ } else if (ax <= 2.5) {
42
+ return fround(C_NEGATIVE_144 * fround(fround(fround(fround(24 * ax) * ax) - fround(113 * ax)) + 130));
43
+ } else if (ax <= 3.5) {
44
+ return fround(C_144 * fround(fround(fround(fround(4 * ax) * ax) - fround(27 * ax)) + 45));
45
+ } else if (ax <= 4.5) {
46
+ const t = fround(fround(2 * ax) - 9);
47
+
48
+ return fround(fround(C_NEGATIVE_1152 * t) * t);
49
+ }
50
+
51
+ return 0;
52
+ }
53
+
54
+ /**
55
+ * @param {number} output_size
56
+ * @param {number} source_size
57
+ * @returns {MipmapKernelAxis}
58
+ */
59
+ function mks_axis(output_size, source_size) {
60
+ const stride = Math.max(1, Math.fround(source_size / output_size));
61
+ const radius = Math.fround(SUPPORT_RADIUS * stride);
62
+ const last = Math.fround(source_size - 1);
63
+
64
+ const axis = new MipmapKernelAxis(output_size, 2 * Math.ceil(radius) + 3);
65
+
66
+ let tap = 0;
67
+
68
+ for (let i = 0; i < output_size; i++) {
69
+ const centre = mipmap_source_centre(i, output_size, source_size);
70
+
71
+ const start = Math.max(Math.floor(Math.fround(centre - radius)), 0);
72
+ const end = Math.min(Math.ceil(Math.fround(centre + radius)), last);
73
+
74
+ axis.first[i] = tap;
75
+
76
+ for (let s = start; s <= end; s++) {
77
+ const distance = Math.fround(Math.abs(Math.fround(s - centre)) / stride);
78
+
79
+ if (distance >= SUPPORT_RADIUS) {
80
+ continue;
81
+ }
82
+
83
+ const weight = mks_2021(distance);
84
+
85
+ if (weight === 0) {
86
+ continue;
87
+ }
88
+
89
+ axis.index[tap] = s;
90
+ axis.weight[tap] = weight;
91
+
92
+ tap++;
93
+ }
94
+
95
+ axis.count[i] = tap - axis.first[i];
96
+ }
97
+
98
+ return axis;
99
+ }
100
+
101
+ /**
102
+ * One pass of the Magic Kernel Sharp 2021 reduction, the CPU twin of `mipmap_shader_code_mks`: each
103
+ * destination texel is the normalised sum of the source texels within 4.5 destination texels of its
104
+ * centre, weighed separably by the kernel at their distance in destination texels, all in f32 as that
105
+ * shader computes it — see {@link mipmap_kernel_reduce}.
106
+ *
107
+ * @param {Float32Array} output RGBA, raster order: the fragment outputs, before any store
108
+ * @param {number} output_width
109
+ * @param {number} output_height
110
+ * @param {Float32Array} source RGBA, raster order: the level read, as the shader reads it
111
+ * @param {number} source_width
112
+ * @param {number} source_height
113
+ *
114
+ * @author Alex Goldring
115
+ * @copyright Company Named Limited (c) 2026
116
+ */
117
+ export function mipmap_filter_mks_cpu(
118
+ output, output_width, output_height,
119
+ source, source_width, source_height
120
+ ) {
121
+ mipmap_kernel_reduce(
122
+ output, output_width, output_height,
123
+ source, source_width,
124
+ mks_axis(output_width, source_width),
125
+ mks_axis(output_height, source_height),
126
+ WEIGHT_SUM_THRESHOLD
127
+ );
128
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * One pass of Wronski's 2021 processing-aware reduction, the CPU twin of
3
+ * `mipmap_shader_code_wronski2021`: each destination texel is the normalised sum of 6x6 bilinear
4
+ * samples of the source (see {@link mipmap_bilinear_sample}) at the taps of
5
+ * {@link WRONSKI2021_TAP_OFFSETS} around its centre, weighed by the products of
6
+ * {@link WRONSKI2021_TAP_WEIGHTS}, in f32 as that shader computes it: row by row, each channel's sum
7
+ * takes `fround(sample * weight)` rounded to f32, and is divided by the weight sum at the end.
8
+ *
9
+ * @see https://bartwronski.com/2021/07/20/processing-aware-image-filtering-compensating-for-the-upsampling/
10
+ * @param {Float32Array} output RGBA, raster order: the fragment outputs, before any store
11
+ * @param {number} output_width
12
+ * @param {number} output_height
13
+ * @param {Float32Array} source RGBA, raster order: the level read, as the shader reads it
14
+ * @param {number} source_width
15
+ * @param {number} source_height
16
+ *
17
+ * @author Alex Goldring
18
+ * @copyright Company Named Limited (c) 2026
19
+ */
20
+ export function mipmap_filter_wronski2021_cpu(output: Float32Array, output_width: number, output_height: number, source: Float32Array, source_width: number, source_height: number): void;
21
+ //# sourceMappingURL=mipmap_filter_wronski2021_cpu.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mipmap_filter_wronski2021_cpu.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.js"],"names":[],"mappings":"AAkGA;;;;;;;;;;;;;;;;;;GAkBG;AACH,sDAVW,YAAY,gBACZ,MAAM,iBACN,MAAM,UACN,YAAY,gBACZ,MAAM,iBACN,MAAM,QAwDhB"}