bevy_image_config

Crates.iobevy_image_config
lib.rsbevy_image_config
version0.2.0
sourcesrc
created_at2022-10-11 20:46:11.303705
updated_at2022-10-12 12:23:39.527447
descriptionBevy plugin that automatically configures image assets when they load
homepage
repositoryhttps://github.com/ickshonpe/bevy_image_config
max_upload_size
id685577
size90,628
(ickshonpe)

documentation

README

bevy_image_config

crates.io MIT/Apache 2.0 crates.io

Bevy plugin that automatically loads and applies image sampler settings for image assets from an accompanying configuration file.

Usage

Add the dependency to Cargo.toml:

bevy_image_config = "0.2"

Add the plugin to your app:

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugin(bevy_image_config::ImageConfigPlugin)
        // ..rest of app
        .run()
}

If you have an image file "image_file_name.img_ext" and a configuration file "image_file_name.img_cfg" in the same directory, the plugin will automatically load and apply the settings from "image_file_name.img_cfg.ron" when you load "image_file_name.img_ext".

The available settings are:

  • address_mode_u, address_mode_v, address_mode_w:
    ClampToEdge | Repeat | MirrorRepeat | ClampToBorder
    
  • min_filter, mag_filter, mipmap_filter:
    Nearest | Linear 
    
  • lod_min_clamp: f32,
  • lod_max_clamp: f32,
  • compare:
    Option of Never | Less | Equal | LessEqual | Greater | NotEqual | GreaterEqual | Always
    
  • anisotropy_clamp: Option<NonZeroU8>,
  • border_color:
    Option of TransparentBlack | OpaqueBlack | OpaqueWhite | Zero
    

Examples

cargo run --example example
Commit count: 5

cargo fmt