@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,21 @@
|
|
|
1
|
+
import { etc2_decode_color } from "./etc2_decode_color.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Decode one `etc2-rgb8unorm` (or `-srgb`) block to sixteen texels.
|
|
5
|
+
*
|
|
6
|
+
* Every mode the specification defines: ETC1's individual and differential modes, and ETC2's T, H
|
|
7
|
+
* and planar modes, selected as the specification selects them. Alpha is 255. The `-srgb` variant
|
|
8
|
+
* is the same blocks and decodes to the same bytes.
|
|
9
|
+
*
|
|
10
|
+
* @param {Uint8Array} source
|
|
11
|
+
* @param {number} offset byte offset of the eight-byte block in `source`
|
|
12
|
+
* @param {Uint8Array} out receives sixteen texels in raster order, RGBA
|
|
13
|
+
*
|
|
14
|
+
* @see Khronos Data Format Specification 1.3, section 22.1
|
|
15
|
+
* @see OpenGL ES 3.0 Specification, section C.1.1
|
|
16
|
+
* @author Alex Goldring
|
|
17
|
+
* @copyright Company Named Limited (c) 2026
|
|
18
|
+
*/
|
|
19
|
+
export function etc2_rgb8_decode_block(source, offset, out) {
|
|
20
|
+
etc2_decode_color(source, offset, false, out);
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decode one `etc2-rgb8a1unorm` (or `-srgb`) block, ETC2 with punch-through alpha, to sixteen texels.
|
|
3
|
+
*
|
|
4
|
+
* As the specification defines it: there is no individual mode, and bit 33 is the opaque bit. With
|
|
5
|
+
* it set the block decodes as the RGB8 block with the same bits. With it clear, the differential
|
|
6
|
+
* mode's tables keep only their large modifiers (a pixel index of 0, 1, 3 selects 0, +b, -b), and in
|
|
7
|
+
* the differential, T and H modes pixel index 2 is transparent black, (0, 0, 0, 0). The planar mode
|
|
8
|
+
* is opaque whatever the bit says. Every other texel has alpha 255. The `-srgb` variant is the same
|
|
9
|
+
* blocks and decodes to the same bytes.
|
|
10
|
+
*
|
|
11
|
+
* @param {Uint8Array} source
|
|
12
|
+
* @param {number} offset byte offset of the eight-byte block in `source`
|
|
13
|
+
* @param {Uint8Array} out receives sixteen texels in raster order, RGBA
|
|
14
|
+
*
|
|
15
|
+
* @see Khronos Data Format Specification 1.3, section 22.9
|
|
16
|
+
* @see OpenGL ES 3.0 Specification, section C.1.9
|
|
17
|
+
* @author Alex Goldring
|
|
18
|
+
* @copyright Company Named Limited (c) 2026
|
|
19
|
+
*/
|
|
20
|
+
export function etc2_rgb8a1_decode_block(source: Uint8Array, offset: number, out: Uint8Array): void;
|
|
21
|
+
//# sourceMappingURL=etc2_rgb8a1_decode_block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"etc2_rgb8a1_decode_block.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/etc/etc2_rgb8a1_decode_block.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,iDATW,UAAU,UACV,MAAM,OACN,UAAU,QASpB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { etc2_decode_color } from "./etc2_decode_color.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Decode one `etc2-rgb8a1unorm` (or `-srgb`) block, ETC2 with punch-through alpha, to sixteen texels.
|
|
5
|
+
*
|
|
6
|
+
* As the specification defines it: there is no individual mode, and bit 33 is the opaque bit. With
|
|
7
|
+
* it set the block decodes as the RGB8 block with the same bits. With it clear, the differential
|
|
8
|
+
* mode's tables keep only their large modifiers (a pixel index of 0, 1, 3 selects 0, +b, -b), and in
|
|
9
|
+
* the differential, T and H modes pixel index 2 is transparent black, (0, 0, 0, 0). The planar mode
|
|
10
|
+
* is opaque whatever the bit says. Every other texel has alpha 255. The `-srgb` variant is the same
|
|
11
|
+
* blocks and decodes to the same bytes.
|
|
12
|
+
*
|
|
13
|
+
* @param {Uint8Array} source
|
|
14
|
+
* @param {number} offset byte offset of the eight-byte block in `source`
|
|
15
|
+
* @param {Uint8Array} out receives sixteen texels in raster order, RGBA
|
|
16
|
+
*
|
|
17
|
+
* @see Khronos Data Format Specification 1.3, section 22.9
|
|
18
|
+
* @see OpenGL ES 3.0 Specification, section C.1.9
|
|
19
|
+
* @author Alex Goldring
|
|
20
|
+
* @copyright Company Named Limited (c) 2026
|
|
21
|
+
*/
|
|
22
|
+
export function etc2_rgb8a1_decode_block(source, offset, out) {
|
|
23
|
+
etc2_decode_color(source, offset, true, out);
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decode one `etc2-rgba8unorm` (or `-srgb`) block to sixteen texels.
|
|
3
|
+
*
|
|
4
|
+
* The block is sixteen bytes: an EAC block holding alpha, decoded in the specification's eight-bit
|
|
5
|
+
* arithmetic, then an ETC2 RGB8 block holding colour, decoded with every one of its modes. The
|
|
6
|
+
* `-srgb` variant is the same blocks and decodes to the same bytes.
|
|
7
|
+
*
|
|
8
|
+
* @param {Uint8Array} source
|
|
9
|
+
* @param {number} offset byte offset of the sixteen-byte block in `source`
|
|
10
|
+
* @param {Uint8Array} out receives sixteen texels in raster order, RGBA
|
|
11
|
+
*
|
|
12
|
+
* @see Khronos Data Format Specification 1.3, section 22.3
|
|
13
|
+
* @see OpenGL ES 3.0 Specification, section C.1.3
|
|
14
|
+
* @author Alex Goldring
|
|
15
|
+
* @copyright Company Named Limited (c) 2026
|
|
16
|
+
*/
|
|
17
|
+
export function etc2_rgba8_decode_block(source: Uint8Array, offset: number, out: Uint8Array): void;
|
|
18
|
+
//# sourceMappingURL=etc2_rgba8_decode_block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"etc2_rgba8_decode_block.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/etc/etc2_rgba8_decode_block.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;GAeG;AACH,gDATW,UAAU,UACV,MAAM,OACN,UAAU,QAWpB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { eac_decode_channel_alpha8 } from "./eac_decode_channel.js";
|
|
2
|
+
import { etc2_decode_color } from "./etc2_decode_color.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Decode one `etc2-rgba8unorm` (or `-srgb`) block to sixteen texels.
|
|
6
|
+
*
|
|
7
|
+
* The block is sixteen bytes: an EAC block holding alpha, decoded in the specification's eight-bit
|
|
8
|
+
* arithmetic, then an ETC2 RGB8 block holding colour, decoded with every one of its modes. The
|
|
9
|
+
* `-srgb` variant is the same blocks and decodes to the same bytes.
|
|
10
|
+
*
|
|
11
|
+
* @param {Uint8Array} source
|
|
12
|
+
* @param {number} offset byte offset of the sixteen-byte block in `source`
|
|
13
|
+
* @param {Uint8Array} out receives sixteen texels in raster order, RGBA
|
|
14
|
+
*
|
|
15
|
+
* @see Khronos Data Format Specification 1.3, section 22.3
|
|
16
|
+
* @see OpenGL ES 3.0 Specification, section C.1.3
|
|
17
|
+
* @author Alex Goldring
|
|
18
|
+
* @copyright Company Named Limited (c) 2026
|
|
19
|
+
*/
|
|
20
|
+
export function etc2_rgba8_decode_block(source, offset, out) {
|
|
21
|
+
etc2_decode_color(source, offset + 8, false, out);
|
|
22
|
+
|
|
23
|
+
eac_decode_channel_alpha8(source, offset, out, 3);
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The line that best fits points, and how far they lie from it.
|
|
3
|
+
*
|
|
4
|
+
* The line runs through the points' mean along the direction they spread most: the eigenvector of their scatter
|
|
5
|
+
* with the largest eigenvalue, from the symmetric eigen solvers in `core`, which converge whatever the points look
|
|
6
|
+
* like — channels that move against each other, or apart, included. Its ends are the points' outermost projections
|
|
7
|
+
* onto it, so every point lies between them. Which end is `low` is not meaningful.
|
|
8
|
+
*
|
|
9
|
+
* @param {ArrayLike<number>} points packed, `channels` values a point
|
|
10
|
+
* @param {number} channels `1`, `3` or `4`
|
|
11
|
+
* @param {number} first the first point read
|
|
12
|
+
* @param {number} count how many points are read, from `first`
|
|
13
|
+
* @param {Float64Array} low written, `channels` values
|
|
14
|
+
* @param {Float64Array} high written, `channels` values
|
|
15
|
+
* @returns {number} the points' squared distance from the line, summed: the scatter's trace less its largest
|
|
16
|
+
* eigenvalue. Zero when they lie on a line or on a point
|
|
17
|
+
* @throws {Error} for a number of channels this does not fit
|
|
18
|
+
*
|
|
19
|
+
* @author Alex Goldring
|
|
20
|
+
* @copyright Company Named Limited (c) 2026
|
|
21
|
+
*/
|
|
22
|
+
export function fit_line(points: ArrayLike<number>, channels: number, first: number, count: number, low: Float64Array, high: Float64Array): number;
|
|
23
|
+
//# sourceMappingURL=fit_line.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fit_line.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/fit/fit_line.js"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,iCAbW,UAAU,MAAM,CAAC,YACjB,MAAM,SACN,MAAM,SACN,MAAM,OACN,YAAY,QACZ,YAAY,GACV,MAAM,CAwFlB"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { matrix_symmetric_3x3_eigen } from "../../../core/math/linalg/eigen/matrix_symmetric_3x3_eigen.js";
|
|
2
|
+
import { matrix_symmetric_4x4_eigen } from "../../../core/math/linalg/eigen/matrix_symmetric_4x4_eigen.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The points' mean.
|
|
6
|
+
*
|
|
7
|
+
* @type {Float64Array}
|
|
8
|
+
*/
|
|
9
|
+
const mean = new Float64Array(4);
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Their scatter about the mean, row-major, `channels` by `channels`.
|
|
13
|
+
*
|
|
14
|
+
* @type {Float64Array}
|
|
15
|
+
*/
|
|
16
|
+
const scatter = new Float64Array(16);
|
|
17
|
+
|
|
18
|
+
const eigen_values = new Float64Array(4);
|
|
19
|
+
const eigen_vectors = new Float64Array(16);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The line that best fits points, and how far they lie from it.
|
|
23
|
+
*
|
|
24
|
+
* The line runs through the points' mean along the direction they spread most: the eigenvector of their scatter
|
|
25
|
+
* with the largest eigenvalue, from the symmetric eigen solvers in `core`, which converge whatever the points look
|
|
26
|
+
* like — channels that move against each other, or apart, included. Its ends are the points' outermost projections
|
|
27
|
+
* onto it, so every point lies between them. Which end is `low` is not meaningful.
|
|
28
|
+
*
|
|
29
|
+
* @param {ArrayLike<number>} points packed, `channels` values a point
|
|
30
|
+
* @param {number} channels `1`, `3` or `4`
|
|
31
|
+
* @param {number} first the first point read
|
|
32
|
+
* @param {number} count how many points are read, from `first`
|
|
33
|
+
* @param {Float64Array} low written, `channels` values
|
|
34
|
+
* @param {Float64Array} high written, `channels` values
|
|
35
|
+
* @returns {number} the points' squared distance from the line, summed: the scatter's trace less its largest
|
|
36
|
+
* eigenvalue. Zero when they lie on a line or on a point
|
|
37
|
+
* @throws {Error} for a number of channels this does not fit
|
|
38
|
+
*
|
|
39
|
+
* @author Alex Goldring
|
|
40
|
+
* @copyright Company Named Limited (c) 2026
|
|
41
|
+
*/
|
|
42
|
+
export function fit_line(points, channels, first, count, low, high) {
|
|
43
|
+
if (channels !== 1 && channels !== 3 && channels !== 4) {
|
|
44
|
+
throw new Error(`a line is fitted to points of 1, 3 or 4 channels, not ${channels}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const end = first + count;
|
|
48
|
+
|
|
49
|
+
for (let c = 0; c < channels; c++) {
|
|
50
|
+
let sum = 0;
|
|
51
|
+
|
|
52
|
+
for (let i = first; i < end; i++) {
|
|
53
|
+
sum += points[i * channels + c];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
mean[c] = sum / count;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
scatter.fill(0, 0, channels * channels);
|
|
60
|
+
|
|
61
|
+
for (let i = first; i < end; i++) {
|
|
62
|
+
for (let r = 0; r < channels; r++) {
|
|
63
|
+
const dr = points[i * channels + r] - mean[r];
|
|
64
|
+
|
|
65
|
+
for (let c = r; c < channels; c++) {
|
|
66
|
+
scatter[r * channels + c] += dr * (points[i * channels + c] - mean[c]);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let trace = 0;
|
|
72
|
+
|
|
73
|
+
for (let c = 0; c < channels; c++) {
|
|
74
|
+
trace += scatter[c * channels + c];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// the direction of greatest spread: the eigenvector of the largest eigenvalue, which the solvers put last
|
|
78
|
+
let largest;
|
|
79
|
+
let axis_at;
|
|
80
|
+
|
|
81
|
+
if (channels === 1) {
|
|
82
|
+
largest = scatter[0];
|
|
83
|
+
eigen_vectors[0] = 1;
|
|
84
|
+
axis_at = 0;
|
|
85
|
+
} else {
|
|
86
|
+
if (channels === 3) {
|
|
87
|
+
matrix_symmetric_3x3_eigen(eigen_values, eigen_vectors, scatter);
|
|
88
|
+
} else {
|
|
89
|
+
matrix_symmetric_4x4_eigen(eigen_values, eigen_vectors, scatter);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
largest = eigen_values[channels - 1];
|
|
93
|
+
axis_at = (channels - 1) * channels;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let t_min = Infinity;
|
|
97
|
+
let t_max = -Infinity;
|
|
98
|
+
|
|
99
|
+
for (let i = first; i < end; i++) {
|
|
100
|
+
let t = 0;
|
|
101
|
+
|
|
102
|
+
for (let c = 0; c < channels; c++) {
|
|
103
|
+
t += (points[i * channels + c] - mean[c]) * eigen_vectors[axis_at + c];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (t < t_min) {
|
|
107
|
+
t_min = t;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (t > t_max) {
|
|
111
|
+
t_max = t;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
for (let c = 0; c < channels; c++) {
|
|
116
|
+
const axis = eigen_vectors[axis_at + c];
|
|
117
|
+
|
|
118
|
+
low[c] = mean[c] + axis * t_min;
|
|
119
|
+
high[c] = mean[c] + axis * t_max;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return Math.max(trace - largest, 0);
|
|
123
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One round of fitting a line's ends to the levels a format interpolates at: each point is assigned the level
|
|
3
|
+
* nearest where it projects onto the line from `low` to `high`, then the ends are solved for those levels by least
|
|
4
|
+
* squares ({@link fit_line_solve}).
|
|
5
|
+
*
|
|
6
|
+
* @param {ArrayLike<number>} points packed, `channels` values a point
|
|
7
|
+
* @param {number} channels values a point
|
|
8
|
+
* @param {number} first the first point read
|
|
9
|
+
* @param {number} count how many points are read, from `first`
|
|
10
|
+
* @param {ArrayLike<number>} levels where along the line a format can put a point, `0` at `low` to `1` at `high`,
|
|
11
|
+
* ascending
|
|
12
|
+
* @param {Float64Array} low read and written, `channels` values
|
|
13
|
+
* @param {Float64Array} high read and written
|
|
14
|
+
* @returns {boolean} whether the ends were solved; they are not when the line has no length or every point took the
|
|
15
|
+
* same level, and are then left as they were
|
|
16
|
+
*
|
|
17
|
+
* @author Alex Goldring
|
|
18
|
+
* @copyright Company Named Limited (c) 2026
|
|
19
|
+
*/
|
|
20
|
+
export function fit_line_refine(points: ArrayLike<number>, channels: number, first: number, count: number, levels: ArrayLike<number>, low: Float64Array, high: Float64Array): boolean;
|
|
21
|
+
//# sourceMappingURL=fit_line_refine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fit_line_refine.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/fit/fit_line_refine.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wCAdW,UAAU,MAAM,CAAC,YACjB,MAAM,SACN,MAAM,SACN,MAAM,UACN,UAAU,MAAM,CAAC,OAEjB,YAAY,QACZ,YAAY,GACV,OAAO,CA8CnB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { fit_line_solve } from "./fit_line_solve.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The weight each point is assigned, by point index.
|
|
5
|
+
*
|
|
6
|
+
* @type {Float64Array}
|
|
7
|
+
*/
|
|
8
|
+
let assigned = new Float64Array(64);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* One round of fitting a line's ends to the levels a format interpolates at: each point is assigned the level
|
|
12
|
+
* nearest where it projects onto the line from `low` to `high`, then the ends are solved for those levels by least
|
|
13
|
+
* squares ({@link fit_line_solve}).
|
|
14
|
+
*
|
|
15
|
+
* @param {ArrayLike<number>} points packed, `channels` values a point
|
|
16
|
+
* @param {number} channels values a point
|
|
17
|
+
* @param {number} first the first point read
|
|
18
|
+
* @param {number} count how many points are read, from `first`
|
|
19
|
+
* @param {ArrayLike<number>} levels where along the line a format can put a point, `0` at `low` to `1` at `high`,
|
|
20
|
+
* ascending
|
|
21
|
+
* @param {Float64Array} low read and written, `channels` values
|
|
22
|
+
* @param {Float64Array} high read and written
|
|
23
|
+
* @returns {boolean} whether the ends were solved; they are not when the line has no length or every point took the
|
|
24
|
+
* same level, and are then left as they were
|
|
25
|
+
*
|
|
26
|
+
* @author Alex Goldring
|
|
27
|
+
* @copyright Company Named Limited (c) 2026
|
|
28
|
+
*/
|
|
29
|
+
export function fit_line_refine(points, channels, first, count, levels, low, high) {
|
|
30
|
+
let length_squared = 0;
|
|
31
|
+
|
|
32
|
+
for (let c = 0; c < channels; c++) {
|
|
33
|
+
const d = high[c] - low[c];
|
|
34
|
+
|
|
35
|
+
length_squared += d * d;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (length_squared === 0) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const end = first + count;
|
|
43
|
+
|
|
44
|
+
if (assigned.length < end) {
|
|
45
|
+
assigned = new Float64Array(end);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
for (let i = first; i < end; i++) {
|
|
49
|
+
let projection = 0;
|
|
50
|
+
|
|
51
|
+
for (let c = 0; c < channels; c++) {
|
|
52
|
+
projection += (points[i * channels + c] - low[c]) * (high[c] - low[c]);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const t = projection / length_squared;
|
|
56
|
+
|
|
57
|
+
let nearest = levels[0];
|
|
58
|
+
|
|
59
|
+
for (let k = 1; k < levels.length; k++) {
|
|
60
|
+
if (Math.abs(levels[k] - t) < Math.abs(nearest - t)) {
|
|
61
|
+
nearest = levels[k];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
assigned[i] = nearest;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
return fit_line_solve(points, channels, first, count, assigned, low, high);
|
|
69
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two ends of a line that best reproduce points at the weights given, by least squares: each point `i` is to be
|
|
3
|
+
* `(1 - w) * low + w * high` with `w = weights[i]`, and the squared error over every channel of every point is the
|
|
4
|
+
* least. Each channel is solved on its own, from the same two-by-two normal equations.
|
|
5
|
+
*
|
|
6
|
+
* This is the step every block encoder and transcoder here takes once it knows which level each texel sits at:
|
|
7
|
+
* the ends that serve those texels best are not, in general, the texels at the extremes.
|
|
8
|
+
*
|
|
9
|
+
* @param {ArrayLike<number>} points packed, `channels` values a point
|
|
10
|
+
* @param {number} channels values a point
|
|
11
|
+
* @param {number} first the first point read
|
|
12
|
+
* @param {number} count how many points are read, from `first`
|
|
13
|
+
* @param {ArrayLike<number>} weights by point index (the same index as `points`), `0` at `low` and `1` at `high`
|
|
14
|
+
* @param {Float64Array} low written, `channels` values, unless there is no solution
|
|
15
|
+
* @param {Float64Array} high likewise
|
|
16
|
+
* @returns {boolean} whether there is a solution; there is none when every point read has the same weight, and the
|
|
17
|
+
* ends are then left as they were
|
|
18
|
+
*
|
|
19
|
+
* @author Alex Goldring
|
|
20
|
+
* @copyright Company Named Limited (c) 2026
|
|
21
|
+
*/
|
|
22
|
+
export function fit_line_solve(points: ArrayLike<number>, channels: number, first: number, count: number, weights: ArrayLike<number>, low: Float64Array, high: Float64Array): boolean;
|
|
23
|
+
//# sourceMappingURL=fit_line_solve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fit_line_solve.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/fit/fit_line_solve.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,uCAbW,UAAU,MAAM,CAAC,YACjB,MAAM,SACN,MAAM,SACN,MAAM,WACN,UAAU,MAAM,CAAC,OACjB,YAAY,QACZ,YAAY,GACV,OAAO,CA8CnB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Below this the normal equations' determinant is taken as zero: every point was given the same weight, which says
|
|
3
|
+
* nothing about where the ends are.
|
|
4
|
+
*
|
|
5
|
+
* @readonly
|
|
6
|
+
* @type {number}
|
|
7
|
+
*/
|
|
8
|
+
const SINGULAR = 1e-6;
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The two ends of a line that best reproduce points at the weights given, by least squares: each point `i` is to be
|
|
12
|
+
* `(1 - w) * low + w * high` with `w = weights[i]`, and the squared error over every channel of every point is the
|
|
13
|
+
* least. Each channel is solved on its own, from the same two-by-two normal equations.
|
|
14
|
+
*
|
|
15
|
+
* This is the step every block encoder and transcoder here takes once it knows which level each texel sits at:
|
|
16
|
+
* the ends that serve those texels best are not, in general, the texels at the extremes.
|
|
17
|
+
*
|
|
18
|
+
* @param {ArrayLike<number>} points packed, `channels` values a point
|
|
19
|
+
* @param {number} channels values a point
|
|
20
|
+
* @param {number} first the first point read
|
|
21
|
+
* @param {number} count how many points are read, from `first`
|
|
22
|
+
* @param {ArrayLike<number>} weights by point index (the same index as `points`), `0` at `low` and `1` at `high`
|
|
23
|
+
* @param {Float64Array} low written, `channels` values, unless there is no solution
|
|
24
|
+
* @param {Float64Array} high likewise
|
|
25
|
+
* @returns {boolean} whether there is a solution; there is none when every point read has the same weight, and the
|
|
26
|
+
* ends are then left as they were
|
|
27
|
+
*
|
|
28
|
+
* @author Alex Goldring
|
|
29
|
+
* @copyright Company Named Limited (c) 2026
|
|
30
|
+
*/
|
|
31
|
+
export function fit_line_solve(points, channels, first, count, weights, low, high) {
|
|
32
|
+
const end = first + count;
|
|
33
|
+
|
|
34
|
+
let sum_aa = 0;
|
|
35
|
+
let sum_ab = 0;
|
|
36
|
+
let sum_bb = 0;
|
|
37
|
+
|
|
38
|
+
for (let i = first; i < end; i++) {
|
|
39
|
+
const b = weights[i];
|
|
40
|
+
const a = 1 - b;
|
|
41
|
+
|
|
42
|
+
sum_aa += a * a;
|
|
43
|
+
sum_ab += a * b;
|
|
44
|
+
sum_bb += b * b;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const determinant = sum_aa * sum_bb - sum_ab * sum_ab;
|
|
48
|
+
|
|
49
|
+
if (Math.abs(determinant) < SINGULAR) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
for (let c = 0; c < channels; c++) {
|
|
54
|
+
let sum_ap = 0;
|
|
55
|
+
let sum_bp = 0;
|
|
56
|
+
|
|
57
|
+
for (let i = first; i < end; i++) {
|
|
58
|
+
const b = weights[i];
|
|
59
|
+
const a = 1 - b;
|
|
60
|
+
const p = points[i * channels + c];
|
|
61
|
+
|
|
62
|
+
sum_ap += a * p;
|
|
63
|
+
sum_bp += b * p;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
low[c] = (sum_bb * sum_ap - sum_ab * sum_bp) / determinant;
|
|
67
|
+
high[c] = (sum_aa * sum_bp - sum_ab * sum_ap) / determinant;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether {@link texel_decode_image} reads this format.
|
|
3
|
+
*
|
|
4
|
+
* @param {GPUTextureFormat} format
|
|
5
|
+
* @returns {boolean}
|
|
6
|
+
*/
|
|
7
|
+
export function texel_decode_image_reads(format: GPUTextureFormat): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* One image of texels in a GPU format, as pixels.
|
|
10
|
+
*
|
|
11
|
+
* Every block-compressed format WebGPU names is read, by the format's own decoder, and so are the eight-bit
|
|
12
|
+
* texel formats. The result is always four channels, RGBA, with a channel the format lacks filled as a GPU
|
|
13
|
+
* samples it: zero for colour, one for alpha. Values are the format's own: an `-srgb` format gives the encoded
|
|
14
|
+
* bytes, unconverted.
|
|
15
|
+
*
|
|
16
|
+
* - `Uint8Array` for every unorm format,
|
|
17
|
+
* - `Int8Array` for every snorm format, `-127` to `127`,
|
|
18
|
+
* - `Float32Array` for BC6H.
|
|
19
|
+
*
|
|
20
|
+
* @param {GPUTextureFormat} format
|
|
21
|
+
* @param {number} width texels
|
|
22
|
+
* @param {number} height texels
|
|
23
|
+
* @param {Uint8Array} bytes the image's blocks (or texels) in tightly packed rows, as a level of a texture file
|
|
24
|
+
* holds them; not kept
|
|
25
|
+
* @returns {Sampler2D} itemSize 4, `width` by `height`
|
|
26
|
+
* @throws {Error} for a format nothing here reads, and for bytes too few for the image
|
|
27
|
+
*
|
|
28
|
+
* @author Alex Goldring
|
|
29
|
+
* @copyright Company Named Limited (c) 2026
|
|
30
|
+
*/
|
|
31
|
+
export function texel_decode_image(format: GPUTextureFormat, width: number, height: number, bytes: Uint8Array): Sampler2D;
|
|
32
|
+
/**
|
|
33
|
+
* How one block is read: the decoder, and the kind of value it writes.
|
|
34
|
+
*/
|
|
35
|
+
export type BlockReader = {
|
|
36
|
+
/**
|
|
37
|
+
* a block at an offset,
|
|
38
|
+
* as RGBA texels in raster order
|
|
39
|
+
*/
|
|
40
|
+
decode: (arg0: Uint8Array, arg1: number, arg2: (Uint8Array | Int8Array | Float32Array)) => void;
|
|
41
|
+
type: Uint8ArrayConstructor | Int8ArrayConstructor | Float32ArrayConstructor;
|
|
42
|
+
};
|
|
43
|
+
import { Sampler2D } from "../../engine/graphics/texture/sampler/Sampler2D.js";
|
|
44
|
+
//# sourceMappingURL=texel_decode_image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texel_decode_image.d.ts","sourceRoot":"","sources":["../../../../src/format/texture/texel_decode_image.js"],"names":[],"mappings":"AAwIA;;;;;GAKG;AACH,oEAFa,OAAO,CAInB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,oEAVW,MAAM,UACN,MAAM,SACN,UAAU,GAER,SAAS,CAqDrB;;;;;;;;;mBA9LsB,UAAU,QAAE,MAAM,QAAE,CAAC,UAAU,GAAC,SAAS,GAAC,YAAY,CAAC,KAAE,IAAI;UAEtE,qBAAqB,GAAC,oBAAoB,GAAC,uBAAuB;;0BA5BtD,oDAAoD"}
|