1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use crate::{Color, Gradient};
use bytemuck::{Pod, Zeroable};
#[derive(Clone, Debug)]
pub struct Mesh2D {
pub vertices: Vec<Vertex2D>,
pub indices: Vec<u32>,
}
#[derive(Copy, Clone, Debug, Zeroable, Pod)]
#[repr(C)]
pub struct Vertex2D {
pub position: [f32; 2],
}
#[derive(Debug, Clone, PartialEq)]
pub enum Style {
Solid(Color),
Gradient(Gradient),
}
impl From<Color> for Style {
fn from(color: Color) -> Self {
Self::Solid(color)
}
}
impl From<Gradient> for Style {
fn from(gradient: Gradient) -> Self {
Self::Gradient(gradient)
}
}