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
path: root/source
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 /source
parent18121524dd626cc9fec510220ff5f808fe3bd5b9 (diff)
Smoke: decoupling of wavelet #2, new noise strength option on gui, fftw3 option in place for cmake, scons yet uncommited
Diffstat (limited to 'source')
-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
6 files changed, 51 insertions, 15 deletions
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)