Async image/asset streaming and priority-queued loading for Kagura, on top of mizchi/atlas + mizchi/gfx (extracted from kagura_engine)
Dependencies
mizchi/kagura_asset_loader does not have a README file
pub struct AssetStreamManager {
fetcher : &BytesFetcher
max_concurrent : Int
next_id : Int
pending : Array[StreamRequest]
active : Map[Int, StreamRequest]
completed_count : Int
failed_count : Int
}fn AssetStreamManager::enqueue(self : AssetStreamManager, url : String, priority : AssetPriority, on_complete : (Bytes?) -> Unit) -> Intfn AssetStreamManager::image_fetch_fn(self : AssetStreamManager, priority? : AssetPriority) -> ((String, (ImageSpec?) -> Unit) -> Unit)fn AssetStreamManager::reprioritize(self : AssetStreamManager, id : Int, new_priority : AssetPriority) -> Boolpub struct AssetStreamer {
manager : AssetStreamManager
config : AssetStreamerConfig
frame_count : Int
handles : Map[String, AssetEntry]
on_evict : (AssetKey) -> Unit
}fn AssetStreamer::new(fetcher : &BytesFetcher, config? : AssetStreamerConfig, on_evict? : (AssetKey) -> Unit) -> AssetStreamerfn AssetStreamer::request(self : AssetStreamer, url : String, key : AssetKey, priority : AssetPriority, on_complete : (Bytes?) -> Unit) -> Intfn AssetStreamer::request_by_distance(self : AssetStreamer, url : String, key : AssetKey, distance : Double, thresholds? : DistanceThresholds, on_complete~ : (Bytes?) -> Unit) -> Intfn AssetStreamer::request_lod(self : AssetStreamer, url : String, key : AssetKey, lod_level : Int, priority : AssetPriority, on_complete : (Bytes?) -> Unit) -> Intpub(all) struct AssetStreamerConfig {
max_concurrent : Int
max_cached : Int
eviction_interval : Int
} derive(Debug)pub struct AsyncImageLoader {
next_id : Int
requests : Map[Int, AsyncImageRequest]
pending_ids : Array[Int]
completed_ids : Array[Int]
fetch_image_fn : (String, (ImageSpec?) -> Unit) -> Unit
}fn AsyncImageLoader::commit_image(self : AsyncImageLoader, id : Int, repo : SimpleImageRepository) -> ImageHandle?fn AsyncImageLoader::new(fetch_image_fn? : (String, (ImageSpec?) -> Unit) -> Unit) -> AsyncImageLoaderpub struct AsyncImageProgress {
total : Int
pending : Int
loading : Int
succeeded : Int
failed : Int
} derive(Debug)pub struct AsyncImageRequest {
id : Int
key : AssetKey
url : String
status : AsyncImageStatus
image_spec : ImageSpec?
} derive(Debug)pub(all) struct StreamProgress {
total : Int
pending : Int
active : Int
completed : Int
failed : Int
} derive(Debug)Install
Download zipAsync image/asset streaming and priority-queued loading for Kagura, on top of mizchi/atlas + mizchi/gfx (extracted from kagura_engine)
Dependencies