Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -164,6 +164,13 @@ extern "C" { · 163 unmodified lines | ||
| 164 | 164 | } |
| 165 | 165 | #endif |
| 166 | 166 | |
| 167 | +#include <procedural/ProceduralSkybox.h> | |
| 168 | +#include <model/Skybox.h> | |
| 169 | + | |
| 170 | +static model::Skybox* skybox{ new ProceduralSkybox() } ; | |
| 171 | +static NetworkTexturePointer skyboxTexture; | |
| 172 | +static bool skyboxTextureLoaded = false; | |
| 173 | + | |
| 167 | 174 | using namespace std; |
| 168 | 175 | |
| 169 | 176 | static QTimer locationUpdateTimer; |
| @@ -1212,6 +1219,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 1042 unmodified lines | ||
| 1212 | 1219 | connect(this, &Application::applicationStateChanged, this, &Application::activeChanged); |
| 1213 | 1220 | qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0); |
| 1214 | 1221 | |
| 1222 | + auto textureCache = DependencyManager::get<TextureCache>(); | |
| 1223 | + skyboxTexture = textureCache->getTexture(QUrl("https://hifi-public.s3.amazonaws.com/images/SkyboxTextures/FullMoon1024Compressed.jpg"), NetworkTexture::CUBE_TEXTURE); | |
| 1224 | + | |
| 1215 | 1225 | // After all of the constructor is completed, then set firstRun to false. |
| 1216 | 1226 | Setting::Handle<bool> firstRun{ Settings::firstRun, true }; |
| 1217 | 1227 | firstRun.set(false); |
| @@ -4241,6 +4251,7 @@ namespace render { · 3023 unmodified lines | ||
| 4241 | 4251 | |
| 4242 | 4252 | // Fall through: if no skybox is available, render the SKY_DOME |
| 4243 | 4253 | case model::SunSkyStage::SKY_DOME: { |
| 4254 | + /* | |
| 4244 | 4255 | if (Menu::getInstance()->isOptionChecked(MenuOption::Stars)) { |
| 4245 | 4256 | PerformanceTimer perfTimer("stars"); |
| 4246 | 4257 | PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), |
| @@ -4250,6 +4261,25 @@ namespace render { · 3 unmodified lines | ||
| 4250 | 4261 | static const float alpha = 1.0f; |
| 4251 | 4262 | background->_stars.render(args, alpha); |
| 4252 | 4263 | } |
| 4264 | + */ | |
| 4265 | + | |
| 4266 | + if (!skyboxTextureLoaded && skyboxTexture && skyboxTexture->isLoaded()) { | |
| 4267 | + skybox->setColor({ 1.0, 1.0, 1.0 }); | |
| 4268 | + skyboxTextureLoaded = true; | |
| 4269 | + auto texture = skyboxTexture->getGPUTexture(); | |
| 4270 | + if (texture) { | |
| 4271 | + skybox->setCubemap(texture); | |
| 4272 | + auto scene = DependencyManager::get<SceneScriptingInterface>()->getStage(); | |
| 4273 | + auto sceneKeyLight = scene->getKeyLight(); | |
| 4274 | + sceneKeyLight->setAmbientSphere(texture->getIrradiance()); | |
| 4275 | + sceneKeyLight->setAmbientMap(texture); | |
| 4276 | + } else { | |
| 4277 | + skybox->setCubemap(nullptr); | |
| 4278 | + } | |
| 4279 | + } | |
| 4280 | + if (skyboxTextureLoaded) { | |
| 4281 | + skybox->render(batch, args->getViewFrustum()); | |
| 4282 | + } | |
| 4253 | 4283 | } |
| 4254 | 4284 | break; |
| 4255 | 4285 | |
| @@ -4443,7 +4473,6 @@ void Application::updateWindowTitle() const { · 187 unmodified lines | ||
| 4443 | 4473 | #endif |
| 4444 | 4474 | _window->setWindowTitle(title); |
| 4445 | 4475 | } |
| 4446 | − | |
| 4447 | 4476 | void Application::clearDomainOctreeDetails() { |
| 4448 | 4477 | |
| 4449 | 4478 | // if we're about to quit, we really don't need to do any of these things... |
| @@ -4469,6 +4498,7 @@ void Application::clearDomainOctreeDetails() { · 19 unmodified lines | ||
| 4469 | 4498 | getEntities()->clear(); |
| 4470 | 4499 | |
| 4471 | 4500 | auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage(); |
| 4501 | + | |
| 4472 | 4502 | skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME); |
| 4473 | 4503 | |
| 4474 | 4504 | _recentlyClearedDomain = true; |