[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [57070] trunk/blender/source/blender/ blenkernel/intern/smoke.c: Fix: smoke initial velocity didn' t work with the new custom size particles.

Miika Hamalainen blender at miikah.org
Tue May 28 10:10:01 CEST 2013


Revision: 57070
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=57070
Author:   miikah
Date:     2013-05-28 08:10:01 +0000 (Tue, 28 May 2013)
Log Message:
-----------
Fix: smoke initial velocity didn't work with the new custom size particles.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/smoke.c

Modified: trunk/blender/source/blender/blenkernel/intern/smoke.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/smoke.c	2013-05-28 01:15:59 UTC (rev 57069)
+++ trunk/blender/source/blender/blenkernel/intern/smoke.c	2013-05-28 08:10:01 UTC (rev 57070)
@@ -1282,7 +1282,7 @@
 			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 @@
 				}
 			}   // 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 @@
 
 							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 @@
 					}
 			}
 			BLI_end_threaded_malloc();
+		}
+
+		if (sfs->flags & MOD_SMOKE_FLOW_USE_PART_SIZE) {
 			BLI_kdtree_free(tree);
 		}
 




More information about the Bf-blender-cvs mailing list