Fix display of surface features and diffuse objects

Surface features will be shown only if their parent body is visible.

Diffuse objects are shown always
pull/3/head
Hleb Valoshka 2019-04-30 22:00:24 +03:00
parent 920a0c81b1
commit 87963a6a42
1 changed files with 22 additions and 3 deletions

View File

@ -5803,6 +5803,27 @@ static float luminosityAtOpposition(float sunLuminosity,
}
static bool isBodyVisible(const Body* body, int bodyVisibilityMask)
{
int klass = body->getClassification();
switch (body->getClassification())
{
// Diffuse objects don't have controls to show/hide visibility
case Body::Diffuse:
return body->isVisible();
// SurfaceFeature inherits visibility of its parent body
case Body::SurfaceFeature:
assert(body->getSystem() != nullptr);
body = body->getSystem()->getPrimaryBody();
assert(body != nullptr);
return body->isVisible() && (bodyVisibilityMask & body->getClassification()) != 0;
default:
return body->isVisible() && (bodyVisibilityMask & klass) != 0;
}
}
void Renderer::addRenderListEntries(RenderListEntry& rle,
Body& body,
bool isLabeled)
@ -5978,10 +5999,8 @@ void Renderer::buildRenderLists(const Vector3d& astrocentricObserverPos,
bool visibleAsPoint = appMag < faintestPlanetMag && body->isVisibleAsPoint();
bool isLabeled = (body->getOrbitClassification() & labelClassMask) != 0;
bool visible = body->isVisible();
bool classVisible = (bodyVisibilityMask & body->getClassification()) != 0;
if ((discSize > 1 || visibleAsPoint || isLabeled) && visible && classVisible)
if ((discSize > 1 || visibleAsPoint || isLabeled) && isBodyVisible(body, bodyVisibilityMask))
{
RenderListEntry rle;