@woosh/meep-engine 3.78.4 → 3.80.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (421) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +1 -1
  3. package/package.json +1 -1
  4. package/src/engine/asset/GameAssetType.d.ts +2 -0
  5. package/src/engine/asset/GameAssetType.js +10 -0
  6. package/src/engine/asset/guessAssetType.d.ts.map +1 -1
  7. package/src/engine/asset/guessAssetType.js +4 -0
  8. package/src/engine/asset/load_model_scene_bundle.d.ts +1 -1
  9. package/src/engine/asset/load_model_scene_bundle.js +2 -2
  10. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.d.ts +42 -0
  11. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.d.ts.map +1 -0
  12. package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.js +83 -0
  13. package/src/engine/asset/loaders/MTFTextureAssetLoader.d.ts +36 -0
  14. package/src/engine/asset/loaders/MTFTextureAssetLoader.d.ts.map +1 -0
  15. package/src/engine/asset/loaders/MTFTextureAssetLoader.js +78 -0
  16. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.d.ts +6 -1
  17. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.d.ts.map +1 -1
  18. package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +8 -2
  19. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  20. package/src/format/image/webp/vp8/VP8BoolDecoder.d.ts +45 -0
  21. package/src/format/image/webp/vp8/VP8BoolDecoder.d.ts.map +1 -0
  22. package/src/format/image/webp/vp8/VP8BoolDecoder.js +137 -0
  23. package/src/format/image/webp/vp8/vp8_decode.d.ts +21 -0
  24. package/src/format/image/webp/vp8/vp8_decode.d.ts.map +1 -0
  25. package/src/format/image/webp/vp8/vp8_decode.js +756 -0
  26. package/src/format/image/webp/vp8/vp8_loop_filter.d.ts +31 -0
  27. package/src/format/image/webp/vp8/vp8_loop_filter.d.ts.map +1 -0
  28. package/src/format/image/webp/vp8/vp8_loop_filter.js +189 -0
  29. package/src/format/image/webp/vp8/vp8_predict.d.ts +48 -0
  30. package/src/format/image/webp/vp8/vp8_predict.d.ts.map +1 -0
  31. package/src/format/image/webp/vp8/vp8_predict.js +290 -0
  32. package/src/format/image/webp/vp8/vp8_tables.d.ts +34 -0
  33. package/src/format/image/webp/vp8/vp8_tables.d.ts.map +1 -0
  34. package/src/format/image/webp/vp8/vp8_tables.js +350 -0
  35. package/src/format/image/webp/vp8/vp8_transform.d.ts +22 -0
  36. package/src/format/image/webp/vp8/vp8_transform.d.ts.map +1 -0
  37. package/src/format/image/webp/vp8/vp8_transform.js +114 -0
  38. package/src/format/image/webp/vp8/vp8_yuv_to_rgba.d.ts +23 -0
  39. package/src/format/image/webp/vp8/vp8_yuv_to_rgba.d.ts.map +1 -0
  40. package/src/format/image/webp/vp8/vp8_yuv_to_rgba.js +133 -0
  41. package/src/format/image/webp/vp8l/VP8LBitReader.d.ts +47 -0
  42. package/src/format/image/webp/vp8l/VP8LBitReader.d.ts.map +1 -0
  43. package/src/format/image/webp/vp8l/VP8LBitReader.js +84 -0
  44. package/src/format/image/webp/vp8l/VP8LPrefixCode.d.ts +27 -0
  45. package/src/format/image/webp/vp8l/VP8LPrefixCode.d.ts.map +1 -0
  46. package/src/format/image/webp/vp8l/VP8LPrefixCode.js +184 -0
  47. package/src/format/image/webp/vp8l/vp8l_decode.d.ts +28 -0
  48. package/src/format/image/webp/vp8l/vp8l_decode.d.ts.map +1 -0
  49. package/src/format/image/webp/vp8l/vp8l_decode.js +261 -0
  50. package/src/format/image/webp/vp8l/vp8l_distance.d.ts +22 -0
  51. package/src/format/image/webp/vp8l/vp8l_distance.d.ts.map +1 -0
  52. package/src/format/image/webp/vp8l/vp8l_distance.js +62 -0
  53. package/src/format/image/webp/vp8l/vp8l_inverse_transforms.d.ts +50 -0
  54. package/src/format/image/webp/vp8l/vp8l_inverse_transforms.d.ts.map +1 -0
  55. package/src/format/image/webp/vp8l/vp8l_inverse_transforms.js +267 -0
  56. package/src/format/image/webp/vp8l/vp8l_read_prefix_code.d.ts +14 -0
  57. package/src/format/image/webp/vp8l/vp8l_read_prefix_code.d.ts.map +1 -0
  58. package/src/format/image/webp/vp8l/vp8l_read_prefix_code.js +99 -0
  59. package/src/format/image/webp/webp_decode.d.ts +23 -0
  60. package/src/format/image/webp/webp_decode.d.ts.map +1 -0
  61. package/src/format/image/webp/webp_decode.js +179 -0
  62. package/src/format/image/webp/webp_decode_alpha.d.ts +18 -0
  63. package/src/format/image/webp/webp_decode_alpha.d.ts.map +1 -0
  64. package/src/format/image/webp/webp_decode_alpha.js +84 -0
  65. package/src/format/texture/{basis → astc}/astc_block.d.ts +41 -0
  66. package/src/format/texture/astc/astc_block.d.ts.map +1 -0
  67. package/src/format/texture/{basis → astc}/astc_block.js +284 -164
  68. package/src/format/texture/astc/astc_decode_block.d.ts +68 -0
  69. package/src/format/texture/astc/astc_decode_block.d.ts.map +1 -0
  70. package/src/format/texture/astc/astc_decode_block.js +1119 -0
  71. package/src/format/texture/astc/astc_encode_block_4x4.d.ts +32 -0
  72. package/src/format/texture/astc/astc_encode_block_4x4.d.ts.map +1 -0
  73. package/src/format/texture/astc/astc_encode_block_4x4.js +181 -0
  74. package/src/format/texture/astc/astc_encode_block_4x4_rgba.d.ts +32 -0
  75. package/src/format/texture/astc/astc_encode_block_4x4_rgba.d.ts.map +1 -0
  76. package/src/format/texture/astc/astc_encode_block_4x4_rgba.js +337 -0
  77. package/src/format/texture/astc/astc_integer_sequence.d.ts.map +1 -0
  78. package/src/format/texture/{basis → astc}/astc_integer_sequence.js +251 -251
  79. package/src/format/texture/astc/astc_partition.d.ts.map +1 -0
  80. package/src/format/texture/{basis → astc}/astc_partition.js +199 -199
  81. package/src/format/texture/basis/transcode/etc1s_to_astc.js +329 -329
  82. package/src/format/texture/basis/transcode/etc1s_to_etc2.d.ts.map +1 -1
  83. package/src/format/texture/basis/transcode/etc1s_to_etc2.js +305 -332
  84. package/src/format/texture/basis/transcode/fit_endpoints.d.ts.map +1 -1
  85. package/src/format/texture/basis/transcode/fit_endpoints.js +14 -27
  86. package/src/format/texture/basis/uastc/uastc_bc7_tables.d.ts +66 -0
  87. package/src/format/texture/basis/uastc/uastc_bc7_tables.d.ts.map +1 -0
  88. package/src/format/texture/basis/uastc/uastc_bc7_tables.js +148 -0
  89. package/src/format/texture/basis/uastc/uastc_decode_block.js +463 -463
  90. package/src/format/texture/basis/uastc/uastc_to_astc.js +421 -421
  91. package/src/format/texture/basis/uastc/uastc_to_bc5.d.ts +1 -6
  92. package/src/format/texture/basis/uastc/uastc_to_bc5.d.ts.map +1 -1
  93. package/src/format/texture/basis/uastc/uastc_to_bc5.js +48 -115
  94. package/src/format/texture/basis/uastc/uastc_to_bc7.d.ts.map +1 -1
  95. package/src/format/texture/basis/uastc/uastc_to_bc7.js +604 -602
  96. package/src/format/texture/bc/bc1_decode_block.d.ts +19 -0
  97. package/src/format/texture/bc/bc1_decode_block.d.ts.map +1 -0
  98. package/src/format/texture/bc/bc1_decode_block.js +22 -0
  99. package/src/format/texture/bc/bc1_decode_colors.d.ts +27 -0
  100. package/src/format/texture/bc/bc1_decode_colors.d.ts.map +1 -0
  101. package/src/format/texture/bc/bc1_decode_colors.js +100 -0
  102. package/src/format/texture/bc/bc2_decode_block.d.ts +18 -0
  103. package/src/format/texture/bc/bc2_decode_block.d.ts.map +1 -0
  104. package/src/format/texture/bc/bc2_decode_block.js +28 -0
  105. package/src/format/texture/bc/bc3_decode_block.d.ts +18 -0
  106. package/src/format/texture/bc/bc3_decode_block.d.ts.map +1 -0
  107. package/src/format/texture/bc/bc3_decode_block.js +23 -0
  108. package/src/format/texture/bc/bc4_decode_channel.d.ts +56 -0
  109. package/src/format/texture/bc/bc4_decode_channel.d.ts.map +1 -0
  110. package/src/format/texture/bc/bc4_decode_channel.js +138 -0
  111. package/src/format/texture/bc/bc4_encode_block.d.ts +43 -0
  112. package/src/format/texture/bc/bc4_encode_block.d.ts.map +1 -0
  113. package/src/format/texture/bc/bc4_encode_block.js +324 -0
  114. package/src/format/texture/bc/bc4_snorm_decode_block.d.ts +18 -0
  115. package/src/format/texture/bc/bc4_snorm_decode_block.d.ts.map +1 -0
  116. package/src/format/texture/bc/bc4_snorm_decode_block.js +27 -0
  117. package/src/format/texture/bc/bc4_unorm_decode_block.d.ts +17 -0
  118. package/src/format/texture/bc/bc4_unorm_decode_block.d.ts.map +1 -0
  119. package/src/format/texture/bc/bc4_unorm_decode_block.js +26 -0
  120. package/src/format/texture/bc/bc5_encode_block.d.ts +25 -0
  121. package/src/format/texture/bc/bc5_encode_block.d.ts.map +1 -0
  122. package/src/format/texture/bc/bc5_encode_block.js +34 -0
  123. package/src/format/texture/bc/bc5_snorm_decode_block.d.ts +18 -0
  124. package/src/format/texture/bc/bc5_snorm_decode_block.d.ts.map +1 -0
  125. package/src/format/texture/bc/bc5_snorm_decode_block.js +27 -0
  126. package/src/format/texture/bc/bc5_unorm_decode_block.d.ts +17 -0
  127. package/src/format/texture/bc/bc5_unorm_decode_block.d.ts.map +1 -0
  128. package/src/format/texture/bc/bc5_unorm_decode_block.js +26 -0
  129. package/src/format/texture/bc/bc6h_decode_texels.d.ts +30 -0
  130. package/src/format/texture/bc/bc6h_decode_texels.d.ts.map +1 -0
  131. package/src/format/texture/bc/bc6h_decode_texels.js +430 -0
  132. package/src/format/texture/bc/bc6h_sfloat_decode_block.d.ts +20 -0
  133. package/src/format/texture/bc/bc6h_sfloat_decode_block.d.ts.map +1 -0
  134. package/src/format/texture/bc/bc6h_sfloat_decode_block.js +23 -0
  135. package/src/format/texture/bc/bc6h_ufloat_decode_block.d.ts +18 -0
  136. package/src/format/texture/bc/bc6h_ufloat_decode_block.d.ts.map +1 -0
  137. package/src/format/texture/bc/bc6h_ufloat_decode_block.js +21 -0
  138. package/src/format/texture/bc/bc7_decode_block.d.ts +30 -0
  139. package/src/format/texture/bc/bc7_decode_block.d.ts.map +1 -0
  140. package/src/format/texture/bc/bc7_decode_block.js +232 -0
  141. package/src/format/texture/bc/bc7_encode_block.d.ts +39 -0
  142. package/src/format/texture/bc/bc7_encode_block.d.ts.map +1 -0
  143. package/src/format/texture/bc/bc7_encode_block.js +423 -0
  144. package/src/format/texture/bc/bc7_tables.d.ts +126 -0
  145. package/src/format/texture/bc/bc7_tables.d.ts.map +1 -0
  146. package/src/format/texture/{basis/uastc → bc}/bc7_tables.js +225 -276
  147. package/src/format/texture/bc/bc7_write_block.d.ts +65 -0
  148. package/src/format/texture/bc/bc7_write_block.d.ts.map +1 -0
  149. package/src/format/texture/{basis/uastc → bc}/bc7_write_block.js +185 -227
  150. package/src/format/texture/etc/eac_decode_channel.d.ts +50 -0
  151. package/src/format/texture/etc/eac_decode_channel.d.ts.map +1 -0
  152. package/src/format/texture/etc/eac_decode_channel.js +142 -0
  153. package/src/format/texture/etc/eac_modifiers.d.ts +15 -0
  154. package/src/format/texture/etc/eac_modifiers.d.ts.map +1 -0
  155. package/src/format/texture/etc/eac_modifiers.js +31 -0
  156. package/src/format/texture/etc/eac_r11_snorm_decode_block.d.ts +21 -0
  157. package/src/format/texture/etc/eac_r11_snorm_decode_block.d.ts.map +1 -0
  158. package/src/format/texture/etc/eac_r11_snorm_decode_block.js +30 -0
  159. package/src/format/texture/etc/eac_r11_unorm_decode_block.d.ts +20 -0
  160. package/src/format/texture/etc/eac_r11_unorm_decode_block.d.ts.map +1 -0
  161. package/src/format/texture/etc/eac_r11_unorm_decode_block.js +29 -0
  162. package/src/format/texture/etc/eac_rg11_snorm_decode_block.d.ts +19 -0
  163. package/src/format/texture/etc/eac_rg11_snorm_decode_block.d.ts.map +1 -0
  164. package/src/format/texture/etc/eac_rg11_snorm_decode_block.js +28 -0
  165. package/src/format/texture/etc/eac_rg11_unorm_decode_block.d.ts +19 -0
  166. package/src/format/texture/etc/eac_rg11_unorm_decode_block.d.ts.map +1 -0
  167. package/src/format/texture/etc/eac_rg11_unorm_decode_block.js +28 -0
  168. package/src/format/texture/etc/etc2_decode_color.d.ts +25 -0
  169. package/src/format/texture/etc/etc2_decode_color.d.ts.map +1 -0
  170. package/src/format/texture/etc/etc2_decode_color.js +370 -0
  171. package/src/format/texture/etc/etc2_rgb8_decode_block.d.ts +18 -0
  172. package/src/format/texture/etc/etc2_rgb8_decode_block.d.ts.map +1 -0
  173. package/src/format/texture/etc/etc2_rgb8_decode_block.js +21 -0
  174. package/src/format/texture/etc/etc2_rgb8a1_decode_block.d.ts +21 -0
  175. package/src/format/texture/etc/etc2_rgb8a1_decode_block.d.ts.map +1 -0
  176. package/src/format/texture/etc/etc2_rgb8a1_decode_block.js +24 -0
  177. package/src/format/texture/etc/etc2_rgba8_decode_block.d.ts +18 -0
  178. package/src/format/texture/etc/etc2_rgba8_decode_block.d.ts.map +1 -0
  179. package/src/format/texture/etc/etc2_rgba8_decode_block.js +24 -0
  180. package/src/format/texture/fit/fit_line.d.ts +23 -0
  181. package/src/format/texture/fit/fit_line.d.ts.map +1 -0
  182. package/src/format/texture/fit/fit_line.js +123 -0
  183. package/src/format/texture/fit/fit_line_refine.d.ts +21 -0
  184. package/src/format/texture/fit/fit_line_refine.d.ts.map +1 -0
  185. package/src/format/texture/fit/fit_line_refine.js +69 -0
  186. package/src/format/texture/fit/fit_line_solve.d.ts +23 -0
  187. package/src/format/texture/fit/fit_line_solve.d.ts.map +1 -0
  188. package/src/format/texture/fit/fit_line_solve.js +71 -0
  189. package/src/format/texture/texel_decode_image.d.ts +44 -0
  190. package/src/format/texture/texel_decode_image.d.ts.map +1 -0
  191. package/src/format/texture/texel_decode_image.js +251 -0
  192. package/src/format/texture/texel_encode_image.d.ts +77 -0
  193. package/src/format/texture/texel_encode_image.d.ts.map +1 -0
  194. package/src/format/texture/texel_encode_image.js +187 -0
  195. package/src/shade/renderer/ShadeIndirectLightingMode.js +2 -0
  196. package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
  197. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +1 -1
  198. package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
  199. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts +33 -0
  200. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts.map +1 -0
  201. package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.js +196 -0
  202. package/src/shade/renderer/animation/SkinSerializationAdapter.d.ts +25 -0
  203. package/src/shade/renderer/animation/SkinSerializationAdapter.d.ts.map +1 -0
  204. package/src/shade/renderer/animation/SkinSerializationAdapter.js +85 -0
  205. package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -1
  206. package/src/shade/renderer/hair/GPUHairSystem.js +16 -7
  207. package/src/shade/renderer/hair/HAIR.d.ts +5 -3
  208. package/src/shade/renderer/hair/HAIR.d.ts.map +1 -1
  209. package/src/shade/renderer/hair/HAIR.js +6 -4
  210. package/src/shade/renderer/hair/hair_shadow_draw.d.ts +10 -10
  211. package/src/shade/renderer/hair/hair_shadow_draw.d.ts.map +1 -1
  212. package/src/shade/renderer/hair/hair_shadow_draw.js +21 -17
  213. package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -1
  214. package/src/shade/renderer/hair/shader_hair_cull.js +6 -2
  215. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts +5 -4
  216. package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts.map +1 -1
  217. package/src/shade/renderer/hair/shader_hair_shadow_list.js +10 -12
  218. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.d.ts +38 -0
  219. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.d.ts.map +1 -0
  220. package/src/shade/renderer/loader/SceneNodeSerializationAdapter.js +198 -0
  221. package/src/shade/renderer/loader/mtf/MTFTexture.d.ts +88 -0
  222. package/src/shade/renderer/loader/mtf/MTFTexture.d.ts.map +1 -0
  223. package/src/shade/renderer/loader/mtf/MTFTexture.js +159 -0
  224. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.d.ts +30 -0
  225. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.d.ts.map +1 -0
  226. package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.js +136 -0
  227. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.d.ts +7 -0
  228. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.d.ts.map +1 -0
  229. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.js +6 -0
  230. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts +8 -0
  231. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts.map +1 -0
  232. package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.js +7 -0
  233. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.d.ts +7 -0
  234. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.d.ts.map +1 -0
  235. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.js +6 -0
  236. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.d.ts +7 -0
  237. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.d.ts.map +1 -0
  238. package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.js +6 -0
  239. package/src/shade/renderer/loader/mtf/load_mtf.d.ts +41 -0
  240. package/src/shade/renderer/loader/mtf/load_mtf.d.ts.map +1 -0
  241. package/src/shade/renderer/loader/mtf/load_mtf.js +73 -0
  242. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.d.ts +19 -0
  243. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.d.ts.map +1 -0
  244. package/src/shade/renderer/loader/mtf/mtf_bundle_textures.js +57 -0
  245. package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts +10 -0
  246. package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts.map +1 -0
  247. package/src/shade/renderer/loader/mtf/mtf_encode_texture.js +152 -0
  248. package/src/shade/renderer/loader/mtf/mtf_export.d.ts +45 -0
  249. package/src/shade/renderer/loader/mtf/mtf_export.d.ts.map +1 -0
  250. package/src/shade/renderer/loader/mtf/mtf_export.js +161 -0
  251. package/src/shade/renderer/loader/mtf/mtf_is_texture.d.ts +9 -0
  252. package/src/shade/renderer/loader/mtf/mtf_is_texture.d.ts.map +1 -0
  253. package/src/shade/renderer/loader/mtf/mtf_is_texture.js +12 -0
  254. package/src/shade/renderer/loader/mtf/mtf_read_collection.d.ts +24 -0
  255. package/src/shade/renderer/loader/mtf/mtf_read_collection.d.ts.map +1 -0
  256. package/src/shade/renderer/loader/mtf/mtf_read_collection.js +37 -0
  257. package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts +27 -0
  258. package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts.map +1 -0
  259. package/src/shade/renderer/loader/mtf/mtf_read_scene.js +121 -0
  260. package/src/shade/renderer/loader/mtf/mtf_read_textures.d.ts +18 -0
  261. package/src/shade/renderer/loader/mtf/mtf_read_textures.d.ts.map +1 -0
  262. package/src/shade/renderer/loader/mtf/mtf_read_textures.js +51 -0
  263. package/src/shade/renderer/loader/mtf/mtf_replace_textures.d.ts +19 -0
  264. package/src/shade/renderer/loader/mtf/mtf_replace_textures.d.ts.map +1 -0
  265. package/src/shade/renderer/loader/mtf/mtf_replace_textures.js +60 -0
  266. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.d.ts +21 -0
  267. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.d.ts.map +1 -0
  268. package/src/shade/renderer/loader/mtf/mtf_resolve_uri.js +98 -0
  269. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts +25 -0
  270. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts.map +1 -0
  271. package/src/shade/renderer/loader/mtf/mtf_serialization_registry.js +51 -0
  272. package/src/shade/renderer/loader/mtf/mtf_texture_read.d.ts +20 -0
  273. package/src/shade/renderer/loader/mtf/mtf_texture_read.d.ts.map +1 -0
  274. package/src/shade/renderer/loader/mtf/mtf_texture_read.js +80 -0
  275. package/src/shade/renderer/loader/mtf/mtf_texture_select.d.ts +24 -0
  276. package/src/shade/renderer/loader/mtf/mtf_texture_select.d.ts.map +1 -0
  277. package/src/shade/renderer/loader/mtf/mtf_texture_select.js +42 -0
  278. package/src/shade/renderer/loader/mtf/mtf_texture_write.d.ts +31 -0
  279. package/src/shade/renderer/loader/mtf/mtf_texture_write.d.ts.map +1 -0
  280. package/src/shade/renderer/loader/mtf/mtf_texture_write.js +87 -0
  281. package/src/shade/renderer/loader/mtf/mtf_write.d.ts +36 -0
  282. package/src/shade/renderer/loader/mtf/mtf_write.d.ts.map +1 -0
  283. package/src/shade/renderer/loader/mtf/mtf_write.js +137 -0
  284. package/src/shade/renderer/loader/mtf/mtf_write_collection.d.ts +23 -0
  285. package/src/shade/renderer/loader/mtf/mtf_write_collection.d.ts.map +1 -0
  286. package/src/shade/renderer/loader/mtf/mtf_write_collection.js +36 -0
  287. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.d.ts +39 -0
  288. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.d.ts.map +1 -0
  289. package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.js +207 -0
  290. package/src/shade/renderer/scene/optimization/source_to_sampler2d.d.ts.map +1 -1
  291. package/src/shade/renderer/scene/optimization/source_to_sampler2d.js +3 -1
  292. package/src/shade/renderer/scene/serialization/STANDARD_MATERIAL_SERIALIZED_BYTE_SIZE.d.ts +5 -5
  293. package/src/shade/renderer/scene/serialization/STANDARD_MATERIAL_SERIALIZED_BYTE_SIZE.js +5 -5
  294. package/src/shade/renderer/scene/serialization/deserialize_scene.d.ts.map +1 -1
  295. package/src/shade/renderer/scene/serialization/deserialize_scene.js +491 -528
  296. package/src/shade/renderer/scene/serialization/serialize_scene.d.ts +0 -10
  297. package/src/shade/renderer/scene/serialization/serialize_scene.d.ts.map +1 -1
  298. package/src/shade/renderer/scene/serialization/serialize_scene.js +15 -71
  299. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.d.ts +13 -0
  300. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.d.ts.map +1 -0
  301. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.js +39 -0
  302. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts +3 -2
  303. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
  304. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +6 -21
  305. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.d.ts +42 -0
  306. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.d.ts.map +1 -0
  307. package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.js +612 -0
  308. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +5 -4
  309. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
  310. package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +8 -25
  311. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
  312. package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +3 -19
  313. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +14 -4
  314. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -1
  315. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +65 -54
  316. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +2 -2
  317. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
  318. package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +5 -22
  319. package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +1 -1
  320. package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.d.ts +27 -0
  321. package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.d.ts.map +1 -0
  322. package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.js +147 -0
  323. package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.d.ts +3 -4
  324. package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.d.ts.map +1 -1
  325. package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.js +6 -13
  326. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.d.ts +13 -0
  327. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.d.ts.map +1 -0
  328. package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.js +66 -0
  329. package/src/shade/renderer/texture/encode/texture_encode.d.ts +28 -1
  330. package/src/shade/renderer/texture/encode/texture_encode.d.ts.map +1 -1
  331. package/src/shade/renderer/texture/encode/texture_encode.js +202 -168
  332. package/src/shade/renderer/texture/encode/texture_encode_shader.d.ts +13 -1
  333. package/src/shade/renderer/texture/encode/texture_encode_shader.d.ts.map +1 -1
  334. package/src/shade/renderer/texture/encode/texture_encode_shader.js +146 -108
  335. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.d.ts +11 -0
  336. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.d.ts.map +1 -0
  337. package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.js +14 -0
  338. package/src/shade/renderer/texture/format/texture_formats_to_build.d.ts +20 -0
  339. package/src/shade/renderer/texture/format/texture_formats_to_build.d.ts.map +1 -0
  340. package/src/shade/renderer/texture/format/texture_formats_to_build.js +98 -0
  341. package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.d.ts.map +1 -1
  342. package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +4 -23
  343. package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.d.ts +53 -0
  344. package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.d.ts.map +1 -0
  345. package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.js +76 -0
  346. package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.d.ts +40 -0
  347. package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.d.ts.map +1 -0
  348. package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.js +43 -0
  349. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.d.ts +17 -0
  350. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.d.ts.map +1 -0
  351. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.js +29 -0
  352. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.d.ts +21 -0
  353. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.d.ts.map +1 -0
  354. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.js +91 -0
  355. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.d.ts +32 -0
  356. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.d.ts.map +1 -0
  357. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.js +216 -0
  358. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.d.ts +30 -0
  359. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.d.ts.map +1 -0
  360. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.js +134 -0
  361. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.d.ts +16 -0
  362. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.d.ts.map +1 -0
  363. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.js +33 -0
  364. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.d.ts +18 -0
  365. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.d.ts.map +1 -0
  366. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.js +71 -0
  367. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.d.ts +20 -0
  368. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.d.ts.map +1 -0
  369. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.js +57 -0
  370. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.d.ts +18 -0
  371. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.d.ts.map +1 -0
  372. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.js +111 -0
  373. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.d.ts +16 -0
  374. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.d.ts.map +1 -0
  375. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.js +33 -0
  376. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.d.ts +18 -0
  377. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.d.ts.map +1 -0
  378. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.js +128 -0
  379. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.d.ts +21 -0
  380. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.d.ts.map +1 -0
  381. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.js +169 -0
  382. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.d.ts +21 -0
  383. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.d.ts.map +1 -0
  384. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.js +119 -0
  385. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.d.ts +16 -0
  386. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.d.ts.map +1 -0
  387. package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.js +19 -0
  388. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.d.ts +24 -0
  389. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.d.ts.map +1 -0
  390. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.js +41 -0
  391. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.d.ts +24 -0
  392. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.d.ts.map +1 -0
  393. package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.js +140 -0
  394. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.d.ts +21 -0
  395. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.d.ts.map +1 -0
  396. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.js +35 -0
  397. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.d.ts +19 -0
  398. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.d.ts.map +1 -0
  399. package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.js +27 -0
  400. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_catmull_rom.js +4 -4
  401. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.d.ts +13 -0
  402. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.d.ts.map +1 -1
  403. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.js +54 -4
  404. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mitchell.js +4 -4
  405. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mks.d.ts.map +1 -1
  406. package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mks.js +9 -13
  407. package/src/shade/renderer/texture/texture_block_encodings.d.ts +33 -0
  408. package/src/shade/renderer/texture/texture_block_encodings.d.ts.map +1 -0
  409. package/src/shade/renderer/texture/texture_block_encodings.js +89 -0
  410. package/src/shade/renderer/texture/texture_role_image_quality.d.ts +10 -0
  411. package/src/shade/renderer/texture/texture_role_image_quality.d.ts.map +1 -0
  412. package/src/shade/renderer/texture/texture_role_image_quality.js +29 -0
  413. package/src/format/texture/basis/astc_block.d.ts.map +0 -1
  414. package/src/format/texture/basis/astc_integer_sequence.d.ts.map +0 -1
  415. package/src/format/texture/basis/astc_partition.d.ts.map +0 -1
  416. package/src/format/texture/basis/uastc/bc7_tables.d.ts +0 -111
  417. package/src/format/texture/basis/uastc/bc7_tables.d.ts.map +0 -1
  418. package/src/format/texture/basis/uastc/bc7_write_block.d.ts +0 -124
  419. package/src/format/texture/basis/uastc/bc7_write_block.d.ts.map +0 -1
  420. /package/src/format/texture/{basis → astc}/astc_integer_sequence.d.ts +0 -0
  421. /package/src/format/texture/{basis → astc}/astc_partition.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"texels_rgba8unorm_to_f32.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.js"],"names":[],"mappings":"AAWA;;;;;;;;;;GAUG;AACH,iDAPW,YAAY,SACZ,UAAU,UACV,MAAM,QAShB;AA1BD;;;;GAIG;AACH,gCAFU,YAAY,CAEiC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * What a shader reads from each byte of an `rgba8unorm` texel: `byte / 255`, the nearest f32.
