@woosh/meep-engine 3.78.4 → 3.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +93 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/engine/asset/GameAssetType.d.ts +2 -0
- package/src/engine/asset/GameAssetType.js +10 -0
- package/src/engine/asset/guessAssetType.d.ts.map +1 -1
- package/src/engine/asset/guessAssetType.js +4 -0
- package/src/engine/asset/load_model_scene_bundle.d.ts +1 -1
- package/src/engine/asset/load_model_scene_bundle.js +2 -2
- package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.d.ts +42 -0
- package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.d.ts.map +1 -0
- package/src/engine/asset/loaders/MTFSceneBundleAssetLoader.js +83 -0
- package/src/engine/asset/loaders/MTFTextureAssetLoader.d.ts +36 -0
- package/src/engine/asset/loaders/MTFTextureAssetLoader.d.ts.map +1 -0
- package/src/engine/asset/loaders/MTFTextureAssetLoader.js +78 -0
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.d.ts +6 -1
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.d.ts.map +1 -1
- package/src/engine/ecs/storage/binary/collection/BinaryCollectionSerializer.js +8 -2
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- 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/GPUAcousticProbes.d.ts +1 -1
- package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
- package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts +33 -0
- package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.d.ts.map +1 -0
- package/src/shade/renderer/animation/ShadeAnimationClipSerializationAdapter.js +196 -0
- package/src/shade/renderer/animation/SkinSerializationAdapter.d.ts +25 -0
- package/src/shade/renderer/animation/SkinSerializationAdapter.d.ts.map +1 -0
- package/src/shade/renderer/animation/SkinSerializationAdapter.js +85 -0
- package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -1
- package/src/shade/renderer/hair/GPUHairSystem.js +16 -7
- package/src/shade/renderer/hair/HAIR.d.ts +5 -3
- package/src/shade/renderer/hair/HAIR.d.ts.map +1 -1
- package/src/shade/renderer/hair/HAIR.js +6 -4
- package/src/shade/renderer/hair/hair_shadow_draw.d.ts +10 -10
- package/src/shade/renderer/hair/hair_shadow_draw.d.ts.map +1 -1
- package/src/shade/renderer/hair/hair_shadow_draw.js +21 -17
- package/src/shade/renderer/hair/shader_hair_cull.d.ts.map +1 -1
- package/src/shade/renderer/hair/shader_hair_cull.js +6 -2
- package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts +5 -4
- package/src/shade/renderer/hair/shader_hair_shadow_list.d.ts.map +1 -1
- package/src/shade/renderer/hair/shader_hair_shadow_list.js +10 -12
- package/src/shade/renderer/loader/SceneNodeSerializationAdapter.d.ts +38 -0
- package/src/shade/renderer/loader/SceneNodeSerializationAdapter.d.ts.map +1 -0
- package/src/shade/renderer/loader/SceneNodeSerializationAdapter.js +198 -0
- package/src/shade/renderer/loader/mtf/MTFTexture.d.ts +88 -0
- package/src/shade/renderer/loader/mtf/MTFTexture.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/MTFTexture.js +159 -0
- package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.d.ts +30 -0
- package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/MTFTextureSerializationAdapter.js +136 -0
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.d.ts +7 -0
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.js +6 -0
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts +8 -0
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.js +7 -0
- package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.d.ts +7 -0
- package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.js +6 -0
- package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.d.ts +7 -0
- package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.js +6 -0
- package/src/shade/renderer/loader/mtf/load_mtf.d.ts +41 -0
- package/src/shade/renderer/loader/mtf/load_mtf.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/load_mtf.js +73 -0
- package/src/shade/renderer/loader/mtf/mtf_bundle_textures.d.ts +19 -0
- package/src/shade/renderer/loader/mtf/mtf_bundle_textures.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_bundle_textures.js +57 -0
- package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts +10 -0
- package/src/shade/renderer/loader/mtf/mtf_encode_texture.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_encode_texture.js +152 -0
- package/src/shade/renderer/loader/mtf/mtf_export.d.ts +45 -0
- package/src/shade/renderer/loader/mtf/mtf_export.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_export.js +161 -0
- package/src/shade/renderer/loader/mtf/mtf_is_texture.d.ts +9 -0
- package/src/shade/renderer/loader/mtf/mtf_is_texture.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_is_texture.js +12 -0
- package/src/shade/renderer/loader/mtf/mtf_read_collection.d.ts +24 -0
- package/src/shade/renderer/loader/mtf/mtf_read_collection.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_read_collection.js +37 -0
- package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts +27 -0
- package/src/shade/renderer/loader/mtf/mtf_read_scene.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_read_scene.js +121 -0
- package/src/shade/renderer/loader/mtf/mtf_read_textures.d.ts +18 -0
- package/src/shade/renderer/loader/mtf/mtf_read_textures.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_read_textures.js +51 -0
- 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_resolve_uri.d.ts +21 -0
- package/src/shade/renderer/loader/mtf/mtf_resolve_uri.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_resolve_uri.js +98 -0
- package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts +25 -0
- package/src/shade/renderer/loader/mtf/mtf_serialization_registry.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_serialization_registry.js +51 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_read.d.ts +20 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_read.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_read.js +80 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_select.d.ts +24 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_select.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_select.js +42 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_write.d.ts +31 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_write.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_texture_write.js +87 -0
- package/src/shade/renderer/loader/mtf/mtf_write.d.ts +36 -0
- package/src/shade/renderer/loader/mtf/mtf_write.d.ts.map +1 -0
- package/src/shade/renderer/loader/mtf/mtf_write.js +137 -0
- 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/material/StandardShadeMaterialSerializationAdapter.d.ts +39 -0
- package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.d.ts.map +1 -0
- package/src/shade/renderer/material/StandardShadeMaterialSerializationAdapter.js +207 -0
- package/src/shade/renderer/scene/optimization/source_to_sampler2d.d.ts.map +1 -1
- package/src/shade/renderer/scene/optimization/source_to_sampler2d.js +3 -1
- package/src/shade/renderer/scene/serialization/STANDARD_MATERIAL_SERIALIZED_BYTE_SIZE.d.ts +5 -5
- package/src/shade/renderer/scene/serialization/STANDARD_MATERIAL_SERIALIZED_BYTE_SIZE.js +5 -5
- package/src/shade/renderer/scene/serialization/deserialize_scene.d.ts.map +1 -1
- package/src/shade/renderer/scene/serialization/deserialize_scene.js +491 -528
- package/src/shade/renderer/scene/serialization/serialize_scene.d.ts +0 -10
- package/src/shade/renderer/scene/serialization/serialize_scene.d.ts.map +1 -1
- package/src/shade/renderer/scene/serialization/serialize_scene.js +15 -71
- 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/gpu_texture_format_without_srgb.d.ts +11 -0
- package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.d.ts.map +1 -0
- package/src/shade/renderer/texture/format/gpu_texture_format_without_srgb.js +14 -0
- 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/shade/renderer/texture/texture_role_image_quality.d.ts +10 -0
- package/src/shade/renderer/texture/texture_role_image_quality.d.ts.map +1 -0
- package/src/shade/renderer/texture/texture_role_image_quality.js +29 -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,5 +1,6 @@
|
|
|
1
1
|
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
2
2
|
import { chunk_bc6h_pack_mode11 } from "./chunk_bc6h_pack_mode11.js";
|
|
3
|
+
import { chunk_scatter_principal_axis } from "./chunk_scatter_principal_axis.js";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Encode sixteen HDR RGB texels as one BC6H block in mode 11, the unsigned format.
|
|
@@ -251,25 +252,7 @@ fn bc6h_encode_block_mode11(texels: array<vec3<f32>, 16>) -> vec4<u32> {
|
|
|
251
252
|
cov[5] += d.z * d.z;
|
|
252
253
|
}
|
|
253
254
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
for (var iteration = 0u; iteration < 4u; iteration++) {
|
|
257
|
-
let next = vec3<f32>(
|
|
258
|
-
cov[0] * axis.x + cov[1] * axis.y + cov[2] * axis.z,
|
|
259
|
-
cov[1] * axis.x + cov[3] * axis.y + cov[4] * axis.z,
|
|
260
|
-
cov[2] * axis.x + cov[4] * axis.y + cov[5] * axis.z
|
|
261
|
-
);
|
|
262
|
-
|
|
263
|
-
let magnitude = length(next);
|
|
264
|
-
|
|
265
|
-
if (magnitude < 1e-3) {
|
|
266
|
-
break;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
axis = next / magnitude;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
axis = normalize(axis);
|
|
255
|
+
let axis = scatter3_principal_axis(cov);
|
|
273
256
|
|
|
274
257
|
var t_min = 1e30;
|
|
275
258
|
var t_max = -1e30;
|
|
@@ -346,4 +329,5 @@ fn bc6h_encode_block_mode11(texels: array<vec3<f32>, 16>) -> vec4<u32> {
|
|
|
346
329
|
}
|
|
347
330
|
`, [
|
|
348
331
|
chunk_bc6h_pack_mode11,
|
|
332
|
+
chunk_scatter_principal_axis,
|
|
349
333
|
]);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Encode sixteen
|
|
3
|
-
*
|
|
2
|
+
* Encode sixteen texels as one BC7 block, in mode 6 or in mode 1 — whichever an estimate says loses
|
|
3
|
+
* less — fitting and writing only that one: `bc7_encode_block` for RGBA, `bc7_encode_block_rgb` for
|
|
4
|
+
* a block whose alpha nobody reads.
|
|
4
5
|
*
|
|
5
6
|
* **Mode 1 is two lines.** Mode 6 (`chunk_bc7_encode_block_mode6`) puts one line through the
|
|
6
7
|
* block in four channels; a block holding two colour regions, each varying its own way, is two lines
|
|
@@ -33,8 +34,8 @@
|
|
|
33
34
|
*
|
|
34
35
|
* **One fit for both modes.** The chosen mode reaches the fit as data — which texels are in the
|
|
35
36
|
* second subset, the levels, the bits an end keeps, whether alpha is held — so a group of
|
|
36
|
-
* invocations holding both modes runs one fit rather than both. Per subset: the principal axis
|
|
37
|
-
*
|
|
37
|
+
* invocations holding both modes runs one fit rather than both. Per subset: the principal axis
|
|
38
|
+
* ({@link chunk_scatter_principal_axis}), the extreme projections as the ends, one round of least squares with each texel
|
|
38
39
|
* at the weight it projects to; then the parities, rounded to and **scored by the least squares'
|
|
39
40
|
* own quadratic form**: at its optimum the error grows by `aa |d0|² + 2 ab d0·d1 + bb |d1|²` for
|
|
40
41
|
* ends moved by `d0` and `d1`, so no combination needs a pass over the texels — 0.1 dB below scoring
|
|
@@ -42,6 +43,15 @@
|
|
|
42
43
|
* nearest entry, once, and the anchors: texel 0 and the partition's second anchor are stored a bit
|
|
43
44
|
* short, and a subset whose anchor lands in the upper half is written the other way up.
|
|
44
45
|
*
|
|
46
|
+
* **An alpha that is the same throughout the block is kept exactly.** Mode 6's parity bit is shared by
|
|
47
|
+
* all four channels of an end, so holding alpha `a` takes `a`'s parity on both ends: an opaque block
|
|
48
|
+
* decodes opaque and a clear one clear, whatever that costs the colour.
|
|
49
|
+
*
|
|
50
|
+
* **Alpha nobody reads costs nothing.** `bc7_encode_block_rgb` takes colour alone. Its fit sees every
|
|
51
|
+
* texel opaque and holds no alpha in either mode, so mode 6's parities serve the colour, and what a
|
|
52
|
+
* block decodes to in alpha is 254 or 255 in mode 6 — whichever parity its first end took — and 255
|
|
53
|
+
* in mode 1.
|
|
54
|
+
*
|
|
45
55
|
* **Modes 3 and 7 are not here, by measurement.** Mode 3, two subsets of four levels on eight-bit
|
|
46
56
|
* ends, chosen by the same estimate at mode 1's partition, bought 0.05 dB over the twenty images and
|
|
47
57
|
* nothing on the graphic ones; mode 7 is mode 3 with alpha, and those images are opaque. A block
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_bc7_encode_block.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/chunk_bc7_encode_block.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chunk_bc7_encode_block.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/chunk_bc7_encode_block.js"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgEG;AACH,qCAFU,SAAS,CA6dZ;0BAliBmB,oCAAoC"}
|
|
@@ -2,10 +2,12 @@ import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
|
2
2
|
import { chunk_bc7_pack_mode1 } from "./chunk_bc7_pack_mode1.js";
|
|
3
3
|
import { chunk_bc7_pack_mode6 } from "./chunk_bc7_pack_mode6.js";
|
|
4
4
|
import { chunk_bc7_partition_2 } from "./chunk_bc7_partition_2.js";
|
|
5
|
+
import { chunk_scatter_principal_axis } from "./chunk_scatter_principal_axis.js";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
|
-
* Encode sixteen
|
|
8
|
-
*
|
|
8
|
+
* Encode sixteen texels as one BC7 block, in mode 6 or in mode 1 — whichever an estimate says loses
|
|
9
|
+
* less — fitting and writing only that one: `bc7_encode_block` for RGBA, `bc7_encode_block_rgb` for
|
|
10
|
+
* a block whose alpha nobody reads.
|
|
9
11
|
*
|
|
10
12
|
* **Mode 1 is two lines.** Mode 6 (`chunk_bc7_encode_block_mode6`) puts one line through the
|
|
11
13
|
* block in four channels; a block holding two colour regions, each varying its own way, is two lines
|
|
@@ -38,8 +40,8 @@ import { chunk_bc7_partition_2 } from "./chunk_bc7_partition_2.js";
|
|
|
38
40
|
*
|
|
39
41
|
* **One fit for both modes.** The chosen mode reaches the fit as data — which texels are in the
|
|
40
42
|
* second subset, the levels, the bits an end keeps, whether alpha is held — so a group of
|
|
41
|
-
* invocations holding both modes runs one fit rather than both. Per subset: the principal axis
|
|
42
|
-
*
|
|
43
|
+
* invocations holding both modes runs one fit rather than both. Per subset: the principal axis
|
|
44
|
+
* ({@link chunk_scatter_principal_axis}), the extreme projections as the ends, one round of least squares with each texel
|
|
43
45
|
* at the weight it projects to; then the parities, rounded to and **scored by the least squares'
|
|
44
46
|
* own quadratic form**: at its optimum the error grows by `aa |d0|² + 2 ab d0·d1 + bb |d1|²` for
|
|
45
47
|
* ends moved by `d0` and `d1`, so no combination needs a pass over the texels — 0.1 dB below scoring
|
|
@@ -47,6 +49,15 @@ import { chunk_bc7_partition_2 } from "./chunk_bc7_partition_2.js";
|
|
|
47
49
|
* nearest entry, once, and the anchors: texel 0 and the partition's second anchor are stored a bit
|
|
48
50
|
* short, and a subset whose anchor lands in the upper half is written the other way up.
|
|
49
51
|
*
|
|
52
|
+
* **An alpha that is the same throughout the block is kept exactly.** Mode 6's parity bit is shared by
|
|
53
|
+
* all four channels of an end, so holding alpha `a` takes `a`'s parity on both ends: an opaque block
|
|
54
|
+
* decodes opaque and a clear one clear, whatever that costs the colour.
|
|
55
|
+
*
|
|
56
|
+
* **Alpha nobody reads costs nothing.** `bc7_encode_block_rgb` takes colour alone. Its fit sees every
|
|
57
|
+
* texel opaque and holds no alpha in either mode, so mode 6's parities serve the colour, and what a
|
|
58
|
+
* block decodes to in alpha is 254 or 255 in mode 6 — whichever parity its first end took — and 255
|
|
59
|
+
* in mode 1.
|
|
60
|
+
*
|
|
50
61
|
* **Modes 3 and 7 are not here, by measurement.** Mode 3, two subsets of four levels on eight-bit
|
|
51
62
|
* ends, chosen by the same estimate at mode 1's partition, bought 0.05 dB over the twenty images and
|
|
52
63
|
* nothing on the graphic ones; mode 7 is mode 3 with alpha, and those images are opaque. A block
|
|
@@ -93,45 +104,6 @@ fn bc7_scatter_terms(d: vec4<f32>) -> array<f32, 10> {
|
|
|
93
104
|
);
|
|
94
105
|
}
|
|
95
106
|
|
|
96
|
-
fn bc7_scatter_times(c: array<f32, 10>, v: vec4<f32>) -> vec4<f32> {
|
|
97
|
-
return vec4<f32>(
|
|
98
|
-
c[0] * v.x + c[1] * v.y + c[2] * v.z + c[3] * v.w,
|
|
99
|
-
c[1] * v.x + c[4] * v.y + c[5] * v.z + c[6] * v.w,
|
|
100
|
-
c[2] * v.x + c[5] * v.y + c[7] * v.z + c[8] * v.w,
|
|
101
|
-
c[3] * v.x + c[6] * v.y + c[8] * v.z + c[9] * v.w
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// the principal axis of a scatter, by power iteration from its widest channel; that channel's unit
|
|
106
|
-
// vector when the scatter is zero
|
|
107
|
-
fn bc7_principal_axis(c: array<f32, 10>) -> vec4<f32> {
|
|
108
|
-
let diagonal = vec4<f32>(c[0], c[4], c[7], c[9]);
|
|
109
|
-
let widest = max(max(diagonal.x, diagonal.y), max(diagonal.z, diagonal.w));
|
|
110
|
-
|
|
111
|
-
var axis = select(
|
|
112
|
-
select(
|
|
113
|
-
select(vec4<f32>(0.0, 0.0, 0.0, 1.0), vec4<f32>(0.0, 0.0, 1.0, 0.0), diagonal.z == widest),
|
|
114
|
-
vec4<f32>(0.0, 1.0, 0.0, 0.0),
|
|
115
|
-
diagonal.y == widest
|
|
116
|
-
),
|
|
117
|
-
vec4<f32>(1.0, 0.0, 0.0, 0.0),
|
|
118
|
-
diagonal.x == widest
|
|
119
|
-
);
|
|
120
|
-
|
|
121
|
-
for (var iteration = 0u; iteration < 4u; iteration++) {
|
|
122
|
-
let next = bc7_scatter_times(c, axis);
|
|
123
|
-
let magnitude = length(next);
|
|
124
|
-
|
|
125
|
-
if (magnitude < 1e-3) {
|
|
126
|
-
break;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
axis = next / magnitude;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
return axis;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
107
|
// the estimated squared error of texels on one line, from the trace of their scatter about their mean
|
|
136
108
|
// and the sum of its principal two-by-two minors: the distance from the line, which is the scatter's
|
|
137
109
|
// lesser eigenvalues and is read as minors over trace — exact as the line thins, half of it for a
|
|
@@ -221,20 +193,48 @@ fn bc7_quantise_end(e: vec4<f32>, bits: u32, parity: u32) -> vec4<f32> {
|
|
|
221
193
|
fn bc7_encode_block(texels: array<vec4<f32>, 16>) -> vec4<u32> {
|
|
222
194
|
var packed: array<u32, 16>;
|
|
223
195
|
|
|
196
|
+
for (var i = 0u; i < 16u; i++) {
|
|
197
|
+
packed[i] = pack4x8unorm(texels[i]);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return bc7_encode_packed(packed, true);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
fn bc7_encode_block_rgb(texels: array<vec3<f32>, 16>) -> vec4<u32> {
|
|
204
|
+
var packed: array<u32, 16>;
|
|
205
|
+
|
|
206
|
+
for (var i = 0u; i < 16u; i++) {
|
|
207
|
+
packed[i] = pack4x8unorm(vec4<f32>(texels[i], 1.0));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return bc7_encode_packed(packed, false);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// the block from its texels as bytes, and whether its alpha is read: one that is not is opaque here,
|
|
214
|
+
// and the fit holds no alpha
|
|
215
|
+
fn bc7_encode_packed(packed: array<u32, 16>, alpha_read: bool) -> vec4<u32> {
|
|
224
216
|
var mean = vec4<f32>(0.0);
|
|
225
217
|
|
|
226
218
|
// what mode 1, which decodes opaque, costs in alpha
|
|
227
219
|
var alpha_error = 0.0;
|
|
228
220
|
|
|
229
|
-
|
|
230
|
-
|
|
221
|
+
// the block's least and greatest alpha: one alpha throughout is kept exactly
|
|
222
|
+
var alpha_low = 255u;
|
|
223
|
+
var alpha_high = 0u;
|
|
231
224
|
|
|
225
|
+
for (var i = 0u; i < 16u; i++) {
|
|
232
226
|
let v = bc7_block_texel(packed[i]);
|
|
233
227
|
|
|
234
228
|
mean += v;
|
|
235
229
|
alpha_error += (255.0 - v.w) * (255.0 - v.w);
|
|
230
|
+
|
|
231
|
+
alpha_low = min(alpha_low, packed[i] >> 24u);
|
|
232
|
+
alpha_high = max(alpha_high, packed[i] >> 24u);
|
|
236
233
|
}
|
|
237
234
|
|
|
235
|
+
// the parity mode 6's ends must both have to hold that alpha, or 2 when alpha varies or is not read
|
|
236
|
+
let alpha_parity = select(2u, select(2u, alpha_low & 1u, alpha_low == alpha_high), alpha_read);
|
|
237
|
+
|
|
238
238
|
mean = mean / 16.0;
|
|
239
239
|
|
|
240
240
|
var block = array<f32, 10>(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
|
|
@@ -313,7 +313,7 @@ fn bc7_encode_block(texels: array<vec4<f32>, 16>) -> vec4<u32> {
|
|
|
313
313
|
}
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
return bc7_encode_fit(packed, mean, block, estimate1 + alpha_error < estimate6, pattern, second);
|
|
316
|
+
return bc7_encode_fit(packed, mean, block, estimate1 + alpha_error < estimate6, pattern, second, alpha_parity, alpha_read);
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
// fit and write the chosen mode: one or two lines, each through its subset, by the same steps for
|
|
@@ -324,7 +324,9 @@ fn bc7_encode_fit(
|
|
|
324
324
|
block_scatter: array<f32, 10>,
|
|
325
325
|
two: bool,
|
|
326
326
|
pattern: u32,
|
|
327
|
-
second: Bc7Subset
|
|
327
|
+
second: Bc7Subset,
|
|
328
|
+
alpha_parity: u32,
|
|
329
|
+
alpha_read: bool
|
|
328
330
|
) -> vec4<u32> {
|
|
329
331
|
let mask = select(0u, bc7_partition_2_mask(pattern), two);
|
|
330
332
|
let anchor = select(0u, bc7_partition_2_anchor(pattern), two);
|
|
@@ -332,9 +334,12 @@ fn bc7_encode_fit(
|
|
|
332
334
|
let steps = select(15.0, 7.0, two);
|
|
333
335
|
let bits = select(8u, 7u, two);
|
|
334
336
|
|
|
335
|
-
// mode 1 decodes opaque:
|
|
336
|
-
|
|
337
|
-
let
|
|
337
|
+
// mode 1 decodes opaque, and alpha nobody reads is no one's: the fit sees every texel as opaque,
|
|
338
|
+
// which leaves alpha out of it
|
|
339
|
+
let colour_only = two || !alpha_read;
|
|
340
|
+
|
|
341
|
+
let held = select(vec4<f32>(1.0), vec4<f32>(1.0, 1.0, 1.0, 0.0), colour_only);
|
|
342
|
+
let opaque = select(vec4<f32>(0.0), vec4<f32>(0.0, 0.0, 0.0, 255.0), colour_only);
|
|
338
343
|
|
|
339
344
|
// each subset's mean and scatter about it, from the second subset's sums; mode 6 has no second
|
|
340
345
|
let n1 = f32(countOneBits(mask));
|
|
@@ -376,8 +381,8 @@ fn bc7_encode_fit(
|
|
|
376
381
|
0.0
|
|
377
382
|
);
|
|
378
383
|
|
|
379
|
-
let axis0 =
|
|
380
|
-
let axis1 =
|
|
384
|
+
let axis0 = scatter4_principal_axis(c0);
|
|
385
|
+
let axis1 = scatter4_principal_axis(c1);
|
|
381
386
|
|
|
382
387
|
// each subset's extreme projections onto its axis
|
|
383
388
|
var low = vec2<f32>(1e30);
|
|
@@ -448,7 +453,8 @@ fn bc7_encode_fit(
|
|
|
448
453
|
|
|
449
454
|
// the parities, by what each combination adds to the least squares' error without a pass over the
|
|
450
455
|
// texels: at its optimum the error grows by aa |d0|² + 2 ab d0·d1 + bb |d1|² for ends moved by d0
|
|
451
|
-
// and d1. Mode 1 shares one parity between a subset's two ends
|
|
456
|
+
// and d1. Mode 1 shares one parity between a subset's two ends; mode 6 keeps an alpha that is the
|
|
457
|
+
// same throughout the block, which only its parity on both ends holds
|
|
452
458
|
var best = vec2<f32>(1e30);
|
|
453
459
|
|
|
454
460
|
var qa0 = vec4<f32>(0.0);
|
|
@@ -473,7 +479,11 @@ fn bc7_encode_fit(
|
|
|
473
479
|
let error = vec2<f32>(
|
|
474
480
|
aa.x * dot(da0, da0) + 2.0 * ab.x * dot(da0, da1) + bb.x * dot(da1, da1),
|
|
475
481
|
aa.y * dot(db0, db0) + 2.0 * ab.y * dot(db0, db1) + bb.y * dot(db1, db1)
|
|
476
|
-
) + select(
|
|
482
|
+
) + select(
|
|
483
|
+
vec2<f32>(0.0),
|
|
484
|
+
vec2<f32>(1e30),
|
|
485
|
+
select(alpha_parity < 2u && (p0 != alpha_parity || p1 != alpha_parity), p0 != p1, two)
|
|
486
|
+
);
|
|
477
487
|
|
|
478
488
|
if (error.x < best.x) {
|
|
479
489
|
best.x = error.x;
|
|
@@ -533,4 +543,5 @@ fn bc7_encode_fit(
|
|
|
533
543
|
chunk_bc7_partition_2,
|
|
534
544
|
chunk_bc7_pack_mode1,
|
|
535
545
|
chunk_bc7_pack_mode6,
|
|
546
|
+
chunk_scatter_principal_axis,
|
|
536
547
|
]);
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* The fit is {@link chunk_bc1_encode_block}'s in four dimensions:
|
|
14
14
|
*
|
|
15
|
-
* 1. The principal axis
|
|
16
|
-
*
|
|
15
|
+
* 1. The principal axis of the 4x4 covariance ({@link chunk_scatter_principal_axis}); the extreme
|
|
16
|
+
* projections as the ends.
|
|
17
17
|
* 2. One round of least squares with the sixteen decode weights shared across channels, each
|
|
18
18
|
* texel at the weight it projects to.
|
|
19
19
|
* 3. **Quantisation with every parity.** Each end's low bit is one of two values, so the pair has
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_bc7_encode_block_mode6.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chunk_bc7_encode_block_mode6.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/chunk_bc7_encode_block_mode6.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,2CAFU,SAAS,CAgOZ;0BAjRmB,oCAAoC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
2
2
|
import { chunk_bc7_pack_mode6 } from "./chunk_bc7_pack_mode6.js";
|
|
3
|
+
import { chunk_scatter_principal_axis } from "./chunk_scatter_principal_axis.js";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Encode sixteen RGBA texels as one BC7 block in mode 6.
|
|
@@ -15,8 +16,8 @@ import { chunk_bc7_pack_mode6 } from "./chunk_bc7_pack_mode6.js";
|
|
|
15
16
|
*
|
|
16
17
|
* The fit is {@link chunk_bc1_encode_block}'s in four dimensions:
|
|
17
18
|
*
|
|
18
|
-
* 1. The principal axis
|
|
19
|
-
*
|
|
19
|
+
* 1. The principal axis of the 4x4 covariance ({@link chunk_scatter_principal_axis}); the extreme
|
|
20
|
+
* projections as the ends.
|
|
20
21
|
* 2. One round of least squares with the sixteen decode weights shared across channels, each
|
|
21
22
|
* texel at the weight it projects to.
|
|
22
23
|
* 3. **Quantisation with every parity.** Each end's low bit is one of two values, so the pair has
|
|
@@ -210,26 +211,7 @@ fn bc7_encode_block_mode6(texels: array<vec4<f32>, 16>) -> vec4<u32> {
|
|
|
210
211
|
cov[9] += d.w * d.w;
|
|
211
212
|
}
|
|
212
213
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
for (var iteration = 0u; iteration < 4u; iteration++) {
|
|
216
|
-
let next = vec4<f32>(
|
|
217
|
-
cov[0] * axis.x + cov[1] * axis.y + cov[2] * axis.z + cov[3] * axis.w,
|
|
218
|
-
cov[1] * axis.x + cov[4] * axis.y + cov[5] * axis.z + cov[6] * axis.w,
|
|
219
|
-
cov[2] * axis.x + cov[5] * axis.y + cov[7] * axis.z + cov[8] * axis.w,
|
|
220
|
-
cov[3] * axis.x + cov[6] * axis.y + cov[8] * axis.z + cov[9] * axis.w
|
|
221
|
-
);
|
|
222
|
-
|
|
223
|
-
let magnitude = length(next);
|
|
224
|
-
|
|
225
|
-
if (magnitude < 1e-3) {
|
|
226
|
-
break;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
axis = next / magnitude;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
axis = normalize(axis);
|
|
214
|
+
let axis = scatter4_principal_axis(cov);
|
|
233
215
|
|
|
234
216
|
var t_min = 1e30;
|
|
235
217
|
var t_max = -1e30;
|
|
@@ -288,4 +270,5 @@ fn bc7_encode_block_mode6(texels: array<vec4<f32>, 16>) -> vec4<u32> {
|
|
|
288
270
|
}
|
|
289
271
|
`, [
|
|
290
272
|
chunk_bc7_pack_mode6,
|
|
273
|
+
chunk_scatter_principal_axis,
|
|
291
274
|
]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BC7_ANCHOR_2, BC7_PARTITIONS_2 } from "../../../../format/texture/
|
|
1
|
+
import { BC7_ANCHOR_2, BC7_PARTITIONS_2 } from "../../../../format/texture/bc/bc7_tables.js";
|
|
2
2
|
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The principal axis of a block's scatter — the direction of the line through its texels that
|
|
3
|
+
* leaves them least squared distance — for the block encoders' line fits, in three channels and in
|
|
4
|
+
* four.
|
|
5
|
+
*
|
|
6
|
+
* **Power iteration from every channel at once.** The scatter divided by its trace is squared three
|
|
7
|
+
* times, which is eight rounds of power iteration on each channel's unit vector side by side, and
|
|
8
|
+
* the longest of the result's columns is the axis. Column `j`'s squared length is the sum over the
|
|
9
|
+
* eigenpairs of `λᵢ¹⁶ uᵢⱼ²`: at least `λ₁¹⁶ / n` for the channel along which the principal
|
|
10
|
+
* eigenvector is largest, while the part of any column off that eigenvector is at most `λ₂¹⁶`. So
|
|
11
|
+
* the axis's squared sine against the principal eigenvector is at most `n (λ₂ / λ₁)¹⁶`, whatever
|
|
12
|
+
* the block: no seed can be orthogonal to the answer, which is how a single starting direction
|
|
13
|
+
* fails — the bounding box's diagonal for two channels moving against each other by equal amounts,
|
|
14
|
+
* the widest channel when it varies apart from a stronger joint direction of the others, and the
|
|
15
|
+
* longest column of the scatter itself in that same block when the joint direction is not by far
|
|
16
|
+
* the stronger. Where the bound is loose the two directions spread the block almost equally, and
|
|
17
|
+
* the line loses little whichever it takes.
|
|
18
|
+
*
|
|
19
|
+
* The scatter is given as its distinct terms, row by row from the diagonal: `xx xy xz yy yz zz`, and
|
|
20
|
+
* in four channels `xx xy xz xw yy yz yw zz zw ww`. One whose trace is under `1e-3` holds no
|
|
21
|
+
* direction worth the name, and its axis is the first channel's.
|
|
22
|
+
*
|
|
23
|
+
* @type {CodeChunk}
|
|
24
|
+
*/
|
|
25
|
+
export const chunk_scatter_principal_axis: CodeChunk;
|
|
26
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
27
|
+
//# sourceMappingURL=chunk_scatter_principal_axis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_scatter_principal_axis.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/chunk_scatter_principal_axis.js"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,2CAFU,SAAS,CA0HhB;0BAlJuB,oCAAoC"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The principal axis of a block's scatter — the direction of the line through its texels that
|
|
5
|
+
* leaves them least squared distance — for the block encoders' line fits, in three channels and in
|
|
6
|
+
* four.
|
|
7
|
+
*
|
|
8
|
+
* **Power iteration from every channel at once.** The scatter divided by its trace is squared three
|
|
9
|
+
* times, which is eight rounds of power iteration on each channel's unit vector side by side, and
|
|
10
|
+
* the longest of the result's columns is the axis. Column `j`'s squared length is the sum over the
|
|
11
|
+
* eigenpairs of `λᵢ¹⁶ uᵢⱼ²`: at least `λ₁¹⁶ / n` for the channel along which the principal
|
|
12
|
+
* eigenvector is largest, while the part of any column off that eigenvector is at most `λ₂¹⁶`. So
|
|
13
|
+
* the axis's squared sine against the principal eigenvector is at most `n (λ₂ / λ₁)¹⁶`, whatever
|
|
14
|
+
* the block: no seed can be orthogonal to the answer, which is how a single starting direction
|
|
15
|
+
* fails — the bounding box's diagonal for two channels moving against each other by equal amounts,
|
|
16
|
+
* the widest channel when it varies apart from a stronger joint direction of the others, and the
|
|
17
|
+
* longest column of the scatter itself in that same block when the joint direction is not by far
|
|
18
|
+
* the stronger. Where the bound is loose the two directions spread the block almost equally, and
|
|
19
|
+
* the line loses little whichever it takes.
|
|
20
|
+
*
|
|
21
|
+
* The scatter is given as its distinct terms, row by row from the diagonal: `xx xy xz yy yz zz`, and
|
|
22
|
+
* in four channels `xx xy xz xw yy yz yw zz zw ww`. One whose trace is under `1e-3` holds no
|
|
23
|
+
* direction worth the name, and its axis is the first channel's.
|
|
24
|
+
*
|
|
25
|
+
* @type {CodeChunk}
|
|
26
|
+
*/
|
|
27
|
+
export const chunk_scatter_principal_axis = CodeChunk.from(
|
|
28
|
+
//language=WGSL
|
|
29
|
+
`
|
|
30
|
+
// a scatter whose trace is under this has no direction in it
|
|
31
|
+
const SCATTER_VANISHED: f32 = 1e-3;
|
|
32
|
+
|
|
33
|
+
fn scatter3_principal_axis(c: array<f32, 6>) -> vec3<f32> {
|
|
34
|
+
let trace = c[0] + c[3] + c[5];
|
|
35
|
+
|
|
36
|
+
if (trace < SCATTER_VANISHED) {
|
|
37
|
+
return vec3<f32>(1.0, 0.0, 0.0);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var m = array<f32, 6>(c[0] / trace, c[1] / trace, c[2] / trace, c[3] / trace, c[4] / trace, c[5] / trace);
|
|
41
|
+
|
|
42
|
+
// squared three times, each time over its trace, which keeps every term within [-1, 1]
|
|
43
|
+
for (var round = 0u; round < 3u; round++) {
|
|
44
|
+
let r0 = vec3<f32>(m[0], m[1], m[2]);
|
|
45
|
+
let r1 = vec3<f32>(m[1], m[3], m[4]);
|
|
46
|
+
let r2 = vec3<f32>(m[2], m[4], m[5]);
|
|
47
|
+
|
|
48
|
+
let s = array<f32, 6>(dot(r0, r0), dot(r0, r1), dot(r0, r2), dot(r1, r1), dot(r1, r2), dot(r2, r2));
|
|
49
|
+
|
|
50
|
+
let t = s[0] + s[3] + s[5];
|
|
51
|
+
|
|
52
|
+
m = array<f32, 6>(s[0] / t, s[1] / t, s[2] / t, s[3] / t, s[4] / t, s[5] / t);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
let r0 = vec3<f32>(m[0], m[1], m[2]);
|
|
56
|
+
let r1 = vec3<f32>(m[1], m[3], m[4]);
|
|
57
|
+
let r2 = vec3<f32>(m[2], m[4], m[5]);
|
|
58
|
+
|
|
59
|
+
var axis = r0;
|
|
60
|
+
var longest = dot(r0, r0);
|
|
61
|
+
|
|
62
|
+
let l1 = dot(r1, r1);
|
|
63
|
+
|
|
64
|
+
if (l1 > longest) {
|
|
65
|
+
axis = r1;
|
|
66
|
+
longest = l1;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
let l2 = dot(r2, r2);
|
|
70
|
+
|
|
71
|
+
if (l2 > longest) {
|
|
72
|
+
axis = r2;
|
|
73
|
+
longest = l2;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let root = sqrt(longest);
|
|
77
|
+
|
|
78
|
+
return axis / root;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
fn scatter4_principal_axis(c: array<f32, 10>) -> vec4<f32> {
|
|
82
|
+
let trace = c[0] + c[4] + c[7] + c[9];
|
|
83
|
+
|
|
84
|
+
if (trace < SCATTER_VANISHED) {
|
|
85
|
+
return vec4<f32>(1.0, 0.0, 0.0, 0.0);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var m = array<f32, 10>(
|
|
89
|
+
c[0] / trace, c[1] / trace, c[2] / trace, c[3] / trace, c[4] / trace,
|
|
90
|
+
c[5] / trace, c[6] / trace, c[7] / trace, c[8] / trace, c[9] / trace
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
for (var round = 0u; round < 3u; round++) {
|
|
94
|
+
let r0 = vec4<f32>(m[0], m[1], m[2], m[3]);
|
|
95
|
+
let r1 = vec4<f32>(m[1], m[4], m[5], m[6]);
|
|
96
|
+
let r2 = vec4<f32>(m[2], m[5], m[7], m[8]);
|
|
97
|
+
let r3 = vec4<f32>(m[3], m[6], m[8], m[9]);
|
|
98
|
+
|
|
99
|
+
let s = array<f32, 10>(
|
|
100
|
+
dot(r0, r0), dot(r0, r1), dot(r0, r2), dot(r0, r3),
|
|
101
|
+
dot(r1, r1), dot(r1, r2), dot(r1, r3),
|
|
102
|
+
dot(r2, r2), dot(r2, r3),
|
|
103
|
+
dot(r3, r3)
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
let t = s[0] + s[4] + s[7] + s[9];
|
|
107
|
+
|
|
108
|
+
m = array<f32, 10>(
|
|
109
|
+
s[0] / t, s[1] / t, s[2] / t, s[3] / t, s[4] / t,
|
|
110
|
+
s[5] / t, s[6] / t, s[7] / t, s[8] / t, s[9] / t
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
let r0 = vec4<f32>(m[0], m[1], m[2], m[3]);
|
|
115
|
+
let r1 = vec4<f32>(m[1], m[4], m[5], m[6]);
|
|
116
|
+
let r2 = vec4<f32>(m[2], m[5], m[7], m[8]);
|
|
117
|
+
let r3 = vec4<f32>(m[3], m[6], m[8], m[9]);
|
|
118
|
+
|
|
119
|
+
var axis = r0;
|
|
120
|
+
var longest = dot(r0, r0);
|
|
121
|
+
|
|
122
|
+
let l1 = dot(r1, r1);
|
|
123
|
+
|
|
124
|
+
if (l1 > longest) {
|
|
125
|
+
axis = r1;
|
|
126
|
+
longest = l1;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
let l2 = dot(r2, r2);
|
|
130
|
+
|
|
131
|
+
if (l2 > longest) {
|
|
132
|
+
axis = r2;
|
|
133
|
+
longest = l2;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
let l3 = dot(r3, r3);
|
|
137
|
+
|
|
138
|
+
if (l3 > longest) {
|
|
139
|
+
axis = r3;
|
|
140
|
+
longest = l3;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
let root = sqrt(longest);
|
|
144
|
+
|
|
145
|
+
return axis / root;
|
|
146
|
+
}
|
|
147
|
+
`);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Every level of a texture to `astc-4x4-unorm` or its sRGB twin, one invocation per block.
|
|
3
3
|
*
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* words.
|
|
4
|
+
* The RGBA of whatever `encode_source` samples as, fitted by {@link chunk_astc_encode_block_4x4}:
|
|
5
|
+
* an opaque block in colour endpoint mode 8, any other in mode 12, which keeps its alpha. The
|
|
6
|
+
* dispatch shape is {@link shader_texture_encode_bc4}'s; a block is four words.
|
|
8
7
|
*
|
|
9
8
|
* @type {ComputeShader}
|
|
10
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader_texture_encode_astc_4x4.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.js"],"names":[],"mappings":"AAQA
|
|
1
|
+
{"version":3,"file":"shader_texture_encode_astc_4x4.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/shader_texture_encode_astc_4x4.js"],"names":[],"mappings":"AAQA;;;;;;;;GAQG;AACH,6CAFU,aAAa,CA2CpB;8BAxD2B,+BAA+B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { chunk_grid3d_to_index } from "../../shader/chunk/grid/chunk_grid3d_to_index.js";
|
|
2
2
|
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
3
3
|
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
4
|
-
import {
|
|
4
|
+
import { chunk_astc_encode_block_4x4 } from "./chunk_astc_encode_block_4x4.js";
|
|
5
5
|
import { chunk_texture_encode_load_block } from "./chunk_texture_encode_load_block.js";
|
|
6
6
|
import { TEXTURE_ENCODE_WORKGROUP_SIZE } from "./shader_texture_encode_bc4.js";
|
|
7
7
|
import { texture_encode_resources } from "./texture_encode_resources.js";
|
|
@@ -9,10 +9,9 @@ import { texture_encode_resources } from "./texture_encode_resources.js";
|
|
|
9
9
|
/**
|
|
10
10
|
* Every level of a texture to `astc-4x4-unorm` or its sRGB twin, one invocation per block.
|
|
11
11
|
*
|
|
12
|
-
* The
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* words.
|
|
12
|
+
* The RGBA of whatever `encode_source` samples as, fitted by {@link chunk_astc_encode_block_4x4}:
|
|
13
|
+
* an opaque block in colour endpoint mode 8, any other in mode 12, which keeps its alpha. The
|
|
14
|
+
* dispatch shape is {@link shader_texture_encode_bc4}'s; a block is four words.
|
|
16
15
|
*
|
|
17
16
|
* @type {ComputeShader}
|
|
18
17
|
*/
|
|
@@ -43,13 +42,7 @@ fn main(
|
|
|
43
42
|
|
|
44
43
|
let texels = texture_encode_load_block(level, block_x, block_y);
|
|
45
44
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
for (var i = 0u; i < 16u; i++) {
|
|
49
|
-
rgb[i] = texels[i].xyz;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
let packed = astc_encode_block_4x4_rgb(rgb);
|
|
45
|
+
let packed = astc_encode_block_4x4(texels);
|
|
53
46
|
|
|
54
47
|
let word = level.word_offset + block_y * level.row_stride_words + block_x * 4u;
|
|
55
48
|
|
|
@@ -61,6 +54,6 @@ fn main(
|
|
|
61
54
|
`, [
|
|
62
55
|
chunk_grid3d_to_index,
|
|
63
56
|
chunk_texture_encode_load_block,
|
|
64
|
-
|
|
57
|
+
chunk_astc_encode_block_4x4,
|
|
65
58
|
]),
|
|
66
59
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every level of a texture whose alpha nobody reads to `bc7-rgba-unorm` or its sRGB twin, one
|
|
3
|
+
* invocation per block.
|
|
4
|
+
*
|
|
5
|
+
* {@link shader_texture_encode_bc7} with the colour-only entry, `bc7_encode_block_rgb`: the source's
|
|
6
|
+
* alpha is not read, mode 6's parity bits serve the colour, and the blocks decode to alpha 254 or
|
|
7
|
+
* 255. The dispatch shape is {@link shader_texture_encode_bc4}'s; a block is four words.
|
|
8
|
+
*
|
|
9
|
+
* @type {ComputeShader}
|
|
10
|
+
*/
|
|
11
|
+
export const shader_texture_encode_bc7_rgb: ComputeShader;
|
|
12
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
13
|
+
//# sourceMappingURL=shader_texture_encode_bc7_rgb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader_texture_encode_bc7_rgb.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/encode/shader_texture_encode_bc7_rgb.js"],"names":[],"mappings":"AAQA;;;;;;;;;GASG;AACH,4CAFU,aAAa,CAiDpB;8BA/D2B,+BAA+B"}
|