diff options
Diffstat (limited to 'src/ocean/ocean_alt.h')
-rw-r--r-- | src/ocean/ocean_alt.h | 55 |
1 files changed, 39 insertions, 16 deletions
diff --git a/src/ocean/ocean_alt.h b/src/ocean/ocean_alt.h index 4bb1d54..9c5e4e2 100644 --- a/src/ocean/ocean_alt.h +++ b/src/ocean/ocean_alt.h @@ -20,16 +20,31 @@ struct WaveIndexConstant{ Eigen::Vector2d k_vector = Eigen::Vector2d(0.f, 0.f); // static horiz pos with no displacement }; +struct FoamConstants{ + std::vector<Eigen::Vector3f> positions; + std::vector<Eigen::Vector2f> k_vectors; + std::vector<float> wavelengths; + std::vector<Eigen::Vector2f> texCoords; +}; + class ocean_alt { public: ocean_alt(); void updateVertexAmplitudes(double t); + void update_ocean(); std::vector<Eigen::Vector3f> get_vertices(); std::vector<Eigen::Vector3i> get_faces(); void fft_prime(double t); std::vector<Eigen::Vector3f> getNormals(); + FoamConstants getFoamConstants(){ + return m_foam_constants; + } + + std::vector<Eigen::Vector3f> m_vertices; // current displacement vector for each K + + @@ -48,42 +63,50 @@ private: Eigen::Vector2d get_horiz_pos(int i); std::pair<double, double> sample_complex_gaussian(); - - - - - - - + // FOAM + std::vector<float> m_saturation; std::map<int, WaveIndexConstant> m_waveIndexConstants; // stores constants that only need to be calculate once for each grid constant - - const double Lx = 512.0; const double Lz = 512.0; const int num_rows = 256; const int num_cols = 256; + const int num_tiles_x = 1; + const int num_tiles_z = 1; + + const double vertex_displacement = Lx / 2; + const int N = num_rows*num_cols; // total number of grid points - const double lambda = 0; // how much displacement matters - const double spacing = 35.0; // spacing between grid points + const double lambda = .5; // how much displacement matters + const double spacing = 1.0; // spacing between grid points - const double A = 100; // numeric constant for the Phillips spectrum - const double V = 50; // wind speed + const double A = 10000; // numeric constant for the Phillips spectrum + const double V = 500; // wind speed const double gravity = 9.81; const double L = V*V/gravity; const Eigen::Vector2d omega_wind = Eigen::Vector2d(1.0, 0.0); // wind direction, used in Phillips equation std::vector<Eigen::Vector2d> m_current_h; // current height fields for each K - std::vector<Eigen::Vector2d> m_displacements; // current displacement vector for each K - std::vector<Eigen::Vector2d> m_slopes; // current displacement vector for each K + // std::vector<Eigen::Vector2d> m_displacements; // current displacement vector for each K + // std::vector<Eigen::Vector2d> m_slopes; // current displacement vector for each K + std::vector<Eigen::Vector2d> m_slopes_x; + std::vector<Eigen::Vector2d> m_slopes_z; + std::vector<Eigen::Vector2d> m_displacements_x; + std::vector<Eigen::Vector2d> m_displacements_z; //std::vector<Eigen::Vector3f> m_slope_vectors; // current displacement vector for each K - std::vector<Eigen::Vector3f> m_normals; // current displacement vector for each K + std::vector<Eigen::Vector3f> m_normals; // normal calculations + + // FOR FOAM: + FoamConstants m_foam_constants; + float max = 0; + float min = 0; + int iterations = 0; |