17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-09 18:22:15 +01:00

opengl33renderer: Fix up the sizes of Sun and Moon

Although the used value makes some physical sense, it fails to take
FoV effect into account, leading to both Sun and Moon becoming
comically tiny. Revert the sizes to the ones used by the legacy
renderer, which makes them appear much more plausible.
This commit is contained in:
Sebastian Krzyszkowiak
2026-10-27 01:00:52 +01:00
parent 66a940d4f5
commit ba405858e1

View File

@@ -2028,12 +2028,12 @@ bool opengl33_renderer::Render(world_environment *Environment)
glm::vec4 color(suncolor.x, suncolor.y, suncolor.z, std::clamp(1.5f - Global.Overcast, 0.f, 1.f) * fogfactor);
auto const sunvector = Environment->m_sun.getDirection();
/*float const size = std::lerp( // TODO: expose distance/scale factor from the moon object
float const size = std::lerp( // TODO: expose distance/scale factor from the moon object
0.0325f,
0.0275f,
std::clamp( Environment->m_sun.getAngle(), 0.f, 90.f ) / 90.f );*/
std::clamp( Environment->m_sun.getAngle(), 0.f, 90.f ) / 90.f );
model_ubs.param[0] = color;
model_ubs.param[1] = glm::vec4(glm::vec3(modelview * glm::vec4(sunvector, 1.0f)), 0.00463f /* size */);
model_ubs.param[1] = glm::vec4(glm::vec3(modelview * glm::vec4(sunvector, 1.0f)), size);
model_ubs.param[2] = glm::vec4(0.0f, 1.0f, 1.0f, 0.0f);
model_ubo->update(model_ubs);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
@@ -2104,14 +2104,13 @@ bool opengl33_renderer::Render(world_environment *Environment)
moonu = 0.0f;
}
/*
float const size = std::lerp( // TODO: expose distance/scale factor from the moon object
0.0160f,
0.0135f,
std::clamp( Environment->m_moon.getAngle(), 0.f, 90.f ) / 90.f );*/
std::clamp( Environment->m_moon.getAngle(), 0.f, 90.f ) / 90.f );
model_ubs.param[0] = color;
model_ubs.param[1] = glm::vec4(glm::vec3(modelview * glm::vec4(moonvector, 1.0f)), 0.00451f /* size */);
model_ubs.param[1] = glm::vec4(glm::vec3(modelview * glm::vec4(moonvector, 1.0f)), size);
model_ubs.param[2] = glm::vec4(moonu, moonv, 0.333f, 0.0f);
model_ubo->update(model_ubs);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);