Blender V2.61 - r43446

WTURBULENCE.h

Go to the documentation of this file.
00001 
00004 
00005 // This file is part of Wavelet Turbulence.
00006 // 
00007 // Wavelet Turbulence is free software: you can redistribute it and/or modify
00008 // it under the terms of the GNU General Public License as published by
00009 // the Free Software Foundation, either version 3 of the License, or
00010 // (at your option) any later version.
00011 // 
00012 // Wavelet Turbulence is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 // 
00017 // You should have received a copy of the GNU General Public License
00018 // along with Wavelet Turbulence.  If not, see <http://www.gnu.org/licenses/>.
00019 // 
00020 // Copyright 2008 Theodore Kim and Nils Thuerey
00021 // 
00022 // WTURBULENCE handling
00024 
00025 #ifndef WTURBULENCE_H
00026 #define WTURBULENCE_H
00027 
00028 #include "VEC3.h"
00029 using namespace BasicVector;
00030 class SIMPLE_PARSER;
00031 
00035 class WTURBULENCE  
00036 {
00037     public:
00038         // both config files can be NULL, altCfg might override values from noiseCfg
00039         WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype);
00040 
00042         virtual ~WTURBULENCE();
00043         
00044         void setNoise(int type);
00045         void initBlenderRNA(float *strength);
00046 
00047         // step more readable version -- no rotation correction
00048         void stepTurbulenceReadable(float dt, float* xvel, float* yvel, float* zvel, unsigned char *obstacles);
00049 
00050         // step more complete version -- include rotation correction
00051         // and use OpenMP if available
00052         void stepTurbulenceFull(float dt, float* xvel, float* yvel, float* zvel, unsigned char *obstacles);
00053     
00054         // texcoord functions
00055         void advectTextureCoordinates(float dtOrg, float* xvel, float* yvel, float* zvel, float *tempBig1, float *tempBig2);
00056         void resetTextureCoordinates(float *_eigMin, float *_eigMax);
00057 
00058         void computeEnergy(float *energy, float* xvel, float* yvel, float* zvel, unsigned char *obstacles);
00059 
00060         // evaluate wavelet noise function
00061         Vec3 WVelocity(Vec3 p);
00062         Vec3 WVelocityWithJacobian(Vec3 p, float* xUnwarped, float* yUnwarped, float* zUnwarped);
00063 
00064         // access functions
00065         inline float* getDensityBig() { return _densityBig; }
00066         inline float* getArrayTcU() { return _tcU; }
00067         inline float* getArrayTcV() { return _tcV; }
00068         inline float* getArrayTcW() { return _tcW; }
00069 
00070         inline Vec3Int getResSm() { return _resSm; } // small resolution
00071         inline Vec3Int getResBig() { return _resBig; }
00072         inline int getOctaves() { return _octaves; }
00073 
00074         // is accessed on through rna gui
00075         float *_strength;
00076 
00077     // protected:
00078         // enlargement factor from original velocity field / simulation
00079         // _Big = _amplify * _Sm
00080         int _amplify;
00081         int _octaves;
00082         
00083         // noise settings
00084         float _cullingThreshold;
00085         // float _noiseStrength;
00086         // float _noiseSizeScale;
00087         // bool _uvwAdvection;
00088         // bool _uvwReset;
00089         // float _noiseTimeanimSpeed;
00090         // int _dumpInterval;
00091         // nt _noiseControlType;
00092         // debug, scale density for projections output images
00093         // float _outputScale;
00094 
00095         // noise resolution
00096         int _xResBig;
00097         int _yResBig;
00098         int _zResBig;
00099         Vec3Int _resBig;
00100         Vec3 _invResBig;
00101         int _totalCellsBig;
00102         int _slabSizeBig;
00103         // original / small resolution
00104         int _xResSm;
00105         int _yResSm;
00106         int _zResSm;
00107         Vec3Int _resSm;
00108         Vec3 _invResSm;
00109         int _totalCellsSm;
00110         int _slabSizeSm;
00111 
00112         float* _densityBig;
00113         float* _densityBigOld;
00114 
00115         // texture coordinates for noise
00116         float* _tcU;
00117         float* _tcV;
00118         float* _tcW;
00119         float* _tcTemp;
00120 
00121         // noise data
00122         float* _noiseTile;
00123         //float* _noiseTileExt;
00124 
00125         // step counter
00126         int _totalStepsBig;
00127         
00128         void computeEigenvalues(float *_eigMin, float *_eigMax);
00129         void decomposeEnergy(float *energy, float *_highFreqEnergy);
00130 };
00131 
00132 #endif // WTURBULENCE_H
00133