Fix pixel format conversion in bevy_gltf (#897)

* Fix pixel format conversion in bevy_gltf

* Update renamed image::DynamicImage method calls

* Remove unused GltfError variant
This commit is contained in:
Joel Nordström 2020-11-22 04:08:50 +01:00 committed by GitHub
parent 3a9a5b4e07
commit 1e9a0544bd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View file

@ -26,7 +26,7 @@ bevy_type_registry = { path = "../bevy_type_registry", version = "0.3.0" }
# other
gltf = { version = "0.15.2", default-features = false, features = ["utils"] }
image = { version = "0.23", default-features = false }
image = { version = "0.23.12", default-features = false }
thiserror = "1.0"
anyhow = "1.0"
base64 = "0.12.3"

View file

@ -44,8 +44,6 @@ pub enum GltfError {
BufferFormatUnsupported,
#[error("Invalid image mime type.")]
InvalidImageMimeType(String),
#[error("Failed to convert image to rgb8.")]
ImageRgb8ConversionFailure,
#[error("Failed to load an image.")]
ImageError(#[from] image::ImageError),
#[error("Failed to load an asset path.")]
@ -131,9 +129,7 @@ async fn load_gltf<'a, 'b>(
}?;
let image = image::load_from_memory_with_format(buffer, format)?;
let size = image.dimensions();
let image = image
.as_rgba8()
.ok_or(GltfError::ImageRgb8ConversionFailure)?;
let image = image.into_rgba8();
let texture_label = texture_label(&texture);
load_context.set_labeled_asset(