Skip to content

Commit

Permalink
OpenXR - Enable 6DoF mode when in game
Browse files Browse the repository at this point in the history
  • Loading branch information
lvonasek committed Jul 24, 2022
1 parent b1e3d8b commit 7a787bd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions UI/EmuScreen.cpp
Expand Up @@ -96,6 +96,10 @@ using namespace std::placeholders;
static AVIDump avi;
#endif

#ifdef OPENXR
#include <VR/VRRenderer.h>
#endif

// TODO: Ugly!
static bool frameStep_;
static int lastNumFlips;
Expand Down Expand Up @@ -821,6 +825,9 @@ class GameInfoBGView : public UI::InertView {
};

void EmuScreen::CreateViews() {
#ifdef OPENXR
VR_SetMode(VR_MODE_MONO_6DOF);
#endif
using namespace UI;

auto dev = GetI18NCategory("Developer");
Expand Down
8 changes: 8 additions & 0 deletions UI/PauseScreen.cpp
Expand Up @@ -48,6 +48,10 @@
#include "UI/OnScreenDisplay.h"
#include "UI/GameInfoCache.h"

#ifdef OPENXR
#include <VR/VRRenderer.h>
#endif

AsyncImageFileView::AsyncImageFileView(const Path &filename, UI::ImageSizeMode sizeMode, UI::LayoutParams *layoutParams)
: UI::Clickable(layoutParams), canFocus_(true), filename_(filename), color_(0xFFFFFFFF), sizeMode_(sizeMode), textureFailed_(false), fixedSizeW_(0.0f), fixedSizeH_(0.0f) {}

Expand Down Expand Up @@ -364,6 +368,10 @@ GamePauseScreen::~GamePauseScreen() {
}

void GamePauseScreen::CreateViews() {
#ifdef OPENXR
VR_SetMode(VR_MODE_FLAT_SCREEN);
#endif

static const int NUM_SAVESLOTS = 5;

using namespace UI;
Expand Down
4 changes: 4 additions & 0 deletions VR/VRRenderer.cpp
Expand Up @@ -422,6 +422,10 @@ void VR_EndFrame( engine_t* engine ) {
}
}

void VR_SetMode( VRMode mode ) {
vrMode = mode;
}

void VR_BindFramebuffer( engine_t* engine, int eye ) {
if (!initialized) return;
ovrFramebuffer* frameBuffer = &engine->appState.Renderer.FrameBuffer[eye];
Expand Down

0 comments on commit 7a787bd

Please sign in to comment.