12 |
|
#include <stdlib.h> |
13 |
|
#include <math.h> |
14 |
|
#include "platform.h" |
15 |
+ |
#include "rtprocess.h" |
16 |
|
#include "calcomp.h" |
17 |
|
#include "bsdfrep.h" |
18 |
|
/* global argv[0] */ |
25 |
|
const double ssamp_thresh = 0.35; |
26 |
|
/* number of super-samples */ |
27 |
|
const int nssamp = 100; |
28 |
+ |
/* limit on number of RBF lobes */ |
29 |
+ |
static int lobe_lim = 15000; |
30 |
|
|
31 |
|
/* Output XML prologue to stdout */ |
32 |
|
static void |
45 |
|
puts("<Optical>"); |
46 |
|
puts("<Layer>"); |
47 |
|
puts("\t<Material>"); |
48 |
< |
puts("\t\t<Name>Name</Name>"); |
49 |
< |
puts("\t\t<Manufacturer>Manufacturer</Manufacturer>"); |
48 |
> |
printf("\t\t<Name>%s</Name>\n", bsdf_name[0] ? bsdf_name : "Unknown"); |
49 |
> |
printf("\t\t<Manufacturer>%s</Manufacturer>\n", |
50 |
> |
bsdf_manuf[0] ? bsdf_manuf : "Unknown"); |
51 |
|
puts("\t\t<DeviceType>Other</DeviceType>"); |
52 |
|
puts("\t</Material>"); |
53 |
|
puts("\t<DataDefinition>"); |
124 |
|
|
125 |
|
data_prologue(); /* begin output */ |
126 |
|
if (pctcull >= 0) { |
127 |
< |
sprintf(cmd, "rttree_reduce -h -a -ff -r 3 -t %f -g %d", |
127 |
> |
sprintf(cmd, "rttree_reduce -a -h -ff -r 3 -t %f -g %d", |
128 |
|
pctcull, samp_order); |
129 |
|
fflush(stdout); |
130 |
|
ofp = popen(cmd, "w"); |
146 |
|
iovec[1] = .0; |
147 |
|
iovec[2] = input_orient * sqrt(1. - iovec[0]*iovec[0]); |
148 |
|
if (funame == NULL) |
149 |
< |
rbf = advect_rbf(iovec); |
149 |
> |
rbf = advect_rbf(iovec, lobe_lim); |
150 |
|
for (ox = 0; ox < sqres; ox++) { |
151 |
|
float last_bsdf = -1; |
152 |
|
for (oy = 0; oy < sqres; oy++) { |
228 |
|
|
229 |
|
data_prologue(); /* begin output */ |
230 |
|
if (pctcull >= 0) { |
231 |
< |
sprintf(cmd, "rttree_reduce -h -a -ff -r 4 -t %f -g %d", |
231 |
> |
sprintf(cmd, "rttree_reduce%s -h -ff -r 4 -t %f -g %d", |
232 |
> |
(input_orient>0 ^ output_orient>0) ? "" : " -a", |
233 |
|
pctcull, samp_order); |
234 |
|
fflush(stdout); |
235 |
|
ofp = popen(cmd, "w"); |
251 |
|
iovec[2] = input_orient * |
252 |
|
sqrt(1. - iovec[0]*iovec[0] - iovec[1]*iovec[1]); |
253 |
|
if (funame == NULL) |
254 |
< |
rbf = advect_rbf(iovec); |
254 |
> |
rbf = advect_rbf(iovec, lobe_lim); |
255 |
|
for (ox = 0; ox < sqres; ox++) { |
256 |
|
float last_bsdf = -1; |
257 |
|
for (oy = 0; oy < sqres; oy++) { |
361 |
|
case 'g': |
362 |
|
samp_order = atoi(argv[++i]); |
363 |
|
break; |
364 |
+ |
case 'l': |
365 |
+ |
lobe_lim = atoi(argv[++i]); |
366 |
+ |
break; |
367 |
|
default: |
368 |
|
goto userr; |
369 |
|
} |
431 |
|
return(0); |
432 |
|
userr: |
433 |
|
fprintf(stderr, |
434 |
< |
"Usage: %s [-g Nlog2][-t pctcull] [bsdf.sir ..] > bsdf.xml\n", |
434 |
> |
"Usage: %s [-g Nlog2][-t pctcull][-l maxlobes] [bsdf.sir ..] > bsdf.xml\n", |
435 |
|
progname); |
436 |
|
fprintf(stderr, |
437 |
|
" or: %s -t{3|4} [-g Nlog2][-t pctcull][{+|-}for[ward]][{+|-}b[ackward]][-e expr][-f file] bsdf_func > bsdf.xml\n", |