mirror of
https://github.com/bevyengine/bevy
synced 2025-02-16 14:08:32 +00:00
Add support for pnm textures (#8601)
# Objective
Add support for the [Netpbm](https://en.wikipedia.org/wiki/Netpbm) image
formats, behind a `pnm` feature flag.
My personal use case for this was robotics applications, with `pgm`
being a popular format used in the field to represent world maps in
robots.
I chose the formats and feature name by checking the logic in
[image.rs](a35ed552fa/crates/bevy_render/src/texture/image.rs (L76)
)
## Solution
Quite straightforward, the `pnm` feature flag already exists in the
`image` crate so it's just creating and exposing a `pnm` feature flag in
the root `Cargo.toml` and forwarding it through `bevy_internal` and
`bevy_render` all the way to the `image` crate.
---
## Changelog
### Added
`pnm` feature to add support for `pam`, `pbm`, `pgm` and `ppm` image
formats.
---------
Signed-off-by: Luca Della Vedova <lucadv@intrinsic.ai>
This commit is contained in:
parent
e0b18091b5
commit
a47f1ab4be
5 changed files with 14 additions and 0 deletions
|
@ -151,6 +151,9 @@ dds = ["bevy_internal/dds"]
|
||||||
# KTX2 compressed texture support
|
# KTX2 compressed texture support
|
||||||
ktx2 = ["bevy_internal/ktx2"]
|
ktx2 = ["bevy_internal/ktx2"]
|
||||||
|
|
||||||
|
# PNM image format support, includes pam, pbm, pgm and ppm
|
||||||
|
pnm = ["bevy_internal/pnm"]
|
||||||
|
|
||||||
# For KTX2 supercompression
|
# For KTX2 supercompression
|
||||||
zlib = ["bevy_internal/zlib"]
|
zlib = ["bevy_internal/zlib"]
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ bmp = ["bevy_render/bmp"]
|
||||||
webp = ["bevy_render/webp"]
|
webp = ["bevy_render/webp"]
|
||||||
basis-universal = ["bevy_render/basis-universal"]
|
basis-universal = ["bevy_render/basis-universal"]
|
||||||
dds = ["bevy_render/dds"]
|
dds = ["bevy_render/dds"]
|
||||||
|
pnm = ["bevy_render/pnm"]
|
||||||
ktx2 = ["bevy_render/ktx2"]
|
ktx2 = ["bevy_render/ktx2"]
|
||||||
# For ktx2 supercompression
|
# For ktx2 supercompression
|
||||||
zlib = ["bevy_render/zlib"]
|
zlib = ["bevy_render/zlib"]
|
||||||
|
|
|
@ -17,6 +17,7 @@ jpeg = ["image/jpeg"]
|
||||||
bmp = ["image/bmp"]
|
bmp = ["image/bmp"]
|
||||||
webp = ["image/webp"]
|
webp = ["image/webp"]
|
||||||
dds = ["ddsfile"]
|
dds = ["ddsfile"]
|
||||||
|
pnm = ["image/pnm"]
|
||||||
bevy_ci_testing = ["bevy_app/bevy_ci_testing"]
|
bevy_ci_testing = ["bevy_app/bevy_ci_testing"]
|
||||||
|
|
||||||
shader_format_glsl = ["naga/glsl-in", "naga/wgsl-out"]
|
shader_format_glsl = ["naga/glsl-in", "naga/wgsl-out"]
|
||||||
|
|
|
@ -36,6 +36,14 @@ const FILE_EXTENSIONS: &[&str] = &[
|
||||||
"ktx2",
|
"ktx2",
|
||||||
#[cfg(feature = "webp")]
|
#[cfg(feature = "webp")]
|
||||||
"webp",
|
"webp",
|
||||||
|
#[cfg(feature = "pnm")]
|
||||||
|
"pam",
|
||||||
|
#[cfg(feature = "pnm")]
|
||||||
|
"pbm",
|
||||||
|
#[cfg(feature = "pnm")]
|
||||||
|
"pgm",
|
||||||
|
#[cfg(feature = "pnm")]
|
||||||
|
"ppm",
|
||||||
];
|
];
|
||||||
|
|
||||||
impl AssetLoader for ImageTextureLoader {
|
impl AssetLoader for ImageTextureLoader {
|
||||||
|
|
|
@ -57,6 +57,7 @@ The default feature set enables most of the expected features of a game engine,
|
||||||
|jpeg|JPEG image format support|
|
|jpeg|JPEG image format support|
|
||||||
|minimp3|MP3 audio format support (through minimp3)|
|
|minimp3|MP3 audio format support (through minimp3)|
|
||||||
|mp3|MP3 audio format support|
|
|mp3|MP3 audio format support|
|
||||||
|
|pnm|PNM image format support, includes pam, pbm, pgm and ppm|
|
||||||
|serialize|Enable serialization support through serde|
|
|serialize|Enable serialization support through serde|
|
||||||
|shader_format_glsl|Enable support for shaders in GLSL|
|
|shader_format_glsl|Enable support for shaders in GLSL|
|
||||||
|shader_format_spirv|Enable support for shaders in SPIR-V|
|
|shader_format_spirv|Enable support for shaders in SPIR-V|
|
||||||
|
|
Loading…
Add table
Reference in a new issue