diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-14 14:29:19 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2015-01-20 11:30:11 +0300 |
commit | 2fe96f3f88c080cbb5433f5d9d0322a12e2bc539 (patch) | |
tree | 1e00c3f5f916731bdbbc1e35162cc16406986ee0 /source/blender/blenkernel/intern | |
parent | 96981822277f38f4ed3a97c072022d5fcc3a8111 (diff) |
New texture influence option for particle kink amplitude (as opposed to
frequency).
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_child.c | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 1 |
3 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index cf611ef4f90..499475104e6 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3331,7 +3331,7 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti float value, rgba[4], texvec[3]; ptex->ivel = ptex->life = ptex->exist = ptex->size = ptex->damp = - ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink_freq = + ptex->gravity = ptex->field = ptex->time = ptex->clump = ptex->kink_freq = ptex->kink_amp = ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.0f; ptex->length = 1.0f - part->randlength * psys_frand(psys, child_index + 26); @@ -3378,6 +3378,7 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti SET_PARTICLE_TEXTURE(PAMAP_LENGTH, ptex->length, mtex->lengthfac); SET_PARTICLE_TEXTURE(PAMAP_CLUMP, ptex->clump, mtex->clumpfac); + SET_PARTICLE_TEXTURE(PAMAP_KINK_AMP, ptex->kink_amp, mtex->kinkampfac); SET_PARTICLE_TEXTURE(PAMAP_KINK_FREQ, ptex->kink_freq, mtex->kinkfac); SET_PARTICLE_TEXTURE(PAMAP_DENS, ptex->exist, mtex->padensfac); } @@ -3385,6 +3386,7 @@ static void get_cpa_texture(DerivedMesh *dm, ParticleSystem *psys, ParticleSetti CLAMP_PARTICLE_TEXTURE_POS(PAMAP_LENGTH, ptex->length); CLAMP_PARTICLE_TEXTURE_POS(PAMAP_CLUMP, ptex->clump); + CLAMP_PARTICLE_TEXTURE_POS(PAMAP_KINK_AMP, ptex->kink_amp); CLAMP_PARTICLE_TEXTURE_POS(PAMAP_KINK_FREQ, ptex->kink_freq); CLAMP_PARTICLE_TEXTURE_POS(PAMAP_ROUGH, ptex->rough1); CLAMP_PARTICLE_TEXTURE_POS(PAMAP_DENS, ptex->exist); @@ -3402,7 +3404,7 @@ void psys_get_texture(ParticleSimulationData *sim, ParticleData *pa, ParticleTex /* initialize ptex */ ptex->ivel = ptex->life = ptex->exist = ptex->size = ptex->damp = - ptex->gravity = ptex->field = ptex->length = ptex->clump = ptex->kink_freq = + ptex->gravity = ptex->field = ptex->length = ptex->clump = ptex->kink_freq = ptex->kink_amp = ptex->effector = ptex->rough1 = ptex->rough2 = ptex->roughe = 1.0f; ptex->time = (float)(pa - sim->psys->particles) / (float)sim->psys->totpart; diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c index d79dd91d9dd..5bc79d132d5 100644 --- a/source/blender/blenkernel/intern/particle_child.c +++ b/source/blender/blenkernel/intern/particle_child.c @@ -204,6 +204,7 @@ static void do_kink_spiral(ParticleThreadContext *ctx, ParticleTexture *ptex, co float kink_base[3]; if (ptex) { + kink_amp *= ptex->kink_amp; kink_freq *= ptex->kink_freq; rough1 *= ptex->rough1; rough2 *= ptex->rough2; @@ -670,6 +671,8 @@ void do_child_modifiers(ParticleSimulationData *sim, ParticleTexture *ptex, cons int i = cpa - sim->psys->child; int guided = 0; + float kink_amp = part->kink_amp; + float kink_amp_clump = part->kink_amp_clump; float kink_freq = part->kink_freq; float rough1 = part->rough1; float rough2 = part->rough2; @@ -677,6 +680,7 @@ void do_child_modifiers(ParticleSimulationData *sim, ParticleTexture *ptex, cons const bool smooth_start = (sim->psys->part->childtype == PART_CHILD_FACES); if (ptex) { + kink_amp *= ptex->kink_amp; kink_freq *= ptex->kink_freq; rough1 *= ptex->rough1; rough2 *= ptex->rough2; @@ -696,13 +700,8 @@ void do_child_modifiers(ParticleSimulationData *sim, ParticleTexture *ptex, cons part->child_flag & PART_CHILD_USE_CLUMP_NOISE, part->clump_noise_size, part->clumpcurve); if (kink_freq != 0.f) { - float kink_amp; - /* seriously ... */ - if (ELEM(part->kink, PART_KINK_SPIRAL)) - kink_amp = part->kink_amp; - else - kink_amp = part->kink_amp * (1.f - part->kink_amp_clump * clump); - + kink_amp *= (1.f - kink_amp_clump * clump); + do_kink(state, par_co, par_vel, par_rot, t, kink_freq, part->kink_shape, kink_amp, part->kink_flat, part->kink, part->kink_axis, sim->ob->obmat, smooth_start); diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index dce6584bdfe..91ca21a9fbf 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -745,6 +745,7 @@ void default_mtex(MTex *mtex) mtex->lengthfac = 1.0f; mtex->clumpfac = 1.0f; mtex->kinkfac = 1.0f; + mtex->kinkampfac = 1.0f; mtex->roughfac = 1.0f; mtex->padensfac = 1.0f; mtex->lifefac = 1.0f; |