mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix sliders, remove uneeded method, fix aspect ratio in character creation
This commit is contained in:
parent
7bebffb2af
commit
fd251c4d3a
BIN
assets/voxygen/voxel/figure/beard/human/1.vox
(Stored with Git LFS)
BIN
assets/voxygen/voxel/figure/beard/human/1.vox
(Stored with Git LFS)
Binary file not shown.
@ -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,
|
||||
|
@ -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<i32>) -> 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() {
|
||||
|
@ -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?
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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());
|
||||
|
@ -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)
|
||||
|
@ -199,7 +199,11 @@ pub fn mesh_chest(chest: Chest) -> Mesh<FigurePipeline> {
|
||||
|
||||
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::<FigurePipeline, FigurePipeline>::generate_mesh(&chest, Vec3::new(-6.0, -3.5, 0.0)).0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user