mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 08:21:24 +02:00
WL21423 Camera mode on startup is determined by user settings and HMD status
This commit is contained in:
parent
0f73496a44
commit
24718e2424
1 changed files with 32 additions and 12 deletions
|
@ -4146,6 +4146,7 @@ void Application::loadSettings() {
|
||||||
//DependencyManager::get<LODManager>()->setAutomaticLODAdjust(false);
|
//DependencyManager::get<LODManager>()->setAutomaticLODAdjust(false);
|
||||||
|
|
||||||
Menu::getInstance()->loadSettings();
|
Menu::getInstance()->loadSettings();
|
||||||
|
|
||||||
// If there is a preferred plugin, we probably messed it up with the menu settings, so fix it.
|
// If there is a preferred plugin, we probably messed it up with the menu settings, so fix it.
|
||||||
auto pluginManager = PluginManager::getInstance();
|
auto pluginManager = PluginManager::getInstance();
|
||||||
auto plugins = pluginManager->getPreferredDisplayPlugins();
|
auto plugins = pluginManager->getPreferredDisplayPlugins();
|
||||||
|
@ -4159,11 +4160,13 @@ void Application::loadSettings() {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
Setting::Handle<bool> firstRun { Settings::firstRun, true };
|
||||||
|
bool isFirstPerson = false;
|
||||||
|
if (firstRun.get()) {
|
||||||
// If this is our first run, and no preferred devices were set, default to
|
// If this is our first run, and no preferred devices were set, default to
|
||||||
// an HMD device if available.
|
// an HMD device if available.
|
||||||
Setting::Handle<bool> firstRun { Settings::firstRun, true };
|
|
||||||
if (firstRun.get()) {
|
|
||||||
auto displayPlugins = pluginManager->getDisplayPlugins();
|
auto displayPlugins = pluginManager->getDisplayPlugins();
|
||||||
for (auto& plugin : displayPlugins) {
|
for (auto& plugin : displayPlugins) {
|
||||||
if (plugin->isHmd()) {
|
if (plugin->isHmd()) {
|
||||||
|
@ -4174,9 +4177,27 @@ void Application::loadSettings() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isFirstPerson = (qApp->isHMDMode());
|
||||||
|
} else {
|
||||||
|
// if this is not the first run, the camera will be initialized differently depending on user settings
|
||||||
|
|
||||||
|
if (qApp->isHMDMode()) {
|
||||||
|
// if the HMD is active, use first-person camera, unless the appropriate setting is checked
|
||||||
|
isFirstPerson = menu->isOptionChecked(MenuOption::FirstPersonHMD);
|
||||||
|
} else {
|
||||||
|
// if HMD is not active, only use first person if the menu option is checked
|
||||||
|
isFirstPerson = menu->isOptionChecked(MenuOption::FirstPerson);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// finish initializing the camera, based on everything we checked above. Third person camera will be used if no settings
|
||||||
|
// dictated that we should be in first person
|
||||||
|
_myCamera.setMode((isFirstPerson) ? CAMERA_MODE_FIRST_PERSON : CAMERA_MODE_THIRD_PERSON);
|
||||||
|
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, isFirstPerson);
|
||||||
|
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !isFirstPerson);
|
||||||
|
cameraMenuChanged();
|
||||||
|
|
||||||
auto inputs = pluginManager->getInputPlugins();
|
auto inputs = pluginManager->getInputPlugins();
|
||||||
for (auto plugin : inputs) {
|
for (auto plugin : inputs) {
|
||||||
if (!plugin->isActive()) {
|
if (!plugin->isActive()) {
|
||||||
|
@ -4225,7 +4246,6 @@ void Application::init() {
|
||||||
DependencyManager::get<DeferredLightingEffect>()->init();
|
DependencyManager::get<DeferredLightingEffect>()->init();
|
||||||
|
|
||||||
DependencyManager::get<AvatarManager>()->init();
|
DependencyManager::get<AvatarManager>()->init();
|
||||||
_myCamera.setMode(CAMERA_MODE_FIRST_PERSON);
|
|
||||||
|
|
||||||
_timerStart.start();
|
_timerStart.start();
|
||||||
_lastTimeUpdated.start();
|
_lastTimeUpdated.start();
|
||||||
|
|
Loading…
Reference in a new issue