diff options
author | Miika Hamalainen <blender@miikah.org> | 2012-06-29 21:36:34 +0400 |
---|---|---|
committer | Miika Hamalainen <blender@miikah.org> | 2012-06-29 21:36:34 +0400 |
commit | 234c338655fc49efef0b7ffe0ef6736e8630411a (patch) | |
tree | d9887295bcbd272f98c4fd0b000a6c9b33fb19e8 | |
parent | 63ad7f0b62380dfd96b366729104948c560a63bb (diff) |
Fix: Smoke obstacles were sometimes processed in wrong location when adaptive domain was enabled.
-rw-r--r-- | source/blender/blenkernel/intern/smoke.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 20 |
2 files changed, 15 insertions, 13 deletions
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 7dd5d7c9f75..6f3548a77e3 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -705,11 +705,11 @@ static void obstacles_from_derivedmesh(Object *coll_ob, SmokeDomainSettings *sds if (bvhtree_from_mesh_faces(&treeData, dm, 0.0f, 4, 6)) { #pragma omp parallel for schedule(static) - for (z = 0; z < res[2]; z++) { + for (z = sds->res_min[2]; z < sds->res_max[2]; z++) { int x,y; - for (x = 0; x < res[0]; x++) - for (y = 0; y < res[1]; y++) { - int index = x + y*res[0] + z*res[0]*res[1]; + for (x = sds->res_min[0]; x < sds->res_max[0]; x++) + for (y = sds->res_min[1]; y < sds->res_max[1]; y++) { + int index = smoke_get_index(x-sds->res_min[0], sds->res[0], y-sds->res_min[1], sds->res[1], z-sds->res_min[2]); float ray_start[3] = {(float)x + 0.5f, (float)y + 0.5f, (float)z + 0.5f}; BVHTreeNearest nearest = {0}; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 4cbd6679f8a..b1d06c6091b 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -7010,15 +7010,17 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short normalize_v3(viewnormal); - /* draw domain max bounds */ - VECSUBFAC(p0, sds->p0, sds->cell_size, sds->adapt_res); - VECADDFAC(p1, sds->p1, sds->cell_size, sds->adapt_res); - BKE_boundbox_init_from_minmax(&bb, p0, p1); - draw_box(bb.vec); - - /* draw base resolution bounds */ - /*BKE_boundbox_init_from_minmax(&bb, sds->p0, sds->p1); - draw_box(bb.vec);*/ + if (sds->flags & MOD_SMOKE_ADAPTIVE_DOMAIN) { + /* draw domain max bounds */ + VECSUBFAC(p0, sds->p0, sds->cell_size, sds->adapt_res); + VECADDFAC(p1, sds->p1, sds->cell_size, sds->adapt_res); + BKE_boundbox_init_from_minmax(&bb, p0, p1); + draw_box(bb.vec); + + /* draw base resolution bounds */ + /*BKE_boundbox_init_from_minmax(&bb, sds->p0, sds->p1); + draw_box(bb.vec);*/ + } /* set dynamic boundaries to draw the volume */ p0[0] = sds->p0[0] + sds->cell_size[0]*sds->res_min[0] + sds->obj_shift_f[0]; |