diff options
author | Janne Karhu <jhkarh@gmail.com> | 2009-10-05 17:25:56 +0400 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2009-10-05 17:25:56 +0400 |
commit | 3816554cbc1a40dc5199c8e56e45817ec09128d5 (patch) | |
tree | 2005de53d609273352eb2d4054cc03b8df258610 /source/blender/blenkernel/intern/effect.c | |
parent | a3449771476955fd4a27eadd17ff4dce2655cc16 (diff) |
General particle bug fixes + few small goodies
The goodies:
* Curves can be used as normal dynamic effectors too with
the new "curve" field shape.
* Group visualization has optional duplication counts for
each object in the specified group.
* Object & group visualizations, which are done without
taking the dupliobject's global position into account
(unless the whole group is used). This is much nicer than
the previous behavior, but I added a "Use Global Location"
option for those who want to use it the old way.
* The active particle system's particles are now drawn a
with theme coloured outline instead of pure white.
* Added object aligned velocity factors (buttons categorized
and re-organized too).
Bug fixes:
* Absorption didn't work as the ui toggle button was forgotten.
* Some other force field ui tweaks.
* Crash after adding children and changing trails count.
* Display types "cross" and "axis" crashed.
* Particles weren't drawn with correct coloring.
* Billboards didn't update properly in viewport to camera
location changes.
* Particle rotation wasn't recreated correctly from point cache.
* Changing particles amount crashed sometimes.
* Some files with child hair crashed on loading.
* Compiler warning fixes.
* Adding boids crashed on frame 1;
Diffstat (limited to 'source/blender/blenkernel/intern/effect.c')
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index 7cc65de827a..9b648e2c05c 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -228,6 +228,8 @@ static void precalculate_effector(EffectorCache *eff) } else if(eff->pd->shape == PFIELD_SHAPE_SURFACE) { eff->surmd = (SurfaceModifierData *)modifiers_findByType ( eff->ob, eModifierType_Surface ); + if(eff->ob->type == OB_CURVE) + eff->flag |= PE_USE_NORMAL_DATA; } else if(eff->psys) psys_update_particle_tree(eff->psys, eff->scene->r.cfra); @@ -518,7 +520,7 @@ float effector_falloff(EffectorCache *eff, EffectorData *efd, EffectedPoint *poi float falloff = weights ? weights->weight[0] * weights->weight[eff->pd->forcefield] : 1.0f; float fac, r_fac; - fac = Inpf(efd->nor, efd->vec_to_point); + fac = Inpf(efd->nor, efd->vec_to_point2); if(eff->pd->zdir == PFIELD_Z_POS && fac < 0.0f) falloff=0.0f; @@ -691,10 +693,16 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin VecSubf(efd->vec_to_point, point->loc, efd->loc); efd->distance = VecLength(efd->vec_to_point); - /* for some effectors we need the object center every time */ - VecSubf(efd->vec_to_point2, point->loc, eff->ob->obmat[3]); - VECCOPY(efd->nor2, eff->ob->obmat[2]); - Normalize(efd->nor2); + if(eff->flag & PE_USE_NORMAL_DATA) { + VECCOPY(efd->vec_to_point2, efd->vec_to_point); + VECCOPY(efd->nor2, efd->nor); + } + else { + /* for some effectors we need the object center every time */ + VecSubf(efd->vec_to_point2, point->loc, eff->ob->obmat[3]); + VECCOPY(efd->nor2, eff->ob->obmat[2]); + Normalize(efd->nor2); + } } return ret; @@ -835,8 +843,7 @@ void do_physical_effector(EffectorCache *eff, EffectorData *efd, EffectedPoint * switch(pd->forcefield){ case PFIELD_WIND: - Normalize(force); - strength *= (Inpf(force, efd->nor) >= 0.0f ? 1.0f : -1.0f); + VECCOPY(force, efd->nor); VecMulf(force, strength * efd->falloff); break; case PFIELD_FORCE: |