diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2015-03-25 20:34:52 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-03-25 20:34:52 +0300 |
commit | d4ac58d04989e8c2e1951a55519cfba53011d494 (patch) | |
tree | f2c9ad3f7250e342dd5977badacef9aea24f400f /source/blender/blenkernel/intern/particle_system.c | |
parent | 9fc1a29de35bd9ac453884d106ec5694539f989e (diff) |
Fix T43694, by Krzysztof Rećko (chrisr), reviewed in D1177.
Added some guards to prevent clumping to non existing particles. Also, adjusted threaded child path evaluation, so each child is evaluated once - previously virtual parents were done twice.
Diffstat (limited to 'source/blender/blenkernel/intern/particle_system.c')
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index b7ebcfa9b0b..5a263e24fc4 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -448,24 +448,24 @@ BLI_INLINE int ceil_ii(int a, int b) return (a + b - 1) / b; } -void psys_tasks_create(ParticleThreadContext *ctx, int totpart, ParticleTask **r_tasks, int *r_numtasks) +void psys_tasks_create(ParticleThreadContext *ctx, int startpart, int endpart, ParticleTask **r_tasks, int *r_numtasks) { ParticleTask *tasks; - int numtasks = ceil_ii(totpart, MAX_PARTICLES_PER_TASK); - float particles_per_task = (float)totpart / (float)numtasks, p, pnext; + int numtasks = ceil_ii((endpart - startpart), MAX_PARTICLES_PER_TASK); + float particles_per_task = (float)(endpart - startpart) / (float)numtasks, p, pnext; int i; tasks = MEM_callocN(sizeof(ParticleTask) * numtasks, "ParticleThread"); *r_numtasks = numtasks; *r_tasks = tasks; - p = 0.0f; + p = (float)startpart; for (i = 0; i < numtasks; i++, p = pnext) { pnext = p + particles_per_task; tasks[i].ctx = ctx; tasks[i].begin = (int)p; - tasks[i].end = min_ii((int)pnext, totpart); + tasks[i].end = min_ii((int)pnext, endpart); } } |