4141#include " rectangle.h"
4242#include " framebuffer.h"
4343#include " planetgrid.h"
44- #include " pointstarvertexbuffer .h"
45- #include " pointstarrenderer .h"
44+ #include " starvertexbuffer .h"
45+ #include " starrenderer .h"
4646#include " orbitsampler.h"
4747#include " rendcontext.h"
4848#include " textlayout.h"
6060#include < celrender/boundariesrenderer.h>
6161#include < celrender/cometrenderer.h>
6262#include < celrender/eclipticlinerenderer.h>
63- #include < celrender/largestarrenderer.h>
6463#include < celrender/linerenderer.h>
6564#include < celrender/galaxyrenderer.h>
6665#include < celrender/globularrenderer.h>
@@ -233,7 +232,7 @@ Renderer::Renderer() :
233232#endif
234233 labelMode (NoLabels),
235234 renderFlags(DefaultRenderFlags),
236- pointStarVertexBuffer (nullptr ),
235+ starVertexBuffer (nullptr ),
237236 textureResolution(medres),
238237 frameCount(0 ),
239238 lastOrbitCacheFlush(0 ),
@@ -248,14 +247,13 @@ Renderer::Renderer() :
248247 m_eclipticLineRenderer(std::make_unique<EclipticLineRenderer>(*this )),
249248 m_galaxyRenderer(std::make_unique<GalaxyRenderer>(*this )),
250249 m_globularRenderer(std::make_unique<GlobularRenderer>(*this )),
251- m_largeStarRenderer(std::make_unique<LargeStarRenderer>(*this )),
252250 m_hollowMarkerRenderer(std::make_unique<LineRenderer>(*this , 1 .0f , LineRenderer::PrimType::Lines, LineRenderer::StorageType::Static)),
253251 m_nebulaRenderer(std::make_unique<NebulaRenderer>(*this )),
254252 m_openClusterRenderer(std::make_unique<OpenClusterRenderer>(*this )),
255253 m_ringRenderer(std::make_unique<RingRenderer>(*this )),
256254 m_skyGridRenderer(std::make_unique<SkyGridRenderer>(*this ))
257255{
258- pointStarVertexBuffer = new PointStarVertexBuffer (*this , 2048 );
256+ starVertexBuffer = new StarVertexBuffer (*this , 2048 );
259257
260258 for (int i = 0 ; i < (int ) FontCount; i++)
261259 {
@@ -267,7 +265,7 @@ Renderer::Renderer() :
267265
268266Renderer::~Renderer ()
269267{
270- delete pointStarVertexBuffer ;
268+ delete starVertexBuffer ;
271269 delete shaderManager;
272270
273271 m_atmosphereRenderer->deinitGL ();
@@ -1620,122 +1618,6 @@ calculateQuadCenter(const Eigen::Quaternionf &cameraOrientation,
16201618 return position + direction * (radius / (m * Vector3f::UnitZ ()).dot (direction));
16211619}
16221620
1623- void
1624- Renderer::calculatePointSize (float appMag,
1625- float size,
1626- float &discSize,
1627- float &alpha,
1628- float &glareSize,
1629- float &glareAlpha) const
1630- {
1631- alpha = std::max (0 .0f , (faintestMag - appMag) * brightnessScale + brightnessBias);
1632-
1633- discSize = size;
1634- if (starStyle == ScaledDiscStars)
1635- {
1636- if (alpha > 1 .0f )
1637- {
1638- float discScale = std::min (MaxScaledDiscStarSize, std::pow (2 .0f , 0 .3f * (satPoint - appMag)));
1639- discSize *= std::max (1 .0f , discScale);
1640-
1641- glareAlpha = std::min (0 .5f , discScale / 4 .0f );
1642- glareSize = discSize * 3 .0f ;
1643-
1644- alpha = 1 .0f ;
1645- }
1646- else
1647- {
1648- glareSize = glareAlpha = 0 .0f ;
1649- }
1650- }
1651- else
1652- {
1653- if (alpha > 1 .0f )
1654- {
1655- float discScale = std::min (100 .0f , satPoint - appMag + 2 .0f );
1656- glareAlpha = std::min (GlareOpacity, (discScale - 2 .0f ) / 4 .0f );
1657- glareSize = 2 .0f * discScale * size;
1658- alpha = 1 .0f ;
1659- }
1660- else
1661- {
1662- glareSize = glareAlpha = 0 .0f ;
1663- }
1664- }
1665- }
1666-
1667- // If the an object occupies a pixel or less of screen space, we don't
1668- // render its mesh at all and just display a starlike point instead.
1669- // Switching between the particle and mesh renderings of an object is
1670- // jarring, however . . . so we'll blend in the particle view of the
1671- // object to smooth things out, making it dimmer as the disc size exceeds the
1672- // max disc size.
1673- void Renderer::renderObjectAsPoint (const Vector3f& position,
1674- float radius,
1675- float appMag,
1676- float discSizeInPixels,
1677- const Color &color,
1678- bool useHalos,
1679- bool emissive,
1680- const Matrices &mvp)
1681- {
1682- const bool useScaledDiscs = starStyle == ScaledDiscStars;
1683- float maxDiscSize = useScaledDiscs ? MaxScaledDiscStarSize : 1 .0f ;
1684- float maxBlendDiscSize = maxDiscSize + 3 .0f ;
1685-
1686- if (discSizeInPixels < maxBlendDiscSize || useHalos)
1687- {
1688- float fade = 1 .0f ;
1689- if (discSizeInPixels > maxDiscSize)
1690- {
1691- fade = std::min (1 .0f , (maxBlendDiscSize - discSizeInPixels) /
1692- (maxBlendDiscSize - maxDiscSize));
1693- }
1694-
1695- float scale = static_cast <float >(screenDpi) / 96 .0f ;
1696- float pointSize, alpha, glareSize, glareAlpha;
1697- calculatePointSize (appMag, BaseStarDiscSize * scale, pointSize, alpha, glareSize, glareAlpha);
1698-
1699- if (useScaledDiscs && discSizeInPixels > MaxScaledDiscStarSize)
1700- glareAlpha = std::min (glareAlpha, (MaxScaledDiscStarSize - discSizeInPixels) / MaxScaledDiscStarSize + 1 .0f );
1701-
1702- alpha *= fade;
1703- if (!emissive)
1704- glareAlpha *= fade;
1705-
1706- if (glareSize != 0 .0f )
1707- glareSize = std::max (glareSize, pointSize * discSizeInPixels / scale * 3 .0f );
1708-
1709- Renderer::PipelineState ps;
1710- ps.blending = true ;
1711- ps.blendFunc = {GL_SRC_ALPHA, GL_ONE};
1712- ps.depthTest = true ;
1713- setPipelineState (ps);
1714-
1715- if (starStyle != PointStars)
1716- gaussianDiscTex->bind ();
1717-
1718- if (pointSize > gl::maxPointSize)
1719- m_largeStarRenderer->render (position, {color, alpha}, pointSize, mvp);
1720- else
1721- pointStarVertexBuffer->addStar (position, {color, alpha}, pointSize);
1722-
1723- // If the object is brighter than magnitude 1, add a halo around it to
1724- // make it appear more brilliant. This is a hack to compensate for the
1725- // limited dynamic range of monitors.
1726- //
1727- // TODO: Stars look fine but planets look unrealistically bright
1728- // with halos.
1729- if (useHalos && glareAlpha > 0 .0f )
1730- {
1731- Eigen::Vector3f center = calculateQuadCenter (getCameraOrientationf (), position, radius);
1732- gaussianGlareTex->bind ();
1733- if (glareSize > gl::maxPointSize)
1734- m_largeStarRenderer->render (center, {color, glareAlpha}, glareSize, mvp);
1735- }
1736- }
1737- }
1738-
17391621
17401622static void renderSphereUnlit (const RenderInfo& ri,
17411623 const math::Frustum& frustum,
@@ -2662,7 +2544,7 @@ void Renderer::renderPlanet(Body& body,
26622544 float discSizeInPixels = body.getRadius () /
26632545 (max (nearPlaneDistance, altitude) * pixelSize);
26642546
2665- float maxDiscSize = (starStyle == ScaledDiscStars) ? MaxScaledDiscStarSize : 1 .0f ;
2547+ float maxDiscSize = 1 .0f ;
26662548 if (discSizeInPixels >= maxDiscSize && body.hasVisibleGeometry ())
26672549 {
26682550 auto bodyFeaturesManager = GetBodyFeaturesManager ();
@@ -3711,24 +3593,17 @@ void Renderer::renderPointStars(const StarDatabase& starDB,
37113593 float exposure,
37123594 const Observer& observer)
37133595{
3714- #ifndef GL_ES
3715- // Disable multisample rendering when drawing point stars
3716- bool toggleAA = (starStyle == Renderer::PointStars && isMSAAEnabled ());
3717- if (toggleAA)
3718- disableMSAA ();
3719- #endif
3720-
37213596 Vector3d obsPos = observer.getPosition ().toLy ();
37223597
3723- PointStarRenderer starRenderer;
3598+ StarRenderer starRenderer;
37243599
37253600 starRenderer.renderer = this ;
37263601 starRenderer.starDB = &starDB;
37273602 starRenderer.observer = &observer;
37283603 starRenderer.obsPos = obsPos;
37293604 starRenderer.viewNormal = getCameraOrientationf ().conjugate () * -Vector3f::UnitZ ();
37303605 starRenderer.renderList = &renderList;
3731- starRenderer.starVertexBuffer = pointStarVertexBuffer ;
3606+ starRenderer.starVertexBuffer = starVertexBuffer ;
37323607 starRenderer.cosFOV = std::cos (math::degToRad (calcMaxFOV (fov, getAspectRatio ())) / 2 .0f );
37333608
37343609 starRenderer.pixelSize = pixelSize;
@@ -3745,11 +3620,8 @@ void Renderer::renderPointStars(const StarDatabase& starDB,
37453620 starRenderer.starVertexBuffer ->setTexture (gaussianDiscTex);
37463621 starRenderer.starVertexBuffer ->setPointScale (screenDpi / 96 .0f );
37473622
3748- PointStarVertexBuffer::enable ();
3749- if (starStyle == PointStars)
3750- starRenderer.starVertexBuffer ->startBasicPoints ();
3751- else
3752- starRenderer.starVertexBuffer ->startSprites ();
3623+ StarVertexBuffer::enable ();
3624+ starRenderer.starVertexBuffer ->startSprites ();
37533625
37543626 Renderer::PipelineState ps;
37553627 ps.blending = true ;
@@ -3764,7 +3636,7 @@ void Renderer::renderPointStars(const StarDatabase& starDB,
37643636 astro::exposureToFaintestMag (exposure));
37653637
37663638 starRenderer.starVertexBuffer ->finish ();
3767- PointStarVertexBuffer ::disable ();
3639+ StarVertexBuffer ::disable ();
37683640
37693641#ifndef GL_ES
37703642 if (toggleAA)
@@ -4211,19 +4083,6 @@ void Renderer::markersToAnnotations(const celestia::MarkerList& markers,
42114083}
42124084
42134085
4214- void Renderer::setStarStyle (StarStyle style)
4215- {
4216- starStyle = style;
4217- markSettingsChanged ();
4218- }
4219-
4220-
4221- Renderer::StarStyle Renderer::getStarStyle () const
4222- {
4223- return starStyle;
4224- }
4225-
4226-
42274086void Renderer::loadTextures (Body* body)
42284087{
42294088 Surface& surface = body->getSurface ();
@@ -5219,14 +5078,14 @@ Renderer::renderSolarSystemObjects(const Observer &observer,
52195078 ps.depthTest = true ;
52205079 setPipelineState (ps);
52215080
5222- PointStarVertexBuffer ::enable ();
5081+ StarVertexBuffer ::enable ();
52235082 if (starStyle == PointStars)
5224- pointStarVertexBuffer ->startBasicPoints ();
5083+ starVertexBuffer ->startBasicPoints ();
52255084 else
5226- pointStarVertexBuffer ->startSprites ();
5227- pointStarVertexBuffer ->render ();
5228- pointStarVertexBuffer ->finish ();
5229- PointStarVertexBuffer ::disable ();
5085+ starVertexBuffer ->startSprites ();
5086+ starVertexBuffer ->render ();
5087+ starVertexBuffer ->finish ();
5088+ StarVertexBuffer ::disable ();
52305089
52315090 // Render annotations in this interval
52325091 annotation = renderSortedAnnotations (annotation,
0 commit comments