16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 19:29:19 +02:00

reformat: set variables to constexpr where possible

This commit is contained in:
jerrrrycho
2026-07-04 06:16:13 +02:00
parent aeb800283c
commit 6fd1d6715b
64 changed files with 541 additions and 541 deletions

View File

@@ -129,8 +129,8 @@ void cMoon::move() {
m_body.oblecl = clamp_circular( 23.4393 - 3.563e-7 * daynumber );
// moon parameters
const double longascnode = clamp_circular( 125.1228 - 0.0529538083 * daynumber ); // N, degrees
double const inclination = 5.1454; // i, degrees
double const mndistance = 60.2666; // a, in earth radii
constexpr double inclination = 5.1454; // i, degrees
constexpr double mndistance = 60.2666; // a, in earth radii
// argument of perigee
double const perigeearg = clamp_circular( 318.0634 + 0.1643573223 * daynumber ); // w, degrees
// mean anomaly
@@ -279,7 +279,7 @@ void cMoon::irradiance() {
const double s2 = sin( degtorad * d2 );
m_body.erv += 0.000719*c2 + 0.000077*s2;
const double solcon = 1367.0; // Solar constant, 1367 W/sq m
constexpr double solcon = 1367.0; // Solar constant, 1367 W/sq m
m_body.coszen = cos( degtorad * m_body.zenref );
if( m_body.coszen > 0.0 ) {

View File

@@ -60,7 +60,7 @@ CSkyDome::~CSkyDome() {
void CSkyDome::Generate() {
// radius of dome
float const radius = 1.0f;
constexpr float radius = 1.0f;
float const offset = 0.1f * radius; // horizontal offset, a cheap way to prevent a gap between ground and horizon
// create geometry chunk
@@ -294,7 +294,7 @@ void CSkyDome::RebuildColors() {
color *= std::clamp( 1.0f - vertex.y * 0.75f, 0.0f, 1.f );
float const horizonboost = 1.5f + m_overcast;
float const horizonbandwidth = 0.2f; // boost tapers to 0 by ~11.5 degrees elevation
constexpr float horizonbandwidth = 0.2f; // boost tapers to 0 by ~11.5 degrees elevation
float const horizonband = std::clamp( 1.0f - vertex.y / horizonbandwidth, 0.0f, 1.0f );
color *= std::lerp( 1.0, horizonboost, horizonband );

View File

@@ -250,7 +250,7 @@ void cSun::irradiance() {
const double s2 = std::sin( glm::radians( d2 ) );
m_body.erv += 0.000719*c2 + 0.000077*s2;
const double solcon = 1367.0; // Solar constant, 1367 W/sq m
constexpr double solcon = 1367.0; // Solar constant, 1367 W/sq m
m_body.coszen = std::cos( glm::radians( m_body.zenref ) );
if( m_body.coszen > 0.0 ) {