From 7a6ceadedc20f58b7be76654eb8357e3ca0b026d Mon Sep 17 00:00:00 2001 From: jjesswan Date: Mon, 6 May 2024 02:22:37 -0400 Subject: saving --- src/glwidget.cpp | 12 ++++++++---- src/glwidget.h | 2 ++ src/ocean/ocean_alt.cpp | 2 ++ src/ocean/ocean_alt.h | 7 +++---- 4 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/glwidget.cpp b/src/glwidget.cpp index f2a6d94..2805d3c 100755 --- a/src/glwidget.cpp +++ b/src/glwidget.cpp @@ -85,8 +85,8 @@ void GLWidget::initializeGL() m_colorShader = new Shader(":resources/shaders/color.vert", ":resources/shaders/color.frag"); m_foamShader = new Shader(":resources/shaders/foam.vert", ":resources/shaders/foam.frag"); - m_halftone_tex = loadTextureFromFile("/Users/jesswan/Desktop/cs2240/ocean-simulation/resources/images/sky_clouds.png").textureID; - + m_halftone_tex = loadTextureFromFile("/Users/jesswan/Desktop/cs2240/ocean-simulation/resources/images/halftone.png").textureID; + m_foam_tex = loadTextureFromFile("/Users/jesswan/Desktop/cs2240/ocean-simulation/resources/images/foam.png").textureID; @@ -361,6 +361,10 @@ void GLWidget::paintGL() glBindTexture(GL_TEXTURE_2D, m_halftone_tex); glUniform1i(glGetUniformLocation(m_foamShader->id(), "halftone_texture"), 5); + glActiveTexture(GL_TEXTURE6); + glBindTexture(GL_TEXTURE_2D, m_foam_tex); + glUniform1i(glGetUniformLocation(m_foamShader->id(), "foam_texture"), 6); + @@ -395,8 +399,8 @@ TextureData GLWidget::loadTextureFromFile(const char *path) glTexImage2D(GL_TEXTURE_2D, 0, format, width, height, 0, format, GL_UNSIGNED_BYTE, data); glGenerateMipmap(GL_TEXTURE_2D); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); diff --git a/src/glwidget.h b/src/glwidget.h index dc4ee78..42cfd83 100755 --- a/src/glwidget.h +++ b/src/glwidget.h @@ -91,6 +91,8 @@ private: // FOAM GLuint m_halftone_tex; + GLuint m_foam_tex; + // Timing QElapsedTimer m_deltaTimeProvider; // For measuring elapsed time diff --git a/src/ocean/ocean_alt.cpp b/src/ocean/ocean_alt.cpp index 9ba0042..8f46f1b 100644 --- a/src/ocean/ocean_alt.cpp +++ b/src/ocean/ocean_alt.cpp @@ -317,6 +317,8 @@ std::vector ocean_alt::get_vertices() vertices.push_back(Eigen::Vector3f(horiz_pos[0] + disp[0], height, horiz_pos[1] + disp[1])); m_normals[i] = norm.normalized();//Eigen::Vector3f(-slope[0], 1.0, -slope[1]).normalized(); //std::cout << "normal: " << m_normals[i] << std::endl + m_foam_constants.wavelengths[i] = 2.f *M_PI * m_slopes[i].dot(m_slopes[i]) / Lx; + //std::cout << m_foam_constants.wavelengths[i] << std::endl; diff --git a/src/ocean/ocean_alt.h b/src/ocean/ocean_alt.h index dc9bb33..41c99ba 100644 --- a/src/ocean/ocean_alt.h +++ b/src/ocean/ocean_alt.h @@ -78,11 +78,10 @@ private: const double Lx = 512.0; const double Lz = 512.0; - const int num_rows = 32; - const int num_cols = 32; - + const int num_rows = 64; + const int num_cols = 64; const int N = num_rows*num_cols; // total number of grid points - const double lambda = 0.3; // how much displacement matters + const double lambda = 0.4; // how much displacement matters const double spacing = 35.0; // spacing between grid points const double A = 100; // numeric constant for the Phillips spectrum -- cgit v1.2.3-70-g09d2