Showing the changes to interface/src/Application.cpp (1 of 110 files). Show all
Unified · Split
| @@ -140,7 +140,6 @@ · 139 unmodified lines | |||
| 140 | #if defined(Q_OS_MAC) || defined(Q_OS_WIN) | 140 | #if defined(Q_OS_MAC) || defined(Q_OS_WIN) |
| 141 | #include "SpeechRecognizer.h" | 141 | #include "SpeechRecognizer.h" |
| 142 | #endif | 142 | #endif |
| 143 | #include "Stars.h" | ||
| 144 | #include "ui/AddressBarDialog.h" | 143 | #include "ui/AddressBarDialog.h" |
| 145 | #include "ui/AvatarInputs.h" | 144 | #include "ui/AvatarInputs.h" |
| 146 | #include "ui/DialogsManager.h" | 145 | #include "ui/DialogsManager.h" |
| @@ -392,6 +391,11 @@ void messageHandler(QtMsgType type, const QMessageLogContext& context, const QSt · 245 unmodified lines | |||
| 392 | } | 391 | } |
| 393 | 392 | ||
| 394 | static const QString STATE_IN_HMD = "InHMD"; | 393 | static const QString STATE_IN_HMD = "InHMD"; |
| 394 | static const QString STATE_CAMERA_FULL_SCREEN_MIRROR = "CameraFSM"; | ||
| 395 | static const QString STATE_CAMERA_FIRST_PERSON = "CameraFirstPerson"; | ||
| 396 | static const QString STATE_CAMERA_THIRD_PERSON = "CameraThirdPerson"; | ||
| 397 | static const QString STATE_CAMERA_ENTITY = "CameraEntity"; | ||
| 398 | static const QString STATE_CAMERA_INDEPENDENT = "CameraIndependent"; | ||
| 395 | static const QString STATE_SNAP_TURN = "SnapTurn"; | 399 | static const QString STATE_SNAP_TURN = "SnapTurn"; |
| 396 | static const QString STATE_GROUNDED = "Grounded"; | 400 | static const QString STATE_GROUNDED = "Grounded"; |
| 397 | static const QString STATE_NAV_FOCUSED = "NavigationFocused"; | 401 | static const QString STATE_NAV_FOCUSED = "NavigationFocused"; |
| @@ -471,7 +475,9 @@ bool setupEssentials(int& argc, char** argv) { · 73 unmodified lines | |||
| 471 | DependencyManager::set<InterfaceActionFactory>(); | 475 | DependencyManager::set<InterfaceActionFactory>(); |
| 472 | DependencyManager::set<AudioInjectorManager>(); | 476 | DependencyManager::set<AudioInjectorManager>(); |
| 473 | DependencyManager::set<MessagesClient>(); | 477 | DependencyManager::set<MessagesClient>(); |
| 474 | controller::StateController::setStateVariables({ { STATE_IN_HMD, STATE_SNAP_TURN, STATE_GROUNDED, STATE_NAV_FOCUSED } }); | 478 | controller::StateController::setStateVariables({ { STATE_IN_HMD, STATE_CAMERA_FULL_SCREEN_MIRROR, |
| 479 | STATE_CAMERA_FIRST_PERSON, STATE_CAMERA_THIRD_PERSON, STATE_CAMERA_ENTITY, STATE_CAMERA_INDEPENDENT, | ||
| 480 | STATE_SNAP_TURN, STATE_GROUNDED, STATE_NAV_FOCUSED } }); | ||
| 475 | DependencyManager::set<UserInputMapper>(); | 481 | DependencyManager::set<UserInputMapper>(); |
| 476 | DependencyManager::set<controller::ScriptingInterface, ControllerScriptingInterface>(); | 482 | DependencyManager::set<controller::ScriptingInterface, ControllerScriptingInterface>(); |
| 477 | DependencyManager::set<InterfaceParentFinder>(); | 483 | DependencyManager::set<InterfaceParentFinder>(); |
| @@ -819,6 +825,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 341 unmodified lines | |||
| 819 | } | 825 | } |
| 820 | UserActivityLogger::getInstance().logAction("launch", properties); | 826 | UserActivityLogger::getInstance().logAction("launch", properties); |
| 821 | 827 | ||
| 828 | _connectionMonitor.init(); | ||
| 822 | 829 | ||
| 823 | // Tell our entity edit sender about our known jurisdictions | 830 | // Tell our entity edit sender about our known jurisdictions |
| 824 | _entityEditSender.setServerJurisdictions(&_entityServerJurisdictions); | 831 | _entityEditSender.setServerJurisdictions(&_entityServerJurisdictions); |
| @@ -962,6 +969,21 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 137 unmodified lines | |||
| 962 | _applicationStateDevice->setInputVariant(STATE_IN_HMD, []() -> float { | 969 | _applicationStateDevice->setInputVariant(STATE_IN_HMD, []() -> float { |
| 963 | return qApp->isHMDMode() ? 1 : 0; | 970 | return qApp->isHMDMode() ? 1 : 0; |
| 964 | }); | 971 | }); |
| 972 | _applicationStateDevice->setInputVariant(STATE_CAMERA_FULL_SCREEN_MIRROR, []() -> float { | ||
| 973 | return qApp->getCamera()->getMode() == CAMERA_MODE_MIRROR ? 1 : 0; | ||
| 974 | }); | ||
| 975 | _applicationStateDevice->setInputVariant(STATE_CAMERA_FIRST_PERSON, []() -> float { | ||
| 976 | return qApp->getCamera()->getMode() == CAMERA_MODE_FIRST_PERSON ? 1 : 0; | ||
| 977 | }); | ||
| 978 | _applicationStateDevice->setInputVariant(STATE_CAMERA_THIRD_PERSON, []() -> float { | ||
| 979 | return qApp->getCamera()->getMode() == CAMERA_MODE_THIRD_PERSON ? 1 : 0; | ||
| 980 | }); | ||
| 981 | _applicationStateDevice->setInputVariant(STATE_CAMERA_ENTITY, []() -> float { | ||
| 982 | return qApp->getCamera()->getMode() == CAMERA_MODE_ENTITY ? 1 : 0; | ||
| 983 | }); | ||
| 984 | _applicationStateDevice->setInputVariant(STATE_CAMERA_INDEPENDENT, []() -> float { | ||
| 985 | return qApp->getCamera()->getMode() == CAMERA_MODE_INDEPENDENT ? 1 : 0; | ||
| 986 | }); | ||
| 965 | _applicationStateDevice->setInputVariant(STATE_SNAP_TURN, []() -> float { | 987 | _applicationStateDevice->setInputVariant(STATE_SNAP_TURN, []() -> float { |
| 966 | return qApp->getMyAvatar()->getSnapTurn() ? 1 : 0; | 988 | return qApp->getMyAvatar()->getSnapTurn() ? 1 : 0; |
| 967 | }); | 989 | }); |
| @@ -1212,6 +1234,17 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 244 unmodified lines | |||
| 1212 | connect(this, &Application::applicationStateChanged, this, &Application::activeChanged); | 1234 | connect(this, &Application::applicationStateChanged, this, &Application::activeChanged); |
| 1213 | qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0); | 1235 | qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0); |
| 1214 | 1236 | ||
| 1237 | auto textureCache = DependencyManager::get<TextureCache>(); | ||
| 1238 | |||
| 1239 | QString skyboxUrl { PathUtils::resourcesPath() + "images/Default-Sky-9-cubemap.jpg" }; | ||
| 1240 | QString skyboxAmbientUrl { PathUtils::resourcesPath() + "images/Default-Sky-9-ambient.jpg" }; | ||
| 1241 | |||
| 1242 | _defaultSkyboxTexture = textureCache->getImageTexture(skyboxUrl, NetworkTexture::CUBE_TEXTURE, { { "generateIrradiance", false } }); | ||
| 1243 | _defaultSkyboxAmbientTexture = textureCache->getImageTexture(skyboxAmbientUrl, NetworkTexture::CUBE_TEXTURE, { { "generateIrradiance", true } }); | ||
| 1244 | |||
| 1245 | _defaultSkybox->setCubemap(_defaultSkyboxTexture); | ||
| 1246 | _defaultSkybox->setColor({ 1.0, 1.0, 1.0 }); | ||
| 1247 | |||
| 1215 | // After all of the constructor is completed, then set firstRun to false. | 1248 | // After all of the constructor is completed, then set firstRun to false. |
| 1216 | Setting::Handle<bool> firstRun{ Settings::firstRun, true }; | 1249 | Setting::Handle<bool> firstRun{ Settings::firstRun, true }; |
| 1217 | firstRun.set(false); | 1250 | firstRun.set(false); |
| @@ -2282,7 +2315,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 1064 unmodified lines | |||
| 2282 | } | 2315 | } |
| 2283 | 2316 | ||
| 2284 | case Qt::Key_Asterisk: | 2317 | case Qt::Key_Asterisk: |
| 2285 | Menu::getInstance()->triggerOption(MenuOption::Stars); | 2318 | Menu::getInstance()->triggerOption(MenuOption::DefaultSkybox); |
| 2286 | break; | 2319 | break; |
| 2287 | 2320 | ||
| 2288 | case Qt::Key_S: | 2321 | case Qt::Key_S: |
| @@ -4217,8 +4250,6 @@ public: · 1928 unmodified lines | |||
| 4217 | typedef render::Payload<BackgroundRenderData> Payload; | 4250 | typedef render::Payload<BackgroundRenderData> Payload; |
| 4218 | typedef Payload::DataPointer Pointer; | 4251 | typedef Payload::DataPointer Pointer; |
| 4219 | 4252 | ||
| 4220 | Stars _stars; | ||
| 4221 | |||
| 4222 | static render::ItemID _item; // unique WorldBoxRenderData | 4253 | static render::ItemID _item; // unique WorldBoxRenderData |
| 4223 | }; | 4254 | }; |
| 4224 | 4255 | ||
| @@ -4253,15 +4284,26 @@ namespace render { · 28 unmodified lines | |||
| 4253 | 4284 | ||
| 4254 | // Fall through: if no skybox is available, render the SKY_DOME | 4285 | // Fall through: if no skybox is available, render the SKY_DOME |
| 4255 | case model::SunSkyStage::SKY_DOME: { | 4286 | case model::SunSkyStage::SKY_DOME: { |
| 4256 | if (Menu::getInstance()->isOptionChecked(MenuOption::Stars)) { | 4287 | if (Menu::getInstance()->isOptionChecked(MenuOption::DefaultSkybox)) { |
| 4257 | PerformanceTimer perfTimer("stars"); | 4288 | static const glm::vec3 DEFAULT_SKYBOX_COLOR { 255.0f / 255.0f, 220.0f / 255.0f, 194.0f / 255.0f }; |
| 4258 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), | 4289 | static const float DEFAULT_SKYBOX_INTENSITY { 0.2f }; |
| 4259 | "Application::payloadRender<BackgroundRenderData>() ... My god, it's full of stars..."); | 4290 | static const float DEFAULT_SKYBOX_AMBIENT_INTENSITY { 2.0f }; |
| 4260 | // should be the first rendering pass - w/o depth buffer / lighting | 4291 | static const glm::vec3 DEFAULT_SKYBOX_DIRECTION { 0.0f, 0.0f, -1.0f }; |
| 4261 | 4292 | ||
| 4262 | static const float alpha = 1.0f; | 4293 | auto scene = DependencyManager::get<SceneScriptingInterface>()->getStage(); |
| 4263 | background->_stars.render(args, alpha); | 4294 | auto sceneKeyLight = scene->getKeyLight(); |
| 4264 | } | 4295 | scene->setSunModelEnable(false); |
| 4296 | sceneKeyLight->setColor(DEFAULT_SKYBOX_COLOR); | ||
| 4297 | sceneKeyLight->setIntensity(DEFAULT_SKYBOX_INTENSITY); | ||
| 4298 | sceneKeyLight->setAmbientIntensity(DEFAULT_SKYBOX_AMBIENT_INTENSITY); | ||
| 4299 | sceneKeyLight->setDirection(DEFAULT_SKYBOX_DIRECTION); | ||
| 4300 | |||
| 4301 | auto defaultSkyboxAmbientTexture = qApp->getDefaultSkyboxAmbientTexture(); | ||
| 4302 | sceneKeyLight->setAmbientSphere(defaultSkyboxAmbientTexture->getIrradiance()); | ||
| 4303 | sceneKeyLight->setAmbientMap(defaultSkyboxAmbientTexture); | ||
| 4304 | |||
| 4305 | qApp->getDefaultSkybox()->render(batch, args->getViewFrustum()); | ||
| 4306 | } | ||
| 4265 | } | 4307 | } |
| 4266 | break; | 4308 | break; |
| 4267 | 4309 | ||
| @@ -4455,7 +4497,6 @@ void Application::updateWindowTitle() const { · 187 unmodified lines | |||
| 4455 | #endif | 4497 | #endif |
| 4456 | _window->setWindowTitle(title); | 4498 | _window->setWindowTitle(title); |
| 4457 | } | 4499 | } |
| 4458 | |||
| 4459 | void Application::clearDomainOctreeDetails() { | 4500 | void Application::clearDomainOctreeDetails() { |
| 4460 | 4501 | ||
| 4461 | // if we're about to quit, we really don't need to do any of these things... | 4502 | // if we're about to quit, we really don't need to do any of these things... |
| @@ -4481,6 +4522,7 @@ void Application::clearDomainOctreeDetails() { · 19 unmodified lines | |||
| 4481 | getEntities()->clear(); | 4522 | getEntities()->clear(); |
| 4482 | 4523 | ||
| 4483 | auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage(); | 4524 | auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage(); |
| 4525 | |||
| 4484 | skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME); | 4526 | skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME); |
| 4485 | 4527 | ||
| 4486 | _recentlyClearedDomain = true; | 4528 | _recentlyClearedDomain = true; |