use crate::Pose;
#[derive(Clone, Debug, Default)]
pub struct Body {
pub name: Option<String>,
pub pose: Pose,
pub mocap: bool,
pub gravcomp: f64,
pub sleep: bool,
pub childclass: Option<String>,
pub class: Option<String>,
pub user: Vec<f64>,
pub inertial: Option<Inertial>,
pub joints: Vec<Joint>,
pub geoms: Vec<Geom>,
pub sites: Vec<Site>,
}
#[derive(Clone, Debug, Default)]
pub struct Inertial {
pub pose: Pose,
pub mass: f64,
pub inertia: InertiaSpec,
}
#[derive(Clone, Debug)]
pub enum InertiaSpec {
Diagonal([f64; 3]),
Full([f64; 6]),
}
impl Default for InertiaSpec {
fn default() -> Self {
InertiaSpec::Diagonal([0.0, 0.0, 0.0])
}
}
#[derive(Clone, Debug, Default)]
pub struct Joint {
pub name: Option<String>,
pub class: Option<String>,
pub type_: JointType,
pub pos: [f64; 3],
pub axis: [f64; 3],
pub limited: crate::types::Tristate,
pub range: Option<[f64; 2]>,
pub stiffness: f64,
pub damping: f64,
pub springref: f64,
pub springdamper: Option<[f64; 2]>,
pub armature: f64,
pub frictionloss: f64,
pub ref_: f64,
pub margin: f64,
pub user: Vec<f64>,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
pub enum JointType {
#[default]
Hinge,
Slide,
Ball,
Free,
}
#[derive(Clone, Debug, Default)]
pub struct Geom {
pub name: Option<String>,
pub class: Option<String>,
pub type_: GeomType,
pub size: [f64; 3],
pub pose: Pose,
pub fromto: Option<[f64; 6]>,
pub friction: [f64; 3],
pub mass: Option<f64>,
pub density: Option<f64>,
pub margin: f64,
pub contype: u32,
pub conaffinity: u32,
pub condim: u32,
pub group: i32,
pub priority: i32,
pub mesh: Option<String>,
pub hfield: Option<String>,
pub material: Option<String>,
pub rgba: Option<[f64; 4]>,
pub user: Vec<f64>,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
pub enum GeomType {
Plane,
Hfield,
#[default]
Sphere,
Capsule,
Ellipsoid,
Cylinder,
Box,
Mesh,
Sdf,
}
#[derive(Clone, Debug, Default)]
pub struct Site {
pub name: Option<String>,
pub class: Option<String>,
pub pose: Pose,
pub size: [f64; 3],
pub rgba: Option<[f64; 4]>,
pub material: Option<String>,
pub type_: SiteType,
pub user: Vec<f64>,
}
#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)]
pub enum SiteType {
#[default]
Sphere,
Capsule,
Ellipsoid,
Cylinder,
Box,
}