diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-03-19 09:16:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-03-19 10:31:56 +0300 |
commit | 1a7596951aafcd0f9c0f112a79c9b6e79d6ac323 (patch) | |
tree | 0621c6f79127f9216b481e8df137be14b11699d4 /source/blender/blenkernel/intern/particle_system.c | |
parent | 6aeb1f7f5609dc1e82b9b2d915e2ee54b3c467de (diff) |
BLI_kdopbvh: Pass center to to range callback
Useful when BLI_bvhtree_range_query callback calculates a new position to measure from.
Diffstat (limited to 'source/blender/blenkernel/intern/particle_system.c')
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index e9ce5329ad0..10ca88cdeeb 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -1584,13 +1584,15 @@ static void sph_evaluate_func(BVHTree *tree, ParticleSystem **psys, float co[3], } } } -static void sph_density_accum_cb(void *userdata, int index, float squared_dist) +static void sph_density_accum_cb(void *userdata, int index, const float co[3], float squared_dist) { SPHRangeData *pfr = (SPHRangeData *)userdata; ParticleData *npa = pfr->npsys->particles + index; float q; float dist; + UNUSED_VARS(co); + if (npa == pfr->pa || squared_dist < FLT_EPSILON) return; @@ -1767,7 +1769,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa sphdata->pass++; } -static void sphclassical_density_accum_cb(void *userdata, int index, float UNUSED(squared_dist)) +static void sphclassical_density_accum_cb(void *userdata, int index, const float co[3], float UNUSED(squared_dist)) { SPHRangeData *pfr = (SPHRangeData *)userdata; ParticleData *npa = pfr->npsys->particles + index; @@ -1779,7 +1781,7 @@ static void sphclassical_density_accum_cb(void *userdata, int index, float UNUSE /* Exclude particles that are more than 2h away. Can't use squared_dist here * because it is not accurate enough. Use current state, i.e. the output of * basic_integrate() - z0r */ - sub_v3_v3v3(vec, npa->state.co, pfr->pa->state.co); + sub_v3_v3v3(vec, npa->state.co, co); rij = len_v3(vec); rij_h = rij / pfr->h; if (rij_h > 2.0f) @@ -1798,7 +1800,7 @@ static void sphclassical_density_accum_cb(void *userdata, int index, float UNUSE pfr->data[1] += q / npa->sphdensity; } -static void sphclassical_neighbour_accum_cb(void *userdata, int index, float UNUSED(squared_dist)) +static void sphclassical_neighbour_accum_cb(void *userdata, int index, const float co[3], float UNUSED(squared_dist)) { SPHRangeData *pfr = (SPHRangeData *)userdata; ParticleData *npa = pfr->npsys->particles + index; @@ -1811,7 +1813,7 @@ static void sphclassical_neighbour_accum_cb(void *userdata, int index, float UNU /* Exclude particles that are more than 2h away. Can't use squared_dist here * because it is not accurate enough. Use current state, i.e. the output of * basic_integrate() - z0r */ - sub_v3_v3v3(vec, npa->state.co, pfr->pa->state.co); + sub_v3_v3v3(vec, npa->state.co, co); rij = len_v3(vec); rij_h = rij / pfr->h; if (rij_h > 2.0f) |