mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add pants coloring, chest and pants sliders
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -70,13 +70,13 @@ impl Segment {
|
|||||||
pub fn replace(self, old: Cell, new: Cell) -> Self {
|
pub fn replace(self, old: Cell, new: Cell) -> Self {
|
||||||
self.map(|cell| if cell == old { Some(new) } else { None })
|
self.map(|cell| if cell == old { Some(new) } else { None })
|
||||||
}
|
}
|
||||||
/// Preserve the luminance of all the colors but set the chomaticity to match the provided color
|
// Preserve the luminance of all the colors but set the chomaticity to match the provided color
|
||||||
pub fn chromify(self, chroma: Rgb<u8>) -> Self {
|
/*pub fn chromify(self, chroma: Rgb<u8>) -> Self {
|
||||||
let chroma = chroma.map(|e| e as f32 / 255.0);
|
let chroma = chroma.map(|e| e as f32 / 255.0);
|
||||||
self.map_rgb(|rgb| {
|
self.map_rgb(|rgb| {
|
||||||
chromify_srgb(rgb.map(|e| e as f32 / 255.0), chroma).map(|e| (e * 255.0) as u8)
|
chromify_srgb(rgb.map(|e| e as f32 / 255.0), chroma).map(|e| (e * 255.0) as u8)
|
||||||
})
|
})
|
||||||
}
|
}*/
|
||||||
// Sets the chromaticity based on the provided color
|
// Sets the chromaticity based on the provided color
|
||||||
// Multiplies luma with luma of the provided color (might not be what we want)
|
// Multiplies luma with luma of the provided color (might not be what we want)
|
||||||
/*pub fn colorify(mut self, color: Rgb<u8>) -> Self {
|
/*pub fn colorify(mut self, color: Rgb<u8>) -> Self {
|
||||||
|
@ -86,10 +86,13 @@ widget_ids! {
|
|||||||
eyebrows_slider,
|
eyebrows_slider,
|
||||||
eyebrows_text,
|
eyebrows_text,
|
||||||
beard_slider,
|
beard_slider,
|
||||||
beard_slider_2,
|
|
||||||
beard_text,
|
beard_text,
|
||||||
accessories_slider,
|
accessories_slider,
|
||||||
accessories_text,
|
accessories_text,
|
||||||
|
chest_slider,
|
||||||
|
chest_text,
|
||||||
|
pants_slider,
|
||||||
|
pants_text,
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
enter_world_button,
|
enter_world_button,
|
||||||
@ -132,8 +135,6 @@ widget_ids! {
|
|||||||
undead,
|
undead,
|
||||||
elf,
|
elf,
|
||||||
danari,
|
danari,
|
||||||
// Body Features
|
|
||||||
chest_slider,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -974,7 +975,7 @@ impl CharSelectionUi {
|
|||||||
.font_id(self.fonts.metamorph)
|
.font_id(self.fonts.metamorph)
|
||||||
.color(TEXT_COLOR_2)
|
.color(TEXT_COLOR_2)
|
||||||
.set(self.ids.beard_text, ui_widgets);
|
.set(self.ids.beard_text, ui_widgets);
|
||||||
ImageSlider::continuous(5.0, 0.0, 10.0, self.imgs.nothing, self.imgs.slider_range)
|
ImageSlider::discrete(5, 0, 10, self.imgs.nothing, self.imgs.slider_range)
|
||||||
.w_h(208.0, 22.0)
|
.w_h(208.0, 22.0)
|
||||||
.mid_bottom_with_margin_on(self.ids.beard_text, -30.0)
|
.mid_bottom_with_margin_on(self.ids.beard_text, -30.0)
|
||||||
.track_breadth(12.0)
|
.track_breadth(12.0)
|
||||||
@ -982,7 +983,39 @@ impl CharSelectionUi {
|
|||||||
.track_color(Color::Rgba(1.0, 1.0, 1.0, 0.2))
|
.track_color(Color::Rgba(1.0, 1.0, 1.0, 0.2))
|
||||||
.slider_color(Color::Rgba(1.0, 1.0, 1.0, 0.2))
|
.slider_color(Color::Rgba(1.0, 1.0, 1.0, 0.2))
|
||||||
.pad_track((5.0, 5.0))
|
.pad_track((5.0, 5.0))
|
||||||
.set(self.ids.beard_slider_2, ui_widgets);
|
.set(self.ids.beard_slider, ui_widgets);
|
||||||
|
}
|
||||||
|
// Chest
|
||||||
|
let current_chest = self.character_body.chest;
|
||||||
|
if let Some(new_val) = char_slider(
|
||||||
|
self.ids.beard_slider,
|
||||||
|
"Chest",
|
||||||
|
self.ids.chest_text,
|
||||||
|
humanoid::ALL_CHESTS.len() - 1,
|
||||||
|
humanoid::ALL_CHESTS
|
||||||
|
.iter()
|
||||||
|
.position(|&c| c == current_chest)
|
||||||
|
.unwrap_or(0),
|
||||||
|
self.ids.chest_slider,
|
||||||
|
ui_widgets,
|
||||||
|
) {
|
||||||
|
self.character_body.chest = humanoid::ALL_CHESTS[new_val];
|
||||||
|
}
|
||||||
|
// Pants
|
||||||
|
let current_pants = self.character_body.pants;
|
||||||
|
if let Some(new_val) = char_slider(
|
||||||
|
self.ids.chest_slider,
|
||||||
|
"Pants",
|
||||||
|
self.ids.pants_text,
|
||||||
|
humanoid::ALL_PANTS.len() - 1,
|
||||||
|
humanoid::ALL_PANTS
|
||||||
|
.iter()
|
||||||
|
.position(|&c| c == current_pants)
|
||||||
|
.unwrap_or(0),
|
||||||
|
self.ids.pants_slider,
|
||||||
|
ui_widgets,
|
||||||
|
) {
|
||||||
|
self.character_body.pants = humanoid::ALL_PANTS[new_val];
|
||||||
}
|
}
|
||||||
} // Char Creation fin
|
} // Char Creation fin
|
||||||
|
|
||||||
|
@ -237,18 +237,21 @@ impl HumHeadSpec {
|
|||||||
|
|
||||||
pub fn mesh_chest(chest: Chest) -> Mesh<FigurePipeline> {
|
pub fn mesh_chest(chest: Chest) -> Mesh<FigurePipeline> {
|
||||||
let color = match chest {
|
let color = match chest {
|
||||||
Chest::Brown => (125, 53, 0),
|
Chest::Blue => (28, 66, 109),
|
||||||
Chest::Dark => (0, 38, 43),
|
Chest::Brown => (54, 30, 26),
|
||||||
Chest::Green => (0, 255, 34),
|
Chest::Dark => (24, 19, 17),
|
||||||
Chest::Orange => (255, 106, 0),
|
Chest::Green => (49, 95, 59),
|
||||||
Chest::Blue => (0, 38, 255),
|
Chest::Orange => (148, 52, 33),
|
||||||
};
|
};
|
||||||
|
|
||||||
let bare_chest = load_segment("figure.body.chest");
|
let bare_chest = graceful_load_segment("figure.body.chest");
|
||||||
let chest_armor = load_segment("armor.chest.generic");
|
let chest_armor = graceful_load_segment("armor.chest.grayscale");
|
||||||
let chest = DynaUnionizer::new()
|
let chest = DynaUnionizer::new()
|
||||||
.add(bare_chest, Vec3::new(0, 0, 0))
|
.add(bare_chest, Vec3::new(0, 0, 0))
|
||||||
.add(chest_armor.chromify(Rgb::from(color)), Vec3::new(0, 0, 0))
|
.add(
|
||||||
|
recolor_greys(chest_armor, Rgb::from(color)),
|
||||||
|
Vec3::new(0, 0, 0),
|
||||||
|
)
|
||||||
.unify()
|
.unify()
|
||||||
.0;
|
.0;
|
||||||
|
|
||||||
@ -266,16 +269,24 @@ pub fn mesh_belt(belt: Belt) -> Mesh<FigurePipeline> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn mesh_pants(pants: Pants) -> Mesh<FigurePipeline> {
|
pub fn mesh_pants(pants: Pants) -> Mesh<FigurePipeline> {
|
||||||
load_mesh(
|
let color = match pants {
|
||||||
match pants {
|
Pants::Blue => (28, 66, 109),
|
||||||
Pants::Blue => "armor.pants.pants_blue",
|
Pants::Brown => (54, 30, 26),
|
||||||
Pants::Brown => "armor.pants.pants_brown",
|
Pants::Dark => (24, 19, 17),
|
||||||
Pants::Dark => "armor.pants.pants_dark",
|
Pants::Green => (49, 95, 59),
|
||||||
Pants::Green => "armor.pants.pants_green",
|
Pants::Orange => (148, 52, 33),
|
||||||
Pants::Orange => "armor.pants.pants_orange",
|
};
|
||||||
},
|
|
||||||
|
let pants_segment = recolor_greys(
|
||||||
|
graceful_load_segment("armor.pants.grayscale"),
|
||||||
|
Rgb::from(color),
|
||||||
|
);
|
||||||
|
|
||||||
|
Meshable::<FigurePipeline, FigurePipeline>::generate_mesh(
|
||||||
|
&pants_segment,
|
||||||
Vec3::new(-5.0, -3.5, 0.0),
|
Vec3::new(-5.0, -3.5, 0.0),
|
||||||
)
|
)
|
||||||
|
.0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mesh_left_hand(hand: Hand) -> Mesh<FigurePipeline> {
|
pub fn mesh_left_hand(hand: Hand) -> Mesh<FigurePipeline> {
|
||||||
|
Reference in New Issue
Block a user