summaryrefslogtreecommitdiff
path: root/engine/src/draw_flags.rs
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-06-22 14:00:27 +0200
committerHampusM <hampus@hampusmat.com>2024-06-22 14:00:27 +0200
commita0dce2164cf348416ea15c63c5baa52afa66508f (patch)
tree9cc86afee8ddb615cf2738636bc67f408f4fbafc /engine/src/draw_flags.rs
parentedb5eb812bb6a3e7ed26526fab24b110be3828d4 (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.rs49
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,
+}