#texture #read #validate #asynchronous #format #parse #reader

ktx2-reader

Asynchronously read, validate and parse KTX v.2 texture files

3 releases

0.1.2 Oct 19, 2020
0.1.1 Sep 21, 2020
0.1.0 Sep 21, 2020

#6 in #asynchronously

Apache-2.0

32KB
601 lines

KTX v.2 reader


Library, that can asynchronously read, validate and parse KTX v.2 texture files.

Features

Example

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.

Dependencies

~3.5MB
~51K SLoC