Added WebP image format support (#8220)
# Objective
WebP is a modern image format developed by Google that offers a
significant reduction in file size compared to other image formats such
as PNG and JPEG, while still maintaining good image quality. This makes
it particularly useful for games with large numbers of images, such as
those with high-quality textures or detailed sprites, where file size
and loading times can have a significant impact on performance.
By adding support for WebP images in Bevy, game developers using this
engine can now take advantage of this modern image format and reduce the
memory usage and loading times of their games. This improvement can
ultimately result in a better gaming experience for players.
In summary, the objective of adding WebP image format support in Bevy is
to enable game developers to use a modern image format that provides
better compression rates and smaller file sizes, resulting in faster
loading times and reduced memory usage for their games.
## Solution
To add support for WebP images in Bevy, this pull request leverages the
existing `image` crate support for WebP. This implementation is easily
integrated into the existing Bevy asset-loading system. To maintain
compatibility with existing Bevy projects, WebP image support is
disabled by default, and developers can enable it by adding a feature
flag to their project's `Cargo.toml` file. With this feature, Bevy
becomes even more versatile for game developers and provides a valuable
addition to the game engine.
---
## Changelog
- Added support for WebP image format in Bevy game engine
## Migration Guide
To enable WebP image support in your Bevy project, add the following
line to your project's Cargo.toml file:
```toml
bevy = { version = "*", features = ["webp"]}
```
This commit is contained in:
parent
90579933f8
commit
95aa387cd0
@ -132,6 +132,9 @@ jpeg = ["bevy_internal/jpeg"]
|
||||
# BMP image format support
|
||||
bmp = ["bevy_internal/bmp"]
|
||||
|
||||
# WebP image format support
|
||||
webp = ["bevy_internal/webp"]
|
||||
|
||||
# Basis Universal compressed texture support
|
||||
basis-universal = ["bevy_internal/basis-universal"]
|
||||
|
||||
|
||||
@ -32,6 +32,7 @@ png = ["bevy_render/png"]
|
||||
tga = ["bevy_render/tga"]
|
||||
jpeg = ["bevy_render/jpeg"]
|
||||
bmp = ["bevy_render/bmp"]
|
||||
webp = ["bevy_render/webp"]
|
||||
basis-universal = ["bevy_render/basis-universal"]
|
||||
dds = ["bevy_render/dds"]
|
||||
ktx2 = ["bevy_render/ktx2"]
|
||||
|
||||
@ -15,6 +15,7 @@ hdr = ["image/hdr"]
|
||||
tga = ["image/tga"]
|
||||
jpeg = ["image/jpeg"]
|
||||
bmp = ["image/bmp"]
|
||||
webp = ["image/webp"]
|
||||
dds = ["ddsfile"]
|
||||
|
||||
# For ktx2 supercompression
|
||||
|
||||
@ -34,6 +34,8 @@ const FILE_EXTENSIONS: &[&str] = &[
|
||||
"jpeg",
|
||||
#[cfg(feature = "ktx2")]
|
||||
"ktx2",
|
||||
#[cfg(feature = "webp")]
|
||||
"webp",
|
||||
];
|
||||
|
||||
impl AssetLoader for ImageTextureLoader {
|
||||
|
||||
@ -68,5 +68,6 @@ The default feature set enables most of the expected features of a game engine,
|
||||
|trace_tracy|Tracing support, exposing a port for Tracy|
|
||||
|wav|WAV audio format support|
|
||||
|wayland|Wayland display server support|
|
||||
|webp|WebP image format support|
|
||||
|wgpu_trace|Save a trace of all wgpu calls|
|
||||
|zlib|For KTX2 supercompression|
|
||||
|
||||
Loading…
Reference in New Issue
Block a user