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

Comparing ray/src/rt/rv2.c (file contents):
Revision 2.78 by greg, Tue Apr 22 16:39:20 2025 UTC vs.
Revision 2.80 by greg, Sat Jun 7 05:09:46 2025 UTC

# Line 14 | Line 14 | static const char      RCSid[] = "$Id$";
14  
15   #include  "platform.h"
16   #include  "rtprocess.h" /* win_popen() */
17 #include  "paths.h"
17   #include  "ray.h"
18   #include  "ambient.h"
19   #include  "otypes.h"
# Line 374 | Line 373 | getorigin(                             /* origin viewpoint */
373   )
374   {
375          VIEW    nv = ourview;
376 +        FVECT   voff;
377 +        int     i;
378          double  d;
379 <                                        /* get new view origin */
380 <        if (sscanf(s, "%lf %lf", &d, &d) == 1) {
381 <                                        /* just moving some distance */
382 <                VSUM(nv.vp, nv.vp, nv.vdir, d);
383 <        } else if (!sscanvec(s, nv.vp)) {
384 <                int     x, y;           /* need to pick origin */
379 >                                        /* check for view origin shift */
380 >        if (sscanf(s, "%lf", &d) == 1) {
381 >                double  d_fore=d, d_right=0, d_up=0;
382 >                sscanf(s, "%*f %lf %lf", &d_right, &d_up);
383 >                d_right /= sqrt(nv.hn2);
384 >                for (i = 3; i--; )
385 >                        nv.vp[i] += d_fore*nv.vdir[i] +
386 >                                        d_right*nv.hvec[i] +
387 >                                        d_up*nv.vup[i];
388 >        } else {                        /* else pick new origin */
389 >                int     x, y;
390                  RAY     thisray;
391                  if (dev->getcur == NULL)
392                          return;
# Line 401 | Line 407 | getorigin(                             /* origin viewpoint */
407                          flipsurface(&thisray);
408                  VSUM(nv.vp, thisray.rop, thisray.ron, 20.0*FTINY);
409                  VCOPY(nv.vdir, thisray.ron);
410 <        } else if (!sscanvec(sskip2(s,3), nv.vdir) || normalize(nv.vdir) == 0.0)
411 <                VCOPY(nv.vdir, ourview.vdir);
412 <
413 <        d = DOT(nv.vdir, nv.vup);       /* need different up vector? */
414 <        if (d*d >= 1.-2.*FTINY) {
415 <                int     i;
416 <                nv.vup[0] = nv.vup[1] = nv.vup[2] = 0.0;
417 <                for (i = 3; i--; )
418 <                        if (nv.vdir[i]*nv.vdir[i] < 0.34)
413 <                                break;
414 <                nv.vup[i] = 1.;
410 >                d = DOT(nv.vdir, nv.vup);
411 >                if (d*d >= 1.-2.*FTINY) {
412 >                                        /* need different up vector */
413 >                        nv.vup[0] = nv.vup[1] = nv.vup[2] = 0.0;
414 >                        for (i = 3; i--; )
415 >                                if (nv.vdir[i]*nv.vdir[i] < 0.34)
416 >                                        break;
417 >                        nv.vup[i] = 1.;
418 >                }
419          }
420          newview(&nv);
421   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines