Skip to content

Commit

Permalink
Fix skybox reverting to non-void after exiting theatre mode. (#2606)
Browse files Browse the repository at this point in the history
  • Loading branch information
philip-lamb authored and bluemarvin committed Jan 10, 2020
1 parent 84a3a31 commit d5ce064
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions app/src/main/cpp/BrowserWorld.cpp
Expand Up @@ -1480,13 +1480,21 @@ BrowserWorld::CreateSkyBox(const std::string& aBasePath, const std::string& aExt
ASSERT_ON_RENDER_THREAD();
vrb::PausePerformanceMonitor pauseMonitor(*m.monitor);
const bool empty = aBasePath == "cubemap/void";
if (empty) {
if (m.skybox) {
VRLayerCubePtr layer = m.skybox->GetLayer();
if (layer) {
m.device->DeleteLayer(layer);
}
m.skybox->GetRoot()->RemoveFromParents();
m.skybox = nullptr;
}
return;
}
const std::string extension = aExtension.empty() ? ".ktx" : aExtension;
const GLenum glFormat = extension == ".ktx" ? GL_COMPRESSED_RGB8_ETC2 : GL_RGBA8;
const int32_t size = 1024;
if (m.skybox && empty) {
m.skybox->SetVisible(false);
return;
} else if (m.skybox) {
if (m.skybox) {
m.skybox->SetVisible(true);
if (m.skybox->GetLayer() && (m.skybox->GetLayer()->GetWidth() != size || m.skybox->GetLayer()->GetFormat() != glFormat)) {
VRLayerCubePtr oldLayer = m.skybox->GetLayer();
Expand All @@ -1495,8 +1503,7 @@ BrowserWorld::CreateSkyBox(const std::string& aBasePath, const std::string& aExt
m.device->DeleteLayer(oldLayer);
}
m.skybox->Load(m.loader, aBasePath, extension);
return;
} else if (!empty) {
} else {
VRLayerCubePtr layer = m.device->CreateLayerCube(size, size, glFormat);
m.skybox = Skybox::Create(m.create, layer);
m.rootOpaqueParent->AddNode(m.skybox->GetRoot());
Expand Down

0 comments on commit d5ce064

Please sign in to comment.