![crate-badge] ![docs-badge] ![ci-status]
Asynchronous reader for KTX texture format
Features:
TODO:
std::io::Read
support (?)Example:
```rust use ktx_async as ktx; use tokio::fs::File; use tokio::stream::StreamExt as _;
// In async code
// Open AsyncRead let file = File::open("example.ktx").await.unwrap();
// Start decoding KTX let decoder = ktx::Decoder::new(file); let (info, mut stream) = decoder.read_async().await.unwrap();
// create and bind a texture object ...
// Get all the frames from the stream while let Some((frame, buf)) = stream.next().await.map(|r| r.unwrap()) { unsafe { gl::TexImage2D(gl::TEXTURE2D, frame.level as GLint, info.glinternalformat as GLint, frame.pixelwidth as GLsizei, frame.pixelheight as GLsizei, /*border*/ 0, info.glformat as GLenum, info.gltype as GLenum, buf.asptr() as *const GLvoid); } } ```
Build:
cargo build
Run Test:
cargo test
Run Example:
cargo run --example basic
This project is licensed under the MIT License