Prepare for follow-on change

This commit is contained in:
Hanno Braun 2024-11-05 18:10:05 +01:00
parent 3ac70f4877
commit 2d4b58e07f
3 changed files with 5 additions and 5 deletions

View File

@ -5,8 +5,6 @@ use crate::geometry::{Mesh, Vertex};
pub fn export(mesh: &Mesh) -> anyhow::Result<()> {
let vertices = mesh
.vertices()
.iter()
.copied()
.map(|Vertex { point: [x, y, z] }| threemf::model::Vertex { x, y, z })
.collect();

View File

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

View File

@ -194,7 +194,9 @@ impl Renderer {
for triangle in mesh.triangles() {
let triangle = triangle.map(|index| {
Vec3::from(
mesh.vertices()[index as usize]
mesh.vertices()
.nth(index as usize)
.unwrap()
.point
.map(|coord| coord as f32),
)