mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 02:57:10 +02:00
Add default skybox
This commit is contained in:
parent
55c690d016
commit
35ea9908cd
2 changed files with 31 additions and 2 deletions
|
@ -164,6 +164,13 @@ extern "C" {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <procedural/ProceduralSkybox.h>
|
||||||
|
#include <model/Skybox.h>
|
||||||
|
|
||||||
|
static model::Skybox* skybox{ new ProceduralSkybox() } ;
|
||||||
|
static NetworkTexturePointer skyboxTexture;
|
||||||
|
static bool skyboxTextureLoaded = false;
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
static QTimer locationUpdateTimer;
|
static QTimer locationUpdateTimer;
|
||||||
|
@ -1212,6 +1219,9 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
||||||
connect(this, &Application::applicationStateChanged, this, &Application::activeChanged);
|
connect(this, &Application::applicationStateChanged, this, &Application::activeChanged);
|
||||||
qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0);
|
qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0);
|
||||||
|
|
||||||
|
auto textureCache = DependencyManager::get<TextureCache>();
|
||||||
|
skyboxTexture = textureCache->getTexture(QUrl("https://hifi-public.s3.amazonaws.com/images/SkyboxTextures/FullMoon1024Compressed.jpg"), NetworkTexture::CUBE_TEXTURE);
|
||||||
|
|
||||||
// After all of the constructor is completed, then set firstRun to false.
|
// After all of the constructor is completed, then set firstRun to false.
|
||||||
Setting::Handle<bool> firstRun{ Settings::firstRun, true };
|
Setting::Handle<bool> firstRun{ Settings::firstRun, true };
|
||||||
firstRun.set(false);
|
firstRun.set(false);
|
||||||
|
@ -4241,6 +4251,7 @@ namespace render {
|
||||||
|
|
||||||
// Fall through: if no skybox is available, render the SKY_DOME
|
// Fall through: if no skybox is available, render the SKY_DOME
|
||||||
case model::SunSkyStage::SKY_DOME: {
|
case model::SunSkyStage::SKY_DOME: {
|
||||||
|
/*
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::Stars)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::Stars)) {
|
||||||
PerformanceTimer perfTimer("stars");
|
PerformanceTimer perfTimer("stars");
|
||||||
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
|
PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
|
||||||
|
@ -4250,6 +4261,25 @@ namespace render {
|
||||||
static const float alpha = 1.0f;
|
static const float alpha = 1.0f;
|
||||||
background->_stars.render(args, alpha);
|
background->_stars.render(args, alpha);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (!skyboxTextureLoaded && skyboxTexture && skyboxTexture->isLoaded()) {
|
||||||
|
skybox->setColor({ 1.0, 1.0, 1.0 });
|
||||||
|
skyboxTextureLoaded = true;
|
||||||
|
auto texture = skyboxTexture->getGPUTexture();
|
||||||
|
if (texture) {
|
||||||
|
skybox->setCubemap(texture);
|
||||||
|
auto scene = DependencyManager::get<SceneScriptingInterface>()->getStage();
|
||||||
|
auto sceneKeyLight = scene->getKeyLight();
|
||||||
|
sceneKeyLight->setAmbientSphere(texture->getIrradiance());
|
||||||
|
sceneKeyLight->setAmbientMap(texture);
|
||||||
|
} else {
|
||||||
|
skybox->setCubemap(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (skyboxTextureLoaded) {
|
||||||
|
skybox->render(batch, args->getViewFrustum());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -4443,7 +4473,6 @@ void Application::updateWindowTitle() const {
|
||||||
#endif
|
#endif
|
||||||
_window->setWindowTitle(title);
|
_window->setWindowTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::clearDomainOctreeDetails() {
|
void Application::clearDomainOctreeDetails() {
|
||||||
|
|
||||||
// if we're about to quit, we really don't need to do any of these things...
|
// if we're about to quit, we really don't need to do any of these things...
|
||||||
|
@ -4469,6 +4498,7 @@ void Application::clearDomainOctreeDetails() {
|
||||||
getEntities()->clear();
|
getEntities()->clear();
|
||||||
|
|
||||||
auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
|
auto skyStage = DependencyManager::get<SceneScriptingInterface>()->getSkyStage();
|
||||||
|
|
||||||
skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME);
|
skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME);
|
||||||
|
|
||||||
_recentlyClearedDomain = true;
|
_recentlyClearedDomain = true;
|
||||||
|
|
|
@ -375,7 +375,6 @@ void EntityTreeRenderer::applyZonePropertiesToScene(std::shared_ptr<ZoneEntityIt
|
||||||
}
|
}
|
||||||
|
|
||||||
skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME); // let the application background through
|
skyStage->setBackgroundMode(model::SunSkyStage::SKY_DOME); // let the application background through
|
||||||
|
|
||||||
return; // Early exit
|
return; // Early exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue