extern crate vecmath;
extern crate xml;
#[macro_use]
extern crate log;
pub use obj::*;
pub use vecmath::Matrix4;
pub mod document;
mod obj;
mod utils;
#[derive(Debug, Clone)]
pub struct Skeleton {
pub joints: Vec<Joint>,
pub bind_poses: Vec<Matrix4<f32>>,
}
#[derive(Debug, Clone)]
pub struct Joint {
pub name: String,
pub parent_index: JointIndex,
pub inverse_bind_pose: Matrix4<f32>,
}
impl Joint {
pub fn is_root(&self) -> bool {
self.parent_index == ROOT_JOINT_PARENT_INDEX
}
}
#[derive(Debug)]
pub struct Animation {
pub target: String,
pub sample_times: Vec<f32>,
pub sample_poses: Vec<Matrix4<f32>>,
}
#[derive(Debug)]
pub struct BindDataSet {
pub bind_data: Vec<BindData>,
}
#[derive(Debug)]
pub struct BindData {
pub object_name: String,
pub skeleton_name: Option<String>,
pub joint_names: Vec<String>,
pub vertex_weights: Vec<VertexWeight>,
pub weights: Vec<f32>,
pub inverse_bind_poses: Vec<Matrix4<f32>>,
}
#[derive(Debug, Copy, Clone)]
pub struct VertexWeight {
pub vertex: VertexIndex,
pub joint: JointIndex,
pub weight: WeightIndex,
}
pub type WeightIndex = usize;
pub type JointIndex = u8;
pub const ROOT_JOINT_PARENT_INDEX: JointIndex = 255u8;