Crate archetype_asset

Crate archetype_asset 

Source
Expand description

archetype_asset—A practical, high-performance bridge for loading assets into GPU memory.

This crate isn’t a full engine; it’s the “plumbing” that handles parallel decoding, memory-mapped I/O, and spatial preloading so you can focus on rendering. We follow a “Dumb Pipe” philosophy: we parse and buffer the data, but we don’t tell you how to draw it.

§Highlights

  • Renderer Agonstic: Produces raw buffers compatible with Vulkan, DX12, or Metal.
  • Runtime Flexible: Compiles against Tokio, async-std, or even no-std if you provide a spawner.
  • Spatial Awareness: Automatically manages a preload queue based on player proximity.
  • Zero-Copy: Leverages memmap2 for massive HDR cubemaps and baked assets.

§Quick Start

use archetype_asset::{AssetCache, MockGpu, runtime::mock::MockSpawner};

let gpu = MockGpu::new();
let spawner = MockSpawner::new();
let cache = AssetCache::new(gpu, spawner, 100 * 1024 * 1024);
let model = cache.get_or_load_model("model.glb")?;

§Feature Flags

  • gpu-vulkan: Enable Vulkan GPU backend
  • runtime-tokio: Enable Tokio async runtime
  • lod: Enable mesh simplification with meshopt
  • spatial-preload: Enable spatial preloading features

Re-exports§

pub use cache::metrics::AssetMetrics;
pub use cache::metrics::AssetMetricsHandle;
pub use cache::pool::AssetMemoryPool;
pub use cache::pool::MeshData;
pub use cache::pool::TextureData;
pub use cache::pool::VertexData;
pub use cache::AssetCache;
pub use gpu::mock::MockGpu;
pub use gpu::BufferUsage;
pub use gpu::GpuDevice;
pub use gpu::GpuError;
pub use gpu::GpuResult;
pub use gpu::GpuTextureFormat;
pub use gpu::TextureDescriptor;
pub use runtime::mock::MockSpawner;
pub use runtime::AsyncSpawner;
pub use runtime::JoinHandle;
pub use model::AlphaMode;
pub use model::LoadedModel;
pub use model::Material;
pub use model::Mesh;
pub use model::ModelError;
pub use model::ModelHandle;
pub use model::ModelLoader;
pub use model::Node;
pub use model::PrimitiveType;
pub use model::Transform;
pub use texture::Texture;
pub use texture::TextureError;
pub use texture::TextureFormat;
pub use texture::TextureLoader;
pub use ibl::IblHeader;
pub use ibl::MappedIblAsset;
pub use lod::default_thresholds;
pub use lod::generate_lod_levels;
pub use lod::DefaultSimplifier;
pub use lod::LodModel;
pub use lod::MeshSimplifier;
pub use async_loading::AsyncAssetError;
pub use async_loading::AsyncModelHandle;
pub use async_loading::LoadState;
pub use spatial::DistancePredictor;
pub use spatial::SpatialPredictor;
pub use renderer::Vertex;

Modules§

async_loading
Async model loading with streaming support
cache
Asset caching with LRU eviction policy
gpu
GPU abstraction layer for backend-agnostic asset loading
ibl
Image-Based Lighting (IBL) asset loading and processing
loader
Loader module for asset format handling
lod
Level of Detail (LOD) system for mesh optimization
model
Model and Mesh types
renderer
Vertex types for rendering
runtime
Async runtime abstraction for flexible async execution
spatial
Spatial preloading module
texture
Texture loading and processing

Enums§

AssetError
Main error type for asset operations

Constants§

VERSION
Current version of the crate

Type Aliases§

Result
Result type alias for asset operations