--- ray/src/rt/rpict.c 2008/03/11 02:21:47 2.78 +++ ray/src/rt/rpict.c 2010/09/03 21:16:50 2.83 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rpict.c,v 2.78 2008/03/11 02:21:47 greg Exp $"; +static const char RCSid[] = "$Id: rpict.c,v 2.83 2010/09/03 21:16:50 greg Exp $"; #endif /* * rpict.c - routines and variables for picture generation. @@ -9,20 +9,24 @@ static const char RCSid[] = "$Id: rpict.c,v 2.78 2008/ #include -#ifndef NON_POSIX -#ifdef BSD -#include -#include +#include "platform.h" +#ifdef NON_POSIX + #ifdef MINGW + #include + #endif #else -#include -#include + #ifdef BSD + #include + #include + #else + #include + #include + #endif #endif -#endif #include #include -#include "platform.h" #include "ray.h" #include "paths.h" #include "ambient.h" @@ -47,7 +51,6 @@ int dimlist[MAXDIM]; /* sampling dimensions */ int ndims = 0; /* number of sampling dimensions */ int samplendx; /* sample index number */ -//extern void ambnotify(); void (*addobjnotify[])() = {ambnotify, NULL}; VIEW ourview = STDVIEW; /* view parameters */ @@ -115,10 +118,6 @@ int hres, vres; /* resolution for this frame */ static VIEW lastview; /* the previous view input */ -//extern char *mktemp(); /* XXX should be in stdlib.h or unistd.h */ - -//double pixvalue(); - static void report(int); static int nextview(FILE *fp); static void render(char *zfile, char *oldfile); @@ -696,9 +695,11 @@ pixvalue( /* compute pixel value */ /* optional depth-of-field */ if (dblur > FTINY && vdist > FTINY) { double vc, dfh, dfv; - /* PI/4. square/circle conv. */ - dfh = PI/4.*dblur*(.5 - frandom()); - dfv = PI/4.*dblur*(.5 - frandom()); + /* square/circle conv. */ + dfh = vc = 1. - 2.*frandom(); + dfv = 1. - 2.*frandom(); + dfh *= .5*dblur*sqrt(1. - .5*dfv*dfv); + dfv *= .5*dblur*sqrt(1. - .5*vc*vc); if (ourview.type == VT_PER || ourview.type == VT_PAR) { dfh /= sqrt(ourview.hn2); dfv /= sqrt(ourview.vn2);