@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,196 @@
|
|
|
1
|
+
import {
|
|
2
|
+
deserialize_animation_curve,
|
|
3
|
+
serialize_animation_curve
|
|
4
|
+
} from "../../../engine/animation/curve/animation_curve_binary_codec.js";
|
|
5
|
+
import { BinaryClassSerializationAdapter } from "../../../engine/ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
6
|
+
import { ShadeAnimationChannel } from "./ShadeAnimationChannel.js";
|
|
7
|
+
import { ShadeAnimationClip } from "./ShadeAnimationClip.js";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {import("../../../core/binary/BinaryBuffer.js").BinaryBuffer} BinaryBuffer
|
|
11
|
+
* @typedef {import("../../../engine/animation/curve/AnimationCurve.js").AnimationCurve} AnimationCurve
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Written in place of a curve's index, for a component that is not animated.
|
|
16
|
+
*
|
|
17
|
+
* @type {number}
|
|
18
|
+
*/
|
|
19
|
+
const NO_CURVE = 0xFFFFFFFF;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Give a curve a place in the clip's table the first time it is met.
|
|
23
|
+
*
|
|
24
|
+
* @param {Map<AnimationCurve, number>} indices
|
|
25
|
+
* @param {AnimationCurve[]} table
|
|
26
|
+
* @param {AnimationCurve|undefined} curve
|
|
27
|
+
*/
|
|
28
|
+
function collect_curve(indices, table, curve) {
|
|
29
|
+
if (curve === undefined || curve === null || indices.has(curve)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
indices.set(curve, table.length);
|
|
34
|
+
table.push(curve);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {BinaryBuffer} buffer
|
|
39
|
+
* @param {Map<AnimationCurve, number>} indices
|
|
40
|
+
* @param {AnimationCurve|undefined} curve
|
|
41
|
+
*/
|
|
42
|
+
function write_curve_index(buffer, indices, curve) {
|
|
43
|
+
if (curve === undefined || curve === null) {
|
|
44
|
+
buffer.writeUint32(NO_CURVE);
|
|
45
|
+
} else {
|
|
46
|
+
buffer.writeUint32(indices.get(curve));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @param {BinaryBuffer} buffer
|
|
52
|
+
* @param {AnimationCurve[]} table
|
|
53
|
+
* @param {string} clip_name named if the index is outside the table
|
|
54
|
+
* @returns {AnimationCurve|undefined}
|
|
55
|
+
*/
|
|
56
|
+
function read_curve_index(buffer, table, clip_name) {
|
|
57
|
+
const index = buffer.readUint32();
|
|
58
|
+
|
|
59
|
+
if (index === NO_CURVE) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (index >= table.length) {
|
|
64
|
+
throw new Error(`clip '${clip_name}' names curve ${index}, and it holds ${table.length}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return table[index];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* A {@link ShadeAnimationClip} on disk, as a loader's bundle holds it: a channel's target is a place in the
|
|
72
|
+
* bundle's nodes.
|
|
73
|
+
*
|
|
74
|
+
* <pre>
|
|
75
|
+
* UTF8 name
|
|
76
|
+
* UintVar curve count
|
|
77
|
+
* curves each as {@link serialize_animation_curve} writes one: a key count, then time, value, in tangent
|
|
78
|
+
* and out tangent of every key as float32s
|
|
79
|
+
* UintVar channel count
|
|
80
|
+
* channels each: u32 target, u8 property ({@link Node3DProperty}), then u32 x 4 for x, y, z and w: a curve's
|
|
81
|
+
* place in this clip's curves, or 0xFFFFFFFF for a component that is not animated
|
|
82
|
+
* </pre>
|
|
83
|
+
*
|
|
84
|
+
* A curve is in the record once however many components it drives, and a clip read back shares exactly the
|
|
85
|
+
* curves the clip written did: a uniform scale is one curve under three axes, and the animation manager uploads a
|
|
86
|
+
* curve once by which object it is.
|
|
87
|
+
*
|
|
88
|
+
* @extends BinaryClassSerializationAdapter<ShadeAnimationClip>
|
|
89
|
+
*
|
|
90
|
+
* @author Alex Goldring
|
|
91
|
+
* @copyright Company Named Limited (c) 2026
|
|
92
|
+
*/
|
|
93
|
+
export class ShadeAnimationClipSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
94
|
+
klass = ShadeAnimationClip;
|
|
95
|
+
version = 0;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Where each curve of the clip being written is in its table. Held between calls so writing a clip allocates
|
|
99
|
+
* no map.
|
|
100
|
+
*
|
|
101
|
+
* @type {Map<AnimationCurve, number>}
|
|
102
|
+
*/
|
|
103
|
+
#indices = new Map();
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @param {BinaryBuffer} buffer
|
|
107
|
+
* @param {ShadeAnimationClip} value
|
|
108
|
+
*/
|
|
109
|
+
serialize(buffer, value) {
|
|
110
|
+
const channels = value.channels;
|
|
111
|
+
const channel_count = channels.length;
|
|
112
|
+
|
|
113
|
+
const indices = this.#indices;
|
|
114
|
+
|
|
115
|
+
// a clip that could not be written leaves its curves here, and they are not this clip's
|
|
116
|
+
indices.clear();
|
|
117
|
+
|
|
118
|
+
/** @type {AnimationCurve[]} */
|
|
119
|
+
const table = [];
|
|
120
|
+
|
|
121
|
+
for (let i = 0; i < channel_count; i++) {
|
|
122
|
+
const curves = channels[i].curves;
|
|
123
|
+
|
|
124
|
+
collect_curve(indices, table, curves.x);
|
|
125
|
+
collect_curve(indices, table, curves.y);
|
|
126
|
+
collect_curve(indices, table, curves.z);
|
|
127
|
+
collect_curve(indices, table, curves.w);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
buffer.writeUTF8String(value.name);
|
|
131
|
+
|
|
132
|
+
buffer.writeUintVar(table.length);
|
|
133
|
+
|
|
134
|
+
for (let i = 0; i < table.length; i++) {
|
|
135
|
+
serialize_animation_curve(buffer, table[i]);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
buffer.writeUintVar(channel_count);
|
|
139
|
+
|
|
140
|
+
for (let i = 0; i < channel_count; i++) {
|
|
141
|
+
const channel = channels[i];
|
|
142
|
+
const curves = channel.curves;
|
|
143
|
+
|
|
144
|
+
buffer.writeUint32(channel.target);
|
|
145
|
+
buffer.writeUint8(channel.property);
|
|
146
|
+
|
|
147
|
+
write_curve_index(buffer, indices, curves.x);
|
|
148
|
+
write_curve_index(buffer, indices, curves.y);
|
|
149
|
+
write_curve_index(buffer, indices, curves.z);
|
|
150
|
+
write_curve_index(buffer, indices, curves.w);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
indices.clear();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @param {BinaryBuffer} buffer
|
|
158
|
+
* @param {ShadeAnimationClip} value
|
|
159
|
+
*/
|
|
160
|
+
deserialize(buffer, value) {
|
|
161
|
+
const name = buffer.readUTF8String();
|
|
162
|
+
|
|
163
|
+
const curve_count = buffer.readUintVar();
|
|
164
|
+
|
|
165
|
+
/** @type {AnimationCurve[]} */
|
|
166
|
+
const table = new Array(curve_count);
|
|
167
|
+
|
|
168
|
+
for (let i = 0; i < curve_count; i++) {
|
|
169
|
+
table[i] = deserialize_animation_curve(buffer);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const channel_count = buffer.readUintVar();
|
|
173
|
+
|
|
174
|
+
/** @type {ShadeAnimationChannel[]} */
|
|
175
|
+
const channels = new Array(channel_count);
|
|
176
|
+
|
|
177
|
+
for (let i = 0; i < channel_count; i++) {
|
|
178
|
+
const channel = new ShadeAnimationChannel();
|
|
179
|
+
|
|
180
|
+
channel.target = buffer.readUint32();
|
|
181
|
+
channel.property = buffer.readUint8();
|
|
182
|
+
|
|
183
|
+
const curves = channel.curves;
|
|
184
|
+
|
|
185
|
+
curves.x = read_curve_index(buffer, table, name);
|
|
186
|
+
curves.y = read_curve_index(buffer, table, name);
|
|
187
|
+
curves.z = read_curve_index(buffer, table, name);
|
|
188
|
+
curves.w = read_curve_index(buffer, table, name);
|
|
189
|
+
|
|
190
|
+
channels[i] = channel;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
value.name = name;
|
|
194
|
+
value.channels = channels;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A {@link Skin} on disk, as a loader's bundle holds it: joints and meshes are places in the bundle's nodes.
|
|
3
|
+
*
|
|
4
|
+
* <pre>
|
|
5
|
+
* UTF8 name
|
|
6
|
+
* UintVar joint count
|
|
7
|
+
* u32 x count joints, in the order per-vertex joint indices mean
|
|
8
|
+
* f32 x 16 each inverse_bind_matrices, column-major, one a joint
|
|
9
|
+
* UintVar mesh count
|
|
10
|
+
* u32 x count meshes, the nodes this skin deforms
|
|
11
|
+
* </pre>
|
|
12
|
+
*
|
|
13
|
+
* @extends BinaryClassSerializationAdapter<Skin>
|
|
14
|
+
*
|
|
15
|
+
* @author Alex Goldring
|
|
16
|
+
* @copyright Company Named Limited (c) 2026
|
|
17
|
+
*/
|
|
18
|
+
export class SkinSerializationAdapter extends BinaryClassSerializationAdapter<Skin> {
|
|
19
|
+
constructor();
|
|
20
|
+
klass: typeof Skin;
|
|
21
|
+
}
|
|
22
|
+
export type BinaryBuffer = import("../../../core/binary/BinaryBuffer.js").BinaryBuffer;
|
|
23
|
+
import { Skin } from "./Skin.js";
|
|
24
|
+
import { BinaryClassSerializationAdapter } from "../../../engine/ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
25
|
+
//# sourceMappingURL=SkinSerializationAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkinSerializationAdapter.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/animation/SkinSerializationAdapter.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;;GAgBG;AACH;;IACI,mBAAa;CA4ChB;2BAhFY,OAAO,sCAAsC,EAAE,YAAY;qBAHnD,WAAW;gDADgB,uEAAuE"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { BinaryClassSerializationAdapter } from "../../../engine/ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
|
+
import { Skin } from "./Skin.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {import("../../../core/binary/BinaryBuffer.js").BinaryBuffer} BinaryBuffer
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {BinaryBuffer} buffer
|
|
10
|
+
* @returns {number[]} a count, then as many indices
|
|
11
|
+
*/
|
|
12
|
+
function read_indices(buffer) {
|
|
13
|
+
const count = buffer.readUintVar();
|
|
14
|
+
const result = new Array(count);
|
|
15
|
+
|
|
16
|
+
for (let i = 0; i < count; i++) {
|
|
17
|
+
result[i] = buffer.readUint32();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return result;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A {@link Skin} on disk, as a loader's bundle holds it: joints and meshes are places in the bundle's nodes.
|
|
25
|
+
*
|
|
26
|
+
* <pre>
|
|
27
|
+
* UTF8 name
|
|
28
|
+
* UintVar joint count
|
|
29
|
+
* u32 x count joints, in the order per-vertex joint indices mean
|
|
30
|
+
* f32 x 16 each inverse_bind_matrices, column-major, one a joint
|
|
31
|
+
* UintVar mesh count
|
|
32
|
+
* u32 x count meshes, the nodes this skin deforms
|
|
33
|
+
* </pre>
|
|
34
|
+
*
|
|
35
|
+
* @extends BinaryClassSerializationAdapter<Skin>
|
|
36
|
+
*
|
|
37
|
+
* @author Alex Goldring
|
|
38
|
+
* @copyright Company Named Limited (c) 2026
|
|
39
|
+
*/
|
|
40
|
+
export class SkinSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
41
|
+
klass = Skin;
|
|
42
|
+
version = 0;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @param {BinaryBuffer} buffer
|
|
46
|
+
* @param {Skin} value
|
|
47
|
+
*/
|
|
48
|
+
serialize(buffer, value) {
|
|
49
|
+
const joints = value.joints;
|
|
50
|
+
const joint_count = joints.length;
|
|
51
|
+
const meshes = value.meshes;
|
|
52
|
+
|
|
53
|
+
if (value.inverse_bind_matrices.length !== joint_count * 16) {
|
|
54
|
+
// not an assert: a record written with the wrong count of matrices reads as garbage from there on
|
|
55
|
+
throw new Error(`skin '${value.name}' has ${joint_count} joints and ${value.inverse_bind_matrices.length} inverse bind matrix elements, where ${joint_count * 16} are due`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
buffer.writeUTF8String(value.name);
|
|
59
|
+
|
|
60
|
+
buffer.writeUintVar(joint_count);
|
|
61
|
+
buffer.writeUint32Array(joints, 0, joint_count);
|
|
62
|
+
buffer.writeFloat32Array(value.inverse_bind_matrices, 0, joint_count * 16);
|
|
63
|
+
|
|
64
|
+
buffer.writeUintVar(meshes.length);
|
|
65
|
+
buffer.writeUint32Array(meshes, 0, meshes.length);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @param {BinaryBuffer} buffer
|
|
70
|
+
* @param {Skin} value
|
|
71
|
+
*/
|
|
72
|
+
deserialize(buffer, value) {
|
|
73
|
+
value.name = buffer.readUTF8String();
|
|
74
|
+
|
|
75
|
+
const joints = read_indices(buffer);
|
|
76
|
+
|
|
77
|
+
const inverse_bind_matrices = new Float32Array(joints.length * 16);
|
|
78
|
+
|
|
79
|
+
buffer.readFloat32Array(inverse_bind_matrices, 0, inverse_bind_matrices.length);
|
|
80
|
+
|
|
81
|
+
value.joints = joints;
|
|
82
|
+
value.inverse_bind_matrices = inverse_bind_matrices;
|
|
83
|
+
value.meshes = read_indices(buffer);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GPUHairSystem.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/GPUHairSystem.js"],"names":[],"mappings":"AAwIA;;;;GAIG;AACH,+BAFU,MAAM,CAEkB;AAElC;;;GAGG;AACH,wCAFU,MAAM,CAE6B;AAc7C;;GAEG;AACH;IACI,6CAA6C;IAC7C,SADW,MAAM,CACH;IAEd,kEAAkE;IAClE,SADW,MAAM,CACL;IAEZ,mDAAmD;IACnD,KADW,YAAY,CACW;IAElC,oDAAoD;IACpD,WADW,MAAM,CACD;IAEhB;;OAEG;IACH,YAFW,YAAY,QAOtB;IAED;;;OAGG;IACH,cAHW,YAAY,GACV,OAAO,CASnB;CACJ;AAED;;;GAGG;AACH;IACI,gCAAgC;IAChC,SADW,MAAM,CACL;IAEZ,gCAAgC;IAChC,mBADW,MAAM,CACM;IAEvB,+CAA+C;IAC/C,oBADW,MAAM,CACQ;IAEzB,gCAAgC;IAChC,kBADW,MAAM,CACK;IAEtB,qBAAqB;IACrB,UADW,MAAM,CACF;IAEf,4BAA4B;IAC5B,WADW,MAAM,CACH;IAEd;;OAEG;IACH,YAFW,oBAAoB,QAS9B;IAED;;;OAGG;IACH,cAHW,oBAAoB,GAClB,OAAO,CASnB;CACJ;AAiBD;;GAEG;AACH;IACI,yBAAyB;IACzB,OADW,KAAK,GAAC,IAAI,CACR;IAEb,iFAAiF;IACjF,MADW,MAAM,EAAE,CACT;IAEV,wDAAwD;IACxD,MADW,MAAM,CACR;IAET,gDAAgD;IAChD,UADW,YAAY,CACO;IAE9B,kGAAkG;IAClG,UADW,oBAAoB,GAAC,IAAI,CACpB;IAEhB,6GAA6G;IAC7G,QADW,OAAO,mDAAmD,EAAE,UAAU,EAAE,CACvE;IAEZ,kDAAkD;IAClD,QADW,MAAM,EAAE,CACP;IAEZ,kHAAkH;IAClH,WADW,WAAW,CACiD;IAEvE,qBAAqB;IACrB,gBADW,MAAM,CACE;IAEnB,2GAA2G;IAC3G,WADW,MAAM,CACa;IAE9B,sGAAsG;IACtG,eADW,OAAO,gCAAgC,EAAE,eAAe,GAAC,IAAI,CACnD;IAErB,4DAA4D;IAC5D,cADW,MAAM,CACA;IAEjB,8FAA8F;IAC9F,UADW,MAAM;QAAC,GAAG,MAAS;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC,GAAC,IAAI,CAAC,CAC1C;IAEd,qHAAqH;IACrH,OADW,MAAM,OAAO,mDAAmD,EAAE,UAAU,GAAC,IAAI,CAAC,CAClF;CACd;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH;IACI;;;;OAIG;IACH,iCAFW,OAAO,0CAA0C,EAAE,eAAe,QAwB5E;
|
|
1
|
+
{"version":3,"file":"GPUHairSystem.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/GPUHairSystem.js"],"names":[],"mappings":"AAwIA;;;;GAIG;AACH,+BAFU,MAAM,CAEkB;AAElC;;;GAGG;AACH,wCAFU,MAAM,CAE6B;AAc7C;;GAEG;AACH;IACI,6CAA6C;IAC7C,SADW,MAAM,CACH;IAEd,kEAAkE;IAClE,SADW,MAAM,CACL;IAEZ,mDAAmD;IACnD,KADW,YAAY,CACW;IAElC,oDAAoD;IACpD,WADW,MAAM,CACD;IAEhB;;OAEG;IACH,YAFW,YAAY,QAOtB;IAED;;;OAGG;IACH,cAHW,YAAY,GACV,OAAO,CASnB;CACJ;AAED;;;GAGG;AACH;IACI,gCAAgC;IAChC,SADW,MAAM,CACL;IAEZ,gCAAgC;IAChC,mBADW,MAAM,CACM;IAEvB,+CAA+C;IAC/C,oBADW,MAAM,CACQ;IAEzB,gCAAgC;IAChC,kBADW,MAAM,CACK;IAEtB,qBAAqB;IACrB,UADW,MAAM,CACF;IAEf,4BAA4B;IAC5B,WADW,MAAM,CACH;IAEd;;OAEG;IACH,YAFW,oBAAoB,QAS9B;IAED;;;OAGG;IACH,cAHW,oBAAoB,GAClB,OAAO,CASnB;CACJ;AAiBD;;GAEG;AACH;IACI,yBAAyB;IACzB,OADW,KAAK,GAAC,IAAI,CACR;IAEb,iFAAiF;IACjF,MADW,MAAM,EAAE,CACT;IAEV,wDAAwD;IACxD,MADW,MAAM,CACR;IAET,gDAAgD;IAChD,UADW,YAAY,CACO;IAE9B,kGAAkG;IAClG,UADW,oBAAoB,GAAC,IAAI,CACpB;IAEhB,6GAA6G;IAC7G,QADW,OAAO,mDAAmD,EAAE,UAAU,EAAE,CACvE;IAEZ,kDAAkD;IAClD,QADW,MAAM,EAAE,CACP;IAEZ,kHAAkH;IAClH,WADW,WAAW,CACiD;IAEvE,qBAAqB;IACrB,gBADW,MAAM,CACE;IAEnB,2GAA2G;IAC3G,WADW,MAAM,CACa;IAE9B,sGAAsG;IACtG,eADW,OAAO,gCAAgC,EAAE,eAAe,GAAC,IAAI,CACnD;IAErB,4DAA4D;IAC5D,cADW,MAAM,CACA;IAEjB,8FAA8F;IAC9F,UADW,MAAM;QAAC,GAAG,MAAS;QAAC,UAAU,EAAE,MAAM,CAAA;KAAC,GAAC,IAAI,CAAC,CAC1C;IAEd,qHAAqH;IACrH,OADW,MAAM,OAAO,mDAAmD,EAAE,UAAU,GAAC,IAAI,CAAC,CAClF;CACd;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH;IACI;;;;OAIG;IACH,iCAFW,OAAO,0CAA0C,EAAE,eAAe,QAwB5E;IAuMD;;OAEG;IACH,sBAFW,eAAe,EAgBzB;IAtND;;;;;;OAMG;IACH,aAFU,MAAM,CAEe;IAE/B;;;;;;;;;;OAUG;IACH,cAFU,OAAO,CAEG;IAEpB;;;OAGG;IACH,SAFU,YAAY,CAEuB;IA8L7C,6BAA6B;IAC7B,4BAEC;IAED,0EAA0E;IAC1E,2EAEC;IAED,4BAA4B;IAC5B,uBAEC;IAED,6CAA6C;IAC7C,0BAEC;IAED,4CAA4C;IAC5C,oBAEC;IAED,+DAA+D;IAC/D,6BAEC;IAED,uFAAuF;IACvF,2BAEC;IAED,0DAA0D;IAC1D,4BAEC;IAED,4GAA4G;IAC5G,4BAEC;IAED,8DAA8D;IAC9D,6BAEC;IAED,uFAAuF;IACvF,2BAEC;IAED,sDAAsD;IACtD,wBAEC;IAED,4BAA4B;IAC5B,6BAEC;IAED,4DAA4D;IAC5D,0BAEC;IAED;;;;;OAKG;IACH,cAFW,MAAM,QAMhB;IAED;;;;;;;OAOG;IACH,sBAHW,cAAc,YACd,oBAAoB,GAAC,IAAI,QAwCnC;IAED;;;;;;;;;;;;OAYG;IACH,qBALW,cAAc,aACd,MAAM,YACN,OAAO,gCAAgC,EAAE,eAAe,GAAC,IAAI,gBAC7D,MAAM,QA2FhB;IAED;;;;;OAKG;IACH,eAFW,cAAc,QAaxB;IAED;;;;;;;OAOG;IACH,uBAJW,cAAc,SACd,WAAW,SACX,MAAM,QAYhB;IAED;;;;;;;OAOG;IACH,WALW,KAAK,QACL,MAAM,YACN,YAAY,GACV,cAAc,GAAC,IAAI,CA+B/B;IAED;;;;;OAKG;IACH,kBAHW,cAAc,QACd,MAAM,QAYhB;IAED;;;OAGG;IACH,sBAHW,cAAc,YACd,YAAY,QAUtB;IAED;;OAEG;IACH,gBAFW,cAAc,QA6CxB;IAED;;OAEG;IACH,eAUC;IAED;;;;;;OAMG;IACH,kBAFW,YAAY,QAsXtB;IA6HD;;;;;OAKG;IACH,mBAFW,YAAY,QAmGtB;IAED,gBAiBC;;CA+rBJ;oBA1qEY,OAAO,wCAAwC,EAAE,KAAK;2BACtD,OAAO,8BAA8B,EAAE,YAAY;8BACnD,OAAO,uBAAuB,EAAE,eAAe;4BAvFhC,gCAAgC;2BADjC,yBAAyB"}
|
|
@@ -533,10 +533,12 @@ export class GPUHairSystem {
|
|
|
533
533
|
#view_u32 = new Uint32Array(this.#view_words);
|
|
534
534
|
|
|
535
535
|
/**
|
|
536
|
-
* A shadow view's rectangle, `HAIR_SHADOW_TARGET_STRUCT`, written a view at a time.
|
|
537
|
-
* @type {
|
|
536
|
+
* A shadow view's rectangle and the frame's list capacity, `HAIR_SHADOW_TARGET_STRUCT`, written a view at a time.
|
|
537
|
+
* @type {ArrayBuffer}
|
|
538
538
|
*/
|
|
539
|
-
#shadow_view_words = new
|
|
539
|
+
#shadow_view_words = new ArrayBuffer(HAIR_SHADOW_TARGET_STRUCT.size);
|
|
540
|
+
#shadow_view_f32 = new Float32Array(this.#shadow_view_words);
|
|
541
|
+
#shadow_view_u32 = new Uint32Array(this.#shadow_view_words);
|
|
540
542
|
|
|
541
543
|
/**
|
|
542
544
|
* The frame's shadow views the strands draw into, `HAIR_SHADOW_VIEW_STRUCT` each; made with the first frame that
|
|
@@ -1421,12 +1423,17 @@ export class GPUHairSystem {
|
|
|
1421
1423
|
|
|
1422
1424
|
const views = shadows.views;
|
|
1423
1425
|
const view_words = this.#shadow_view_words;
|
|
1426
|
+
const view_f32 = this.#shadow_view_f32;
|
|
1427
|
+
const resolution_word = HAIR_SHADOW_TARGET_STRUCT.get("resolution").offset / 4;
|
|
1428
|
+
|
|
1429
|
+
this.#shadow_view_u32[HAIR_SHADOW_TARGET_STRUCT.get("list_capacity").offset / 4] = list_capacity;
|
|
1424
1430
|
|
|
1425
1431
|
const data = {};
|
|
1426
1432
|
|
|
1427
1433
|
const pass = graph.add("draw hair shadows", data, (data, resources, context) => {
|
|
1428
1434
|
const encoder = context.encoder;
|
|
1429
1435
|
const atlas = resources.get(data.atlas).obtainView();
|
|
1436
|
+
const hair_shadow_list = resources.get(data.shadow_list);
|
|
1430
1437
|
const hair_list = resources.get(data.list);
|
|
1431
1438
|
const hair_points = resources.get(data.points);
|
|
1432
1439
|
const draw_args = resources.get(data.args);
|
|
@@ -1435,12 +1442,13 @@ export class GPUHairSystem {
|
|
|
1435
1442
|
const view = views[v];
|
|
1436
1443
|
const [x, y, width, height] = view.viewport;
|
|
1437
1444
|
|
|
1438
|
-
|
|
1439
|
-
|
|
1445
|
+
view_f32[resolution_word] = width;
|
|
1446
|
+
view_f32[resolution_word + 1] = height;
|
|
1440
1447
|
|
|
1441
1448
|
const bindings = HAIR_SHADOW_RESOURCES.generateBindings({
|
|
1442
1449
|
camera: view.camera_buffer,
|
|
1443
|
-
hair_shadow_view: encoder.allocateTransientBufferAndLoad(view_words
|
|
1450
|
+
hair_shadow_view: encoder.allocateTransientBufferAndLoad(view_words, GPUBufferUsage.UNIFORM),
|
|
1451
|
+
hair_shadow_list,
|
|
1444
1452
|
hair_list,
|
|
1445
1453
|
hair_points,
|
|
1446
1454
|
}, encoder);
|
|
@@ -1469,7 +1477,8 @@ export class GPUHairSystem {
|
|
|
1469
1477
|
}
|
|
1470
1478
|
});
|
|
1471
1479
|
|
|
1472
|
-
data.
|
|
1480
|
+
data.shadow_list = pass.read(listed.hair_shadow_list);
|
|
1481
|
+
data.list = pass.read(list);
|
|
1473
1482
|
data.points = pass.read(points);
|
|
1474
1483
|
data.args = pass.read(args);
|
|
1475
1484
|
data.atlas = pass.write(shadows.atlas);
|
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
* **A draw list entry** is a strand: its slot, with its point class above {@link HAIR_CLASS_SHIFT}. A strand of
|
|
12
12
|
* class `c` has `2^c` segments. A class's region of the list holds first the strands of instances the view draws,
|
|
13
13
|
* from its start, then those of instances only the shadow views draw, from its start plus the first's count. Where
|
|
14
|
-
* the strands cast shadows, the list is followed, at its capacity, by
|
|
15
|
-
* ({@link HAIR_LIST_SHADOW_WORDS}): the widest half width any point of the strand is drawn at
|
|
16
|
-
* point of it is from its root, metres,
|
|
14
|
+
* the strands cast shadows, the list is followed, at its capacity, by three words an entry
|
|
15
|
+
* ({@link HAIR_LIST_SHADOW_WORDS}), f32 bits: the widest half width any point of the strand is drawn at; the farthest
|
|
16
|
+
* any point of it is from its root, metres; and its share, the number in [0, 1), stratified over its group's ranks,
|
|
17
|
+
* that decides whether a point of it narrower than a view's floor or a shadow view's texel is drawn at it. The share
|
|
18
|
+
* belongs to the strand, not to where the frame placed it, so a strand is drawn or not frame after frame.
|
|
17
19
|
*
|
|
18
20
|
* **An instance's density volume** is a box of voxels around its strands, cubes of one edge, in the frame's voxel
|
|
19
21
|
* buffer (`u32`) from its LOD record's `voxel_base`: {@link HAIR_VOLUME_MIPS} levels one after another, x fastest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HAIR.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/HAIR.js"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"HAIR.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/HAIR.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH;;GAEG;AACH,8CAAwC;AAExC;;;GAGG;AACH,2BAFU,MAAM,CAEc;AAE9B;;;GAGG;AACH,iCAFU,MAAM,CAEoB;AAEpC;;;GAGG;AACH,+BAFU,MAAM,CAEmB;AAEnC;;;GAGG;AACH,+BAFU,MAAM,CAEkB;AAElC;;;GAGG;AACH,wCAFU,MAAM,CAEmD;AAEnE;;;GAGG;AACH,4BAFU,MAAM,CAEgB;AAEhC;;;;GAIG;AACH,6BAFU,MAAM,CAEiB;AAEjC;;;GAGG;AACH,oCAFU,MAAM,CAE2B;AAE3C;;;GAGG;AACH,+BAFU,MAAM,CAEkB;AAElC;;;GAGG;AACH,0CAFU,MAAM,CAE+B;AAE/C;;;;GAIG;AACH,yCAFU,MAAM,CAEsF;AAEtG;;;;;;;;;;;;;;GAcG;AACH,iCAFU,MAAM,CAEqB;AAErC,oCAAqC;AACrC,oCAAqC;AACrC,oCAAqC;AACrC,sCAAuC;AACvC,6CAA8C;AAC9C,6CAA8C;AAE9C;;;GAGG;AACH,qCAFU,MAAM,CAEwB;AAExC;;;GAGG;AACH,mCAFU,MAAM,CAEsB"}
|
|
@@ -11,9 +11,11 @@
|
|
|
11
11
|
* **A draw list entry** is a strand: its slot, with its point class above {@link HAIR_CLASS_SHIFT}. A strand of
|
|
12
12
|
* class `c` has `2^c` segments. A class's region of the list holds first the strands of instances the view draws,
|
|
13
13
|
* from its start, then those of instances only the shadow views draw, from its start plus the first's count. Where
|
|
14
|
-
* the strands cast shadows, the list is followed, at its capacity, by
|
|
15
|
-
* ({@link HAIR_LIST_SHADOW_WORDS}): the widest half width any point of the strand is drawn at
|
|
16
|
-
* point of it is from its root, metres,
|
|
14
|
+
* the strands cast shadows, the list is followed, at its capacity, by three words an entry
|
|
15
|
+
* ({@link HAIR_LIST_SHADOW_WORDS}), f32 bits: the widest half width any point of the strand is drawn at; the farthest
|
|
16
|
+
* any point of it is from its root, metres; and its share, the number in [0, 1), stratified over its group's ranks,
|
|
17
|
+
* that decides whether a point of it narrower than a view's floor or a shadow view's texel is drawn at it. The share
|
|
18
|
+
* belongs to the strand, not to where the frame placed it, so a strand is drawn or not frame after frame.
|
|
17
19
|
*
|
|
18
20
|
* **An instance's density volume** is a box of voxels around its strands, cubes of one edge, in the frame's voxel
|
|
19
21
|
* buffer (`u32`) from its LOD record's `voxel_base`: {@link HAIR_VOLUME_MIPS} levels one after another, x fastest,
|
|
@@ -127,7 +129,7 @@ export const HAIR_COUNTER_SHADOW_CURSORS = 40;
|
|
|
127
129
|
* Words an entry of the draw list carries past the list's capacity where the strands cast shadows.
|
|
128
130
|
* @type {number}
|
|
129
131
|
*/
|
|
130
|
-
export const HAIR_LIST_SHADOW_WORDS =
|
|
132
|
+
export const HAIR_LIST_SHADOW_WORDS = 3;
|
|
131
133
|
|
|
132
134
|
/**
|
|
133
135
|
* Words of one indirect draw: vertex count, instance count, first vertex, first instance.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A shadow view's rectangle as the hair draws into it.
|
|
2
|
+
* A shadow view's rectangle as the hair draws into it, and where the frame's draw list keeps its shadow words.
|
|
3
3
|
* @type {WebGPUStruct}
|
|
4
4
|
*/
|
|
5
5
|
export const HAIR_SHADOW_TARGET_STRUCT: WebGPUStruct;
|
|
6
6
|
/**
|
|
7
|
-
* The bindings of {@link HAIR_SHADOW_PIPELINE}: `camera` (the shadow view's), `hair_shadow_view`, `
|
|
8
|
-
* shadow views' lists) and `hair_points` (the frame's deformed points).
|
|
7
|
+
* The bindings of {@link HAIR_SHADOW_PIPELINE}: `camera` (the shadow view's), `hair_shadow_view`, `hair_shadow_list`
|
|
8
|
+
* (the shadow views' lists), `hair_list` (the frame's draw list) and `hair_points` (the frame's deformed points).
|
|
9
9
|
*
|
|
10
10
|
* @type {ShaderResourceSetDescriptor}
|
|
11
11
|
*/
|
|
@@ -14,14 +14,14 @@ export const HAIR_SHADOW_RESOURCES: ShaderResourceSetDescriptor;
|
|
|
14
14
|
* Draws the frame's strands into a shadow view's depth with the rasterizer's bias (`DEPTH_STENCIL_STATE_SHADOW`), in
|
|
15
15
|
* cascades as well: a strand has no surface normal for the cascade casters' vertex-stage push to read.
|
|
16
16
|
*
|
|
17
|
-
* An instance is an entry of the view's list (`shader_hair_shadow_list`), a strand,
|
|
18
|
-
* it for the eye: a triangle strip a pair of vertices at each
|
|
19
|
-
* point class (`shader_hair_shadow_draw_args`),
|
|
17
|
+
* An instance is an entry of the view's list (`shader_hair_shadow_list`), a strand, the place of its entry in the
|
|
18
|
+
* frame's draw list. It is drawn as `hair_id_draw.js` draws it for the eye: a triangle strip a pair of vertices at each
|
|
19
|
+
* of its points, `2 (2^class + 1)` vertices, one draw a point class (`shader_hair_shadow_draw_args`),
|
|
20
20
|
* across the strand's tangent and the way to the light. Its width is the strand's own, as its point carries it, also
|
|
21
|
-
* where the camera's view drew it at none. Under a texel, a point is drawn a texel wide by the strands whose
|
|
22
|
-
*
|
|
23
|
-
* strands' own at any texel size. A point nearer the light than the view's near plane is drawn on
|
|
24
|
-
* are drawn.
|
|
21
|
+
* where the camera's view drew it at none. Under a texel, a point is drawn a texel wide by the strands whose share
|
|
22
|
+
* (their third shadow word, `HAIR.js`) is under its width's fraction of the texel, and at none by the rest, so the
|
|
23
|
+
* covered area is the strands' own at any texel size. A point nearer the light than the view's near plane is drawn on
|
|
24
|
+
* the plane. Both faces are drawn.
|
|
25
25
|
*
|
|
26
26
|
* @type {RenderPipelineDescriptor}
|
|
27
27
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hair_shadow_draw.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/hair_shadow_draw.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wCAFU,YAAY,
|
|
1
|
+
{"version":3,"file":"hair_shadow_draw.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/hair_shadow_draw.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH,wCAFU,YAAY,CAOQ;AA6E9B;;;;;GAKG;AACH,oCAFU,2BAA2B,CAEU;AAE/C;;;;;;;;;;;;;;GAcG;AACH,mCAFU,wBAAwB,CAQ/B;6BAtH0B,gCAAgC;4CAJjB,mDAAmD;yCAJtD,8DAA8D"}
|
|
@@ -4,18 +4,20 @@ import { DEPTH_STENCIL_STATE_SHADOW } from "../rasterize/DEPTH_STENCIL_STATE_SHA
|
|
|
4
4
|
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
5
5
|
import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
|
|
6
6
|
import { ShaderDescriptor } from "../shader/ShaderDescriptor.js";
|
|
7
|
-
import { vec2f, vec4u } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
7
|
+
import { u32, vec2f, vec4u } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
8
8
|
import { WebGPUArray } from "../shader/type/WebGPUArray.js";
|
|
9
9
|
import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
|
|
10
|
-
import { HAIR_CLASS_SHIFT } from "./HAIR.js";
|
|
10
|
+
import { HAIR_CLASS_SHIFT, HAIR_LIST_SHADOW_WORDS } from "./HAIR.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* A shadow view's rectangle as the hair draws into it.
|
|
13
|
+
* A shadow view's rectangle as the hair draws into it, and where the frame's draw list keeps its shadow words.
|
|
14
14
|
* @type {WebGPUStruct}
|
|
15
15
|
*/
|
|
16
16
|
export const HAIR_SHADOW_TARGET_STRUCT = WebGPUStruct.from({
|
|
17
17
|
/** the view's rectangle in the atlas, texels */
|
|
18
18
|
resolution: vec2f,
|
|
19
|
+
/** entries the frame's draw list holds: its shadow words follow them */
|
|
20
|
+
list_capacity: u32,
|
|
19
21
|
}, "HairShadowTarget").pack();
|
|
20
22
|
|
|
21
23
|
const resources = new ShaderResourceSetDescriptor();
|
|
@@ -23,6 +25,7 @@ const resources = new ShaderResourceSetDescriptor();
|
|
|
23
25
|
resources.createGroup()
|
|
24
26
|
.add(CAMERA_RESOURCE)
|
|
25
27
|
.addUniform("hair_shadow_view", HAIR_SHADOW_TARGET_STRUCT)
|
|
28
|
+
.addStorageBuffer("hair_shadow_list", WebGPUArray.u32)
|
|
26
29
|
.addStorageBuffer("hair_list", WebGPUArray.u32)
|
|
27
30
|
.addStorageBuffer("hair_points", WebGPUArray.from(vec4u));
|
|
28
31
|
|
|
@@ -36,7 +39,8 @@ fn hair_point(slot: u32) -> vec4<f32> {
|
|
|
36
39
|
|
|
37
40
|
@vertex
|
|
38
41
|
fn vs_main(@builtin(vertex_index) vertex: u32, @builtin(instance_index) instance: u32) -> @builtin(position) vec4<f32> {
|
|
39
|
-
let
|
|
42
|
+
let at = hair_shadow_list[instance];
|
|
43
|
+
let entry = hair_list[at];
|
|
40
44
|
let slot = entry & ${2 ** HAIR_CLASS_SHIFT - 1}u;
|
|
41
45
|
let segments = 1u << (entry >> ${HAIR_CLASS_SHIFT}u);
|
|
42
46
|
|
|
@@ -73,10 +77,10 @@ fn vs_main(@builtin(vertex_index) vertex: u32, @builtin(instance_index) instance
|
|
|
73
77
|
let way = select(vec2<f32>(1.0, 0.0), offset / max(real, 1e-12), real >= 1e-6);
|
|
74
78
|
|
|
75
79
|
// a point narrower than a texel is drawn a texel wide by as many strands as its width is of the texel: by those
|
|
76
|
-
// whose share
|
|
77
|
-
// the strands cover, which the map's filter takes as the light they let through
|
|
78
|
-
|
|
79
|
-
let share =
|
|
80
|
+
// whose share, stratified over their group's ranks, is under its width's fraction of the texel; the depth covers
|
|
81
|
+
// then what the strands cover, which the map's filter takes as the light they let through. The share is the
|
|
82
|
+
// strand's own, its third shadow word, so the same strands are drawn wherever the frame placed their points
|
|
83
|
+
let share = bitcast<f32>(hair_list[hair_shadow_view.list_capacity + at * ${HAIR_LIST_SHADOW_WORDS}u + 2u]);
|
|
80
84
|
let drawn = select(select(0.0, 0.5, real > share * 0.5), real, real >= 0.5);
|
|
81
85
|
|
|
82
86
|
var position = clip + vec4<f32>(way * (drawn * side) / texels * clip.w, 0.0, 0.0);
|
|
@@ -92,8 +96,8 @@ fn vs_main(@builtin(vertex_index) vertex: u32, @builtin(instance_index) instance
|
|
|
92
96
|
const descriptor = ShaderDescriptor.from({ label: "Hair Shadow", body, resources });
|
|
93
97
|
|
|
94
98
|
/**
|
|
95
|
-
* The bindings of {@link HAIR_SHADOW_PIPELINE}: `camera` (the shadow view's), `hair_shadow_view`, `
|
|
96
|
-
* shadow views' lists) and `hair_points` (the frame's deformed points).
|
|
99
|
+
* The bindings of {@link HAIR_SHADOW_PIPELINE}: `camera` (the shadow view's), `hair_shadow_view`, `hair_shadow_list`
|
|
100
|
+
* (the shadow views' lists), `hair_list` (the frame's draw list) and `hair_points` (the frame's deformed points).
|
|
97
101
|
*
|
|
98
102
|
* @type {ShaderResourceSetDescriptor}
|
|
99
103
|
*/
|
|
@@ -103,14 +107,14 @@ export const HAIR_SHADOW_RESOURCES = resources;
|
|
|
103
107
|
* Draws the frame's strands into a shadow view's depth with the rasterizer's bias (`DEPTH_STENCIL_STATE_SHADOW`), in
|
|
104
108
|
* cascades as well: a strand has no surface normal for the cascade casters' vertex-stage push to read.
|
|
105
109
|
*
|
|
106
|
-
* An instance is an entry of the view's list (`shader_hair_shadow_list`), a strand,
|
|
107
|
-
* it for the eye: a triangle strip a pair of vertices at each
|
|
108
|
-
* point class (`shader_hair_shadow_draw_args`),
|
|
110
|
+
* An instance is an entry of the view's list (`shader_hair_shadow_list`), a strand, the place of its entry in the
|
|
111
|
+
* frame's draw list. It is drawn as `hair_id_draw.js` draws it for the eye: a triangle strip a pair of vertices at each
|
|
112
|
+
* of its points, `2 (2^class + 1)` vertices, one draw a point class (`shader_hair_shadow_draw_args`),
|
|
109
113
|
* across the strand's tangent and the way to the light. Its width is the strand's own, as its point carries it, also
|
|
110
|
-
* where the camera's view drew it at none. Under a texel, a point is drawn a texel wide by the strands whose
|
|
111
|
-
*
|
|
112
|
-
* strands' own at any texel size. A point nearer the light than the view's near plane is drawn on
|
|
113
|
-
* are drawn.
|
|
114
|
+
* where the camera's view drew it at none. Under a texel, a point is drawn a texel wide by the strands whose share
|
|
115
|
+
* (their third shadow word, `HAIR.js`) is under its width's fraction of the texel, and at none by the rest, so the
|
|
116
|
+
* covered area is the strands' own at any texel size. A point nearer the light than the view's near plane is drawn on
|
|
117
|
+
* the plane. Both faces are drawn.
|
|
114
118
|
*
|
|
115
119
|
* @type {RenderPipelineDescriptor}
|
|
116
120
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader_hair_cull.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/shader_hair_cull.js"],"names":[],"mappings":"AAiCA,8CAWuB;
|
|
1
|
+
{"version":3,"file":"shader_hair_cull.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/shader_hair_cull.js"],"names":[],"mappings":"AAiCA,8CAWuB;AA8KvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,+BAFU,aAAa,CAMpB;6BA9O0B,gCAAgC;8BAL/B,4BAA4B"}
|
|
@@ -88,6 +88,7 @@ fn main(
|
|
|
88
88
|
var entry = 0u;
|
|
89
89
|
var widest = 0.0;
|
|
90
90
|
var reach = 0.0;
|
|
91
|
+
var strand_share = 0.0;
|
|
91
92
|
|
|
92
93
|
if (row < rows) {
|
|
93
94
|
var point = thread;
|
|
@@ -176,13 +177,15 @@ fn main(
|
|
|
176
177
|
hair_points[settings.point_capacity + slot + j] = vec4<u32>(bitcast<vec3<u32>>(before), row | (variation << ${HAIR_ROW_BITS}u));
|
|
177
178
|
|
|
178
179
|
// the root's thread lists the strand, in its class's part for the view or for the shadow views alone,
|
|
179
|
-
// with the widest it is drawn
|
|
180
|
-
// allows a strand: its group's longest guide and the farthest a point strays from one)
|
|
180
|
+
// with the widest it is drawn, how far it reaches from its root (the reach the level of detail's box
|
|
181
|
+
// allows a strand: its group's longest guide and the farthest a point strays from one) and its share,
|
|
182
|
+
// which a shadow view thins it by as the floor does here
|
|
181
183
|
if (j == 0u) {
|
|
182
184
|
key = select(${HAIR_COUNTER_CURSORS}u, ${HAIR_COUNTER_SHADOW_CURSORS}u, shadow_only) + lod.point_class;
|
|
183
185
|
entry = slot | (lod.point_class << ${HAIR_CLASS_SHIFT}u);
|
|
184
186
|
widest = 0.5 * instance.width_max * saturate(presence) / kept * lod.scale;
|
|
185
187
|
reach = (instance.guide_length_max + instance.guide_reach) * lod.scale + widest;
|
|
188
|
+
strand_share = share;
|
|
186
189
|
}
|
|
187
190
|
}
|
|
188
191
|
}
|
|
@@ -197,6 +200,7 @@ fn main(
|
|
|
197
200
|
|
|
198
201
|
hair_list[at] = bitcast<u32>(widest);
|
|
199
202
|
hair_list[at + 1u] = bitcast<u32>(reach);
|
|
203
|
+
hair_list[at + 2u] = bitcast<u32>(strand_share);
|
|
200
204
|
}
|
|
201
205
|
}
|
|
202
206
|
}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* **A shadow view's list** is laid out as the frame's draw list is (`HAIR.js`): view `v`'s from entry
|
|
5
5
|
* `v × list capacity`, each class's region from the draw list's start of it, its strands from the region's start, as
|
|
6
|
-
* many as the view's count of the class (`hair_shadow_counts`, `v × HAIR_CLASS_COUNT + class`).
|
|
6
|
+
* many as the view's count of the class (`hair_shadow_counts`, `v × HAIR_CLASS_COUNT + class`). An entry is where the
|
|
7
|
+
* strand's entry is in the frame's draw list, which holds its slot, its class and its shadow words.
|
|
7
8
|
*/
|
|
8
9
|
export const HAIR_SHADOW_LIST_SETTINGS: WebGPUStruct;
|
|
9
10
|
/**
|
|
@@ -22,11 +23,11 @@ export const shader_hair_shadow_list_command: ComputeShader;
|
|
|
22
23
|
*
|
|
23
24
|
* - the ball about its root as wide as its reach (its shadow words) is inside the view's planes, the near one aside;
|
|
24
25
|
* - its widest point, at the finest the view's texels are within that ball, is drawn by the shadow draw: wider than
|
|
25
|
-
* its
|
|
26
|
+
* its share (its third shadow word) of half a texel, the test of `hair_shadow_draw.js`. Where the ball reaches
|
|
26
27
|
* the eye of a perspective view, its texels are not bounded, and the strand is drawn.
|
|
27
28
|
*
|
|
28
|
-
* A drawn strand is appended to its class's region of the view's list
|
|
29
|
-
* count of the class).
|
|
29
|
+
* A drawn strand is appended to its class's region of the view's list, as the place of its entry in the frame's draw
|
|
30
|
+
* list (`chunk_subgroup_keyed_append` on the view's count of the class).
|
|
30
31
|
*
|
|
31
32
|
* @type {ComputeShader}
|
|
32
33
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader_hair_shadow_list.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/shader_hair_shadow_list.js"],"names":[],"mappings":"AA2BA
|
|
1
|
+
{"version":3,"file":"shader_hair_shadow_list.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/hair/shader_hair_shadow_list.js"],"names":[],"mappings":"AA2BA;;;;;;;GAOG;AAEH,qDAK6B;AA6B7B;;;;;GAKG;AACH,8CAFU,aAAa,CAkBpB;AAcH;;;;;;;;;;;;;;;;GAgBG;AACH,sCAFU,aAAa,CA2EpB;AAWH;;;;;;GAMG;AACH,2CAFU,aAAa,CAyBpB;6BA/N0B,gCAAgC;8BAJ/B,4BAA4B"}
|