| 82 |
|
int (*sample_basis)(PARAMS *p, int b, FVECT orig_dir[]); |
| 83 |
|
}; |
| 84 |
|
|
| 85 |
< |
PARAMS curparams; |
| 86 |
< |
char curmod[MAXSTR]; |
| 87 |
< |
char newparams[1024]; |
| 85 |
> |
static PARAMS curparams; |
| 86 |
> |
static char curmod[MAXSTR]; |
| 87 |
> |
static char newparams[1024]; |
| 88 |
|
|
| 89 |
|
typedef int SURFSAMP(FVECT, SURF *, double); |
| 90 |
|
|
| 91 |
< |
SURFSAMP ssamp_bad, ssamp_poly, ssamp_ring; |
| 91 |
> |
static SURFSAMP ssamp_bad, ssamp_poly, ssamp_ring; |
| 92 |
|
|
| 93 |
< |
SURFSAMP *orig_in_surf[4] = { |
| 93 |
> |
static SURFSAMP *orig_in_surf[4] = { |
| 94 |
|
ssamp_bad, ssamp_poly, ssamp_ring, ssamp_bad |
| 95 |
|
}; |
| 96 |
|
|
| 99 |
|
double dblur = 0; // depth-of-field |
| 100 |
|
|
| 101 |
|
/* Clear parameter set */ |
| 102 |
< |
void |
| 102 |
> |
static void |
| 103 |
|
clear_params(PARAMS *p, bool reset_only = true) |
| 104 |
|
{ |
| 105 |
|
while (p->slist != NULL) { |
| 119 |
|
} |
| 120 |
|
|
| 121 |
|
/* Get surface type from name */ |
| 122 |
< |
int |
| 122 |
> |
static int |
| 123 |
|
surf_type(const char *otype) |
| 124 |
|
{ |
| 125 |
|
if (!strcmp(otype, "polygon")) |
| 132 |
|
} |
| 133 |
|
|
| 134 |
|
/* Add arguments to oconv command */ |
| 135 |
< |
char * |
| 135 |
> |
static char * |
| 136 |
|
oconv_command(int ac, char *av[]) |
| 137 |
|
{ |
| 138 |
|
static char oconvbuf[4096] = "!oconv -f "; |
| 179 |
|
} |
| 180 |
|
|
| 181 |
|
/* Get normalized direction vector from string specification */ |
| 182 |
< |
int |
| 182 |
> |
static int |
| 183 |
|
get_direction(FVECT dv, const char *s) |
| 184 |
|
{ |
| 185 |
|
int sign = 1; |
| 219 |
|
} |
| 220 |
|
|
| 221 |
|
/* Parse program parameters (directives) */ |
| 222 |
< |
int |
| 222 |
> |
static int |
| 223 |
|
parse_params(PARAMS *p, char *pargs) |
| 224 |
|
{ |
| 225 |
|
char *cp = pargs; |
| 298 |
|
} |
| 299 |
|
|
| 300 |
|
/* Add receiver modifier and associated parameters */ |
| 301 |
< |
void |
| 301 |
> |
static void |
| 302 |
|
finish_receiver() |
| 303 |
|
{ |
| 304 |
|
bool uniform = false; |
| 412 |
|
} |
| 413 |
|
|
| 414 |
|
/* Make randomly oriented tangent plane axes for given normal direction */ |
| 415 |
< |
void |
| 415 |
> |
static void |
| 416 |
|
make_axes(FVECT uva[2], const FVECT nrm) |
| 417 |
|
{ |
| 418 |
|
int i; |
| 423 |
|
} |
| 424 |
|
|
| 425 |
|
/* Illegal sender surfaces end up here */ |
| 426 |
< |
int |
| 426 |
> |
static int |
| 427 |
|
ssamp_bad(FVECT orig, SURF *sp, double x) |
| 428 |
|
{ |
| 429 |
|
sprintf(errmsg, "illegal sender surface '%s'", sp->sname); |
| 432 |
|
} |
| 433 |
|
|
| 434 |
|
/* Generate origin on ring surface from uniform random variable */ |
| 435 |
< |
int |
| 435 |
> |
static int |
| 436 |
|
ssamp_ring(FVECT orig, SURF *sp, double x) |
| 437 |
|
{ |
| 438 |
|
FVECT *uva = (FVECT *)sp->priv; |
| 460 |
|
} |
| 461 |
|
|
| 462 |
|
/* Add triangle to polygon's list (call-back function) */ |
| 463 |
< |
int |
| 463 |
> |
static int |
| 464 |
|
add_triangle(const Vert2_list *tp, int a, int b, int c) |
| 465 |
|
{ |
| 466 |
|
POLYTRIS *ptp = (POLYTRIS *)tp->p; |
| 473 |
|
} |
| 474 |
|
|
| 475 |
|
/* Generate origin on polygon surface from uniform random variable */ |
| 476 |
< |
int |
| 476 |
> |
static int |
| 477 |
|
ssamp_poly(FVECT orig, SURF *sp, double x) |
| 478 |
|
{ |
| 479 |
|
POLYTRIS *ptp = (POLYTRIS *)sp->priv; |
| 545 |
|
} |
| 546 |
|
|
| 547 |
|
/* Compute sample origin based on projected areas of sender subsurfaces */ |
| 548 |
< |
int |
| 548 |
> |
static int |
| 549 |
|
sample_origin(PARAMS *p, FVECT orig, const FVECT rdir, double x) |
| 550 |
|
{ |
| 551 |
|
static double *projsa; |
| 586 |
|
} |
| 587 |
|
|
| 588 |
|
/* Uniform sample generator */ |
| 589 |
< |
int |
| 589 |
> |
static int |
| 590 |
|
sample_uniform(PARAMS *p, int b, FVECT orig_dir[]) |
| 591 |
|
{ |
| 592 |
|
int n = myRCmanager.accum; |
| 613 |
|
} |
| 614 |
|
|
| 615 |
|
/* Shirly-Chiu sample generator */ |
| 616 |
< |
int |
| 616 |
> |
static int |
| 617 |
|
sample_shirchiu(PARAMS *p, int b, FVECT orig_dir[]) |
| 618 |
|
{ |
| 619 |
|
int n = myRCmanager.accum; |
| 641 |
|
} |
| 642 |
|
|
| 643 |
|
/* Reinhart/Tregenza sample generator */ |
| 644 |
< |
int |
| 644 |
> |
static int |
| 645 |
|
sample_reinhart(PARAMS *p, int b, FVECT orig_dir[]) |
| 646 |
|
{ |
| 647 |
|
#define T_NALT 7 |
| 691 |
|
} |
| 692 |
|
|
| 693 |
|
/* Klems sample generator */ |
| 694 |
< |
int |
| 694 |
> |
static int |
| 695 |
|
sample_klems(PARAMS *p, int b, FVECT orig_dir[]) |
| 696 |
|
{ |
| 697 |
|
static const char bname[4][20] = { |
| 739 |
|
} |
| 740 |
|
|
| 741 |
|
/* Prepare hemisphere basis sampler that will send rays to rcontrib */ |
| 742 |
< |
int |
| 742 |
> |
static int |
| 743 |
|
prepare_sampler(PARAMS *p) |
| 744 |
|
{ |
| 745 |
|
if (p->slist == NULL) { /* missing sample surface! */ |
| 821 |
|
} |
| 822 |
|
|
| 823 |
|
/* Compute normal and area for polygon */ |
| 824 |
< |
int |
| 824 |
> |
static int |
| 825 |
|
finish_polygon(SURF *p) |
| 826 |
|
{ |
| 827 |
|
const int nv = p->nfargs / 3; |
| 843 |
|
} |
| 844 |
|
|
| 845 |
|
/* Add a surface to our current parameters */ |
| 846 |
< |
void |
| 846 |
> |
static void |
| 847 |
|
add_surface(int st, const char *oname, FILE *fp) |
| 848 |
|
{ |
| 849 |
|
SURF *snew; |
| 919 |
|
} |
| 920 |
|
|
| 921 |
|
/* Parse a receiver object (look for modifiers to add) */ |
| 922 |
< |
int |
| 922 |
> |
static int |
| 923 |
|
add_recv_object(FILE *fp) |
| 924 |
|
{ |
| 925 |
|
int st; |
| 955 |
|
} |
| 956 |
|
|
| 957 |
|
/* Parse a sender object */ |
| 958 |
< |
int |
| 958 |
> |
static int |
| 959 |
|
add_send_object(FILE *fp) |
| 960 |
|
{ |
| 961 |
|
int st; |
| 995 |
|
} |
| 996 |
|
|
| 997 |
|
/* Load a Radiance scene using the given callback function for objects */ |
| 998 |
< |
int |
| 998 |
> |
static int |
| 999 |
|
load_scene(const char *inspec, int (*ocb)(FILE *)) |
| 1000 |
|
{ |
| 1001 |
|
int rv = 0; |
| 1087 |
|
} |
| 1088 |
|
|
| 1089 |
|
/* set input/output format */ |
| 1090 |
< |
void |
| 1090 |
> |
static void |
| 1091 |
|
setformat(const char *fmt) |
| 1092 |
|
{ |
| 1093 |
|
switch (fmt[0]) { |
| 1127 |
|
error(USER, errmsg); |
| 1128 |
|
} |
| 1129 |
|
|
| 1130 |
< |
inline double |
| 1130 |
> |
static inline double |
| 1131 |
|
pixjitter() |
| 1132 |
|
{ |
| 1133 |
|
return(0.5 + dstrpix*(frandom()-0.5)); |
| 1135 |
|
|
| 1136 |
|
// Compute a set of view rays for the given pixel accumulator |
| 1137 |
|
bool |
| 1138 |
< |
viewRays(FVECT orig_dir[], int x, int y) |
| 1138 |
> |
viewRayBundle(FVECT orig_dir[], int x, int y) |
| 1139 |
|
{ |
| 1140 |
|
for (int n = 0; n < myRCmanager.accum; orig_dir += 2, n++) { |
| 1141 |
|
const double d = viewray(orig_dir[0], orig_dir[1], &ourview, |
| 1160 |
|
|
| 1161 |
|
// Load a set of rays for accumulation (do not normalize direction) |
| 1162 |
|
int |
| 1163 |
< |
getRays(FVECT orig_dir[]) |
| 1163 |
> |
getRayBundle(FVECT orig_dir[]) |
| 1164 |
|
{ |
| 1165 |
|
int n; |
| 1166 |
|
// read directly if possible |
| 1198 |
|
} |
| 1199 |
|
|
| 1200 |
|
/* Set default options */ |
| 1201 |
< |
void |
| 1201 |
> |
static void |
| 1202 |
|
default_options() |
| 1203 |
|
{ |
| 1204 |
|
rand_samp = 1; |
| 1216 |
|
} |
| 1217 |
|
|
| 1218 |
|
/* Set overriding options */ |
| 1219 |
< |
void |
| 1219 |
> |
static void |
| 1220 |
|
override_options() |
| 1221 |
|
{ |
| 1222 |
|
shadthresh = 0; |
| 1549 |
|
for (i = myRCmanager.yres; i--; ) // from the top! |
| 1550 |
|
for (int x = 0; x < myRCmanager.xres; x++) { |
| 1551 |
|
report_progress(); |
| 1552 |
< |
if (!viewRays(rayarr, x, i)) |
| 1552 |
> |
if (!viewRayBundle(rayarr, x, i)) |
| 1553 |
|
quit(1); |
| 1554 |
|
if (myRCmanager.ComputeRecord(rayarr) != myRCmanager.accum) |
| 1555 |
|
error(USER, "failed call to ComputeRecord()"); |
| 1568 |
|
} |
| 1569 |
|
for (i = 0; i < myRCmanager.GetRowMax(); i++) { |
| 1570 |
|
report_progress(); |
| 1571 |
< |
if (getRays(rayarr) != myRCmanager.accum) { |
| 1571 |
> |
if (getRayBundle(rayarr) != myRCmanager.accum) { |
| 1572 |
|
sprintf(errmsg, "ray read error after %d of %d", |
| 1573 |
|
myRCmanager.GetRowCount(), |
| 1574 |
|
myRCmanager.GetRowMax()); |