summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-08-20 19:12:47 +0200
committerHampusM <hampus@hampusmat.com>2026-08-20 19:12:47 +0200
commit14bd4580f580f36920bc2ea465592bfc08b50b2b (patch)
treefe192d84b8fd9f27e20ffaecbcd930f152b1fcee
parent197b8e13dc070c9bee72ceda3d21ae1561a5a69a (diff)
feat(engine): add reflection derive to color types
-rw-r--r--engine/src/data_types/color.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/engine/src/data_types/color.rs b/engine/src/data_types/color.rs
index 9664507..d2fd217 100644
--- a/engine/src/data_types/color.rs
+++ b/engine/src/data_types/color.rs
@@ -1,5 +1,7 @@
use std::ops::{Add, Div, Mul, Sub};
+use crate::reflection::Reflection;
+
pub trait Pixel: sealed::Sealed
{
type Component: PixelComponent;
@@ -12,7 +14,8 @@ pub trait PixelComponent: Clone + Copy + sealed::Sealed
macro_rules! gen_color {
($ident: ident, components=($($component: ident),+)) => {
- #[derive(Debug, Clone, Default)]
+ #[derive(Debug, Clone, Default, Reflection)]
+ #[reflection(impl_with_generics(<u8>, <u16>, <u32>, <f32>))]
pub struct $ident<Component>
{
$(pub $component: Component),+
@@ -40,7 +43,8 @@ macro_rules! gen_color {
gen_color!(Rgb, components = (r, g, b));
gen_color!(Rgba, components = (r, g, b, a));
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, Reflection)]
+#[reflection(impl_with_generics(<u8>, <u16>, <u32>, <f32>))]
pub enum Color<Component>
{
Rgb(Rgb<Component>),