nightshade 0.14.1

A cross-platform data-oriented game engine.
Documentation
use crate::ecs::material::resources::MaterialRegistry;
use crate::ecs::prefab::resources::{AnimationCache, MeshCache, PrefabCache};
use crate::render::wgpu::texture_cache::{SamplerSettings, TextureUsage};
use std::collections::HashMap;

#[cfg(feature = "scene_graph")]
use crate::ecs::scene::registry::AssetRegistry;

#[derive(Default)]
pub struct AssetState {
    pub mesh_cache: MeshCache,
    pub animation_cache: AnimationCache,
    pub prefab_cache: PrefabCache,
    pub material_registry: MaterialRegistry,
    /// Encoded or decoded texture bytes, keyed by texture name. Populated
    /// when textures are imported (e.g. from glTF) so that scene saves
    /// can embed the original data instead of relying on transient
    /// `texture_cache` GPU state. Not used during rendering.
    pub texture_sources: HashMap<String, TextureSourceBytes>,
    #[cfg(feature = "scene_graph")]
    pub asset_registry: AssetRegistry,
}

#[derive(Debug, Clone)]
pub struct TextureSourceBytes {
    pub data: TextureSourceData,
    /// Color space the renderer should treat the data as.
    /// Critical for normal maps and metallic-roughness textures (Linear),
    /// distinct from color/albedo textures (Color/sRGB).
    pub usage: TextureUsage,
    pub sampler: SamplerSettings,
}

#[derive(Debug, Clone)]
pub enum TextureSourceData {
    Rgba {
        rgba: Vec<u8>,
        width: u32,
        height: u32,
    },
    Png(Vec<u8>),
}