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