diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/classes/texture2d.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/classes/texture2d.rs b/src/classes/texture2d.rs index 6b96b17..d1e6e30 100644 --- a/src/classes/texture2d.rs +++ b/src/classes/texture2d.rs @@ -133,20 +133,24 @@ impl Texture2D { _ => unreachable!(), } ); - let mut buf = vec![0u32; w * h]; - texture2ddecoder::decode_unity_crunch(&self.image_data, w, h, &mut buf).unwrap(); + let mut buf = vec![0u32; w * h * self.image_count as usize]; + // TODO decode multi-face textures + texture2ddecoder::decode_unity_crunch(&self.image_data, w, h, &mut buf) + .map_err(|e| anyhow!("{e}"))?; Ok(u32_argb_buf_to_images(buf)) } BC7 => { info!("decompressing {w}x{h} BC7 texture",); let mut buf = vec![0u32; w * h]; - texture2ddecoder::decode_bc7(&self.image_data, w, h, &mut buf).unwrap(); + texture2ddecoder::decode_bc7(&self.image_data, w, h, &mut buf) + .map_err(|e| anyhow!("{e}"))?; Ok(u32_argb_buf_to_images(buf)) } BC6H => { info!("decompressing {w}x{h} BC6H texture",); let mut buf = vec![0u32; w * h]; - texture2ddecoder::decode_bc6(&self.image_data, w, h, &mut buf, false).unwrap(); + texture2ddecoder::decode_bc6(&self.image_data, w, h, &mut buf, false) + .map_err(|e| anyhow!("{e}"))?; Ok(u32_argb_buf_to_images(buf)) } RGB24 => { |