Skip to content

Commit

Permalink
remove deprecated put_together_some_attrs calls
Browse files Browse the repository at this point in the history
  • Loading branch information
MattFerraro committed Jun 3, 2024
1 parent 3919a90 commit dfb3a69
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/cadmium/src/solid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ use truck_polymesh::Point3 as TruckPoint3;
use truck_polymesh::Vector3 as TruckVector3;
use truck_topology::Solid as TruckSolid;

const MESH_TOLERANCE: f64 = 0.1;

#[derive(Tsify, Debug, Serialize, Deserialize, Clone)]
#[tsify(into_wasm_abi, from_wasm_abi)]
pub struct Solid {
Expand Down Expand Up @@ -64,8 +62,7 @@ impl Solid {
indices: vec![],
truck_solid,
};
let mut mesh = solid.truck_solid.triangulation(MESH_TOLERANCE).to_polygon();
mesh.put_together_same_attrs(0.1);
let mesh = solid.truck_solid.triangulation(0.01).to_polygon();

// the mesh is prepared for obj export, but we need to convert it
// to a format compatible for rendering
Expand Down Expand Up @@ -295,17 +292,15 @@ impl Solid {
}

pub fn to_obj_string(&self, tolerance: f64) -> String {
let mut mesh = self.truck_solid.triangulation(tolerance).to_polygon();
mesh.put_together_same_attrs(0.1);
let mesh = self.truck_solid.triangulation(tolerance).to_polygon();
let mut buf = Vec::new();
obj::write(&mesh, &mut buf).unwrap();
let string = String::from_utf8(buf).unwrap();
string
}

pub fn save_as_obj(&self, filename: &str, tolerance: f64) {
let mut mesh = self.truck_solid.triangulation(tolerance).to_polygon();
mesh.put_together_same_attrs(0.1);
let mesh = self.truck_solid.triangulation(tolerance).to_polygon();
let file = std::fs::File::create(filename).unwrap();
obj::write(&mesh, file).unwrap();
}
Expand Down

0 comments on commit dfb3a69

Please sign in to comment.