diff options
author | HampusM <hampus@hampusmat.com> | 2024-06-22 14:00:27 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-06-22 14:00:27 +0200 |
commit | a0dce2164cf348416ea15c63c5baa52afa66508f (patch) | |
tree | 9cc86afee8ddb615cf2738636bc67f408f4fbafc /engine/src/draw_flags.rs | |
parent | edb5eb812bb6a3e7ed26526fab24b110be3828d4 (diff) |
feat(engine): add ability to change polygon mode per object
Diffstat (limited to 'engine/src/draw_flags.rs')
-rw-r--r-- | engine/src/draw_flags.rs | 49 |
1 files changed, 49 insertions, 0 deletions
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, +} |