Skip to content

Commit 7d9332a

Browse files
committed
wip
1 parent 462c18d commit 7d9332a

File tree

9 files changed

+23
-30
lines changed

9 files changed

+23
-30
lines changed

src/celastro/astro.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,17 @@ irradianceToMag(float irradiance)
142142
float
143143
faintestMagToExposure(float faintestMag)
144144
{
145-
return std::exp(faintestMag / LN_MAG) * IRRADIATION_LIMIT;
145+
return std::exp(faintestMag / LN_MAG) * LOWEST_IRRADIATION;
146146
// slower solution:
147-
// return std::pow(10.0f, 0.4f * faintestMag) * IRRADIATION_LIMIT;
147+
// return std::pow(10.0f, 0.4f * faintestMag) * LOWEST_IRRADIATION;
148148
}
149149

150150
float
151151
exposureToFaintestMag(float exposure)
152152
{
153-
return std::log(exposure / IRRADIATION_LIMIT) * LN_MAG;
153+
return std::log(exposure / LOWEST_IRRADIATION) * LN_MAG;
154154
// equivalent solution:
155-
// return 2.5f * std::log10(exposure / IRRADIATION_LIMIT);
155+
// return 2.5f * std::log10(exposure / LOWEST_IRRADIATION);
156156
}
157157

158158

src/celastro/astro.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ constexpr inline float SOLAR_ABSMAG = 4.83f;
2929
constexpr inline float LN_MAG = 1.0857362f; // 5/ln(100)
3030

3131
// Lowest screen brightness of a point to render
32-
constexpr inline float IRRADIATION_LIMIT = 1.0f / 255.0f;
32+
constexpr inline float LOWEST_IRRADIATION = 1.0f / 255.0f;
3333
// = 1.0f / (255.0f * 12.92f); after implementing gamma correction
3434

3535
namespace detail

src/celengine/dsorenderer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,10 @@ void DSORenderer::process(DeepSkyObject* const &dso,
188188
}
189189

