mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 09:59:20 +02:00
Put proper comments and indentation.
This commit is contained in:
parent
8d51be644d
commit
a2851b5bcb
4 changed files with 22 additions and 23 deletions
|
@ -1339,14 +1339,14 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo
|
||||||
properties["using_hmd"] = isHMDMode();
|
properties["using_hmd"] = isHMDMode();
|
||||||
|
|
||||||
if (isOculusRiftPluginAvailable()) {
|
if (isOculusRiftPluginAvailable()) {
|
||||||
// If Oculus Rift Plugin is Available,And Current Display Plugin is not Oculus Rift
|
// If Oculus Rift Plugin is available and current display plugin is not Oculus Rift
|
||||||
// then startOculusRiftStandBySession to listen Oculus HMD Mounted status.
|
// then startOculusRiftStandBySession to listen Oculus HMD Mounted status.
|
||||||
if (getActiveDisplayPlugin()->getName() != "Oculus Rift" &&
|
if (getActiveDisplayPlugin()->getName() != "Oculus Rift" &&
|
||||||
!oculusRiftPlugin->isFakeSessionActive()) {
|
!oculusRiftPlugin->isStandBySessionActive()) {
|
||||||
startOculusRiftStandBySession();
|
startOculusRiftStandBySession();
|
||||||
}
|
}
|
||||||
// Poll periodically to check whether the user has worn Oculus HMD or not. And switch mode
|
// Poll periodically to check whether the user has worn Oculus HMD or not. And switch Display mode accordingly.
|
||||||
// accordingly. If the user wear HMD, switch to VR mode, if remove switch to Desktop mode.
|
// If the user wear Oculus HMD then switch to VR mode. If the user removes Oculus HMD then switch to Desktop mode.
|
||||||
QTimer *switchDisplayModeTimer = new QTimer(this);
|
QTimer *switchDisplayModeTimer = new QTimer(this);
|
||||||
connect(switchDisplayModeTimer, SIGNAL(timeout()), this, SLOT(switchDisplayModeForOculus()));
|
connect(switchDisplayModeTimer, SIGNAL(timeout()), this, SLOT(switchDisplayModeForOculus()));
|
||||||
switchDisplayModeTimer->start(500);
|
switchDisplayModeTimer->start(500);
|
||||||
|
@ -1581,7 +1581,7 @@ void Application::aboutToQuit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
getActiveDisplayPlugin()->deactivate();
|
getActiveDisplayPlugin()->deactivate();
|
||||||
if (oculusRiftPlugin && oculusRiftPlugin->isFakeSessionActive()){
|
if (oculusRiftPlugin && oculusRiftPlugin->isStandBySessionActive()) {
|
||||||
oculusRiftPlugin->endStandBySession();
|
oculusRiftPlugin->endStandBySession();
|
||||||
}
|
}
|
||||||
// Hide Running Scripts dialog so that it gets destroyed in an orderly manner; prevents warnings at shutdown.
|
// Hide Running Scripts dialog so that it gets destroyed in an orderly manner; prevents warnings at shutdown.
|
||||||
|
@ -6846,14 +6846,14 @@ void Application::updateDisplayMode() {
|
||||||
Q_ASSERT_X(_displayPlugin, "Application::updateDisplayMode", "could not find an activated display plugin");
|
Q_ASSERT_X(_displayPlugin, "Application::updateDisplayMode", "could not find an activated display plugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Application::isOculusRiftPluginAvailable(){
|
bool Application::isOculusRiftPluginAvailable() {
|
||||||
bool isOculusRiftPluginAvailable = false;
|
bool isOculusRiftPluginAvailable = false;
|
||||||
auto displayPlugins = PluginManager::getInstance()->getDisplayPlugins();
|
auto displayPlugins = PluginManager::getInstance()->getDisplayPlugins();
|
||||||
// Default to the first item on the list, in case none of the menu items match
|
// Default to the first item on the list, in case none of the menu items match
|
||||||
DisplayPluginPointer defaultplugin = displayPlugins.at(0);
|
DisplayPluginPointer defaultplugin = displayPlugins.at(0);
|
||||||
if (defaultplugin->isHmd() && defaultplugin->getName() == "Oculus Rift") {
|
if (defaultplugin->isHmd() && defaultplugin->getName() == "Oculus Rift") {
|
||||||
oculusRiftPlugin = defaultplugin;
|
oculusRiftPlugin = defaultplugin;
|
||||||
return true; // No need to iterate again,so return
|
return true;
|
||||||
}
|
}
|
||||||
// Iterate to check If Oculus Rift Plugin is available
|
// Iterate to check If Oculus Rift Plugin is available
|
||||||
foreach(DisplayPluginPointer displayPlugin, PluginManager::getInstance()->getDisplayPlugins()) {
|
foreach(DisplayPluginPointer displayPlugin, PluginManager::getInstance()->getDisplayPlugins()) {
|
||||||
|
@ -6868,9 +6868,9 @@ bool Application::isOculusRiftPluginAvailable(){
|
||||||
return isOculusRiftPluginAvailable;
|
return isOculusRiftPluginAvailable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::switchDisplayModeForOculus(){
|
void Application::switchDisplayModeForOculus() {
|
||||||
bool currenthmdMountedStatus = oculusRiftPlugin->isDisplayVisible();
|
bool currenthmdMountedStatus = oculusRiftPlugin->isDisplayVisible();
|
||||||
if (currenthmdMountedStatus != _oculusHMDMountedStatus){
|
if (currenthmdMountedStatus != _oculusHMDMountedStatus) {
|
||||||
// Switch to respective mode as soon as currenthmdMountedStatus changes
|
// Switch to respective mode as soon as currenthmdMountedStatus changes
|
||||||
if (currenthmdMountedStatus == false && _oculusHMDMountedStatus == true) {
|
if (currenthmdMountedStatus == false && _oculusHMDMountedStatus == true) {
|
||||||
qCDebug(interfaceapp) << "Switching from HMD to desktop mode";
|
qCDebug(interfaceapp) << "Switching from HMD to desktop mode";
|
||||||
|
@ -6886,13 +6886,13 @@ void Application::switchDisplayModeForOculus(){
|
||||||
_oculusHMDMountedStatus = currenthmdMountedStatus;
|
_oculusHMDMountedStatus = currenthmdMountedStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Application::startOculusRiftStandBySession(){
|
bool Application::startOculusRiftStandBySession() {
|
||||||
bool isStandBySessionStarted = oculusRiftPlugin->startStandBySession();
|
bool isStandBySessionStarted = oculusRiftPlugin->startStandBySession();
|
||||||
qCDebug(interfaceapp) << "startOculusRiftStandBySession: " << isStandBySessionStarted;
|
qCDebug(interfaceapp) << "startOculusRiftStandBySession: " << isStandBySessionStarted;
|
||||||
return isStandBySessionStarted;
|
return isStandBySessionStarted;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::endOculusRiftStandBySession(){
|
void Application::endOculusRiftStandBySession() {
|
||||||
oculusRiftPlugin->endStandBySession();
|
oculusRiftPlugin->endStandBySession();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,7 @@ public:
|
||||||
void paintGL();
|
void paintGL();
|
||||||
void resizeGL();
|
void resizeGL();
|
||||||
|
|
||||||
bool event(QEvent* event) override;
|
bool event(QEvent* event) override;
|
||||||
bool eventFilter(QObject* object, QEvent* event) override;
|
bool eventFilter(QObject* object, QEvent* event) override;
|
||||||
|
|
||||||
glm::uvec2 getCanvasSize() const;
|
glm::uvec2 getCanvasSize() const;
|
||||||
|
@ -685,9 +685,8 @@ private:
|
||||||
|
|
||||||
|
|
||||||
DisplayPluginPointer oculusRiftPlugin;
|
DisplayPluginPointer oculusRiftPlugin;
|
||||||
|
|
||||||
bool isOculusRiftPluginAvailable();
|
bool isOculusRiftPluginAvailable();
|
||||||
bool _oculusHMDMountedStatus; // Keep track of HMD Mounted Flag
|
bool _oculusHMDMountedStatus; // Keep track of Oculus Rift HMDMounted Flag
|
||||||
bool startOculusRiftStandBySession();
|
bool startOculusRiftStandBySession();
|
||||||
void endOculusRiftStandBySession();
|
void endOculusRiftStandBySession();
|
||||||
};
|
};
|
||||||
|
|
|
@ -315,7 +315,7 @@ bool OpenGLDisplayPlugin::activate() {
|
||||||
if (isHmd() && (getHmdScreen() >= 0)) {
|
if (isHmd() && (getHmdScreen() >= 0)) {
|
||||||
_container->showDisplayPluginsTools();
|
_container->showDisplayPluginsTools();
|
||||||
}
|
}
|
||||||
return Parent::activate();
|
return Parent::activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenGLDisplayPlugin::deactivate() {
|
void OpenGLDisplayPlugin::deactivate() {
|
||||||
|
|
|
@ -53,17 +53,17 @@ public:
|
||||||
virtual bool isActive() {
|
virtual bool isActive() {
|
||||||
return _active;
|
return _active;
|
||||||
}
|
}
|
||||||
virtual bool startStandBySession(){
|
virtual bool startStandBySession() {
|
||||||
_standbysessionactive = true;
|
_standbysessionstatus = true;
|
||||||
return _standbysessionactive;
|
return _standbysessionstatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void endStandBySession(){
|
virtual void endStandBySession() {
|
||||||
_standbysessionactive = false;
|
_standbysessionstatus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool isFakeSessionActive() {
|
virtual bool isStandBySessionActive() {
|
||||||
return _standbysessionactive;
|
return _standbysessionstatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,7 +85,7 @@ signals:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool _active { false };
|
bool _active { false };
|
||||||
bool _standbysessionactive { false };
|
bool _standbysessionstatus { false };
|
||||||
PluginContainer* _container { nullptr };
|
PluginContainer* _container { nullptr };
|
||||||
static const char* UNKNOWN_PLUGIN_ID;
|
static const char* UNKNOWN_PLUGIN_ID;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue