summaryrefslogtreecommitdiff
path: root/src/arap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/arap.cpp')
-rw-r--r--src/arap.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/src/arap.cpp b/src/arap.cpp
index 2e4532b..8d81337 100644
--- a/src/arap.cpp
+++ b/src/arap.cpp
@@ -34,10 +34,12 @@ void ARAP::init
// if (MeshLoader::loadTriMesh(m_mesh_path, vertices, triangles)) {
// m_shape.init(vertices, triangles);
// }
-
+ m_ocean.update_ocean();
vertices = m_ocean.get_vertices();
triangles = m_ocean.get_faces();
m_shape.init(vertices, triangles);
+ m_foam_shape.init(vertices, triangles);
+
m_shape.setColor(0.27f, .803f, .96f);
// Students, please don't touch this code: get min and max for viewport stuff
@@ -51,6 +53,18 @@ void ARAP::init
minCorner = coeffMin;
maxCorner = coeffMax;
+//
+ std::cout << "minCorner: " << minCorner << std::endl;
+ std::cout << "maxCorner: " << maxCorner << std::endl;
+//
+// minCorner = Vector3f(0.0f, 0.0f, 0.0f);
+// maxCorner = Vector3f(1.0f, 0.0f, 1.0f);
+//
+// std::cout << "minCorner: " << minCorner << std::endl;
+// std::cout << "maxCorner: " << maxCorner << std::endl;
+//
+// minCorner = Vector3f(-1.0f, -1.0f, -1.0f);
+// maxCorner = Vector3f(1.0f, 1.0f, 1.0f);
initCausticsShape(1000);
}
@@ -68,10 +82,24 @@ void ARAP::update(double seconds)
// Note that the "seconds" parameter represents the amount of time that has passed since
// the last update
+ m_ocean.fft_prime(m_time);
+ m_ocean.update_ocean();
+ m_shape.setVertices_and_Normals(m_ocean.get_vertices(), m_ocean.getNormals());
+ // m_shape.setVertices(m_ocean.get_vertices());
+
+// auto tmp = m_ocean.get_vertices();
+ // print the min and max of the vertices
+// Vector3f min = Vector3f::Ones() * 1000000;
+// Vector3f max = Vector3f::Ones() * -1000000;
+// for (int i = 0; i < tmp.size(); i++) {
+// min = min.cwiseMin(tmp[i]);
+// max = max.cwiseMax(tmp[i]);
+// }
+// std::cout << "min: " << min << std::endl;
+//std::cout << "max: " << max << std::endl;
- m_ocean.fft_prime(m_time);
-// m_shape.setVertices_and_Normals(m_ocean.get_vertices(), m_ocean.getNormals());
- m_shape.setVertices(m_ocean.get_vertices());
+ FoamConstants foam = m_ocean.getFoamConstants();
+ m_foam_shape.setFoamInputs(m_ocean.m_vertices, foam.wavelengths, foam.k_vectors, foam.texCoords);
m_time += m_timestep;