Draw glow before objects

Closes: #1339
translations_po-celestia-pot--master_be
Hleb Valoshka 2022-01-30 11:43:11 +02:00
parent a783eee8fe
commit cbdd9de63f
1 changed files with 3 additions and 17 deletions

View File

@ -1819,19 +1819,10 @@ void Renderer::renderObjectAsPoint(const Vector3f& position,
if (starStyle != PointStars) if (starStyle != PointStars)
gaussianDiscTex->bind(); gaussianDiscTex->bind();
bool centerCalculated = false;
Eigen::Vector3f center;
if (pointSize > gl::maxPointSize) if (pointSize > gl::maxPointSize)
{ renderLargePoint(*this, position, {color, alpha}, pointSize, mvp);
centerCalculated = true;
center = calculateQuadCenter(m_cameraOrientation, position, radius);
renderLargePoint(*this, center, {color, alpha}, pointSize, mvp);
}
else else
{
pointStarVertexBuffer->addStar(position, {color, alpha}, pointSize); pointStarVertexBuffer->addStar(position, {color, alpha}, pointSize);
}
// If the object is brighter than magnitude 1, add a halo around it to // If the object is brighter than magnitude 1, add a halo around it to
// make it appear more brilliant. This is a hack to compensate for the // make it appear more brilliant. This is a hack to compensate for the
@ -1841,17 +1832,12 @@ void Renderer::renderObjectAsPoint(const Vector3f& position,
// with halos. // with halos.
if (useHalos && glareAlpha > 0.0f) if (useHalos && glareAlpha > 0.0f)
{ {
Eigen::Vector3f center = calculateQuadCenter(m_cameraOrientation, position, radius);
gaussianGlareTex->bind(); gaussianGlareTex->bind();
if (glareSize > gl::maxPointSize) if (glareSize > gl::maxPointSize)
{
if (!centerCalculated)
center = calculateQuadCenter(m_cameraOrientation, position, radius);
renderLargePoint(*this, center, {color, glareAlpha}, glareSize, mvp); renderLargePoint(*this, center, {color, glareAlpha}, glareSize, mvp);
}
else else
{ glareVertexBuffer->addStar(center, {color, glareAlpha}, glareSize);
glareVertexBuffer->addStar(position, {color, glareAlpha}, glareSize);
}
} }
} }
} }