Compare commits

..

No commits in common. "847c8243070ef573bc92c54b81544c6880b13996" and "fd643f702c5724c92598b000db7280476e639d00" have entirely different histories.

9 changed files with 32 additions and 106 deletions

View file

@ -1,7 +1,3 @@
# v0.14.0-dev
- Add sparkles to Jupiter's ring ✨😍✨ best visible from Farview Station
# v0.13.0 # v0.13.0
- Reduce power usage when the menu is open or the window is unfocused - Reduce power usage when the menu is open or the window is unfocused

2
Cargo.lock generated
View file

@ -3039,7 +3039,7 @@ dependencies = [
[[package]] [[package]]
name = "outfly" name = "outfly"
version = "0.14.0-dev" version = "0.13.0"
dependencies = [ dependencies = [
"bevy", "bevy",
"bevy_embedded_assets", "bevy_embedded_assets",

View file

@ -10,7 +10,7 @@
[package] [package]
name = "outfly" name = "outfly"
version = "0.14.0-dev" version = "0.13.0"
edition = "2021" edition = "2021"
homepage = "https://codeberg.org/outfly/outfly" homepage = "https://codeberg.org/outfly/outfly"
repository = "https://codeberg.org/outfly/outfly" repository = "https://codeberg.org/outfly/outfly"

View file

@ -14,9 +14,9 @@ fn smooth_edge(start: f32, end: f32, value: f32) -> f32 {
return 4 * x * x * (1 - x * x); return 4 * x * x * (1 - x * x);
} }
fn rand(co: vec2<f32>) -> f32 { //fn rand(co: vec2<f32>) -> f32 {
return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453); //return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453);
} //}
//const PHI: f32 = 1.61803398874989484820459; //const PHI: f32 = 1.61803398874989484820459;
//fn gold_noise(xy: vec2<f32>, seed: f32) -> f32 { //fn gold_noise(xy: vec2<f32>, seed: f32) -> f32 {
@ -95,8 +95,8 @@ fn fragment(in: VertexOutput) -> @location(0) vec4<f32> {
//if (sin(in.uv[0] * 1000.0) + cos(in.uv[1] * 10412.0) > 1.999) { //if (sin(in.uv[0] * 1000.0) + cos(in.uv[1] * 10412.0) > 1.999) {
//if (sin(in.uv[0] * 10000.0 + in.uv[1] * 5132.0) + cos(in.uv[0] * 12399.0 + in.uv[1] * 10412.0) > 1.999) { //if (sin(in.uv[0] * 10000.0 + in.uv[1] * 5132.0) + cos(in.uv[0] * 12399.0 + in.uv[1] * 10412.0) > 1.999) {
//if (sin(sin(in.uv[0] * 10000000.0) * 412.0 + cos(in.uv[1] * 11132000.0) * 12.0) + cos(sin(in.uv[0] * 12309900.0) * 93.0 + sin(in.uv[1] * 10410200.0) * 115.0) > 1.999) { //if (sin(sin(in.uv[0] * 10000000.0) * 412.0 + cos(in.uv[1] * 11132000.0) * 12.0) + cos(sin(in.uv[0] * 12309900.0) * 93.0 + sin(in.uv[1] * 10410200.0) * 115.0) > 1.999) {
if (rand(in.uv) + rand(vec2(in.uv[1]*10.0, in.uv[0]*10.0)) > 1.997) { //if (rand(in.uv) + rand(vec2(in.uv[1]*10.0, in.uv[0]*10.0)) > 1.997) {
alpha *= 200.0; //alpha *= 200.0;
} //}
return vec4<f32>(color, alpha); return vec4<f32>(color, alpha);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

View file

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View file

@ -17,7 +17,6 @@ use bevy::prelude::*;
use bevy::scene::SceneInstance; use bevy::scene::SceneInstance;
use bevy::transform::TransformSystem; use bevy::transform::TransformSystem;
use bevy_xpbd_3d::prelude::*; use bevy_xpbd_3d::prelude::*;
use serde::{Deserialize, Serialize};
use std::collections::VecDeque; use std::collections::VecDeque;
use std::time::SystemTime; use std::time::SystemTime;
@ -58,12 +57,6 @@ pub const PLAYER_AR_AVATARS: &[(Avatar, &str, f32, &str)] = &[
(Avatar::Asteroid, "metis", 1.3, "Asteroid"), (Avatar::Asteroid, "metis", 1.3, "Asteroid"),
]; ];
pub const POINTERS: &[(Pointer, Option<&str>, &str)] = &[
(Pointer::None, None, "Off"),
(Pointer::Tri, Some("sprites/pointer_tri.png"), "Default"),
(Pointer::Dot, Some("sprites/pointer_dot.png"), "Dot"),
];
pub struct HudPlugin; pub struct HudPlugin;
impl Plugin for HudPlugin { impl Plugin for HudPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
@ -84,7 +77,6 @@ impl Plugin for HudPlugin {
( (
update_overlay_visibility, update_overlay_visibility,
update_avatar.run_if(on_event::<UpdateAvatarEvent>()), update_avatar.run_if(on_event::<UpdateAvatarEvent>()),
update_pointer.run_if(on_event::<UpdatePointerEvent>()),
update_ar_overlays update_ar_overlays
.run_if(game_running) .run_if(game_running)
.after(camera::position_to_transform) .after(camera::position_to_transform)
@ -113,7 +105,6 @@ impl Plugin for HudPlugin {
))); )));
app.add_event::<TargetEvent>(); app.add_event::<TargetEvent>();
app.add_event::<UpdateAvatarEvent>(); app.add_event::<UpdateAvatarEvent>();
app.add_event::<UpdatePointerEvent>();
app.add_event::<UpdateOverlayVisibility>(); app.add_event::<UpdateOverlayVisibility>();
} }
} }
@ -124,8 +115,6 @@ pub struct TargetEvent(pub Option<Entity>);
pub struct UpdateOverlayVisibility; pub struct UpdateOverlayVisibility;
#[derive(Event)] #[derive(Event)]
pub struct UpdateAvatarEvent; pub struct UpdateAvatarEvent;
#[derive(Event)]
pub struct UpdatePointerEvent;
#[derive(Component)] #[derive(Component)]
struct NodeHud; struct NodeHud;
#[derive(Component)] #[derive(Component)]
@ -137,7 +126,7 @@ struct NodeSpeedometerText;
#[derive(Component)] #[derive(Component)]
struct NodeCurrentChatLine; struct NodeCurrentChatLine;
#[derive(Component)] #[derive(Component)]
struct PointerComponent(pub Pointer); struct Reticule;
#[derive(Component)] #[derive(Component)]
struct Speedometer; struct Speedometer;
#[derive(Component)] #[derive(Component)]
@ -191,14 +180,6 @@ pub struct AugmentedRealityOverlay {
#[derive(Resource)] #[derive(Resource)]
struct FPSUpdateTimer(Timer); struct FPSUpdateTimer(Timer);
#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)]
pub enum Pointer {
None,
#[default]
Tri,
Dot,
}
pub enum Avatar { pub enum Avatar {
None, None,
ChefHat, ChefHat,
@ -315,7 +296,6 @@ impl Log {
pub fn setup( pub fn setup(
mut commands: Commands, mut commands: Commands,
settings: Res<Settings>, settings: Res<Settings>,
prefs: Res<Preferences>,
asset_server: Res<AssetServer>, asset_server: Res<AssetServer>,
mut ew_updateoverlays: EventWriter<UpdateOverlayVisibility>, mut ew_updateoverlays: EventWriter<UpdateOverlayVisibility>,
) { ) {
@ -407,38 +387,31 @@ pub fn setup(
parent.spawn((bundle_chatbox, NodeConsole)); parent.spawn((bundle_chatbox, NodeConsole));
}); });
// Add Pointer // Add Reticule
for (pointer_enum, sprite, _) in POINTERS { let reticule_handle: Handle<Image> = asset_server.load("sprites/reticule4.png");
if sprite.is_none() { commands
continue; .spawn((
} NodeBundle {
let sprite = sprite.unwrap(); style: style_centered(),
let pointer_handle: Handle<Image> = asset_server.load(sprite.to_string()); visibility,
commands ..default()
.spawn(( },
NodeBundle { ToggleableHudElement,
style: style_centered(), ))
visibility, .with_children(|builder| {
..default() builder.spawn((
}, ImageBundle {
ToggleableHudElement, image: UiImage::new(reticule_handle),
)) style: Style {
.with_children(|builder| { width: Val::VMin(5.0),
builder.spawn(( height: Val::VMin(5.0),
ImageBundle {
image: UiImage::new(pointer_handle),
style: Style {
width: Val::VMin(5.0),
height: Val::VMin(5.0),
..Default::default()
},
visibility: bool2vis(prefs.pointer == *pointer_enum),
..Default::default() ..Default::default()
}, },
PointerComponent(pointer_enum.clone()), ..Default::default()
)); },
}); Reticule,
} ));
});
// HP/O2/Suit Integrity/Power Gauges // HP/O2/Suit Integrity/Power Gauges
let gauges_handle: Handle<Image> = asset_server.load("sprites/gauge_horizontal.png"); let gauges_handle: Handle<Image> = asset_server.load("sprites/gauge_horizontal.png");
@ -1327,19 +1300,6 @@ fn update_overlay_visibility(
}; };
} }
fn update_pointer(
prefs: ResMut<Preferences>,
mut q_pointer: Query<(&PointerComponent, &mut Visibility)>,
) {
for (pointer, mut vis) in &mut q_pointer {
*vis = if pointer.0 == prefs.pointer {
Visibility::Inherited
} else {
Visibility::Hidden
}
}
}
fn update_avatar( fn update_avatar(
mut commands: Commands, mut commands: Commands,
mut settings: ResMut<Settings>, mut settings: ResMut<Settings>,

View file

@ -65,7 +65,6 @@ pub enum DeathScreenEvent {
pub const MENUDEF: &[(&str, MenuAction)] = &[ pub const MENUDEF: &[(&str, MenuAction)] = &[
("", MenuAction::ToggleAR), ("", MenuAction::ToggleAR),
("", MenuAction::ChangeARAvatar), ("", MenuAction::ChangeARAvatar),
("", MenuAction::ChangePointer),
("", MenuAction::ToggleMap), ("", MenuAction::ToggleMap),
("", MenuAction::ModLightAmp), ("", MenuAction::ModLightAmp),
("", MenuAction::ModFlashlightPower), ("", MenuAction::ModFlashlightPower),
@ -85,7 +84,6 @@ pub enum MenuAction {
ToggleMap, ToggleMap,
ToggleAR, ToggleAR,
ChangeARAvatar, ChangeARAvatar,
ChangePointer,
ModLightAmp, ModLightAmp,
ModFlashlightPower, ModFlashlightPower,
ModThrusterBoost, ModThrusterBoost,
@ -546,14 +544,6 @@ pub fn update_menu(
text.sections[i].value = format!("Avatar: {avatar_title}\n"); text.sections[i].value = format!("Avatar: {avatar_title}\n");
} }
} }
MenuAction::ChangePointer => {
for pointer in hud::POINTERS {
if pointer.0 == prefs.pointer {
text.sections[i].value = format!("Pointer: {}\n", pointer.2);
break;
}
}
}
MenuAction::ToggleMap => { MenuAction::ToggleMap => {
let onoff = bool2string(settings.map_active); let onoff = bool2string(settings.map_active);
text.sections[i].value = format!("Map: {onoff} [M]\n"); text.sections[i].value = format!("Map: {onoff} [M]\n");
@ -587,7 +577,6 @@ pub fn handle_input(
mut ew_sfx: EventWriter<audio::PlaySfxEvent>, mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
mut ew_updatemenu: EventWriter<UpdateMenuEvent>, mut ew_updatemenu: EventWriter<UpdateMenuEvent>,
mut ew_updateavatar: EventWriter<hud::UpdateAvatarEvent>, mut ew_updateavatar: EventWriter<hud::UpdateAvatarEvent>,
mut ew_updatepointer: EventWriter<hud::UpdatePointerEvent>,
mut ew_updateoverlays: EventWriter<hud::UpdateOverlayVisibility>, mut ew_updateoverlays: EventWriter<hud::UpdateOverlayVisibility>,
) { ) {
let last_menu_entry = MENUDEF.len() - 1; let last_menu_entry = MENUDEF.len() - 1;
@ -642,24 +631,6 @@ pub fn handle_input(
settings.ar_avatar += 1; settings.ar_avatar += 1;
ew_updateavatar.send(hud::UpdateAvatarEvent); ew_updateavatar.send(hud::UpdateAvatarEvent);
} }
MenuAction::ChangePointer => {
let mut index = 0;
for (i, pointer) in hud::POINTERS.iter().enumerate() {
if pointer.0 == prefs.pointer {
index = i;
break;
}
}
index = (index + 1) % hud::POINTERS.len();
for (i, pointer) in hud::POINTERS.iter().enumerate() {
if i == index {
prefs.pointer = pointer.0;
break;
}
}
ew_updatepointer.send(hud::UpdatePointerEvent);
ew_updatemenu.send(UpdateMenuEvent);
}
MenuAction::ModLightAmp => { MenuAction::ModLightAmp => {
prefs.light_amp += 1; prefs.light_amp += 1;
if prefs.light_amp > 3 { if prefs.light_amp > 3 {

View file

@ -473,7 +473,6 @@ pub struct Preferences {
pub third_person: bool, pub third_person: bool,
pub shadows_sun: bool, pub shadows_sun: bool,
pub avatar: usize, pub avatar: usize,
pub pointer: hud::Pointer,
#[serde(default = "Preferences::default_light_amp")] #[serde(default = "Preferences::default_light_amp")]
pub light_amp: usize, // 0-3 pub light_amp: usize, // 0-3
#[serde(default = "Preferences::default_flashlight_power")] #[serde(default = "Preferences::default_flashlight_power")]