Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix skybox reverting to non-void after exiting immersive theatre mode. #2606

Merged
merged 1 commit into from Jan 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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;
philip-lamb marked this conversation as resolved.
Show resolved Hide resolved
}
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