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 1.16 by greg, Tue Jun 26 09:00:19 1990 UTC vs.
Revision 2.33 by greg, Fri Oct 8 20:41:04 2010 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1987 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  rv3.c - miscellaneous routines for rview.
6   *
7 < *     5/11/87
7 > *  External symbols declared in rpaint.h
8   */
9  
10 < #include  "ray.h"
10 > #include "copyright.h"
11  
12 < #include  "octree.h"
12 > #include <string.h>
13  
14 + #include  "ray.h"
15   #include  "rpaint.h"
18
16   #include  "random.h"
17  
18   #ifndef WFLUSH
19 < #define WFLUSH          30              /* flush after this many rays */
19 > #define WFLUSH          64              /* flush after this many primary rays */
20   #endif
21 + #ifndef WFLUSH1
22 + #define WFLUSH1         512             /* or this many total rays */
23 + #endif
24  
25  
26 < getrect(s, r)                           /* get a box */
27 < char  *s;
28 < register RECT  *r;
26 > #ifdef  SMLFLT
27 > #define  sscanvec(s,v)  (sscanf(s,"%f %f %f",v,v+1,v+2)==3)
28 > #else
29 > #define  sscanvec(s,v)  (sscanf(s,"%lf %lf %lf",v,v+1,v+2)==3)
30 > #endif
31 >
32 > static RNUMBER  niflush;                /* flushes since newimage() */
33 >
34 > int
35 > getrect(                                /* get a box */
36 >        char  *s,
37 >        RECT  *r
38 > )
39   {
40          int  x0, y0, x1, y1;
41  
# Line 69 | Line 79 | register RECT  *r;
79   }
80  
81  
82 < getinterest(s, direc, vec, mp)          /* get area of interest */
83 < char  *s;
84 < int  direc;
85 < FVECT  vec;
86 < double  *mp;
82 > int
83 > getinterest(            /* get area of interest */
84 >        char  *s,
85 >        int  direc,
86 >        FVECT  vec,
87 >        double  *mp
88 > )
89   {
90          int  x, y;
91          RAY  thisray;
92 <        register int  i;
92 >        int  i;
93  
94          if (sscanf(s, "%lf", mp) != 1)
95                  *mp = 1.0;
# Line 87 | Line 99 | double  *mp;
99                  error(COMMAND, "illegal magnification");
100                  return(-1);
101          }
102 <        if (sscanf(s, "%*lf %lf %lf %lf", &vec[0], &vec[1], &vec[2]) != 3) {
102 >        if (!sscanvec(sskip(s), vec)) {
103                  if (dev->getcur == NULL)
104                          return(-1);
105                  (*dev->comout)("Pick view center\n");
106                  if ((*dev->getcur)(&x, &y) == ABORT)
107                          return(-1);
108 <                viewray(thisray.rorg, thisray.rdir, &ourview,
109 <                                (x+.5)/hresolu, (y+.5)/vresolu);
108 >                if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir,
109 >                        &ourview, (x+.5)/hresolu, (y+.5)/vresolu)) < -FTINY) {
110 >                        error(COMMAND, "not on image");
111 >                        return(-1);
112 >                }
113                  if (!direc || ourview.type == VT_PAR) {
114 <                        rayorigin(&thisray, NULL, PRIMARY, 1.0);
114 >                        rayorigin(&thisray, PRIMARY, NULL, NULL);
115                          if (!localhit(&thisray, &thescene)) {
116                                  error(COMMAND, "not a local object");
117                                  return(-1);
# Line 110 | Line 125 | double  *mp;
125                                  VCOPY(vec, thisray.rdir);
126                  else
127                          VCOPY(vec, thisray.rop);
128 <        } else if (direc)
129 <                        for (i = 0; i < 3; i++)
130 <                                vec[i] -= ourview.vp[i];
128 >        } else if (direc) {
129 >                for (i = 0; i < 3; i++)
130 >                        vec[i] -= ourview.vp[i];
131 >                if (normalize(vec) == 0.0) {
132 >                        error(COMMAND, "point at view origin");
133 >                        return(-1);
134 >                }
135 >        }
136          return(0);
137   }
138  
139  
140   float *         /* keep consistent with COLOR typedef */
141 < greyof(col)                             /* convert color to greyscale */
142 < register COLOR  col;
141 > greyof(                         /* convert color to greyscale */
142 >        COLOR  col
143 > )
144   {
145          static COLOR  gcol;
146          double  b;
# Line 129 | Line 150 | register COLOR  col;
150          return(gcol);
151   }
152  
153 + static void
154 + recolor(                                        /* recolor the given node */
155 +        PNODE *p
156 + )
157 + {
158 +        while (p->kid != NULL) {                /* need to propogate down */
159 +                int  mx = (p->xmin + p->xmax) >> 1;
160 +                int  my = (p->ymin + p->ymax) >> 1;
161 +                int  ki;
162 +                if (p->x >= mx)
163 +                        ki = (p->y >= my) ? UR : DR;
164 +                else
165 +                        ki = (p->y >= my) ? UL : DL;
166 +                pcopy(p, p->kid+ki);
167 +                p = p->kid + ki;
168 +        }
169  
170 < paint(p, xmin, ymin, xmax, ymax)        /* compute and paint a rectangle */
171 < register PNODE  *p;
172 < int  xmin, ymin, xmax, ymax;
170 >        (*dev->paintr)(greyscale?greyof(p->v):p->v,
171 >                        p->xmin, p->ymin, p->xmax, p->ymax);
172 > }
173 >
174 > int
175 > paint(                  /* compute and paint a rectangle */
176 >        PNODE  *p
177 > )
178   {
137        extern long  nrays;
138        static long  lastflush = 0;
179          static RAY  thisray;
180          double  h, v;
181  
182 <        if (xmax - xmin <= 0 || ymax - ymin <= 0) {     /* empty */
183 <                p->x = xmin;
184 <                p->y = ymin;
182 >        if ((p->xmax <= p->xmin) | (p->ymax <= p->ymin)) {      /* empty */
183 >                p->x = p->xmin;
184 >                p->y = p->ymin;
185                  setcolor(p->v, 0.0, 0.0, 0.0);
186 <                return;
186 >                return(0);
187          }
188                                                  /* jitter ray direction */
189 <        h = xmin + (xmax-xmin)*frandom();
190 <        v = ymin + (ymax-ymin)*frandom();
189 >        p->x = h = p->xmin + (p->xmax-p->xmin)*frandom();
190 >        p->y = v = p->ymin + (p->ymax-p->ymin)*frandom();
191          
192 <        viewray(thisray.rorg, thisray.rdir, &ourview, h/hresolu, v/vresolu);
193 <        rayorigin(&thisray, NULL, PRIMARY, 1.0);
194 <        rayvalue(&thisray);
192 >        if ((thisray.rmax = viewray(thisray.rorg, thisray.rdir, &ourview,
193 >                        h/hresolu, v/vresolu)) < -FTINY) {
194 >                setcolor(thisray.rcol, 0.0, 0.0, 0.0);
195 >        } else if (nproc == 1) {                /* immediate mode */
196 >                ray_trace(&thisray);
197 >        } else {                                /* queuing mode */
198 >                int     rval;
199 >                rayorigin(&thisray, PRIMARY, NULL, NULL);
200 >                thisray.rno = (RNUMBER)p;
201 >                rval = ray_pqueue(&thisray);
202 >                if (!rval)
203 >                        return(0);
204 >                if (rval < 0)
205 >                        return(-1);
206 >                                                /* random color place holder */
207 >                setcolor(p->v, frandom(), frandom(), frandom());
208 >                                                /* get node for returned ray */
209 >                p = (PNODE *)thisray.rno;
210 >        }
211  
156        p->x = h;
157        p->y = v;
212          copycolor(p->v, thisray.rcol);
213          scalecolor(p->v, exposure);
214  
215 <        (*dev->paintr)(greyscale?greyof(p->v):p->v, xmin, ymin, xmax, ymax);
215 >        recolor(p);                             /* paint it */
216  
217 <        if (dev->flush != NULL && nrays - lastflush >= WFLUSH) {
218 <                lastflush = nrays;
219 <                (*dev->flush)();
217 >        if (dev->flush != NULL) {               /* shall we check for input? */
218 >                static RNUMBER  lastflush = 0;
219 >                RNUMBER         counter = raynum;
220 >                int             flushintvl;
221 >                if (nproc == 1) {
222 >                        counter = nrays;
223 >                        flushintvl = WFLUSH1;
224 >                } else if (ambounce == 0)
225 >                        flushintvl = nproc*WFLUSH;
226 >                else if (niflush < WFLUSH)
227 >                        flushintvl = nproc*niflush/(ambounce+1);
228 >                else
229 >                        flushintvl = nproc*WFLUSH/(ambounce+1);
230 >                if (lastflush > counter)
231 >                        lastflush = 0;          /* counter wrapped */
232 >
233 >                if (counter - lastflush >= flushintvl) {
234 >                        lastflush = counter;
235 >                        (*dev->flush)();
236 >                        niflush++;
237 >                }
238          }
239 +        return(1);
240   }
241  
242  
243 < newimage()                              /* start a new image */
243 > int
244 > waitrays(void)                                  /* finish up pending rays */
245   {
246 +        int     nwaited = 0;
247 +        int     rval;
248 +        RAY     raydone;
249 +
250 +        if (nproc <= 1)                         /* immediate mode? */
251 +                return(0);
252 +        while ((rval = ray_presult(&raydone, 0)) > 0) {
253 +                PNODE  *p = (PNODE *)raydone.rno;
254 +                copycolor(p->v, raydone.rcol);
255 +                scalecolor(p->v, exposure);
256 +                recolor(p);
257 +                nwaited++;
258 +        }
259 +        if (rval < 0)
260 +                return(-1);
261 +        return(nwaited);
262 + }
263 +
264 +
265 + void
266 + newimage(                                       /* start a new image */
267 +        char *s
268 + )
269 + {
270 +        extern int      ray_pnprocs;
271 +        int             newnp;
272 +                                                /* change in nproc? */
273 +        if (s != NULL && sscanf(s, "%d", &newnp) == 1 &&
274 +                        (newnp > 0) & (newnp != nproc)) {
275 +                if (!newparam) {
276 +                        if (newnp == 1)
277 +                                ray_pclose(0);
278 +                        else if (newnp < ray_pnprocs)
279 +                                ray_pclose(ray_pnprocs - newnp);
280 +                        else
281 +                                ray_popen(newnp - ray_pnprocs);
282 +                }
283 +                nproc = newnp;
284 +        }
285                                                  /* free old image */
286          freepkids(&ptrunk);
287                                                  /* compute resolution */
288          hresolu = dev->xsiz;
289          vresolu = dev->ysiz;
290          normaspect(viewaspect(&ourview), &dev->pixaspect, &hresolu, &vresolu);
291 <        pframe.l = pframe.d = 0;
292 <        pframe.r = hresolu; pframe.u = vresolu;
291 >        ptrunk.xmin = ptrunk.ymin = pframe.l = pframe.d = 0;
292 >        ptrunk.xmax = pframe.r = hresolu;
293 >        ptrunk.ymax = pframe.u = vresolu;
294          pdepth = 0;
295                                                  /* clear device */
296          (*dev->clear)(hresolu, vresolu);
297 <                                                /* get first value */
298 <        paint(&ptrunk, 0, 0, hresolu, vresolu);
297 >
298 >        if (newparam) {                         /* (re)start rendering procs */
299 >                if (ray_pnprocs > 0)
300 >                        ray_pclose(0);
301 >                if (nproc > 1)
302 >                        ray_popen(nproc);
303 >                newparam = 0;
304 >        }
305 >        niflush = 0;                            /* get first value */
306 >        paint(&ptrunk);
307   }
308  
309  
310 < redraw()                                /* redraw the image */
310 > void
311 > redraw(void)                            /* redraw the image */
312   {
313          (*dev->clear)(hresolu, vresolu);
314          (*dev->comout)("redrawing...\n");
# Line 194 | Line 317 | redraw()                               /* redraw the image */
317   }
318  
319  
320 < repaint(xmin, ymin, xmax, ymax)                 /* repaint a region */
321 < int  xmin, ymin, xmax, ymax;
320 > void
321 > repaint(                                /* repaint a region */
322 >        int  xmin,
323 >        int  ymin,
324 >        int  xmax,
325 >        int  ymax
326 > )
327   {
328          RECT  reg;
329  
330          reg.l = xmin; reg.r = xmax;
331          reg.d = ymin; reg.u = ymax;
332  
333 <        paintrect(&ptrunk, 0, 0, hresolu, vresolu, &reg);
333 >        paintrect(&ptrunk, &reg);
334   }
335  
336  
337 < paintrect(p, xmin, ymin, xmax, ymax, r)         /* paint picture rectangle */
338 < register PNODE  *p;
339 < int  xmin, ymin, xmax, ymax;
340 < register RECT  *r;
337 > void
338 > paintrect(                              /* paint picture rectangle */
339 >        PNODE  *p,
340 >        RECT  *r
341 > )
342   {
343          int  mx, my;
344  
345 <        if (xmax - xmin <= 0 || ymax - ymin <= 0)
345 >        if (p->xmax - p->xmin <= 0 || p->ymax - p->ymin <= 0)
346                  return;
347  
348          if (p->kid == NULL) {
349                  (*dev->paintr)(greyscale?greyof(p->v):p->v,
350 <                                xmin, ymin, xmax, ymax);        /* do this */
350 >                        p->xmin, p->ymin, p->xmax, p->ymax);    /* do this */
351                  return;
352          }
353 <        mx = (xmin + xmax) >> 1;                                /* do kids */
354 <        my = (ymin + ymax) >> 1;
353 >        mx = (p->xmin + p->xmax) >> 1;                          /* do kids */
354 >        my = (p->ymin + p->ymax) >> 1;
355          if (mx > r->l) {
356                  if (my > r->d)
357 <                        paintrect(p->kid+DL, xmin, ymin, mx, my, r);
357 >                        paintrect(p->kid+DL, r);
358                  if (my < r->u)
359 <                        paintrect(p->kid+UL, xmin, my, mx, ymax, r);
359 >                        paintrect(p->kid+UL, r);
360          }
361          if (mx < r->r) {
362                  if (my > r->d)
363 <                        paintrect(p->kid+DR, mx, ymin, xmax, my, r);
363 >                        paintrect(p->kid+DR, r);
364                  if (my < r->u)
365 <                        paintrect(p->kid+UR, mx, my, xmax, ymax, r);
365 >                        paintrect(p->kid+UR, r);
366          }
367   }
368  
369  
370   PNODE *
371 < findrect(x, y, p, r, pd)                /* find a rectangle */
372 < int  x, y;
373 < register PNODE  *p;
374 < register RECT  *r;
375 < int  pd;
371 > findrect(                               /* find a rectangle */
372 >        int  x,
373 >        int  y,
374 >        PNODE  *p,
375 >        int  pd
376 > )
377   {
378          int  mx, my;
379  
380          while (p->kid != NULL && pd--) {
381  
382 <                mx = (r->l + r->r) >> 1;
383 <                my = (r->d + r->u) >> 1;
382 >                mx = (p->xmin + p->xmax) >> 1;
383 >                my = (p->ymin + p->ymax) >> 1;
384  
385                  if (x < mx) {
256                        r->r = mx;
386                          if (y < my) {
258                                r->u = my;
387                                  p = p->kid+DL;
388                          } else {
261                                r->d = my;
389                                  p = p->kid+UL;
390                          }
391                  } else {
265                        r->l = mx;
392                          if (y < my) {
267                                r->u = my;
393                                  p = p->kid+DR;
394                          } else {
270                                r->d = my;
395                                  p = p->kid+UR;
396                          }
397                  }
# Line 276 | Line 400 | int  pd;
400   }
401  
402  
403 < scalepict(p, sf)                        /* scale picture values */
404 < register PNODE  *p;
405 < double  sf;
403 > void
404 > compavg(                                /* recompute averages */
405 >        PNODE   *p
406 > )
407   {
408 +        int     i, navg;
409 +        
410 +        if (p->kid == NULL)
411 +                return;
412 +
413 +        setcolor(p->v, .0, .0, .0);
414 +        navg = 0;
415 +        for (i = 0; i < 4; i++) {
416 +                if (p->kid[i].xmin >= p->kid[i].xmax) continue;
417 +                if (p->kid[i].ymin >= p->kid[i].ymax) continue;
418 +                compavg(p->kid+i);
419 +                addcolor(p->v, p->kid[i].v);
420 +                navg++;
421 +        }
422 +        if (navg > 1)
423 +                scalecolor(p->v, 1./navg);
424 + }
425 +
426 +
427 + void
428 + scalepict(                              /* scale picture values */
429 +        PNODE  *p,
430 +        double  sf
431 + )
432 + {
433          scalecolor(p->v, sf);           /* do this node */
434  
435          if (p->kid == NULL)
# Line 292 | Line 442 | double  sf;
442   }
443  
444  
445 < getpictcolrs(yoff, scan, p, xsiz, ysiz) /* get scanline from picture */
446 < int  yoff;
447 < register COLR  *scan;
448 < register PNODE  *p;
449 < int  xsiz, ysiz;
445 > void
446 > getpictcolrs(                           /* get scanline from picture */
447 >        int  yoff,
448 >        COLR  *scan,
449 >        PNODE  *p,
450 >        int  xsiz,
451 >        int  ysiz
452 > )
453   {
454 <        register int  mx;
454 >        int  mx;
455          int  my;
456  
457          if (p->kid == NULL) {                   /* do this node */
# Line 322 | Line 475 | int  xsiz, ysiz;
475   }
476  
477  
478 < pcopy(p1, p2)                           /* copy paint node p1 into p2 */
479 < register PNODE  *p1, *p2;
478 > void
479 > freepkids(                              /* free pnode's children */
480 >        PNODE  *p
481 > )
482   {
328        copycolor(p2->v, p1->v);
329        p2->x = p1->x;
330        p2->y = p1->y;
331 }
332
333
334 freepkids(p)                            /* free pnode's children */
335 register PNODE  *p;
336 {
483          if (p->kid == NULL)
484                  return;
485          freepkids(p->kid+DL);
486          freepkids(p->kid+DR);
487          freepkids(p->kid+UL);
488          freepkids(p->kid+UR);
489 <        free((char *)p->kid);
489 >        free((void *)p->kid);
490          p->kid = NULL;
491   }
492  
493  
494 < newview(vp)                             /* change viewing parameters */
495 < register VIEW  *vp;
494 > void
495 > newview(                                        /* change viewing parameters */
496 >        VIEW  *vp
497 > )
498   {
499          char  *err;
500  
501          if ((err = setview(vp)) != NULL) {
502                  sprintf(errmsg, "view not set - %s", err);
503                  error(COMMAND, errmsg);
504 <        } else if (bcmp((char *)vp, (char *)&ourview, sizeof(VIEW))) {
505 <                copystruct(&oldview, &ourview);
506 <                copystruct(&ourview, vp);
507 <                newimage();
504 >        } else if (memcmp((char *)vp, (char *)&ourview, sizeof(VIEW))) {
505 >                oldview = ourview;
506 >                ourview = *vp;
507 >                newimage(NULL);
508          }
509   }
510  
511  
512 < moveview(angle, elev, mag, vc)                  /* move viewpoint */
513 < double  angle, elev, mag;
514 < FVECT  vc;
512 > void
513 > moveview(                                       /* move viewpoint */
514 >        double  angle,
515 >        double  elev,
516 >        double  mag,
517 >        FVECT  vc
518 > )
519   {
368        extern double  sqrt(), dist2();
520          double  d;
521          FVECT  v1;
522 <        VIEW  nv;
523 <        register int  i;
522 >        VIEW  nv = ourview;
523 >        int  i;
524  
374        VCOPY(nv.vup, ourview.vup);
375        nv.hoff = ourview.hoff; nv.voff = ourview.voff;
525          spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.));
526          if (elev != 0.0) {
527                  fcross(v1, ourview.vup, nv.vdir);
528                  normalize(v1);
529                  spinvector(nv.vdir, nv.vdir, v1, elev*(PI/180.));
530          }
531 <        if ((nv.type = ourview.type) == VT_PAR) {
532 <                nv.horiz = ourview.horiz / mag;
533 <                nv.vert = ourview.vert / mag;
531 >        if (nv.type == VT_PAR) {
532 >                nv.horiz /= mag;
533 >                nv.vert /= mag;
534                  d = 0.0;                        /* don't move closer */
535                  for (i = 0; i < 3; i++)
536                          d += (vc[i] - ourview.vp[i])*ourview.vdir[i];
537          } else {
389                nv.horiz = ourview.horiz;
390                nv.vert = ourview.vert;
538                  d = sqrt(dist2(ourview.vp, vc)) / mag;
539 +                if (nv.vfore > FTINY) {
540 +                        nv.vfore += d - d*mag;
541 +                        if (nv.vfore < 0.0) nv.vfore = 0.0;
542 +                }
543 +                if (nv.vaft > FTINY) {
544 +                        nv.vaft += d - d*mag;
545 +                        if (nv.vaft <= nv.vfore) nv.vaft = 0.0;
546 +                }
547 +                nv.vdist /= mag;
548          }
549          for (i = 0; i < 3; i++)
550                  nv.vp[i] = vc[i] - d*nv.vdir[i];
# Line 396 | Line 552 | FVECT  vc;
552   }
553  
554  
555 < spinvector(vres, vorig, vnorm, theta)   /* rotate vector around normal */
556 < FVECT  vres, vorig, vnorm;
557 < double  theta;
555 > void
556 > pcopy(                                  /* copy paint node p1 into p2 */
557 >        PNODE  *p1,
558 >        PNODE  *p2
559 > )
560   {
561 <        extern double  sin(), cos();
562 <        double  sint, cost, dotp;
563 <        FVECT  vperp;
564 <        register int  i;
565 <        
566 <        if (theta == 0.0) {
567 <                VCOPY(vres, vorig);
561 >        copycolor(p2->v, p1->v);
562 >        p2->x = p1->x;
563 >        p2->y = p1->y;
564 > }
565 >
566 >
567 > void
568 > zoomview(                               /* zoom in or out */
569 >        VIEW  *vp,
570 >        double  zf
571 > )
572 > {
573 >        switch (vp->type) {
574 >        case VT_PAR:                            /* parallel view */
575 >                vp->horiz /= zf;
576 >                vp->vert /= zf;
577                  return;
578 +        case VT_ANG:                            /* angular fisheye */
579 +                vp->horiz /= zf;
580 +                if (vp->horiz > 360.)
581 +                        vp->horiz = 360.;
582 +                vp->vert /= zf;
583 +                if (vp->vert > 360.)
584 +                        vp->vert = 360.;
585 +                return;
586 +        case VT_PLS:                            /* planisphere fisheye */
587 +                vp->horiz = sin((PI/180./2.)*vp->horiz) /
588 +                                (1.0 + cos((PI/180./2.)*vp->horiz)) / zf;
589 +                vp->horiz *= vp->horiz;
590 +                vp->horiz = (2.*180./PI)*acos((1. - vp->horiz) /
591 +                                                (1. + vp->horiz));
592 +                vp->vert = sin((PI/180./2.)*vp->vert) /
593 +                                (1.0 + cos((PI/180./2.)*vp->vert)) / zf;
594 +                vp->vert *= vp->vert;
595 +                vp->vert = (2.*180./PI)*acos((1. - vp->vert) /
596 +                                                (1. + vp->vert));
597 +                return;
598 +        case VT_CYL:                            /* cylindrical panorama */
599 +                vp->horiz /= zf;
600 +                if (vp->horiz > 360.)
601 +                        vp->horiz = 360.;
602 +                vp->vert = atan(tan(vp->vert*(PI/180./2.))/zf) / (PI/180./2.);
603 +                return;
604 +        case VT_PER:                            /* perspective view */
605 +                vp->horiz = atan(tan(vp->horiz*(PI/180./2.))/zf) /
606 +                                (PI/180./2.);
607 +                vp->vert = atan(tan(vp->vert*(PI/180./2.))/zf) /
608 +                                (PI/180./2.);
609 +                return;
610 +        case VT_HEM:                            /* hemispherical fisheye */
611 +                vp->horiz = sin(vp->horiz*(PI/180./2.))/zf;
612 +                if (vp->horiz >= 1.0-FTINY)
613 +                        vp->horiz = 180.;
614 +                else
615 +                        vp->horiz = asin(vp->horiz) / (PI/180./2.);
616 +                vp->vert = sin(vp->vert*(PI/180./2.))/zf;
617 +                if (vp->vert >= 1.0-FTINY)
618 +                        vp->vert = 180.;
619 +                else
620 +                        vp->vert = asin(vp->vert) / (PI/180./2.);
621 +                return;
622          }
412        sint = sin(theta);
413        cost = cos(theta);
414        dotp = DOT(vorig, vnorm);
415        fcross(vperp, vnorm, vorig);
416        for (i = 0; i < 3; i++)
417                vres[i] = vnorm[i]*dotp*(1.-cost) +
418                                vorig[i]*cost + vperp[i]*sint;
623   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines