![]() I can't underrate anisotropic filtering. # Objective - Allow easily enabling anisotropic filtering on glTF assets. - Allow selecting `ImageFilterMode` for glTF assets at runtime. ## Solution - Added a Resource `DefaultGltfImageSampler`: it stores `Arc<Mutex<ImageSamplerDescriptor>>` and the same `Arc` is stored in `GltfLoader`. The default is independent from provided to `ImagePlugin` and is set in the same way but with `GltfPlugin`. It can then be modified at runtime with `DefaultGltfImageSampler::set`. - Added two fields to `GltfLoaderSettings`: `default_sampler: Option<ImageSamplerDescriptor>` to override aforementioned global default descriptor and `override_sampler: bool` to ignore glTF sampler data. ## Showcase Enabling anisotropic filtering as easy as: ```rust app.add_plugins(DefaultPlugins.set(GltfPlugin{ default_sampler: ImageSamplerDescriptor { min_filter: ImageFilterMode::Linear, mag_filter: ImageFilterMode::Linear, mipmap_filter: ImageFilterMode::Linear, anisotropy_clamp: 16, ..default() }, ..default() })) ``` Use code below to ignore both the global default sampler and glTF data, having `your_shiny_sampler` used directly for all textures instead: ```rust commands.spawn(SceneRoot(asset_server.load_with_settings( GltfAssetLabel::Scene(0).from_asset("models/test-scene.gltf"), |settings: &mut GltfLoaderSettings| { settings.default_sampler = Some(your_shiny_sampler); settings.override_sampler = true; } ))); ``` Remove either setting to get different result! They don't come in pair! Scene rendered with trillinear texture filtering:  Scene rendered with 16x anisotropic texture filtering:  ## Migration Guide - The new fields in `GltfLoaderSettings` have their default values replicate previous behavior. --------- Co-authored-by: Greeble <166992735+greeble-dev@users.noreply.github.com> |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
LICENSE-APACHE | ||
LICENSE-MIT | ||
README.md |