summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjjesswan <jessica_wan@brown.edu>2024-05-07 01:32:02 -0400
committerjjesswan <jessica_wan@brown.edu>2024-05-07 01:32:02 -0400
commitcb868acadcae4e3f497ecdabeca507f3e73e01c7 (patch)
treef7caa27311d6a7291be66cf98376223f7f283179 /src
parenteb8af873097ce73a22139db4924ebd41d766f011 (diff)
add more accurate foam height saturation, poppping bubble effect
Diffstat (limited to 'src')
-rwxr-xr-xsrc/glwidget.cpp2
-rw-r--r--src/ocean/ocean_alt.cpp6
-rw-r--r--src/ocean/ocean_alt.h6
3 files changed, 8 insertions, 6 deletions
diff --git a/src/glwidget.cpp b/src/glwidget.cpp
index 230eb3c..c3c525b 100755
--- a/src/glwidget.cpp
+++ b/src/glwidget.cpp
@@ -86,7 +86,7 @@ void GLWidget::initializeGL()
m_foamShader = new Shader(":resources/shaders/foam.vert", ":resources/shaders/foam.frag");
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/foam4.png").textureID;
+ m_foam_tex = loadTextureFromFile("/Users/jesswan/Desktop/cs2240/ocean-simulation/resources/images/foam3.png").textureID;
diff --git a/src/ocean/ocean_alt.cpp b/src/ocean/ocean_alt.cpp
index 5dcfd74..20c663c 100644
--- a/src/ocean/ocean_alt.cpp
+++ b/src/ocean/ocean_alt.cpp
@@ -332,10 +332,12 @@ std::vector<Eigen::Vector3f> ocean_alt::get_vertices()
// m_foam_constants.wavelengths[i] = 2.f* M_PI * m_slopes[i].dot(m_slopes[i]) / Lx;
- m_foam_constants.wavelengths[i] = ((height -200 ) / (1000.f -200 ));
+ float h_0 = m_waveIndexConstants[i].h0_prime[0]; // min*.2f;
+ float h_max = max*.01f; // the smaller the constant, the more foam there is
+ m_foam_constants.wavelengths[i] = (height - h_0 ) / (h_max - h_0);
// if (i < 5){
-// //std::cout << min << ", " << max << std::endl;
+// std::cout << h_0 << ", " << h_max << std::endl;
// std::cout << m_foam_constants.wavelengths[i] << std::endl;
// }
diff --git a/src/ocean/ocean_alt.h b/src/ocean/ocean_alt.h
index ad6e69e..219ad60 100644
--- a/src/ocean/ocean_alt.h
+++ b/src/ocean/ocean_alt.h
@@ -75,14 +75,14 @@ private:
- const double Lx = 512.0;
- const double Lz = 512.0;
+ const double Lx = 1024.0;
+ const double Lz = 1024.0;
const int num_rows = 256;
const int num_cols = 256;
const int N = num_rows*num_cols; // total number of grid points
const double lambda = 2.5; // how much displacement matters
- const double spacing = 75.0; // spacing between grid points
+ const double spacing = 25.0; // spacing between grid points
const double A = 200; // numeric constant for the Phillips spectrum
const double V = 200; // wind speed