Route VR lifecycle through platform services
This commit is contained in:
@@ -198,6 +198,8 @@ public:
|
||||
void display_file(std::string path);
|
||||
void share_file(std::string path);
|
||||
void request_app_close();
|
||||
[[nodiscard]] bool start_platform_vr_mode();
|
||||
void stop_platform_vr_mode();
|
||||
void attach_ui_thread();
|
||||
void detach_ui_thread();
|
||||
void acquire_render_context();
|
||||
|
||||
@@ -264,6 +264,16 @@ void App::request_app_close()
|
||||
active_platform_services().request_app_close();
|
||||
}
|
||||
|
||||
bool App::start_platform_vr_mode()
|
||||
{
|
||||
return active_platform_services().start_vr_mode();
|
||||
}
|
||||
|
||||
void App::stop_platform_vr_mode()
|
||||
{
|
||||
active_platform_services().stop_vr_mode();
|
||||
}
|
||||
|
||||
void App::attach_ui_thread()
|
||||
{
|
||||
active_platform_services().attach_ui_thread();
|
||||
|
||||
@@ -7,11 +7,6 @@
|
||||
#include "shape.h"
|
||||
#include "renderer_gl/opengl_capabilities.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
bool win32_vr_start();
|
||||
void win32_vr_stop();
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
void set_active_texture_unit(std::uint32_t unit_index)
|
||||
@@ -104,18 +99,12 @@ Sphere controller_ray;
|
||||
|
||||
bool App::vr_start()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
return win32_vr_start();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
return start_platform_vr_mode();
|
||||
}
|
||||
|
||||
void App::vr_stop()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
win32_vr_stop();
|
||||
#endif
|
||||
stop_platform_vr_mode();
|
||||
}
|
||||
|
||||
void App::vr_draw_ui()
|
||||
|
||||
@@ -59,6 +59,8 @@ public:
|
||||
virtual void display_file(std::string_view path) = 0;
|
||||
virtual void share_file(std::string_view path) = 0;
|
||||
virtual void request_app_close() = 0;
|
||||
[[nodiscard]] virtual bool start_vr_mode() = 0;
|
||||
virtual void stop_vr_mode() = 0;
|
||||
virtual void pick_image(PickedPathCallback callback) = 0;
|
||||
virtual void pick_file(std::vector<std::string> file_types, PickedPathCallback callback) = 0;
|
||||
virtual void pick_save_file(std::vector<std::string> file_types, PickedPathCallback callback) = 0;
|
||||
|
||||
@@ -587,6 +587,15 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
[[nodiscard]] bool start_vr_mode() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void stop_vr_mode() override
|
||||
{
|
||||
}
|
||||
|
||||
void save_prepared_file(
|
||||
std::string_view path,
|
||||
std::string_view suggested_name,
|
||||
|
||||
@@ -21,6 +21,8 @@ void win32_renderdoc_frame_end();
|
||||
void win32_update_fps(int frames);
|
||||
void win32_update_stylus(float dt);
|
||||
void win32_save_window_state();
|
||||
bool win32_vr_start();
|
||||
void win32_vr_stop();
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -423,6 +425,16 @@ public:
|
||||
destroy_window();
|
||||
}
|
||||
|
||||
[[nodiscard]] bool start_vr_mode() override
|
||||
{
|
||||
return win32_vr_start();
|
||||
}
|
||||
|
||||
void stop_vr_mode() override
|
||||
{
|
||||
win32_vr_stop();
|
||||
}
|
||||
|
||||
void pick_image(pp::platform::PickedPathCallback callback) override
|
||||
{
|
||||
const std::string path = open_file("Image Files (*.jpg, *.png)\0*.jpg;*.png");
|
||||
|
||||
Reference in New Issue
Block a user