feat: upgrade hexagon_launcher with thinner outlines and better colors

This commit is contained in:
Nova
2023-11-16 08:42:59 -05:00
parent 6e322aaf1d
commit e6d51a36a8
16 changed files with 367 additions and 306 deletions

View File

@@ -7,6 +7,7 @@ edition = "2021"
tokio = { version = "1.32.0", features = ["rt", "tokio-macros", "sync"] }
protostar = { path = "../protostar" }
color-eyre = "0.6.2"
color-rs = "0.8.0"
clap = "4.4.6"
manifest-dir-macros = "0.1.18"
glam = "0.24.2"

View File

@@ -1,4 +1,5 @@
use clap::{self, Parser};
use color::rgba_linear;
use color_eyre::eyre::Result;
use glam::{Quat, Vec3};
use manifest_dir_macros::directory_relative_path;
@@ -164,36 +165,40 @@ impl RootHandler for Sirius {
}
}
}
let color = [0.0, 1.0, 0.0, 1.0];
self.model
.model_part("?????")
.unwrap()
.set_material_parameter("color", MaterialParameter::Color(color))
.set_material_parameter(
"color",
MaterialParameter::Color(rgba_linear!(0.0, 1.0, 0.0, 1.0)),
)
.unwrap();
self.model
.model_part("?????")
.unwrap()
.set_material_parameter(
"emission_factor",
MaterialParameter::Color(color.map(|c| c * 0.75)),
MaterialParameter::Color(rgba_linear!(0.0, 0.75, 0.0, 0.75)),
)
.unwrap();
}
if self.touch_plane.touch_stopped() {
println!("Touch ended");
let color = [1.0, 0.0, 0.0, 1.0];
self.model
.model_part("?????")
.unwrap()
.set_material_parameter("color", MaterialParameter::Color(color))
.set_material_parameter(
"color",
MaterialParameter::Color(rgba_linear!(1.0, 0.0, 0.0, 1.0)),
)
.unwrap();
self.model
.model_part("?????")
.unwrap()
.set_material_parameter(
"emission_factor",
MaterialParameter::Color(color.map(|c| c * 0.5)),
MaterialParameter::Color(rgba_linear!(0.5, 0.0, 0.0, 0.5)),
)
.unwrap();
}
@@ -217,9 +222,10 @@ fn model_from_icon(parent: &Spatial, icon: &Icon) -> Result<Model> {
t,
&ResourceID::new_namespaced("protostar", "hexagon/hexagon"),
)?;
model
.model_part("Hex")?
.set_material_parameter("color", MaterialParameter::Color([0.0, 1.0, 1.0, 1.0]))?;
model.model_part("Hex")?.set_material_parameter(
"color",
MaterialParameter::Color(rgba_linear!(0.0, 1.0, 1.0, 1.0)),
)?;
model.model_part("Icon")?.set_material_parameter(
"diffuse",
MaterialParameter::Texture(ResourceID::Direct(icon.path.clone())),
@@ -402,12 +408,15 @@ impl App {
.unwrap();
self.grabbable_grow = None;
}
} else if self.grabbable.valid() && self.grabbable.grab_action().actor_stopped() {
} else if self.grabbable.grab_action().actor_stopped() {
self.grabbable_shrink = Some(Tweener::quart_in_out(APP_SIZE * 0.5, 0.0001, 0.25));
let Ok(distance_future) = self.grabbable
let Ok(distance_future) = self
.grabbable
.content_parent()
.get_position_rotation_scale(&self.parent)
else {return};
else {
return;
};
let application = self.application.clone();
let space = self.content_parent().alias();