@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
|
@@ -1,227 +1,185 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* The
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* @
|
|
19
|
-
* @
|
|
20
|
-
* @
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @
|
|
35
|
-
* @
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
* @
|
|
72
|
-
*
|
|
73
|
-
* @
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
*
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
*
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
*
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
for (let
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
write(block.parity[subset * 2 + end], 1);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
if (spec.shared_parity_bits > 0) {
|
|
192
|
-
for (let subset = 0; subset < spec.subsets; subset++) {
|
|
193
|
-
write(block.parity[subset], 1);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
write_indices(write, block.indices, block.anchors, spec.subsets, spec.index_bits);
|
|
198
|
-
|
|
199
|
-
if (spec.secondary_index_bits > 0) {
|
|
200
|
-
write_indices(
|
|
201
|
-
write, block.secondary_indices, block.anchors, spec.subsets, spec.secondary_index_bits
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* @param {function(number, number): void} write
|
|
208
|
-
* @param {Uint8Array} indices
|
|
209
|
-
* @param {Uint8Array} anchors one texel per subset
|
|
210
|
-
* @param {number} subsets
|
|
211
|
-
* @param {number} bits
|
|
212
|
-
*/
|
|
213
|
-
function write_indices(write, indices, anchors, subsets, bits) {
|
|
214
|
-
for (let texel = 0; texel < 16; texel++) {
|
|
215
|
-
let anchor = false;
|
|
216
|
-
|
|
217
|
-
for (let subset = 0; subset < subsets; subset++) {
|
|
218
|
-
if (anchors[subset] === texel) {
|
|
219
|
-
anchor = true;
|
|
220
|
-
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
write(indices[texel], anchor ? bits - 1 : bits);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
1
|
+
import { BC7_MODES } from "./bc7_tables.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Bytes one BC7 block occupies.
|
|
5
|
+
*
|
|
6
|
+
* @readonly
|
|
7
|
+
* @type {number}
|
|
8
|
+
*/
|
|
9
|
+
export const BC7_BLOCK_BYTES = 16;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The eight-bit value a stored endpoint component decodes to.
|
|
13
|
+
*
|
|
14
|
+
* The parity bit, where the mode has one, sits *below* the stored bits — so a five-bit component
|
|
15
|
+
* with a parity bit is a six-bit value — and the result is then widened to eight by replicating its
|
|
16
|
+
* top bits downward.
|
|
17
|
+
*
|
|
18
|
+
* @param {number} stored
|
|
19
|
+
* @param {number} bits including the parity bit
|
|
20
|
+
* @returns {number}
|
|
21
|
+
*/
|
|
22
|
+
export function bc7_expand_endpoint(stored, bits) {
|
|
23
|
+
if (bits >= 8) {
|
|
24
|
+
return stored & 255;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return ((stored << (8 - bits)) | (stored >>> (2 * bits - 8))) & 255;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Quantise an eight-bit value to what a mode can store, optionally forced to a parity.
|
|
32
|
+
*
|
|
33
|
+
* @param {number} value
|
|
34
|
+
* @param {number} bits including the parity bit, where there is one
|
|
35
|
+
* @param {number} parity `-1` when the mode has none
|
|
36
|
+
* @returns {number} the value including its parity bit, so `bits` wide
|
|
37
|
+
*/
|
|
38
|
+
export function bc7_quantise_endpoint(value, bits, parity) {
|
|
39
|
+
const max = (1 << bits) - 1;
|
|
40
|
+
|
|
41
|
+
let quantised = Math.round((value * max) / 255);
|
|
42
|
+
|
|
43
|
+
if (parity >= 0 && (quantised & 1) !== parity) {
|
|
44
|
+
/*
|
|
45
|
+
Both neighbours are equally far, so the one that stays inside the range wins and otherwise
|
|
46
|
+
the one nearer the original value does.
|
|
47
|
+
*/
|
|
48
|
+
const lower = quantised - 1;
|
|
49
|
+
const upper = quantised + 1;
|
|
50
|
+
|
|
51
|
+
const ideal = (value * max) / 255;
|
|
52
|
+
|
|
53
|
+
quantised = lower < 0 ? upper
|
|
54
|
+
: upper > max ? lower
|
|
55
|
+
: (Math.abs(ideal - lower) <= Math.abs(ideal - upper) ? lower : upper);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return quantised < 0 ? (parity < 0 ? 0 : parity)
|
|
59
|
+
: quantised > max ? (max - ((max & 1) === parity || parity < 0 ? 0 : 1))
|
|
60
|
+
: quantised;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Where the next field goes, in bits from the start of the output.
|
|
65
|
+
*
|
|
66
|
+
* @type {number}
|
|
67
|
+
*/
|
|
68
|
+
let cursor = 0;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Write a field at {@link cursor}, lowest bit first, and move past it. The bits it lands on are zero.
|
|
72
|
+
*
|
|
73
|
+
* @param {Uint8Array} out
|
|
74
|
+
* @param {number} value
|
|
75
|
+
* @param {number} count
|
|
76
|
+
*/
|
|
77
|
+
function write_field(out, value, count) {
|
|
78
|
+
for (let i = 0; i < count; i++) {
|
|
79
|
+
if (((value >> i) & 1) !== 0) {
|
|
80
|
+
out[(cursor + i) >> 3] |= 1 << ((cursor + i) & 7);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
cursor += count;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Write one BC7 block, all sixteen of its bytes.
|
|
89
|
+
*
|
|
90
|
+
* **One writer for every mode** ({@link BC7_MODES}), because the specification says the fields are always in the
|
|
91
|
+
* same order and only their widths change.
|
|
92
|
+
*
|
|
93
|
+
* Endpoints are ordered as the specification stores them: by channel, then by subset, then by
|
|
94
|
+
* endpoint — so red for both ends of subset 0, then both ends of subset 1, then green, and so on.
|
|
95
|
+
*
|
|
96
|
+
* @param {Uint8Array} out
|
|
97
|
+
* @param {number} byte_offset of the block
|
|
98
|
+
* @param {number} mode
|
|
99
|
+
* @param {object} block
|
|
100
|
+
* @param {number} [block.partition] index into BC7's partition table
|
|
101
|
+
* @param {number} [block.rotation]
|
|
102
|
+
* @param {number} [block.index_selection] mode 4's: `1` gives colour the secondary indices and alpha the primary
|
|
103
|
+
* @param {Uint8Array} block.endpoints `subsets * 2 * 4` stored fields, low then high RGBA per
|
|
104
|
+
* subset — already quantised to the mode's width, with any parity bit held separately
|
|
105
|
+
* @param {Uint8Array} block.indices sixteen
|
|
106
|
+
* @param {Uint8Array} [block.secondary_indices] sixteen, for a mode with two index sets
|
|
107
|
+
* @param {Uint8Array} block.anchors one texel index per subset
|
|
108
|
+
* @param {Int8Array} [block.parity] one bit per endpoint, or per subset for a shared-parity mode
|
|
109
|
+
*
|
|
110
|
+
* @author Alex Goldring
|
|
111
|
+
* @copyright Company Named Limited (c) 2026
|
|
112
|
+
*/
|
|
113
|
+
export function bc7_write_block(out, byte_offset, mode, block) {
|
|
114
|
+
const spec = BC7_MODES[mode];
|
|
115
|
+
|
|
116
|
+
out.fill(0, byte_offset, byte_offset + BC7_BLOCK_BYTES);
|
|
117
|
+
|
|
118
|
+
cursor = byte_offset * 8;
|
|
119
|
+
|
|
120
|
+
// a mode is signalled by that many zero bits followed by a one
|
|
121
|
+
write_field(out, 1 << mode, mode + 1);
|
|
122
|
+
|
|
123
|
+
write_field(out, block.partition ?? 0, spec.partition_bits);
|
|
124
|
+
write_field(out, block.rotation ?? 0, spec.rotation_bits);
|
|
125
|
+
write_field(out, block.index_selection ?? 0, spec.index_selection_bits);
|
|
126
|
+
|
|
127
|
+
for (let channel = 0; channel < 3; channel++) {
|
|
128
|
+
for (let subset = 0; subset < spec.subsets; subset++) {
|
|
129
|
+
for (let end = 0; end < 2; end++) {
|
|
130
|
+
write_field(out, block.endpoints[(subset * 2 + end) * 4 + channel], spec.color_bits);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (spec.alpha_bits > 0) {
|
|
136
|
+
for (let subset = 0; subset < spec.subsets; subset++) {
|
|
137
|
+
for (let end = 0; end < 2; end++) {
|
|
138
|
+
write_field(out, block.endpoints[(subset * 2 + end) * 4 + 3], spec.alpha_bits);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (spec.endpoint_parity_bits > 0) {
|
|
144
|
+
for (let subset = 0; subset < spec.subsets; subset++) {
|
|
145
|
+
for (let end = 0; end < 2; end++) {
|
|
146
|
+
write_field(out, block.parity[subset * 2 + end], 1);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (spec.shared_parity_bits > 0) {
|
|
152
|
+
for (let subset = 0; subset < spec.subsets; subset++) {
|
|
153
|
+
write_field(out, block.parity[subset], 1);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
write_indices(out, block.indices, block.anchors, spec.subsets, spec.index_bits);
|
|
158
|
+
|
|
159
|
+
if (spec.secondary_index_bits > 0) {
|
|
160
|
+
write_indices(out, block.secondary_indices, block.anchors, spec.subsets, spec.secondary_index_bits);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @param {Uint8Array} out
|
|
166
|
+
* @param {Uint8Array} indices
|
|
167
|
+
* @param {Uint8Array} anchors one texel per subset
|
|
168
|
+
* @param {number} subsets
|
|
169
|
+
* @param {number} bits
|
|
170
|
+
*/
|
|
171
|
+
function write_indices(out, indices, anchors, subsets, bits) {
|
|
172
|
+
for (let texel = 0; texel < 16; texel++) {
|
|
173
|
+
let anchor = false;
|
|
174
|
+
|
|
175
|
+
for (let subset = 0; subset < subsets; subset++) {
|
|
176
|
+
if (anchors[subset] === texel) {
|
|
177
|
+
anchor = true;
|
|
178
|
+
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
write_field(out, indices[texel], anchor ? bits - 1 : bits);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decode one EAC block in the specification's eight-bit arithmetic, the alpha half of an ETC2 RGBA8
|
|
3
|
+
* block: `clamp255(base + modifier × multiplier)`, a multiplier of 0 giving every texel the base.
|
|
4
|
+
*
|
|
5
|
+
* @param {Uint8Array} source
|
|
6
|
+
* @param {number} offset byte offset of the eight-byte block
|
|
7
|
+
* @param {Uint8Array} out sixteen RGBA texels in raster order; only `channel` is written
|
|
8
|
+
* @param {number} channel `0..3`
|
|
9
|
+
*
|
|
10
|
+
* @see Khronos Data Format Specification 1.3, section 22.3
|
|
11
|
+
* @author Alex Goldring
|
|
12
|
+
* @copyright Company Named Limited (c) 2026
|
|
13
|
+
*/
|
|
14
|
+
export function eac_decode_channel_alpha8(source: Uint8Array, offset: number, out: Uint8Array, channel: number): void;
|
|
15
|
+
/**
|
|
16
|
+
* Decode one EAC block in the specification's eleven-bit unsigned arithmetic, the R11 form:
|
|
17
|
+
* `clamp(base × 8 + 4 + modifier × multiplier × 8)` to `[0, 2047]`, with `modifier` alone in place
|
|
18
|
+
* of the product when the multiplier is 0. 2047 represents 1.0; the specification gives no rule for
|
|
19
|
+
* fewer than eleven bits, so each value is written as the nearest eight-bit unorm,
|
|
20
|
+
* `round(value × 255 / 2047)` — exact in integers, as no value lies halfway.
|
|
21
|
+
*
|
|
22
|
+
* @param {Uint8Array} source
|
|
23
|
+
* @param {number} offset byte offset of the eight-byte block
|
|
24
|
+
* @param {Uint8Array} out sixteen RGBA texels in raster order; only `channel` is written
|
|
25
|
+
* @param {number} channel `0..3`
|
|
26
|
+
*
|
|
27
|
+
* @see Khronos Data Format Specification 1.3, section 22.5
|
|
28
|
+
* @author Alex Goldring
|
|
29
|
+
* @copyright Company Named Limited (c) 2026
|
|
30
|
+
*/
|
|
31
|
+
export function eac_decode_channel_unorm11(source: Uint8Array, offset: number, out: Uint8Array, channel: number): void;
|
|
32
|
+
/**
|
|
33
|
+
* Decode one EAC block in the specification's eleven-bit signed arithmetic, the signed R11 form:
|
|
34
|
+
* the base codeword a two's-complement byte read as -127 when it is -128, then
|
|
35
|
+
* `clamp(base × 8 + modifier × multiplier × 8)` to `[-1023, 1023]`, with `modifier` alone in place
|
|
36
|
+
* of the product when the multiplier is 0. 1023 represents 1.0; the specification gives no rule for
|
|
37
|
+
* fewer than eleven bits, so each value is written as the nearest eight-bit snorm,
|
|
38
|
+
* `round(value × 127 / 1023)` — exact in integers, as no value lies halfway.
|
|
39
|
+
*
|
|
40
|
+
* @param {Uint8Array} source
|
|
41
|
+
* @param {number} offset byte offset of the eight-byte block
|
|
42
|
+
* @param {Int8Array} out sixteen RGBA texels in raster order; only `channel` is written
|
|
43
|
+
* @param {number} channel `0..3`
|
|
44
|
+
*
|
|
45
|
+
* @see Khronos Data Format Specification 1.3, section 22.7
|
|
46
|
+
* @author Alex Goldring
|
|
47
|
+
* @copyright Company Named Limited (c) 2026
|
|
48
|
+
*/
|
|
49
|
+
export function eac_decode_channel_snorm11(source: Uint8Array, offset: number, out: Int8Array, channel: number): void;
|
|
50
|
+
//# sourceMappingURL=eac_decode_channel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eac_decode_channel.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/etc/eac_decode_channel.js"],"names":[],"mappings":"AA2DA;;;;;;;;;;;;GAYG;AACH,kDATW,UAAU,UACV,MAAM,OACN,UAAU,WACV,MAAM,QAYhB;AAED;;;;;;;;;;;;;;;GAeG;AACH,mDATW,UAAU,UACV,MAAM,OACN,UAAU,WACV,MAAM,QAiBhB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,mDATW,UAAU,UACV,MAAM,OACN,SAAS,WACT,MAAM,QAqBhB"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { EAC_MODIFIERS } from "./eac_modifiers.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Scratch: the eight values a block's indices select.
|
|
5
|
+
*
|
|
6
|
+
* @type {Int32Array}
|
|
7
|
+
*/
|
|
8
|
+
const palette = new Int32Array(8);
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Fill {@link palette} with the specification's sum for each of a row's eight modifiers,
|
|
12
|
+
* `clamp(base + modifier × multiplier)` to `[low, high]`. The two arithmetics differ only in these
|
|
13
|
+
* terms: the eight-bit alpha form passes the base codeword and the multiplier as they are, the
|
|
14
|
+
* eleven-bit form passes them scaled by 8 (with the unsigned form's +4 in the base, and a multiplier
|
|
15
|
+
* of 0 standing for 1/8).
|
|
16
|
+
*
|
|
17
|
+
* @param {number} table `0..15`
|
|
18
|
+
* @param {number} base
|
|
19
|
+
* @param {number} multiplier
|
|
20
|
+
* @param {number} low
|
|
21
|
+
* @param {number} high
|
|
22
|
+
*/
|
|
23
|
+
function fill_palette(table, base, multiplier, low, high) {
|
|
24
|
+
const row = table * 8;
|
|
25
|
+
|
|
26
|
+
for (let i = 0; i < 8; i++) {
|
|
27
|
+
const value = base + EAC_MODIFIERS[row + i] * multiplier;
|
|
28
|
+
|
|
29
|
+
palette[i] = value < low ? low : value > high ? high : value;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Write {@link palette}'s entry for each texel's index into one channel of `out`.
|
|
35
|
+
*
|
|
36
|
+
* The forty-eight index bits are bits 47..0 of the block, three per texel from the top, the texels
|
|
37
|
+
* lettered a..p down each column: letter `k`, texel (k >> 2, k & 3), holds bits `47 - 3k` to
|
|
38
|
+
* `45 - 3k`. Letters 0..7 fill bytes 2..4 and letters 8..15 bytes 5..7.
|
|
39
|
+
*
|
|
40
|
+
* @param {Uint8Array} source
|
|
41
|
+
* @param {number} offset of the block
|
|
42
|
+
* @param {Uint8Array|Int8Array} out sixteen RGBA texels, raster order
|
|
43
|
+
* @param {number} channel `0..3`
|
|
44
|
+
*/
|
|
45
|
+
function write_channel(source, offset, out, channel) {
|
|
46
|
+
const first = (source[offset + 2] << 16) | (source[offset + 3] << 8) | source[offset + 4];
|
|
47
|
+
const second = (source[offset + 5] << 16) | (source[offset + 6] << 8) | source[offset + 7];
|
|
48
|
+
|
|
49
|
+
for (let k = 0; k < 8; k++) {
|
|
50
|
+
const shift = 21 - 3 * k;
|
|
51
|
+
|
|
52
|
+
// letter k is column k >> 2, row k & 3; letter k + 8 is two columns further right
|
|
53
|
+
const texel = (k & 3) * 4 + (k >> 2);
|
|
54
|
+
|
|
55
|
+
out[texel * 4 + channel] = palette[(first >>> shift) & 7];
|
|
56
|
+
out[(texel + 2) * 4 + channel] = palette[(second >>> shift) & 7];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Decode one EAC block in the specification's eight-bit arithmetic, the alpha half of an ETC2 RGBA8
|
|
62
|
+
* block: `clamp255(base + modifier × multiplier)`, a multiplier of 0 giving every texel the base.
|
|
63
|
+
*
|
|
64
|
+
* @param {Uint8Array} source
|
|
65
|
+
* @param {number} offset byte offset of the eight-byte block
|
|
66
|
+
* @param {Uint8Array} out sixteen RGBA texels in raster order; only `channel` is written
|
|
67
|
+
* @param {number} channel `0..3`
|
|
68
|
+
*
|
|
69
|
+
* @see Khronos Data Format Specification 1.3, section 22.3
|
|
70
|
+
* @author Alex Goldring
|
|
71
|
+
* @copyright Company Named Limited (c) 2026
|
|
72
|
+
*/
|
|
73
|
+
export function eac_decode_channel_alpha8(source, offset, out, channel) {
|
|
74
|
+
const header = source[offset + 1];
|
|
75
|
+
|
|
76
|
+
fill_palette(header & 15, source[offset], header >> 4, 0, 255);
|
|
77
|
+
|
|
78
|
+
write_channel(source, offset, out, channel);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Decode one EAC block in the specification's eleven-bit unsigned arithmetic, the R11 form:
|
|
83
|
+
* `clamp(base × 8 + 4 + modifier × multiplier × 8)` to `[0, 2047]`, with `modifier` alone in place
|
|
84
|
+
* of the product when the multiplier is 0. 2047 represents 1.0; the specification gives no rule for
|
|
85
|
+
* fewer than eleven bits, so each value is written as the nearest eight-bit unorm,
|
|
86
|
+
* `round(value × 255 / 2047)` — exact in integers, as no value lies halfway.
|
|
87
|
+
*
|
|
88
|
+
* @param {Uint8Array} source
|
|
89
|
+
* @param {number} offset byte offset of the eight-byte block
|
|
90
|
+
* @param {Uint8Array} out sixteen RGBA texels in raster order; only `channel` is written
|
|
91
|
+
* @param {number} channel `0..3`
|
|
92
|
+
*
|
|
93
|
+
* @see Khronos Data Format Specification 1.3, section 22.5
|
|
94
|
+
* @author Alex Goldring
|
|
95
|
+
* @copyright Company Named Limited (c) 2026
|
|
96
|
+
*/
|
|
97
|
+
export function eac_decode_channel_unorm11(source, offset, out, channel) {
|
|
98
|
+
const header = source[offset + 1];
|
|
99
|
+
const multiplier = header >> 4;
|
|
100
|
+
|
|
101
|
+
fill_palette(header & 15, source[offset] * 8 + 4, multiplier === 0 ? 1 : multiplier * 8, 0, 2047);
|
|
102
|
+
|
|
103
|
+
for (let i = 0; i < 8; i++) {
|
|
104
|
+
palette[i] = ((palette[i] * 510 + 2047) / 4094) | 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
write_channel(source, offset, out, channel);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Decode one EAC block in the specification's eleven-bit signed arithmetic, the signed R11 form:
|
|
112
|
+
* the base codeword a two's-complement byte read as -127 when it is -128, then
|
|
113
|
+
* `clamp(base × 8 + modifier × multiplier × 8)` to `[-1023, 1023]`, with `modifier` alone in place
|
|
114
|
+
* of the product when the multiplier is 0. 1023 represents 1.0; the specification gives no rule for
|
|
115
|
+
* fewer than eleven bits, so each value is written as the nearest eight-bit snorm,
|
|
116
|
+
* `round(value × 127 / 1023)` — exact in integers, as no value lies halfway.
|
|
117
|
+
*
|
|
118
|
+
* @param {Uint8Array} source
|
|
119
|
+
* @param {number} offset byte offset of the eight-byte block
|
|
120
|
+
* @param {Int8Array} out sixteen RGBA texels in raster order; only `channel` is written
|
|
121
|
+
* @param {number} channel `0..3`
|
|
122
|
+
*
|
|
123
|
+
* @see Khronos Data Format Specification 1.3, section 22.7
|
|
124
|
+
* @author Alex Goldring
|
|
125
|
+
* @copyright Company Named Limited (c) 2026
|
|
126
|
+
*/
|
|
127
|
+
export function eac_decode_channel_snorm11(source, offset, out, channel) {
|
|
128
|
+
const header = source[offset + 1];
|
|
129
|
+
const multiplier = header >> 4;
|
|
130
|
+
|
|
131
|
+
const base = (source[offset] << 24) >> 24;
|
|
132
|
+
|
|
133
|
+
fill_palette(
|
|
134
|
+
header & 15, (base < -127 ? -127 : base) * 8, multiplier === 0 ? 1 : multiplier * 8, -1023, 1023
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
for (let i = 0; i < 8; i++) {
|
|
138
|
+
palette[i] = Math.floor((palette[i] * 254 + 1023) / 2046);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
write_channel(source, offset, out, channel);
|
|
142
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EAC's modifier table: sixteen rows of eight, a block's table index picking the row and a texel's three-bit index
|
|
3
|
+
* the entry. The same table serves the eight-bit alpha of ETC2 RGBA8 and the eleven-bit R11 and RG11 formats.
|
|
4
|
+
*
|
|
5
|
+
* Row 13 is the only one holding a zero, which is what lets a block hold one value exactly.
|
|
6
|
+
*
|
|
7
|
+
* @readonly
|
|
8
|
+
* @type {Int32Array}
|
|
9
|
+
* @see OpenGL ES 3.0, table C.10; Khronos Data Format Specification 1.3, table 22.6
|
|
10
|
+
*
|
|
11
|
+
* @author Alex Goldring
|
|
12
|
+
* @copyright Company Named Limited (c) 2026
|
|
13
|
+
*/
|
|
14
|
+
export const EAC_MODIFIERS: Int32Array;
|
|
15
|
+
//# sourceMappingURL=eac_modifiers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eac_modifiers.d.ts","sourceRoot":"","sources":["../../../../../src/format/texture/etc/eac_modifiers.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,4BANU,UAAU,CAuBjB"}
|