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.14 by greg, Fri Nov 8 13:17:47 1991 UTC vs.
Revision 2.4 by greg, Thu Aug 13 10:03:19 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 67 | Line 66 | char  *nm;
66          distarr = (float *)calloc(n, 3*sizeof(float));
67          if (distarr == NULL)
68                  error(SYSTEM, "out of memory in o_face");
69 <        mkaxes(u, v, fa->norm);
69 >                                /* take first edge longer than sqrt(area) */
70 >        for (j = fa->nv-1, i = 0; i < fa->nv; j = i++) {
71 >                u[0] = VERTEX(fa,i)[0] - VERTEX(fa,j)[0];
72 >                u[1] = VERTEX(fa,i)[1] - VERTEX(fa,j)[1];
73 >                u[2] = VERTEX(fa,i)[2] - VERTEX(fa,j)[2];
74 >                if (DOT(u,u) >= fa->area-FTINY)
75 >                        break;
76 >        }
77 >        if (i < fa->nv) {       /* got one! -- let's align our axes */
78 >                normalize(u);
79 >                fcross(v, fa->norm, u);
80 >        } else                  /* oh well, we'll just have to wing it */
81 >                mkaxes(u, v, fa->norm);
82 >                                /* now, find limits in (u,v) coordinates */
83          ur[0] = vr[0] = FHUGE;
84          ur[1] = vr[1] = -FHUGE;
85          for (i = 0; i < fa->nv; i++) {
# Line 120 | Line 132 | char  *nm;
132                  if (il->sampdens > 0)
133                          flatout(il, distarr, nalt, nazi, u, v, fa->norm);
134                  illumout(il, ob);
135 <        } else if (!(il->flags & IL_LIGHT))
135 >        } else
136                  printobj(il->altmat, ob);
137                                  /* clean up */
138          freeface(ob);
# Line 191 | Line 203 | char  *nm;
203                  else
204                          objerror(ob, WARNING, "diffuse distribution");
205                  illumout(il, ob);
206 <        } else if (!(il->flags & IL_LIGHT))
206 >        } else
207                  printobj(il->altmat, ob);
208                                  /* clean up */
209          free((char *)distarr);
# Line 259 | Line 271 | char  *nm;
271                  if (il->sampdens > 0)
272                          flatout(il, distarr, nalt, nazi, u, v, co->ad);
273                  illumout(il, ob);
274 <        } else if (!(il->flags & IL_LIGHT))
274 >        } else
275                  printobj(il->altmat, ob);
276                                  /* clean up */
277          freecone(ob);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines