nightshade 0.53.0

A cross-platform data-oriented game engine.
Documentation
use crate::ecs::animation::components::AnimationClip;
#[cfg(feature = "assets")]
use crate::ecs::prefab::components::Prefab;
use std::collections::HashMap;

#[derive(Default, Clone)]
pub struct AnimationCache {
    pub clips: HashMap<String, AnimationClip>,
}

#[derive(Default, Clone)]
pub struct PrefabCache {
    #[cfg(feature = "assets")]
    pub prefabs: HashMap<String, CachedPrefab>,
    #[cfg(not(feature = "assets"))]
    pub prefabs: HashMap<String, ()>,
}

#[cfg(feature = "assets")]
#[derive(Clone)]
pub struct CachedPrefab {
    pub prefab: Prefab,
    pub animations: Vec<AnimationClip>,
    pub skins: Vec<crate::ecs::prefab::GltfSkin>,
    pub source_path: Option<String>,
}

#[cfg(feature = "assets")]
pub fn prefab_cache_insert(cache: &mut PrefabCache, name: String, cached: CachedPrefab) {
    cache.prefabs.insert(name, cached);
}

#[cfg(feature = "assets")]
pub fn prefab_cache_names(cache: &PrefabCache) -> impl Iterator<Item = &String> + '_ {
    cache.prefabs.keys()
}