Skip to content
Snippets Groups Projects
Commit 55e248f2 authored by Dethcrvsh's avatar Dethcrvsh
Browse files

removed scaling from normals

parent 898862cd
Branches
No related tags found
No related merge requests found
......@@ -24,7 +24,7 @@ struct Wave {
};
layout(std140) uniform WaveBuffer {
Wave waves[16];
Wave waves[64];
};
/* Get the offset for a single wave along the y-axis. */
......@@ -41,7 +41,7 @@ float get_gerstner_xz(Wave wave, float dir, float x, float z, float t) {
// float w = 2.0/wave.L;
float w = sqrt(g*(2*pi/wave.L));
float phase_const = wave.S * w;
float Q = 0.3/(w*wave.A*in_WavesNum);
float Q = 0.8/(w*wave.A*in_WavesNum);
return Q * wave.A * dir * cos(dot(normalize(wave.D) * w, vec2(x, z)) + t * phase_const);
}
......@@ -74,8 +74,7 @@ vec3 compute_normal(vec3 pos, float t) {
float offset_z = (get_waves(offset1, t) - get_waves(offset2, t)).z;
// Construct the normal using partial derivatives
float scale = 20.0; // TODO: Not here
return normalize(vec3(-offset_x * scale, 1.0, -offset_z * scale));
return normalize(vec3(-offset_x, 1.0, -offset_z));
}
void main(void)
......
......@@ -38,8 +38,8 @@ struct Surface : public Object {
char const* UNIFORM_BLOCK = "WaveBuffer";
static int const MAX_WAVES {16};
static constexpr float const MEDIAN_WAVELENGTH {2.6};
static constexpr float const MEDIAN_AMPLITUDE {0.002};
static constexpr float const MEDIAN_SPEED {0.3};
static constexpr float const MEDIAN_AMPLITUDE {0.006};
static constexpr float const MEDIAN_SPEED {0.6};
static constexpr float const MEDIAN_DIR {3.14/4.0};
struct Wave {
......@@ -56,7 +56,7 @@ struct Surface : public Object {
std::vector<Wave> waves {};
// Direction of the wind [0-2π]
float wind_dir {3.14/3.0};
float wind_dir {0.0};
Surface() = default;
......@@ -86,7 +86,7 @@ struct Surface : public Object {
rd_amplitude(rd),
rd_speed(rd),
{},
vec2(cos(dir), sin(dir))
vec2(cos(dir), sin(dir)),
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment