From 34cde7c56948d34ea318fc85aeb781cc62859885 Mon Sep 17 00:00:00 2001 From: Connor Slade Date: Wed, 7 Aug 2024 20:24:14 -0400 Subject: [PATCH] Cleanup / fix clippy lints --- common/src/misc.rs | 1 + mslicer/src/render/pipelines/slice_preview.rs | 4 ++-- mslicer/src/shaders/slice_preview.wgsl | 3 --- slicer/src/builder.rs | 6 ++++++ slicer/src/supports/line.rs | 6 ++---- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/common/src/misc.rs b/common/src/misc.rs index 6ce8f87..b9a05e4 100644 --- a/common/src/misc.rs +++ b/common/src/misc.rs @@ -9,6 +9,7 @@ pub struct SliceResult<'a, Layer> { pub slice_config: &'a SliceConfig, } +#[derive(Debug)] pub struct Run { pub length: u64, pub value: u8, diff --git a/mslicer/src/render/pipelines/slice_preview.rs b/mslicer/src/render/pipelines/slice_preview.rs index 7dca4ae..52a3187 100644 --- a/mslicer/src/render/pipelines/slice_preview.rs +++ b/mslicer/src/render/pipelines/slice_preview.rs @@ -109,13 +109,13 @@ impl SlicePreviewPipeline { }) .collect::>(); let vertex_buffer = device.create_buffer_init(&BufferInitDescriptor { - label: Some("Platform Vertex Buffer"), + label: None, contents: bytemuck::cast_slice(&vert), usage: BufferUsages::VERTEX | BufferUsages::COPY_DST, }); let index_buffer = device.create_buffer_init(&BufferInitDescriptor { - label: Some("Platform Index Buffer"), + label: None, contents: bytemuck::cast_slice(&[0, 1, 2]), usage: BufferUsages::INDEX | BufferUsages::COPY_DST, }); diff --git a/mslicer/src/shaders/slice_preview.wgsl b/mslicer/src/shaders/slice_preview.wgsl index d6d9f07..0bb898d 100644 --- a/mslicer/src/shaders/slice_preview.wgsl +++ b/mslicer/src/shaders/slice_preview.wgsl @@ -10,8 +10,6 @@ struct Context { struct VertexOutput { @builtin(position) position: vec4, - @location(1) - normal: vec3, }; @vertex @@ -21,7 +19,6 @@ fn vert( ) -> VertexOutput { var out: VertexOutput; out.position = position; - out.normal = normal; return out; } diff --git a/slicer/src/builder.rs b/slicer/src/builder.rs index 50777bc..70c87b9 100644 --- a/slicer/src/builder.rs +++ b/slicer/src/builder.rs @@ -106,3 +106,9 @@ impl MeshBuilder { } } } + +impl Default for MeshBuilder { + fn default() -> Self { + Self::new() + } +} diff --git a/slicer/src/supports/line.rs b/slicer/src/supports/line.rs index abe9a7a..b8fb56e 100644 --- a/slicer/src/supports/line.rs +++ b/slicer/src/supports/line.rs @@ -55,11 +55,9 @@ impl<'a> LineSupportGenerator<'a> { let mut out = MeshBuilder::new(); for [origin, _normal] in overhangs { let bottom = origin.xy().to_homogeneous(); - out.add_vertical_cylinder(bottom, origin.z, self.config.support_radius, 10); + out.add_vertical_cylinder(bottom, origin.z, self.config.support_radius, 15); } - out.save_stl("debug.stl").unwrap(); - out.build() } @@ -109,7 +107,7 @@ impl<'a> LineSupportGenerator<'a> { let normals = mesh.normals(); for (face, normal) in normals.iter().enumerate() { - let normal = mesh.transform_normal(&normal); + let normal = mesh.transform_normal(normal); if normal.z >= self.config.max_origin_normal_z { continue; }