From 85d55e42119ea80cd1cd9e9e34c05ea7d07b3a88 Mon Sep 17 00:00:00 2001 From: Lizzy Fleckenstein Date: Tue, 28 Feb 2023 18:08:41 +0100 Subject: Use cgmath and support BS constant --- src/to_clt/obj.rs | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) (limited to 'src/to_clt/obj.rs') diff --git a/src/to_clt/obj.rs b/src/to_clt/obj.rs index 1b605cc..7ce9f32 100644 --- a/src/to_clt/obj.rs +++ b/src/to_clt/obj.rs @@ -16,33 +16,33 @@ pub struct ObjProps { pub max_hp: u16, // player only pub collide_with_nodes: bool, pub weight: f32, // deprecated - pub collision_box: RangeInclusive<[f32; 3]>, - pub selection_box: RangeInclusive<[f32; 3]>, + pub collision_box: Aabb3, + pub selection_box: Aabb3, pub pointable: bool, pub visual: ObjVisual, - pub visual_size: [f32; 3], + pub visual_size: Vector3, pub textures: Vec, - pub sprite_sheet_size: [i16; 2], // in sprites - pub sprite_pos: [i16; 2], // in sprite sheet + pub sprite_sheet_size: Vector2, // in sprites + pub sprite_pos: Point2, // in sprite sheet pub visible: bool, pub make_footstep_sounds: bool, - pub rotate_speed: f32, // in radians per second + pub rotate_speed: Rad, // per second pub mesh: String, pub colors: Vec, pub collide_with_objs: bool, pub step_height: f32, pub face_rotate_dir: bool, - pub face_rotate_dir_off: f32, // in degrees + pub face_rotate_dir_off: Deg, pub backface_cull: bool, pub nametag: String, pub nametag_color: Color, - pub face_rotate_speed: f32, // in degrees per second + pub face_rotate_speed: Deg, // per second pub infotext: String, pub itemstring: String, pub glow: i8, - pub max_breath: u16, // player only - pub eye_height: f32, // player only - pub zoom_fov: f32, // in degrees. player only + pub max_breath: u16, // player only + pub eye_height: f32, // player only + pub zoom_fov: Deg, // player only pub use_texture_alpha: bool, pub dmg_texture_mod: String, // suffix pub shaded: bool, @@ -52,10 +52,13 @@ pub struct ObjProps { #[mt_derive(to = "clt")] pub struct ObjPos { - pub pos: [f32; 3], - pub vel: [f32; 3], - pub acc: [f32; 3], - pub rot: [f32; 3], + #[mt(multiplier = "BS")] + pub pos: Point3, + #[mt(multiplier = "BS")] + pub vel: Vector3, + #[mt(multiplier = "BS")] + pub acc: Vector3, + pub rot: Euler>, pub interpolate: bool, pub end: bool, pub update_interval: f32, @@ -63,7 +66,7 @@ pub struct ObjPos { #[mt_derive(to = "clt")] pub struct ObjSprite { - pub frame0: [i16; 2], + pub frame_0: Point2, pub frames: u16, pub frame_duration: f32, pub view_angle_frames: bool, @@ -71,7 +74,7 @@ pub struct ObjSprite { #[mt_derive(to = "clt")] pub struct ObjAnim { - pub frames: [i32; 2], + pub frames: Vector2, pub speed: f32, pub blend: f32, pub no_loop: bool, @@ -79,16 +82,16 @@ pub struct ObjAnim { #[mt_derive(to = "clt")] pub struct ObjBonePos { - pub pos: [f32; 3], - pub rot: [f32; 3], + pub pos: Point3, + pub rot: Euler>, } #[mt_derive(to = "clt")] pub struct ObjAttach { pub parent_id: u16, pub bone: String, - pub pos: [f32; 3], - pub rot: [f32; 3], + pub pos: Point3, + pub rot: Euler>, pub force_visible: bool, } @@ -152,8 +155,9 @@ pub struct ObjInitData { pub name: String, pub is_player: bool, pub id: u16, - pub pos: [f32; 3], - pub rot: [f32; 3], + #[mt(multiplier = "BS")] + pub pos: Point3, + pub rot: Euler>, pub hp: u16, #[mt(len = "u8")] pub msgs: Vec, -- cgit v1.2.3