Rework to split layer generation and triangle rendering.
This commit is contained in:
1 parent
fa7b9345fe
commit
860ac88b61
6 files changed
+304
-86
No files matched your search
+26
-2
@@ -1,14 +1,38 @@
|
||||
use serde_derive::Serialize;
|
||||
|
||||
#[derive(clap::ValueEnum, Clone, Default, Debug, Serialize, PartialEq)]
|
||||
pub enum CapStyle {
|
||||
#[default]
|
||||
Cylinder,
|
||||
Dome,
|
||||
Pointed,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub struct Mushroom {
|
||||
/// Stalk height in millimeters. Zero for default.
|
||||
pub stalk_h: f32,
|
||||
|
||||
/// Stalk diameter in millimeters. Zero for default.
|
||||
pub stalk_d: f32,
|
||||
pub stalk_r: f32,
|
||||
|
||||
/// Cap height in millimeters. Zero for default.
|
||||
pub cap_h: f32,
|
||||
|
||||
/// Stalk diameter in millimeters. Zero for default.
|
||||
pub cap_d: f32,
|
||||
pub cap_r: f32,
|
||||
|
||||
pub cap_style: CapStyle,
|
||||
}
|
||||
|
||||
impl Mushroom {
|
||||
/// Total height of the mushroom.
|
||||
pub fn height(&self) -> f32 {
|
||||
return self.stalk_h + self.cap_h;
|
||||
}
|
||||
|
||||
/// Maximum radius of the mushroom.
|
||||
pub fn radius(&self) -> f32 {
|
||||
return self.stalk_r.max(self.cap_r) / 2.0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user