Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade wavefront_rs to 2.0.0-beta.1 #1773

Merged
merged 1 commit into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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