9 |
|
|
10 |
|
#include <sys/types.h> |
11 |
|
|
12 |
< |
#ifndef NON_POSIX |
13 |
< |
#ifdef BSD |
14 |
< |
#include <sys/time.h> |
15 |
< |
#include <sys/resource.h> |
12 |
> |
#include "platform.h" |
13 |
> |
#ifdef NON_POSIX |
14 |
> |
#ifdef MINGW |
15 |
> |
#include <sys/time.h> |
16 |
> |
#endif |
17 |
|
#else |
18 |
< |
#include <sys/times.h> |
19 |
< |
#include <unistd.h> |
18 |
> |
#ifdef BSD |
19 |
> |
#include <sys/time.h> |
20 |
> |
#include <sys/resource.h> |
21 |
> |
#else |
22 |
> |
#include <sys/times.h> |
23 |
> |
#include <unistd.h> |
24 |
> |
#endif |
25 |
|
#endif |
20 |
– |
#endif |
26 |
|
|
27 |
|
#include <time.h> |
28 |
|
#include <signal.h> |
29 |
|
|
25 |
– |
#include "platform.h" |
30 |
|
#include "ray.h" |
31 |
|
#include "paths.h" |
32 |
|
#include "ambient.h" |
51 |
|
int ndims = 0; /* number of sampling dimensions */ |
52 |
|
int samplendx; /* sample index number */ |
53 |
|
|
50 |
– |
//extern void ambnotify(); |
54 |
|
void (*addobjnotify[])() = {ambnotify, NULL}; |
55 |
|
|
56 |
|
VIEW ourview = STDVIEW; /* view parameters */ |
91 |
|
int backvis = 1; /* back face visibility */ |
92 |
|
|
93 |
|
int maxdepth = 7; /* maximum recursion depth */ |
94 |
< |
double minweight = 4e-3; /* minimum ray weight */ |
94 |
> |
double minweight = 1e-3; /* minimum ray weight */ |
95 |
|
|
96 |
|
char *ambfile = NULL; /* ambient file name */ |
97 |
|
COLOR ambval = BLKCOLOR; /* ambient value */ |
118 |
|
|
119 |
|
static VIEW lastview; /* the previous view input */ |
120 |
|
|
118 |
– |
//extern char *mktemp(); /* XXX should be in stdlib.h or unistd.h */ |
119 |
– |
|
120 |
– |
//double pixvalue(); |
121 |
– |
|
121 |
|
static void report(int); |
122 |
|
static int nextview(FILE *fp); |
123 |
|
static void render(char *zfile, char *oldfile); |
676 |
|
return(0.0); |
677 |
|
} |
678 |
|
vdist = ourview.vdist; |
679 |
< |
|
680 |
< |
if (rand_samp) /* set pixel index */ |
682 |
< |
samplendx = random(); |
683 |
< |
else |
684 |
< |
samplendx = pixnumber(x,y,hres,vres); |
685 |
< |
|
679 |
> |
/* set pixel index */ |
680 |
> |
samplendx = pixnumber(x,y,hres,vres); |
681 |
|
/* optional motion blur */ |
682 |
|
if (lastview.type && mblur > FTINY && (lmax = viewray(lorg, ldir, |
683 |
|
&lastview, hpos, vpos)) >= -FTINY) { |
695 |
|
/* optional depth-of-field */ |
696 |
|
if (dblur > FTINY && vdist > FTINY) { |
697 |
|
double vc, dfh, dfv; |
698 |
< |
/* PI/4. square/circle conv. */ |
699 |
< |
dfh = PI/4.*dblur*(.5 - frandom()); |
700 |
< |
dfv = PI/4.*dblur*(.5 - frandom()); |
698 |
> |
/* square/circle conv. */ |
699 |
> |
dfh = vc = 1. - 2.*frandom(); |
700 |
> |
dfv = 1. - 2.*frandom(); |
701 |
> |
dfh *= .5*dblur*sqrt(1. - .5*dfv*dfv); |
702 |
> |
dfv *= .5*dblur*sqrt(1. - .5*vc*vc); |
703 |
|
if (ourview.type == VT_PER || ourview.type == VT_PAR) { |
704 |
|
dfh /= sqrt(ourview.hn2); |
705 |
|
dfv /= sqrt(ourview.vn2); |
711 |
|
} |
712 |
|
} else { /* non-standard view case */ |
713 |
|
double dfd = PI/4.*dblur*(.5 - frandom()); |
714 |
< |
if (ourview.type != VT_ANG) { |
714 |
> |
if (ourview.type != VT_ANG && ourview.type != VT_PLS) { |
715 |
|
if (ourview.type != VT_CYL) |
716 |
|
dfh /= sqrt(ourview.hn2); |
717 |
|
dfv /= sqrt(ourview.vn2); |