mirror of https://github.com/wayvr-org/wayvr.git
skybox selector
This commit is contained in:
parent
16446f7808
commit
9986b71b26
|
|
@ -29,7 +29,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div gap="8" flex_direction="column" width="100%">
|
<div gap="8" flex_direction="column" width="100%">
|
||||||
<label text="Curve"/>
|
<label text="Curve (0 = disabled)"/>
|
||||||
<Slider id="slider_keying_curve" min_value="0" max_value="100" macro="slider"/>
|
<Slider id="slider_keying_curve" min_value="0" max_value="100" macro="slider"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -27,12 +27,20 @@ impl<T> Tab<T> for TabGames<T> {
|
||||||
TabType::Games
|
TabType::Games
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, frontend: &mut Frontend<T>, time_ms: u32, _data: &mut T) -> anyhow::Result<()> {
|
fn update(&mut self, frontend: &mut Frontend<T>, time_ms: u32, data: &mut T) -> anyhow::Result<()> {
|
||||||
|
let mut config_change_kind = None;
|
||||||
|
|
||||||
self.view_game_list.update(&mut ViewUpdateParams {
|
self.view_game_list.update(&mut ViewUpdateParams {
|
||||||
layout: &mut frontend.layout,
|
layout: &mut frontend.layout,
|
||||||
executor: &mut frontend.executor,
|
executor: &frontend.executor,
|
||||||
|
general_config: frontend.interface.general_config(data),
|
||||||
|
config_change_kind: &mut config_change_kind,
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
if let Some(kind) = config_change_kind {
|
||||||
|
frontend.interface.config_changed(data, kind);
|
||||||
|
}
|
||||||
|
|
||||||
self.view_running_games_list.update(&mut frontend.layout, time_ms)?;
|
self.view_running_games_list.update(&mut frontend.layout, time_ms)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,9 @@ impl<T> Tab<T> for TabMonado<T> {
|
||||||
Task::GeneralSettingsChromaUpdate => {
|
Task::GeneralSettingsChromaUpdate => {
|
||||||
if let Subtab::GeneralSettings(tab) = &mut self.subtab {
|
if let Subtab::GeneralSettings(tab) = &mut self.subtab {
|
||||||
tab.chroma_update(frontend.interface.general_config(data));
|
tab.chroma_update(frontend.interface.general_config(data));
|
||||||
frontend.interface.config_changed(data, ConfigChangeKind::EnvironmentBlend);
|
frontend
|
||||||
|
.interface
|
||||||
|
.config_changed(data, ConfigChangeKind::EnvironmentBlend);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Task::SetBrightness(brightness) => self.set_brightness(frontend, data, brightness),
|
Task::SetBrightness(brightness) => self.set_brightness(frontend, data, brightness),
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,11 @@ use wgui::{
|
||||||
},
|
},
|
||||||
windowing::context_menu::{self, Blueprint, ContextMenu, TickResult},
|
windowing::context_menu::{self, Blueprint, ContextMenu, TickResult},
|
||||||
};
|
};
|
||||||
use wlx_common::{config::GeneralConfig, config_io::ConfigRoot, dash_interface::{ConfigChangeKind, RecenterMode}};
|
use wlx_common::{
|
||||||
|
config::GeneralConfig,
|
||||||
|
config_io::ConfigRoot,
|
||||||
|
dash_interface::{ConfigChangeKind, RecenterMode},
|
||||||
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
frontend::{Frontend, FrontendTask, FrontendTasks},
|
frontend::{Frontend, FrontendTask, FrontendTasks},
|
||||||
|
|
@ -110,13 +114,21 @@ impl<T> Tab<T> for TabSettings<T> {
|
||||||
|
|
||||||
fn update(&mut self, frontend: &mut Frontend<T>, _time_ms: u32, data: &mut T) -> anyhow::Result<()> {
|
fn update(&mut self, frontend: &mut Frontend<T>, _time_ms: u32, data: &mut T) -> anyhow::Result<()> {
|
||||||
if let Some(tab) = &mut self.current_tab {
|
if let Some(tab) = &mut self.current_tab {
|
||||||
|
let mut config_change_kind = None;
|
||||||
|
|
||||||
tab.update(&mut ViewUpdateParams {
|
tab.update(&mut ViewUpdateParams {
|
||||||
layout: &mut frontend.layout,
|
layout: &mut frontend.layout,
|
||||||
executor: &frontend.executor,
|
executor: &frontend.executor,
|
||||||
|
general_config: frontend.interface.general_config(data),
|
||||||
|
config_change_kind: &mut config_change_kind,
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
|
if let Some(kind) = config_change_kind {
|
||||||
|
frontend.interface.config_changed(data, kind);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut changed = false;
|
let mut changed = None;
|
||||||
for task in self.tasks.drain() {
|
for task in self.tasks.drain() {
|
||||||
match task {
|
match task {
|
||||||
Task::SetTab(tab) => {
|
Task::SetTab(tab) => {
|
||||||
|
|
@ -129,7 +141,7 @@ impl<T> Tab<T> for TabSettings<T> {
|
||||||
}
|
}
|
||||||
let config = frontend.interface.general_config(data);
|
let config = frontend.interface.general_config(data);
|
||||||
*setting.mut_bool(config) = n;
|
*setting.mut_bool(config) = n;
|
||||||
changed = true;
|
changed = Some(setting.change_kind());
|
||||||
}
|
}
|
||||||
Task::UpdateFloat(setting, n) => {
|
Task::UpdateFloat(setting, n) => {
|
||||||
self.tasks.push(Task::SettingUpdated(setting));
|
self.tasks.push(Task::SettingUpdated(setting));
|
||||||
|
|
@ -138,7 +150,7 @@ impl<T> Tab<T> for TabSettings<T> {
|
||||||
}
|
}
|
||||||
let config = frontend.interface.general_config(data);
|
let config = frontend.interface.general_config(data);
|
||||||
*setting.mut_f32(config) = n;
|
*setting.mut_f32(config) = n;
|
||||||
changed = true;
|
changed = Some(setting.change_kind());
|
||||||
}
|
}
|
||||||
Task::UpdateInt(setting, n) => {
|
Task::UpdateInt(setting, n) => {
|
||||||
self.tasks.push(Task::SettingUpdated(setting));
|
self.tasks.push(Task::SettingUpdated(setting));
|
||||||
|
|
@ -147,7 +159,7 @@ impl<T> Tab<T> for TabSettings<T> {
|
||||||
}
|
}
|
||||||
let config = frontend.interface.general_config(data);
|
let config = frontend.interface.general_config(data);
|
||||||
*setting.mut_i32(config) = n;
|
*setting.mut_i32(config) = n;
|
||||||
changed = true;
|
changed = Some(setting.change_kind());
|
||||||
}
|
}
|
||||||
Task::ClearPipewireTokens => {
|
Task::ClearPipewireTokens => {
|
||||||
let _ = std::fs::remove_file(ConfigRoot::Generic.get_conf_d_path().join("pw_tokens.yaml"))
|
let _ = std::fs::remove_file(ConfigRoot::Generic.get_conf_d_path().join("pw_tokens.yaml"))
|
||||||
|
|
@ -186,7 +198,7 @@ impl<T> Tab<T> for TabSettings<T> {
|
||||||
let config = frontend.interface.general_config(data);
|
let config = frontend.interface.general_config(data);
|
||||||
config.autostart_apps.remove(idx);
|
config.autostart_apps.remove(idx);
|
||||||
frontend.layout.remove_widget(widget);
|
frontend.layout.remove_widget(widget);
|
||||||
changed = true;
|
changed = Some(ConfigChangeKind::OverlayConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Task::SettingUpdated(setting) => match setting {
|
Task::SettingUpdated(setting) => match setting {
|
||||||
|
|
@ -219,12 +231,12 @@ impl<T> Tab<T> for TabSettings<T> {
|
||||||
let setting = SettingType::from_str(setting).expect("Invalid Enum string");
|
let setting = SettingType::from_str(setting).expect("Invalid Enum string");
|
||||||
let config = frontend.interface.general_config(data);
|
let config = frontend.interface.general_config(data);
|
||||||
setting.set_enum(config, value);
|
setting.set_enum(config, value);
|
||||||
changed = true;
|
changed = Some(ConfigChangeKind::OverlayConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify overlays of the change
|
// Notify overlays of the change
|
||||||
if changed {
|
if let Some(changed) = changed {
|
||||||
frontend.interface.config_changed(data, ConfigChangeKind::OverlayConfig);
|
frontend.interface.config_changed(data, changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
@ -277,6 +289,13 @@ enum SettingType {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SettingType {
|
impl SettingType {
|
||||||
|
pub fn change_kind(self) -> ConfigChangeKind {
|
||||||
|
match self {
|
||||||
|
Self::UseSkybox | Self::UsePassthrough => ConfigChangeKind::EnvironmentBlend,
|
||||||
|
_ => ConfigChangeKind::OverlayConfig,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn mut_bool(self, config: &mut GeneralConfig) -> &mut bool {
|
pub fn mut_bool(self, config: &mut GeneralConfig) -> &mut bool {
|
||||||
match self {
|
match self {
|
||||||
Self::InvertScrollDirectionX => &mut config.invert_scroll_direction_x,
|
Self::InvertScrollDirectionX => &mut config.invert_scroll_direction_x,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::tab::settings::{
|
use crate::tab::settings::{
|
||||||
macros::{options_category, options_checkbox, options_slider_f32},
|
|
||||||
SettingType, SettingsMountParams, SettingsTab,
|
SettingType, SettingsMountParams, SettingsTab,
|
||||||
|
macros::{options_category, options_checkbox, options_slider_f32},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub struct State {}
|
pub struct State {}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
use wlx_common::async_executor::AsyncExecutor;
|
use wlx_common::{async_executor::AsyncExecutor, config::GeneralConfig, dash_interface::ConfigChangeKind};
|
||||||
|
|
||||||
pub mod app_launcher;
|
pub mod app_launcher;
|
||||||
pub mod audio_settings;
|
pub mod audio_settings;
|
||||||
|
|
@ -16,6 +16,8 @@ pub mod skymap_list_cell;
|
||||||
pub struct ViewUpdateParams<'a> {
|
pub struct ViewUpdateParams<'a> {
|
||||||
pub layout: &'a mut wgui::layout::Layout,
|
pub layout: &'a mut wgui::layout::Layout,
|
||||||
pub executor: &'a AsyncExecutor,
|
pub executor: &'a AsyncExecutor,
|
||||||
|
pub general_config: &'a mut GeneralConfig,
|
||||||
|
pub config_change_kind: &'a mut Option<ConfigChangeKind>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ViewTrait {
|
pub trait ViewTrait {
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ use wgui::{
|
||||||
renderer_vk::text::custom_glyph::CustomGlyphData,
|
renderer_vk::text::custom_glyph::CustomGlyphData,
|
||||||
task::Tasks,
|
task::Tasks,
|
||||||
};
|
};
|
||||||
use wlx_common::{async_executor::AsyncExecutor, config_io};
|
use wlx_common::{async_executor::AsyncExecutor, config::GeneralConfig, config_io, dash_interface::ConfigChangeKind};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
frontend::{FrontendTask, FrontendTasks},
|
frontend::{FrontendTask, FrontendTasks},
|
||||||
|
|
@ -75,7 +75,7 @@ impl ViewTrait for View {
|
||||||
self.show_skymap_resolution_selector(entry);
|
self.show_skymap_resolution_selector(entry);
|
||||||
}
|
}
|
||||||
Task::SetSkymap(entry, resolution) => {
|
Task::SetSkymap(entry, resolution) => {
|
||||||
self.set_skymap(entry, resolution)?;
|
self.set_skymap(entry, resolution, par.general_config, par.config_change_kind)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -132,16 +132,23 @@ impl View {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_skymap(&mut self, entry: SkymapCatalogEntry, resolution: SkymapResolution) -> anyhow::Result<()> {
|
fn set_skymap(
|
||||||
|
&mut self,
|
||||||
|
entry: SkymapCatalogEntry,
|
||||||
|
resolution: SkymapResolution,
|
||||||
|
config: &mut GeneralConfig,
|
||||||
|
change_kind: &mut Option<ConfigChangeKind>,
|
||||||
|
) -> anyhow::Result<()> {
|
||||||
let skymap_file_path = entry
|
let skymap_file_path = entry
|
||||||
.get_destination_path(resolution)
|
.get_destination_path(resolution)
|
||||||
.context("Skymap not found" /* you shouldn't really see this, like ever. */)?;
|
.context("Skymap not found" /* you shouldn't really see this, like ever. */)?;
|
||||||
|
|
||||||
log::error!(
|
config.skybox_texture = config_io::get_skymaps_root()
|
||||||
"not implemented (skymap path to be loaded: {} with resolution {:?})",
|
.join(skymap_file_path)
|
||||||
skymap_file_path.to_string_lossy(),
|
.to_str()
|
||||||
resolution
|
.context("Skymap filename not valid UTF-8")?
|
||||||
);
|
.into();
|
||||||
|
*change_kind = Some(ConfigChangeKind::EnvironmentBlend);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,7 @@ pub(super) fn posef_to_transform(pose: &xr::Posef) -> Affine3A {
|
||||||
|
|
||||||
pub(super) fn try_apply_chroma_key(app: &AppState) -> bool {
|
pub(super) fn try_apply_chroma_key(app: &AppState) -> bool {
|
||||||
let Some(monado) = app.monado_state.as_ref() else {
|
let Some(monado) = app.monado_state.as_ref() else {
|
||||||
|
log::warn!("Could not set Chroma Key: no monado_state");
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -230,6 +231,5 @@ pub(super) fn try_apply_chroma_key(app: &AppState) -> bool {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if all values were non-0, assume we're in chroma key mode
|
params.curve > 0.001
|
||||||
params.hsv_max[0] * params.hsv_max[1] * params.hsv_max[2] * params.curve > 0.001
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -569,6 +569,9 @@ fn reconfigure_environment_blend(
|
||||||
log::debug!("Allocating skybox.");
|
log::debug!("Allocating skybox.");
|
||||||
*skybox = create_skybox(xr_state, app);
|
*skybox = create_skybox(xr_state, app);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log::debug!("Allocating skybox.");
|
||||||
|
*skybox = create_skybox(xr_state, app);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log::debug!("Destroying skybox.");
|
log::debug!("Destroying skybox.");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue