Crates.io | decrunch-unity |
lib.rs | decrunch-unity |
version | 0.1.2 |
created_at | 2025-05-18 19:52:06.337728+00 |
updated_at | 2025-05-18 19:52:06.337728+00 |
description | Decoder for crunch-compressed texture data, using the Unity fork of the crunch library. |
homepage | https://github.com/miwig/decrunch-unity |
repository | https://github.com/miwig/decrunch-unity |
max_upload_size | |
id | 1678873 |
size | 4,630,523 |
This crate provides a Rust wrapper around the Unity fork of the crunch decompressor.
use decrunch::*;
use std::fs::File;
use std::io::Read;
let mut compressed_file = File::open("testdata/copyright_2048_compressed.dat")?;
let mut compressed_data = Vec::new();
compressed_file.read_to_end(&mut compressed_data)?;
let c_data = CrunchedData::new(&compressed_data);
let decompressed_data = match c_data.decode_level(0) {
None => {
panic!("Failed to decompress texture data");
}
Some(res) => res,
};
assert!(decompressed_data.len() > 0);