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:
authorMiika Hamalainen <blender@miikah.org>2013-05-28 12:10:01 +0400
committerMiika Hamalainen <blender@miikah.org>2013-05-28 12:10:01 +0400
commit8ebc246a9a0aa33a9586b181a1bfe9ea97329c69 (patch)
treebaa566227bab78ad05fb65cc673d846e8b58417c /source/blender/blenkernel/intern/smoke.c
parentc77179a3c25b349e8686cdbfe8603e4d03ee2ed3 (diff)
Fix: smoke initial velocity didn't work with the new custom size particles.
Diffstat (limited to 'source/blender/blenkernel/intern/smoke.c')
-rw-r--r--source/blender/blenkernel/intern/smoke.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c
index 669be5fc6ec..2bf11b993c4 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -1282,7 +1282,7 @@ static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, Smoke
mul_mat3_m4_v3(sds->imat, &particle_vel[valid_particles * 3]);
if (sfs->flags & MOD_SMOKE_FLOW_USE_PART_SIZE) {
- BLI_kdtree_insert(tree, p, pos, NULL);
+ BLI_kdtree_insert(tree, valid_particles, pos, NULL);
}
/* calculate emission map bounds */
@@ -1326,8 +1326,8 @@ static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, Smoke
}
} // particles loop
}
- else // MOD_SMOKE_FLOW_USE_PART_SIZE
- {
+ else if (valid_particles > 0) { // MOD_SMOKE_FLOW_USE_PART_SIZE
+
int min[3], max[3], res[3];
float hr = 1.0f / ((float)hires_multiplier);
/* slightly adjust high res antialias smoothness based on number of divisions
@@ -1368,6 +1368,11 @@ static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, Smoke
if (nearest.dist < range) {
em->influence[index] = (nearest.dist < solid) ? 1.0f : (1.0f - (nearest.dist-solid) / smooth);
+ /* Uses particle velocity as initial velocity for smoke */
+ if (sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY && (psys->part->phystype != PART_PHYS_NO))
+ {
+ VECADDFAC(&em->velocity[index * 3], &em->velocity[index * 3], &particle_vel[nearest.index * 3], sfs->vel_multi);
+ }
}
}
@@ -1394,6 +1399,9 @@ static void emit_from_particles(Object *flow_ob, SmokeDomainSettings *sds, Smoke
}
}
BLI_end_threaded_malloc();
+ }
+
+ if (sfs->flags & MOD_SMOKE_FLOW_USE_PART_SIZE) {
BLI_kdtree_free(tree);
}