Skip to content

Commit

Permalink
Add Node Filter for Utility Shapes
Browse files Browse the repository at this point in the history
Since they aren't in the pickbuffer at the moment, these can only be selected
by filtering on the outliner. This adds a second way, by allowing you to show
clickable labels from them, without them falling under "unknown", which drives
my framerate down to the single digits most of the time...
  • Loading branch information
Froggy618157725 committed Jul 18, 2024
1 parent f9f0721 commit fc20d81
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 6 additions & 2 deletions crates/alkahest-renderer/src/ecs/tags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use super::Scene;
use crate::{
icons::{
ICON_ACCOUNT_CONVERT, ICON_CHESS_PAWN, ICON_DROPBOX, ICON_HELP, ICON_LIGHTBULB_ON,
ICON_PINE_TREE, ICON_REPLY, ICON_SKULL, ICON_SPHERE, ICON_TAG, ICON_VOLUME_HIGH,
ICON_WEATHER_PARTLY_CLOUDY,
ICON_PINE_TREE, ICON_REPLY, ICON_SKULL, ICON_SPHERE, ICON_TAG, ICON_TOOLBOX,
ICON_VOLUME_HIGH, ICON_WEATHER_PARTLY_CLOUDY,
},
util::color::Color,
};
Expand All @@ -32,6 +32,8 @@ pub enum NodeFilter {
NamedArea,
SlipSurfaceVolume,

Utility,

Unknown,
}

Expand All @@ -50,6 +52,7 @@ impl NodeFilter {
NodeFilter::PlayerContainmentVolume => ICON_DROPBOX,
NodeFilter::NamedArea => ICON_TAG,
NodeFilter::SlipSurfaceVolume => ICON_HELP,
NodeFilter::Utility => ICON_TOOLBOX,
NodeFilter::Unknown => ICON_HELP,
}
}
Expand All @@ -70,6 +73,7 @@ impl NodeFilter {
}
NodeFilter::NamedArea => Color::from_srgba_unmultiplied(0, 127, 0, 255),
NodeFilter::SlipSurfaceVolume => Color::from_srgba_unmultiplied(96, 96, 255, 255),
NodeFilter::Utility => Color::from_srgba_unmultiplied(119, 142, 160, 255),
NodeFilter::Unknown => Color::from_srgba_unmultiplied(255, 255, 255, 255),
}
}
Expand Down
6 changes: 5 additions & 1 deletion crates/alkahest/src/gui/menu/utility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::maplist::MapList;
use alkahest_renderer::camera::Camera;
use alkahest_renderer::ecs::common::{Global, Icon, Label, Mutable};
use alkahest_renderer::ecs::resources::SelectedEntity;
use alkahest_renderer::ecs::tags::{EntityTag, Tags};
use alkahest_renderer::ecs::tags::{EntityTag, NodeFilter, Tags};
use alkahest_renderer::ecs::transform::{Transform, TransformFlags};
use alkahest_renderer::ecs::utility::{Beacon, Route, RouteNode, Ruler, Sphere, Utility};
use alkahest_renderer::ecs::SceneInfo;
Expand Down Expand Up @@ -31,6 +31,7 @@ impl MenuBar {
if let Some(map) = maps.current_map_mut() {
let position_base = camera.position() + camera.forward() * 15.0;
let e = map.scene.spawn((
NodeFilter::Utility,
if pos.is_finite() {
Ruler {
start: camera.position(),
Expand Down Expand Up @@ -68,6 +69,7 @@ impl MenuBar {
let camera = resources.get::<Camera>();
let position_base = camera.position() + camera.forward() * 24.0;
let e = map.scene.spawn((
NodeFilter::Utility,
Transform {
translation: if distance > 24.0 { position_base } else { pos },
scale: Vec3::splat(9.0),
Expand Down Expand Up @@ -99,6 +101,7 @@ impl MenuBar {
if let Some(map) = maps.current_map_mut() {
let camera = resources.get::<Camera>();
let e = map.scene.spawn((
NodeFilter::Utility,
Transform {
translation: if distance > 24.0 {
camera.position()
Expand Down Expand Up @@ -129,6 +132,7 @@ impl MenuBar {

if let Some(map) = maps.current_map_mut() {
let e = map.scene.spawn((
NodeFilter::Utility,
Route {
path: vec![RouteNode {
pos: camera.position(),
Expand Down

0 comments on commit fc20d81

Please sign in to comment.