@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
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { BinaryClassSerializationAdapter } from "../../../../engine/ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
|
+
import { ColorSpace } from "../../texture/ColorSpace.js";
|
|
3
|
+
import { TextureFilterType } from "../../texture/TextureFilterType.js";
|
|
4
|
+
import { TextureRole } from "../../texture/TextureRole.js";
|
|
5
|
+
import { TextureVariantSet } from "../../texture/TextureVariantSet.js";
|
|
6
|
+
import { MTFTexture } from "./MTFTexture.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {import("../../../../core/binary/BinaryBuffer.js").BinaryBuffer} BinaryBuffer
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type {Set<number>}
|
|
14
|
+
*/
|
|
15
|
+
const ROLES = new Set(Object.values(TextureRole));
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @type {Set<number>}
|
|
19
|
+
*/
|
|
20
|
+
const COLOR_SPACES = new Set(Object.values(ColorSpace));
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @type {Set<number>}
|
|
24
|
+
*/
|
|
25
|
+
const FILTERS = new Set(Object.values(TextureFilterType));
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* An {@link MTFTexture} on disk.
|
|
29
|
+
*
|
|
30
|
+
* <pre>
|
|
31
|
+
* UTF8 name
|
|
32
|
+
* u8 role {@link TextureRole}
|
|
33
|
+
* u8 color_space {@link ColorSpace}
|
|
34
|
+
* u8 flags {@link ShadeTextureFlags}
|
|
35
|
+
* u8 mipmap_generation_filter {@link TextureFilterType}
|
|
36
|
+
* u32 sampler as {@link sampler_descriptor_pack} packs one
|
|
37
|
+
* UTF8 fallback URI of an encoding every device can use
|
|
38
|
+
* UintVar format count, which may be 0
|
|
39
|
+
* formats each: UTF8 WebGPU format name, the non-sRGB one of its pair, then UTF8 URI of a texture file in it
|
|
40
|
+
* </pre>
|
|
41
|
+
*
|
|
42
|
+
* The last three fields are a {@link TextureVariantSet}. Formats are kept in the order written.
|
|
43
|
+
*
|
|
44
|
+
* @extends BinaryClassSerializationAdapter<MTFTexture>
|
|
45
|
+
*
|
|
46
|
+
* @author Alex Goldring
|
|
47
|
+
* @copyright Company Named Limited (c) 2026
|
|
48
|
+
*/
|
|
49
|
+
export class MTFTextureSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
50
|
+
klass = MTFTexture;
|
|
51
|
+
version = 0;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @param {BinaryBuffer} buffer
|
|
55
|
+
* @param {MTFTexture} value
|
|
56
|
+
*/
|
|
57
|
+
serialize(buffer, value) {
|
|
58
|
+
const variants = value.variants;
|
|
59
|
+
|
|
60
|
+
if (variants === null) {
|
|
61
|
+
// not an assert: a record with nowhere to fetch its texture from is a package that cannot be loaded
|
|
62
|
+
throw new Error(`texture '${value.name}' names no files: its variants are not set`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
buffer.writeUTF8String(value.name);
|
|
66
|
+
|
|
67
|
+
buffer.writeUint8(value.role);
|
|
68
|
+
buffer.writeUint8(value.color_space);
|
|
69
|
+
buffer.writeUint8(value.flags);
|
|
70
|
+
buffer.writeUint8(value.mipmap_generation_filter);
|
|
71
|
+
buffer.writeUint32(value.sampler);
|
|
72
|
+
|
|
73
|
+
buffer.writeUTF8String(variants.fallback);
|
|
74
|
+
|
|
75
|
+
const formats = variants.formats;
|
|
76
|
+
|
|
77
|
+
buffer.writeUintVar(formats.length);
|
|
78
|
+
|
|
79
|
+
for (let i = 0; i < formats.length; i++) {
|
|
80
|
+
const format = formats[i];
|
|
81
|
+
|
|
82
|
+
buffer.writeUTF8String(format);
|
|
83
|
+
buffer.writeUTF8String(variants.path(format));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @param {BinaryBuffer} buffer
|
|
89
|
+
* @param {MTFTexture} value
|
|
90
|
+
*/
|
|
91
|
+
deserialize(buffer, value) {
|
|
92
|
+
const name = buffer.readUTF8String();
|
|
93
|
+
|
|
94
|
+
const role = buffer.readUint8();
|
|
95
|
+
const color_space = buffer.readUint8();
|
|
96
|
+
const flags = buffer.readUint8();
|
|
97
|
+
const mipmap_generation_filter = buffer.readUint8();
|
|
98
|
+
const sampler = buffer.readUint32();
|
|
99
|
+
|
|
100
|
+
if (!ROLES.has(role)) {
|
|
101
|
+
throw new Error(`texture '${name}' has role ${role}, which is not a TextureRole`);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (!COLOR_SPACES.has(color_space)) {
|
|
105
|
+
throw new Error(`texture '${name}' has colour space ${color_space}, which is not a ColorSpace`);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (!FILTERS.has(mipmap_generation_filter)) {
|
|
109
|
+
throw new Error(`texture '${name}' has mip generation filter ${mipmap_generation_filter}, which is not a TextureFilterType`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const fallback = buffer.readUTF8String();
|
|
113
|
+
|
|
114
|
+
const format_count = buffer.readUintVar();
|
|
115
|
+
|
|
116
|
+
/** @type {[string, string][]} */
|
|
117
|
+
const by_format = new Array(format_count);
|
|
118
|
+
|
|
119
|
+
for (let i = 0; i < format_count; i++) {
|
|
120
|
+
const format = buffer.readUTF8String();
|
|
121
|
+
const uri = buffer.readUTF8String();
|
|
122
|
+
|
|
123
|
+
by_format[i] = [format, uri];
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
value.name = name;
|
|
127
|
+
value.role = role;
|
|
128
|
+
value.color_space = color_space;
|
|
129
|
+
value.flags = flags;
|
|
130
|
+
value.mipmap_generation_filter = mipmap_generation_filter;
|
|
131
|
+
value.sampler = sampler;
|
|
132
|
+
|
|
133
|
+
// refuses a name that is not a texture format
|
|
134
|
+
value.variants = new TextureVariantSet(fallback, by_format);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MTF_PACKAGE_MAGIC.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/MTF_PACKAGE_MAGIC.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,gCAFU,MAAM,CAE4B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The version of the MTF package this engine writes, and the newest it reads. It says which collections a
|
|
3
|
+
* package holds, and nothing else: each collection carries the version of its own class.
|
|
4
|
+
*
|
|
5
|
+
* @type {number}
|
|
6
|
+
*/
|
|
7
|
+
export const MTF_PACKAGE_VERSION: number;
|
|
8
|
+
//# sourceMappingURL=MTF_PACKAGE_VERSION.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MTF_PACKAGE_VERSION.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/MTF_PACKAGE_VERSION.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,kCAFU,MAAM,CAEqB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The version of the MTF package this engine writes, and the newest it reads. It says which collections a
|
|
3
|
+
* package holds, and nothing else: each collection carries the version of its own class.
|
|
4
|
+
*
|
|
5
|
+
* @type {number}
|
|
6
|
+
*/
|
|
7
|
+
export const MTF_PACKAGE_VERSION = 0;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MTF_TEXTURE_MAGIC.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/MTF_TEXTURE_MAGIC.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,gCAFU,MAAM,CAE4B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MTF_TEXTURE_VERSION.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/MTF_TEXTURE_VERSION.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,kCAFU,MAAM,CAEqB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("../../../../engine/asset/AssetManager.js").AssetManager} AssetManager
|
|
3
|
+
* @typedef {import("../../../../engine/asset/AssetRequestScope.js").AssetRequestScope} AssetRequestScope
|
|
4
|
+
* @typedef {import("../SceneBundle.js").SceneBundle} SceneBundle
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Loads an MTF package: the model it holds, as the {@link SceneBundle} every loader produces, with its skins and
|
|
8
|
+
* clips.
|
|
9
|
+
*
|
|
10
|
+
* Of each texture, one file is fetched: the best encoding built for it that this device can sample
|
|
11
|
+
* ({@link mtf_texture_select}), or its fallback where none is. Every file comes through the asset manager
|
|
12
|
+
* under its resolved URL ({@link mtf_resolve_uri}), so a texture two packages name is fetched once and both hold
|
|
13
|
+
* the same image.
|
|
14
|
+
*
|
|
15
|
+
* Nothing is built on the way. Geometry is read as it was written, tree included; texels from a texture file go
|
|
16
|
+
* to the device as they are; clips are read finished. A fallback that is an image is decoded, and has its mips
|
|
17
|
+
* generated, as any image's are.
|
|
18
|
+
*
|
|
19
|
+
* The bundle is ready when its textures are.
|
|
20
|
+
*
|
|
21
|
+
* @param {string} url un-resolved — the asset manager resolves network paths
|
|
22
|
+
* @param {object} options
|
|
23
|
+
* @param {AssetManager} options.assetManager where the package and its textures come from, with a loader
|
|
24
|
+
* registered for {@link GameAssetType.TextureMTF}
|
|
25
|
+
* @param {AssetRequestScope} [options.scope] the load these requests belong to
|
|
26
|
+
* @param {Set<GPUTextureFormat>} options.texture_support what the device can sample, from
|
|
27
|
+
* `gpu_texture_compression_support(device)`. An empty set asks for every texture's fallback
|
|
28
|
+
* @returns {Promise<SceneBundle>}
|
|
29
|
+
*
|
|
30
|
+
* @author Alex Goldring
|
|
31
|
+
* @copyright Company Named Limited (c) 2026
|
|
32
|
+
*/
|
|
33
|
+
export function load_mtf(url: string, { assetManager, scope, texture_support }: {
|
|
34
|
+
assetManager: import("../../../../engine/asset/AssetManager.js").AssetManager<any>;
|
|
35
|
+
scope?: AssetRequestScope;
|
|
36
|
+
texture_support: Set<GPUTextureFormat>;
|
|
37
|
+
}): Promise<SceneBundle>;
|
|
38
|
+
export type AssetManager = import("../../../../engine/asset/AssetManager.js").AssetManager<any>;
|
|
39
|
+
export type AssetRequestScope = import("../../../../engine/asset/AssetRequestScope.js").AssetRequestScope;
|
|
40
|
+
export type SceneBundle = import("../SceneBundle.js").SceneBundle;
|
|
41
|
+
//# sourceMappingURL=load_mtf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load_mtf.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/load_mtf.js"],"names":[],"mappings":"AAQA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,8BAZW,MAAM;IAEgB,YAAY;IAEN,KAAK,GAAjC,iBAAiB;IACc,eAAe,EAA9C,qBAAqB;IAEnB,QAAQ,WAAW,CAAC,CAoChC;;gCA9DY,OAAO,+CAA+C,EAAE,iBAAiB;0BACzE,OAAO,mBAAmB,EAAE,WAAW"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { assert } from "../../../../core/assert.js";
|
|
2
|
+
import { BinaryBuffer } from "../../../../core/binary/BinaryBuffer.js";
|
|
3
|
+
import { GameAssetType } from "../../../../engine/asset/GameAssetType.js";
|
|
4
|
+
import { mtf_read_scene } from "./mtf_read_scene.js";
|
|
5
|
+
import { mtf_read_textures } from "./mtf_read_textures.js";
|
|
6
|
+
import { mtf_resolve_uri } from "./mtf_resolve_uri.js";
|
|
7
|
+
import { mtf_texture_select } from "./mtf_texture_select.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {import("../../../../engine/asset/AssetManager.js").AssetManager} AssetManager
|
|
11
|
+
* @typedef {import("../../../../engine/asset/AssetRequestScope.js").AssetRequestScope} AssetRequestScope
|
|
12
|
+
* @typedef {import("../SceneBundle.js").SceneBundle} SceneBundle
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Loads an MTF package: the model it holds, as the {@link SceneBundle} every loader produces, with its skins and
|
|
17
|
+
* clips.
|
|
18
|
+
*
|
|
19
|
+
* Of each texture, one file is fetched: the best encoding built for it that this device can sample
|
|
20
|
+
* ({@link mtf_texture_select}), or its fallback where none is. Every file comes through the asset manager
|
|
21
|
+
* under its resolved URL ({@link mtf_resolve_uri}), so a texture two packages name is fetched once and both hold
|
|
22
|
+
* the same image.
|
|
23
|
+
*
|
|
24
|
+
* Nothing is built on the way. Geometry is read as it was written, tree included; texels from a texture file go
|
|
25
|
+
* to the device as they are; clips are read finished. A fallback that is an image is decoded, and has its mips
|
|
26
|
+
* generated, as any image's are.
|
|
27
|
+
*
|
|
28
|
+
* The bundle is ready when its textures are.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} url un-resolved — the asset manager resolves network paths
|
|
31
|
+
* @param {object} options
|
|
32
|
+
* @param {AssetManager} options.assetManager where the package and its textures come from, with a loader
|
|
33
|
+
* registered for {@link GameAssetType.TextureMTF}
|
|
34
|
+
* @param {AssetRequestScope} [options.scope] the load these requests belong to
|
|
35
|
+
* @param {Set<GPUTextureFormat>} options.texture_support what the device can sample, from
|
|
36
|
+
* `gpu_texture_compression_support(device)`. An empty set asks for every texture's fallback
|
|
37
|
+
* @returns {Promise<SceneBundle>}
|
|
38
|
+
*
|
|
39
|
+
* @author Alex Goldring
|
|
40
|
+
* @copyright Company Named Limited (c) 2026
|
|
41
|
+
*/
|
|
42
|
+
export async function load_mtf(url, { assetManager, scope, texture_support }) {
|
|
43
|
+
assert.isString(url, 'url');
|
|
44
|
+
assert.defined(assetManager, 'assetManager');
|
|
45
|
+
assert.defined(texture_support, 'texture_support');
|
|
46
|
+
|
|
47
|
+
const file = await assetManager.promise(url, GameAssetType.ArrayBuffer, { scope });
|
|
48
|
+
|
|
49
|
+
const buffer = BinaryBuffer.fromArrayBuffer(file.create());
|
|
50
|
+
|
|
51
|
+
const records = mtf_read_textures(buffer);
|
|
52
|
+
const count = records.length;
|
|
53
|
+
|
|
54
|
+
const requests = new Array(count);
|
|
55
|
+
|
|
56
|
+
for (let i = 0; i < count; i++) {
|
|
57
|
+
const record = records[i];
|
|
58
|
+
|
|
59
|
+
const uri = mtf_texture_select(record.variants, record.role, texture_support);
|
|
60
|
+
|
|
61
|
+
requests[i] = assetManager.promise(mtf_resolve_uri(uri, url), GameAssetType.TextureMTF, { scope });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const images = await Promise.all(requests);
|
|
65
|
+
|
|
66
|
+
const textures = new Array(count);
|
|
67
|
+
|
|
68
|
+
for (let i = 0; i < count; i++) {
|
|
69
|
+
textures[i] = records[i].to_shade_texture(images[i].create());
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return mtf_read_scene(buffer, textures);
|
|
73
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The textures a bundle's materials name, each once, in the order an MTF package holds their records: nodes in
|
|
3
|
+
* their order, and for each material met for the first time its albedo, normal, occlusion-roughness-metalness
|
|
4
|
+
* and emissive slots.
|
|
5
|
+
*
|
|
6
|
+
* A texture's role is that of the first slot that names it. The role is what its encodings are chosen by, so one
|
|
7
|
+
* texture under two roles gets the encodings of the first.
|
|
8
|
+
*
|
|
9
|
+
* @param {SceneBundle} bundle
|
|
10
|
+
* @returns {Map<ShadeTexture, TextureRole|number>} texture to role, in record order
|
|
11
|
+
*
|
|
12
|
+
* @author Alex Goldring
|
|
13
|
+
* @copyright Company Named Limited (c) 2026
|
|
14
|
+
*/
|
|
15
|
+
export function mtf_bundle_textures(bundle: SceneBundle): Map<ShadeTexture, TextureRole | number>;
|
|
16
|
+
export type SceneBundle = import("../SceneBundle.js").SceneBundle;
|
|
17
|
+
export type ShadeTexture = import("../../texture/ShadeTexture.js").ShadeTexture;
|
|
18
|
+
import { TextureRole } from "../../texture/TextureRole.js";
|
|
19
|
+
//# sourceMappingURL=mtf_bundle_textures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mtf_bundle_textures.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_bundle_textures.js"],"names":[],"mappings":"AAkBA;;;;;;;;;;;;;GAaG;AACH,4CANW,WAAW,GACT,IAAI,YAAY,EAAE,WAAW,GAAC,MAAM,CAAC,CA6BjD;0BArDY,OAAO,mBAAmB,EAAE,WAAW;2BACvC,OAAO,+BAA+B,EAAE,YAAY;4BAJrC,8BAA8B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { TextureRole } from "../../texture/TextureRole.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {import("../SceneBundle.js").SceneBundle} SceneBundle
|
|
5
|
+
* @typedef {import("../../texture/ShadeTexture.js").ShadeTexture} ShadeTexture
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {Map<ShadeTexture, number>} roles
|
|
10
|
+
* @param {ShadeTexture|undefined} texture
|
|
11
|
+
* @param {TextureRole|number} role
|
|
12
|
+
*/
|
|
13
|
+
function note(roles, texture, role) {
|
|
14
|
+
if (texture !== undefined && texture !== null && !roles.has(texture)) {
|
|
15
|
+
roles.set(texture, role);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The textures a bundle's materials name, each once, in the order an MTF package holds their records: nodes in
|
|
21
|
+
* their order, and for each material met for the first time its albedo, normal, occlusion-roughness-metalness
|
|
22
|
+
* and emissive slots.
|
|
23
|
+
*
|
|
24
|
+
* A texture's role is that of the first slot that names it. The role is what its encodings are chosen by, so one
|
|
25
|
+
* texture under two roles gets the encodings of the first.
|
|
26
|
+
*
|
|
27
|
+
* @param {SceneBundle} bundle
|
|
28
|
+
* @returns {Map<ShadeTexture, TextureRole|number>} texture to role, in record order
|
|
29
|
+
*
|
|
30
|
+
* @author Alex Goldring
|
|
31
|
+
* @copyright Company Named Limited (c) 2026
|
|
32
|
+
*/
|
|
33
|
+
export function mtf_bundle_textures(bundle) {
|
|
34
|
+
/** @type {Map<ShadeTexture, number>} */
|
|
35
|
+
const roles = new Map();
|
|
36
|
+
|
|
37
|
+
const seen = new Set();
|
|
38
|
+
|
|
39
|
+
const nodes = bundle.nodes;
|
|
40
|
+
|
|
41
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
42
|
+
const material = nodes[i].material;
|
|
43
|
+
|
|
44
|
+
if (material === null || seen.has(material)) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
seen.add(material);
|
|
49
|
+
|
|
50
|
+
note(roles, material.texture_albedo, TextureRole.Albedo);
|
|
51
|
+
note(roles, material.texture_normal, TextureRole.Normal);
|
|
52
|
+
note(roles, material.texture_orm, TextureRole.Orm);
|
|
53
|
+
note(roles, material.texture_emissive, TextureRole.Emissive);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return roles;
|
|
57
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function mtf_encode_texture(texture: ShadeTexture, role: TextureRole | number, stem: string, files: Map<string, ArrayBuffer>): Promise<TextureVariantSet>;
|
|
2
|
+
export type ShadeTexture = import("../../texture/ShadeTexture.js").ShadeTexture;
|
|
3
|
+
export type TextureRole = import("../../texture/TextureRole.js").TextureRole;
|
|
4
|
+
export type ShadeTexelData = import("../../texture/source/ShadeTexelData.js").ShadeTexelData;
|
|
5
|
+
/**
|
|
6
|
+
* What {@link mtf_export } asks for the files of one texture.
|
|
7
|
+
*/
|
|
8
|
+
export type MTFTextureEncoder = (texture: ShadeTexture, role: TextureRole | number, stem: string, files: Map<string, ArrayBuffer>) => Promise<TextureVariantSet>;
|
|
9
|
+
import { TextureVariantSet } from "../../texture/TextureVariantSet.js";
|
|
10
|
+
//# sourceMappingURL=mtf_encode_texture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mtf_encode_texture.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_encode_texture.js"],"names":[],"mappings":"AAsBG,4CACQ,YAAY,QACZ,WAAW,GAAC,MAAM,QAClB,MAAM,SAEN,IAAI,MAAM,EAAE,WAAW,CAAC,GAEtB,QAAQ,iBAAiB,CAAC,CACtC;2BAhBY,OAAO,+BAA+B,EAAE,YAAY;0BACpD,OAAO,8BAA8B,EAAE,WAAW;6BAClD,OAAO,wCAAwC,EAAE,cAAc;;;;0CAOjE,YAAY,QACZ,WAAW,GAAC,MAAM,QAClB,MAAM,SAEN,IAAI,MAAM,EAAE,WAAW,CAAC,KAEtB,QAAQ,iBAAiB,CAAC;kCAnBL,oCAAoC"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Sampler2D } from "../../../../engine/graphics/texture/sampler/Sampler2D.js";
|
|
2
|
+
import { texel_decode_image, texel_decode_image_reads } from "../../../../format/texture/texel_decode_image.js";
|
|
3
|
+
import { gpu_texture_format_feature } from "../../../descriptor/texture/format/gpu_texture_format_feature.js";
|
|
4
|
+
import { texture_mip_size } from "../../../util/texture_mip_extent.js";
|
|
5
|
+
import { write_image_source } from "../../scene/serialization/write_image_source.js";
|
|
6
|
+
import { ColorSpace } from "../../texture/ColorSpace.js";
|
|
7
|
+
import { gpu_texture_format_without_srgb } from "../../texture/format/gpu_texture_format_without_srgb.js";
|
|
8
|
+
import { ShadeTextureFlags } from "../../texture/ShadeTextureFlags.js";
|
|
9
|
+
import { texture_block_encodings } from "../../texture/texture_block_encodings.js";
|
|
10
|
+
import { texture_role_image_quality } from "../../texture/texture_role_image_quality.js";
|
|
11
|
+
import { TextureVariantSet } from "../../texture/TextureVariantSet.js";
|
|
12
|
+
import { mtf_texture_write } from "./mtf_texture_write.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @typedef {import("../../texture/ShadeTexture.js").ShadeTexture} ShadeTexture
|
|
16
|
+
* @typedef {import("../../texture/TextureRole.js").TextureRole} TextureRole
|
|
17
|
+
* @typedef {import("../../texture/source/ShadeTexelData.js").ShadeTexelData} ShadeTexelData
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* What {@link mtf_export} asks for the files of one texture.
|
|
22
|
+
*
|
|
23
|
+
* @callback MTFTextureEncoder
|
|
24
|
+
* @param {ShadeTexture} texture
|
|
25
|
+
* @param {TextureRole|number} role what the texture is for, which is what its encodings are chosen by
|
|
26
|
+
* @param {string} stem where its files go, relative to the package and without an extension. No two textures of
|
|
27
|
+
* an export are given the same one
|
|
28
|
+
* @param {Map<string, ArrayBuffer>} files the export's files by URI relative to the package; the encoder adds
|
|
29
|
+
* each file it writes
|
|
30
|
+
* @returns {Promise<TextureVariantSet>} which encodings it built, by the URIs it put them under
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The pixels of an `ImageBitmap`, read back through a canvas.
|
|
35
|
+
*
|
|
36
|
+
* @param {ImageBitmap} bitmap
|
|
37
|
+
* @param {string} label for the refusal
|
|
38
|
+
* @returns {Sampler2D} eight-bit RGBA
|
|
39
|
+
*/
|
|
40
|
+
function bitmap_pixels(bitmap, label) {
|
|
41
|
+
if (typeof OffscreenCanvas === "undefined") {
|
|
42
|
+
throw new Error(`texture '${label}' is over an ImageBitmap, and reading its pixels needs OffscreenCanvas, which this environment does not have`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
|
|
46
|
+
const context = canvas.getContext("2d");
|
|
47
|
+
|
|
48
|
+
context.drawImage(bitmap, 0, 0);
|
|
49
|
+
|
|
50
|
+
const image = context.getImageData(0, 0, bitmap.width, bitmap.height);
|
|
51
|
+
|
|
52
|
+
return new Sampler2D(new Uint8Array(image.data.buffer, image.data.byteOffset, image.data.byteLength), 4, bitmap.width, bitmap.height);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Every level of texels, as eight-bit pixels.
|
|
57
|
+
*
|
|
58
|
+
* @param {ShadeTexelData} texels
|
|
59
|
+
* @param {string} label for the refusal
|
|
60
|
+
* @returns {Sampler2D[]}
|
|
61
|
+
*/
|
|
62
|
+
function texel_pixels(texels, label) {
|
|
63
|
+
const levels = [];
|
|
64
|
+
|
|
65
|
+
for (let level = 0; level < texels.level_count; level++) {
|
|
66
|
+
const width = texture_mip_size(texels.width, level);
|
|
67
|
+
const height = texture_mip_size(texels.height, level);
|
|
68
|
+
|
|
69
|
+
const pixels = texel_decode_image_reads(texels.format)
|
|
70
|
+
? texel_decode_image(texels.format, width, height, texels.levels[level])
|
|
71
|
+
: null;
|
|
72
|
+
|
|
73
|
+
if (pixels === null || !(pixels.data instanceof Uint8Array)) {
|
|
74
|
+
throw new Error(`texture '${label}' brings '${texels.format}' texels, which decode to no eight-bit picture: neither a fallback nor another format can be made of them`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
levels.push(pixels);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return levels;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The files of a texture: its fallback, and a texture file in each block format it is built in.
|
|
85
|
+
*
|
|
86
|
+
* - **The fallback**, which every device can read: texels in a format every device samples are their own fallback,
|
|
87
|
+
* a texture file as they are; anything else becomes an AVIF of its base level, at the quality its role calls for
|
|
88
|
+
* ({@link texture_role_image_quality}).
|
|
89
|
+
* - **The block formats** are {@link texture_block_encodings}: those the role is built in, with the chain the
|
|
90
|
+
* texture asked for. Texels already in one of those formats are written in it as they are.
|
|
91
|
+
*
|
|
92
|
+
* Texels in a block format are decoded for the rest. Texels that decode to no eight-bit picture (BC6H, the snorm
|
|
93
|
+
* formats) are refused.
|
|
94
|
+
*
|
|
95
|
+
* The model's own pixels are left as they were.
|
|
96
|
+
*
|
|
97
|
+
* @type {MTFTextureEncoder}
|
|
98
|
+
*
|
|
99
|
+
* @author Alex Goldring
|
|
100
|
+
* @copyright Company Named Limited (c) 2026
|
|
101
|
+
*/
|
|
102
|
+
export async function mtf_encode_texture(texture, role, stem, files) {
|
|
103
|
+
const source = texture.image.source;
|
|
104
|
+
const label = texture.label;
|
|
105
|
+
|
|
106
|
+
const texels = source !== undefined && source !== null && source.isShadeTexelData === true ? source : null;
|
|
107
|
+
|
|
108
|
+
/** @type {Sampler2D[]} */
|
|
109
|
+
let levels;
|
|
110
|
+
|
|
111
|
+
if (texels !== null) {
|
|
112
|
+
levels = texel_pixels(texels, label);
|
|
113
|
+
} else if (source !== undefined && source !== null && source.isSampler2D === true) {
|
|
114
|
+
levels = [source];
|
|
115
|
+
} else if (typeof ImageBitmap !== "undefined" && source instanceof ImageBitmap) {
|
|
116
|
+
levels = [bitmap_pixels(source, label)];
|
|
117
|
+
} else {
|
|
118
|
+
throw new Error(`texture '${label}' is over an image that is neither texels nor decoded pixels, and nothing here encodes it`);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
let fallback;
|
|
122
|
+
|
|
123
|
+
if (texels !== null && gpu_texture_format_feature(texels.format) === undefined) {
|
|
124
|
+
fallback = `${stem}.mtt`;
|
|
125
|
+
|
|
126
|
+
files.set(fallback, mtf_texture_write(texels));
|
|
127
|
+
} else {
|
|
128
|
+
fallback = `${stem}.avif`;
|
|
129
|
+
|
|
130
|
+
// the encoder keeps what it is given: a copy, so the model is still whole after its files are written
|
|
131
|
+
const base = levels[0];
|
|
132
|
+
|
|
133
|
+
files.set(fallback, await write_image_source(new Sampler2D(base.data.slice(), base.itemSize, base.width, base.height), texture_role_image_quality(role)));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const generate = (texture.flags & ShadeTextureFlags.GenerateMipMaps) !== 0;
|
|
137
|
+
const srgb = (texture.color_space ?? texture.image.color_space) === ColorSpace.SRGB;
|
|
138
|
+
|
|
139
|
+
const own_format = texels !== null ? gpu_texture_format_without_srgb(texels.format) : null;
|
|
140
|
+
|
|
141
|
+
const by_format = [];
|
|
142
|
+
|
|
143
|
+
for (const [format, encoded] of texture_block_encodings(levels, role, generate, texture.mipmapGenerationFilter, srgb)) {
|
|
144
|
+
const uri = `${stem}.${format}.mtt`;
|
|
145
|
+
|
|
146
|
+
files.set(uri, mtf_texture_write(format === own_format ? texels : encoded));
|
|
147
|
+
|
|
148
|
+
by_format.push([format, uri]);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return new TextureVariantSet(fallback, by_format);
|
|
152
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A model as the files of an MTF export: its package, and beside it a folder of the files its textures are in.
|
|
3
|
+
*
|
|
4
|
+
* <pre>
|
|
5
|
+
* <name>.mtf
|
|
6
|
+
* <name>_textures/0000_<label>.avif
|
|
7
|
+
* <name>_textures/0001_<label>.mtt
|
|
8
|
+
* ...
|
|
9
|
+
* </pre>
|
|
10
|
+
*
|
|
11
|
+
* The steps, in order:
|
|
12
|
+
*
|
|
13
|
+
* 1. With `optimize`, {@link scene_optimize} first: geometries that are alike become one, pieces that repeat are
|
|
14
|
+
* shared, and images that are the same pixels become one image. **It rewrites the bundle in place**, so the
|
|
15
|
+
* bundle is the caller's to give away. A model with skins is refused: the optimizer does not carry skinning.
|
|
16
|
+
* 2. The files of each texture are asked of `encode_texture`, once for each image a role is met with: textures
|
|
17
|
+
* over one image share its files.
|
|
18
|
+
* 3. {@link mtf_write}.
|
|
19
|
+
*
|
|
20
|
+
* Nothing is put anywhere. What comes back is the files by where they go relative to one another, and writing
|
|
21
|
+
* them out is the caller's.
|
|
22
|
+
*
|
|
23
|
+
* @param {object} options
|
|
24
|
+
* @param {SceneBundle} options.bundle
|
|
25
|
+
* @param {string} options.name what the package's file is called, without a folder or an extension
|
|
26
|
+
* @param {boolean} [options.optimize] whether to optimize the bundle before it is written
|
|
27
|
+
* @param {MTFTextureEncoder} [options.encode_texture] what builds a texture's files. The default builds a
|
|
28
|
+
* fallback and no block formats ({@link mtf_encode_texture})
|
|
29
|
+
* @returns {Promise<Map<string, ArrayBuffer>>} every file by its path, the package first. A texture's path is
|
|
30
|
+
* the URI the package names it by
|
|
31
|
+
*
|
|
32
|
+
* @author Alex Goldring
|
|
33
|
+
* @copyright Company Named Limited (c) 2026
|
|
34
|
+
*/
|
|
35
|
+
export function mtf_export({ bundle, name, optimize, encode_texture, }: {
|
|
36
|
+
bundle: SceneBundle;
|
|
37
|
+
name: string;
|
|
38
|
+
optimize?: boolean;
|
|
39
|
+
encode_texture?: MTFTextureEncoder;
|
|
40
|
+
}): Promise<Map<string, ArrayBuffer>>;
|
|
41
|
+
export type SceneBundle = import("../SceneBundle.js").SceneBundle;
|
|
42
|
+
export type ShadeTexture = import("../../texture/ShadeTexture.js").ShadeTexture;
|
|
43
|
+
export type TextureVariantSet = import("../../texture/TextureVariantSet.js").TextureVariantSet;
|
|
44
|
+
export type MTFTextureEncoder = import("./mtf_encode_texture.js").MTFTextureEncoder;
|
|
45
|
+
//# sourceMappingURL=mtf_export.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mtf_export.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/loader/mtf/mtf_export.js"],"names":[],"mappings":"AAwCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH;IAXgC,MAAM,EAA3B,WAAW;IACK,IAAI,EAApB,MAAM;IACY,QAAQ,GAA1B,OAAO;IACqB,cAAc,GAA1C,iBAAiB;IAEf,QAAQ,IAAI,MAAM,EAAE,WAAW,CAAC,CAAC,CA4F7C;0BAzJY,OAAO,mBAAmB,EAAE,WAAW;2BACvC,OAAO,+BAA+B,EAAE,YAAY;gCACpD,OAAO,oCAAoC,EAAE,iBAAiB;gCAC9D,OAAO,yBAAyB,EAAE,iBAAiB"}
|