]> git.mxchange.org Git - flightgear.git/blob - src/FDM/YASim/Turbulence.hpp
First cut at a turbulence model for YASim. It's a
[flightgear.git] / src / FDM / YASim / Turbulence.hpp
1 namespace yasim {
2
3 class Turbulence {
4 public:
5     Turbulence(int gens, int seed);
6     ~Turbulence();
7     void update(double dt, double rate);
8     void setMagnitude(double mag) { _mag = mag; }
9     void getTurbulence(double* loc, float* turbOut);
10
11 private:
12     unsigned int hashrand(unsigned int i);
13     float lattice(unsigned int x, unsigned int y);
14     float iturb(unsigned int x, unsigned int y);
15     float fturb(double a, double b);
16     void mkimg(float* buf, int sz);
17     float cubenorm(float x, float y, float z);
18     void turblut(int x, int y, float* out);
19
20     int _gens;
21     int _sz;
22     int _seed;
23
24     double _currTime;
25     double _mag;
26     float _x0, _x1, _y0, _y1, _z0, _z1;
27     unsigned char* _data;
28 };
29
30 }; // namespace yasim