use mln_engine::RenderMode;
use mln_engine::camera::{FrameProjection, MapView};
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
pub enum DemandMode {
#[default]
IfChanged,
Force,
WaitForUpdate,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
pub struct FrameDemand {
pub mode: DemandMode,
pub token: u64,
}
impl FrameDemand {
#[must_use]
pub fn new(mode: DemandMode, token: u64) -> Self {
FrameDemand { mode, token }
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum FrameDisposition {
Rendered,
NoUpdate,
TargetNotReady,
Superseded,
Failed,
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct FrameResult {
pub disposition: FrameDisposition,
pub token: Option<u64>,
pub map_update_generation: u64,
pub generation: u64,
pub frame_generation: u64,
pub needs_repaint: bool,
pub view: Option<MapView>,
pub mode: RenderMode,
pub projection: Option<FrameProjection>,
}
impl FrameResult {
pub(crate) fn unrendered(token: Option<u64>, disposition: FrameDisposition, map_update_generation: u64) -> Self {
FrameResult {
disposition,
token,
map_update_generation,
generation: 0,
frame_generation: 0,
needs_repaint: false,
view: None,
mode: RenderMode::Partial,
projection: None,
}
}
}