doxygen: intern/smoke tagged.
[blender.git] / intern / smoke / intern / WTURBULENCE.h
1 /** \file smoke/intern/WTURBULENCE.h
2  *  \ingroup smoke
3  */
4 //////////////////////////////////////////////////////////////////////
5 // This file is part of Wavelet Turbulence.
6 // 
7 // Wavelet Turbulence is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation, either version 3 of the License, or
10 // (at your option) any later version.
11 // 
12 // Wavelet Turbulence is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 // GNU General Public License for more details.
16 // 
17 // You should have received a copy of the GNU General Public License
18 // along with Wavelet Turbulence.  If not, see <http://www.gnu.org/licenses/>.
19 // 
20 // Copyright 2008 Theodore Kim and Nils Thuerey
21 // 
22 // WTURBULENCE handling
23 ///////////////////////////////////////////////////////////////////////////////////
24
25 #ifndef WTURBULENCE_H
26 #define WTURBULENCE_H
27
28 #include "VEC3.h"
29 using namespace BasicVector;
30 class SIMPLE_PARSER;
31
32 ///////////////////////////////////////////////////////////////////////////////
33 /// Main WTURBULENCE class, stores large density array etc.
34 ///////////////////////////////////////////////////////////////////////////////
35 class WTURBULENCE  
36 {
37         public:
38                 // both config files can be NULL, altCfg might override values from noiseCfg
39                 WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype);
40
41                 /// destructor
42                 virtual ~WTURBULENCE();
43                 
44                 void setNoise(int type);
45                 void initBlenderRNA(float *strength);
46
47                 // step more readable version -- no rotation correction
48                 void stepTurbulenceReadable(float dt, float* xvel, float* yvel, float* zvel, unsigned char *obstacles);
49
50                 // step more complete version -- include rotation correction
51                 // and use OpenMP if available
52                 void stepTurbulenceFull(float dt, float* xvel, float* yvel, float* zvel, unsigned char *obstacles);
53         
54                 // texcoord functions
55                 void advectTextureCoordinates(float dtOrg, float* xvel, float* yvel, float* zvel, float *tempBig1, float *tempBig2);
56                 void resetTextureCoordinates(float *_eigMin, float *_eigMax);
57
58                 void computeEnergy(float *energy, float* xvel, float* yvel, float* zvel, unsigned char *obstacles);
59
60                 // evaluate wavelet noise function
61                 Vec3 WVelocity(Vec3 p);
62                 Vec3 WVelocityWithJacobian(Vec3 p, float* xUnwarped, float* yUnwarped, float* zUnwarped);
63
64                 // access functions
65                 inline float* getDensityBig() { return _densityBig; }
66                 inline float* getArrayTcU() { return _tcU; }
67                 inline float* getArrayTcV() { return _tcV; }
68                 inline float* getArrayTcW() { return _tcW; }
69
70                 inline Vec3Int getResSm() { return _resSm; } // small resolution
71                 inline Vec3Int getResBig() { return _resBig; }
72                 inline int getOctaves() { return _octaves; }
73
74                 // is accessed on through rna gui
75                 float *_strength;
76
77         // protected:
78                 // enlargement factor from original velocity field / simulation
79                 // _Big = _amplify * _Sm
80                 int _amplify;
81                 int _octaves;
82                 
83                 // noise settings
84                 float _cullingThreshold;
85                 // float _noiseStrength;
86                 // float _noiseSizeScale;
87                 // bool _uvwAdvection;
88                 // bool _uvwReset;
89                 // float _noiseTimeanimSpeed;
90                 // int _dumpInterval;
91                 // nt _noiseControlType;
92                 // debug, scale density for projections output images
93                 // float _outputScale;
94
95                 // noise resolution
96                 int _xResBig;
97                 int _yResBig;
98                 int _zResBig;
99                 Vec3Int _resBig;
100                 Vec3 _invResBig;
101                 int _totalCellsBig;
102                 int _slabSizeBig;
103                 // original / small resolution
104                 int _xResSm;
105                 int _yResSm;
106                 int _zResSm;
107                 Vec3Int _resSm;
108                 Vec3 _invResSm;
109                 int _totalCellsSm;
110                 int _slabSizeSm;
111
112                 float* _densityBig;
113                 float* _densityBigOld;
114
115                 // texture coordinates for noise
116                 float* _tcU;
117                 float* _tcV;
118                 float* _tcW;
119                 float* _tcTemp;
120
121                 // noise data
122                 float* _noiseTile;
123                 //float* _noiseTileExt;
124
125                 // step counter
126                 int _totalStepsBig;
127                 
128                 void computeEigenvalues(float *_eigMin, float *_eigMax);
129                 void decomposeEnergy(float *energy, float *_highFreqEnergy);
130 };
131
132 #endif // WTURBULENCE_H
133