use std::{collections::BTreeSet, path::PathBuf};
use glam::{Mat4, Vec3};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use crate::skeleton::{JointName, Skeleton};
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
pub struct JointWeight {
pub indices: [u8; 4],
pub weights: [f32; 4],
pub joint_name: [JointName; 4],
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct RenderObject {
pub name: String,
pub id: Uuid,
pub vertices: Vec<Vec3>,
pub indices: Vec<u16>,
pub skin: Option<SkinData>,
pub texture: Option<PathBuf>,
pub uv: Option<Vec<[f32; 2]>>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct SkinData {
pub skeleton: Skeleton,
pub weights: Vec<JointWeight>,
pub joint_names: Vec<JointName>,
pub inverse_bind_matrices: Vec<Mat4>,
}
#[derive(Debug, Default, Clone, Serialize, Deserialize)]
pub struct AvatarObject {
pub objects: Vec<PathBuf>,
pub global_skeleton: Skeleton,
pub used_joints: BTreeSet<JointName>,
}