diff options
author | Sebastian Park <SebPark03@gmail.com> | 2024-04-25 03:39:49 -0400 |
---|---|---|
committer | Sebastian Park <SebPark03@gmail.com> | 2024-04-25 03:39:49 -0400 |
commit | 13d8a5ce616d67b01c6ed0becdde537474ba154e (patch) | |
tree | 4be53bf46e33fa742c8db93acdb35faadfabba69 /src | |
parent | 086fffe83539595c7ddefb7bcbe6cf15b9a63666 (diff) |
Michael Normal fixes and change reflection distances.
Diffstat (limited to 'src')
-rwxr-xr-x | src/glwidget.cpp | 2 | ||||
-rw-r--r-- | src/graphics/shape.cpp | 1 | ||||
-rw-r--r-- | src/ocean/ocean_alt.cpp | 9 |
3 files changed, 9 insertions, 3 deletions
diff --git a/src/glwidget.cpp b/src/glwidget.cpp index 7147e48..7d56389 100755 --- a/src/glwidget.cpp +++ b/src/glwidget.cpp @@ -64,7 +64,7 @@ void GLWidget::initializeGL() fprintf(stdout, "Successfully initialized GLEW %s\n", glewGetString(GLEW_VERSION)); // Set clear color to white - glClearColor(1, 1, 1, 1); + glClearColor(0, 0, 0, 1); // Enable depth-testing and backface culling glEnable(GL_DEPTH_TEST); diff --git a/src/graphics/shape.cpp b/src/graphics/shape.cpp index f983848..07af24a 100644 --- a/src/graphics/shape.cpp +++ b/src/graphics/shape.cpp @@ -147,6 +147,7 @@ void Shape::draw(Shader *shader, GLenum mode) // https://stackoverflow.com/questions/67277087/opengl-glsl-multiple-texture-binding-not-working // FIGURED OUT THE PROBLEM. it was that SAMPLERS WERE DEFAULTING TO SLOT 0 AND SETUNIFORM WASN'T WORKING // BECAUSE IT WAS CALLING SETUNIFORM WITH FREAKING FLOATS. WHAT THE FRICK C++. + // https://learnopengl.com/Getting-started/Textures glActiveTexture(GL_TEXTURE1); glBindTexture(GL_TEXTURE_2D, m_sky_texture); shader->setUniform("skySampler", 1); diff --git a/src/ocean/ocean_alt.cpp b/src/ocean/ocean_alt.cpp index dfb474c..b4052d6 100644 --- a/src/ocean/ocean_alt.cpp +++ b/src/ocean/ocean_alt.cpp @@ -110,7 +110,7 @@ void ocean_alt::fft_prime(double t){ Eigen::Vector2d k_normalized = k_vector.normalized(); m_displacements[i] += k_normalized*imag_comp; - m_slopes[i] += k_vector*imag_comp; + m_slopes[i] += -k_vector*imag_comp; } } @@ -271,7 +271,12 @@ std::vector<Eigen::Vector3f> ocean_alt::get_vertices() float zs = 1.f + s[2]*s[2]; Eigen::Vector3f diff = y - s; - Eigen::Vector3f norm = Eigen::Vector3f(diff[0]/ sqrt(xs), diff[1]/ sqrt(ys), diff[2]/sqrt(zs)); + // Eigen::Vector3f norm = Eigen::Vector3f(diff[0]/ sqrt(xs), diff[1]/ sqrt(ys), diff[2]/sqrt(zs)); + + // NEW + Eigen::Vector3f norm = Eigen::Vector3f(-slope[0], 1.0, -slope[1]); + norm.normalize(); + // NEW |