3
+ * @readonly
4
+ * @type {Float32Array}
5
+ */
6
+ export const RGBA8UNORM_TO_F32 = new Float32Array(256);
7
+
8
+ for (let byte = 0; byte < 256; byte++) {
9
+ RGBA8UNORM_TO_F32[byte] = byte / 255;
10
+ }
11
+
12
+ /**
13
+ * Read `rgba8unorm` texels as a shader reads them through a view of that format: each channel
14
+ * `byte / 255`, the nearest f32.
15
+ *
16
+ * @param {Float32Array} output written from index 0
17
+ * @param {Uint8Array} input
18
+ * @param {number} length values to convert, four a texel
19
+ *
20
+ * @author Alex Goldring
21
+ * @copyright Company Named Limited (c) 2026
22
+ */
23
+ export function texels_rgba8unorm_to_f32(output, input, length) {
24
+ for (let i = 0; i < length; i++) {
25
+ output[i] = RGBA8UNORM_TO_F32[input[i]];
26
+ }
27
+ }
@@ -30,9 +30,9 @@ fn main(
30
30
  let src_center = uv_to_texel_coordinate(uv, source_dim);
31
31
 
32
32
  // 3. Determine Kernel Radius
33
- // Mitchell filter is defined on range [-2, 2].
33
+ // Catmull-Rom filter is defined on range [-2, 2], in output texels.
34
34
  // We must stretch this range by the stride to cover the correct area.
35
- let radius = 1.0 * stride;
35
+ let radius = 2.0 * stride;
36
36
 
37
37
  // 4. Calculate Bounds (Clamped to texture dimensions)
38
38
  // We clamp the loop range here so we don't need 'if' checks inside the loop.
@@ -51,7 +51,7 @@ fn main(
51
51
 
52
52
  let dy_norm = dy / stride.y;
53
53
 
54
- let weight_y = filter_catmullrom(dy_norm * 2.0);
54
+ let weight_y = filter_catmullrom(dy_norm);
55
55
 
56
56
  for (var x = start.x; x <= end.x; x++) {
57
57
 
@@ -59,7 +59,7 @@ fn main(
59
59
 
60
60
  let dx_norm = dx / stride.x;
61
61
 
62
- let weight_x = filter_catmullrom(dx_norm * 2.0);
62
+ let weight_x = filter_catmullrom(dx_norm);
63
63
 
64
64
  let weight = (weight_x * weight_y);
65
65
 
@@ -1,3 +1,16 @@
1
+ /**
2
+ * The linear reduction: each output texel is the mean of the source over the texel's footprint.
3
+ * Along an axis, output texel `i` of `D` covers `[i * S / D, (i + 1) * S / D)` of a source `S` texels
4
+ * long, and each source texel weighs the share of that footprint it covers; the 2D weight is the
5
+ * product of the two axes'. A source twice the size gives the average of a 2x2 block; an odd one,
6
+ * three texels a side with the outer two shared with the neighbours, so every source texel counts
7
+ * toward the level below and the level keeps its mean.
8
+ *
9
+ * Coverage is counted exactly, in integers, in units of `1 / D` of a source texel; each axis weight
10
+ * is `covered / S`, rounded once to f32. The weighted sum is divided by the sum of the weights.
11
+ *
12
+ * @type {CodeChunk}
13
+ */
1
14
  export const mipmap_shader_code_linear: CodeChunk;
2
15
  import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
3
16
  //# sourceMappingURL=mipmap_shader_code_linear.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mipmap_shader_code_linear.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.js"],"names":[],"mappings":"AAEA,kDAcG;0BAhBuB,uCAAuC"}
1
+ {"version":3,"file":"mipmap_shader_code_linear.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,wCAFU,SAAS,CAqD+B;0BAnExB,uCAAuC"}
@@ -1,18 +1,68 @@
1
1
  import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
2
+ import { MIP_SHADER_UNIFORM_STRUCT } from "../MIP_SHADER_UNIFORM_STRUCT.js";
2
3
 
4
+ /**
5
+ * The linear reduction: each output texel is the mean of the source over the texel's footprint.
6
+ * Along an axis, output texel `i` of `D` covers `[i * S / D, (i + 1) * S / D)` of a source `S` texels
7
+ * long, and each source texel weighs the share of that footprint it covers; the 2D weight is the
8
+ * product of the two axes'. A source twice the size gives the average of a 2x2 block; an odd one,
9
+ * three texels a side with the outer two shared with the neighbours, so every source texel counts
10
+ * toward the level below and the level keeps its mean.
11
+ *
12
+ * Coverage is counted exactly, in integers, in units of `1 / D` of a source texel; each axis weight
13
+ * is `covered / S`, rounded once to f32. The weighted sum is divided by the sum of the weights.
14
+ *
15
+ * @type {CodeChunk}
16
+ */
3
17
  export const mipmap_shader_code_linear = CodeChunk.from(
4
18
  //language=WGSL
5
19
  `
6
- @group(0) @binding(0) var imgSampler : sampler;
7
20
  @group(0) @binding(1) var img : texture_2d<f32>;
21
+ @group(0) @binding(2) var<uniform> params: ${MIP_SHADER_UNIFORM_STRUCT.wgsl_ref};
22
+
23
+ /**
24
+ * The share of a footprint [lo, hi) that source texel k covers. lo and hi are in units of
25
+ * 1 / output_size of a source texel, so the footprint is source_size of them long.
26
+ */
27
+ fn mip_box_weight(k: u32, lo: u32, hi: u32, output_size: u32, source_size: u32) -> f32 {
28
+ let covered = min(hi, (k + 1u) * output_size) - max(lo, k * output_size);
29
+
30
+ return f32(covered) / f32(source_size);
31
+ }
8
32
 
9
33
  @fragment
10
34
  fn main(
11
35
  @location(0) uv : vec2<f32>
12
36
  ) -> @location(0) vec4<f32> {
37
+ let source_dim = textureDimensions(img, 0);
38
+ let output_dim = params.output_resolution;
13
39
 
14
- return textureSample(img, imgSampler, uv);
40
+ let texel = vec2<u32>(uv * vec2<f32>(output_dim));
15
41
 
16
- }
17
- `);
42
+ // the footprint, in units of 1 / output_dim of a source texel
43
+ let lo = texel * source_dim;
44
+ let hi = lo + source_dim;
45
+
46
+ // the source texels it touches
47
+ let first = lo / output_dim;
48
+ let last = (hi - 1u) / output_dim;
49
+
50
+ var result = vec4<f32>(0.0);
51
+ var weight_sum = 0.0;
18
52
 
53
+ for (var y = first.y; y <= last.y; y++) {
54
+ let weight_y = mip_box_weight(y, lo.y, hi.y, output_dim.y, source_dim.y);
55
+
56
+ for (var x = first.x; x <= last.x; x++) {
57
+ let weight_x = mip_box_weight(x, lo.x, hi.x, output_dim.x, source_dim.x);
58
+
59
+ let weight = weight_x * weight_y;
60
+
61
+ result += textureLoad(img, vec2u(x, y), 0) * weight;
62
+ weight_sum += weight;
63
+ }
64
+ }
65
+
66
+ return result / weight_sum;
67
+ }
68
+ `, [MIP_SHADER_UNIFORM_STRUCT.declaration_chunk]);
@@ -26,9 +26,9 @@ fn main(
26
26
  let src_center = uv_to_texel_coordinate(uv, source_dim);
27
27
 
28
28
  // 3. Determine Kernel Radius
29
- // Mitchell filter is defined on range [-2, 2].
29
+ // Mitchell filter is defined on range [-2, 2], in output texels.
30
30
  // We must stretch this range by the stride to cover the correct area.
31
- let radius = 1.0 * stride;
31
+ let radius = 2.0 * stride;
32
32
 
33
33
  // 4. Calculate Bounds (Clamped to texture dimensions)
34
34
  // We clamp the loop range here so we don't need 'if' checks inside the loop.
@@ -47,7 +47,7 @@ fn main(
47
47
 
48
48
  let dy_norm = dy / stride.y;
49
49
 
50
- let weight_y = filter_mitchell(dy_norm * 2.0);
50
+ let weight_y = filter_mitchell(dy_norm);
51
51
 
52
52
  for (var x = start.x; x <= end.x; x++) {
53
53
 
@@ -55,7 +55,7 @@ fn main(
55
55
 
56
56
  let dx_norm = dx / stride.x;
57
57
 
58
- let weight_x = filter_mitchell(dx_norm * 2.0);
58
+ let weight_x = filter_mitchell(dx_norm);
59
59
 
60
60
  let weight = (weight_x * weight_y);
61
61
 
@@ -1 +1 @@
1
- {"version":3,"file":"mipmap_shader_code_mks.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mks.js"],"names":[],"mappings":"AAgCA;;;;GAIG;AACH,qCAFU,SAAS,CAyEZ;0BA3GmB,uCAAuC"}
1
+ {"version":3,"file":"mipmap_shader_code_mks.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mks.js"],"names":[],"mappings":"AAgCA;;;;GAIG;AACH,qCAFU,SAAS,CAqEZ;0BAvGmB,uCAAuC"}
@@ -51,15 +51,12 @@ fn main(
51
51
  let stride = max(vec2(1.0), vec2<f32>(source_dim) / vec2<f32>(output_dim));
52
52
 
53
53
  let src_center = uv_to_texel_coordinate(uv, source_dim);
54
-
55
- var radius = vec2(5.0);
56
- if(stride.x > 1.0){
57
- radius.x = ceil(3.5 * stride.x);
58
- }
59
- if(stride.y > 1.0){
60
- radius.y = ceil(3.5 * stride.y);
61
- }
62
-
54
+
55
+ // The kernel is non-zero on (-4.5, 4.5), in output texels
56
+ const SUPPORT_RADIUS = 4.5;
57
+
58
+ let radius = SUPPORT_RADIUS * stride;
59
+
63
60
  let min_bound = vec2(0.0);
64
61
  let max_bound = vec2<f32>(source_dim) - 1.0;
65
62
 
@@ -73,9 +70,8 @@ fn main(
73
70
 
74
71
  let dy = abs(f32(y) - src_center.y);
75
72
  let dy_norm = dy / stride.y;
76
-
77
- // Discarding samples strictly outside the 4.5 radius to save math ops
78
- if (dy_norm >= 4.5) { continue; }
73
+
74
+ if (dy_norm >= SUPPORT_RADIUS) { continue; }
79
75
 
80
76
  let weight_y = filter_mks_2021(dy_norm);
81
77
 
@@ -84,7 +80,7 @@ fn main(
84
80
  let dx = abs(f32(x) - src_center.x);
85
81
  let dx_norm = dx / stride.x;
86
82
 
87
- if (dx_norm >= 4.5) { continue; }
83
+ if (dx_norm >= SUPPORT_RADIUS) { continue; }
88
84
 
89
85
  let weight_x = filter_mks_2021(dx_norm);
90
86
  let weight = (weight_x * weight_y);
@@ -0,0 +1,33 @@
1
+ /**
2
+ * A texture in each block format it is built in: what a device that can sample the format is handed instead of
3
+ * the texture's uncompressed fallback.
4
+ *
5
+ * - **Which formats** is {@link texture_formats_to_build} for the role, less what cannot be had: a format nothing
6
+ * here encodes, and every format if the base level is not whole blocks (a device makes no block texture of it).
7
+ * - **Which channels.** For a role whose alpha the renderer reads, all four, kept in every format. For any other
8
+ * role alpha is not read here either: every block is fitted to the colour alone ({@link texel_encode_image_rgb}),
9
+ * and what it decodes to in alpha is whatever served the colour.
10
+ * - **Which levels** is the texture's own rule: when it is to have its chain generated
11
+ * ({@link ShadeTextureFlags.GenerateMipMaps}), the chain the device would generate from the base level with the
12
+ * texture's filter ({@link mipmap_chain_cpu}); otherwise the levels it brings, as they are.
13
+ *
14
+ * The pixels given are not changed.
15
+ *
16
+ * @param {Sampler2D[]} levels the texture's pixels, base first: one level, or its whole chain; eight-bit, one to
17
+ * four channels
18
+ * @param {TextureRole|number} role
19
+ * @param {boolean} generate whether the texture is to have its chain generated from the base level
20
+ * @param {TextureFilterType|number} filter what a generated chain is filtered with
21
+ * @param {boolean} srgb whether the pixels are sRGB-encoded, which a generated chain is filtered in linear light for
22
+ * @returns {[GPUTextureFormat, ShadeTexelData][]} in the order {@link texture_formats_to_build} gives; empty when
23
+ * no format can be had
24
+ *
25
+ * @author Alex Goldring
26
+ * @copyright Company Named Limited (c) 2026
27
+ */
28
+ export function texture_block_encodings(levels: Sampler2D[], role: TextureRole | number, generate: boolean, filter: TextureFilterType | number, srgb: boolean): [GPUTextureFormat, ShadeTexelData][];
29
+ export type TextureFilterType = import("./TextureFilterType.js").TextureFilterType;
30
+ import { Sampler2D } from "../../../engine/graphics/texture/sampler/Sampler2D.js";
31
+ import { TextureRole } from "./TextureRole.js";
32
+ import { ShadeTexelData } from "./source/ShadeTexelData.js";
33
+ //# sourceMappingURL=texture_block_encodings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"texture_block_encodings.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/texture/texture_block_encodings.js"],"names":[],"mappings":"AA4BA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,gDAZW,SAAS,EAAE,QAEX,WAAW,GAAC,MAAM,YAClB,OAAO,UACP,iBAAiB,GAAC,MAAM,QACxB,OAAO,GACL,mBAAmB,cAAc,CAAC,EAAE,CAuChD;gCA9EY,OAAO,wBAAwB,EAAE,iBAAiB;0BATrC,uDAAuD;4BAMrD,kBAAkB;+BADf,4BAA4B"}
@@ -0,0 +1,89 @@
1
+ import { sampler2d_to_uint8_RGBA } from "../../../engine/graphics/texture/sampler/sampler2d_to_uint8_RGBA.js";
2
+ import { Sampler2D } from "../../../engine/graphics/texture/sampler/Sampler2D.js";
3
+ import { texel_encode_image, texel_encode_image_rgb, texel_encode_image_writes } from "../../../format/texture/texel_encode_image.js";
4
+ import { gpu_texture_format_info } from "../../descriptor/texture/format/gpu_texture_format_info.js";
5
+ import { texture_formats_to_build } from "./format/texture_formats_to_build.js";
6
+ import { mipmap_chain_cpu } from "./mipmaps/cpu/mipmap_chain_cpu.js";
7
+ import { ShadeTexelData } from "./source/ShadeTexelData.js";
8
+ import { TextureRole } from "./TextureRole.js";
9
+
10
+ /**
11
+ * @typedef {import("./TextureFilterType.js").TextureFilterType} TextureFilterType
12
+ */
13
+
14
+ /**
15
+ * A copy of pixels as eight-bit RGBA, which is what the mip generator and the block encoders read: grey is grey
16
+ * in every colour channel, and an image without alpha is opaque.
17
+ *
18
+ * @param {Sampler2D} pixels
19
+ * @returns {Sampler2D} always a new sampler, so its texels are free to change
20
+ */
21
+ function rgba8_copy(pixels) {
22
+ const copy = Sampler2D.uint8(4, pixels.width, pixels.height);
23
+
24
+ sampler2d_to_uint8_RGBA(copy, pixels);
25
+
26
+ return copy;
27
+ }
28
+
29
+ /**
30
+ * A texture in each block format it is built in: what a device that can sample the format is handed instead of
31
+ * the texture's uncompressed fallback.
32
+ *
33
+ * - **Which formats** is {@link texture_formats_to_build} for the role, less what cannot be had: a format nothing
34
+ * here encodes, and every format if the base level is not whole blocks (a device makes no block texture of it).
35
+ * - **Which channels.** For a role whose alpha the renderer reads, all four, kept in every format. For any other
36
+ * role alpha is not read here either: every block is fitted to the colour alone ({@link texel_encode_image_rgb}),
37
+ * and what it decodes to in alpha is whatever served the colour.
38
+ * - **Which levels** is the texture's own rule: when it is to have its chain generated
39
+ * ({@link ShadeTextureFlags.GenerateMipMaps}), the chain the device would generate from the base level with the
40
+ * texture's filter ({@link mipmap_chain_cpu}); otherwise the levels it brings, as they are.
41
+ *
42
+ * The pixels given are not changed.
43
+ *
44
+ * @param {Sampler2D[]} levels the texture's pixels, base first: one level, or its whole chain; eight-bit, one to
45
+ * four channels
46
+ * @param {TextureRole|number} role
47
+ * @param {boolean} generate whether the texture is to have its chain generated from the base level
48
+ * @param {TextureFilterType|number} filter what a generated chain is filtered with
49
+ * @param {boolean} srgb whether the pixels are sRGB-encoded, which a generated chain is filtered in linear light for
50
+ * @returns {[GPUTextureFormat, ShadeTexelData][]} in the order {@link texture_formats_to_build} gives; empty when
51
+ * no format can be had
52
+ *
53
+ * @author Alex Goldring
54
+ * @copyright Company Named Limited (c) 2026
55
+ */
56
+ export function texture_block_encodings(levels, role, generate, filter, srgb) {
57
+ const base = levels[0];
58
+
59
+ const formats = texture_formats_to_build(role).filter(format => {
60
+ const info = gpu_texture_format_info(format);
61
+
62
+ return texel_encode_image_writes(format)
63
+ && base.width % info.block_width === 0
64
+ && base.height % info.block_height === 0;
65
+ });
66
+
67
+ if (formats.length === 0) {
68
+ return [];
69
+ }
70
+
71
+ const rgba = generate
72
+ ? mipmap_chain_cpu(rgba8_copy(base), filter, srgb)
73
+ : levels.map(rgba8_copy);
74
+
75
+ const reads_alpha = role === TextureRole.Albedo;
76
+
77
+ // alpha that means nothing for the role is not read: it would only cost the colour precision
78
+ const encode = reads_alpha ? texel_encode_image : texel_encode_image_rgb;
79
+
80
+ const encodings = [];
81
+
82
+ for (const format of formats) {
83
+ const blocks = rgba.map(level => encode(format, level));
84
+
85
+ encodings.push([format, new ShadeTexelData(format, base.width, base.height, 1, blocks)]);
86
+ }
87
+
88
+ return encodings;
89
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The quality a lossy image encoder is asked for when it encodes a texture of this role, 0 to 1: how much a
3
+ * visible error in that kind of content costs.
4
+ *
5
+ * @param {TextureRole|number} role
6
+ * @returns {number}
7
+ */
8
+ export function texture_role_image_quality(role: TextureRole | number): number;
9
+ import { TextureRole } from "./TextureRole.js";
10
+ //# sourceMappingURL=texture_role_image_quality.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"texture_role_image_quality.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/texture/texture_role_image_quality.js"],"names":[],"mappings":"AAiBA;;;;;;GAMG;AACH,iDAHW,WAAW,GAAC,MAAM,GAChB,MAAM,CAMlB;4BA3B2B,kBAAkB"}
@@ -0,0 +1,29 @@
1
+ import { assert } from "../../../core/assert.js";
2
+ import { TextureRole } from "./TextureRole.js";
3
+
4
+ /**
5
+ * @type {Object<TextureRole, number>}
6
+ */
7
+ const BY_ROLE = {
8
+ // the one people look at, and the one a lossy codec is built for
9
+ [TextureRole.Albedo]: 0.5,
10
+
11
+ // a direction: an error in it is an error in every light on the surface
12
+ [TextureRole.Normal]: 0.75,
13
+
14
+ [TextureRole.Orm]: 0.4,
15
+ [TextureRole.Emissive]: 0.4,
16
+ };
17
+
18
+ /**
19
+ * The quality a lossy image encoder is asked for when it encodes a texture of this role, 0 to 1: how much a
20
+ * visible error in that kind of content costs.
21
+ *
22
+ * @param {TextureRole|number} role
23
+ * @returns {number}
24
+ */
25
+ export function texture_role_image_quality(role) {
26
+ assert.enum(role, TextureRole, 'role');
27
+
28
+ return BY_ROLE[role];
29
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"astc_block.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/basis/astc_block.js"],"names":[],"mappings":"AA4DA;;;;;;;;;;;;;GAaG;AACH,qCALW,MAAM,MACN,MAAM,UACN,MAAM,GACJ,MAAM,CAOlB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,gDAJW,UAAU,WACV,UAAU,OACV,MAAM,QAoBhB;AAED;;;;;;;;;GASG;AACH,sCANW,UAAU,UACV,MAAM,aACN,UAAU,WACV,UAAU,eACV,MAAM,QAoChB;AAnKD;;;;;GAKG;AACH,+BAFU,MAAM,CAEmB;AAEnC;;;;;GAKG;AACH,iCAFU,MAAM,CAEoB;AAUpC;;;;;;;;;;;;;;GAcG;AACH;QAFiB,MAAM,GAAE,MAAM;EAK7B;AAEF;;;;;;;;;;GAUG;AACH;QAFiB,MAAM,GAAE,MAAM,EAAE;EAK/B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"astc_integer_sequence.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/basis/astc_integer_sequence.js"],"names":[],"mappings":"AAkCA;;;;;;;;;;;;GAYG;AACH,0CAHW,MAAM,GACJ,MAAM,EAAE,CAgDpB;AAED;;;;;;GAMG;AACH,2CAJW,MAAM,GACJ,MAAM,EAAE,CAiCpB;AA0CD;;;;;;;;;;;;;;;;;;GAkBG;AACH,mDAPW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,UACtC,MAAM,EAAE,GAAC,UAAU,eACnB,MAAM,QAiDhB;AA7OD;;;;;;;;;GASG;AACH,yBAFU;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAC,EAAE,CAwBvE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"astc_partition.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/basis/astc_partition.js"],"names":[],"mappings":"AA4BA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,4CAVW,MAAM,KACN,MAAM,KACN,MAAM,mBACN,MAAM,GACJ,MAAM,CAiFlB;AAED;;;;;;GAMG;AACH,6CAJW,MAAM,mBACN,MAAM,GACJ,UAAU,CAYtB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,iDALW,UAAU,mBACV,MAAM,GACJ;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,EAAE,CAAA;CAAC,GAAC,SAAS,CAmC3D"}
@@ -1,111 +0,0 @@
1
- /**
2
- * Which of UASTC's two subsets a BC7 three-subset index belongs to, under one of the six folds.
3
- *
4
- * @param {number} subset BC7's, `0` to `2`
5
- * @param {number} fold
6
- * @returns {number} UASTC's, `0` or `1`
7
- */
8
- export function bc7_fold_subset_3_to_2(subset: number, fold: number): number;
9
- /**
10
- * BC7's own partition and anchor tables, and how UASTC's patterns map onto them.
11
- *
12
- * **Two specifications meet here.** The partition and anchor tables are BC7's, transcribed from the
13
- * BPTC specification; the three mapping tables are UASTC's, which name for each of its patterns the
14
- * BC7 pattern that draws the same subsets and how the two number them differently.
15
- *
16
- * They are checked against each other by `bc7_tables.spec.js` rather than trusted: for every UASTC
17
- * pattern, applying the stated relabelling to BC7's own pattern must reproduce UASTC's texel for
18
- * texel. That check is what makes a transcription error here impossible to miss, and it passes for
19
- * all sixty patterns.
20
- *
21
- * @see the BPTC specification (ARB_texture_compression_bptc), tables P2, P3, A2, A3a and A3b
22
- * @see the UASTC LDR 4x4 specification, "Partition Pattern Table" sections
23
- * @author Alex Goldring
24
- * @copyright Company Named Limited (c) 2026
25
- */
26
- /**
27
- * BC7's two-subset partitions: one subset index per texel, sixty-four patterns of sixteen.
28
- *
29
- * @readonly
30
- * @type {Uint8Array}
31
- */
32
- export const BC7_PARTITIONS_2: Uint8Array;
33
- /**
34
- * BC7's three-subset partitions.
35
- *
36
- * @readonly
37
- * @type {Uint8Array}
38
- */
39
- export const BC7_PARTITIONS_3: Uint8Array;
40
- /**
41
- * The texel whose index is stored a bit short for the second subset of a two-subset partition.
42
- *
43
- * Subset zero's anchor is always texel zero, so only the others are tabulated. The anchor is *not*
44
- * the first texel of its subset — BC7 chose these positions for the encoder's benefit and a decoder
45
- * has to read them from the table.
46
- *
47
- * @readonly
48
- * @type {Uint8Array}
49
- */
50
- export const BC7_ANCHOR_2: Uint8Array;
51
- /**
52
- * The same for the second subset of a three-subset partition.
53
- *
54
- * @readonly
55
- * @type {Uint8Array}
56
- */
57
- export const BC7_ANCHOR_3_SECOND: Uint8Array;
58
- /**
59
- * The same for the third subset of a three-subset partition.
60
- *
61
- * @readonly
62
- * @type {Uint8Array}
63
- */
64
- export const BC7_ANCHOR_3_THIRD: Uint8Array;
65
- /**
66
- * For each UASTC two-subset pattern, the BC7 pattern drawing the same shape.
67
- *
68
- * `invert` says the two number their subsets oppositely, so a UASTC subset `s` is BC7's `1 - s`.
69
- *
70
- * @readonly
71
- * @type {{bc7: number, invert: boolean}[]}
72
- */
73
- export const UASTC_TO_BC7_2: {
74
- bc7: number;
75
- invert: boolean;
76
- }[];
77
- /**
78
- * For each UASTC three-subset pattern, the BC7 pattern and which relabelling of the three subsets
79
- * takes UASTC's numbering to BC7's.
80
- *
81
- * @readonly
82
- * @type {{bc7: number, permutation: number}[]}
83
- */
84
- export const UASTC_TO_BC7_3: {
85
- bc7: number;
86
- permutation: number;
87
- }[];
88
- /**
89
- * The relabellings {@link UASTC_TO_BC7_3} refers to: entry `p` of a row is the BC7 subset that
90
- * UASTC's subset `p` becomes.
91
- *
92
- * @readonly
93
- * @type {number[][]}
94
- */
95
- export const SUBSET_PERMUTATIONS: number[][];
96
- /**
97
- * For each of mode 7's patterns, the BC7 *three*-subset pattern to use and the rule folding its
98
- * three subsets back down to UASTC's two.
99
- *
100
- * Mode 7 is the odd one: two subsets in UASTC and three in BC7, which works because two of BC7's
101
- * three endpoint pairs are written identically. `fold` is the rule, applied by
102
- * {@link bc7_fold_subset_3_to_2}.
103
- *
104
- * @readonly
105
- * @type {{bc7: number, fold: number}[]}
106
- */
107
- export const UASTC_TO_BC7_2_VIA_3: {
108
- bc7: number;
109
- fold: number;
110
- }[];
111
- //# sourceMappingURL=bc7_tables.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bc7_tables.d.ts","sourceRoot":"","sources":["../../../../../../src/format/texture/basis/uastc/bc7_tables.js"],"names":[],"mappings":"AA2PA;;;;;;GAMG;AACH,+CAJW,MAAM,QACN,MAAM,GACJ,MAAM,CAmBlB;AAnRD;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;GAKG;AACH,+BAFU,UAAU,CAmCjB;AAEH;;;;;GAKG;AACH,+BAFU,UAAU,CAmCjB;AAEH;;;;;;;;;GASG;AACH,2BAFU,UAAU,CAMjB;AAEH;;;;;GAKG;AACH,kCAFU,UAAU,CAMjB;AAEH;;;;;GAKG;AACH,iCAFU,UAAU,CAMjB;AAEH;;;;;;;GAOG;AACH,6BAFU;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAC,EAAE,CAiCxC;AAEF;;;;;;GAMG;AACH,6BAFU;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,EAAE,CAc5C;AAEF;;;;;;GAMG;AACH,kCAFU,MAAM,EAAE,EAAE,CASlB;AAEF;;;;;;;;;;GAUG;AACH,mCAFU;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,EAAE,CAsBrC"}
@@ -1,124 +0,0 @@
1
- /**
2
- * The eight-bit value a stored endpoint component decodes to.
3
- *
4
- * The parity bit, where the mode has one, sits *below* the stored bits — so a five-bit component
5
- * with a parity bit is a six-bit value — and the result is then widened to eight by replicating its
6
- * top bits downward.
7
- *
8
- * @param {number} stored
9
- * @param {number} bits including the parity bit
10
- * @returns {number}
11
- */
12
- export function bc7_expand_endpoint(stored: number, bits: number): number;
13
- /**
14
- * Quantise an eight-bit value to what a mode can store, optionally forced to a parity.
15
- *
16
- * @param {number} value
17
- * @param {number} bits including the parity bit, where there is one
18
- * @param {number} parity `-1` when the mode has none
19
- * @returns {number} the value including its parity bit, so `bits` wide
20
- */
21
- export function bc7_quantise_endpoint(value: number, bits: number, parity: number): number;
22
- /**
23
- * Write one BC7 block.
24
- *
25
- * **One writer for every mode**, because the specification says the fields are always in the same
26
- * order and only their widths change. Writing each mode out separately would be the same sequence
27
- * five times with different constants, and the constants are already a table.
28
- *
29
- * Endpoints are ordered as the specification stores them: by channel, then by subset, then by
30
- * endpoint — so red for both ends of subset 0, then both ends of subset 1, then green, and so on.
31
- *
32
- * @param {Uint8Array} out
33
- * @param {number} byte_offset of the block
34
- * @param {number} mode
35
- * @param {object} block
36
- * @param {number} [block.partition] index into BC7's partition table
37
- * @param {number} [block.rotation]
38
- * @param {Uint8Array} block.endpoints `subsets * 2 * 4` stored fields, low then high RGBA per
39
- * subset — already quantised to the mode's width, with any parity bit held separately
40
- * @param {Uint8Array} block.indices sixteen
41
- * @param {Uint8Array} [block.secondary_indices] sixteen, for a mode with two index sets
42
- * @param {Uint8Array} block.anchors one texel index per subset
43
- * @param {Int8Array} [block.parity] one bit per endpoint, or per subset for a shared-parity mode
44
- *
45
- * @author Alex Goldring
46
- * @copyright Company Named Limited (c) 2026
47
- */
48
- export function bc7_write_block(out: Uint8Array, byte_offset: number, mode: number, block: {
49
- partition?: number;
50
- rotation?: number;
51
- endpoints: Uint8Array;
52
- indices: Uint8Array;
53
- secondary_indices?: Uint8Array;
54
- anchors: Uint8Array;
55
- parity?: Int8Array;
56
- }): void;
57
- /**
58
- * Bytes one BC7 block occupies.
59
- *
60
- * @readonly
61
- * @type {number}
62
- */
63
- export const BC7_BLOCK_BYTES: number;
64
- /**
65
- * What one BC7 mode stores, from the specification's mode table.
66
- *
67
- * The field *order* is the same for every mode — partition, rotation, index selection, colour,
68
- * alpha, per-endpoint parity, shared parity, indices — so a mode is entirely described by how many
69
- * bits it gives each, which is what makes one writer enough for all of them.
70
- *
71
- * @typedef {object} Bc7Mode
72
- * @property {number} subsets
73
- * @property {number} partition_bits
74
- * @property {number} rotation_bits
75
- * @property {number} color_bits
76
- * @property {number} alpha_bits `0` where the mode has no alpha, which then decodes as opaque
77
- * @property {number} endpoint_parity_bits one parity bit per endpoint, `0` or `1`
78
- * @property {number} shared_parity_bits one parity bit per *subset*, shared by both its endpoints
79
- * @property {number} index_bits
80
- * @property {number} secondary_index_bits `0` unless the mode has a second index set
81
- */
82
- /**
83
- * Every BC7 mode this writes, from Table.M of the specification.
84
- *
85
- * Modes 0 and 4 are absent: no UASTC mode maps to either, so writing them would be code with no
86
- * caller and no test.
87
- *
88
- * @readonly
89
- * @type {Object<number, Bc7Mode>}
90
- */
91
- export const BC7_MODES: {
92
- [x: number]: Bc7Mode;
93
- };
94
- /**
95
- * What one BC7 mode stores, from the specification's mode table.
96
- *
97
- * The field *order* is the same for every mode — partition, rotation, index selection, colour,
98
- * alpha, per-endpoint parity, shared parity, indices — so a mode is entirely described by how many
99
- * bits it gives each, which is what makes one writer enough for all of them.
100
- */
101
- export type Bc7Mode = {
102
- subsets: number;
103
- partition_bits: number;
104
- rotation_bits: number;
105
- color_bits: number;
106
- /**
107
- * `0` where the mode has no alpha, which then decodes as opaque
108
- */
109
- alpha_bits: number;
110
- /**
111
- * one parity bit per endpoint, `0` or `1`
112
- */
113
- endpoint_parity_bits: number;
114
- /**
115
- * one parity bit per *subset*, shared by both its endpoints
116
- */
117
- shared_parity_bits: number;
118
- index_bits: number;
119
- /**
120
- * `0` unless the mode has a second index set
121
- */
122
- secondary_index_bits: number;
123
- };
124
- //# sourceMappingURL=bc7_write_block.d.ts.map