archetype_asset 0.2.0

Fast, modular asset system with spatial preloading
Documentation
# Archetype Asset


**Fast, modular asset system for high-performance Rust game engines.**

![License](https://img.shields.io/badge/license-Apache--2.0-blue)
![Crates.io](https://img.shields.io/crates/v/archetype_asset)

## Features


- **Backend Agnostic**: Generic `GpuDevice` abstraction (Vulkan ready, Mock provided).
- **Runtime Agnostic**: Generic `AsyncSpawner` (Tokio support, Mock provided).
- **Spatial Preloading**: Background loading based on player position.
- **LOD Generation**: Automatic mesh simplification using `meshopt`.
- **Concurrency**: High-performance caching with `DashMap`.
- **Memory Pooling**: Reduced fragmentation for geometry data.

## Quick Start


```rust
use archetype_asset::cache::AssetCache;
use archetype_asset::gpu::mock::MockGpu;
use archetype_asset::runtime::tokio::TokioSpawner; // requires feature "runtime-tokio"

#[tokio::main]

async fn main() -> anyhow::Result<()> {
    // 1. Initialize GPU and Spawner
    let gpu = MockGpu::new(); // Or your real GpuDevice impl
    let spawner = TokioSpawner::new();
    
    // 2. Create Cache (100MB limit)
    let cache = AssetCache::new(gpu, spawner, 100 * 1024 * 1024);

    // 3. Load Asset
    let model = cache.get_or_load_model("assets/my_model.glb").await?;
    
    println!("Loaded model with {} meshes", model.meshes.len());
    Ok(())
}
```

## Architecture


See [ARCHITECTURAL_GUIDE.md](ARCHITECTURAL_GUIDE.md) for a deep dive into the system design, including the caching strategy, memory pooling, and spatial system.

## Performance


- **Zero-Copy Uploads**: Assets move from disk to GPU with minimal overhead.
- **Async Pipeline**: Loading does not stall the main thread.
- **Smart Eviction**: LRU-based eviction ensures memory budget compliance.
- **Proven Efficiency**:
    - **20% faster** model loader instantiation.
    - **7% faster** cache hit lookups.
    - **Zero allocation** mesh creation path.
    
    *Benchmarks run on Intel Core i5-11400F, Intel Arc A380, 16GB RAM.*