Skip to content

Commit

Permalink
Merge pull request #1773 from dzvon/upgrade-wavefront
Browse files Browse the repository at this point in the history
Upgrade wavefront_rs to 2.0.0-beta.1
  • Loading branch information
hannobraun authored Apr 19, 2023
2 parents 92f0617 + 5af2461 commit 2108a91
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/fj-export/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ fj-math.workspace = true
thiserror = "1.0.40"
threemf = "0.4.0"
stl = "0.2.1"
wavefront_rs = "=2.0.0-alpha.1"
wavefront_rs = "=2.0.0-beta.1"
70 changes: 35 additions & 35 deletions crates/fj-export/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#![warn(missing_docs)]

use std::{fs::File, io::Write, path::Path};
use std::{fs::File, path::Path};

use thiserror::Error;

Expand Down Expand Up @@ -128,44 +128,44 @@ fn export_obj(mesh: &Mesh<Point<3>>, path: &Path) -> Result<(), Error> {
for (cnt, t) in mesh.triangles().enumerate() {
// write each point of the triangle
for v in t.inner.points() {
wavefront_rs::obj::writer::Writer::write(
wavefront_rs::obj::writer::Writer { auto_newline: true }
.write(
&mut f,
&wavefront_rs::obj::entity::Entity::Vertex {
x: v.x.into_f64(),
y: v.y.into_f64(),
z: v.z.into_f64(),
w: None,
},
)
.or(Err(Error::OBJ))?;
}

// write the triangle
wavefront_rs::obj::writer::Writer { auto_newline: true }
.write(
&mut f,
&wavefront_rs::obj::entity::Entity::Vertex {
x: v.x.into_f64(),
y: v.y.into_f64(),
z: v.z.into_f64(),
w: None,
&wavefront_rs::obj::entity::Entity::Face {
vertices: vec![
wavefront_rs::obj::entity::FaceVertex {
vertex: (cnt * 3 + 1) as i64,
texture: None,
normal: None,
},
wavefront_rs::obj::entity::FaceVertex {
vertex: (cnt * 3 + 2) as i64,
texture: None,
normal: None,
},
wavefront_rs::obj::entity::FaceVertex {
vertex: (cnt * 3 + 3) as i64,
texture: None,
normal: None,
},
],
},
)
.or(Err(Error::OBJ))?;
f.write_all(b"\n")?;
}

// write the triangle
wavefront_rs::obj::writer::Writer::write(
&mut f,
&wavefront_rs::obj::entity::Entity::Face {
vertices: vec![
wavefront_rs::obj::entity::FaceVertex {
vertex: (cnt * 3 + 1) as i64,
texture: None,
normal: None,
},
wavefront_rs::obj::entity::FaceVertex {
vertex: (cnt * 3 + 2) as i64,
texture: None,
normal: None,
},
wavefront_rs::obj::entity::FaceVertex {
vertex: (cnt * 3 + 3) as i64,
texture: None,
normal: None,
},
],
},
)
.or(Err(Error::OBJ))?;
f.write_all(b"\n")?;
}

Ok(())
Expand Down

0 comments on commit 2108a91

Please sign in to comment.