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:
-rw-r--r--intern/smoke/intern/FLUID_3D.cpp1
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenkernel/intern/smoke.c44
-rw-r--r--source/blender/blenloader/intern/readfile.c21
-rw-r--r--source/blender/editors/space_view3d/drawobject.c4
-rw-r--r--source/blender/makesdna/DNA_smoke_types.h2
6 files changed, 44 insertions, 30 deletions
diff --git a/intern/smoke/intern/FLUID_3D.cpp b/intern/smoke/intern/FLUID_3D.cpp
index 04971f898e9..821b428363e 100644
--- a/intern/smoke/intern/FLUID_3D.cpp
+++ b/intern/smoke/intern/FLUID_3D.cpp
@@ -249,7 +249,6 @@ void FLUID_3D::step(float dt)
// set vorticity from RNA value
_vorticityEps = (*_vorticityRNA)/_constantScaling;
-
#if PARALLEL==1
int threadval = 1;
threadval = omp_get_max_threads();
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index e0b734faddb..e2bca1bb93e 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -42,7 +42,7 @@ extern "C" {
* and keep comment above the defines.
* Use STRINGIFY() rather than defining with quotes */
#define BLENDER_VERSION 263
-#define BLENDER_SUBVERSION 6
+#define BLENDER_SUBVERSION 7
#define BLENDER_MINVERSION 250
#define BLENDER_MINSUBVERSION 0
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 06f98b0e840..b33ae202f1a 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -198,8 +198,6 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
// calc other res with max_res provided
sub_v3_v3v3(size, max, min);
- // printf("size: %f, %f, %f\n", size[0], size[1], size[2]);
-
// prevent crash when initializing a plane as domain
if((size[0] < FLT_EPSILON) || (size[1] < FLT_EPSILON) || (size[2] < FLT_EPSILON))
return 0;
@@ -209,14 +207,16 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
if(size[0] > size[2])
{
scale = res / size[0];
- smd->domain->dx = size[0] / res; // dx is in global coords
+ smd->domain->scale = size[0];
+ smd->domain->dx = 1.0f / res;
smd->domain->res[0] = res;
smd->domain->res[1] = (int)(size[1] * scale + 0.5);
smd->domain->res[2] = (int)(size[2] * scale + 0.5);
}
else {
scale = res / size[2];
- smd->domain->dx = size[2] / res; // dx is in global coords
+ smd->domain->scale = size[2];
+ smd->domain->dx = 1.0f / res;
smd->domain->res[2] = res;
smd->domain->res[0] = (int)(size[0] * scale + 0.5);
smd->domain->res[1] = (int)(size[1] * scale + 0.5);
@@ -226,25 +226,24 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
if(size[1] > size[2])
{
scale = res / size[1];
- smd->domain->dx = size[1] / res; // dx is in global coords
+ smd->domain->scale = size[1];
+ smd->domain->dx = 1.0f / res;
smd->domain->res[1] = res;
smd->domain->res[0] = (int)(size[0] * scale + 0.5);
smd->domain->res[2] = (int)(size[2] * scale + 0.5);
}
else {
scale = res / size[2];
- smd->domain->dx = size[2] / res;
+ smd->domain->scale = size[2];
+ smd->domain->dx = 1.0f / res;
smd->domain->res[2] = res;
smd->domain->res[0] = (int)(size[0] * scale + 0.5);
smd->domain->res[1] = (int)(size[1] * scale + 0.5);
}
}
- // printf("smd->domain->dx: %f\n", smd->domain->dx);
-
// TODO: put in failsafe if res<=0 - dg
- // 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->p0, DT_DEFAULT);
smd->time = scene->r.cfra;
@@ -256,8 +255,6 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
smd->domain->res_wt[1] = smd->domain->res[1] * (smd->domain->amplify + 1);
smd->domain->res_wt[2] = smd->domain->res[2] * (smd->domain->amplify + 1);
smd->domain->dx_wt = smd->domain->dx / (smd->domain->amplify + 1);
- // printf("smd->domain->amplify: %d\n", smd->domain->amplify);
- // printf("(smd->domain->flags & MOD_SMOKE_HIGHRES)\n");
}
if(!smd->domain->shadow)
@@ -268,7 +265,6 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
if(smd->domain->wt)
{
smoke_initWaveletBlenderRNA(smd->domain->wt, &(smd->domain->strength));
- // printf("smoke_initWaveletBlenderRNA\n");
}
return 1;
}
@@ -303,8 +299,6 @@ static int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene,
DM_ensure_tessface(dm);
fill_scs_points(ob, dm, scs);
-
- // DEBUG printf("scs->dx: %f\n", scs->dx);
}
if(!smd->coll->bvhtree)
@@ -1184,7 +1178,7 @@ static void update_obstacles(Scene *scene, Object *ob, SmokeDomainSettings *sds,
// DG TODO: cap velocity to maxVelMag (or maxvel)
// oldpos + velocity * dt = newpos
- get_cell(sds->p0, sds->res, sds->dx, cOldpos /* use current position here instead of "pos" */, cell, 0);
+ get_cell(sds->p0, sds->res, sds->dx*sds->scale, cOldpos /* use current position here instead of "pos" */, cell, 0);
// check if cell is valid (in the domain boundary)
for(j = 0; j < 3; j++)
@@ -1329,7 +1323,7 @@ static void update_flowsfluids(Scene *scene, Object *ob, SmokeDomainSettings *sd
// copy_v3_v3(pos, pa->state.co);
// mul_m4_v3(ob->imat, pos);
// 1. get corresponding cell
- get_cell(sds->p0, sds->res, sds->dx, state.co, cell, 0);
+ get_cell(sds->p0, sds->res, sds->dx*sds->scale, state.co, cell, 0);
// check if cell is valid (in the domain boundary)
for(i = 0; i < 3; i++)
{
@@ -1555,9 +1549,9 @@ static void update_effectors(Scene *scene, Object *ob, SmokeDomainSettings *sds,
vel[1] = velocity_y[index];
vel[2] = velocity_z[index];
- voxelCenter[0] = sds->p0[0] + sds->dx * x + sds->dx * 0.5;
- voxelCenter[1] = sds->p0[1] + sds->dx * y + sds->dx * 0.5;
- voxelCenter[2] = sds->p0[2] + sds->dx * z + sds->dx * 0.5;
+ voxelCenter[0] = sds->p0[0] + sds->dx * sds->scale * x + sds->dx * sds->scale * 0.5;
+ voxelCenter[1] = sds->p0[1] + sds->dx * sds->scale * y + sds->dx * sds->scale * 0.5;
+ voxelCenter[2] = sds->p0[2] + sds->dx * sds->scale * z + sds->dx * sds->scale * 0.5;
pd_point_from_loc(scene, voxelCenter, vel, index, &epoint);
pdDoEffectors(effectors, NULL, sds->effector_weights, &epoint, retvel, NULL);
@@ -1667,6 +1661,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
Base *base = scene->base.first;
int changed = 0;
float dx = FLT_MAX;
+ float scale = 1.0f;
int haveDomain = 0;
for ( ; base; base = base->next)
@@ -1677,9 +1672,10 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
{
SmokeDomainSettings *sds = smd2->domain;
- if(sds->dx < dx)
+ if(sds->dx * sds->scale < dx)
{
dx = sds->dx;
+ scale = sds->scale;
changed = 1;
}
@@ -1692,9 +1688,9 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
if(changed)
{
- if(dx != scs->dx)
+ if(dx*scale != scs->dx)
{
- scs->dx = dx;
+ scs->dx = dx*scale;
smokeModifier_reset(smd);
}
}
@@ -1813,7 +1809,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
if((int)smd->time == startframe && (cache->flag & PTCACHE_OUTDATED || cache->last_exact==0)) {
// create shadows straight after domain initialization so we get nice shadows for startframe, too
if(get_lamp(scene, light))
- smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx);
+ smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx * sds->scale, light, calc_voxel_transp, -7.0*sds->dx * sds->scale);
if(sds->wt)
{
@@ -1844,7 +1840,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM
// create shadows before writing cache so they get stored
if(get_lamp(scene, light))
- smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx);
+ smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx * sds->scale, light, calc_voxel_transp, -7.0*sds->dx * sds->scale);
if(sds->wt)
{
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 63df006aa66..352e9d57489 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6814,7 +6814,7 @@ static void do_versions_nodetree_frame_2_64_6(bNodeTree *ntree)
}
/* initialize custom node color */
- node->color[0] = node->color[1] = node->color[2] = 0.608; /* default theme color */
+ node->color[0] = node->color[1] = node->color[2] = 0.608f; /* default theme color */
}
}
@@ -7498,6 +7498,25 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for (ntree=main->nodetree.first; ntree; ntree=ntree->id.next)
do_versions_nodetree_frame_2_64_6(ntree);
}
+
+ if (main->versionfile < 263 || (main->versionfile == 263 && main->subversionfile < 7))
+ {
+ Object *ob;
+
+ for (ob = main->object.first; ob; ob = ob->id.next) {
+ ModifierData *md;
+ for (md = ob->modifiers.first; md; md = md->next) {
+ if (md->type == eModifierType_Smoke) {
+ SmokeModifierData *smd = (SmokeModifierData *)md;
+ if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
+ int maxres = MAX3(smd->domain->res[0], smd->domain->res[1], smd->domain->res[2]);
+ smd->domain->scale = smd->domain->dx * maxres;
+ smd->domain->dx = 1.0f / smd->domain->scale;
+ }
+ }
+ }
+ }
+ }
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 9633917344f..780f4a2d86a 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -6938,7 +6938,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
GPU_create_smoke(smd, 0);
draw_volume(ar, smd->domain->tex,
smd->domain->p0, smd->domain->p1,
- smd->domain->res, smd->domain->dx,
+ smd->domain->res, smd->domain->dx * smd->domain->scale,
smd->domain->tex_shadow);
GPU_free_smoke(smd);
// #endif
@@ -6991,7 +6991,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
GPU_create_smoke(smd, 1);
draw_volume(ar, smd->domain->tex,
smd->domain->p0, smd->domain->p1,
- smd->domain->res_wt, smd->domain->dx_wt,
+ smd->domain->res_wt, smd->domain->dx_wt * smd->domain->scale,
smd->domain->tex_shadow);
GPU_free_smoke(smd);
}
diff --git a/source/blender/makesdna/DNA_smoke_types.h b/source/blender/makesdna/DNA_smoke_types.h
index 50e48a13835..cceb7333478 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -80,11 +80,11 @@ typedef struct SmokeDomainSettings {
float tempAmb; /* ambient temperature */
float alpha;
float beta;
+ float scale; /* largest domain size */
int res[3]; /* domain resolution */
int amplify; /* wavelet amplification */
int maxres; /* longest axis on the BB gets this resolution assigned */
int flags; /* show up-res or low res, etc */
- int pad;
int viewsettings;
short noise; /* noise type: wave, curl, anisotropic */
short diss_percent;