mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-11 21:38:31 +00:00
Add Index
This commit is contained in:
parent
596a02d82a
commit
34aa368907
@ -1,7 +1,7 @@
|
|||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Mesh {
|
pub struct Mesh {
|
||||||
vertices: Vec<Vertex>,
|
vertices: Vec<Vertex>,
|
||||||
triangles: Vec<[u32; 3]>,
|
triangles: Vec<[Index; 3]>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Mesh {
|
impl Mesh {
|
||||||
@ -9,7 +9,7 @@ impl Mesh {
|
|||||||
&self.vertices
|
&self.vertices
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn triangles(&self) -> &[[u32; 3]] {
|
pub fn triangles(&self) -> &[[Index; 3]] {
|
||||||
&self.triangles
|
&self.triangles
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -17,9 +17,10 @@ impl Mesh {
|
|||||||
self.vertices.push(vertex);
|
self.vertices.push(vertex);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn push_triangle(&mut self, triangle: [u32; 3]) {
|
pub fn push_triangle(&mut self, triangle: [Index; 3]) {
|
||||||
self.triangles.push(triangle);
|
self.triangles.push(triangle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Vertex = [f32; 3];
|
pub type Vertex = [f32; 3];
|
||||||
|
pub type Index = u32;
|
||||||
|
Loading…
Reference in New Issue
Block a user