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