Bug fix 2116
authorTon Roosendaal <ton@blender.org>
Fri, 21 Jan 2005 12:46:59 +0000 (12:46 +0000)
committerTon Roosendaal <ton@blender.org>
Fri, 21 Jan 2005 12:46:59 +0000 (12:46 +0000)
Area lights with "Noise" dithering only worked for first area light, the
other ones then used wrong table... bug since area lights are in blender.

source/blender/render/extern/include/render_types.h
source/blender/render/intern/source/ray.c

index 7c7499740ccd09d34e64845238529d8c9d016d7f..1042a52bf18a6f59647ec18e2d66fd23c788eeae 100644 (file)
@@ -278,6 +278,7 @@ typedef struct LampRen
        float bias;
        
        short ray_samp, ray_sampy, ray_sampz, ray_samp_type, area_shape, ray_totsamp;
+       short xold, yold;       /* last jitter table for area lights */
        float area_size, area_sizey, area_sizez;
        
        struct ShadBuf *shb;
index e1731d2dbb862cb97c7e75685e5a1a321b082e67..433da92e7a76f1f2b8fa529827a61d5fd33d5e9a 100644 (file)
@@ -1647,20 +1647,16 @@ static float *jitter_plane(LampRen *lar, int xs, int ys)
        if(lar->ray_samp_type & LA_SAMP_JITTER) {
                /* made it threadsafe */
                if(ys & 1) {
-                       static int xold=0, yold=0;
-
-                       if(xold!=xs || yold!=ys) {
+                       if(lar->xold!=xs || lar->yold!=ys) {
                                jitter_plane_offset(lar->jitter, lar->jitter+2*tot, tot, lar->area_size, lar->area_sizey, BLI_frand(), BLI_frand());
-                               xold= xs; yold= ys;
+                               lar->xold= xs; lar->yold= ys;
                        }
                        return lar->jitter+2*tot;
                }
                else {
-                       static int xold=0, yold=0;
-                       
-                       if(xold!=xs || yold!=ys) {
+                       if(lar->xold!=xs || lar->yold!=ys) {
                                jitter_plane_offset(lar->jitter, lar->jitter+4*tot, tot, lar->area_size, lar->area_sizey, BLI_frand(), BLI_frand());
-                               xold= xs; yold= ys;
+                               lar->xold= xs; lar->yold= ys;
                        }
                        return lar->jitter+4*tot;
                }