diff --git a/Cargo.toml b/Cargo.toml index 5711e49ceb..392646dc9d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,9 +13,19 @@ readme = "README.md" exclude = ["assets/**/*", "tools/**/*", ".github/**/*", "crates/**/*"] [features] -default = ["bevy_audio", "bevy_gltf", "bevy_wgpu", "bevy_winit"] +default = ["bevy_audio", "bevy_gltf", "bevy_wgpu", "bevy_winit", "png", "hdr", "mp3"] profiler = ["bevy_ecs/profiler", "bevy_diagnostic/profiler"] +# Image format support for texture loading (PNG and HDR are enabled by default) +png = ["bevy_render/png"] +hdr = ["bevy_render/hdr"] + +# Audio format support (MP3 is enabled by default) +mp3 = ["bevy_audio/mp3"] +flac = ["bevy_audio/flac"] +wav = ["bevy_audio/wav"] +vorbis = ["bevy_audio/vorbis"] + [workspace] members = [ "crates/*", diff --git a/crates/bevy_audio/Cargo.toml b/crates/bevy_audio/Cargo.toml index 3b265a12a5..c99dc7719b 100644 --- a/crates/bevy_audio/Cargo.toml +++ b/crates/bevy_audio/Cargo.toml @@ -17,4 +17,10 @@ bevy_ecs = {path = "../bevy_ecs", version = "0.1"} # other anyhow = "1.0" -rodio = {version = "0.11", default-features = false, features = ["mp3"]} +rodio = {version = "0.11", default-features = false} + +[features] +mp3 = ["rodio/mp3"] +flac = ["rodio/flac"] +wav = ["rodio/wav"] +vorbis = ["rodio/vorbis"] diff --git a/crates/bevy_audio/src/audio_source.rs b/crates/bevy_audio/src/audio_source.rs index 94b43b91bf..16a032e3ae 100644 --- a/crates/bevy_audio/src/audio_source.rs +++ b/crates/bevy_audio/src/audio_source.rs @@ -26,7 +26,7 @@ impl AssetLoader for Mp3Loader { } fn extensions(&self) -> &[&str] { - static EXTENSIONS: &[&str] = &["mp3"]; + static EXTENSIONS: &[&str] = &["mp3", "flac", "wav", "ogg"]; EXTENSIONS } } diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index 5e01fcdc51..bd7789ec08 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -25,7 +25,7 @@ bevy_window = { path = "../bevy_window", version = "0.1" } # rendering spirv-reflect = "0.2.3" bevy-glsl-to-spirv = "0.1.7" -image = { version = "0.23", default-features = false, features = ["png", "hdr"] } +image = { version = "0.23", default-features = false } # misc log = { version = "0.4", features = ["release_max_level_info"] } @@ -37,4 +37,8 @@ smallvec = "1.4.0" once_cell = "1.4.0" downcast-rs = "1.1.1" thiserror = "1.0" -anyhow = "1.0" \ No newline at end of file +anyhow = "1.0" + +[features] +png = ["image/png"] +hdr = ["image/hdr"] \ No newline at end of file