diff --git a/assets/voxygen/voxel/figure/beard/human/1.vox b/assets/voxygen/voxel/figure/beard/human/1.vox index 8489a322ce..46b25e2a48 100644 --- a/assets/voxygen/voxel/figure/beard/human/1.vox +++ b/assets/voxygen/voxel/figure/beard/human/1.vox @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5e9515f72b4595d7867b47c0f58cbc624eace2f043fc6643a3b30e033ca783dc -size 44944 +oid sha256:a600da27caeb2970182441265c192b291969a86db1e10d761dd0bf926c5740ea +size 44478 diff --git a/assets/voxygen/voxel/humanoid_head_manifest.ron b/assets/voxygen/voxel/humanoid_head_manifest.ron index 3712d46bae..b93c70e6f5 100644 --- a/assets/voxygen/voxel/humanoid_head_manifest.ron +++ b/assets/voxygen/voxel/humanoid_head_manifest.ron @@ -1,16 +1,16 @@ ({ (Human, Male): ( - offset: (-7.0, -5.0, -2.25), + offset: (-7.0, -5.0, -1.25), head: ("figure.head.human.male", (0, 0, 0)), - eyes: ("figure.eyes.human.male", (10, 10, 3)), + eyes: ("figure.eyes.human.male", (3, 7, 2)), hair: { None: None, - Temp1: Some(("figure.hair.human.male", (1, 2, 3))), - Temp2: Some(("figure.hair.human.male", (1, 2, 3))), + Temp1: Some(("figure.hair.human.male", (1, 0, 1))), + Temp2: Some(("figure.hair.human.male", (1, 0, 1))), }, beard: { None: None, - Some: Some(("figure.beard.human.1", (0, 0, -5))), + Some: Some(("figure.beard.human.1", (1, 8, -7))), }, accessory: { Nothing: None, diff --git a/common/src/figure/mod.rs b/common/src/figure/mod.rs index e9a521b2da..5c3d9634f7 100644 --- a/common/src/figure/mod.rs +++ b/common/src/figure/mod.rs @@ -47,35 +47,6 @@ impl From<&DotVoxData> for Segment { } impl Segment { - // TODO: this is currenlty unused, remove? - /// Create a new `Segment` by combining two existing ones - pub fn union(&self, other: &Self, other_offset: Vec3) -> Self { - let size = self.get_size(); - let other_size = other.get_size(); - let new_size = other_offset - .map2(other_size, |oo, os| (oo, os)) - .map2(size, |(oo, os), s| { - (oo + os as i32).max(s as i32) - oo.min(0) - }) - .map(|e| e as u32); - let mut combined = Segment::filled(new_size, Cell::empty(), ()); - // Copy self into combined - let offset = other_offset.map(|e| e.min(0).abs()); - for pos in self.iter_positions() { - if let Cell::Filled(col) = *self.get(pos).unwrap() { - combined.set(pos + offset, Cell::Filled(col)).unwrap(); - } - } - // Copy other into combined - let offset = other_offset.map(|e| e.max(0)); - for pos in other.iter_positions() { - if let Cell::Filled(col) = *other.get(pos).unwrap() { - combined.set(pos + offset, Cell::Filled(col)).unwrap(); - } - } - - combined - } /// Replaces one cell with another pub fn replace(mut self, old: Cell, new: Cell) -> Self { for pos in self.iter_positions() { diff --git a/voxygen/src/menu/char_selection/mod.rs b/voxygen/src/menu/char_selection/mod.rs index 967798c17f..5ddfb528ec 100644 --- a/voxygen/src/menu/char_selection/mod.rs +++ b/voxygen/src/menu/char_selection/mod.rs @@ -45,8 +45,10 @@ impl PlayState for CharSelectionState { Event::Ui(event) => { self.char_selection_ui.handle_event(event); } - // Ignore all other events. - _ => {} + // Pass all other events to the scene + event => { + self.scene.handle_input_event(event); + } // TODO: Do something if the event wasn't handled? } } diff --git a/voxygen/src/menu/char_selection/scene.rs b/voxygen/src/menu/char_selection/scene.rs index fcc2dc2e9b..87bbcdb02d 100644 --- a/voxygen/src/menu/char_selection/scene.rs +++ b/voxygen/src/menu/char_selection/scene.rs @@ -12,6 +12,7 @@ use crate::{ camera::{Camera, CameraMode}, figure::{load_mesh, FigureModelCache, FigureState}, }, + window::Event, }; use client::Client; use common::{ @@ -82,6 +83,21 @@ impl Scene { &self.globals } + /// Handle an incoming user input event (e.g.: cursor moved, key pressed, window closed). + /// + /// If the event is handled, return true. + pub fn handle_input_event(&mut self, event: Event) -> bool { + match event { + // When the window is resized, change the camera's aspect ratio + Event::Resize(dims) => { + self.camera.set_aspect_ratio(dims.x as f32 / dims.y as f32); + true + } + // All other events are unhandled + _ => false, + } + } + pub fn maintain(&mut self, renderer: &mut Renderer, client: &Client, body: humanoid::Body) { self.camera.set_focus_pos(Vec3::unit_z() * 2.0); self.camera.update(client.state().get_time()); diff --git a/voxygen/src/menu/char_selection/ui.rs b/voxygen/src/menu/char_selection/ui.rs index 3e906138b9..a784de0d8f 100644 --- a/voxygen/src/menu/char_selection/ui.rs +++ b/voxygen/src/menu/char_selection/ui.rs @@ -852,7 +852,7 @@ impl CharSelectionUi { ui_widgets: &mut UiCell| { Text::new(text) .down_from(prev_id, 22.0) - .align_middle_x() + .align_middle_x_of(prev_id) .font_size(18) .font_id(metamorph) .color(TEXT_COLOR) diff --git a/voxygen/src/scene/figure/load.rs b/voxygen/src/scene/figure/load.rs index 352091e3fa..a83613e509 100644 --- a/voxygen/src/scene/figure/load.rs +++ b/voxygen/src/scene/figure/load.rs @@ -199,7 +199,11 @@ pub fn mesh_chest(chest: Chest) -> Mesh { let bare_chest = load_segment("figure.body.chest"); let chest_armor = load_segment("armor.chest.generic"); - let chest = bare_chest.union(&chest_armor.chromify(Rgb::from(color)), Vec3::new(0, 0, 0)); + let chest = SegmentUnionizer::new() + .add(bare_chest, Vec3::new(0, 0, 0)) + .add(chest_armor.chromify(Rgb::from(color)), Vec3::new(0, 0, 0)) + .unify() + .0; Meshable::::generate_mesh(&chest, Vec3::new(-6.0, -3.5, 0.0)).0 }