190190
float irradiationEff = astro::magToIrradiance(appMagEff) * exposure;
191-
if (irradiationEff > labelThresholdIrradiation)
191+
if (irradiationEff > labelLowestIrradiation)
192192
{
193193
// TODO: the label transparency is not tested, most likely need fixes
194-
float distr = std::min(1.0f, step * (irradiationEff - labelThresholdIrradiation) / labelThresholdIrradiation);
194+
float distr = std::min(1.0f, step * (irradiationEff - labelLowestIrradiation) / labelLowestIrradiation);
195195
labelColor.alpha(distr * labelColor.alpha());
196196

197197
renderer->addBackgroundAnnotation(rep,

src/celengine/objectrenderer.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ template <class OBJ, class PREC> class ObjectRenderer : public OctreeProcessor<O
2424
{
2525
};
2626

27-
const Observer* observer { nullptr };
28-
Renderer* renderer { nullptr };
27+
const Observer* observer { nullptr };
28+
Renderer* renderer { nullptr };
2929

30-
float pixelSize { 0.0f };
31-
float exposure { 0.0f };
32-
float distanceLimit { 0.0f };
30+
float pixelSize { 0.0f };
31+
float exposure { 0.0f };
32+
float distanceLimit { 0.0f };
3333

34-
// Objects with screen brightness higher than labelThresholdIrradiation will be labeled
35-
float labelThresholdIrradiation { 0.0f };
34+
// Objects with screen brightness higher than labelLowestIrradiation will be labeled
35+
float labelLowestIrradiation { 0.0f };
3636

37-
uint64_t renderFlags { 0 };
38-
int labelMode { 0 };
37+
uint64_t renderFlags { 0 };
38+
int labelMode { 0 };
3939
};

src/celengine/pointstarrenderer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,19 +98,19 @@ void PointStarRenderer::process(const Star& star, float distance, float irradian
9898
float irradiation = irradiance * exposure;
9999
if (distance > SolarSystemMaxDistance)
100100
{
101-
if (irradiation > astro::IRRADIATION_LIMIT)
101+
if (irradiation > astro::LOWEST_IRRADIATION)
102102
{
103103
starVertexBuffer->addStar(relPos, starColor, irradiation);
104104
}
105105

106106
// Place labels for stars brighter than the specified label threshold brightness
107-
if (((labelMode & Renderer::StarLabels) != 0) && irradiation > labelThresholdIrradiation)
107+
if (((labelMode & Renderer::StarLabels) != 0) && irradiation > labelLowestIrradiation)
108108
{
109109
Vector3f starDir = relPos.normalized();
110110
if (starDir.dot(viewNormal) > cosFOV)
111111
{
112112
// TODO: the label transparency is not tested, most likely need fixes
113-
float distr = min(1.0f, 3.5f * (irradiation - labelThresholdIrradiation)/labelThresholdIrradiation);
113+
float distr = min(1.0f, 3.5f * (irradiation - labelLowestIrradiation)/labelLowestIrradiation);
114114
Color color = Color(Renderer::StarLabelColor, distr * Renderer::StarLabelColor.alpha());
115115
renderer->addBackgroundAnnotation(nullptr,
116116
starDB->getStarName(star, true),

src/celengine/render.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3743,7 +3743,7 @@ void Renderer::renderPointStars(const StarDatabase& starDB,
37433743
// Original function
37443744
// float effDistanceToScreen = mmToInches((float) REF_DISTANCE_TO_SCREEN) * pixelSize * getScreenDpi(); // = 1.0 at startup
37453745
// starRenderer.labelThresholdMag = 1.2f * max(1.0f, (faintestMag - 4.0f) * (1.0f - 0.5f * std::log10(effDistanceToScreen)));
3746-
starRenderer.labelThresholdIrradiation = 1.0f; // refinement is needed
3746+
starRenderer.labelLowestIrradiation = 1.0f; // refinement is needed
37473747

37483748
starRenderer.colorTemp = &starColors;
37493749

@@ -3820,7 +3820,7 @@ void Renderer::renderDeepSkyObjects(const Universe& universe,
38203820
// Original function
38213821
// float effDistanceToScreen = mmToInches((float) REF_DISTANCE_TO_SCREEN) * pixelSize * getScreenDpi(); // = 1.0 at startup
38223822
// dsoRenderer.labelThresholdMag = 2.0f * max(1.0f, (faintestMag - 4.0f) * (1.0f - 0.5f * log10(effDistanceToScreen)));
3823-
dsoRenderer.labelThresholdIrradiation = 1.0f; // refinement is needed
3823+
dsoRenderer.labelLowestIrradiation = 1.0f; // refinement is needed
38243824

38253825
using namespace celestia;
38263826
galaxyRep = MarkerRepresentation(MarkerRepresentation::Triangle, 8.0f, GalaxyLabelColor);

src/celengine/render.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -572,13 +572,6 @@ class Renderer
572572
float discSizeInPixels,
573573
const Matrices&);
574574

575-
void calculatePointSize(float appMag,
576-
float size,
577-
float &discSize,
578-
float &alpha,
579-
float &glareSize,
580-
float &glareAlpha) const;
581-
582575
void renderObjectAsPoint(const Eigen::Vector3f& center,
583576
float radius,
584577
float appMag,

src/celengine/renderlistentry.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ struct RenderListEntry
4141
float nearZ;
4242
float farZ;
4343
float discSizeInPixels;
44-
float appMag;
44+
float irradiation;
4545
RenderableType renderableType;
4646
bool isOpaque;
4747
};

src/celengine/star.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,7 @@ Star::getIrradiance(float km) const
12241224
// extinction seems to be in a strange units, mag/ly is not used in astronomy
12251225
// it can be optimized later, with astro::absMagToIrradiance() that duplicates it, but with no extinction
12261226

1227-
float irradianceInSuns = std::exp((astro::SOLAR_ABSMAG - absMag - extinction * astro::kilometersToLightYears(km)) / astro::LN_MAG)
1227+
float irradianceInSuns = std::exp((astro::SOLAR_ABSMAG - absMag - extinction * astro::kilometersToLightYears(km)) / astro::LN_MAG);
12281228
return irradianceInSuns * astro::SOLAR_POWER / (math::sphereArea(km * 1000) * astro::VEGAN_IRRADIANCE);
12291229
}
12301230

0 commit comments

Comments
 (0)