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

Comparing ray/src/rt/rv3.c (file contents):
Revision 2.35 by greg, Sat Oct 16 15:08:14 2010 UTC vs.
Revision 2.42 by greg, Thu Nov 8 00:54:07 2018 UTC

# Line 13 | Line 13 | static const char      RCSid[] = "$Id$";
13  
14   #include  "ray.h"
15   #include  "rpaint.h"
16 + #include  "otypes.h"
17 + #include  "otspecial.h"
18   #include  "random.h"
19  
20   #ifndef WFLUSH
# Line 29 | Line 31 | static const char      RCSid[] = "$Id$";
31   #define  sscanvec(s,v)  (sscanf(s,"%lf %lf %lf",v,v+1,v+2)==3)
32   #endif
33  
34 + extern int      ray_pnprocs;
35 +
36   static RNUMBER  niflush;                /* flushes since newimage() */
37  
38   int
# Line 112 | Line 116 | getinterest(           /* get area of interest */
116                  }
117                  if (!direc || ourview.type == VT_PAR) {
118                          rayorigin(&thisray, PRIMARY, NULL, NULL);
119 <                        if (!localhit(&thisray, &thescene)) {
119 >                        while (localhit(&thisray, &thescene)) {
120 >                                OBJREC  *m = findmaterial(thisray.ro);
121 >                                if (m != NULL && !istransp(m->otype) &&
122 >                                                !isBSDFproxy(m) &&
123 >                                                (thisray.clipset == NULL ||
124 >                                                        !inset(thisray.clipset,
125 >                                                            thisray.ro->omod)))
126 >                                        break;          /* found something */
127 >                                VCOPY(thisray.rorg, thisray.rop);
128 >                                rayclear(&thisray);     /* skip invisible */
129 >                        }
130 >                        if ((thisray.ro == NULL) | (thisray.ro == &Aftplane)) {
131                                  error(COMMAND, "not a local object");
132                                  return(-1);
133                          }
# Line 137 | Line 152 | getinterest(           /* get area of interest */
152   }
153  
154  
155 < float *         /* keep consistent with COLOR typedef */
155 > COLORV *
156   greyof(                         /* convert color to greyscale */
157          COLOR  col
158   )
# Line 192 | Line 207 | paint(                 /* compute and paint a rectangle */
207          if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir, &ourview,
208                          h/hresolu, v/vresolu)) < -FTINY) {
209                  setcolor(thisray.rcol, 0.0, 0.0, 0.0);
210 <        } else if (nproc == 1) {                /* immediate mode */
210 >        } else if (!ray_pnprocs) {              /* immediate mode */
211                  ray_trace(&thisray);
212          } else {                                /* queuing mode */
213                  int     rval;
# Line 216 | Line 231 | paint(                 /* compute and paint a rectangle */
231                  static RNUMBER  lastflush = 0;
232                  RNUMBER         counter = raynum;
233                  int             flushintvl;
234 <                if (nproc == 1) {
234 >                if (!ray_pnprocs) {
235                          counter = nrays;
236                          flushintvl = WFLUSH1;
237                  } else if (ambounce == 0)
238 <                        flushintvl = nproc*WFLUSH;
238 >                        flushintvl = ray_pnprocs*WFLUSH;
239                  else if (niflush < WFLUSH)
240 <                        flushintvl = nproc*niflush/(ambounce+1);
240 >                        flushintvl = ray_pnprocs*niflush/(ambounce*(ambounce>0)+1);
241                  else
242 <                        flushintvl = nproc*WFLUSH/(ambounce+1);
242 >                        flushintvl = ray_pnprocs*WFLUSH/(ambounce*(ambounce>0)+1);
243                  if (lastflush > counter)
244                          lastflush = 0;          /* counter wrapped */
245  
# Line 245 | Line 260 | waitrays(void)                                 /* finish up pending rays */
260          int     rval;
261          RAY     raydone;
262  
263 <        if (nproc <= 1)                         /* immediate mode? */
263 >        if (!ray_pnprocs)                       /* immediate mode? */
264                  return(0);
265          while ((rval = ray_presult(&raydone, 0)) > 0) {
266                  PNODE  *p = (PNODE *)raydone.rno;
# Line 265 | Line 280 | newimage(                                      /* start a new image */
280          char *s
281   )
282   {
268        extern int      ray_pnprocs;
283          int             newnp = 0;
284                                                  /* # rendering procs arg? */
285          if (s != NULL)
# Line 284 | Line 298 | newimage(                                      /* start a new image */
298          (*dev->clear)(hresolu, vresolu);
299  
300          if (newparam) {                         /* (re)start rendering procs */
301 <                if (ray_pnprocs > 0)
302 <                        ray_pclose(0);
301 >                if (ray_pnprocs)
302 >                        ray_pclose(0);          /* should already be closed */
303                  if (newnp > 0)
304                          nproc = newnp;
305                  if (nproc > 1)
# Line 516 | Line 530 | moveview(                                      /* move viewpoint */
530   )
531   {
532          double  d;
519        FVECT  v1;
533          VIEW  nv = ourview;
534          int  i;
535  
536          spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.));
537 <        if (elev != 0.0) {
538 <                fcross(v1, ourview.vup, nv.vdir);
539 <                normalize(v1);
527 <                spinvector(nv.vdir, nv.vdir, v1, elev*(PI/180.));
528 <        }
537 >        if (elev != 0.0)
538 >                geodesic(nv.vdir, nv.vdir, nv.vup, elev*(-PI/180.), GEOD_RAD);
539 >
540          if (nv.type == VT_PAR) {
541                  nv.horiz /= mag;
542                  nv.vert /= mag;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines