diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-10-01 00:19:54 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-10-01 00:19:54 +0400 |
commit | da4b54cd5dd0f0e4c856626bb5ebbdf07a969668 (patch) | |
tree | 2b699179ac854a2fe68c6fb0f6d8b36146b130d0 | |
parent | 96977c6ffee0b23ad21d9664c4d442a37ed87a5f (diff) |
Fix #23540: smoke preview shading only used point lamps, now it uses other
lamps to if no point lamp is available.
-rw-r--r-- | source/blender/blenkernel/intern/smoke.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index d0fcde0da58..965ce9801d7 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -800,20 +800,25 @@ static float calc_voxel_transp(float *result, float *input, int res[3], int *pix static int get_lamp(Scene *scene, float *light) { Base *base_tmp = NULL; - for(base_tmp = scene->base.first; base_tmp; base_tmp= base_tmp->next) - { - if(base_tmp->object->type == OB_LAMP) - { - Lamp *la = (Lamp *)base_tmp->object->data; - - if(la->type == LA_LOCAL) - { - VECCOPY(light, base_tmp->object->obmat[3]); - return 1; - } - } - } - return 0; + int found_lamp = 0; + + // try to find a lamp, preferably local + for(base_tmp = scene->base.first; base_tmp; base_tmp= base_tmp->next) { + if(base_tmp->object->type == OB_LAMP) { + Lamp *la = base_tmp->object->data; + + if(la->type == LA_LOCAL) { + copy_v3_v3(light, base_tmp->object->obmat[3]); + return 1; + } + else if(!found_lamp) { + copy_v3_v3(light, base_tmp->object->obmat[3]); + found_lamp = 1; + } + } + } + + return found_lamp; } static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd) |