Skip to content

Commit

Permalink
Fix pixel format conversion in bevy_gltf (#897)
Browse files Browse the repository at this point in the history
* Fix pixel format conversion in bevy_gltf

* Update renamed image::DynamicImage method calls

* Remove unused GltfError variant
  • Loading branch information
iwikal authored Nov 22, 2020
1 parent 3a9a5b4 commit 1e9a054
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_gltf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 1 addition & 5 deletions crates/bevy_gltf/src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.")]
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 1e9a054

Please sign in to comment.