add bind_texture field to UiVertex

This commit is contained in:
griffi-gh 2023-12-01 00:54:32 +01:00
parent ce1cb63c01
commit 64e4dcfe01

View file

@ -38,6 +38,7 @@ pub struct UiDrawCommands {
// } // }
// } // }
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum BindTexture { pub enum BindTexture {
FontTexture, FontTexture,
//UserDefined(usize), //UserDefined(usize),
@ -48,7 +49,7 @@ pub struct UiVertex {
pub position: Vec2, pub position: Vec2,
pub color: Vec4, pub color: Vec4,
pub uv: Vec2, pub uv: Vec2,
//pub texture: Option<NonZeroU16>, pub bind_texture: Option<BindTexture>,
} }
#[derive(Default)] #[derive(Default)]
@ -75,21 +76,25 @@ impl UiDrawPlan {
position: *position, position: *position,
color: *color, color: *color,
uv: vec2(0.0, 0.0), uv: vec2(0.0, 0.0),
bind_texture: None,
}, },
UiVertex { UiVertex {
position: *position + Vec2::new(size.x, 0.0), position: *position + Vec2::new(size.x, 0.0),
color: *color, color: *color,
uv: vec2(1.0, 0.0), uv: vec2(1.0, 0.0),
bind_texture: None,
}, },
UiVertex { UiVertex {
position: *position + *size, position: *position + *size,
color: *color, color: *color,
uv: vec2(1.0, 1.0), uv: vec2(1.0, 1.0),
bind_texture: None,
}, },
UiVertex { UiVertex {
position: *position + Vec2::new(0.0, size.y), position: *position + Vec2::new(0.0, size.y),
color: *color, color: *color,
uv: vec2(0.0, 1.0), uv: vec2(0.0, 1.0),
bind_texture: None,
}, },
]); ]);
}, },