ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/gen/mkillum2.c
(Generate patch)

Comparing ray/src/gen/mkillum2.c (file contents):
Revision 1.11 by greg, Thu Aug 22 12:12:23 1991 UTC vs.
Revision 2.2 by greg, Wed Mar 11 12:25:47 1992 UTC

# Line 26 | Line 26 | char  *nm;
26          sprintf(errmsg, "(%s): cannot make illum for %s \"%s\"",
27                          nm, ofun[ob->otype].funame, ob->oname);
28          error(WARNING, errmsg);
29 <        if (!(il->flags & IL_LIGHT))
30 <                printobj(il->altmat, ob);
29 >        printobj(il->altmat, ob);
30   }
31  
32  
# Line 88 | Line 87 | char  *nm;
87                      h = ilhash(dim, 3) + i;
88                      multisamp(sp, 2, urand(h));
89                      r1 = (dim[1] + sp[0])/nalt;
90 <                    r2 = (dim[2] + sp[1])/nazi;
90 >                    r2 = (dim[2] + sp[1] - .5)/nazi;
91                      flatdir(dn, r1, r2);
92                      for (j = 0; j < 3; j++)
93                          dir[j] = -dn[0]*u[j] - dn[1]*v[j] - dn[2]*fa->norm[j];
# Line 116 | Line 115 | char  *nm;
115                  }
116          rayflush(rt);
117                                  /* write out the face and its distribution */
118 <        average(il, distarr, nalt*nazi);
119 <        if (il->sampdens > 0)
120 <                flatout(il, distarr, nalt, nazi, u, v, fa->norm);
121 <        illumout(il, ob);
118 >        if (average(il, distarr, nalt*nazi)) {
119 >                if (il->sampdens > 0)
120 >                        flatout(il, distarr, nalt, nazi, u, v, fa->norm);
121 >                illumout(il, ob);
122 >        } else
123 >                printobj(il->altmat, ob);
124                                  /* clean up */
125          freeface(ob);
126          free((char *)distarr);
# Line 164 | Line 165 | char  *nm;
165                      multisamp(sp, 4, urand(ilhash(dim,3)+i));
166                                          /* random direction */
167                      r1 = (dim[1] + sp[0])/nalt;
168 <                    r2 = (dim[2] + sp[1])/nazi;
168 >                    r2 = (dim[2] + sp[1] - .5)/nazi;
169                      rounddir(dir, r1, r2);
170                                          /* random location */
171                      mkaxes(u, v, dir);          /* yuck! */
# Line 183 | Line 184 | char  *nm;
184                  }
185          rayflush(rt);
186                                  /* write out the sphere and its distribution */
187 <        average(il, distarr, nalt*nazi);
188 <        if (il->sampdens > 0)
189 <                roundout(il, distarr, nalt, nazi);
190 <        else
191 <                objerror(ob, WARNING, "diffuse distribution");
192 <        illumout(il, ob);
187 >        if (average(il, distarr, nalt*nazi)) {
188 >                if (il->sampdens > 0)
189 >                        roundout(il, distarr, nalt, nazi);
190 >                else
191 >                        objerror(ob, WARNING, "diffuse distribution");
192 >                illumout(il, ob);
193 >        } else
194 >                printobj(il->altmat, ob);
195                                  /* clean up */
196          free((char *)distarr);
197   }
# Line 232 | Line 235 | char  *nm;
235                      multisamp(sp, 4, urand(ilhash(dim,3)+i));
236                                          /* random direction */
237                      r1 = (dim[1] + sp[0])/nalt;
238 <                    r2 = (dim[2] + sp[1])/nalt;
238 >                    r2 = (dim[2] + sp[1] - .5)/nazi;
239                      flatdir(dn, r1, r2);
240                      for (j = 0; j < 3; j++)
241                          dir[j] = -dn[0]*u[j] - dn[1]*v[j] - dn[2]*co->ad[j];
# Line 251 | Line 254 | char  *nm;
254                  }
255          rayflush(rt);
256                                  /* write out the ring and its distribution */
257 <        average(il, distarr, nalt*nazi);
258 <        if (il->sampdens > 0)
259 <                flatout(il, distarr, nalt, nazi, u, v, co->ad);
260 <        illumout(il, ob);
257 >        if (average(il, distarr, nalt*nazi)) {
258 >                if (il->sampdens > 0)
259 >                        flatout(il, distarr, nalt, nazi, u, v, co->ad);
260 >                illumout(il, ob);
261 >        } else
262 >                printobj(il->altmat, ob);
263                                  /* clean up */
264          freecone(ob);
265          free((char *)distarr);
# Line 285 | Line 290 | register struct rtproc  *rt;
290          if (rt->nrays <= 0)
291                  return;
292          bzero(rt->buf+6*rt->nrays, 6*sizeof(float));
293 +        errno = 0;
294          if ( process(rt->pd, (char *)rt->buf, (char *)rt->buf,
295                          3*sizeof(float)*rt->nrays,
296                          6*sizeof(float)*(rt->nrays+1)) <

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines