Skip to content

Commit 7719c66

Browse files
committed
(semi)fixes
1 parent 2bd203f commit 7719c66

File tree

5 files changed

+22
-18
lines changed

5 files changed

+22
-18
lines changed

shaders/star_vert.glsl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// star_frag.glsl
1+
// star_vert.glsl
22
//
33
// Copyright (C) 2023-present, the Celestia Development Team
44
// Original rendering algorithm by Askaniy Anpilogov <[email protected]>
@@ -9,6 +9,8 @@
99
// as published by the Free Software Foundation; either version 2
1010
// of the License, or (at your option) any later version.
1111

12+
const float a = 0.123; // empirical constant
13+
1214
const float degree_per_px = 0.01; // higher value causes blinking due to optimizations in the psf_glow()
1315
const float max_square_size = 256.0; // px
1416
const float max_irradiation = pow((degree_per_px * max_square_size / a), 2.0) / (2.0 * 3.141592653);

src/celengine/render.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,7 +1645,7 @@ static void renderSphereUnlit(const RenderInfo& ri,
16451645
textures.push_back(ri.overlayTex);
16461646
}
16471647
if (ri.isStar)
1648-
shadprop.lightModel = ShaderProperties::StarModel;
1648+
shadprop.lightModel = LightingModel::StarModel;
16491649

16501650
// Get a shader for the current rendering configuration
16511651
auto* prog = r->getShaderManager().getShader(shadprop);
@@ -2791,12 +2791,14 @@ void Renderer::renderPlanet(Body& body,
27912791
{
27922792
if (float maxCoeff = body.getSurface().color.toVector3().maxCoeff(); maxCoeff > 0.0f) // ignore [ 0 0 0 ]; used by old addons to make objects not get rendered as point
27932793
{
2794+
#if 0
27942795
renderObjectAsPoint(pos,
27952796
body.getRadius(),
27962797
appMag,
27972798
discSizeInPixels,
27982799
body.getSurface().color * (1.0f / maxCoeff), // normalize point color; 'darkness' is handled by size of point determined by GeomAlbedo.
27992800
false, false, m);
2801+
#endif
28002802
}
28012803
}
28022804
}
@@ -2851,13 +2853,15 @@ void Renderer::renderStar(const Star& star,
28512853
rp, LightingState(), m);
28522854
}
28532855

2856+
#if 0
28542857
renderObjectAsPoint(pos,
28552858
star.getRadius(),
28562859
appMag,
28572860
discSizeInPixels,
28582861
color,
28592862
star.hasCorona(), true,
28602863
m);
2864+
#endif
28612865
}
28622866

28632867

@@ -3166,7 +3170,7 @@ void Renderer::buildRenderLists(const Vector3d& astrocentricObserverPos,
31663170
// Compute the irradiance
31673171
// Instead of summing the reflected light from all nearby stars,
31683172
// we just consider the one with the highest irradiance.
3169-
float irradiance = 1.175494e-38f; // minimum positive float value
3173+
float irradiance = std::numeric_limits<float>::min();
31703174
for (const auto &lightSource : lightSourceList)
31713175
{
31723176
Eigen::Vector3d sunPos = pos_v - lightSource.position;
@@ -3183,7 +3187,7 @@ void Renderer::buildRenderLists(const Vector3d& astrocentricObserverPos,
31833187
rle.position = pos_v.cast<float>();
31843188
rle.distance = (float) dist_v;
31853189
rle.centerZ = pos_v.cast<float>().dot(viewMatZ);
3186-
rle.irradiation = irradiation;
3190+
rle.irradiation = irradiance;
31873191
rle.discSizeInPixels = body->getRadius() / ((float) dist_v * pixelSize);
31883192

31893193
// TODO: Remove this. It's only used in two places: for calculating comet tail
@@ -3625,11 +3629,6 @@ void Renderer::renderStars(const StarDatabase& starDB,
36253629

36263630
starRenderer.starVertexBuffer->finish();
36273631
StarVertexBuffer::disable();
3628-
3629-
#ifndef GL_ES
3630-
if (toggleAA)
3631-
enableMSAA();
3632-
#endif
36333632
}
36343633

36353634
void Renderer::renderDeepSkyObjects(const Universe& universe,

src/celengine/renderinfo.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class Texture;
2323
struct RenderInfo
2424
{
2525
Eigen::Quaternionf orientation{ Eigen::Quaternionf::Identity() };
26-
Color color{ 1.0f, 1.0f, 1.0f };
2726
Texture* baseTex{ nullptr };
2827
Texture* bumpTex{ nullptr };
2928
Texture* nightTex{ nullptr };

src/celengine/shadermanager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2094,7 +2094,7 @@ ShaderManager::buildFragmentShader(const ShaderProperties& props)
20942094
}
20952095

20962096
// Include the effect of limb darkening.
2097-
if (props.lightModel == ShaderProperties::StarModel)
2097+
if (props.lightModel == LightingModel::StarModel)
20982098
{
20992099
source += "gl_FragColor.rgb = gl_FragColor.rgb - vec3(1.0 - NV) * vec3(0.56, 0.61, 0.72);\n";
21002100
}

src/celestia/celestiacore.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,15 +1467,19 @@ void CelestiaCore::charEntered(const char *c_p, int modifiers)
14671467
break;
14681468

14691469
case '[':
1470-
setExposure(sim->getExposure() * 0.5);
1471-
auto buf = fmt::format(loc, _("Exposure time: {:.2f}"), sim->getExposure());
1472-
flash(buf);
1470+
{
1471+
setExposure(sim->getExposure() * 0.5);
1472+
auto buf = fmt::format(loc, _("Exposure time: {:.2f}"), sim->getExposure());
1473+
flash(buf);
1474+
}
14731475
break;
14741476

14751477
case ']':
1476-
setExposure(sim->getExposure() * 2.0);
1477-
auto buf = fmt::format(loc, _("Exposure time: {:.2f}"), sim->getExposure());
1478-
flash(buf);
1478+
{
1479+
setExposure(sim->getExposure() * 2.0);
1480+
auto buf = fmt::format(loc, _("Exposure time: {:.2f}"), sim->getExposure());
1481+
flash(buf);
1482+
}
14791483
break;
14801484

14811485
case '\\':
@@ -2459,7 +2463,7 @@ bool CelestiaCore::initSimulation(const fs::path& configFileName,
24592463
set_or_unset(interactionFlags, InteractionFlags::FocusZooming, config->mouse.focusZooming);
24602464

24612465
sim = new Simulation(universe);
2462-
sim->setExposure(config->renderDetails.Exposure);
2466+
sim->setExposure(config->renderDetails.exposure);
24632467

24642468
viewManager = std::make_unique<ViewManager>(new View(View::ViewWindow, sim->getActiveObserver(), 0.0f, 0.0f, 1.0f, 1.0f));
24652469

0 commit comments

Comments
 (0)