don't update rain during pause

This commit is contained in:
milek7
2018-10-18 22:46:51 +02:00
parent 1761f0b367
commit e3cfa2acbe
3 changed files with 11 additions and 4 deletions

View File

@@ -111,7 +111,7 @@ basic_precipitation::init() {
void
basic_precipitation::update() {
auto const timedelta { static_cast<float>( ( DebugModeFlag ? Timer::GetDeltaTime() : Timer::GetDeltaTime() ) ) };
auto const timedelta = Timer::GetDeltaTime();
if( timedelta == 0.0 ) { return; }

View File

@@ -2797,12 +2797,17 @@ void opengl_renderer::Render_precipitation()
::glRotated(roll, forward.x, 0.0, forward.z);
}
}
if (Global.Weather == "rain:")
if (!Global.iPause)
{
// oddly enough random streaks produce more natural looking rain than ones the eye can follow
::glRotated(Random() * 360, 0.0, 1.0, 0.0);
if (Global.Weather == "rain:")
// oddly enough random streaks produce more natural looking rain than ones the eye can follow
m_precipitationrotation = Random() * 360;
else
m_precipitationrotation = 0.0;
}
::glRotated(m_precipitationrotation, 0.0, 1.0, 0.0);
model_ubs.set_modelview(OpenGLMatrices.data(GL_MODELVIEW));
model_ubs.param[0] = interpolate(0.5f * (Global.DayLight.diffuse + Global.DayLight.ambient), colors::white, 0.5f * clamp<float>(Global.fLuminance, 0.f, 1.f));
model_ubs.param[1].x = simulation::Environment.m_precipitation.get_textureoffset();

View File

@@ -330,6 +330,8 @@ class opengl_renderer
GLuint m_gltimequery = 0;
GLuint64 m_gllasttime = 0;
double m_precipitationrotation;
glm::mat4 perspective_projection(float fov, float aspect, float z_near, float z_far);
glm::mat4 perpsective_frustumtest_projection(float fov, float aspect, float z_near, float z_far);
glm::mat4 ortho_projection(float left, float right, float bottom, float top, float z_near, float z_far);