| 11 |
|
#include <stdio.h> |
| 12 |
|
#include <stdlib.h> |
| 13 |
|
#include <math.h> |
| 14 |
+ |
#include "random.h" |
| 15 |
|
#include "platform.h" |
| 16 |
+ |
#include "rtprocess.h" |
| 17 |
|
#include "calcomp.h" |
| 18 |
|
#include "bsdfrep.h" |
| 19 |
|
/* global argv[0] */ |
| 46 |
|
puts("<Optical>"); |
| 47 |
|
puts("<Layer>"); |
| 48 |
|
puts("\t<Material>"); |
| 49 |
< |
puts("\t\t<Name>Name</Name>"); |
| 50 |
< |
puts("\t\t<Manufacturer>Manufacturer</Manufacturer>"); |
| 49 |
> |
printf("\t\t<Name>%s</Name>\n", bsdf_name[0] ? bsdf_name : "Unknown"); |
| 50 |
> |
printf("\t\t<Manufacturer>%s</Manufacturer>\n", |
| 51 |
> |
bsdf_manuf[0] ? bsdf_manuf : "Unknown"); |
| 52 |
|
puts("\t\t<DeviceType>Other</DeviceType>"); |
| 53 |
|
puts("\t</Material>"); |
| 54 |
|
puts("\t<DataDefinition>"); |
| 125 |
|
|
| 126 |
|
data_prologue(); /* begin output */ |
| 127 |
|
if (pctcull >= 0) { |
| 128 |
< |
sprintf(cmd, "rttree_reduce -h -a -ff -r 3 -t %f -g %d", |
| 128 |
> |
sprintf(cmd, "rttree_reduce -a -h -ff -r 3 -t %f -g %d", |
| 129 |
|
pctcull, samp_order); |
| 130 |
|
fflush(stdout); |
| 131 |
|
ofp = popen(cmd, "w"); |
| 135 |
|
exit(1); |
| 136 |
|
} |
| 137 |
|
SET_FILE_BINARY(ofp); |
| 138 |
+ |
#ifdef getc_unlocked /* avoid lock/unlock overhead */ |
| 139 |
+ |
flockfile(ofp); |
| 140 |
+ |
#endif |
| 141 |
|
} else |
| 142 |
|
fputs("{\n", stdout); |
| 143 |
|
/* need to assign Dx, Dy, Dz? */ |
| 173 |
|
if (abs_diff(bsdf, last_bsdf) > ssamp_thresh) { |
| 174 |
|
sum = 0; /* super-sample voxel */ |
| 175 |
|
for (ssi = nssamp; ssi--; ) { |
| 176 |
< |
SDmultiSamp(ssa, 3, (ssi+drand48())/nssamp); |
| 176 |
> |
SDmultiSamp(ssa, 3, (ssi+frandom())/nssamp); |
| 177 |
|
ssvec[0] = 2.*(ix+ssa[0])/sqres - 1.; |
| 178 |
|
ssvec[1] = .0; |
| 179 |
|
ssvec[2] = input_orient * |
| 232 |
|
|
| 233 |
|
data_prologue(); /* begin output */ |
| 234 |
|
if (pctcull >= 0) { |
| 235 |
< |
sprintf(cmd, "rttree_reduce -h -a -ff -r 4 -t %f -g %d", |
| 235 |
> |
sprintf(cmd, "rttree_reduce%s -h -ff -r 4 -t %f -g %d", |
| 236 |
> |
(input_orient>0 ^ output_orient>0) ? "" : " -a", |
| 237 |
|
pctcull, samp_order); |
| 238 |
|
fflush(stdout); |
| 239 |
|
ofp = popen(cmd, "w"); |
| 242 |
|
progname); |
| 243 |
|
exit(1); |
| 244 |
|
} |
| 245 |
+ |
SET_FILE_BINARY(ofp); |
| 246 |
+ |
#ifdef getc_unlocked /* avoid lock/unlock overhead */ |
| 247 |
+ |
flockfile(ofp); |
| 248 |
+ |
#endif |
| 249 |
|
} else |
| 250 |
|
fputs("{\n", stdout); |
| 251 |
|
/* need to assign Dx, Dy, Dz? */ |
| 282 |
|
if (abs_diff(bsdf, last_bsdf) > ssamp_thresh) { |
| 283 |
|
sum = 0; /* super-sample voxel */ |
| 284 |
|
for (ssi = nssamp; ssi--; ) { |
| 285 |
< |
SDmultiSamp(ssa, 4, (ssi+drand48())/nssamp); |
| 285 |
> |
SDmultiSamp(ssa, 4, (ssi+frandom())/nssamp); |
| 286 |
|
SDsquare2disk(ssvec, 1.-(ix+ssa[0])/sqres, |
| 287 |
|
1.-(iy+ssa[1])/sqres); |
| 288 |
|
ssvec[2] = output_orient * |
| 382 |
|
fprintf(stderr, |
| 383 |
|
"%s: need single function with 6 arguments: bsdf(ix,iy,iz,ox,oy,oz)\n", |
| 384 |
|
progname); |
| 385 |
< |
fprintf(stderr, "\tor 3 arguments using Dx,Dy,Dz: bsdf(ix,iy,iz)\n", |
| 375 |
< |
progname); |
| 385 |
> |
fprintf(stderr, "\tor 3 arguments using Dx,Dy,Dz: bsdf(ix,iy,iz)\n"); |
| 386 |
|
goto userr; |
| 387 |
|
} |
| 388 |
|
++eclock; |