//! Asset loading and management.
//!
//! Stage 4 introduced the first importer: a static-mesh [`glTF`](gltf) loader
//! that turns a `.gltf`/`.glb` file into engine [`Mesh`](crate::render::Mesh)es,
//! [`Material`](crate::render::Material)s, and placement [`Transform`](crate::math::Transform)s.
//!
//! Stage 5 adds the [`AssetServer`]: a central registry that loads assets through
//! pluggable [`AssetLoader`]s, deduplicates by path+type, and hands out
//! reference-counted [`Handle`]s (an asset lives as long as a handle to it does).
//! It supports synchronous and background loading and in-place [reload](AssetServer::reload),
//! the foundation later stages build live reload, streaming, and export packing
//! on. The standalone [`load_gltf`] importer stays available; the server reaches
//! it through the built-in [`GltfLoader`].

mod database;
mod gltf;
mod handle;
mod server;

pub use database::{
    asset_ref_target, AssetDatabase, AssetEntry, AssetKind, AssetRef, AssetUid, ASSET_MANIFEST_FILE,
};
pub use gltf::{load_gltf, load_gltf_slice, GltfError, GltfLoader, GltfMesh, GltfModel};
pub use handle::{AssetId, Handle, LoadState};
pub use server::{AssetError, AssetLoader, AssetServer};

/// Registers the engine's built-in asset loaders on `server`. Called by
/// [`AssetServer::new`].
pub(crate) fn register_default_loaders(server: &AssetServer) {
    server.register_loader(GltfLoader);
    server.register_loader(crate::ui::FontLoader);
}
