nightshade 0.52.0

A cross-platform data-oriented game engine.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Shared helper for gizmo overlay systems.
//!
//! Both the selection gizmo and the navigation gizmo render only when the
//! active camera's [`ViewportShading::show_overlays`] is true. Cameras
//! without a `ViewportShading` component fall back to "overlays on", so
//! apps that never attach the component see the historical behavior.

use crate::ecs::world::World;

pub(super) fn active_camera_overlays_enabled(world: &World) -> bool {
    let Some(camera_entity) = world.resources.active_camera else {
        return true;
    };
    world
        .get::<crate::ecs::camera::components::ViewportShading>(camera_entity)
        .map(|shading| shading.show_overlays)
        .unwrap_or(true)
}