use super::*;
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct IkBoneConstraint {
#[get(type(copy))]
pub(crate) max_cone_angle_rad: f32,
#[get(type(copy))]
pub(crate) reference_axis: Vec3,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct IkTwoBoneResult {
#[get(type(copy))]
pub(crate) joint_mid: Vec3,
#[get(type(copy))]
pub(crate) effector: Vec3,
#[get(type(copy))]
pub(crate) upper_rotation: Quat,
#[get(type(copy))]
pub(crate) lower_rotation: Quat,
#[get(type(copy))]
pub(crate) error: f32,
#[get(type(copy))]
pub(crate) reached: bool,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct IkChainResult {
#[get(type(copy))]
pub(crate) iterations: usize,
#[get(type(copy))]
pub(crate) error: f32,
#[get(type(copy))]
pub(crate) reached: bool,
}
#[derive(Clone, Copy, Data, Debug, Default, New, PartialEq)]
pub struct IkSolver3D {
#[get(type(copy))]
pub(crate) default_tolerance: f32,
}
#[derive(Clone, Copy, Debug)]
pub(crate) struct EpaFace3D {
pub(crate) indices: [usize; 3],
pub(crate) normal: Vec3,
pub(crate) distance: f32,
}
#[derive(Clone, Debug, Default)]
pub(crate) struct GjkEpaScratch {
pub(crate) vertices: Vec<Vec3>,
pub(crate) faces: Vec<EpaFace3D>,
pub(crate) loose_edges: Vec<(usize, usize)>,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct GjkEpaContact3D {
#[get(type(copy))]
pub(crate) normal: Vec3,
#[get(type(copy))]
pub(crate) depth: f32,
}
#[derive(Clone, Data, Debug, Default)]
pub struct GjkEpaSolver3D {
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) scratch: GjkEpaScratch,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct VerletParticle3D {
#[get(type(copy))]
pub(crate) position: Vec3,
#[get(type(copy))]
pub(crate) prev_position: Vec3,
#[get(type(copy))]
pub(crate) inv_mass: f32,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct VerletDistanceConstraint {
#[get(type(copy))]
pub(crate) index_a: usize,
#[get(type(copy))]
pub(crate) index_b: usize,
#[get(type(copy))]
pub(crate) rest_length: f32,
#[get(type(copy))]
pub(crate) stiffness: f32,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct VerletSphereCollider {
#[get(type(copy))]
pub(crate) center: Vec3,
#[get(type(copy))]
pub(crate) radius: f32,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct VerletPlaneCollider {
#[get(type(copy))]
pub(crate) normal: Vec3,
#[get(type(copy))]
pub(crate) offset: f32,
}
#[derive(Clone, Data, Debug)]
pub struct VerletClothSolver {
#[get(type(copy))]
pub(crate) cols: usize,
#[get(type(copy))]
pub(crate) rows: usize,
#[get(type(copy))]
pub(crate) gravity: Vec3,
#[get(type(copy))]
pub(crate) wind: Vec3,
#[get(type(copy))]
pub(crate) damping: f32,
#[get(type(copy))]
pub(crate) solver_iterations: usize,
pub(crate) particles: Vec<VerletParticle3D>,
pub(crate) constraints: Vec<VerletDistanceConstraint>,
pub(crate) sphere_colliders: Vec<VerletSphereCollider>,
pub(crate) plane_colliders: Vec<VerletPlaneCollider>,
}
#[derive(Clone, Data, Debug)]
pub struct VerletRopeSolver {
#[get(type(copy))]
pub(crate) gravity: Vec3,
#[get(type(copy))]
pub(crate) wind: Vec3,
#[get(type(copy))]
pub(crate) damping: f32,
#[get(type(copy))]
pub(crate) solver_iterations: usize,
pub(crate) particles: Vec<VerletParticle3D>,
pub(crate) constraints: Vec<VerletDistanceConstraint>,
pub(crate) sphere_colliders: Vec<VerletSphereCollider>,
pub(crate) plane_colliders: Vec<VerletPlaneCollider>,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct CameraSplinePoint {
#[get(type(copy))]
pub(crate) position: Vec3,
#[get(type(copy))]
pub(crate) look_target: Vec3,
#[get(type(copy))]
pub(crate) fov_deg: f32,
}
#[derive(Clone, Copy, Data, Debug, PartialEq)]
pub struct CameraRigConfig {
#[get(type(copy))]
pub(crate) mode: CameraRigMode,
#[get(type(copy))]
pub(crate) arm_length: f32,
#[get(type(copy))]
pub(crate) arm_min_length: f32,
#[get(type(copy))]
pub(crate) pivot_offset: Vec3,
#[get(type(copy))]
pub(crate) position_stiffness: f32,
#[get(type(copy))]
pub(crate) rotation_stiffness: f32,
#[get(type(copy))]
pub(crate) min_pitch: f32,
#[get(type(copy))]
pub(crate) max_pitch: f32,
#[get(type(copy))]
pub(crate) eye_height: f32,
#[get(type(copy))]
pub(crate) fov_deg: f32,
#[get(type(copy))]
pub(crate) near: f32,
#[get(type(copy))]
pub(crate) far: f32,
#[get(type(copy))]
pub(crate) trauma_decay: f32,
#[get(type(copy))]
pub(crate) shake_max_offset: f32,
#[get(type(copy))]
pub(crate) shake_max_angle_rad: f32,
#[get(type(copy))]
pub(crate) shake_frequency: f32,
#[get(type(copy))]
pub(crate) spline_loop: bool,
}
#[derive(Clone, Copy, Data, Debug, New, PartialEq)]
pub struct CameraRigState {
#[get(type(copy))]
pub(crate) position: Vec3,
#[get(type(copy))]
pub(crate) target: Vec3,
#[get(type(copy))]
pub(crate) rotation: Quat,
#[get(type(copy))]
pub(crate) yaw: f32,
#[get(type(copy))]
pub(crate) pitch: f32,
#[get(type(copy))]
pub(crate) roll: f32,
#[get(type(copy))]
pub(crate) fov_deg: f32,
}
#[derive(Clone, Data, Debug)]
pub struct CameraRig3D {
#[get(type(copy))]
pub(crate) config: CameraRigConfig,
#[get(type(copy))]
pub(crate) desired_yaw: f32,
#[get(type(copy))]
pub(crate) desired_pitch: f32,
#[get(type(copy))]
pub(crate) smooth_position: Vec3,
#[get(type(copy))]
pub(crate) smooth_target: Vec3,
#[get(type(copy))]
pub(crate) smooth_yaw: f32,
#[get(type(copy))]
pub(crate) smooth_pitch: f32,
#[get(type(copy))]
pub(crate) smooth_fov_deg: f32,
#[get(type(copy))]
pub(crate) current_arm_length: f32,
#[get(type(copy))]
pub(crate) trauma: f32,
#[get(type(copy))]
pub(crate) shake_clock: f32,
#[get(type(copy))]
pub(crate) spline_t: f32,
pub(crate) spline_points: Vec<CameraSplinePoint>,
#[get(pub(crate))]
#[get_mut(pub(crate))]
#[set(pub(crate))]
pub(crate) noise: NoiseField,
#[get(type(copy))]
pub(crate) state: CameraRigState,
}