Add pants coloring, chest and pants sliders

This commit is contained in:
Imbris 2019-08-30 22:41:46 -04:00
parent 0ffc534df2
commit 074eee06e6
11 changed files with 74 additions and 42 deletions

Binary file not shown.

BIN
assets/voxygen/voxel/armor/chest/grayscale.vox (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/voxel/armor/pants/grayscale.vox (Stored with Git LFS) Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -70,13 +70,13 @@ impl Segment {
pub fn replace(self, old: Cell, new: Cell) -> Self {
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
pub fn chromify(self, chroma: Rgb<u8>) -> Self {
// Preserve the luminance of all the colors but set the chomaticity to match the provided color
/*pub fn chromify(self, chroma: Rgb<u8>) -> Self {
let chroma = chroma.map(|e| e as f32 / 255.0);
self.map_rgb(|rgb| {
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
// Multiplies luma with luma of the provided color (might not be what we want)
/*pub fn colorify(mut self, color: Rgb<u8>) -> Self {

View File

@ -86,10 +86,13 @@ widget_ids! {
eyebrows_slider,
eyebrows_text,
beard_slider,
beard_slider_2,
beard_text,
accessories_slider,
accessories_text,
chest_slider,
chest_text,
pants_slider,
pants_text,
// Buttons
enter_world_button,
@ -132,8 +135,6 @@ widget_ids! {
undead,
elf,
danari,
// Body Features
chest_slider,
}
}
@ -974,7 +975,7 @@ impl CharSelectionUi {
.font_id(self.fonts.metamorph)
.color(TEXT_COLOR_2)
.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)
.mid_bottom_with_margin_on(self.ids.beard_text, -30.0)
.track_breadth(12.0)
@ -982,7 +983,39 @@ impl CharSelectionUi {
.track_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))
.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

View File

@ -237,18 +237,21 @@ impl HumHeadSpec {
pub fn mesh_chest(chest: Chest) -> Mesh<FigurePipeline> {
let color = match chest {
Chest::Brown => (125, 53, 0),
Chest::Dark => (0, 38, 43),
Chest::Green => (0, 255, 34),
Chest::Orange => (255, 106, 0),
Chest::Blue => (0, 38, 255),
Chest::Blue => (28, 66, 109),
Chest::Brown => (54, 30, 26),
Chest::Dark => (24, 19, 17),
Chest::Green => (49, 95, 59),
Chest::Orange => (148, 52, 33),
};
let bare_chest = load_segment("figure.body.chest");
let chest_armor = load_segment("armor.chest.generic");
let bare_chest = graceful_load_segment("figure.body.chest");
let chest_armor = graceful_load_segment("armor.chest.grayscale");
let chest = DynaUnionizer::new()
.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()
.0;
@ -266,16 +269,24 @@ pub fn mesh_belt(belt: Belt) -> Mesh<FigurePipeline> {
}
pub fn mesh_pants(pants: Pants) -> Mesh<FigurePipeline> {
load_mesh(
match pants {
Pants::Blue => "armor.pants.pants_blue",
Pants::Brown => "armor.pants.pants_brown",
Pants::Dark => "armor.pants.pants_dark",
Pants::Green => "armor.pants.pants_green",
Pants::Orange => "armor.pants.pants_orange",
},
let color = match pants {
Pants::Blue => (28, 66, 109),
Pants::Brown => (54, 30, 26),
Pants::Dark => (24, 19, 17),
Pants::Green => (49, 95, 59),
Pants::Orange => (148, 52, 33),
};
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),
)
.0
}
pub fn mesh_left_hand(hand: Hand) -> Mesh<FigurePipeline> {