From 948207caffb5d425a76499d286afa36f8e2fb7cc Mon Sep 17 00:00:00 2001 From: tritonas00 Date: Mon, 21 Jun 2021 17:12:05 +0300 Subject: [PATCH] moved m_waves_height in more proper place --- source/main/gfx/Water.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/main/gfx/Water.cpp b/source/main/gfx/Water.cpp index 9442878477..9b94834bac 100644 --- a/source/main/gfx/Water.cpp +++ b/source/main/gfx/Water.cpp @@ -538,7 +538,7 @@ float Water::CalcWavesHeight(Vector3 pos) { // calculate the amplitude that this wave will have. wavetrains[i].amplitude is read from the config // upper limit: prevent too big waves by setting an upper limit - float amp = std::min(m_wavetrain_defs[i].amplitude * (waveheight + m_waves_height), m_wavetrain_defs[i].maxheight); + float amp = std::min(m_wavetrain_defs[i].amplitude * waveheight, m_wavetrain_defs[i].maxheight); // now the main thing: // calculate the sinus with the values of the config file and add it to the result result += amp * sin(Math::TWO_PI * ((time_sec * m_wavetrain_defs[i].wavespeed + m_wavetrain_defs[i].dir_sin * pos.x + m_wavetrain_defs[i].dir_cos * pos.z) / m_wavetrain_defs[i].wavelength)); @@ -652,6 +652,7 @@ float Water::GetWaveHeight(Vector3 pos) // (mapsize.z * m_waterplane_mesh_scale) / 2 = terrain height / 2 // calculate distance to the center of the terrain and divide by 3.000.000 float waveheight = (pos - Vector3((m_map_size.x * m_waterplane_mesh_scale) * 0.5, m_water_height, (m_map_size.z * m_waterplane_mesh_scale) * 0.5)).squaredLength() / 3000000.0; + waveheight += m_waves_height; return waveheight; }