@woosh/meep-engine 3.79.0 → 3.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -3
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/format/image/webp/vp8/VP8BoolDecoder.d.ts +45 -0
- package/src/format/image/webp/vp8/VP8BoolDecoder.d.ts.map +1 -0
- package/src/format/image/webp/vp8/VP8BoolDecoder.js +137 -0
- package/src/format/image/webp/vp8/vp8_decode.d.ts +21 -0
- package/src/format/image/webp/vp8/vp8_decode.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_decode.js +756 -0
- package/src/format/image/webp/vp8/vp8_loop_filter.d.ts +31 -0
- package/src/format/image/webp/vp8/vp8_loop_filter.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_loop_filter.js +189 -0
- package/src/format/image/webp/vp8/vp8_predict.d.ts +48 -0
- package/src/format/image/webp/vp8/vp8_predict.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_predict.js +290 -0
- package/src/format/image/webp/vp8/vp8_tables.d.ts +34 -0
- package/src/format/image/webp/vp8/vp8_tables.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_tables.js +350 -0
- package/src/format/image/webp/vp8/vp8_transform.d.ts +22 -0
- package/src/format/image/webp/vp8/vp8_transform.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_transform.js +114 -0
- package/src/format/image/webp/vp8/vp8_yuv_to_rgba.d.ts +23 -0
- package/src/format/image/webp/vp8/vp8_yuv_to_rgba.d.ts.map +1 -0
- package/src/format/image/webp/vp8/vp8_yuv_to_rgba.js +133 -0
- package/src/format/image/webp/vp8l/VP8LBitReader.d.ts +47 -0
- package/src/format/image/webp/vp8l/VP8LBitReader.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/VP8LBitReader.js +84 -0
- package/src/format/image/webp/vp8l/VP8LPrefixCode.d.ts +27 -0
- package/src/format/image/webp/vp8l/VP8LPrefixCode.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/VP8LPrefixCode.js +184 -0
- package/src/format/image/webp/vp8l/vp8l_decode.d.ts +28 -0
- package/src/format/image/webp/vp8l/vp8l_decode.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/vp8l_decode.js +261 -0
- package/src/format/image/webp/vp8l/vp8l_distance.d.ts +22 -0
- package/src/format/image/webp/vp8l/vp8l_distance.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/vp8l_distance.js +62 -0
- package/src/format/image/webp/vp8l/vp8l_inverse_transforms.d.ts +50 -0
- package/src/format/image/webp/vp8l/vp8l_inverse_transforms.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/vp8l_inverse_transforms.js +267 -0
- package/src/format/image/webp/vp8l/vp8l_read_prefix_code.d.ts +14 -0
- package/src/format/image/webp/vp8l/vp8l_read_prefix_code.d.ts.map +1 -0
- package/src/format/image/webp/vp8l/vp8l_read_prefix_code.js +99 -0
- package/src/format/image/webp/webp_decode.d.ts +23 -0
- package/src/format/image/webp/webp_decode.d.ts.map +1 -0
- package/src/format/image/webp/webp_decode.js +179 -0
- package/src/format/image/webp/webp_decode_alpha.d.ts +18 -0
- package/src/format/image/webp/webp_decode_alpha.d.ts.map +1 -0
- package/src/format/image/webp/webp_decode_alpha.js +84 -0
- package/src/format/texture/{basis → astc}/astc_block.d.ts +41 -0
- package/src/format/texture/astc/astc_block.d.ts.map +1 -0
- package/src/format/texture/{basis → astc}/astc_block.js +284 -164
- package/src/format/texture/astc/astc_decode_block.d.ts +68 -0
- package/src/format/texture/astc/astc_decode_block.d.ts.map +1 -0
- package/src/format/texture/astc/astc_decode_block.js +1119 -0
- package/src/format/texture/astc/astc_encode_block_4x4.d.ts +32 -0
- package/src/format/texture/astc/astc_encode_block_4x4.d.ts.map +1 -0
- package/src/format/texture/astc/astc_encode_block_4x4.js +181 -0
- package/src/format/texture/astc/astc_encode_block_4x4_rgba.d.ts +32 -0
- package/src/format/texture/astc/astc_encode_block_4x4_rgba.d.ts.map +1 -0
- package/src/format/texture/astc/astc_encode_block_4x4_rgba.js +337 -0
- package/src/format/texture/astc/astc_integer_sequence.d.ts.map +1 -0
- package/src/format/texture/{basis → astc}/astc_integer_sequence.js +251 -251
- package/src/format/texture/astc/astc_partition.d.ts.map +1 -0
- package/src/format/texture/{basis → astc}/astc_partition.js +199 -199
- package/src/format/texture/basis/transcode/etc1s_to_astc.js +329 -329
- package/src/format/texture/basis/transcode/etc1s_to_etc2.d.ts.map +1 -1
- package/src/format/texture/basis/transcode/etc1s_to_etc2.js +305 -332
- package/src/format/texture/basis/transcode/fit_endpoints.d.ts.map +1 -1
- package/src/format/texture/basis/transcode/fit_endpoints.js +14 -27
- package/src/format/texture/basis/uastc/uastc_bc7_tables.d.ts +66 -0
- package/src/format/texture/basis/uastc/uastc_bc7_tables.d.ts.map +1 -0
- package/src/format/texture/basis/uastc/uastc_bc7_tables.js +148 -0
- package/src/format/texture/basis/uastc/uastc_decode_block.js +463 -463
- package/src/format/texture/basis/uastc/uastc_to_astc.js +421 -421
- package/src/format/texture/basis/uastc/uastc_to_bc5.d.ts +1 -6
- package/src/format/texture/basis/uastc/uastc_to_bc5.d.ts.map +1 -1
- package/src/format/texture/basis/uastc/uastc_to_bc5.js +48 -115
- package/src/format/texture/basis/uastc/uastc_to_bc7.d.ts.map +1 -1
- package/src/format/texture/basis/uastc/uastc_to_bc7.js +604 -602
- package/src/format/texture/bc/bc1_decode_block.d.ts +19 -0
- package/src/format/texture/bc/bc1_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc1_decode_block.js +22 -0
- package/src/format/texture/bc/bc1_decode_colors.d.ts +27 -0
- package/src/format/texture/bc/bc1_decode_colors.d.ts.map +1 -0
- package/src/format/texture/bc/bc1_decode_colors.js +100 -0
- package/src/format/texture/bc/bc2_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc2_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc2_decode_block.js +28 -0
- package/src/format/texture/bc/bc3_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc3_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc3_decode_block.js +23 -0
- package/src/format/texture/bc/bc4_decode_channel.d.ts +56 -0
- package/src/format/texture/bc/bc4_decode_channel.d.ts.map +1 -0
- package/src/format/texture/bc/bc4_decode_channel.js +138 -0
- package/src/format/texture/bc/bc4_encode_block.d.ts +43 -0
- package/src/format/texture/bc/bc4_encode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc4_encode_block.js +324 -0
- package/src/format/texture/bc/bc4_snorm_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc4_snorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc4_snorm_decode_block.js +27 -0
- package/src/format/texture/bc/bc4_unorm_decode_block.d.ts +17 -0
- package/src/format/texture/bc/bc4_unorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc4_unorm_decode_block.js +26 -0
- package/src/format/texture/bc/bc5_encode_block.d.ts +25 -0
- package/src/format/texture/bc/bc5_encode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc5_encode_block.js +34 -0
- package/src/format/texture/bc/bc5_snorm_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc5_snorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc5_snorm_decode_block.js +27 -0
- package/src/format/texture/bc/bc5_unorm_decode_block.d.ts +17 -0
- package/src/format/texture/bc/bc5_unorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc5_unorm_decode_block.js +26 -0
- package/src/format/texture/bc/bc6h_decode_texels.d.ts +30 -0
- package/src/format/texture/bc/bc6h_decode_texels.d.ts.map +1 -0
- package/src/format/texture/bc/bc6h_decode_texels.js +430 -0
- package/src/format/texture/bc/bc6h_sfloat_decode_block.d.ts +20 -0
- package/src/format/texture/bc/bc6h_sfloat_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc6h_sfloat_decode_block.js +23 -0
- package/src/format/texture/bc/bc6h_ufloat_decode_block.d.ts +18 -0
- package/src/format/texture/bc/bc6h_ufloat_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc6h_ufloat_decode_block.js +21 -0
- package/src/format/texture/bc/bc7_decode_block.d.ts +30 -0
- package/src/format/texture/bc/bc7_decode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc7_decode_block.js +232 -0
- package/src/format/texture/bc/bc7_encode_block.d.ts +39 -0
- package/src/format/texture/bc/bc7_encode_block.d.ts.map +1 -0
- package/src/format/texture/bc/bc7_encode_block.js +423 -0
- package/src/format/texture/bc/bc7_tables.d.ts +126 -0
- package/src/format/texture/bc/bc7_tables.d.ts.map +1 -0
- package/src/format/texture/{basis/uastc → bc}/bc7_tables.js +225 -276
- package/src/format/texture/bc/bc7_write_block.d.ts +65 -0
- package/src/format/texture/bc/bc7_write_block.d.ts.map +1 -0
- package/src/format/texture/{basis/uastc → bc}/bc7_write_block.js +185 -227
- package/src/format/texture/etc/eac_decode_channel.d.ts +50 -0
- package/src/format/texture/etc/eac_decode_channel.d.ts.map +1 -0
- package/src/format/texture/etc/eac_decode_channel.js +142 -0
- package/src/format/texture/etc/eac_modifiers.d.ts +15 -0
- package/src/format/texture/etc/eac_modifiers.d.ts.map +1 -0
- package/src/format/texture/etc/eac_modifiers.js +31 -0
- package/src/format/texture/etc/eac_r11_snorm_decode_block.d.ts +21 -0
- package/src/format/texture/etc/eac_r11_snorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/eac_r11_snorm_decode_block.js +30 -0
- package/src/format/texture/etc/eac_r11_unorm_decode_block.d.ts +20 -0
- package/src/format/texture/etc/eac_r11_unorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/eac_r11_unorm_decode_block.js +29 -0
- package/src/format/texture/etc/eac_rg11_snorm_decode_block.d.ts +19 -0
- package/src/format/texture/etc/eac_rg11_snorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/eac_rg11_snorm_decode_block.js +28 -0
- package/src/format/texture/etc/eac_rg11_unorm_decode_block.d.ts +19 -0
- package/src/format/texture/etc/eac_rg11_unorm_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/eac_rg11_unorm_decode_block.js +28 -0
- package/src/format/texture/etc/etc2_decode_color.d.ts +25 -0
- package/src/format/texture/etc/etc2_decode_color.d.ts.map +1 -0
- package/src/format/texture/etc/etc2_decode_color.js +370 -0
- package/src/format/texture/etc/etc2_rgb8_decode_block.d.ts +18 -0
- package/src/format/texture/etc/etc2_rgb8_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/etc2_rgb8_decode_block.js +21 -0
- package/src/format/texture/etc/etc2_rgb8a1_decode_block.d.ts +21 -0
- package/src/format/texture/etc/etc2_rgb8a1_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/etc2_rgb8a1_decode_block.js +24 -0
- package/src/format/texture/etc/etc2_rgba8_decode_block.d.ts +18 -0
- package/src/format/texture/etc/etc2_rgba8_decode_block.d.ts.map +1 -0
- package/src/format/texture/etc/etc2_rgba8_decode_block.js +24 -0
- package/src/format/texture/fit/fit_line.d.ts +23 -0
- package/src/format/texture/fit/fit_line.d.ts.map +1 -0
- package/src/format/texture/fit/fit_line.js +123 -0
- package/src/format/texture/fit/fit_line_refine.d.ts +21 -0
- package/src/format/texture/fit/fit_line_refine.d.ts.map +1 -0
- package/src/format/texture/fit/fit_line_refine.js +69 -0
- package/src/format/texture/fit/fit_line_solve.d.ts +23 -0
- package/src/format/texture/fit/fit_line_solve.d.ts.map +1 -0
- package/src/format/texture/fit/fit_line_solve.js +71 -0
- package/src/format/texture/texel_decode_image.d.ts +44 -0
- package/src/format/texture/texel_decode_image.d.ts.map +1 -0
- package/src/format/texture/texel_decode_image.js +251 -0
- package/src/format/texture/texel_encode_image.d.ts +77 -0
- package/src/format/texture/texel_encode_image.d.ts.map +1 -0
- package/src/format/texture/texel_encode_image.js +187 -0
- package/src/shade/renderer/ShadeIndirectLightingMode.js +2 -0
- package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
- package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
- package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts +1 -0
- package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts.map +1 -1
- package/src/shade/renderer/loader/mtf/mtf_encode_texture.js +102 -28
- package/src/shade/renderer/loader/mtf/mtf_replace_textures.d.ts +19 -0
- package/src/shade/renderer/loader/mtf/mtf_replace_textures.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_replace_textures.js +60 -0
- package/src/shade/renderer/loader/mtf/mtf_write.d.ts.map +1 -1
- package/src/shade/renderer/loader/mtf/mtf_write.js +7 -31
- package/src/shade/renderer/loader/mtf/mtf_write_collection.d.ts +23 -0
- package/src/shade/renderer/loader/mtf/mtf_write_collection.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_write_collection.js +36 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.d.ts +13 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4.js +39 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts +3 -2
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgb.js +6 -21
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.d.ts +42 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_astc_encode_block_4x4_rgba.js +612 -0
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts +5 -4
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc1_encode_block.js +8 -25
- package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc6h_encode_block_mode11.js +3 -19
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts +14 -4
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block.js +65 -54
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts +2 -2
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js +5 -22
- package/src/shade/renderer/texture/encode/chunk_bc7_partition_2.js +1 -1
- package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.d.ts +27 -0
- package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/chunk_scatter_principal_axis.js +147 -0
- package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.d.ts +3 -4
- package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.js +6 -13
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.d.ts +13 -0
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.d.ts.map +1 -0
- package/src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.js +66 -0
- package/src/shade/renderer/texture/encode/texture_encode.d.ts +28 -1
- package/src/shade/renderer/texture/encode/texture_encode.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/texture_encode.js +202 -168
- package/src/shade/renderer/texture/encode/texture_encode_shader.d.ts +13 -1
- package/src/shade/renderer/texture/encode/texture_encode_shader.d.ts.map +1 -1
- package/src/shade/renderer/texture/encode/texture_encode_shader.js +146 -108
- package/src/shade/renderer/texture/format/texture_formats_to_build.d.ts +20 -0
- package/src/shade/renderer/texture/format/texture_formats_to_build.d.ts.map +1 -0
- package/src/shade/renderer/texture/format/texture_formats_to_build.js +98 -0
- package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.d.ts.map +1 -1
- package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +4 -23
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.d.ts +53 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.js +76 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.d.ts +40 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/MipmapKernelAxis.js +43 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.d.ts +17 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_centres.js +29 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.d.ts +21 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_bilinear_sample.js +91 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.d.ts +32 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_chain_cpu.js +216 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.d.ts +30 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_cubic_filter_cpu.js +134 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.d.ts +16 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_catmull_rom_cpu.js +33 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.d.ts +18 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_cpu.js +71 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.d.ts +20 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_linear_normal_cpu.js +57 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.d.ts +18 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_magic_kernel_cpu.js +111 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.d.ts +16 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mitchell_cpu.js +33 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.d.ts +18 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_mks_cpu.js +128 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.d.ts +21 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_filter_wronski2021_cpu.js +169 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.d.ts +21 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.js +119 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.d.ts +16 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.js +19 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.d.ts +24 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.js +41 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.d.ts +24 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.js +140 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.d.ts +21 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.js +35 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.d.ts +19 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.d.ts.map +1 -0
- package/src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_to_f32.js +27 -0
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_catmull_rom.js +4 -4
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.d.ts +13 -0
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.d.ts.map +1 -1
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_linear.js +54 -4
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mitchell.js +4 -4
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mks.d.ts.map +1 -1
- package/src/shade/renderer/texture/mipmaps/filters/mipmap_shader_code_mks.js +9 -13
- package/src/shade/renderer/texture/texture_block_encodings.d.ts +33 -0
- package/src/shade/renderer/texture/texture_block_encodings.d.ts.map +1 -0
- package/src/shade/renderer/texture/texture_block_encodings.js +89 -0
- package/src/format/texture/basis/astc_block.d.ts.map +0 -1
- package/src/format/texture/basis/astc_integer_sequence.d.ts.map +0 -1
- package/src/format/texture/basis/astc_partition.d.ts.map +0 -1
- package/src/format/texture/basis/uastc/bc7_tables.d.ts +0 -111
- package/src/format/texture/basis/uastc/bc7_tables.d.ts.map +0 -1
- package/src/format/texture/basis/uastc/bc7_write_block.d.ts +0 -124
- package/src/format/texture/basis/uastc/bc7_write_block.d.ts.map +0 -1
- /package/src/format/texture/{basis → astc}/astc_integer_sequence.d.ts +0 -0
- /package/src/format/texture/{basis → astc}/astc_partition.d.ts +0 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { Sampler2D } from "../../engine/graphics/texture/sampler/Sampler2D.js";
|
|
2
|
+
import { gpu_texture_format_info } from "../../shade/descriptor/texture/format/gpu_texture_format_info.js";
|
|
3
|
+
import { TextureFormat } from "../../shade/descriptor/texture/format/TextureFormat.js";
|
|
4
|
+
import { astc_decode_block, astc_srgb_decode_block } from "./astc/astc_decode_block.js";
|
|
5
|
+
import { bc1_decode_block } from "./bc/bc1_decode_block.js";
|
|
6
|
+
import { bc2_decode_block } from "./bc/bc2_decode_block.js";
|
|
7
|
+
import { bc3_decode_block } from "./bc/bc3_decode_block.js";
|
|
8
|
+
import { bc4_snorm_decode_block } from "./bc/bc4_snorm_decode_block.js";
|
|
9
|
+
import { bc4_unorm_decode_block } from "./bc/bc4_unorm_decode_block.js";
|
|
10
|
+
import { bc5_snorm_decode_block } from "./bc/bc5_snorm_decode_block.js";
|
|
11
|
+
import { bc5_unorm_decode_block } from "./bc/bc5_unorm_decode_block.js";
|
|
12
|
+
import { bc6h_sfloat_decode_block } from "./bc/bc6h_sfloat_decode_block.js";
|
|
13
|
+
import { bc6h_ufloat_decode_block } from "./bc/bc6h_ufloat_decode_block.js";
|
|
14
|
+
import { bc7_decode_block } from "./bc/bc7_decode_block.js";
|
|
15
|
+
import { eac_r11_snorm_decode_block } from "./etc/eac_r11_snorm_decode_block.js";
|
|
16
|
+
import { eac_r11_unorm_decode_block } from "./etc/eac_r11_unorm_decode_block.js";
|
|
17
|
+
import { eac_rg11_snorm_decode_block } from "./etc/eac_rg11_snorm_decode_block.js";
|
|
18
|
+
import { eac_rg11_unorm_decode_block } from "./etc/eac_rg11_unorm_decode_block.js";
|
|
19
|
+
import { etc2_rgb8_decode_block } from "./etc/etc2_rgb8_decode_block.js";
|
|
20
|
+
import { etc2_rgb8a1_decode_block } from "./etc/etc2_rgb8a1_decode_block.js";
|
|
21
|
+
import { etc2_rgba8_decode_block } from "./etc/etc2_rgba8_decode_block.js";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* How one block is read: the decoder, and the kind of value it writes.
|
|
25
|
+
*
|
|
26
|
+
* @typedef {object} BlockReader
|
|
27
|
+
* @property {function(Uint8Array, number, (Uint8Array|Int8Array|Float32Array)):void} decode a block at an offset,
|
|
28
|
+
* as RGBA texels in raster order
|
|
29
|
+
* @property {Uint8ArrayConstructor|Int8ArrayConstructor|Float32ArrayConstructor} type
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {function(Uint8Array, number, number, number, Uint8Array):void} decode
|
|
34
|
+
* @param {GPUTextureFormat} format
|
|
35
|
+
* @returns {function(Uint8Array, number, Uint8Array):void}
|
|
36
|
+
*/
|
|
37
|
+
function astc_footprint(decode, format) {
|
|
38
|
+
const info = gpu_texture_format_info(format);
|
|
39
|
+
|
|
40
|
+
return (source, offset, out) => decode(source, offset, info.block_width, info.block_height, out);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The block formats, each with the decoder that reads it. An `-srgb` format and its linear twin are the same
|
|
45
|
+
* bytes and read the same, except where the format's own arithmetic differs (ASTC).
|
|
46
|
+
*
|
|
47
|
+
* @readonly
|
|
48
|
+
* @type {Map<GPUTextureFormat, BlockReader>}
|
|
49
|
+
*/
|
|
50
|
+
const BLOCK_READERS = new Map([
|
|
51
|
+
[TextureFormat.BC1_RGBA_UNORM, { decode: bc1_decode_block, type: Uint8Array }],
|
|
52
|
+
[TextureFormat.BC1_RGBA_UNORM_SRGB, { decode: bc1_decode_block, type: Uint8Array }],
|
|
53
|
+
[TextureFormat.BC2_RGBA_UNORM, { decode: bc2_decode_block, type: Uint8Array }],
|
|
54
|
+
[TextureFormat.BC2_RGBA_UNORM_SRGB, { decode: bc2_decode_block, type: Uint8Array }],
|
|
55
|
+
[TextureFormat.BC3_RGBA_UNORM, { decode: bc3_decode_block, type: Uint8Array }],
|
|
56
|
+
[TextureFormat.BC3_RGBA_UNORM_SRGB, { decode: bc3_decode_block, type: Uint8Array }],
|
|
57
|
+
[TextureFormat.BC4_R_UNORM, { decode: bc4_unorm_decode_block, type: Uint8Array }],
|
|
58
|
+
[TextureFormat.BC4_R_SNORM, { decode: bc4_snorm_decode_block, type: Int8Array }],
|
|
59
|
+
[TextureFormat.BC5_RG_UNORM, { decode: bc5_unorm_decode_block, type: Uint8Array }],
|
|
60
|
+
[TextureFormat.BC5_RG_SNORM, { decode: bc5_snorm_decode_block, type: Int8Array }],
|
|
61
|
+
[TextureFormat.BC6H_RGB_UFLOAT, { decode: bc6h_ufloat_decode_block, type: Float32Array }],
|
|
62
|
+
[TextureFormat.BC6H_RGB_FLOAT, { decode: bc6h_sfloat_decode_block, type: Float32Array }],
|
|
63
|
+
[TextureFormat.BC7_RGBA_UNORM, { decode: bc7_decode_block, type: Uint8Array }],
|
|
64
|
+
[TextureFormat.BC7_RGBA_UNORM_SRGB, { decode: bc7_decode_block, type: Uint8Array }],
|
|
65
|
+
[TextureFormat.ETC2_RGB8UNORM, { decode: etc2_rgb8_decode_block, type: Uint8Array }],
|
|
66
|
+
[TextureFormat.ETC2_RGB8UNORM_SRGB, { decode: etc2_rgb8_decode_block, type: Uint8Array }],
|
|
67
|
+
[TextureFormat.ETC2_RGB8A1UNORM, { decode: etc2_rgb8a1_decode_block, type: Uint8Array }],
|
|
68
|
+
[TextureFormat.ETC2_RGB8A1UNORM_SRGB, { decode: etc2_rgb8a1_decode_block, type: Uint8Array }],
|
|
69
|
+
[TextureFormat.ETC2_RGBA8UNORM, { decode: etc2_rgba8_decode_block, type: Uint8Array }],
|
|
70
|
+
[TextureFormat.ETC2_RGBA8UNORM_SRGB, { decode: etc2_rgba8_decode_block, type: Uint8Array }],
|
|
71
|
+
[TextureFormat.EAC_R11UNORM, { decode: eac_r11_unorm_decode_block, type: Uint8Array }],
|
|
72
|
+
[TextureFormat.EAC_R11SNORM, { decode: eac_r11_snorm_decode_block, type: Int8Array }],
|
|
73
|
+
[TextureFormat.EAC_RG11UNORM, { decode: eac_rg11_unorm_decode_block, type: Uint8Array }],
|
|
74
|
+
[TextureFormat.EAC_RG11SNORM, { decode: eac_rg11_snorm_decode_block, type: Int8Array }],
|
|
75
|
+
]);
|
|
76
|
+
|
|
77
|
+
for (const [linear, srgb] of [
|
|
78
|
+
[TextureFormat.ASTC_4X4_UNORM, TextureFormat.ASTC_4X4_UNORM_SRGB],
|
|
79
|
+
[TextureFormat.ASTC_5X4_UNORM, TextureFormat.ASTC_5X4_UNORM_SRGB],
|
|
80
|
+
[TextureFormat.ASTC_5X5_UNORM, TextureFormat.ASTC_5X5_UNORM_SRGB],
|
|
81
|
+
[TextureFormat.ASTC_6X5_UNORM, TextureFormat.ASTC_6X5_UNORM_SRGB],
|
|
82
|
+
[TextureFormat.ASTC_6X6_UNORM, TextureFormat.ASTC_6X6_UNORM_SRGB],
|
|
83
|
+
[TextureFormat.ASTC_8X5_UNORM, TextureFormat.ASTC_8X5_UNORM_SRGB],
|
|
84
|
+
[TextureFormat.ASTC_8X6_UNORM, TextureFormat.ASTC_8X6_UNORM_SRGB],
|
|
85
|
+
[TextureFormat.ASTC_8X8_UNORM, TextureFormat.ASTC_8X8_UNORM_SRGB],
|
|
86
|
+
[TextureFormat.ASTC_10X5_UNORM, TextureFormat.ASTC_10X5_UNORM_SRGB],
|
|
87
|
+
[TextureFormat.ASTC_10X6_UNORM, TextureFormat.ASTC_10X6_UNORM_SRGB],
|
|
88
|
+
[TextureFormat.ASTC_10X8_UNORM, TextureFormat.ASTC_10X8_UNORM_SRGB],
|
|
89
|
+
[TextureFormat.ASTC_10X10_UNORM, TextureFormat.ASTC_10X10_UNORM_SRGB],
|
|
90
|
+
[TextureFormat.ASTC_12X10_UNORM, TextureFormat.ASTC_12X10_UNORM_SRGB],
|
|
91
|
+
[TextureFormat.ASTC_12X12_UNORM, TextureFormat.ASTC_12X12_UNORM_SRGB],
|
|
92
|
+
]) {
|
|
93
|
+
BLOCK_READERS.set(linear, { decode: astc_footprint(astc_decode_block, linear), type: Uint8Array });
|
|
94
|
+
BLOCK_READERS.set(srgb, { decode: astc_footprint(astc_srgb_decode_block, srgb), type: Uint8Array });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The eight-bit texel formats: which byte of a texel each of R, G, B and A comes from, `-1` for a channel the
|
|
99
|
+
* format lacks.
|
|
100
|
+
*
|
|
101
|
+
* @readonly
|
|
102
|
+
* @type {Map<GPUTextureFormat, {channels: number[], type: Uint8ArrayConstructor|Int8ArrayConstructor}>}
|
|
103
|
+
*/
|
|
104
|
+
const TEXEL_READERS = new Map([
|
|
105
|
+
[TextureFormat.R8UNORM, { channels: [0, -1, -1, -1], type: Uint8Array }],
|
|
106
|
+
[TextureFormat.RG8UNORM, { channels: [0, 1, -1, -1], type: Uint8Array }],
|
|
107
|
+
[TextureFormat.RGBA8UNORM, { channels: [0, 1, 2, 3], type: Uint8Array }],
|
|
108
|
+
[TextureFormat.RGBA8UNORM_SRGB, { channels: [0, 1, 2, 3], type: Uint8Array }],
|
|
109
|
+
[TextureFormat.BGRA8UNORM, { channels: [2, 1, 0, 3], type: Uint8Array }],
|
|
110
|
+
[TextureFormat.BGRA8UNORM_SRGB, { channels: [2, 1, 0, 3], type: Uint8Array }],
|
|
111
|
+
[TextureFormat.R8SNORM, { channels: [0, -1, -1, -1], type: Int8Array }],
|
|
112
|
+
[TextureFormat.RG8SNORM, { channels: [0, 1, -1, -1], type: Int8Array }],
|
|
113
|
+
[TextureFormat.RGBA8SNORM, { channels: [0, 1, 2, 3], type: Int8Array }],
|
|
114
|
+
]);
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* The most a block decoder writes: a 12x12 ASTC block, four values a texel.
|
|
118
|
+
*
|
|
119
|
+
* @type {Float32Array}
|
|
120
|
+
*/
|
|
121
|
+
const scratch_float = new Float32Array(12 * 12 * 4);
|
|
122
|
+
const scratch_unorm = new Uint8Array(12 * 12 * 4);
|
|
123
|
+
const scratch_snorm = new Int8Array(12 * 12 * 4);
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* @param {Uint8ArrayConstructor|Int8ArrayConstructor|Float32ArrayConstructor} type
|
|
127
|
+
* @returns {Uint8Array|Int8Array|Float32Array}
|
|
128
|
+
*/
|
|
129
|
+
function scratch_of(type) {
|
|
130
|
+
if (type === Float32Array) {
|
|
131
|
+
return scratch_float;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return type === Int8Array ? scratch_snorm : scratch_unorm;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Whether {@link texel_decode_image} reads this format.
|
|
139
|
+
*
|
|
140
|
+
* @param {GPUTextureFormat} format
|
|
141
|
+
* @returns {boolean}
|
|
142
|
+
*/
|
|
143
|
+
export function texel_decode_image_reads(format) {
|
|
144
|
+
return BLOCK_READERS.has(format) || TEXEL_READERS.has(format);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* One image of texels in a GPU format, as pixels.
|
|
149
|
+
*
|
|
150
|
+
* Every block-compressed format WebGPU names is read, by the format's own decoder, and so are the eight-bit
|
|
151
|
+
* texel formats. The result is always four channels, RGBA, with a channel the format lacks filled as a GPU
|
|
152
|
+
* samples it: zero for colour, one for alpha. Values are the format's own: an `-srgb` format gives the encoded
|
|
153
|
+
* bytes, unconverted.
|
|
154
|
+
*
|
|
155
|
+
* - `Uint8Array` for every unorm format,
|
|
156
|
+
* - `Int8Array` for every snorm format, `-127` to `127`,
|
|
157
|
+
* - `Float32Array` for BC6H.
|
|
158
|
+
*
|
|
159
|
+
* @param {GPUTextureFormat} format
|
|
160
|
+
* @param {number} width texels
|
|
161
|
+
* @param {number} height texels
|
|
162
|
+
* @param {Uint8Array} bytes the image's blocks (or texels) in tightly packed rows, as a level of a texture file
|
|
163
|
+
* holds them; not kept
|
|
164
|
+
* @returns {Sampler2D} itemSize 4, `width` by `height`
|
|
165
|
+
* @throws {Error} for a format nothing here reads, and for bytes too few for the image
|
|
166
|
+
*
|
|
167
|
+
* @author Alex Goldring
|
|
168
|
+
* @copyright Company Named Limited (c) 2026
|
|
169
|
+
*/
|
|
170
|
+
export function texel_decode_image(format, width, height, bytes) {
|
|
171
|
+
const info = gpu_texture_format_info(format);
|
|
172
|
+
|
|
173
|
+
const blocks_x = Math.ceil(width / info.block_width);
|
|
174
|
+
const blocks_y = Math.ceil(height / info.block_height);
|
|
175
|
+
const needed = blocks_x * blocks_y * info.bytes_per_block;
|
|
176
|
+
|
|
177
|
+
if (!texel_decode_image_reads(format)) {
|
|
178
|
+
throw new Error(`'${format}' texels are not read here: nothing decodes them to pixels`);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (bytes.length < needed) {
|
|
182
|
+
throw new Error(`a ${width}x${height} image of '${format}' is ${needed} bytes, and ${bytes.length} were given`);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const texel_reader = TEXEL_READERS.get(format);
|
|
186
|
+
|
|
187
|
+
if (texel_reader !== undefined) {
|
|
188
|
+
return read_texels(texel_reader, info.bytes_per_block, width, height, bytes);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const reader = BLOCK_READERS.get(format);
|
|
192
|
+
const data = new reader.type(width * height * 4);
|
|
193
|
+
const block = scratch_of(reader.type);
|
|
194
|
+
|
|
195
|
+
const block_width = info.block_width;
|
|
196
|
+
const block_height = info.block_height;
|
|
197
|
+
|
|
198
|
+
for (let by = 0; by < blocks_y; by++) {
|
|
199
|
+
for (let bx = 0; bx < blocks_x; bx++) {
|
|
200
|
+
reader.decode(bytes, (by * blocks_x + bx) * info.bytes_per_block, block);
|
|
201
|
+
|
|
202
|
+
// the part of the block inside the image
|
|
203
|
+
const x0 = bx * block_width;
|
|
204
|
+
const y0 = by * block_height;
|
|
205
|
+
const columns = Math.min(block_width, width - x0);
|
|
206
|
+
const rows = Math.min(block_height, height - y0);
|
|
207
|
+
|
|
208
|
+
for (let row = 0; row < rows; row++) {
|
|
209
|
+
const from = row * block_width * 4;
|
|
210
|
+
|
|
211
|
+
data.set(block.subarray(from, from + columns * 4), ((y0 + row) * width + x0) * 4);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return new Sampler2D(data, 4, width, height);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @param {{channels: number[], type: Uint8ArrayConstructor|Int8ArrayConstructor}} reader
|
|
221
|
+
* @param {number} stride bytes a texel
|
|
222
|
+
* @param {number} width
|
|
223
|
+
* @param {number} height
|
|
224
|
+
* @param {Uint8Array} bytes
|
|
225
|
+
* @returns {Sampler2D}
|
|
226
|
+
*/
|
|
227
|
+
function read_texels(reader, stride, width, height, bytes) {
|
|
228
|
+
const count = width * height;
|
|
229
|
+
const data = new reader.type(count * 4);
|
|
230
|
+
|
|
231
|
+
// the bytes as the format's own values: a signed format's bytes are two's complement
|
|
232
|
+
const values = reader.type === Int8Array
|
|
233
|
+
? new Int8Array(bytes.buffer, bytes.byteOffset, count * stride)
|
|
234
|
+
: bytes;
|
|
235
|
+
|
|
236
|
+
const one = reader.type === Int8Array ? 127 : 255;
|
|
237
|
+
|
|
238
|
+
for (let c = 0; c < 4; c++) {
|
|
239
|
+
const channel = reader.channels[c];
|
|
240
|
+
const absent = c === 3 ? one : 0;
|
|
241
|
+
|
|
242
|
+
for (let i = 0; i < count; i++) {
|
|
243
|
+
data[i * 4 + c] = channel < 0
|
|
244
|
+
? absent
|
|
245
|
+
// a snorm byte of -128 reads as -1, the same as -127
|
|
246
|
+
: Math.max(values[i * stride + channel], -127);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return new Sampler2D(data, 4, width, height);
|
|
251
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether {@link texel_encode_image} writes this format.
|
|
3
|
+
*
|
|
4
|
+
* @param {GPUTextureFormat} format
|
|
5
|
+
* @returns {boolean}
|
|
6
|
+
*/
|
|
7
|
+
export function texel_encode_image_writes(format: GPUTextureFormat): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Whether the blocks {@link texel_encode_image} writes in this format hold the image's alpha.
|
|
10
|
+
*
|
|
11
|
+
* @param {GPUTextureFormat} format
|
|
12
|
+
* @returns {boolean}
|
|
13
|
+
* @throws {Error} for a format nothing here encodes
|
|
14
|
+
*/
|
|
15
|
+
export function texel_encode_stores_alpha(format: GPUTextureFormat): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Pixels as one image of blocks in a GPU format.
|
|
18
|
+
*
|
|
19
|
+
* Each block is the format's encoder over the block's sixteen texels. A block reaching past the image's right or
|
|
20
|
+
* bottom edge repeats the last column or row. The image may be any size; a texture of a block format needs its base
|
|
21
|
+
* level to be whole blocks, which is the caller's to arrange. For a texture whose alpha nobody reads,
|
|
22
|
+
* {@link texel_encode_image_rgb}.
|
|
23
|
+
*
|
|
24
|
+
* @param {GPUTextureFormat} format one of {@link texel_encode_image_writes}
|
|
25
|
+
* @param {import("../../engine/graphics/texture/sampler/Sampler2D.js").Sampler2D} image RGBA: itemSize 4, a
|
|
26
|
+
* `Uint8Array` for a unorm format, an `Int8Array` for a snorm one
|
|
27
|
+
* @returns {Uint8Array} the blocks, in tightly packed rows
|
|
28
|
+
* @throws {Error} for a format nothing here encodes; for pixels of the wrong kind
|
|
29
|
+
*
|
|
30
|
+
* @author Alex Goldring
|
|
31
|
+
* @copyright Company Named Limited (c) 2026
|
|
32
|
+
*/
|
|
33
|
+
export function texel_encode_image(format: GPUTextureFormat, image: import("../../engine/graphics/texture/sampler/Sampler2D.js").Sampler2D): Uint8Array;
|
|
34
|
+
/**
|
|
35
|
+
* Pixels as one image of blocks in a GPU format, for a texture whose alpha nobody reads.
|
|
36
|
+
*
|
|
37
|
+
* As {@link texel_encode_image}, except that the image's alpha is not read: each block is fitted to the colour
|
|
38
|
+
* channels its format holds and to nothing else, and what a block decodes to in alpha is whatever served the
|
|
39
|
+
* colour. In BC7 that frees the low bit each end's channels share with alpha, which an opaque alpha would otherwise
|
|
40
|
+
* take: alpha decodes 254 or 255. A format whose encoder reads no alpha writes what {@link texel_encode_image}
|
|
41
|
+
* writes, and one that holds no alpha does not refuse an image whose alpha is not opaque.
|
|
42
|
+
*
|
|
43
|
+
* @param {GPUTextureFormat} format one of {@link texel_encode_image_writes}
|
|
44
|
+
* @param {import("../../engine/graphics/texture/sampler/Sampler2D.js").Sampler2D} image RGBA: itemSize 4, a
|
|
45
|
+
* `Uint8Array` for a unorm format, an `Int8Array` for a snorm one
|
|
46
|
+
* @returns {Uint8Array} the blocks, in tightly packed rows
|
|
47
|
+
* @throws {Error} for a format nothing here encodes; for pixels of the wrong kind
|
|
48
|
+
*
|
|
49
|
+
* @author Alex Goldring
|
|
50
|
+
* @copyright Company Named Limited (c) 2026
|
|
51
|
+
*/
|
|
52
|
+
export function texel_encode_image_rgb(format: GPUTextureFormat, image: import("../../engine/graphics/texture/sampler/Sampler2D.js").Sampler2D): Uint8Array;
|
|
53
|
+
/**
|
|
54
|
+
* How one block is written.
|
|
55
|
+
*/
|
|
56
|
+
export type BlockWriter = {
|
|
57
|
+
/**
|
|
58
|
+
* sixteen RGBA texels to one block
|
|
59
|
+
*/
|
|
60
|
+
encode: (arg0: (Uint8Array | Int8Array), arg1: Uint8Array, arg2: number) => void;
|
|
61
|
+
/**
|
|
62
|
+
* sixteen RGBA texels to one block
|
|
63
|
+
* whose alpha nobody reads: alpha is not read, and the channels the format holds are fitted alone. For a format whose
|
|
64
|
+
* encoder reads no alpha anyway, the same function as `encode`
|
|
65
|
+
*/
|
|
66
|
+
encode_rgb: (arg0: (Uint8Array | Int8Array), arg1: Uint8Array, arg2: number) => void;
|
|
67
|
+
/**
|
|
68
|
+
* whether it takes snorm pixels (`Int8Array`) rather than unorm ones (`Uint8Array`)
|
|
69
|
+
*/
|
|
70
|
+
signed: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* whether the block holds alpha: every format here with an alpha channel does, and one
|
|
73
|
+
* without holds none by its nature
|
|
74
|
+
*/
|
|
75
|
+
alpha: boolean;
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=texel_encode_image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texel_encode_image.d.ts","sourceRoot":"","sources":["../../../../src/format/texture/texel_encode_image.js"],"names":[],"mappings":"AA6CA;;;;;GAKG;AACH,qEAFa,OAAO,CAInB;AAED;;;;;;GAMG;AACH,qEAHa,OAAO,CAWnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,oEARW,OAAO,oDAAoD,EAAE,SAAS,GAEpE,UAAU,CAUtB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wEARW,OAAO,oDAAoD,EAAE,SAAS,GAEpE,UAAU,CAUtB;;;;;;;;mBA1GsB,CAAC,UAAU,GAAC,SAAS,CAAC,QAAE,UAAU,QAAE,MAAM,KAAE,IAAI;;;;;;uBAChD,CAAC,UAAU,GAAC,SAAS,CAAC,QAAE,UAAU,QAAE,MAAM,KAAE,IAAI;;;;YAGzD,OAAO;;;;;WACP,OAAO"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { gpu_texture_format_info } from "../../shade/descriptor/texture/format/gpu_texture_format_info.js";
|
|
2
|
+
import { TextureFormat } from "../../shade/descriptor/texture/format/TextureFormat.js";
|
|
3
|
+
import { astc_encode_block_4x4, astc_encode_block_4x4_rgb } from "./astc/astc_encode_block_4x4.js";
|
|
4
|
+
import { bc4_snorm_encode_block, bc4_unorm_encode_block } from "./bc/bc4_encode_block.js";
|
|
5
|
+
import { bc5_snorm_encode_block, bc5_unorm_encode_block } from "./bc/bc5_encode_block.js";
|
|
6
|
+
import { bc7_encode_block, bc7_encode_block_rgb } from "./bc/bc7_encode_block.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* How one block is written.
|
|
10
|
+
*
|
|
11
|
+
* @typedef {object} BlockWriter
|
|
12
|
+
* @property {function((Uint8Array|Int8Array), Uint8Array, number):void} encode sixteen RGBA texels to one block
|
|
13
|
+
* @property {function((Uint8Array|Int8Array), Uint8Array, number):void} encode_rgb sixteen RGBA texels to one block
|
|
14
|
+
* whose alpha nobody reads: alpha is not read, and the channels the format holds are fitted alone. For a format whose
|
|
15
|
+
* encoder reads no alpha anyway, the same function as `encode`
|
|
16
|
+
* @property {boolean} signed whether it takes snorm pixels (`Int8Array`) rather than unorm ones (`Uint8Array`)
|
|
17
|
+
* @property {boolean} alpha whether the block holds alpha: every format here with an alpha channel does, and one
|
|
18
|
+
* without holds none by its nature
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The formats meep encodes on the CPU, each with its encoder. An `-srgb` format is its linear twin's bytes.
|
|
23
|
+
*
|
|
24
|
+
* @readonly
|
|
25
|
+
* @type {Map<GPUTextureFormat, BlockWriter>}
|
|
26
|
+
*/
|
|
27
|
+
const BLOCK_WRITERS = new Map([
|
|
28
|
+
[TextureFormat.BC4_R_UNORM, { encode: bc4_unorm_encode_block, encode_rgb: bc4_unorm_encode_block, signed: false, alpha: false }],
|
|
29
|
+
[TextureFormat.BC4_R_SNORM, { encode: bc4_snorm_encode_block, encode_rgb: bc4_snorm_encode_block, signed: true, alpha: false }],
|
|
30
|
+
[TextureFormat.BC5_RG_UNORM, { encode: bc5_unorm_encode_block, encode_rgb: bc5_unorm_encode_block, signed: false, alpha: false }],
|
|
31
|
+
[TextureFormat.BC5_RG_SNORM, { encode: bc5_snorm_encode_block, encode_rgb: bc5_snorm_encode_block, signed: true, alpha: false }],
|
|
32
|
+
[TextureFormat.BC7_RGBA_UNORM, { encode: bc7_encode_block, encode_rgb: bc7_encode_block_rgb, signed: false, alpha: true }],
|
|
33
|
+
[TextureFormat.BC7_RGBA_UNORM_SRGB, { encode: bc7_encode_block, encode_rgb: bc7_encode_block_rgb, signed: false, alpha: true }],
|
|
34
|
+
[TextureFormat.ASTC_4X4_UNORM, { encode: astc_encode_block_4x4, encode_rgb: astc_encode_block_4x4_rgb, signed: false, alpha: true }],
|
|
35
|
+
[TextureFormat.ASTC_4X4_UNORM_SRGB, { encode: astc_encode_block_4x4, encode_rgb: astc_encode_block_4x4_rgb, signed: false, alpha: true }],
|
|
36
|
+
]);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* One block's texels, as the encoders take them: RGBA bytes, signed for the snorm formats.
|
|
40
|
+
*
|
|
41
|
+
* @type {Uint8Array}
|
|
42
|
+
*/
|
|
43
|
+
const scratch_unorm = new Uint8Array(64);
|
|
44
|
+
const scratch_snorm = new Int8Array(64);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Whether {@link texel_encode_image} writes this format.
|
|
48
|
+
*
|
|
49
|
+
* @param {GPUTextureFormat} format
|
|
50
|
+
* @returns {boolean}
|
|
51
|
+
*/
|
|
52
|
+
export function texel_encode_image_writes(format) {
|
|
53
|
+
return BLOCK_WRITERS.has(format);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Whether the blocks {@link texel_encode_image} writes in this format hold the image's alpha.
|
|
58
|
+
*
|
|
59
|
+
* @param {GPUTextureFormat} format
|
|
60
|
+
* @returns {boolean}
|
|
61
|
+
* @throws {Error} for a format nothing here encodes
|
|
62
|
+
*/
|
|
63
|
+
export function texel_encode_stores_alpha(format) {
|
|
64
|
+
const writer = BLOCK_WRITERS.get(format);
|
|
65
|
+
|
|
66
|
+
if (writer === undefined) {
|
|
67
|
+
throw new Error(`'${format}' is not encoded here`);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return writer.alpha;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Pixels as one image of blocks in a GPU format.
|
|
75
|
+
*
|
|
76
|
+
* Each block is the format's encoder over the block's sixteen texels. A block reaching past the image's right or
|
|
77
|
+
* bottom edge repeats the last column or row. The image may be any size; a texture of a block format needs its base
|
|
78
|
+
* level to be whole blocks, which is the caller's to arrange. For a texture whose alpha nobody reads,
|
|
79
|
+
* {@link texel_encode_image_rgb}.
|
|
80
|
+
*
|
|
81
|
+
* @param {GPUTextureFormat} format one of {@link texel_encode_image_writes}
|
|
82
|
+
* @param {import("../../engine/graphics/texture/sampler/Sampler2D.js").Sampler2D} image RGBA: itemSize 4, a
|
|
83
|
+
* `Uint8Array` for a unorm format, an `Int8Array` for a snorm one
|
|
84
|
+
* @returns {Uint8Array} the blocks, in tightly packed rows
|
|
85
|
+
* @throws {Error} for a format nothing here encodes; for pixels of the wrong kind
|
|
86
|
+
*
|
|
87
|
+
* @author Alex Goldring
|
|
88
|
+
* @copyright Company Named Limited (c) 2026
|
|
89
|
+
*/
|
|
90
|
+
export function texel_encode_image(format, image) {
|
|
91
|
+
const writer = block_writer(format, image);
|
|
92
|
+
|
|
93
|
+
return encode_blocks(format, image, writer.encode, writer.signed);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Pixels as one image of blocks in a GPU format, for a texture whose alpha nobody reads.
|
|
98
|
+
*
|
|
99
|
+
* As {@link texel_encode_image}, except that the image's alpha is not read: each block is fitted to the colour
|
|
100
|
+
* channels its format holds and to nothing else, and what a block decodes to in alpha is whatever served the
|
|
101
|
+
* colour. In BC7 that frees the low bit each end's channels share with alpha, which an opaque alpha would otherwise
|
|
102
|
+
* take: alpha decodes 254 or 255. A format whose encoder reads no alpha writes what {@link texel_encode_image}
|
|
103
|
+
* writes, and one that holds no alpha does not refuse an image whose alpha is not opaque.
|
|
104
|
+
*
|
|
105
|
+
* @param {GPUTextureFormat} format one of {@link texel_encode_image_writes}
|
|
106
|
+
* @param {import("../../engine/graphics/texture/sampler/Sampler2D.js").Sampler2D} image RGBA: itemSize 4, a
|
|
107
|
+
* `Uint8Array` for a unorm format, an `Int8Array` for a snorm one
|
|
108
|
+
* @returns {Uint8Array} the blocks, in tightly packed rows
|
|
109
|
+
* @throws {Error} for a format nothing here encodes; for pixels of the wrong kind
|
|
110
|
+
*
|
|
111
|
+
* @author Alex Goldring
|
|
112
|
+
* @copyright Company Named Limited (c) 2026
|
|
113
|
+
*/
|
|
114
|
+
export function texel_encode_image_rgb(format, image) {
|
|
115
|
+
const writer = block_writer(format, image);
|
|
116
|
+
|
|
117
|
+
return encode_blocks(format, image, writer.encode_rgb, writer.signed);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @param {GPUTextureFormat} format
|
|
122
|
+
* @param {import("../../engine/graphics/texture/sampler/Sampler2D.js").Sampler2D} image
|
|
123
|
+
* @returns {BlockWriter} the format's, once the pixels are of the kind it takes
|
|
124
|
+
* @throws {Error} for a format nothing here encodes; for pixels of the wrong kind
|
|
125
|
+
*/
|
|
126
|
+
function block_writer(format, image) {
|
|
127
|
+
const writer = BLOCK_WRITERS.get(format);
|
|
128
|
+
|
|
129
|
+
if (writer === undefined) {
|
|
130
|
+
throw new Error(`'${format}' is not encoded here: there is no CPU encoder for it`);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const kind = writer.signed ? Int8Array : Uint8Array;
|
|
134
|
+
|
|
135
|
+
if (!(image.data instanceof kind)) {
|
|
136
|
+
throw new Error(`'${format}' is encoded from ${kind.name} pixels, and was given ${image.data.constructor.name}`);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (image.itemSize !== 4) {
|
|
140
|
+
throw new Error(`pixels to encode are RGBA, 4 channels, and were given ${image.itemSize}`);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return writer;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Every block of an image by one block encoder.
|
|
148
|
+
*
|
|
149
|
+
* @param {GPUTextureFormat} format
|
|
150
|
+
* @param {import("../../engine/graphics/texture/sampler/Sampler2D.js").Sampler2D} image
|
|
151
|
+
* @param {function((Uint8Array|Int8Array), Uint8Array, number):void} encode
|
|
152
|
+
* @param {boolean} signed whether the pixels are snorm
|
|
153
|
+
* @returns {Uint8Array}
|
|
154
|
+
*/
|
|
155
|
+
function encode_blocks(format, image, encode, signed) {
|
|
156
|
+
const width = image.width;
|
|
157
|
+
const height = image.height;
|
|
158
|
+
const data = image.data;
|
|
159
|
+
|
|
160
|
+
const info = gpu_texture_format_info(format);
|
|
161
|
+
|
|
162
|
+
const blocks_x = Math.ceil(width / 4);
|
|
163
|
+
const blocks_y = Math.ceil(height / 4);
|
|
164
|
+
|
|
165
|
+
const out = new Uint8Array(blocks_x * blocks_y * info.bytes_per_block);
|
|
166
|
+
|
|
167
|
+
const block = signed ? scratch_snorm : scratch_unorm;
|
|
168
|
+
|
|
169
|
+
for (let by = 0; by < blocks_y; by++) {
|
|
170
|
+
for (let bx = 0; bx < blocks_x; bx++) {
|
|
171
|
+
for (let i = 0; i < 16; i++) {
|
|
172
|
+
const x = Math.min(bx * 4 + (i & 3), width - 1);
|
|
173
|
+
const y = Math.min(by * 4 + (i >> 2), height - 1);
|
|
174
|
+
|
|
175
|
+
const from = (y * width + x) * 4;
|
|
176
|
+
|
|
177
|
+
for (let c = 0; c < 4; c++) {
|
|
178
|
+
block[i * 4 + c] = data[from + c];
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
encode(block, out, (by * blocks_x + bx) * info.bytes_per_block);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return out;
|
|
187
|
+
}
|
|
@@ -10,6 +10,8 @@ export const ShadeIndirectLightingMode = {
|
|
|
10
10
|
/** Sparse Volumetric Lightmap (Brick4) */
|
|
11
11
|
Brick4: 1,
|
|
12
12
|
/**
|
|
13
|
+
* @deprecated use {@link ScreenProbes} instead
|
|
14
|
+
*
|
|
13
15
|
* Probes on a 3-D clipmap around the camera, traced against a clipmap of SDF bricks
|
|
14
16
|
* (`global_illumination/probe_clipmap/PROBE_CLIPMAP_PROPOSAL_2026_10_27.md`). Settings are
|
|
15
17
|
* `Renderer.probe_clipmap`. Lit as {@link IBL} until its probes are traced (that proposal's §13, S4).
|
|
@@ -55,7 +55,7 @@ export class GPUAcousticLattice {
|
|
|
55
55
|
* @param {number} gz
|
|
56
56
|
* @returns {number} the point's storage index: storage wraps, as the clipmaps' does
|
|
57
57
|
*/
|
|
58
|
-
static "__#
|
|
58
|
+
static "__#615@#storage"(c: number, gx: number, gy: number, gz: number): number;
|
|
59
59
|
/**
|
|
60
60
|
* @param {GPUAcoustics} acoustics whose receivers the points are
|
|
61
61
|
* @param {number} radius metres: the default source's, which the points stand for
|
|
@@ -39,7 +39,7 @@ export class GPUAcoustics {
|
|
|
39
39
|
* @param {*} resources
|
|
40
40
|
* @param {{encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
|
|
41
41
|
*/
|
|
42
|
-
static "__#
|
|
42
|
+
static "__#614@#execute"(pass: object, resources: any, context: {
|
|
43
43
|
encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
|
|
44
44
|
}): void;
|
|
45
45
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export function mtf_encode_texture(texture: ShadeTexture, role: TextureRole | number, stem: string, files: Map<string, ArrayBuffer>): Promise<TextureVariantSet>;
|
|
2
2
|
export type ShadeTexture = import("../../texture/ShadeTexture.js").ShadeTexture;
|
|
3
3
|
export type TextureRole = import("../../texture/TextureRole.js").TextureRole;
|
|
4
|
+
export type ShadeTexelData = import("../../texture/source/ShadeTexelData.js").ShadeTexelData;
|
|
4
5
|
/**
|
|
5
6
|
* What {@link mtf_export } asks for the files of one texture.
|
|
6
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mtf_encode_texture.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_encode_texture.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mtf_encode_texture.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_encode_texture.js"],"names":[],"mappings":"AAsBG,4CACQ,YAAY,QACZ,WAAW,GAAC,MAAM,QAClB,MAAM,SAEN,IAAI,MAAM,EAAE,WAAW,CAAC,GAEtB,QAAQ,iBAAiB,CAAC,CACtC;2BAhBY,OAAO,+BAA+B,EAAE,YAAY;0BACpD,OAAO,8BAA8B,EAAE,WAAW;6BAClD,OAAO,wCAAwC,EAAE,cAAc;;;;0CAOjE,YAAY,QACZ,WAAW,GAAC,MAAM,QAClB,MAAM,SAEN,IAAI,MAAM,EAAE,WAAW,CAAC,KAEtB,QAAQ,iBAAiB,CAAC;kCAnBL,oCAAoC"}
|