use bevy::{math::DVec3, prelude::*};
use fmc_protocol_derive::ClientBound;
use serde::{Deserialize, Serialize};
#[derive(ClientBound, Event, Serialize, Deserialize, Debug, Clone)]
pub struct NewModel {
pub model_id: u32,
pub parent_id: Option<u32>,
pub position: DVec3,
pub rotation: Quat,
pub scale: Vec3,
pub asset: u32,
}
#[derive(ClientBound, Event, Serialize, Deserialize, Debug, Clone)]
pub struct SpawnCustomModel {
pub model_id: u32,
pub parent_id: Option<u32>,
pub position: DVec3,
pub rotation: Quat,
pub scale: Vec3,
pub mesh_indices: Vec<u32>,
pub mesh_vertices: Vec<[f32; 3]>,
pub mesh_normals: Vec<[f32; 3]>,
pub mesh_uvs: Option<Vec<[f32; 2]>>,
pub material_color_texture: Option<String>,
pub material_parallax_texture: Option<String>,
pub material_alpha_mode: u8,
pub material_alpha_cutoff: f32,
pub material_double_sided: bool,
}
impl Default for SpawnCustomModel {
fn default() -> Self {
Self {
model_id: 0,
parent_id: None,
position: DVec3::ZERO,
rotation: Quat::IDENTITY,
scale: Vec3::ONE,
mesh_indices: Vec::new(),
mesh_vertices: Vec::new(),
mesh_normals: Vec::new(),
mesh_uvs: None,
material_color_texture: None,
material_parallax_texture: None,
material_alpha_mode: 0,
material_alpha_cutoff: 0.0,
material_double_sided: false,
}
}
}
#[derive(ClientBound, Event, Serialize, Deserialize, Debug, Clone)]
pub struct DeleteModel {
pub model_id: u32,
}
#[derive(ClientBound, Event, Serialize, Deserialize, Debug, Clone)]
pub struct ModelUpdateAsset {
pub model_id: u32,
pub asset: u32,
}
#[derive(ClientBound, Event, Serialize, Deserialize, Debug, Clone)]
pub struct ModelUpdateTransform {
pub model_id: u32,
pub position: DVec3,
pub rotation: Quat,
pub scale: Vec3,
}
#[derive(ClientBound, Event, Serialize, Deserialize, Debug, Clone)]
pub struct ModelPlayAnimation {
pub model_id: u32,
pub animation_index: u32,
pub restart: bool,
pub repeat: bool,
pub transition: Option<(u32, f32)>,
}
#[derive(ClientBound, Event, Serialize, Deserialize, Debug, Clone)]
pub struct ModelColor {
pub model_id: u32,
pub color: String,
}