blob: de0af7041624cb5377eba4c2ca5713a4d01fdb64 (
plain)
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
|
use ecs::Component;
use crate::vertex::Vertex;
pub mod cube;
#[derive(Debug, Clone, Component)]
pub struct Mesh
{
vertices: Vec<Vertex>,
indices: Option<Vec<u32>>,
}
impl Mesh
{
#[must_use]
pub fn new(vertices: Vec<Vertex>, indices: Option<Vec<u32>>) -> Self
{
Self { vertices, indices }
}
#[must_use]
pub fn vertices(&self) -> &[Vertex]
{
&self.vertices
}
#[must_use]
pub fn indices(&self) -> Option<&[u32]>
{
self.indices.as_deref()
}
}
|