use nalgebra_glm::{Vec2, Vec3};
#[derive(Default, Debug, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum ClothPinning {
#[default]
TopRow,
TopCorners,
None,
}
#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Cloth {
pub columns: u32,
pub rows: u32,
pub width: f32,
pub height: f32,
pub pinning: ClothPinning,
pub stiffness: f32,
pub damping: f32,
pub substeps: u32,
pub solver_iterations: u32,
pub gravity: Vec3,
pub wind_response: f32,
pub ground_height: Option<f32>,
pub texture_tiling: Vec2,
pub reset_epoch: u32,
}
impl Default for Cloth {
fn default() -> Self {
Self {
columns: 96,
rows: 64,
width: 3.0,
height: 2.0,
pinning: ClothPinning::TopRow,
stiffness: 0.85,
damping: 0.996,
substeps: 4,
solver_iterations: 8,
gravity: Vec3::new(0.0, -9.81, 0.0),
wind_response: 1.0,
ground_height: Some(0.0),
texture_tiling: Vec2::new(1.0, 1.0),
reset_epoch: 0,
}
}
}