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.12 by schorsch, Mon Jun 30 14:59:13 2003 UTC vs.
Revision 2.18 by greg, Mon Jun 13 20:07:56 2005 UTC

# Line 108 | Line 108 | double  *mp;
108                          return(-1);
109                  }
110                  if (!direc || ourview.type == VT_PAR) {
111 <                        rayorigin(&thisray, NULL, PRIMARY, 1.0);
111 >                        rayorigin(&thisray, PRIMARY, NULL, NULL);
112                          if (!localhit(&thisray, &thescene)) {
113                                  error(COMMAND, "not a local object");
114                                  return(-1);
# Line 122 | Line 122 | double  *mp;
122                                  VCOPY(vec, thisray.rdir);
123                  else
124                          VCOPY(vec, thisray.rop);
125 <        } else if (direc)
126 <                        for (i = 0; i < 3; i++)
127 <                                vec[i] -= ourview.vp[i];
125 >        } else if (direc) {
126 >                for (i = 0; i < 3; i++)
127 >                        vec[i] -= ourview.vp[i];
128 >                if (normalize(vec) == 0.0) {
129 >                        error(COMMAND, "point at view origin");
130 >                        return(-1);
131 >                }
132 >        }
133          return(0);
134   }
135  
# Line 165 | Line 170 | int  xmin, ymin, xmax, ymax;
170                          h/hresolu, v/vresolu)) < -FTINY) {
171                  setcolor(thisray.rcol, 0.0, 0.0, 0.0);
172          } else {
173 <                rayorigin(&thisray, NULL, PRIMARY, 1.0);
174 <                samplendx++;
173 >                rayorigin(&thisray, PRIMARY, NULL, NULL);
174 >                samplendx = rand_samp ? random() : samplendx+1;
175                  rayvalue(&thisray);
176          }
177  
# Line 372 | Line 377 | register VIEW  *vp;
377                  sprintf(errmsg, "view not set - %s", err);
378                  error(COMMAND, errmsg);
379          } else if (memcmp((char *)vp, (char *)&ourview, sizeof(VIEW))) {
380 <                copystruct(&oldview, &ourview);
381 <                copystruct(&ourview, vp);
380 >                oldview = ourview;
381 >                ourview = *vp;
382                  newimage();
383          }
384   }
# Line 386 | Line 391 | FVECT  vc;
391   {
392          double  d;
393          FVECT  v1;
394 <        VIEW  nv;
394 >        VIEW  nv = ourview;
395          register int  i;
396  
392        VCOPY(nv.vup, ourview.vup);
393        nv.hoff = ourview.hoff; nv.voff = ourview.voff;
397          spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.));
398          if (elev != 0.0) {
399                  fcross(v1, ourview.vup, nv.vdir);
400                  normalize(v1);
401                  spinvector(nv.vdir, nv.vdir, v1, elev*(PI/180.));
402          }
403 <        if ((nv.type = ourview.type) == VT_PAR) {
404 <                nv.horiz = ourview.horiz / mag;
405 <                nv.vert = ourview.vert / mag;
403 >        if (nv.type == VT_PAR) {
404 >                nv.horiz /= mag;
405 >                nv.vert /= mag;
406                  d = 0.0;                        /* don't move closer */
407                  for (i = 0; i < 3; i++)
408                          d += (vc[i] - ourview.vp[i])*ourview.vdir[i];
406                nv.vfore = ourview.vfore;
407                nv.vaft = ourview.vaft;
409          } else {
409                nv.horiz = ourview.horiz;
410                nv.vert = ourview.vert;
410                  d = sqrt(dist2(ourview.vp, vc)) / mag;
411 <                if ((nv.vfore = ourview.vfore) > FTINY) {
411 >                if (nv.vfore > FTINY) {
412                          nv.vfore += d - d*mag;
413                          if (nv.vfore < 0.0) nv.vfore = 0.0;
414                  }
415 <                if ((nv.vaft = ourview.vaft) > FTINY) {
415 >                if (nv.vaft > FTINY) {
416                          nv.vaft += d - d*mag;
417                          if (nv.vaft <= nv.vfore) nv.vaft = 0.0;
418                  }
419 +                nv.vdist /= mag;
420          }
421          for (i = 0; i < 3; i++)
422                  nv.vp[i] = vc[i] - d*nv.vdir[i];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines