@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,169 @@
|
|
|
1
|
+
import { WRONSKI2021_TAP_OFFSETS, WRONSKI2021_TAP_WEIGHTS } from "../filters/mipmap_shader_code_wronski2021.js";
|
|
2
|
+
import { MipmapBilinearAxis } from "./MipmapBilinearAxis.js";
|
|
3
|
+
import { mipmap_bilinear_sample } from "./mipmap_bilinear_sample.js";
|
|
4
|
+
import { mipmap_source_centre } from "./mipmap_source_centre.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Taps along each axis.
|
|
8
|
+
* @type {number}
|
|
9
|
+
*/
|
|
10
|
+
const TAP_COUNT = WRONSKI2021_TAP_OFFSETS.length;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Where each tap sits along an axis, in source texels from the centre of a 2x reduction's
|
|
14
|
+
* destination texel, as f32.
|
|
15
|
+
* @readonly
|
|
16
|
+
* @type {Float32Array}
|
|
17
|
+
*/
|
|
18
|
+
const TAP_OFFSETS = Float32Array.from(WRONSKI2021_TAP_OFFSETS);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The weight of each 2D tap, row `ty`, column `tx` at `ty * TAP_COUNT + tx`: `fround(weight_x *
|
|
22
|
+
* weight_y)` of the f32 axis weights.
|
|
23
|
+
* @readonly
|
|
24
|
+
* @type {Float32Array}
|
|
25
|
+
*/
|
|
26
|
+
const TAP_WEIGHTS_2D = new Float32Array(TAP_COUNT * TAP_COUNT);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The sum of {@link TAP_WEIGHTS_2D} in the order the shader adds them, row by row, in f32.
|
|
30
|
+
* @type {number}
|
|
31
|
+
*/
|
|
32
|
+
let tap_weight_sum = 0;
|
|
33
|
+
|
|
34
|
+
for (let ty = 0; ty < TAP_COUNT; ty++) {
|
|
35
|
+
for (let tx = 0; tx < TAP_COUNT; tx++) {
|
|
36
|
+
const weight = Math.fround(Math.fround(WRONSKI2021_TAP_WEIGHTS[tx]) * Math.fround(WRONSKI2021_TAP_WEIGHTS[ty]));
|
|
37
|
+
|
|
38
|
+
TAP_WEIGHTS_2D[ty * TAP_COUNT + tx] = weight;
|
|
39
|
+
|
|
40
|
+
tap_weight_sum = Math.fround(tap_weight_sum + weight);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @type {number}
|
|
46
|
+
*/
|
|
47
|
+
const TAP_WEIGHT_SUM = tap_weight_sum;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @type {number}
|
|
51
|
+
*/
|
|
52
|
+
const WEIGHT_SUM_THRESHOLD = Math.fround(0.00001);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @type {Float32Array}
|
|
56
|
+
*/
|
|
57
|
+
const SAMPLE = new Float32Array(4);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The bilinear footprint of every tap along one axis: slot `i * TAP_COUNT + t` for destination texel
|
|
61
|
+
* `i`'s tap `t`. A tap sits at `centre + offset * stride` source texels, and is sampled at that
|
|
62
|
+
* position's normalised coordinate, `(position + 0.5) / source_size`, each step rounded to f32.
|
|
63
|
+
*
|
|
64
|
+
* @param {number} output_size
|
|
65
|
+
* @param {number} source_size
|
|
66
|
+
* @param {boolean} single whether the source is sampled without this axis, as a level one texel high
|
|
67
|
+
* is; see {@link MipmapBilinearAxis#place_single}
|
|
68
|
+
* @returns {MipmapBilinearAxis}
|
|
69
|
+
*/
|
|
70
|
+
function wronski_axis(output_size, source_size, single) {
|
|
71
|
+
const fround = Math.fround;
|
|
72
|
+
|
|
73
|
+
// the taps are laid out for a 2x reduction, so scaled by how far this one departs from it
|
|
74
|
+
const stride = Math.max(1, fround(fround(source_size * 0.5) / output_size));
|
|
75
|
+
|
|
76
|
+
const axis = new MipmapBilinearAxis(output_size * TAP_COUNT);
|
|
77
|
+
|
|
78
|
+
for (let i = 0; i < output_size; i++) {
|
|
79
|
+
const centre = mipmap_source_centre(i, output_size, source_size);
|
|
80
|
+
|
|
81
|
+
for (let t = 0; t < TAP_COUNT; t++) {
|
|
82
|
+
const slot = i * TAP_COUNT + t;
|
|
83
|
+
|
|
84
|
+
if (single) {
|
|
85
|
+
axis.place_single(slot);
|
|
86
|
+
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const position = fround(centre + fround(TAP_OFFSETS[t] * stride));
|
|
91
|
+
|
|
92
|
+
axis.place(slot, fround(fround(position + 0.5) / source_size), source_size);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return axis;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* One pass of Wronski's 2021 processing-aware reduction, the CPU twin of
|
|
101
|
+
* `mipmap_shader_code_wronski2021`: each destination texel is the normalised sum of 6x6 bilinear
|
|
102
|
+
* samples of the source (see {@link mipmap_bilinear_sample}) at the taps of
|
|
103
|
+
* {@link WRONSKI2021_TAP_OFFSETS} around its centre, weighed by the products of
|
|
104
|
+
* {@link WRONSKI2021_TAP_WEIGHTS}, in f32 as that shader computes it: row by row, each channel's sum
|
|
105
|
+
* takes `fround(sample * weight)` rounded to f32, and is divided by the weight sum at the end.
|
|
106
|
+
*
|
|
107
|
+
* @see https://bartwronski.com/2021/07/20/processing-aware-image-filtering-compensating-for-the-upsampling/
|
|
108
|
+
* @param {Float32Array} output RGBA, raster order: the fragment outputs, before any store
|
|
109
|
+
* @param {number} output_width
|
|
110
|
+
* @param {number} output_height
|
|
111
|
+
* @param {Float32Array} source RGBA, raster order: the level read, as the shader reads it
|
|
112
|
+
* @param {number} source_width
|
|
113
|
+
* @param {number} source_height
|
|
114
|
+
*
|
|
115
|
+
* @author Alex Goldring
|
|
116
|
+
* @copyright Company Named Limited (c) 2026
|
|
117
|
+
*/
|
|
118
|
+
export function mipmap_filter_wronski2021_cpu(
|
|
119
|
+
output, output_width, output_height,
|
|
120
|
+
source, source_width, source_height
|
|
121
|
+
) {
|
|
122
|
+
const fround = Math.fround;
|
|
123
|
+
|
|
124
|
+
const x_axis = wronski_axis(output_width, source_width, false);
|
|
125
|
+
const y_axis = wronski_axis(output_height, source_height, source_height === 1);
|
|
126
|
+
|
|
127
|
+
let out = 0;
|
|
128
|
+
|
|
129
|
+
for (let y = 0; y < output_height; y++) {
|
|
130
|
+
for (let x = 0; x < output_width; x++) {
|
|
131
|
+
let r = 0;
|
|
132
|
+
let g = 0;
|
|
133
|
+
let b = 0;
|
|
134
|
+
let a = 0;
|
|
135
|
+
|
|
136
|
+
for (let ty = 0; ty < TAP_COUNT; ty++) {
|
|
137
|
+
for (let tx = 0; tx < TAP_COUNT; tx++) {
|
|
138
|
+
const weight = TAP_WEIGHTS_2D[ty * TAP_COUNT + tx];
|
|
139
|
+
|
|
140
|
+
mipmap_bilinear_sample(
|
|
141
|
+
SAMPLE, 0,
|
|
142
|
+
source, source_width,
|
|
143
|
+
x_axis, x * TAP_COUNT + tx,
|
|
144
|
+
y_axis, y * TAP_COUNT + ty
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
r = fround(r + fround(SAMPLE[0] * weight));
|
|
148
|
+
g = fround(g + fround(SAMPLE[1] * weight));
|
|
149
|
+
b = fround(b + fround(SAMPLE[2] * weight));
|
|
150
|
+
a = fround(a + fround(SAMPLE[3] * weight));
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
if (TAP_WEIGHT_SUM > WEIGHT_SUM_THRESHOLD) {
|
|
155
|
+
r = fround(r / TAP_WEIGHT_SUM);
|
|
156
|
+
g = fround(g / TAP_WEIGHT_SUM);
|
|
157
|
+
b = fround(b / TAP_WEIGHT_SUM);
|
|
158
|
+
a = fround(a / TAP_WEIGHT_SUM);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
output[out] = r;
|
|
162
|
+
output[out + 1] = g;
|
|
163
|
+
output[out + 2] = b;
|
|
164
|
+
output[out + 3] = a;
|
|
165
|
+
|
|
166
|
+
out += 4;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reduce a level by a separable kernel, in f32, as the mip filter shaders that load texels do: for
|
|
3
|
+
* each destination texel, over its rows of taps in order and within each row its columns in order,
|
|
4
|
+
* the tap's weight is `fround(weight_x * weight_y)`, each channel's sum takes `fround(texel *
|
|
5
|
+
* weight)` and the weight sum takes the weight, each addition rounded to f32; if the weight sum then
|
|
6
|
+
* exceeds `weight_sum_threshold`, each channel is divided by it, rounded to f32.
|
|
7
|
+
*
|
|
8
|
+
* @param {Float32Array} output RGBA, `output_width * output_height` texels in raster order
|
|
9
|
+
* @param {number} output_width
|
|
10
|
+
* @param {number} output_height
|
|
11
|
+
* @param {Float32Array} source RGBA, `source_width` texels a row
|
|
12
|
+
* @param {number} source_width
|
|
13
|
+
* @param {import("./MipmapKernelAxis.js").MipmapKernelAxis} x_axis taps along x, one entry per destination column
|
|
14
|
+
* @param {import("./MipmapKernelAxis.js").MipmapKernelAxis} y_axis taps along y, one entry per destination row
|
|
15
|
+
* @param {number} weight_sum_threshold an f32
|
|
16
|
+
*
|
|
17
|
+
* @author Alex Goldring
|
|
18
|
+
* @copyright Company Named Limited (c) 2026
|
|
19
|
+
*/
|
|
20
|
+
export function mipmap_kernel_reduce(output: Float32Array, output_width: number, output_height: number, source: Float32Array, source_width: number, x_axis: import("./MipmapKernelAxis.js").MipmapKernelAxis, y_axis: import("./MipmapKernelAxis.js").MipmapKernelAxis, weight_sum_threshold: number): void;
|
|
21
|
+
//# sourceMappingURL=mipmap_kernel_reduce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mipmap_kernel_reduce.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/cpu/mipmap_kernel_reduce.js"],"names":[],"mappings":"AA+DA;;;;;;;;;;;;;;;;;;GAkBG;AACH,6CAZW,YAAY,gBACZ,MAAM,iBACN,MAAM,UACN,YAAY,gBACZ,MAAM,UACN,OAAO,uBAAuB,EAAE,gBAAgB,UAChD,OAAO,uBAAuB,EAAE,gBAAgB,wBAChD,MAAM,QAyChB"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One destination texel of {@link mipmap_kernel_reduce}.
|
|
3
|
+
*
|
|
4
|
+
* @param {Float32Array} output
|
|
5
|
+
* @param {number} output_offset
|
|
6
|
+
* @param {Float32Array} source
|
|
7
|
+
* @param {number} source_width
|
|
8
|
+
* @param {Uint32Array} x_index
|
|
9
|
+
* @param {Float32Array} x_weight
|
|
10
|
+
* @param {number} column_tap_start
|
|
11
|
+
* @param {number} column_tap_end
|
|
12
|
+
* @param {Uint32Array} y_index
|
|
13
|
+
* @param {Float32Array} y_weight
|
|
14
|
+
* @param {number} row_tap_start
|
|
15
|
+
* @param {number} row_tap_end
|
|
16
|
+
* @param {number} weight_sum_threshold
|
|
17
|
+
*/
|
|
18
|
+
function reduce_texel(
|
|
19
|
+
output, output_offset,
|
|
20
|
+
source, source_width,
|
|
21
|
+
x_index, x_weight, column_tap_start, column_tap_end,
|
|
22
|
+
y_index, y_weight, row_tap_start, row_tap_end,
|
|
23
|
+
weight_sum_threshold
|
|
24
|
+
) {
|
|
25
|
+
const fround = Math.fround;
|
|
26
|
+
|
|
27
|
+
let r = 0;
|
|
28
|
+
let g = 0;
|
|
29
|
+
let b = 0;
|
|
30
|
+
let a = 0;
|
|
31
|
+
let weight_sum = 0;
|
|
32
|
+
|
|
33
|
+
for (let ty = row_tap_start; ty < row_tap_end; ty++) {
|
|
34
|
+
const weight_y = y_weight[ty];
|
|
35
|
+
const row = y_index[ty] * source_width;
|
|
36
|
+
|
|
37
|
+
for (let tx = column_tap_start; tx < column_tap_end; tx++) {
|
|
38
|
+
const weight = fround(x_weight[tx] * weight_y);
|
|
39
|
+
|
|
40
|
+
const texel = (row + x_index[tx]) * 4;
|
|
41
|
+
|
|
42
|
+
r = fround(r + fround(source[texel] * weight));
|
|
43
|
+
g = fround(g + fround(source[texel + 1] * weight));
|
|
44
|
+
b = fround(b + fround(source[texel + 2] * weight));
|
|
45
|
+
a = fround(a + fround(source[texel + 3] * weight));
|
|
46
|
+
|
|
47
|
+
weight_sum = fround(weight_sum + weight);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (weight_sum > weight_sum_threshold) {
|
|
52
|
+
r = fround(r / weight_sum);
|
|
53
|
+
g = fround(g / weight_sum);
|
|
54
|
+
b = fround(b / weight_sum);
|
|
55
|
+
a = fround(a / weight_sum);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
output[output_offset] = r;
|
|
59
|
+
output[output_offset + 1] = g;
|
|
60
|
+
output[output_offset + 2] = b;
|
|
61
|
+
output[output_offset + 3] = a;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Reduce a level by a separable kernel, in f32, as the mip filter shaders that load texels do: for
|
|
66
|
+
* each destination texel, over its rows of taps in order and within each row its columns in order,
|
|
67
|
+
* the tap's weight is `fround(weight_x * weight_y)`, each channel's sum takes `fround(texel *
|
|
68
|
+
* weight)` and the weight sum takes the weight, each addition rounded to f32; if the weight sum then
|
|
69
|
+
* exceeds `weight_sum_threshold`, each channel is divided by it, rounded to f32.
|
|
70
|
+
*
|
|
71
|
+
* @param {Float32Array} output RGBA, `output_width * output_height` texels in raster order
|
|
72
|
+
* @param {number} output_width
|
|
73
|
+
* @param {number} output_height
|
|
74
|
+
* @param {Float32Array} source RGBA, `source_width` texels a row
|
|
75
|
+
* @param {number} source_width
|
|
76
|
+
* @param {import("./MipmapKernelAxis.js").MipmapKernelAxis} x_axis taps along x, one entry per destination column
|
|
77
|
+
* @param {import("./MipmapKernelAxis.js").MipmapKernelAxis} y_axis taps along y, one entry per destination row
|
|
78
|
+
* @param {number} weight_sum_threshold an f32
|
|
79
|
+
*
|
|
80
|
+
* @author Alex Goldring
|
|
81
|
+
* @copyright Company Named Limited (c) 2026
|
|
82
|
+
*/
|
|
83
|
+
export function mipmap_kernel_reduce(
|
|
84
|
+
output, output_width, output_height,
|
|
85
|
+
source, source_width,
|
|
86
|
+
x_axis, y_axis,
|
|
87
|
+
weight_sum_threshold
|
|
88
|
+
) {
|
|
89
|
+
const x_first = x_axis.first;
|
|
90
|
+
const x_count = x_axis.count;
|
|
91
|
+
const x_index = x_axis.index;
|
|
92
|
+
const x_weight = x_axis.weight;
|
|
93
|
+
|
|
94
|
+
const y_first = y_axis.first;
|
|
95
|
+
const y_count = y_axis.count;
|
|
96
|
+
const y_index = y_axis.index;
|
|
97
|
+
const y_weight = y_axis.weight;
|
|
98
|
+
|
|
99
|
+
let out = 0;
|
|
100
|
+
|
|
101
|
+
for (let y = 0; y < output_height; y++) {
|
|
102
|
+
const row_tap_start = y_first[y];
|
|
103
|
+
const row_tap_end = row_tap_start + y_count[y];
|
|
104
|
+
|
|
105
|
+
for (let x = 0; x < output_width; x++) {
|
|
106
|
+
const column_tap_start = x_first[x];
|
|
107
|
+
|
|
108
|
+
reduce_texel(
|
|
109
|
+
output, out,
|
|
110
|
+
source, source_width,
|
|
111
|
+
x_index, x_weight, column_tap_start, column_tap_start + x_count[x],
|
|
112
|
+
y_index, y_weight, row_tap_start, row_tap_end,
|
|
113
|
+
weight_sum_threshold
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
out += 4;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the centre of destination texel `i` falls in the source, in source texels along one axis
|
|
3
|
+
* (texel `j`'s centre is at `j`), as a mip filter shader finds it: the texel's centre as a normalised
|
|
4
|
+
* coordinate in f32, `(i + 0.5) / output_size`, then `fma(uv, source_size, -0.5)`, rounded once to
|
|
5
|
+
* f32 as a fused multiply-add rounds.
|
|
6
|
+
*
|
|
7
|
+
* @param {number} i destination texel
|
|
8
|
+
* @param {number} output_size destination texels along the axis
|
|
9
|
+
* @param {number} source_size source texels along the axis
|
|
10
|
+
* @returns {number} an f32
|
|
11
|
+
*
|
|
12
|
+
* @author Alex Goldring
|
|
13
|
+
* @copyright Company Named Limited (c) 2026
|
|
14
|
+
*/
|
|
15
|
+
export function mipmap_source_centre(i: number, output_size: number, source_size: number): number;
|
|
16
|
+
//# sourceMappingURL=mipmap_source_centre.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mipmap_source_centre.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/cpu/mipmap_source_centre.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wCARW,MAAM,eACN,MAAM,eACN,MAAM,GACJ,MAAM,CASlB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the centre of destination texel `i` falls in the source, in source texels along one axis
|
|
3
|
+
* (texel `j`'s centre is at `j`), as a mip filter shader finds it: the texel's centre as a normalised
|
|
4
|
+
* coordinate in f32, `(i + 0.5) / output_size`, then `fma(uv, source_size, -0.5)`, rounded once to
|
|
5
|
+
* f32 as a fused multiply-add rounds.
|
|
6
|
+
*
|
|
7
|
+
* @param {number} i destination texel
|
|
8
|
+
* @param {number} output_size destination texels along the axis
|
|
9
|
+
* @param {number} source_size source texels along the axis
|
|
10
|
+
* @returns {number} an f32
|
|
11
|
+
*
|
|
12
|
+
* @author Alex Goldring
|
|
13
|
+
* @copyright Company Named Limited (c) 2026
|
|
14
|
+
*/
|
|
15
|
+
export function mipmap_source_centre(i, output_size, source_size) {
|
|
16
|
+
const uv = Math.fround((i + 0.5) / output_size);
|
|
17
|
+
|
|
18
|
+
return Math.fround(uv * source_size + -0.5);
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Float to 8-bit unorm, as a render target of a unorm format stores a fragment's output: the
|
|
3
|
+
* conversion of the D3D11 functional specification (3.2.3.6) — NaN is 0, the value is clamped to
|
|
4
|
+
* [0, 1], scaled by 255, and rounded half up — on the exact product. For an f32 that product is never
|
|
5
|
+
* a tie except at exactly 0.5, which both rounding directions take to 128, so this is also Vulkan's
|
|
6
|
+
* round-to-nearest.
|
|
7
|
+
*
|
|
8
|
+
* @param {number} v
|
|
9
|
+
* @returns {number} 0 to 255
|
|
10
|
+
*/
|
|
11
|
+
export function f32_to_unorm8(v: number): number;
|
|
12
|
+
/**
|
|
13
|
+
* Store values into `rgba8unorm` texels as a render target of that format stores a fragment's
|
|
14
|
+
* output; see {@link f32_to_unorm8}.
|
|
15
|
+
*
|
|
16
|
+
* @param {Uint8Array} output written from index 0
|
|
17
|
+
* @param {Float32Array} input
|
|
18
|
+
* @param {number} length values to convert, four a texel
|
|
19
|
+
*
|
|
20
|
+
* @author Alex Goldring
|
|
21
|
+
* @copyright Company Named Limited (c) 2026
|
|
22
|
+
*/
|
|
23
|
+
export function texels_f32_to_rgba8unorm(output: Uint8Array, input: Float32Array, length: number): void;
|
|
24
|
+
//# sourceMappingURL=texels_f32_to_rgba8unorm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texels_f32_to_rgba8unorm.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm.js"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,iCAHW,MAAM,GACJ,MAAM,CAelB;AAED;;;;;;;;;;GAUG;AACH,iDAPW,UAAU,SACV,YAAY,UACZ,MAAM,QAShB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Float to 8-bit unorm, as a render target of a unorm format stores a fragment's output: the
|
|
3
|
+
* conversion of the D3D11 functional specification (3.2.3.6) — NaN is 0, the value is clamped to
|
|
4
|
+
* [0, 1], scaled by 255, and rounded half up — on the exact product. For an f32 that product is never
|
|
5
|
+
* a tie except at exactly 0.5, which both rounding directions take to 128, so this is also Vulkan's
|
|
6
|
+
* round-to-nearest.
|
|
7
|
+
*
|
|
8
|
+
* @param {number} v
|
|
9
|
+
* @returns {number} 0 to 255
|
|
10
|
+
*/
|
|
11
|
+
export function f32_to_unorm8(v) {
|
|
12
|
+
// written so that NaN fails the first test
|
|
13
|
+
if (!(v > 0)) {
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (v >= 1) {
|
|
18
|
+
return 255;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// the product is exact (an f32 times 255 has 32 significant bits); adding the half rounds only
|
|
22
|
+
// for a product far below 1, whose floor it cannot change
|
|
23
|
+
return Math.floor(v * 255 + 0.5);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Store values into `rgba8unorm` texels as a render target of that format stores a fragment's
|
|
28
|
+
* output; see {@link f32_to_unorm8}.
|
|
29
|
+
*
|
|
30
|
+
* @param {Uint8Array} output written from index 0
|
|
31
|
+
* @param {Float32Array} input
|
|
32
|
+
* @param {number} length values to convert, four a texel
|
|
33
|
+
*
|
|
34
|
+
* @author Alex Goldring
|
|
35
|
+
* @copyright Company Named Limited (c) 2026
|
|
36
|
+
*/
|
|
37
|
+
export function texels_f32_to_rgba8unorm(output, input, length) {
|
|
38
|
+
for (let i = 0; i < length; i++) {
|
|
39
|
+
output[i] = f32_to_unorm8(input[i]);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Float to an 8-bit sRGB-encoded channel, as a render target of an `-srgb` format stores a
|
|
3
|
+
* fragment's linear output: NaN and anything at or below 0 store 0, anything at or above 1 stores
|
|
4
|
+
* 255, and in between the sRGB encoding function of IEC 61966-2-1 followed by the unorm conversion
|
|
5
|
+
* (see {@link f32_to_unorm8}), exact for every f32.
|
|
6
|
+
*
|
|
7
|
+
* @param {number} v an f32
|
|
8
|
+
* @returns {number} 0 to 255
|
|
9
|
+
*/
|
|
10
|
+
export function f32_to_srgb8(v: number): number;
|
|
11
|
+
/**
|
|
12
|
+
* Store values into `rgba8unorm-srgb` texels as a render target of that format stores a fragment's
|
|
13
|
+
* output: red, green and blue encoded from linear by {@link f32_to_srgb8}; alpha, which the format
|
|
14
|
+
* stores linearly, by {@link f32_to_unorm8}.
|
|
15
|
+
*
|
|
16
|
+
* @param {Uint8Array} output written from index 0
|
|
17
|
+
* @param {Float32Array} input
|
|
18
|
+
* @param {number} length values to convert, four a texel; a multiple of 4
|
|
19
|
+
*
|
|
20
|
+
* @author Alex Goldring
|
|
21
|
+
* @copyright Company Named Limited (c) 2026
|
|
22
|
+
*/
|
|
23
|
+
export function texels_f32_to_rgba8unorm_srgb(output: Uint8Array, input: Float32Array, length: number): void;
|
|
24
|
+
//# sourceMappingURL=texels_f32_to_rgba8unorm_srgb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texels_f32_to_rgba8unorm_srgb.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/cpu/texels_f32_to_rgba8unorm_srgb.js"],"names":[],"mappings":"AAwFA;;;;;;;;GAQG;AACH,gCAHW,MAAM,GACJ,MAAM,CAuBlB;AAED;;;;;;;;;;;GAWG;AACH,sDAPW,UAAU,SACV,YAAY,UACZ,MAAM,QAYhB"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { convert_channel_linear_to_sRGB } from "../../../../../core/color/sRGB/linear_to_sRGB.js";
|
|
2
|
+
import { f32_to_unorm8 } from "./texels_f32_to_rgba8unorm.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The byte a linear value encodes to: the sRGB encoding function of IEC 61966-2-1, then the unorm
|
|
6
|
+
* conversion of {@link f32_to_unorm8}.
|
|
7
|
+
*
|
|
8
|
+
* @param {number} linear finite, in [0, 1]
|
|
9
|
+
* @returns {number}
|
|
10
|
+
*/
|
|
11
|
+
function srgb8_of(linear) {
|
|
12
|
+
return f32_to_unorm8(convert_channel_linear_to_sRGB(linear));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const F32_SCRATCH = new Float32Array(1);
|
|
16
|
+
const F32_SCRATCH_BITS = new Uint32Array(F32_SCRATCH.buffer);
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* The bit pattern of 1.0 as an f32. Positive floats order as their bit patterns do.
|
|
20
|
+
* @type {number}
|
|
21
|
+
*/
|
|
22
|
+
const F32_ONE_BITS = 0x3F800000;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The bit pattern of +Infinity as an f32; above it, up to the sign bit, are the NaNs.
|
|
26
|
+
* @type {number}
|
|
27
|
+
*/
|
|
28
|
+
const F32_INFINITY_BITS = 0x7F800000;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* `SRGB8_THRESHOLD_BITS[k]` is the bit pattern of the least f32 that encodes to byte `k` or above,
|
|
32
|
+
* for `k` in 1..255; entry 0 is 0, and entry 256 is past every value it is compared with. The
|
|
33
|
+
* encoding rises with its input, so a value's byte is the number of thresholds from 1 up that it
|
|
34
|
+
* reaches: the byte {@link srgb8_of} gives, for every f32 in [0, 1]. Each threshold is found by
|
|
35
|
+
* bisecting the bit patterns.
|
|
36
|
+
* @readonly
|
|
37
|
+
* @type {Uint32Array}
|
|
38
|
+
*/
|
|
39
|
+
const SRGB8_THRESHOLD_BITS = new Uint32Array(257);
|
|
40
|
+
|
|
41
|
+
for (let k = 1; k < 256; k++) {
|
|
42
|
+
// srgb8_of(0) is 0 < k, and srgb8_of(1) is 255 >= k
|
|
43
|
+
let below = 0;
|
|
44
|
+
let at_or_above = F32_ONE_BITS;
|
|
45
|
+
|
|
46
|
+
while (at_or_above - below > 1) {
|
|
47
|
+
const middle = (below + at_or_above) >>> 1;
|
|
48
|
+
|
|
49
|
+
F32_SCRATCH_BITS[0] = middle;
|
|
50
|
+
|
|
51
|
+
if (srgb8_of(F32_SCRATCH[0]) >= k) {
|
|
52
|
+
at_or_above = middle;
|
|
53
|
+
} else {
|
|
54
|
+
below = middle;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
SRGB8_THRESHOLD_BITS[k] = at_or_above;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
SRGB8_THRESHOLD_BITS[256] = 0xFFFFFFFF;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Bits of an f32 dropped to name its bucket: what is left is the exponent and the top 7 bits of the
|
|
65
|
+
* mantissa.
|
|
66
|
+
* @type {number}
|
|
67
|
+
*/
|
|
68
|
+
const BUCKET_SHIFT = 16;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The byte of the least value in each bucket of f32s below 1 — the values sharing their bits above
|
|
72
|
+
* {@link BUCKET_SHIFT}. A value's byte is its bucket's or a few above it, reached by stepping up
|
|
73
|
+
* through the thresholds; a bucket spans well under one step of the encoding, so rarely more than one.
|
|
74
|
+
* @readonly
|
|
75
|
+
* @type {Uint8Array}
|
|
76
|
+
*/
|
|
77
|
+
const SRGB8_BUCKET_START = new Uint8Array(F32_ONE_BITS >>> BUCKET_SHIFT);
|
|
78
|
+
|
|
79
|
+
for (let bucket = 0, k = 0; bucket < SRGB8_BUCKET_START.length; bucket++) {
|
|
80
|
+
const least = bucket << BUCKET_SHIFT;
|
|
81
|
+
|
|
82
|
+
while (least >= SRGB8_THRESHOLD_BITS[k + 1]) {
|
|
83
|
+
k++;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
SRGB8_BUCKET_START[bucket] = k;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Float to an 8-bit sRGB-encoded channel, as a render target of an `-srgb` format stores a
|
|
91
|
+
* fragment's linear output: NaN and anything at or below 0 store 0, anything at or above 1 stores
|
|
92
|
+
* 255, and in between the sRGB encoding function of IEC 61966-2-1 followed by the unorm conversion
|
|
93
|
+
* (see {@link f32_to_unorm8}), exact for every f32.
|
|
94
|
+
*
|
|
95
|
+
* @param {number} v an f32
|
|
96
|
+
* @returns {number} 0 to 255
|
|
97
|
+
*/
|
|
98
|
+
export function f32_to_srgb8(v) {
|
|
99
|
+
F32_SCRATCH[0] = v;
|
|
100
|
+
|
|
101
|
+
const bits = F32_SCRATCH_BITS[0];
|
|
102
|
+
|
|
103
|
+
if (bits === 0 || bits > F32_INFINITY_BITS) {
|
|
104
|
+
// +0, the NaNs, and everything with the sign bit set
|
|
105
|
+
return 0;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (bits >= F32_ONE_BITS) {
|
|
109
|
+
return 255;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
let k = SRGB8_BUCKET_START[bits >>> BUCKET_SHIFT];
|
|
113
|
+
|
|
114
|
+
while (bits >= SRGB8_THRESHOLD_BITS[k + 1]) {
|
|
115
|
+
k++;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return k;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Store values into `rgba8unorm-srgb` texels as a render target of that format stores a fragment's
|
|
123
|
+
* output: red, green and blue encoded from linear by {@link f32_to_srgb8}; alpha, which the format
|
|
124
|
+
* stores linearly, by {@link f32_to_unorm8}.
|
|
125
|
+
*
|
|
126
|
+
* @param {Uint8Array} output written from index 0
|
|
127
|
+
* @param {Float32Array} input
|
|
128
|
+
* @param {number} length values to convert, four a texel; a multiple of 4
|
|
129
|
+
*
|
|
130
|
+
* @author Alex Goldring
|
|
131
|
+
* @copyright Company Named Limited (c) 2026
|
|
132
|
+
*/
|
|
133
|
+
export function texels_f32_to_rgba8unorm_srgb(output, input, length) {
|
|
134
|
+
for (let i = 0; i < length; i += 4) {
|
|
135
|
+
output[i] = f32_to_srgb8(input[i]);
|
|
136
|
+
output[i + 1] = f32_to_srgb8(input[i + 1]);
|
|
137
|
+
output[i + 2] = f32_to_srgb8(input[i + 2]);
|
|
138
|
+
output[i + 3] = f32_to_unorm8(input[i + 3]);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read `rgba8unorm-srgb` texels as a shader reads them through a view of that format: red, green
|
|
3
|
+
* and blue decoded to linear by the sRGB decoding function, the nearest f32; alpha, which the format
|
|
4
|
+
* stores linearly, `byte / 255`.
|
|
5
|
+
*
|
|
6
|
+
* @param {Float32Array} output written from index 0
|
|
7
|
+
* @param {Uint8Array} input
|
|
8
|
+
* @param {number} length values to convert, four a texel; a multiple of 4
|
|
9
|
+
*
|
|
10
|
+
* @author Alex Goldring
|
|
11
|
+
* @copyright Company Named Limited (c) 2026
|
|
12
|
+
*/
|
|
13
|
+
export function texels_rgba8unorm_srgb_to_f32(output: Float32Array, input: Uint8Array, length: number): void;
|
|
14
|
+
/**
|
|
15
|
+
* What a shader reads from each byte of an `rgba8unorm-srgb` colour channel: the sRGB decoding
|
|
16
|
+
* function of IEC 61966-2-1 at `byte / 255`, the nearest f32.
|
|
17
|
+
* @readonly
|
|
18
|
+
* @type {Float32Array}
|
|
19
|
+
*/
|
|
20
|
+
export const RGBA8UNORM_SRGB_TO_F32: Float32Array;
|
|
21
|
+
//# sourceMappingURL=texels_rgba8unorm_srgb_to_f32.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"texels_rgba8unorm_srgb_to_f32.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/texture/mipmaps/cpu/texels_rgba8unorm_srgb_to_f32.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;GAWG;AACH,sDAPW,YAAY,SACZ,UAAU,UACV,MAAM,QAYhB;AA/BD;;;;;GAKG;AACH,qCAFU,YAAY,CAEsC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { convert_channel_sRGB_to_linear } from "../../../../../core/color/sRGB/sRGB_to_linear.js";
|
|
2
|
+
import { RGBA8UNORM_TO_F32 } from "./texels_rgba8unorm_to_f32.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* What a shader reads from each byte of an `rgba8unorm-srgb` colour channel: the sRGB decoding
|
|
6
|
+
* function of IEC 61966-2-1 at `byte / 255`, the nearest f32.
|
|
7
|
+
* @readonly
|
|
8
|
+
* @type {Float32Array}
|
|
9
|
+
*/
|
|
10
|
+
export const RGBA8UNORM_SRGB_TO_F32 = new Float32Array(256);
|
|
11
|
+
|
|
12
|
+
for (let byte = 0; byte < 256; byte++) {
|
|
13
|
+
RGBA8UNORM_SRGB_TO_F32[byte] = convert_channel_sRGB_to_linear(byte / 255);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Read `rgba8unorm-srgb` texels as a shader reads them through a view of that format: red, green
|
|
18
|
+
* and blue decoded to linear by the sRGB decoding function, the nearest f32; alpha, which the format
|
|
19
|
+
* stores linearly, `byte / 255`.
|
|
20
|
+
*
|
|
21
|
+
* @param {Float32Array} output written from index 0
|
|
22
|
+
* @param {Uint8Array} input
|
|
23
|
+
* @param {number} length values to convert, four a texel; a multiple of 4
|
|
24
|
+
*
|
|
25
|
+
* @author Alex Goldring
|
|
26
|
+
* @copyright Company Named Limited (c) 2026
|
|
27
|
+
*/
|
|
28
|
+
export function texels_rgba8unorm_srgb_to_f32(output, input, length) {
|
|
29
|
+
for (let i = 0; i < length; i += 4) {
|
|
30
|
+
output[i] = RGBA8UNORM_SRGB_TO_F32[input[i]];
|
|
31
|
+
output[i + 1] = RGBA8UNORM_SRGB_TO_F32[input[i + 1]];
|
|
32
|
+
output[i + 2] = RGBA8UNORM_SRGB_TO_F32[input[i + 2]];
|
|
33
|
+
output[i + 3] = RGBA8UNORM_TO_F32[input[i + 3]];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read `rgba8unorm` texels as a shader reads them through a view of that format: each channel
|
|
3
|
+
* `byte / 255`, the nearest f32.
|
|
4
|
+
*
|
|
5
|
+
* @param {Float32Array} output written from index 0
|
|
6
|
+
* @param {Uint8Array} input
|
|
7
|
+
* @param {number} length values to convert, four a texel
|
|
8
|
+
*
|
|
9
|
+
* @author Alex Goldring
|
|
10
|
+
* @copyright Company Named Limited (c) 2026
|
|
11
|
+
*/
|
|
12
|
+
export function texels_rgba8unorm_to_f32(output: Float32Array, input: Uint8Array, length: number): void;
|
|
13
|
+
/**
|
|
14
|
+
* What a shader reads from each byte of an `rgba8unorm` texel: `byte / 255`, the nearest f32.
|
|
15
|
+
* @readonly
|
|
16
|
+
* @type {Float32Array}
|
|
17
|
+
*/
|
|
18
|
+
export const RGBA8UNORM_TO_F32: Float32Array;
|
|
19
|
+
//# sourceMappingURL=texels_rgba8unorm_to_f32.d.ts.map
|