diff options
Diffstat (limited to 'src/arap.cpp')
-rw-r--r-- | src/arap.cpp | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/src/arap.cpp b/src/arap.cpp index ae7240d..b6f2f8c 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 @@ -49,8 +51,20 @@ void ARAP::init coeffMin = all_vertices.colwise().minCoeff(); coeffMax = all_vertices.colwise().maxCoeff(); - minCorner = coeffMin; - maxCorner = coeffMax; +// 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(10); } @@ -68,11 +82,25 @@ 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.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; + + FoamConstants foam = m_ocean.getFoamConstants(); + m_foam_shape.setFoamInputs(m_shape.getVertices(), foam.wavelengths, foam.k_vectors, foam.texCoords); + m_time += m_timestep; // std::cout << m_time << std::endl; |