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.13 by greg, Mon Aug 26 10:16:56 1991 UTC vs.
Revision 2.3 by greg, Wed Aug 12 14:44:15 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 (i = 1; i < fa->nv; i++) {
71 >                for (j = 0; j < 3; j++)
72 >                        u[j] = VERTEX(fa,i)[j] - VERTEX(fa,i-1)[j];
73 >                if (DOT(u,u) >= fa->area-FTINY)
74 >                        break;
75 >        }
76 >        if (i < fa->nv) {       /* got one! -- let's align our axes */
77 >                normalize(u);
78 >                fcross(v, fa->norm, u);
79 >        } else                  /* oh well, we'll just have to wing it */
80 >                mkaxes(u, v, fa->norm);
81 >                                /* now, find limits in (u,v) coordinates */
82          ur[0] = vr[0] = FHUGE;
83          ur[1] = vr[1] = -FHUGE;
84          for (i = 0; i < fa->nv; i++) {
# Line 120 | Line 131 | char  *nm;
131                  if (il->sampdens > 0)
132                          flatout(il, distarr, nalt, nazi, u, v, fa->norm);
133                  illumout(il, ob);
134 <        } else if (!(il->flags & IL_LIGHT))
134 >        } else
135                  printobj(il->altmat, ob);
136                                  /* clean up */
137          freeface(ob);
# Line 191 | Line 202 | char  *nm;
202                  else
203                          objerror(ob, WARNING, "diffuse distribution");
204                  illumout(il, ob);
205 <        } else if (!(il->flags & IL_LIGHT))
205 >        } else
206                  printobj(il->altmat, ob);
207                                  /* clean up */
208          free((char *)distarr);
# Line 259 | Line 270 | char  *nm;
270                  if (il->sampdens > 0)
271                          flatout(il, distarr, nalt, nazi, u, v, co->ad);
272                  illumout(il, ob);
273 <        } else if (!(il->flags & IL_LIGHT))
273 >        } else
274                  printobj(il->altmat, ob);
275                                  /* clean up */
276          freecone(ob);
# Line 291 | Line 302 | register struct rtproc  *rt;
302          if (rt->nrays <= 0)
303                  return;
304          bzero(rt->buf+6*rt->nrays, 6*sizeof(float));
305 +        errno = 0;
306          if ( process(rt->pd, (char *)rt->buf, (char *)rt->buf,
307                          3*sizeof(float)*rt->nrays,
308                          6*sizeof(float)*(rt->nrays+1)) <

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines