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%s -h -ff -r 3 -t %f -g %d", |
126 |
< |
(input_orient>0 ^ output_orient>0) ? "" : " -a", |
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"); |
170 |
|
if (abs_diff(bsdf, last_bsdf) > ssamp_thresh) { |
171 |
|
sum = 0; /* super-sample voxel */ |
172 |
|
for (ssi = nssamp; ssi--; ) { |
173 |
< |
SDmultiSamp(ssa, 3, (ssi+drand48())/nssamp); |
173 |
> |
SDmultiSamp(ssa, 3, (ssi+frandom())/nssamp); |
174 |
|
ssvec[0] = 2.*(ix+ssa[0])/sqres - 1.; |
175 |
|
ssvec[1] = .0; |
176 |
|
ssvec[2] = input_orient * |
275 |
|
if (abs_diff(bsdf, last_bsdf) > ssamp_thresh) { |
276 |
|
sum = 0; /* super-sample voxel */ |
277 |
|
for (ssi = nssamp; ssi--; ) { |
278 |
< |
SDmultiSamp(ssa, 4, (ssi+drand48())/nssamp); |
278 |
> |
SDmultiSamp(ssa, 4, (ssi+frandom())/nssamp); |
279 |
|
SDsquare2disk(ssvec, 1.-(ix+ssa[0])/sqres, |
280 |
|
1.-(iy+ssa[1])/sqres); |
281 |
|
ssvec[2] = output_orient * |
375 |
|
fprintf(stderr, |
376 |
|
"%s: need single function with 6 arguments: bsdf(ix,iy,iz,ox,oy,oz)\n", |
377 |
|
progname); |
378 |
< |
fprintf(stderr, "\tor 3 arguments using Dx,Dy,Dz: bsdf(ix,iy,iz)\n", |
377 |
< |
progname); |
378 |
> |
fprintf(stderr, "\tor 3 arguments using Dx,Dy,Dz: bsdf(ix,iy,iz)\n"); |
379 |
|
goto userr; |
380 |
|
} |
381 |
|
++eclock; |