use crate::{graphics::Color, system::Vector2f};
#[repr(C)]
#[derive(Debug, Clone, Copy)]
pub struct Vertex {
pub position: Vector2f,
pub color: Color,
pub tex_coords: Vector2f,
}
impl Vertex {
#[must_use]
pub const fn new(position: Vector2f, color: Color, tex_coords: Vector2f) -> Self {
Self {
position,
color,
tex_coords,
}
}
#[must_use]
pub const fn with_pos(position: Vector2f) -> Self {
Self::new(position, Self::DEFAULT.color, Self::DEFAULT.tex_coords)
}
#[must_use]
pub const fn with_pos_color(position: Vector2f, color: Color) -> Vertex {
Self::new(position, color, Self::DEFAULT.tex_coords)
}
#[must_use]
pub const fn with_pos_coords(position: Vector2f, tex_coords: Vector2f) -> Vertex {
Self::new(position, Self::DEFAULT.color, tex_coords)
}
pub const DEFAULT: Vertex =
Self::new(Vector2f::new(0., 0.), Color::WHITE, Vector2f::new(0., 0.));
}
impl Default for Vertex {
fn default() -> Vertex {
Self::DEFAULT
}
}