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:
authorJanne Karhu <jhkarh@gmail.com>2011-02-06 18:50:00 +0300
committerJanne Karhu <jhkarh@gmail.com>2011-02-06 18:50:00 +0300
commit0ea9271f43e7e8ef914d33244d658ad7b5720f1f (patch)
tree3b307bc11ae557d91d06d001dadd552d35e006e2 /source/blender/blenkernel/intern/particle.c
parentd9aa3f66a65161f324148ecb68b847bbbebee235 (diff)
Bug fix: Particles in dupligroups were mostly drawn properly in 3d view, but rendering them was a real mess.
* After countless different bugs particles should now render correctly inside dupligroups. * Only particles with metaball visualization are still problematic, this is mostly due to the ancient metaball code. * I'll also add a test file for some of the situations, so that hopefully these cases stay fixed :)
Diffstat (limited to 'source/blender/blenkernel/intern/particle.c')
-rw-r--r--source/blender/blenkernel/intern/particle.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 11ea82803eb..f6b97dcb78e 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -1194,12 +1194,12 @@ static void mvert_to_particle(ParticleKey *key, MVert *mvert, HairKey *hkey)
key->time = hkey->time;
}
-static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData *pa, float t, float frs_sec, ParticleInterpolationData *pind, ParticleKey *result)
+static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData *pa, float t, ParticleInterpolationData *pind, ParticleKey *result)
{
PTCacheEditPoint *point = pind->epoint;
ParticleKey keys[4];
int point_vel = (point && point->keys->vel);
- float real_t, dfra, keytime;
+ float real_t, dfra, keytime, invdt;
/* billboards wont fill in all of these, so start cleared */
memset(keys, 0, sizeof(keys));
@@ -1338,11 +1338,12 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
dfra = keys[2].time - keys[1].time;
keytime = (real_t - keys[1].time) / dfra;
+ invdt = dfra * 0.04f * psys->part->timetweak;
/* convert velocity to timestep size */
if(pind->keyed || pind->cache || point_vel){
- mul_v3_fl(keys[1].vel, dfra / frs_sec);
- mul_v3_fl(keys[2].vel, dfra / frs_sec);
+ mul_v3_fl(keys[1].vel, invdt);
+ mul_v3_fl(keys[2].vel, invdt);
interp_qt_qtqt(result->rot,keys[1].rot,keys[2].rot,keytime);
}
@@ -1353,7 +1354,7 @@ static void do_particle_interpolation(ParticleSystem *psys, int p, ParticleData
/* the velocity needs to be converted back from cubic interpolation */
if(pind->keyed || pind->cache || point_vel)
- mul_v3_fl(result->vel, frs_sec / dfra);
+ mul_v3_fl(result->vel, 1.f/invdt);
}
/************************************************/
/* Particles on a dm */
@@ -2954,7 +2955,7 @@ void psys_cache_paths(ParticleSimulationData *sim, float cfra)
time = (float)k / (float)steps;
t = birthtime + time * (dietime - birthtime);
result.time = -t;
- do_particle_interpolation(psys, p, pa, t, frs_sec, &pind, &result);
+ do_particle_interpolation(psys, p, pa, t, &pind, &result);
copy_v3_v3(ca->co, result.co);
/* dynamic hair is in object space */
@@ -3133,7 +3134,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
time = (float)k / (float)steps;
t = birthtime + time * (dietime - birthtime);
result.time = -t;
- do_particle_interpolation(psys, i, pa, t, frs_sec, &pind, &result);
+ do_particle_interpolation(psys, i, pa, t, &pind, &result);
copy_v3_v3(ca->co, result.co);
/* non-hair points are already in global space */
@@ -3954,7 +3955,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
ParticleThreadContext ctx; /* fake thread context for child modifiers */
ParticleInterpolationData pind;
- float t, frs_sec = sim->scene->r.frs_sec;
+ float t;
float co[3], orco[3];
float hairmat[4][4];
int totpart = psys->totpart;
@@ -3982,7 +3983,7 @@ void psys_get_particle_on_path(ParticleSimulationData *sim, int p, ParticleKey *
* account when subdividing for instance */
pind.dm = psys_in_edit_mode(sim->scene, psys) ? NULL : psys->hair_out_dm;
init_particle_interpolation(sim->ob, psys, pa, &pind);
- do_particle_interpolation(psys, p, pa, t, frs_sec, &pind, state);
+ do_particle_interpolation(psys, p, pa, t, &pind, state);
if(!keyed && !cached) {
if((pa->flag & PARS_REKEY)==0) {