mirror of
https://github.com/WiVRn/WiVRn.git
synced 2026-11-20 09:01:39 -08:00
Add checkboxes for eye and face tracking
This commit is contained in:
1 parent
76626b8133
commit
e80c6cdd67
4 files changed
+49
-10
No files matched your search
@@ -79,7 +79,7 @@ static std::string json_string(const std::string & in)
|
||||
return out;
|
||||
}
|
||||
|
||||
bool configuration::check_feature(feature f)
|
||||
bool configuration::check_feature(feature f) const
|
||||
{
|
||||
auto it = features.find(f);
|
||||
if (it == features.end())
|
||||
@@ -88,6 +88,19 @@ bool configuration::check_feature(feature f)
|
||||
// Skip permission checks if not requested
|
||||
if (not it->second)
|
||||
return false;
|
||||
switch (f)
|
||||
{
|
||||
case feature::microphone:
|
||||
break;
|
||||
case feature::eye_gaze:
|
||||
if (not application::get_eye_gaze_supported())
|
||||
return false;
|
||||
break;
|
||||
case feature::face_tracking:
|
||||
if (not application::get_fb_face_tracking2_supported())
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
#ifdef __ANDROID__
|
||||
return check_permission(permission_name(f));
|
||||
#else
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
bool show_performance_metrics = false;
|
||||
bool passthrough_enabled = false;
|
||||
|
||||
bool check_feature(feature f);
|
||||
bool check_feature(feature f) const;
|
||||
void set_feature(feature f, bool state);
|
||||
|
||||
private:
|
||||
|
||||
@@ -380,13 +380,37 @@ void scenes::lobby::gui_settings()
|
||||
vibrate_on_hover();
|
||||
}
|
||||
|
||||
bool enabled = config.check_feature(feature::microphone);
|
||||
if (ImGui::Checkbox(_S("Enable microphone"), &enabled))
|
||||
{
|
||||
config.set_feature(feature::microphone, enabled);
|
||||
config.save();
|
||||
bool enabled = config.check_feature(feature::microphone);
|
||||
if (ImGui::Checkbox(_S("Enable microphone"), &enabled))
|
||||
{
|
||||
config.set_feature(feature::microphone, enabled);
|
||||
config.save();
|
||||
}
|
||||
vibrate_on_hover();
|
||||
}
|
||||
{
|
||||
ImGui::BeginDisabled(not application::get_eye_gaze_supported());
|
||||
bool enabled = config.check_feature(feature::eye_gaze);
|
||||
if (ImGui::Checkbox(_S("Enable eye tracking"), &enabled))
|
||||
{
|
||||
config.set_feature(feature::eye_gaze, enabled);
|
||||
config.save();
|
||||
}
|
||||
vibrate_on_hover();
|
||||
ImGui::EndDisabled();
|
||||
}
|
||||
{
|
||||
ImGui::BeginDisabled(not application::get_fb_face_tracking2_supported());
|
||||
bool enabled = config.check_feature(feature::face_tracking);
|
||||
if (ImGui::Checkbox(_S("Enable face tracking"), &enabled))
|
||||
{
|
||||
config.set_feature(feature::face_tracking, enabled);
|
||||
config.save();
|
||||
}
|
||||
ImGui::EndDisabled();
|
||||
vibrate_on_hover();
|
||||
}
|
||||
vibrate_on_hover();
|
||||
|
||||
ImGui::BeginDisabled(passthrough_supported == xr::system::passthrough_type::no_passthrough);
|
||||
if (ImGui::Checkbox(_S("Enable video passthrough in lobby"), &config.passthrough_enabled))
|
||||
|
||||
@@ -118,12 +118,14 @@ std::shared_ptr<scenes::stream> scenes::stream::create(std::unique_ptr<wivrn_ses
|
||||
if (info.available_refresh_rates.empty())
|
||||
spdlog::warn("Unable to detect refresh rates");
|
||||
|
||||
const auto & config = application::get_config();
|
||||
|
||||
info.hand_tracking = application::get_hand_tracking_supported();
|
||||
info.eye_gaze = application::get_eye_gaze_supported();
|
||||
info.face_tracking2_fb = application::get_fb_face_tracking2_supported();
|
||||
info.eye_gaze = config.check_feature(feature::eye_gaze);
|
||||
info.face_tracking2_fb = config.check_feature(feature::face_tracking);
|
||||
|
||||
audio::get_audio_description(info);
|
||||
if (not(application::get_config().check_feature(feature::microphone)))
|
||||
if (not(config.check_feature(feature::microphone)))
|
||||
info.microphone = {};
|
||||
|
||||
info.supported_codecs = decoder_impl::supported_codecs();
|
||||
|
||||
Reference in new issue
Block a user