#include <GL/glut.h>
-WaterSurface::WaterSurface(int size, double unitLength) :
+WaterSurface::WaterSurface(int size, double extend) :
m_size{size},
- m_unitLength{unitLength}
+ m_extend{extend}
{
m_points.resize(size*size);
}
return m_size;
}
+double WaterSurface::extend() const
+{
+ return m_extend;
+}
+
void WaterSurface::draw() const
{
- glScalef(m_unitLength, m_unitLength, 1.0f);
+ const double scaleFactor{m_extend / m_size};
+
+ glScalef(scaleFactor, scaleFactor, 1.0f);
glTranslatef(-(float)(m_size - 1) / 2, -(float)(m_size - 1) / 2, 0);
for (int y = 0; y < m_size - 1; ++y) {