Prepare for follow-on change

This commit is contained in:
Hanno Braun 2024-11-05 18:08:07 +01:00
parent 8fe493c8d1
commit 3ac70f4877
3 changed files with 3 additions and 5 deletions

View File

@ -12,8 +12,6 @@ pub fn export(mesh: &Mesh) -> anyhow::Result<()> {
let triangles = mesh
.triangles()
.iter()
.copied()
.map(|triangle| {
triangle.map(|index| {
index.try_into().expect(

View File

@ -9,8 +9,8 @@ impl Mesh {
&self.vertices
}
pub fn triangles(&self) -> &[Triangle] {
&self.triangles
pub fn triangles(&self) -> impl Iterator<Item = Triangle> + '_ {
self.triangles.iter().copied()
}
pub fn push_vertex(&mut self, vertex: Vertex) {

View File

@ -271,7 +271,7 @@ impl Renderer {
render_pass.set_pipeline(&self.pipeline);
render_pass.set_bind_group(0, &self.bind_group, &[]);
render_pass.draw_indexed(
0..mesh.triangles().len() as u32 * 3,
0..mesh.triangles().count() as u32 * 3,
0,
0..1,
);