Crates.io | ktx2-reader |
lib.rs | ktx2-reader |
version | 0.1.2 |
source | src |
created_at | 2020-09-21 07:48:52.275987 |
updated_at | 2020-10-19 10:48:50.790723 |
description | Asynchronously read, validate and parse KTX v.2 texture files |
homepage | |
repository | https://github.com/F3kilo/ktx2-reader |
max_upload_size | |
id | 291039 |
size | 2,832,620 |
Library, that can asynchronously read, validate and parse KTX v.2 texture files.
async fn main() {
let tex_path = get_texture_path(); /// Returns path ro texture file
let file = tokio::fs::File::open(tex_path).await.expect("Can't open file");
// Crate instance of reader.
// Load, parse and validate header.
let mut reader = Reader::new(file).await.expect("Can't create reader"); // Crate instance of reader.
// Get general texture information.
let header = reader.header();
// Description of texture regions layout e.g. layers and mip-levels.
let regions_desc = reader.regions_description();
// Read Vec<u8> with texture data.
let data = reader.read_data().await.expect("Can't read data");
}
Example of usage can be found in examples
directory.