Page MenuHome

smoke_particle-children-trails.patch

smoke_particle-children-trails.patch

Index: source/blender/blenkernel/intern/smoke.c
===================================================================
--- source/blender/blenkernel/intern/smoke.c (revision 43745)
+++ source/blender/blenkernel/intern/smoke.c (working copy)
@@ -1008,7 +1008,8 @@
{
ParticleSimulationData sim;
ParticleSystem *psys = sfs->psys;
- int p = 0;
+ int totpart=psys->totpart, totchild;
+ int p = 0, t;
float *density = smoke_get_density(sds->fluid);
float *bigdensity = smoke_turbulence_get_density(sds->wt);
float *heat = smoke_get_heat(sds->fluid);
@@ -1043,7 +1044,14 @@
}
// mostly copied from particle code
- for(p=0; p<psys->totpart; p++)
+ if(psys->part->type==PART_HAIR && !psys->childcache)
+ totchild=0;
+ else
+ totchild=psys->totchild*psys->part->disp/100;
+
+
+ for(t=0; t<psys->part->trail_count; t++)
+ for(p=0; p<totpart+totchild; p++)
{
int cell[3];
size_t i = 0;
@@ -1051,14 +1059,49 @@
int badcell = 0;
ParticleKey state;
- if(psys->particles[p].flag & (PARS_NO_DISP|PARS_UNEXIST))
+ if(p < totpart)
+ {
+ if(psys->particles[p].flag & (PARS_NO_DISP|PARS_UNEXIST))
continue;
+ }
- state.time = smd->time;
+ if(psys->part->trail_count > 1)
+ {
+ float pa_time = (psys->cfra -psys->particles->time) /psys->particles->lifetime;
+ float pa_birthtime = psys->particles->time;
+ float pa_dietime = psys->particles->dietime;
+
+ ChildParticle *cpa= &psys->child[p-totpart];
+
+ float r_length = PSYS_FRAND(p + 22);
+ float length = psys->part->path_end * (1.0f - psys->part->randlength * r_length);
+ float dt = length / (psys->part->trail_count ? (float)psys->part->trail_count : 1.0f);
+ float ct;
+
+ if(p >= totpart)
+ {
+ pa_time = psys_get_child_time(psys, cpa, psys->cfra, &pa_birthtime, &pa_dietime);
+ }
+ ct = (psys->part->draw & PART_ABS_PATH_TIME) ? psys->cfra : pa_time;
+ ct = ct -(dt *t);
- if(psys_get_particle_state(&sim, p, &state, 0) == 0)
- continue;
-
+ if(psys->part->draw & PART_ABS_PATH_TIME) {
+ if(ct < pa_birthtime || ct > pa_dietime)
+ continue;
+ }
+ else if(ct < 0.0f || ct > 1.0f)
+ continue;
+
+ state.time = (psys->part->draw & PART_ABS_PATH_TIME) ? -ct : ct;
+ psys_get_particle_on_path(&sim, p, &state, 1);
+ }
+ else
+ {
+ 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

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
33/b4/436440d5459ab15123f01c37f1a7

Event Timeline