From a0dce2164cf348416ea15c63c5baa52afa66508f Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 22 Jun 2024 14:00:27 +0200 Subject: feat(engine): add ability to change polygon mode per object --- engine/src/draw_flags.rs | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 engine/src/draw_flags.rs (limited to 'engine/src/draw_flags.rs') diff --git a/engine/src/draw_flags.rs b/engine/src/draw_flags.rs new file mode 100644 index 0000000..c8c11c9 --- /dev/null +++ b/engine/src/draw_flags.rs @@ -0,0 +1,49 @@ +use ecs::Component; + +use crate::util::builder; + +builder! { +/// Flags for how a object should be drawn. +#[builder(name = Builder, derives = (Debug, Default, Clone))] +#[derive(Debug, Default, Clone, Component)] +#[non_exhaustive] +pub struct DrawFlags +{ + pub polygon_mode_config: PolygonModeConfig, +} +} + +impl DrawFlags +{ + pub fn builder() -> Builder + { + Builder::default() + } +} + +#[derive(Debug, Default, Clone)] +pub struct PolygonModeConfig +{ + pub face: PolygonModeFace, + pub mode: PolygonMode, +} + +#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub enum PolygonMode +{ + Point, + Line, + + #[default] + Fill, +} + +#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] +pub enum PolygonModeFace +{ + Front, + Back, + + #[default] + FrontAndBack, +} -- cgit v1.2.3-18-g5258