nightshade 0.57.0

A cross-platform data-oriented game engine.
Documentation
//! Prebuilt bundles of common engine components.
//!
//! Each bundle is a plain grouping of components that spawn together. Bundles
//! nest, so the shared [`SpatialBundle`] flattens into the others. Some pull in
//! render-owned component types, which a bundle may span.

use crate::ecs::camera::components::Camera;
use crate::ecs::cloth::components::Cloth;
use crate::ecs::decal::components::Decal;
use crate::ecs::light::components::Light;
use crate::ecs::material::components::MaterialRef;
use crate::ecs::mesh::components::{InstancedMesh, RenderMesh};
use crate::ecs::meshlet::components::MeshletMesh;
use crate::ecs::primitives::{CastsShadow, Name, Visibility};
use crate::ecs::text::components::Text;
use crate::ecs::transform::components::{GlobalTransform, LocalTransform};
use crate::ecs::water::components::Water;
use crate::render::bounding_volume::BoundingVolume;
use crate::render::particles::ParticleEmitter;

nightshade_ecs::bundle! {
    /// A named, transformed entity: the shared base the other bundles nest.
    pub struct SpatialBundle {
        pub name: Name,
        pub local_transform: LocalTransform,
        pub global_transform: GlobalTransform,
    }
}

nightshade_ecs::bundle! {
    /// A shadow-casting mesh with a material, visibility, and bounds.
    pub struct MeshBundle {
        pub spatial: SpatialBundle,
        pub mesh: RenderMesh,
        pub material: MaterialRef,
        pub visibility: Visibility,
        pub casts_shadow: CastsShadow,
        pub bounds: BoundingVolume,
    }
}

nightshade_ecs::bundle! {
    /// A light source.
    pub struct LightBundle {
        pub spatial: SpatialBundle,
        pub light: Light,
    }
}

nightshade_ecs::bundle! {
    /// Many instances of one mesh under a shared material.
    pub struct InstancedMeshBundle {
        pub spatial: SpatialBundle,
        pub instanced: InstancedMesh,
        pub material: MaterialRef,
        pub visibility: Visibility,
    }
}

nightshade_ecs::bundle! {
    /// A camera.
    pub struct CameraBundle {
        pub spatial: SpatialBundle,
        pub camera: Camera,
    }
}

nightshade_ecs::bundle! {
    /// A projected decal.
    pub struct DecalBundle {
        pub spatial: SpatialBundle,
        pub decal: Decal,
        pub visibility: Visibility,
    }
}

nightshade_ecs::bundle! {
    /// A water body.
    pub struct WaterBundle {
        pub spatial: SpatialBundle,
        pub water: Water,
    }
}

nightshade_ecs::bundle! {
    /// A block of 3D text.
    pub struct TextBundle {
        pub spatial: SpatialBundle,
        pub text: Text,
        pub visibility: Visibility,
    }
}

nightshade_ecs::bundle! {
    /// A simulated cloth with a render mesh and material.
    pub struct ClothBundle {
        pub spatial: SpatialBundle,
        pub cloth: Cloth,
        pub mesh: RenderMesh,
        pub material: MaterialRef,
        pub visibility: Visibility,
    }
}

nightshade_ecs::bundle! {
    /// A particle emitter.
    pub struct ParticleBundle {
        pub spatial: SpatialBundle,
        pub emitter: ParticleEmitter,
    }
}

nightshade_ecs::bundle! {
    /// A meshlet-based mesh with a material, visibility, and bounds.
    pub struct MeshletBundle {
        pub spatial: SpatialBundle,
        pub meshlet: MeshletMesh,
        pub material: MaterialRef,
        pub visibility: Visibility,
        pub bounds: BoundingVolume,
    }
}