--- ray/src/rt/rv3.c 2005/01/21 00:52:59 2.15 +++ ray/src/rt/rv3.c 2008/03/11 02:21:47 2.21 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rv3.c,v 2.15 2005/01/21 00:52:59 greg Exp $"; +static const char RCSid[] = "$Id: rv3.c,v 2.21 2008/03/11 02:21:47 greg Exp $"; #endif /* * rv3.c - miscellaneous routines for rview. @@ -16,12 +16,8 @@ static const char RCSid[] = "$Id: rv3.c,v 2.15 2005/01 #include "random.h" #ifndef WFLUSH -#ifdef SPEED -#define WFLUSH (5*SPEED) -#else -#define WFLUSH 100 /* flush after this many rays */ +#define WFLUSH 2048 /* flush after this many rays */ #endif -#endif #ifdef SMLFLT #define sscanvec(s,v) (sscanf(s,"%f %f %f",v,v+1,v+2)==3) @@ -108,7 +104,7 @@ double *mp; return(-1); } if (!direc || ourview.type == VT_PAR) { - rayorigin(&thisray, NULL, PRIMARY, 1.0); + rayorigin(&thisray, PRIMARY, NULL, NULL); if (!localhit(&thisray, &thescene)) { error(COMMAND, "not a local object"); return(-1); @@ -170,7 +166,7 @@ int xmin, ymin, xmax, ymax; h/hresolu, v/vresolu)) < -FTINY) { setcolor(thisray.rcol, 0.0, 0.0, 0.0); } else { - rayorigin(&thisray, NULL, PRIMARY, 1.0); + rayorigin(&thisray, PRIMARY, NULL, NULL); samplendx++; rayvalue(&thisray); } @@ -416,7 +412,7 @@ FVECT vc; nv.vaft += d - d*mag; if (nv.vaft <= nv.vfore) nv.vaft = 0.0; } - nv.vdist += d - d*mag; + nv.vdist /= mag; } for (i = 0; i < 3; i++) nv.vp[i] = vc[i] - d*nv.vdir[i]; @@ -451,6 +447,18 @@ double zf; vp->vert /= zf; if (vp->vert > 360.) vp->vert = 360.; + return; + case VT_PLS: /* planisphere fisheye */ + vp->horiz = sin((PI/180./2.)*vp->horiz) / + (1.0 + cos((PI/180./2.)*vp->horiz)) / zf; + vp->horiz *= vp->horiz; + vp->horiz = (2.*180./PI)*acos((1. - vp->horiz) / + (1. + vp->horiz)); + vp->vert = sin((PI/180./2.)*vp->vert) / + (1.0 + cos((PI/180./2.)*vp->vert)) / zf; + vp->vert *= vp->vert; + vp->vert = (2.*180./PI)*acos((1. - vp->vert) / + (1. + vp->vert)); return; case VT_CYL: /* cylindrical panorama */ vp->horiz /= zf;