dreamwell-engine 1.0.0

Dreamwell pure-logic engine library — transforms, hierarchy, canon pipeline, spatial math, hashing, tile rules, validation, waymark schema, material/lighting descriptors. No SpacetimeDB dependency.
Documentation
use serde::{Deserialize, Serialize};

/// Render mode — GPU rendering strategy for particles.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum RenderMode {
    Billboard,
    StretchedBillboard,
    Ribbon,
    Beam,
    MeshInstance,
    ShardInstance,
    MeshletCluster,
    VolumetricImpostor,
    PointCloud,
}

/// Representation mode — camera/view perspective for rendering.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum RepresentationMode {
    Sprite2D,
    TopDown2D,
    Isometric2D,
    SideScroll2D,
    World3D,
    TopDown3D,
    FirstPerson3D,
    ThirdPerson3D,
}

impl RenderMode {
    pub const ALL: &[RenderMode] = &[
        Self::Billboard,
        Self::StretchedBillboard,
        Self::Ribbon,
        Self::Beam,
        Self::MeshInstance,
        Self::ShardInstance,
        Self::MeshletCluster,
        Self::VolumetricImpostor,
        Self::PointCloud,
    ];

    pub fn name(&self) -> &'static str {
        match self {
            Self::Billboard => "Billboard",
            Self::StretchedBillboard => "Stretched Billboard",
            Self::Ribbon => "Ribbon",
            Self::Beam => "Beam",
            Self::MeshInstance => "Mesh Instance",
            Self::ShardInstance => "Shard Instance",
            Self::MeshletCluster => "Meshlet Cluster",
            Self::VolumetricImpostor => "Volumetric Impostor",
            Self::PointCloud => "Point Cloud",
        }
    }
}

impl RepresentationMode {
    pub const ALL: &[RepresentationMode] = &[
        Self::Sprite2D,
        Self::TopDown2D,
        Self::Isometric2D,
        Self::SideScroll2D,
        Self::World3D,
        Self::TopDown3D,
        Self::FirstPerson3D,
        Self::ThirdPerson3D,
    ];
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn render_mode_all() {
        assert_eq!(RenderMode::ALL.len(), 9);
    }

    #[test]
    fn representation_mode_all() {
        assert_eq!(RepresentationMode::ALL.len(), 8);
    }
}