From 1994d2789f4210b8ecbda6d79237357c0e67b818 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Fri, 12 May 2023 16:37:08 +0800 Subject: [PATCH 1/2] Add support for pnm textures Signed-off-by: Luca Della Vedova --- Cargo.toml | 3 +++ crates/bevy_internal/Cargo.toml | 1 + crates/bevy_render/Cargo.toml | 1 + crates/bevy_render/src/texture/image_texture_loader.rs | 8 ++++++++ 4 files changed, 13 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 88b42749dbc08..41f7ce36a7cc5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -150,6 +150,9 @@ dds = ["bevy_internal/dds"] # KTX2 compressed texture support ktx2 = ["bevy_internal/ktx2"] +# PNM image format support, includes pam, pbm, pgm and ppm +pnm = ["bevy_internal/pnm"] + # For KTX2 supercompression zlib = ["bevy_internal/zlib"] diff --git a/crates/bevy_internal/Cargo.toml b/crates/bevy_internal/Cargo.toml index 712ce1890aca3..d3e9a532a44cf 100644 --- a/crates/bevy_internal/Cargo.toml +++ b/crates/bevy_internal/Cargo.toml @@ -36,6 +36,7 @@ bmp = ["bevy_render/bmp"] webp = ["bevy_render/webp"] basis-universal = ["bevy_render/basis-universal"] dds = ["bevy_render/dds"] +pnm = ["bevy_render/pnm"] ktx2 = ["bevy_render/ktx2"] # For ktx2 supercompression zlib = ["bevy_render/zlib"] diff --git a/crates/bevy_render/Cargo.toml b/crates/bevy_render/Cargo.toml index aec631dde0f8c..c1f932c5422e1 100644 --- a/crates/bevy_render/Cargo.toml +++ b/crates/bevy_render/Cargo.toml @@ -17,6 +17,7 @@ jpeg = ["image/jpeg"] bmp = ["image/bmp"] webp = ["image/webp"] dds = ["ddsfile"] +pnm = ["image/pnm"] bevy_ci_testing = ["bevy_app/bevy_ci_testing"] shader_format_glsl = ["naga/glsl-in", "naga/wgsl-out"] diff --git a/crates/bevy_render/src/texture/image_texture_loader.rs b/crates/bevy_render/src/texture/image_texture_loader.rs index 577f83626853f..080198beee5df 100644 --- a/crates/bevy_render/src/texture/image_texture_loader.rs +++ b/crates/bevy_render/src/texture/image_texture_loader.rs @@ -36,6 +36,14 @@ const FILE_EXTENSIONS: &[&str] = &[ "ktx2", #[cfg(feature = "webp")] "webp", + #[cfg(feature = "pnm")] + "pam", + #[cfg(feature = "pnm")] + "pbm", + #[cfg(feature = "pnm")] + "pgm", + #[cfg(feature = "pnm")] + "ppm", ]; impl AssetLoader for ImageTextureLoader { From 2cdf34e03067bd89137a9d5218b2d917c1459865 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Fri, 12 May 2023 17:03:44 +0800 Subject: [PATCH 2/2] Add docs Signed-off-by: Luca Della Vedova --- docs/cargo_features.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/cargo_features.md b/docs/cargo_features.md index 6ae8ca9a07a49..bf6a5e55fc643 100644 --- a/docs/cargo_features.md +++ b/docs/cargo_features.md @@ -57,6 +57,7 @@ The default feature set enables most of the expected features of a game engine, |jpeg|JPEG image format support| |minimp3|MP3 audio format support (through minimp3)| |mp3|MP3 audio format support| +|pnm|PNM image format support, includes pam, pbm, pgm and ppm| |serialize|Enable serialization support through serde| |shader_format_glsl|Enable support for shaders in GLSL| |shader_format_spirv|Enable support for shaders in SPIR-V|