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:
parent
3a9a5b4e07
commit
1e9a0544bd
@ -26,7 +26,7 @@ bevy_type_registry = { path = "../bevy_type_registry", version = "0.3.0" }
|
|||||||
|
|
||||||
# other
|
# other
|
||||||
gltf = { version = "0.15.2", default-features = false, features = ["utils"] }
|
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"
|
thiserror = "1.0"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
base64 = "0.12.3"
|
base64 = "0.12.3"
|
||||||
|
|||||||
@ -44,8 +44,6 @@ pub enum GltfError {
|
|||||||
BufferFormatUnsupported,
|
BufferFormatUnsupported,
|
||||||
#[error("Invalid image mime type.")]
|
#[error("Invalid image mime type.")]
|
||||||
InvalidImageMimeType(String),
|
InvalidImageMimeType(String),
|
||||||
#[error("Failed to convert image to rgb8.")]
|
|
||||||
ImageRgb8ConversionFailure,
|
|
||||||
#[error("Failed to load an image.")]
|
#[error("Failed to load an image.")]
|
||||||
ImageError(#[from] image::ImageError),
|
ImageError(#[from] image::ImageError),
|
||||||
#[error("Failed to load an asset path.")]
|
#[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 image = image::load_from_memory_with_format(buffer, format)?;
|
||||||
let size = image.dimensions();
|
let size = image.dimensions();
|
||||||
let image = image
|
let image = image.into_rgba8();
|
||||||
.as_rgba8()
|
|
||||||
.ok_or(GltfError::ImageRgb8ConversionFailure)?;
|
|
||||||
|
|
||||||
let texture_label = texture_label(&texture);
|
let texture_label = texture_label(&texture);
|
||||||
load_context.set_labeled_asset(
|
load_context.set_labeled_asset(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user