diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2015-03-13 15:06:40 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-03-13 15:07:23 +0300 |
commit | a0a6cb129e9df46e80dec891b535992e773901af (patch) | |
tree | 530431d3e770b386a535b364ac1526c34380eca5 /source/blender/blenkernel/intern | |
parent | 63ea8dd156b39eb57b73a953f5ac9ae54b7a447a (diff) |
Fix unstable particle jittered distribution.
This was never working for threaded distribution.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/particle_distribute.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c index 6cc42e85a12..245c2432105 100644 --- a/source/blender/blenkernel/intern/particle_distribute.c +++ b/source/blender/blenkernel/intern/particle_distribute.c @@ -467,10 +467,9 @@ static void distribute_from_faces_exec(ParticleTask *thread, ParticleData *pa, i psys_uv_to_w(1.0f / 3.0f, 1.0f / 3.0f, mface->v4, pa->fuv); } else { - ctx->jitoff[i] = fmod(ctx->jitoff[i],(float)ctx->jitlevel); - if (!isnan(ctx->jitoff[i])) { - psys_uv_to_w(ctx->jit[2*(int)ctx->jitoff[i]], ctx->jit[2*(int)ctx->jitoff[i]+1], mface->v4, pa->fuv); - ctx->jitoff[i]++; + float offset = fmod(ctx->jitoff[i] + (float)p, (float)ctx->jitlevel); + if (!isnan(offset)) { + psys_uv_to_w(ctx->jit[2*(int)offset], ctx->jit[2*(int)offset+1], mface->v4, pa->fuv); } } break; @@ -512,10 +511,9 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa, psys_uv_to_w(1.0f / 3.0f, 1.0f / 3.0f, mface->v4, pa->fuv); } else { - ctx->jitoff[i] = fmod(ctx->jitoff[i],(float)ctx->jitlevel); - if (!isnan(ctx->jitoff[i])) { - psys_uv_to_w(ctx->jit[2*(int)ctx->jitoff[i]], ctx->jit[2*(int)ctx->jitoff[i]+1], mface->v4, pa->fuv); - ctx->jitoff[i]++; + float offset = fmod(ctx->jitoff[i] + (float)p, (float)ctx->jitlevel); + if (!isnan(offset)) { + psys_uv_to_w(ctx->jit[2*(int)offset], ctx->jit[2*(int)offset+1], mface->v4, pa->fuv); } } break; |