mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 12:43:34 +00:00
Fix HDR asset support (#3795)
The HDR texture loader was never added to the app, this PR makes sure it is added when the relevant feature is enabled.
This commit is contained in:
parent
3431335ee9
commit
865698548f
2 changed files with 27 additions and 2 deletions
|
@ -9,7 +9,20 @@ use crate::texture::{Image, ImageType, TextureError};
|
|||
#[derive(Clone, Default)]
|
||||
pub struct ImageTextureLoader;
|
||||
|
||||
const FILE_EXTENSIONS: &[&str] = &["png", "dds", "tga", "jpg", "jpeg", "bmp"];
|
||||
const FILE_EXTENSIONS: &[&str] = &[
|
||||
#[cfg(feature = "png")]
|
||||
"png",
|
||||
#[cfg(feature = "dds")]
|
||||
"dds",
|
||||
#[cfg(feature = "tga")]
|
||||
"tga",
|
||||
#[cfg(feature = "jpeg")]
|
||||
"jpg",
|
||||
#[cfg(feature = "jpeg")]
|
||||
"jpeg",
|
||||
#[cfg(feature = "bmp")]
|
||||
"bmp",
|
||||
];
|
||||
|
||||
impl AssetLoader for ImageTextureLoader {
|
||||
fn load<'a>(
|
||||
|
|
|
@ -10,6 +10,7 @@ pub(crate) mod image_texture_conversion;
|
|||
pub use self::image::*;
|
||||
#[cfg(feature = "hdr")]
|
||||
pub use hdr_texture_loader::*;
|
||||
|
||||
pub use image_texture_loader::*;
|
||||
pub use texture_cache::*;
|
||||
|
||||
|
@ -23,11 +24,22 @@ pub struct ImagePlugin;
|
|||
|
||||
impl Plugin for ImagePlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
#[cfg(feature = "png")]
|
||||
#[cfg(any(
|
||||
feature = "png",
|
||||
feature = "dds",
|
||||
feature = "tga",
|
||||
feature = "jpeg",
|
||||
feature = "bmp"
|
||||
))]
|
||||
{
|
||||
app.init_asset_loader::<ImageTextureLoader>();
|
||||
}
|
||||
|
||||
#[cfg(feature = "hdr")]
|
||||
{
|
||||
app.init_asset_loader::<HdrTextureLoader>();
|
||||
}
|
||||
|
||||
app.add_plugin(RenderAssetPlugin::<Image>::default())
|
||||
.add_asset::<Image>();
|
||||
app.world
|
||||
|
|
Loading…
Reference in a new issue