Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Genrich <daniel.genrich@gmx.net>2009-08-09 05:30:32 +0400
committerDaniel Genrich <daniel.genrich@gmx.net>2009-08-09 05:30:32 +0400
commitd48ca69985ce3f20db89650b0050b04c903b1815 (patch)
treed3781e2498aa3631c6940a85ca543eb067582f9f
parent18121524dd626cc9fec510220ff5f808fe3bd5b9 (diff)
Smoke: decoupling of wavelet #2, new noise strength option on gui, fftw3 option in place for cmake, scons yet uncommited
-rw-r--r--CMakeLists.txt22
-rw-r--r--intern/smoke/CMakeLists.txt7
-rw-r--r--intern/smoke/extern/smoke_API.h12
-rw-r--r--intern/smoke/intern/FFT_NOISE.h2
-rw-r--r--intern/smoke/intern/FLUID_3D.cpp33
-rw-r--r--intern/smoke/intern/FLUID_3D.h4
-rw-r--r--intern/smoke/intern/WTURBULENCE.cpp27
-rw-r--r--intern/smoke/intern/WTURBULENCE.h9
-rw-r--r--intern/smoke/intern/smoke_API.cpp41
-rw-r--r--release/ui/buttons_physics_smoke.py1
-rw-r--r--source/blender/blenkernel/intern/smoke.c38
-rw-r--r--source/blender/blenloader/intern/readfile.c8
-rw-r--r--source/blender/editors/space_view3d/drawobject.c2
-rw-r--r--source/blender/makesdna/DNA_smoke_types.h3
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt4
-rw-r--r--source/blender/makesrna/intern/rna_smoke.c11
16 files changed, 158 insertions, 66 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d2595bd0138..6da0015d427 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -68,6 +68,7 @@ OPTION(WITH_OPENJPEG "Enable OpenJpeg Support (http://www.openjpeg.org/)" OFF)
OPTION(WITH_OPENAL "Enable OpenAL Support (http://www.openal.org)" ON)
OPTION(WITH_OPENMP "Enable OpenMP (has to be supported by the compiler)" OFF)
OPTION(WITH_WEBPLUGIN "Enable Web Plugin (Unix only)" OFF)
+OPTION(WITH_FFTW3 "Enable FFTW3 support" OFF)
IF(NOT WITH_GAMEENGINE AND WITH_PLAYER)
MESSAGE("WARNING: WITH_PLAYER needs WITH_GAMEENGINE")
@@ -156,6 +157,13 @@ IF(UNIX AND NOT APPLE)
SET(FFMPEG_INC ${FFMPEG}/include)
SET(FFMPEG_LIB avformat avcodec avutil avdevice swscale)
SET(FFMPEG_LIBPATH ${FFMPEG}/lib)
+
+ IF(WITH_FFTW3)
+ SET(FFTW3 /usr)
+ SET(FFTW3_INC ${FFTW3}/include)
+ SET(FFTW3_LIB fftw3)
+ SET(FFTW3_LIBPATH ${FFTW3}/lib)
+ ENDIF(WITH_FFTW3)
FIND_PACKAGE(JPEG REQUIRED)
@@ -234,6 +242,13 @@ IF(WIN32)
SET(ICONV_LIB iconv)
SET(ICONV_LIBPATH ${ICONV}/lib)
+ IF(WITH_FFTW3)
+ SET(FFTW3 ${LIBDIR}/fftw3)
+ SET(FFTW3_INC ${FFTW3}/include)
+ SET(FFTW3_LIB libfftw)
+ SET(FFTW3_LIBPATH ${FFTW3}/lib)
+ ENDIF(WITH_FFTW3)
+
SET(GETTEXT ${LIBDIR}/gettext)
SET(GETTEXT_INC ${GETTEXT}/include)
IF(CMAKE_CL_64)
@@ -367,6 +382,13 @@ IF(APPLE)
SET(GETTEXT_INC "${GETTEXT}/include")
SET(GETTEXT_LIB intl iconv)
SET(GETTEXT_LIBPATH ${GETTEXT}/lib)
+
+ IF(WITH_FFTW3)
+ SET(FFTW3 ${LIBDIR}/fftw3)
+ SET(FFTW3_INC ${FFTW3}/include)
+ SET(FFTW3_LIB libfftw)
+ SET(FFTW3_LIBPATH ${FFTW3}/lib)
+ ENDIF(WITH_FFTW3)
SET(PNG_LIBRARIES png)
SET(JPEG_LIBRARY jpeg)
diff --git a/intern/smoke/CMakeLists.txt b/intern/smoke/CMakeLists.txt
index 90768e58be0..221bc911d20 100644
--- a/intern/smoke/CMakeLists.txt
+++ b/intern/smoke/CMakeLists.txt
@@ -24,8 +24,7 @@
#
# ***** END GPL LICENSE BLOCK *****
-SET(INC ${PNG_INC} ${ZLIB_INC} intern ../../extern/bullet2/src ../memutil ../guardealloc)
-# ${FFTW3_INC}
+SET(INC ${PNG_INC} ${ZLIB_INC} intern ../../extern/bullet2/src ../memutil ../guardealloc ${FFTW3_INC})
FILE(GLOB SRC intern/*.cpp)
@@ -33,6 +32,10 @@ IF(WITH_OPENMP)
ADD_DEFINITIONS(-DPARALLEL=1)
ENDIF(WITH_OPENMP)
+IF(WITH_FFTW3)
+ ADD_DEFINITIONS(-DFFTW3=1)
+ENDIF(WITH_FFTW3)
+
BLENDERLIB(bf_smoke "${SRC}" "${INC}")
#, libtype='blender', priority = 0 )
diff --git a/intern/smoke/extern/smoke_API.h b/intern/smoke/extern/smoke_API.h
index b7819d06edc..ba14a247bf1 100644
--- a/intern/smoke/extern/smoke_API.h
+++ b/intern/smoke/extern/smoke_API.h
@@ -36,11 +36,9 @@ struct FLUID_3D *smoke_init(int *res, int amplify, float *p0, float *p1, float d
void smoke_free(struct FLUID_3D *fluid);
void smoke_initBlenderRNA(struct FLUID_3D *fluid, float *alpha, float *beta);
-
void smoke_step(struct FLUID_3D *fluid);
float *smoke_get_density(struct FLUID_3D *fluid);
-float *smoke_get_bigdensity(struct FLUID_3D *fluid);
float *smoke_get_heat(struct FLUID_3D *fluid);
float *smoke_get_velocity_x(struct FLUID_3D *fluid);
float *smoke_get_velocity_y(struct FLUID_3D *fluid);
@@ -51,9 +49,15 @@ unsigned char *smoke_get_obstacle(struct FLUID_3D *fluid);
size_t smoke_get_index(int x, int max_x, int y, int max_y, int z);
size_t smoke_get_index2d(int x, int max_x, int y);
-void smoke_set_noise(struct FLUID_3D *fluid, int type);
+// wavelet turbulence functions
+struct WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype);
+void smoke_turbulence_free(struct WTURBULENCE *wt);
+void smoke_turbulence_step(struct WTURBULENCE *wt, struct FLUID_3D *fluid);
-void smoke_get_bigres(struct FLUID_3D *fluid, int *res);
+float *smoke_turbulence_get_density(struct WTURBULENCE *wt);
+void smoke_turbulence_get_res(struct WTURBULENCE *wt, int *res);
+void smoke_turbulence_set_noise(struct WTURBULENCE *wt, int type);
+void smoke_initWaveletBlenderRNA(struct WTURBULENCE *wt, float *strength);
#ifdef __cplusplus
}
diff --git a/intern/smoke/intern/FFT_NOISE.h b/intern/smoke/intern/FFT_NOISE.h
index 9ae9682e2a0..e1000f72fb3 100644
--- a/intern/smoke/intern/FFT_NOISE.h
+++ b/intern/smoke/intern/FFT_NOISE.h
@@ -22,7 +22,7 @@
#ifndef FFT_NOISE_H_
#define FFT_NOISE_H_
-#if 0
+#if FFTW3==1
#include <iostream>
#include <fftw3.h>
#include <MERSENNETWISTER.h>
diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index 5f40a823238..7e3a00417c1 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -59,10 +59,12 @@ FLUID_3D::FLUID_3D(int *res, int amplify, float *p0, float dt) :
_maxRes = MAX3(_xRes, _yRes, _zRes);
// initialize wavelet turbulence
+ /*
if(amplify)
- _wTurbulence = new WTURBULENCE(_res[0],_res[1],_res[2], amplify);
+ _wTurbulence = new WTURBULENCE(_res[0],_res[1],_res[2], amplify, noisetype);
else
_wTurbulence = NULL;
+ */
// scale the constants according to the refinement of the grid
_dx = 1.0f / (float)_maxRes;
@@ -196,7 +198,7 @@ FLUID_3D::~FLUID_3D()
if (_h) delete[] _h;
if (_Precond) delete[] _Precond;
if (_obstacles) delete[] _obstacles;
- if (_wTurbulence) delete _wTurbulence;
+ // if (_wTurbulence) delete _wTurbulence;
printf("deleted fluid\n");
}
@@ -206,10 +208,6 @@ void FLUID_3D::initBlenderRNA(float *alpha, float *beta)
{
_alpha = alpha;
_beta = beta;
-
- // XXX TODO DEBUG
- // *_alpha = 0;
- // *_beta = 0;
}
//////////////////////////////////////////////////////////////////////
@@ -233,12 +231,12 @@ void FLUID_3D::step()
// advect everything
advectMacCormack();
- if(_wTurbulence) {
- _wTurbulence->stepTurbulenceFull(_dt/_dx,
- _xVelocity, _yVelocity, _zVelocity, _obstacles);
+ // if(_wTurbulence) {
+ // _wTurbulence->stepTurbulenceFull(_dt/_dx,
+ // _xVelocity, _yVelocity, _zVelocity, _obstacles);
// _wTurbulence->stepTurbulenceReadable(_dt/_dx,
// _xVelocity, _yVelocity, _zVelocity, _obstacles);
- }
+ // }
/*
// no file output
float *src = _density;
@@ -257,20 +255,7 @@ void FLUID_3D::step()
IMAGE::dumpPBRT(_totalSteps, pbrtPrefix, _density, _res[0],_res[1],_res[2]);
*/
_totalTime += _dt;
- _totalSteps++;
-
- // clear obstacles
- for (int i = 0; i < _totalCells; i++)
- {
- if(_obstacles[i])
- {
- _xVelocity[i] =
- _yVelocity[i] =
- _zVelocity[i] = 0.0f;
- _pressure[i] = 0.0f;
- }
- _obstacles[i] = 0;
- }
+ _totalSteps++;
}
//////////////////////////////////////////////////////////////////////
diff --git a/intern/smoke/intern/FLUID_3D.h b/intern/smoke/intern/FLUID_3D.h
index 3e685a8df16..ffda34021c3 100644
--- a/intern/smoke/intern/FLUID_3D.h
+++ b/intern/smoke/intern/FLUID_3D.h
@@ -27,7 +27,7 @@
#include <cmath>
#include <iostream>
#include "OBSTACLE.h"
-#include "WTURBULENCE.h"
+// #include "WTURBULENCE.h"
#include "VEC3.h"
using namespace std;
@@ -115,7 +115,7 @@ class FLUID_3D
float _tempAmb; /* ambient temperature */
// WTURBULENCE object, if active
- WTURBULENCE* _wTurbulence;
+ // WTURBULENCE* _wTurbulence;
// boundary setting functions
void copyBorderAll(float* field);
diff --git a/intern/smoke/intern/WTURBULENCE.cpp b/intern/smoke/intern/WTURBULENCE.cpp
index 022c8f28252..6ce29e2c8cd 100644
--- a/intern/smoke/intern/WTURBULENCE.cpp
+++ b/intern/smoke/intern/WTURBULENCE.cpp
@@ -43,7 +43,7 @@ static const float persistence = 0.56123f;
//////////////////////////////////////////////////////////////////////
// constructor
//////////////////////////////////////////////////////////////////////
-WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify)
+WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype)
{
// if noise magnitude is below this threshold, its contribution
// is negilgible, so stop evaluating new octaves
@@ -53,10 +53,10 @@ WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify)
_amplify = amplify;
// manually adjust the overall amount of turbulence
- _strength = 2.;
+ // DG - RNA-fied _strength = 2.;
// add the corresponding octaves of noise
- _octaves = (int)log((float)_amplify) / log(2.0f); // XXX DEBUG/ TODO: int casting correct? - dg
+ _octaves = (int)(log((float)_amplify) / log(2.0f) + 0.5); // XXX DEBUG/ TODO: int casting correct? - dg
// noise resolution
_xResBig = _amplify * xResSm;
@@ -136,8 +136,11 @@ WTURBULENCE::WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify)
// noise tiles
_noiseTile = new float[noiseTileSize * noiseTileSize * noiseTileSize];
+ /*
std::string noiseTileFilename = std::string("noise.wavelets");
generateTile_WAVELET(_noiseTile, noiseTileFilename);
+ */
+ setNoise(noisetype);
/*
std::string noiseTileFilename = std::string("noise.fft");
generatTile_FFT(_noiseTile, noiseTileFilename);
@@ -182,8 +185,10 @@ void WTURBULENCE::setNoise(int type)
if(type == 4) // FFT
{
// needs fft
- // std::string noiseTileFilename = std::string("noise.fft");
- // generatTile_FFT(_noiseTile, noiseTileFilename);
+ #if FFTW3==1
+ std::string noiseTileFilename = std::string("noise.fft");
+ generatTile_FFT(_noiseTile, noiseTileFilename);
+ #endif
}
else if(type == 8) // curl
{
@@ -196,6 +201,12 @@ void WTURBULENCE::setNoise(int type)
}
}
+// init direct access functions from blender
+void WTURBULENCE::initBlenderRNA(float *strength)
+{
+ _strength = strength;
+}
+
//////////////////////////////////////////////////////////////////////
// Get the smallest valid x derivative
//
@@ -642,7 +653,7 @@ void WTURBULENCE::stepTurbulenceReadable(float dtOrg, float* xvel, float* yvel,
// base amplitude for octave 0
float coefficient = sqrtf(2.0f * fabs(energy));
- const float amplitude = _strength * fabs(0.5 * coefficient) * persistence;
+ const float amplitude = *_strength * fabs(0.5 * coefficient) * persistence;
// add noise to velocity, but only if the turbulence is
// sufficiently undeformed, and the energy is large enough
@@ -854,7 +865,7 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
// base amplitude for octave 0
float coefficient = sqrtf(2.0f * fabs(energy));
- const float amplitude = _strength * fabs(0.5 * coefficient) * persistence;
+ const float amplitude = *_strength * fabs(0.5 * coefficient) * persistence;
// add noise to velocity, but only if the turbulence is
// sufficiently undeformed, and the energy is large enough
@@ -925,7 +936,7 @@ void WTURBULENCE::stepTurbulenceFull(float dtOrg, float* xvel, float* yvel, floa
maxVelMag = sqrt(maxVelMag) * dt;
int totalSubsteps = (int)(maxVelMag / (float)maxVel);
totalSubsteps = (totalSubsteps < 1) ? 1 : totalSubsteps;
-
+ // printf("totalSubsteps: %d\n", totalSubsteps);
totalSubsteps = (totalSubsteps > maxSubSteps) ? maxSubSteps : totalSubsteps;
const float dtSubdiv = dt / (float)totalSubsteps;
diff --git a/intern/smoke/intern/WTURBULENCE.h b/intern/smoke/intern/WTURBULENCE.h
index 858a47b7dd1..d4e6b0c6a17 100644
--- a/intern/smoke/intern/WTURBULENCE.h
+++ b/intern/smoke/intern/WTURBULENCE.h
@@ -33,12 +33,13 @@ class WTURBULENCE
{
public:
// both config files can be NULL, altCfg might override values from noiseCfg
- WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify);
+ WTURBULENCE(int xResSm, int yResSm, int zResSm, int amplify, int noisetype);
/// destructor
virtual ~WTURBULENCE();
void setNoise(int type);
+ void initBlenderRNA(float *strength);
// step more readable version -- no rotation correction
void stepTurbulenceReadable(float dt, float* xvel, float* yvel, float* zvel, unsigned char *obstacles);
@@ -69,13 +70,15 @@ class WTURBULENCE
inline Vec3Int getResBig() { return _resBig; }
inline int getOctaves() { return _octaves; }
+ // is accessed on through rna gui
+ float *_strength;
+
protected:
// enlargement factor from original velocity field / simulation
// _Big = _amplify * _Sm
int _amplify;
int _octaves;
- float _strength;
-
+
// noise settings
float _cullingThreshold;
float _noiseStrength;
diff --git a/intern/smoke/intern/smoke_API.cpp b/intern/smoke/intern/smoke_API.cpp
index 281761bd387..7d476191c90 100644
--- a/intern/smoke/intern/smoke_API.cpp
+++ b/intern/smoke/intern/smoke_API.cpp
@@ -26,6 +26,7 @@
*/
#include "FLUID_3D.h"
+#include "WTURBULENCE.h"
#include <stdio.h>
#include <stdlib.h>
@@ -41,22 +42,48 @@ extern "C" FLUID_3D *smoke_init(int *res, int amplify, float *p0, float *p1, flo
return fluid;
}
+extern "C" WTURBULENCE *smoke_turbulence_init(int *res, int amplify, int noisetype)
+{
+ // initialize wavelet turbulence
+ if(amplify)
+ return new WTURBULENCE(res[0],res[1],res[2], amplify, noisetype);
+ else
+ return NULL;
+}
+
extern "C" void smoke_free(FLUID_3D *fluid)
{
delete fluid;
fluid = NULL;
}
+extern "C" void smoke_turbulence_free(WTURBULENCE *wt)
+{
+ delete wt;
+ wt = NULL;
+}
+
extern "C" void smoke_step(FLUID_3D *fluid)
{
fluid->step();
}
+extern "C" void smoke_turbulence_step(WTURBULENCE *wt, FLUID_3D *fluid)
+{
+ if(wt)
+ wt->stepTurbulenceFull(fluid->_dt/fluid->_dx, fluid->_xVelocity, fluid->_yVelocity, fluid->_zVelocity, fluid->_obstacles);
+}
+
extern "C" void smoke_initBlenderRNA(FLUID_3D *fluid, float *alpha, float *beta)
{
fluid->initBlenderRNA(alpha, beta);
}
+extern "C" void smoke_initWaveletBlenderRNA(WTURBULENCE *wt, float *strength)
+{
+ wt->initBlenderRNA(strength);
+}
+
template < class T > inline T ABS( T a ) {
return (0 < a) ? a : -a ;
}
@@ -86,16 +113,16 @@ extern "C" float *smoke_get_velocity_z(FLUID_3D *fluid)
return fluid->_zVorticity;
}
-extern "C" float *smoke_get_bigdensity(FLUID_3D *fluid)
+extern "C" float *smoke_turbulence_get_density(WTURBULENCE *wt)
{
- return fluid->_wTurbulence ? fluid->_wTurbulence->getDensityBig() : NULL;
+ return wt ? wt->getDensityBig() : NULL;
}
-extern "C" void smoke_get_bigres(FLUID_3D *fluid, int *res)
+extern "C" void smoke_turbulence_get_res(WTURBULENCE *wt, int *res)
{
- if(fluid->_wTurbulence)
+ if(wt)
{
- Vec3Int r = fluid->_wTurbulence->getResBig();
+ Vec3Int r = wt->getResBig();
res[0] = r[0];
res[1] = r[1];
res[2] = r[2];
@@ -118,7 +145,7 @@ extern "C" size_t smoke_get_index2d(int x, int max_x, int y /*, int max_y, int z
return x + y * max_x;
}
-extern "C" void smoke_set_noise(FLUID_3D *fluid, int type)
+extern "C" void smoke_turbulence_set_noise(WTURBULENCE *wt, int type)
{
- fluid->_wTurbulence->setNoise(type);
+ wt->setNoise(type);
}
diff --git a/release/ui/buttons_physics_smoke.py b/release/ui/buttons_physics_smoke.py
index d28cda01fa0..f2b3bc35ed8 100644
--- a/release/ui/buttons_physics_smoke.py
+++ b/release/ui/buttons_physics_smoke.py
@@ -54,6 +54,7 @@ class PHYSICS_PT_smoke(PhysicButtonsPanel):
sub.active = md.domain_settings.highres
sub.itemR(md.domain_settings, "amplify", text="High")
col.itemR(md.domain_settings, "highres", text="Use High Resolution")
+ col.itemR(md.domain_settings, "strength")
col = split.column()
col.itemL(text="Display:")
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index bd93126d365..f053c55cf10 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -207,12 +207,16 @@ int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, Derive
// printf("res[0]: %d, res[1]: %d, res[2]: %d\n", smd->domain->res[0], smd->domain->res[1], smd->domain->res[2]);
// dt max is 0.1
- smd->domain->fluid = smoke_init(smd->domain->res, (smd->domain->flags & MOD_SMOKE_HIGHRES) ? (smd->domain->amplify + 1) : 0, smd->domain->p0, smd->domain->p1, 2.5 / FPS);
+ smd->domain->fluid = smoke_init(smd->domain->res, 0, smd->domain->p0, smd->domain->p1, 2.5 / FPS);
+ smd->domain->wt = smoke_turbulence_init(smd->domain->res, (smd->domain->flags & MOD_SMOKE_HIGHRES) ? (smd->domain->amplify + 1) : 0, smd->domain->noise);
smd->time = scene->r.cfra;
smd->domain->firstframe = smd->time;
smoke_initBlenderRNA(smd->domain->fluid, &(smd->domain->alpha), &(smd->domain->beta));
+ if(smd->domain->wt)
+ smoke_initWaveletBlenderRNA(smd->domain->wt, &(smd->domain->strength));
+
return 1;
}
else if((smd->type & MOD_SMOKE_TYPE_FLOW) && smd->flow)
@@ -509,9 +513,11 @@ void smokeModifier_freeDomain(SmokeModifierData *smd)
MEM_freeN(smd->domain->tvoxbig);
if(smd->domain->fluid)
- {
smoke_free(smd->domain->fluid);
- }
+
+ if(smd->domain->wt)
+ smoke_turbulence_free(smd->domain->wt);
+
MEM_freeN(smd->domain);
smd->domain = NULL;
}
@@ -589,6 +595,12 @@ void smokeModifier_reset(struct SmokeModifierData *smd)
smoke_free(smd->domain->fluid);
smd->domain->fluid = NULL;
}
+
+ if(smd->domain->wt)
+ {
+ smoke_turbulence_free(smd->domain->wt);
+ smd->domain->wt = NULL;
+ }
}
else if(smd->flow)
{
@@ -641,6 +653,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
/* set some standard values */
smd->domain->fluid = NULL;
+ smd->domain->wt = NULL;
smd->domain->eff_group = NULL;
smd->domain->fluid_group = NULL;
smd->domain->coll_group = NULL;
@@ -650,6 +663,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
smd->domain->alpha = -0.001;
smd->domain->beta = 0.1;
smd->domain->flags = 0;
+ smd->domain->strength = 2.0;
smd->domain->noise = MOD_SMOKE_NOISEWAVE;
smd->domain->visibility = 1;
@@ -829,7 +843,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
ParticleData *pa = NULL;
int p = 0;
float *density = smoke_get_density(sds->fluid);
- float *bigdensity = smoke_get_bigdensity(sds->fluid);
+ float *bigdensity = smoke_turbulence_get_density(sds->wt);
float *heat = smoke_get_heat(sds->fluid);
float *velocity_x = smoke_get_velocity_x(sds->fluid);
float *velocity_y = smoke_get_velocity_y(sds->fluid);
@@ -887,7 +901,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
// init all surrounding cells according to amplification, too
int i, j, k;
- smoke_get_bigres(smd->domain->fluid, bigres);
+ smoke_turbulence_get_res(smd->domain->wt, bigres);
for(i = 0; i < smd->domain->amplify + 1; i++)
for(j = 0; j < smd->domain->amplify + 1; j++)
@@ -912,7 +926,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
// init all surrounding cells according to amplification, too
int i, j, k;
- smoke_get_bigres(smd->domain->fluid, bigres);
+ smoke_turbulence_get_res(smd->domain->wt, bigres);
for(i = 0; i < smd->domain->amplify + 1; i++)
for(j = 0; j < smd->domain->amplify + 1; j++)
@@ -1063,6 +1077,8 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
// simulate the actual smoke (c++ code in intern/smoke)
smoke_step(sds->fluid);
+ if(sds->wt)
+ smoke_turbulence_step(sds->wt, sds->fluid);
tend();
printf ( "Frame: %d, Time: %f\n", (int)smd->time, ( float ) tval() );
@@ -1118,7 +1134,7 @@ void smoke_prepare_bigView(SmokeModifierData *smd, float *light)
size_t i = 0;
int bigres[3];
- smoke_get_bigres(smd->domain->fluid, bigres);
+ smoke_turbulence_get_res(smd->domain->wt, bigres);
if(!smd->domain->traybig)
{
@@ -1131,7 +1147,7 @@ void smoke_prepare_bigView(SmokeModifierData *smd, float *light)
smd->domain->tvoxbig = MEM_callocN(sizeof(float)*bigres[0]*bigres[1]*bigres[2], "Smoke_tVoxBig");
}
- density = smoke_get_bigdensity(smd->domain->fluid);
+ density = smoke_turbulence_get_density(smd->domain->wt);
for (i = 0; i < bigres[0] * bigres[1] * bigres[2]; i++)
{
// Transparency computation
@@ -1217,7 +1233,7 @@ static void calc_voxel_transp_big(SmokeModifierData *smd, int *pixel, float *tRa
int bigres[3];
size_t index;
- smoke_get_bigres(smd->domain->fluid, bigres);
+ smoke_turbulence_get_res(smd->domain->wt, bigres);
index = smoke_get_index(pixel[0], bigres[0], pixel[1], bigres[1], pixel[2]);
/*
@@ -1349,7 +1365,7 @@ static void get_bigcell(struct SmokeModifierData *smd, float *pos, int *cell, in
{
float tmp[3];
int res[3];
- smoke_get_bigres(smd->domain->fluid, res);
+ smoke_turbulence_get_res(smd->domain->wt, res);
VECSUB(tmp, pos, smd->domain->p0);
@@ -1401,7 +1417,7 @@ void smoke_calc_transparency(struct SmokeModifierData *smd, float *light, int bi
}
else
{
- smoke_get_bigres(smd->domain->fluid, res);
+ smoke_turbulence_get_res(smd->domain->wt, res);
bigfactor = 1.0 / (smd->domain->amplify + 1);
}
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 019392ebcb2..d87cd052454 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -3659,12 +3659,18 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
smd->domain->smd = smd;
smd->domain->fluid = NULL;
+ smd->domain->wt = NULL;
smd->domain->tvox = NULL;
smd->domain->tray = NULL;
smd->domain->tvoxbig = NULL;
smd->domain->traybig = NULL;
smd->domain->bind = NULL;
- smd->domain->max_textures = 0;
+ smd->domain->max_textures= 0;
+
+ // do_versions trick
+ if(smd->domain->strength < 1.0)
+ smd->domain->strength = 2.0;
+
// reset 3dview
if(smd->domain->viewsettings < MOD_SMOKE_VIEW_USEBIG)
smd->domain->viewsettings = 0;
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index dd1f44c55cb..05336d29dc3 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -5367,7 +5367,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
else
{
- smoke_get_bigres(smd->domain->fluid, res);
+ smoke_turbulence_get_res(smd->domain->wt, res);
bigfactor = 1.0 / (smd->domain->amplify + 1);
}
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index c4d551f2f74..7d64862ba32 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -77,7 +77,8 @@ typedef struct SmokeDomainSettings {
short noise; /* noise type: wave, curl, anisotropic */
short pad2;
int pad;
- int pad3;
+ float strength;
+ struct WTURBULENCE *wt; // WTURBULENCE object, if active
} SmokeDomainSettings;
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 2aa0fcc79ff..343df04d4ff 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -67,6 +67,10 @@ IF(NOT WITH_ELBEEM)
ADD_DEFINITIONS(-DDISABLE_ELBEEM)
ENDIF(NOT WITH_ELBEEM)
+IF(WITH_FFTW3)
+ ADD_DEFINITIONS(-DFFTW3=1)
+ENDIF(WITH_FFTW3)
+
# Build makesrna executable
ADD_EXECUTABLE(makesrna ${SRC} ${INC_FILES})
TARGET_LINK_LIBRARIES(makesrna bf_dna)
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index eefafcc32b4..1cd98ca3a9c 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -118,7 +118,9 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
static EnumPropertyItem prop_noise_type_items[] = {
{MOD_SMOKE_NOISEWAVE, "NOISEWAVE", 0, "Wavelet", ""},
- /* {MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""}, */
+#if FFTW3 == 1
+ {MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""},
+#endif
/* {MOD_SMOKE_NOISECURL, "NOISECURL", 0, "Curl", ""}, */
{0, NULL, 0, NULL, NULL}};
@@ -205,6 +207,13 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this group.");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset_dependancy");
+
+ prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "strength");
+ RNA_def_property_range(prop, -5.0, 5.0);
+ RNA_def_property_ui_range(prop, 1.0, 10.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Strength", "Strength of wavelet noise");
+ RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Smoke_reset");
}
static void rna_def_smoke_flow_settings(BlenderRNA *brna)