| 132 |
|
error(USER, errmsg); |
| 133 |
|
} |
| 134 |
|
|
| 135 |
+ |
/* Set default options */ |
| 136 |
+ |
static void |
| 137 |
+ |
default_options(void) |
| 138 |
+ |
{ |
| 139 |
+ |
rand_samp = 1; |
| 140 |
+ |
dstrsrc = 0.9; |
| 141 |
+ |
directrelay = 3; |
| 142 |
+ |
vspretest = 512; |
| 143 |
+ |
srcsizerat = .2; |
| 144 |
+ |
specthresh = .02; |
| 145 |
+ |
specjitter = 1.; |
| 146 |
+ |
maxdepth = -10; |
| 147 |
+ |
minweight = 2e-3; |
| 148 |
+ |
ambres = 256; |
| 149 |
+ |
ambdiv = 350; |
| 150 |
+ |
ambounce = 1; |
| 151 |
+ |
} |
| 152 |
|
|
| 153 |
|
/* Set overriding options */ |
| 154 |
|
static void |
| 159 |
|
ambacc = 0; |
| 160 |
|
} |
| 161 |
|
|
| 145 |
– |
|
| 162 |
|
int |
| 163 |
|
main(int argc, char *argv[]) |
| 164 |
|
{ |
| 189 |
|
/* initialize calcomp routines early */ |
| 190 |
|
initfunc(); |
| 191 |
|
calcontext(RCCONTEXT); |
| 192 |
+ |
/* set rcontrib defaults */ |
| 193 |
+ |
default_options(); |
| 194 |
|
/* option city */ |
| 195 |
|
for (i = 1; i < argc; i++) { |
| 196 |
|
/* expand arguments */ |
| 415 |
|
int n2go = myRCmanager.accum; |
| 416 |
|
|
| 417 |
|
switch (inpfmt) { |
| 418 |
< |
case 'a': // ASCII input |
| 418 |
> |
case 'a': // ASCII input |
| 419 |
|
if (!orig_dir) |
| 420 |
|
return skipWords(6*n2go); |
| 421 |
|
while (n2go-- > 0) { |
| 428 |
|
orig_dir += 2; |
| 429 |
|
} |
| 430 |
|
break; |
| 431 |
< |
case 'f': // float input |
| 431 |
> |
case 'f': // float input |
| 432 |
|
if (!orig_dir) |
| 433 |
|
return skipBytes(6*sizeof(float)*n2go); |
| 434 |
|
#ifdef SMLFLT |
| 435 |
|
if (getbinary(orig_dir, sizeof(FVECT), 2*n2go, stdin) != 2*n2go) |
| 436 |
|
return false; |
| 437 |
+ |
orig_dir += 2*n2go; |
| 438 |
|
#else |
| 439 |
|
while (n2go-- > 0) { |
| 440 |
|
float fvecs[6]; |
| 446 |
|
} |
| 447 |
|
#endif |
| 448 |
|
break; |
| 449 |
< |
case 'd': // double input |
| 449 |
> |
case 'd': // double input |
| 450 |
|
if (!orig_dir) |
| 451 |
|
return skipBytes(6*sizeof(double)*n2go); |
| 452 |
|
#ifndef SMLFLT |
| 453 |
|
if (getbinary(orig_dir, sizeof(FVECT), 2*n2go, stdin) != 2*n2go) |
| 454 |
|
return false; |
| 455 |
+ |
orig_dir += 2*n2go; |
| 456 |
|
#else |
| 457 |
|
while (n2go-- > 0) { |
| 458 |
|
double dvecs[6]; |
| 468 |
|
error(INTERNAL, "unsupported format in getRayBundle()"); |
| 469 |
|
return false; |
| 470 |
|
} |
| 471 |
< |
int warned = 0; // normalize directions |
| 452 |
< |
n2go = myRCmanager.accum; |
| 471 |
> |
n2go = myRCmanager.accum; // normalize directions |
| 472 |
|
while (n2go-- > 0) { |
| 473 |
|
orig_dir -= 2; |
| 474 |
< |
if (normalize(orig_dir[1]) == 0) |
| 456 |
< |
if (!warned++) |
| 457 |
< |
error(WARNING, "zero ray direction on input"); |
| 474 |
> |
normalize(orig_dir[1]); |
| 475 |
|
} |
| 476 |
|
return true; |
| 477 |
|
} |