Ensure target and browser always are visible together by using the enabled flag

This commit is contained in:
Ylva Selling
2021-03-23 09:51:15 +01:00
parent fbc05244e1
commit 6ff0e6475a
2 changed files with 15 additions and 0 deletions
@@ -113,6 +113,13 @@ namespace openspace {
// The projection plane seems to be located at z = -2.1 so at that place the ScreenSpaceRenderables behaves like
// they are in screen space
_cartesianPosition.setValue(glm::vec3(_cartesianPosition.value().x, _cartesianPosition.value().y, -2.1f));
// Always make sure that the target and browser are visible together
_enabled.onChange([&]() {
if (_skyTarget) {
_skyTarget->property("Enabled")->set(_enabled.value());
}
});
}
bool ScreenSpaceSkyBrowser::initializeGL() {
@@ -92,8 +92,16 @@ namespace openspace {
identifier = makeUniqueIdentifier(identifier);
setIdentifier(identifier);
// Projection plane seems to be at -2.1. The browser is at -2.1 and the browser should have precedence over target
_cartesianPosition.setValue(glm::vec3(_cartesianPosition.value().x, _cartesianPosition.value().y, -2.11f));
// Always make sure that the target and browser are visible together
_enabled.onChange([&]() {
if (_skyBrowser) {
_skyBrowser->property("Enabled")->set(_enabled.value());
}
});
}
void ScreenSpaceSkyTarget::bindTexture() {