@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,108 +1,146 @@
|
|
|
1
|
-
import { gpu_texture_format_info } from "../../../descriptor/texture/format/gpu_texture_format_info.js";
|
|
2
|
-
import { TextureFormat } from "../../../descriptor/texture/format/TextureFormat.js";
|
|
3
|
-
import { shader_texture_encode_astc_4x4 } from "./shader_texture_encode_astc_4x4.js";
|
|
4
|
-
import { shader_texture_encode_bc1 } from "./shader_texture_encode_bc1.js";
|
|
5
|
-
import { shader_texture_encode_bc4 } from "./shader_texture_encode_bc4.js";
|
|
6
|
-
import { shader_texture_encode_bc4_snorm } from "./shader_texture_encode_bc4_snorm.js";
|
|
7
|
-
import { shader_texture_encode_bc5 } from "./shader_texture_encode_bc5.js";
|
|
8
|
-
import { shader_texture_encode_bc5_snorm } from "./shader_texture_encode_bc5_snorm.js";
|
|
9
|
-
import { shader_texture_encode_bc6h } from "./shader_texture_encode_bc6h.js";
|
|
10
|
-
import { shader_texture_encode_bc7 } from "./shader_texture_encode_bc7.js";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
TextureFormat.
|
|
24
|
-
TextureFormat.
|
|
25
|
-
TextureFormat.
|
|
26
|
-
TextureFormat.
|
|
27
|
-
TextureFormat.
|
|
28
|
-
TextureFormat.
|
|
29
|
-
TextureFormat.
|
|
30
|
-
TextureFormat.
|
|
31
|
-
TextureFormat.
|
|
32
|
-
TextureFormat.
|
|
33
|
-
TextureFormat.
|
|
34
|
-
TextureFormat.
|
|
35
|
-
TextureFormat.
|
|
36
|
-
TextureFormat.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* @
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
[TextureFormat.
|
|
55
|
-
[TextureFormat.
|
|
56
|
-
[TextureFormat.
|
|
57
|
-
[TextureFormat.
|
|
58
|
-
[TextureFormat.
|
|
59
|
-
[TextureFormat.
|
|
60
|
-
[TextureFormat.
|
|
61
|
-
[TextureFormat.
|
|
62
|
-
[TextureFormat.
|
|
63
|
-
[TextureFormat.
|
|
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
|
-
export function
|
|
107
|
-
return
|
|
108
|
-
}
|
|
1
|
+
import { gpu_texture_format_info } from "../../../descriptor/texture/format/gpu_texture_format_info.js";
|
|
2
|
+
import { TextureFormat } from "../../../descriptor/texture/format/TextureFormat.js";
|
|
3
|
+
import { shader_texture_encode_astc_4x4 } from "./shader_texture_encode_astc_4x4.js";
|
|
4
|
+
import { shader_texture_encode_bc1 } from "./shader_texture_encode_bc1.js";
|
|
5
|
+
import { shader_texture_encode_bc4 } from "./shader_texture_encode_bc4.js";
|
|
6
|
+
import { shader_texture_encode_bc4_snorm } from "./shader_texture_encode_bc4_snorm.js";
|
|
7
|
+
import { shader_texture_encode_bc5 } from "./shader_texture_encode_bc5.js";
|
|
8
|
+
import { shader_texture_encode_bc5_snorm } from "./shader_texture_encode_bc5_snorm.js";
|
|
9
|
+
import { shader_texture_encode_bc6h } from "./shader_texture_encode_bc6h.js";
|
|
10
|
+
import { shader_texture_encode_bc7 } from "./shader_texture_encode_bc7.js";
|
|
11
|
+
import { shader_texture_encode_bc7_rgb } from "./shader_texture_encode_bc7_rgb.js";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Every format the block encoder is meant to write, implemented or not.
|
|
15
|
+
*
|
|
16
|
+
* The list the refusal below reads, so that a target that is planned and a name that was never a
|
|
17
|
+
* target get different answers: one says "not yet", the other "not at all".
|
|
18
|
+
*
|
|
19
|
+
* @readonly
|
|
20
|
+
* @type {GPUTextureFormat[]}
|
|
21
|
+
*/
|
|
22
|
+
export const TEXTURE_ENCODE_TARGETS = [
|
|
23
|
+
TextureFormat.BC1_RGBA_UNORM,
|
|
24
|
+
TextureFormat.BC1_RGBA_UNORM_SRGB,
|
|
25
|
+
TextureFormat.BC4_R_UNORM,
|
|
26
|
+
TextureFormat.BC4_R_SNORM,
|
|
27
|
+
TextureFormat.BC5_RG_UNORM,
|
|
28
|
+
TextureFormat.BC5_RG_SNORM,
|
|
29
|
+
TextureFormat.BC6H_RGB_UFLOAT,
|
|
30
|
+
TextureFormat.BC7_RGBA_UNORM,
|
|
31
|
+
TextureFormat.BC7_RGBA_UNORM_SRGB,
|
|
32
|
+
TextureFormat.ASTC_4X4_UNORM,
|
|
33
|
+
TextureFormat.ASTC_4X4_UNORM_SRGB,
|
|
34
|
+
TextureFormat.ASTC_6X6_UNORM,
|
|
35
|
+
TextureFormat.ASTC_6X6_UNORM_SRGB,
|
|
36
|
+
TextureFormat.ASTC_8X8_UNORM,
|
|
37
|
+
TextureFormat.ASTC_8X8_UNORM_SRGB,
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The encoder for each implemented target.
|
|
42
|
+
*
|
|
43
|
+
* **An `-srgb` format and its linear twin are one encoder**, listed twice rather than resolved by
|
|
44
|
+
* stripping the suffix: the two are the same encoded bytes and differ only in how the sampler
|
|
45
|
+
* decodes them, so the encoder does identical work and the caller's format is the tag the texture is
|
|
46
|
+
* created with. Listing both keeps the map the whole of the answer — nothing here strips a suffix
|
|
47
|
+
* and guesses. **A `snorm` format is not a tag**: its endpoints are signed and its palette runs over
|
|
48
|
+
* a different domain, so it is its own shader.
|
|
49
|
+
*
|
|
50
|
+
* @readonly
|
|
51
|
+
* @type {Map<GPUTextureFormat, ComputeShader>}
|
|
52
|
+
*/
|
|
53
|
+
const ENCODERS = new Map([
|
|
54
|
+
[TextureFormat.BC1_RGBA_UNORM, shader_texture_encode_bc1],
|
|
55
|
+
[TextureFormat.BC1_RGBA_UNORM_SRGB, shader_texture_encode_bc1],
|
|
56
|
+
[TextureFormat.BC4_R_UNORM, shader_texture_encode_bc4],
|
|
57
|
+
[TextureFormat.BC4_R_SNORM, shader_texture_encode_bc4_snorm],
|
|
58
|
+
[TextureFormat.BC5_RG_UNORM, shader_texture_encode_bc5],
|
|
59
|
+
[TextureFormat.BC5_RG_SNORM, shader_texture_encode_bc5_snorm],
|
|
60
|
+
[TextureFormat.BC6H_RGB_UFLOAT, shader_texture_encode_bc6h],
|
|
61
|
+
[TextureFormat.BC7_RGBA_UNORM, shader_texture_encode_bc7],
|
|
62
|
+
[TextureFormat.BC7_RGBA_UNORM_SRGB, shader_texture_encode_bc7],
|
|
63
|
+
[TextureFormat.ASTC_4X4_UNORM, shader_texture_encode_astc_4x4],
|
|
64
|
+
[TextureFormat.ASTC_4X4_UNORM_SRGB, shader_texture_encode_astc_4x4],
|
|
65
|
+
]);
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The encoder for each implemented target, for a texture whose alpha nobody reads: BC7's colour-only
|
|
69
|
+
* encoder, and every other target's own, none of which reads alpha.
|
|
70
|
+
*
|
|
71
|
+
* @readonly
|
|
72
|
+
* @type {Map<GPUTextureFormat, ComputeShader>}
|
|
73
|
+
*/
|
|
74
|
+
const ENCODERS_RGB = new Map([
|
|
75
|
+
...ENCODERS,
|
|
76
|
+
[TextureFormat.BC7_RGBA_UNORM, shader_texture_encode_bc7_rgb],
|
|
77
|
+
[TextureFormat.BC7_RGBA_UNORM_SRGB, shader_texture_encode_bc7_rgb],
|
|
78
|
+
]);
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The compute shader that encodes into `format`. For a texture whose alpha nobody reads,
|
|
82
|
+
* {@link texture_encode_shader_rgb}.
|
|
83
|
+
*
|
|
84
|
+
* Refuses by name rather than approximating: a target this cannot write yet is named as such, and a
|
|
85
|
+
* format that was never a target is named as that. Nothing is encoded as a neighbour of what was
|
|
86
|
+
* asked for.
|
|
87
|
+
*
|
|
88
|
+
* @param {GPUTextureFormat} format
|
|
89
|
+
* @returns {ComputeShader}
|
|
90
|
+
* @throws {Error} naming the format, for one that is not implemented or not a target
|
|
91
|
+
*/
|
|
92
|
+
export function texture_encode_shader(format) {
|
|
93
|
+
return encoder_from(ENCODERS, format);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The compute shader that encodes into `format` a texture whose alpha nobody reads: the source's alpha
|
|
98
|
+
* is not read, and the blocks decode to whatever alpha served the colour. For BC7 that frees the low
|
|
99
|
+
* bit each end's channels share with alpha ({@link shader_texture_encode_bc7_rgb}); every other
|
|
100
|
+
* target is the shader {@link texture_encode_shader} gives, as none of them reads alpha.
|
|
101
|
+
*
|
|
102
|
+
* @param {GPUTextureFormat} format
|
|
103
|
+
* @returns {ComputeShader}
|
|
104
|
+
* @throws {Error} naming the format, for one that is not implemented or not a target
|
|
105
|
+
*/
|
|
106
|
+
export function texture_encode_shader_rgb(format) {
|
|
107
|
+
return encoder_from(ENCODERS_RGB, format);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @param {Map<GPUTextureFormat, ComputeShader>} encoders
|
|
112
|
+
* @param {GPUTextureFormat} format
|
|
113
|
+
* @returns {ComputeShader}
|
|
114
|
+
*/
|
|
115
|
+
function encoder_from(encoders, format) {
|
|
116
|
+
// throws for a name that is not a format at all, which is the first thing worth knowing
|
|
117
|
+
gpu_texture_format_info(format);
|
|
118
|
+
|
|
119
|
+
const shader = encoders.get(format);
|
|
120
|
+
|
|
121
|
+
if (shader !== undefined) {
|
|
122
|
+
return shader;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (TEXTURE_ENCODE_TARGETS.includes(format)) {
|
|
126
|
+
throw new Error(
|
|
127
|
+
`texture_encode: '${format}' is a planned target of the block encoder and is not implemented yet.`
|
|
128
|
+
+ ` Nothing approximates it; the implemented targets are ${[...ENCODERS.keys()].join(', ')}`
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
throw new Error(
|
|
133
|
+
`texture_encode: '${format}' is not a target of the block encoder.`
|
|
134
|
+
+ ` The targets are ${TEXTURE_ENCODE_TARGETS.join(', ')}`
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Whether the block encoder can write `format` today.
|
|
140
|
+
*
|
|
141
|
+
* @param {GPUTextureFormat} format
|
|
142
|
+
* @returns {boolean}
|
|
143
|
+
*/
|
|
144
|
+
export function texture_encode_implements(format) {
|
|
145
|
+
return ENCODERS.has(format);
|
|
146
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The name texels are stored under: a format's own, or for the sRGB member of a pair the other member's.
|
|
3
|
+
*
|
|
4
|
+
* The two names of a pair are the same bytes. Which of them a texture is created as belongs to what the texture
|
|
5
|
+
* means, its colour space, and not to its bytes, so stored texels are named without it.
|
|
6
|
+
*
|
|
7
|
+
* @param {GPUTextureFormat} format
|
|
8
|
+
* @returns {GPUTextureFormat}
|
|
9
|
+
*/
|
|
10
|
+
export function gpu_texture_format_without_srgb(format: GPUTextureFormat): GPUTextureFormat;
|
|
11
|
+
//# sourceMappingURL=gpu_texture_format_without_srgb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gpu_texture_format_without_srgb.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/format/gpu_texture_format_without_srgb.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,4FAEC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { gpu_texture_format_srg_to_linear } from "./gpu_texture_format_srg_to_linear.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The name texels are stored under: a format's own, or for the sRGB member of a pair the other member's.
|
|
5
|
+
*
|
|
6
|
+
* The two names of a pair are the same bytes. Which of them a texture is created as belongs to what the texture
|
|
7
|
+
* means, its colour space, and not to its bytes, so stored texels are named without it.
|
|
8
|
+
*
|
|
9
|
+
* @param {GPUTextureFormat} format
|
|
10
|
+
* @returns {GPUTextureFormat}
|
|
11
|
+
*/
|
|
12
|
+
export function gpu_texture_format_without_srgb(format) {
|
|
13
|
+
return format.endsWith("-srgb") ? gpu_texture_format_srg_to_linear(format) : format;
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The block formats to build for a texture with this role so that every device finds the one it would choose.
|
|
3
|
+
*
|
|
4
|
+
* Each device picks the first entry of {@link texture_format_preference} it can sample. This is the set of those
|
|
5
|
+
* picks over every kind of device WebGPU allows, and nothing else: a format no device would pick is never fetched,
|
|
6
|
+
* and leaving out one a device would pick sends that device to the uncompressed fallback. The order is the
|
|
7
|
+
* preference order.
|
|
8
|
+
*
|
|
9
|
+
* Names are the non-sRGB ones, as the preference list's are; the sRGB variant is the same bytes.
|
|
10
|
+
*
|
|
11
|
+
* @param {TextureRole|number} role
|
|
12
|
+
* @returns {GPUTextureFormat[]}
|
|
13
|
+
* @throws {Error} for a value that is not a {@link TextureRole}
|
|
14
|
+
*
|
|
15
|
+
* @author Alex Goldring
|
|
16
|
+
* @copyright Company Named Limited (c) 2026
|
|
17
|
+
*/
|
|
18
|
+
export function texture_formats_to_build(role: TextureRole | number): GPUTextureFormat[];
|
|
19
|
+
import { TextureRole } from "../TextureRole.js";
|
|
20
|
+
//# sourceMappingURL=texture_formats_to_build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texture_formats_to_build.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/format/texture_formats_to_build.js"],"names":[],"mappings":"AA+DA;;;;;;;;;;;;;;;;GAgBG;AACH,+CAPW,WAAW,GAAC,MAAM,GAChB,kBAAkB,CAuB9B;4BA9F2B,mBAAmB"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { gpu_texture_format_feature } from "../../../descriptor/texture/format/gpu_texture_format_feature.js";
|
|
2
|
+
import { gpu_texture_format_names } from "../../../descriptor/texture/format/gpu_texture_format_info.js";
|
|
3
|
+
import { WebGPUExtensionType } from "../../../descriptor/WebGPUExtensionType.js";
|
|
4
|
+
import { TextureRole } from "../TextureRole.js";
|
|
5
|
+
import { texture_format_preference } from "./texture_format_preference.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* What WebGPU promises of every adapter's compression support: at least one of these sets of features is
|
|
9
|
+
* supported whole (WebGPU, "Adapter Capability Guarantees").
|
|
10
|
+
*
|
|
11
|
+
* @readonly
|
|
12
|
+
* @type {GPUFeatureName[][]}
|
|
13
|
+
*/
|
|
14
|
+
const ADAPTER_GUARANTEE = [
|
|
15
|
+
[WebGPUExtensionType.TextureCompressionBC],
|
|
16
|
+
[WebGPUExtensionType.TextureCompressionETC2, WebGPUExtensionType.TextureCompressionASTC],
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Every compressed format, by the feature it arrives under.
|
|
21
|
+
*
|
|
22
|
+
* @readonly
|
|
23
|
+
* @type {Map<GPUFeatureName, GPUTextureFormat[]>}
|
|
24
|
+
*/
|
|
25
|
+
const FORMATS_BY_FEATURE = new Map();
|
|
26
|
+
|
|
27
|
+
for (const format of gpu_texture_format_names()) {
|
|
28
|
+
const feature = gpu_texture_format_feature(format);
|
|
29
|
+
|
|
30
|
+
if (feature === undefined) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!FORMATS_BY_FEATURE.has(feature)) {
|
|
35
|
+
FORMATS_BY_FEATURE.set(feature, []);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
FORMATS_BY_FEATURE.get(feature).push(format);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* What each kind of device WebGPU allows can sample: one set of formats for every combination of compression
|
|
43
|
+
* features that meets {@link ADAPTER_GUARANTEE}.
|
|
44
|
+
*
|
|
45
|
+
* @readonly
|
|
46
|
+
* @type {Set<GPUTextureFormat>[]}
|
|
47
|
+
*/
|
|
48
|
+
const DEVICES = [];
|
|
49
|
+
|
|
50
|
+
{
|
|
51
|
+
const features = [...FORMATS_BY_FEATURE.keys()];
|
|
52
|
+
|
|
53
|
+
for (let mask = 0; mask < (1 << features.length); mask++) {
|
|
54
|
+
const has = features.filter((feature, bit) => (mask & (1 << bit)) !== 0);
|
|
55
|
+
|
|
56
|
+
if (!ADAPTER_GUARANTEE.some(required => required.every(feature => has.includes(feature)))) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
DEVICES.push(new Set(has.flatMap(feature => FORMATS_BY_FEATURE.get(feature))));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The block formats to build for a texture with this role so that every device finds the one it would choose.
|
|
66
|
+
*
|
|
67
|
+
* Each device picks the first entry of {@link texture_format_preference} it can sample. This is the set of those
|
|
68
|
+
* picks over every kind of device WebGPU allows, and nothing else: a format no device would pick is never fetched,
|
|
69
|
+
* and leaving out one a device would pick sends that device to the uncompressed fallback. The order is the
|
|
70
|
+
* preference order.
|
|
71
|
+
*
|
|
72
|
+
* Names are the non-sRGB ones, as the preference list's are; the sRGB variant is the same bytes.
|
|
73
|
+
*
|
|
74
|
+
* @param {TextureRole|number} role
|
|
75
|
+
* @returns {GPUTextureFormat[]}
|
|
76
|
+
* @throws {Error} for a value that is not a {@link TextureRole}
|
|
77
|
+
*
|
|
78
|
+
* @author Alex Goldring
|
|
79
|
+
* @copyright Company Named Limited (c) 2026
|
|
80
|
+
*/
|
|
81
|
+
export function texture_formats_to_build(role) {
|
|
82
|
+
if (!Object.values(TextureRole).includes(role)) {
|
|
83
|
+
throw new Error(`${role} is not a TextureRole`);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const chosen = new Set();
|
|
87
|
+
|
|
88
|
+
for (const support of DEVICES) {
|
|
89
|
+
const format = texture_format_preference(role, support)[0];
|
|
90
|
+
|
|
91
|
+
if (format !== undefined) {
|
|
92
|
+
chosen.add(format);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// in preference order, which is the order of the list every device reads
|
|
97
|
+
return texture_format_preference(role, chosen);
|
|
98
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGPUMipmapGenerator.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebGPUMipmapGenerator.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js"],"names":[],"mappings":"AA8LA;;;GAGG;AACH;IAoEI;;;OAGG;IACH,+BAiBC;IAxFD;;OAEG;IACH,kBAAM;IAEN;;;;OAIG;IACH,oBAFU,QAAQ,eAAe,oBAAoB,CAE3B;IAE1B;;OAEG;IACH,oBAAQ;IA4CR,gBAMC;IAmED;;;;;OAKG;IACH,yEAFW,iBAAiB,QAY3B;IAED;;;OAGG;IACH,wBAFW,MAAM,QAyBhB;IAED;;OAEG;IACH,cAEC;IA+HG,qBAiBE;IAEF,oBAGE;IAGN;;;;;;;;;;;;OAYG;IACH,uFARW,iBAAiB,6DAIjB;QAAC,OAAO,QAAa,IAAI,CAAA;KAAC,EAAE,cAYtC;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,2FATW,iBAAiB,WACjB,YAAY,gBAGZ,MAAM,6DAEN;QAAC,OAAO,QAAa,IAAI,CAAA;KAAC,EAAE,cAsBtC;;CAscJ;wBAphCuB,4CAA4C;AA2CpE;IAEI;;OAEG;IACH,yBAAO;IAEP;;OAEG;IACH;;;;QA1BA;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;;;MAgBI;IAEP;;;OAGG;IACH,SAFU,OAAO,CAED;IAEhB;;;;OAIG;IACH,cAHW,eAAe,GACd,OAAO,CAOlB;IAED;;;OAGG;IACH,QAFY,MAAM,CAOjB;CAEJ;kCA1EiC,yBAAyB"}
|
|
@@ -102,12 +102,6 @@ class FilterProcessDescriptor {
|
|
|
102
102
|
*/
|
|
103
103
|
base_filter;
|
|
104
104
|
|
|
105
|
-
/**
|
|
106
|
-
* Kernel support size, in output pixels.
|
|
107
|
-
* @type {number}
|
|
108
|
-
*/
|
|
109
|
-
support = 1;
|
|
110
|
-
|
|
111
105
|
/**
|
|
112
106
|
* How far back to sample from, in mipmap levels.
|
|
113
107
|
* Only valid when {@link base_filter} and {@link filter} are different.
|
|
@@ -118,21 +112,16 @@ class FilterProcessDescriptor {
|
|
|
118
112
|
/**
|
|
119
113
|
*
|
|
120
114
|
* @param {Object} options
|
|
121
|
-
* @param {number} options.support
|
|
122
115
|
* @param {number} [options.skip_distance]
|
|
123
116
|
* @param {FilterShaderType} options.filter
|
|
124
117
|
* @param {FilterShaderType} options.base_filter
|
|
125
118
|
* @returns {FilterProcessDescriptor}
|
|
126
119
|
*/
|
|
127
120
|
static from({
|
|
128
|
-
support = 1,
|
|
129
121
|
skip_distance = 0,
|
|
130
122
|
filter = FilterShaderType.Linear,
|
|
131
123
|
base_filter = FilterShaderType.Linear,
|
|
132
124
|
}) {
|
|
133
|
-
assert.isNumber(support, 'support');
|
|
134
|
-
assert.greaterThanOrEqual(support, 0, 'support');
|
|
135
|
-
|
|
136
125
|
assert.isNumber(skip_distance, 'skip_distance');
|
|
137
126
|
assert.isNonNegativeInteger(skip_distance, 'skip_distance');
|
|
138
127
|
|
|
@@ -140,7 +129,6 @@ class FilterProcessDescriptor {
|
|
|
140
129
|
|
|
141
130
|
r.filter = filter;
|
|
142
131
|
r.base_filter = base_filter;
|
|
143
|
-
r.support = support;
|
|
144
132
|
r.skip_distance = skip_distance;
|
|
145
133
|
|
|
146
134
|
return r;
|
|
@@ -158,35 +146,29 @@ const DEFAULT_SKIP_DISTANCE = 2;
|
|
|
158
146
|
*/
|
|
159
147
|
const FILTER_PROCESSES = {
|
|
160
148
|
[TextureFilterType.Linear]: FilterProcessDescriptor.from({
|
|
161
|
-
support: 1,
|
|
162
149
|
filter: FilterShaderType.Linear,
|
|
163
150
|
base_filter: FilterShaderType.Linear,
|
|
164
151
|
}),
|
|
165
152
|
[TextureFilterType.LinearNormal]: FilterProcessDescriptor.from({
|
|
166
|
-
support: 1,
|
|
167
153
|
filter: FilterShaderType.LinearNormal,
|
|
168
154
|
base_filter: FilterShaderType.Linear,
|
|
169
155
|
}),
|
|
170
156
|
[TextureFilterType.Mitchell]: FilterProcessDescriptor.from({
|
|
171
|
-
support: 2,
|
|
172
157
|
filter: FilterShaderType.Mitchell,
|
|
173
158
|
skip_distance: DEFAULT_SKIP_DISTANCE,
|
|
174
159
|
base_filter: FilterShaderType.MagicKernelBase,
|
|
175
160
|
}),
|
|
176
161
|
[TextureFilterType.MagicKernelSharp]: FilterProcessDescriptor.from({
|
|
177
|
-
support: 3.5,
|
|
178
162
|
filter: FilterShaderType.MagicKernelSharp,
|
|
179
163
|
skip_distance: 1,
|
|
180
164
|
base_filter: FilterShaderType.MagicKernelSharp,
|
|
181
165
|
}),
|
|
182
166
|
[TextureFilterType.CatmullRom]: FilterProcessDescriptor.from({
|
|
183
|
-
support: 2,
|
|
184
167
|
filter: FilterShaderType.CatmullRom,
|
|
185
168
|
skip_distance: DEFAULT_SKIP_DISTANCE,
|
|
186
169
|
base_filter: FilterShaderType.Linear,
|
|
187
170
|
}),
|
|
188
171
|
[TextureFilterType.Wronski2021]: FilterProcessDescriptor.from({
|
|
189
|
-
support: 5,
|
|
190
172
|
filter: FilterShaderType.Wronski2021,
|
|
191
173
|
skip_distance: 1,
|
|
192
174
|
base_filter: FilterShaderType.Linear,
|
|
@@ -286,10 +268,9 @@ export class WebGPUMipmapGenerator {
|
|
|
286
268
|
this.device = device;
|
|
287
269
|
|
|
288
270
|
/*
|
|
289
|
-
`magFilter` as well as `minFilter`. Most filters read exact texels with `textureLoad
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
the default 'nearest', every one of its bilinear taps read a single texel.
|
|
271
|
+
`magFilter` as well as `minFilter`. Most filters read exact texels with `textureLoad`.
|
|
272
|
+
Wronski2021 and the atlas region reduction sample between texels at an explicit level 0, and
|
|
273
|
+
an explicit level 0 is magnification, so it is `magFilter` that makes their taps bilinear.
|
|
293
274
|
*/
|
|
294
275
|
this.sampler = device.createSampler({ minFilter: 'linear', magFilter: 'linear' });
|
|
295
276
|
|
|
@@ -408,7 +389,7 @@ export class WebGPUMipmapGenerator {
|
|
|
408
389
|
|
|
409
390
|
assert.enum(filter, FilterShaderType, 'filter');
|
|
410
391
|
|
|
411
|
-
const filter_key_name = objectKeyByValue(
|
|
392
|
+
const filter_key_name = objectKeyByValue(FilterShaderType, filter);
|
|
412
393
|
|
|
413
394
|
/**
|
|
414
395
|
* @type {CodeChunk}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bilinear sample footprints along one axis of a source level: for each slot, the two texels a
|
|
3
|
+
* linear, clamp-to-edge sampler blends and their weights.
|
|
4
|
+
*
|
|
5
|
+
* A slot is placed from a normalised coordinate as the sampler places it: `p = uv * size - 0.5`, the
|
|
6
|
+
* texels `floor(p)` and `floor(p) + 1` clamped into the level, weighed `1 - fract(p)` and `fract(p)`.
|
|
7
|
+
* The weights are kept at double precision, unrounded, as `cpu_texture_sample` forms them.
|
|
8
|
+
*
|
|
9
|
+
* @author Alex Goldring
|
|
10
|
+
* @copyright Company Named Limited (c) 2026
|
|
11
|
+
*/
|
|
12
|
+
export class MipmapBilinearAxis {
|
|
13
|
+
/**
|
|
14
|
+
* @param {number} slot_count
|
|
15
|
+
*/
|
|
16
|
+
constructor(slot_count: number);
|
|
17
|
+
/**
|
|
18
|
+
* @readonly
|
|
19
|
+
* @type {Uint32Array}
|
|
20
|
+
*/
|
|
21
|
+
readonly lower: Uint32Array;
|
|
22
|
+
/**
|
|
23
|
+
* @readonly
|
|
24
|
+
* @type {Uint32Array}
|
|
25
|
+
*/
|
|
26
|
+
readonly upper: Uint32Array;
|
|
27
|
+
/**
|
|
28
|
+
* @readonly
|
|
29
|
+
* @type {Float64Array}
|
|
30
|
+
*/
|
|
31
|
+
readonly lower_weight: Float64Array;
|
|
32
|
+
/**
|
|
33
|
+
* @readonly
|
|
34
|
+
* @type {Float64Array}
|
|
35
|
+
*/
|
|
36
|
+
readonly upper_weight: Float64Array;
|
|
37
|
+
/**
|
|
38
|
+
* Place `slot` at normalised coordinate `uv` of an axis `size` texels long.
|
|
39
|
+
*
|
|
40
|
+
* @param {number} slot
|
|
41
|
+
* @param {number} uv an f32
|
|
42
|
+
* @param {number} size
|
|
43
|
+
*/
|
|
44
|
+
place(slot: number, uv: number, size: number): void;
|
|
45
|
+
/**
|
|
46
|
+
* Place `slot` on an axis one texel long that is sampled as a texture of one dimension fewer:
|
|
47
|
+
* texel 0 with a weight of exactly 1, wherever along the axis the sample falls.
|
|
48
|
+
*
|
|
49
|
+
* @param {number} slot
|
|
50
|
+
*/
|
|
51
|
+
place_single(slot: number): void;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=MipmapBilinearAxis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MipmapBilinearAxis.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/cpu/MipmapBilinearAxis.js"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH;IACI;;OAEG;IACH,wBAFW,MAAM,EA0BhB;IAvBG;;;OAGG;IACH,gBAFU,WAAW,CAEmB;IAExC;;;OAGG;IACH,gBAFU,WAAW,CAEmB;IAExC;;;OAGG;IACH,uBAFU,YAAY,CAE0B;IAEhD;;;OAGG;IACH,uBAFU,YAAY,CAE0B;IAGpD;;;;;;OAMG;IACH,YAJW,MAAM,MACN,MAAM,QACN,MAAM,QAchB;IAED;;;;;OAKG;IACH,mBAFW,MAAM,QAQhB;CACJ"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bilinear sample footprints along one axis of a source level: for each slot, the two texels a
|
|
3
|
+
* linear, clamp-to-edge sampler blends and their weights.
|
|
4
|
+
*
|
|
5
|
+
* A slot is placed from a normalised coordinate as the sampler places it: `p = uv * size - 0.5`, the
|
|
6
|
+
* texels `floor(p)` and `floor(p) + 1` clamped into the level, weighed `1 - fract(p)` and `fract(p)`.
|
|
7
|
+
* The weights are kept at double precision, unrounded, as `cpu_texture_sample` forms them.
|
|
8
|
+
*
|
|
9
|
+
* @author Alex Goldring
|
|
10
|
+
* @copyright Company Named Limited (c) 2026
|
|
11
|
+
*/
|
|
12
|
+
export class MipmapBilinearAxis {
|
|
13
|
+
/**
|
|
14
|
+
* @param {number} slot_count
|
|
15
|
+
*/
|
|
16
|
+
constructor(slot_count) {
|
|
17
|
+
/**
|
|
18
|
+
* @readonly
|
|
19
|
+
* @type {Uint32Array}
|
|
20
|
+
*/
|
|
21
|
+
this.lower = new Uint32Array(slot_count);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @readonly
|
|
25
|
+
* @type {Uint32Array}
|
|
26
|
+
*/
|
|
27
|
+
this.upper = new Uint32Array(slot_count);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @readonly
|
|
31
|
+
* @type {Float64Array}
|
|
32
|
+
*/
|
|
33
|
+
this.lower_weight = new Float64Array(slot_count);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @readonly
|
|
37
|
+
* @type {Float64Array}
|
|
38
|
+
*/
|
|
39
|
+
this.upper_weight = new Float64Array(slot_count);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Place `slot` at normalised coordinate `uv` of an axis `size` texels long.
|
|
44
|
+
*
|
|
45
|
+
* @param {number} slot
|
|
46
|
+
* @param {number} uv an f32
|
|
47
|
+
* @param {number} size
|
|
48
|
+
*/
|
|
49
|
+
place(slot, uv, size) {
|
|
50
|
+
const p = uv * size - 0.5;
|
|
51
|
+
const below = Math.floor(p);
|
|
52
|
+
const fraction = p - below;
|
|
53
|
+
|
|
54
|
+
const last = size - 1;
|
|
55
|
+
|
|
56
|
+
this.lower[slot] = below < 0 ? 0 : (below > last ? last : below);
|
|
57
|
+
this.upper[slot] = below + 1 < 0 ? 0 : (below + 1 > last ? last : below + 1);
|
|
58
|
+
|
|
59
|
+
this.lower_weight[slot] = 1 - fraction;
|
|
60
|
+
this.upper_weight[slot] = fraction;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Place `slot` on an axis one texel long that is sampled as a texture of one dimension fewer:
|
|
65
|
+
* texel 0 with a weight of exactly 1, wherever along the axis the sample falls.
|
|
66
|
+
*
|
|
67
|
+
* @param {number} slot
|
|
68
|
+
*/
|
|
69
|
+
place_single(slot) {
|
|
70
|
+
this.lower[slot] = 0;
|
|
71
|
+
this.upper[slot] = 0;
|
|
72
|
+
|
|
73
|
+
this.lower_weight[slot] = 1;
|
|
74
|
+
this.upper_weight[slot] = 0;
|
|
75
|
+
}
|
|
76
|
+
}
|