/* * WiVRn VR streaming * Copyright (C) 2022 Guillaume Meunier * Copyright (C) 2022 Patrick Nicolas * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #pragma once #include "asset.h" #include "configuration.h" #include "render/scene_data.h" #include "scene.h" #include "scenes/hand_model.h" #include "wifi_lock.h" #include "wivrn_discover.h" #include #include "xr/passthrough.h" #include "xr/system.h" #include #include #include "input_profile.h" #include "render/imgui_impl.h" #include "render/scene_renderer.h" #include "utils/async.h" class wivrn_session; namespace scenes { class stream; class lobby : public scene_impl { std::optional discover; wifi_lock::multicast multicast; char add_server_window_prettyname[200]; char add_server_window_hostname[200]; int add_server_window_port; utils::future, std::string> async_session; std::optional async_error; std::shared_ptr next_scene; std::string server_name; bool autoconnect_enabled = true; std::optional renderer; std::optional lobby_scene; std::optional controllers_scene; std::optional input; std::optional left_hand; std::optional right_hand; std::optional imgui_ctx; std::array haptic_output; std::string selected_item; std::unique_ptr license; ImGuiID hovered_item; std::vector swapchains_lobby; std::vector swapchains_controllers; xr::swapchain swapchain_imgui; vk::Format swapchain_format; xr::system::passthrough_type passthrough_supported; xr::passthrough passthrough; XrViewConfigurationView stream_view; void update_server_list(); XrCompositionLayerQuad draw_gui(XrTime predicted_display_time); XrAction recenter_left_action = XR_NULL_HANDLE; XrAction recenter_right_action = XR_NULL_HANDLE; std::optional gui_recenter_distance; bool recenter_gui = true; void move_gui(glm::vec3 head_position, glm::vec3 new_gui_position); enum class tab { server_list, new_server, settings, about, licenses, exit }; tab current_tab = tab::server_list; tab last_current_tab = tab::server_list; ImTextureID about_picture; void draw_features_status(XrTime predicted_display_time); void gui_connecting(); void gui_server_list(); void gui_add_server(); void gui_settings(); void gui_about(); void gui_licenses(); void gui_keyboard(ImVec2 size); void setup_passthrough(); void vibrate_on_hover(); void connect(const configuration::server_data & data); std::optional check_recenter_gesture(const std::array & joints); std::optional check_recenter_action(XrTime predicted_display_time); std::optional check_recenter_gui(glm::vec3 head_position, glm::quat head_orientation); public: virtual ~lobby(); lobby(); void render(const XrFrameState &) override; void on_unfocused() override; void on_focused() override; void on_session_state_changed(XrSessionState state) override; void on_reference_space_changed(XrReferenceSpaceType, XrTime) override; static meta & get_meta_scene(); }; } // namespace scenes