Revision: 44260
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44260
Author:   genscher
Date:     2012-02-19 20:05:01 +0000 (Sun, 19 Feb 2012)
Log Message:
-----------
Smoke
------
New: Child particles are used as emitter. 

Based on the patch #30013 by Kai Kostack. Thank you!

Please do test this code!

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      2012-02-19 
19:32:41 UTC (rev 44259)
+++ trunk/blender/source/blender/blenkernel/intern/smoke.c      2012-02-19 
20:05:01 UTC (rev 44260)
@@ -1008,6 +1008,7 @@
                                        {
                                                ParticleSimulationData sim;
                                                ParticleSystem *psys = 
sfs->psys;
+                                               int totpart=psys->totpart, 
totchild;
                                                int p = 0;                      
                                        
                                                float *density = 
smoke_get_density(sds->fluid);                                                  
       
                                                float *bigdensity = 
smoke_turbulence_get_density(sds->wt);                                          
                    
@@ -1043,25 +1044,51 @@
                                                }
                                                                                
                                
                                                // mostly copied from particle 
code                                                             
-                                               for(p=0; p<psys->totpart; p++)  
                                                        
+                                               if(psys->part->type==PART_HAIR)
                                                {
+                                                       /*
+                                                       if(psys->childcache)
+                                                       {
+                                                               totchild = 
psys->totchildcache;
+                                                       }
+                                                       else
+                                                       */
+
+                                                       // TODO: PART_HAIR not 
supported whatsoever
+                                                       totchild=0;
+                                               }
+                                               else
+                                                       
totchild=psys->totchild*psys->part->disp/100;
+                                               
+                                               for(p=0; p<totpart+totchild; 
p++)                                                               
+                                               {
                                                        int cell[3];
                                                        size_t i = 0;
                                                        size_t index = 0;
                                                        int badcell = 0;
                                                        ParticleKey state;
 
-                                                       
if(psys->particles[p].flag & (PARS_NO_DISP|PARS_UNEXIST))
-                                                               continue;
+                                                       if(p < totpart)
+                                                       {
+                                                               
if(psys->particles[p].flag & (PARS_NO_DISP|PARS_UNEXIST))
+                                                                       
continue;
+                                                       }
+                                                       else
+                                                       {
+                                                               /* handle child 
particle */
+                                                               ChildParticle 
*cpa = &psys->child[p - totpart];
+                                       
+                                                               
if(psys->particles[cpa->parent].flag & (PARS_NO_DISP|PARS_UNEXIST))
+                                                                       
continue;
+                                                       }
 
                                                        state.time = smd->time;
-
                                                        
if(psys_get_particle_state(&sim, p, &state, 0) == 0)
                                                                continue;
-                                                       
+                                                                               
                
                                                        // copy_v3_v3(pos, 
pa->state.co);
-                                                       // mul_m4_v3(ob->imat, 
pos);                                                                           
                                                                 
-                                                       // 1. get corresponding 
cell    
+                                                       // mul_m4_v3(ob->imat, 
pos);
+                                                       // 1. get corresponding 
cell
                                                        
get_cell(smd->domain->p0, smd->domain->res, smd->domain->dx, state.co, cell, 
0);                                                                             
                                                           
                                                        // check if cell is 
valid (in the domain boundary)                                                  
                    
                                                        for(i = 0; i < 3; i++)  
                                                                

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to