88 |
|
h = ilhash(dim, 3) + i; |
89 |
|
multisamp(sp, 2, urand(h)); |
90 |
|
r1 = (dim[1] + sp[0])/nalt; |
91 |
< |
r2 = (dim[2] + sp[1])/nazi; |
91 |
> |
r2 = (dim[2] + sp[1] - .5)/nazi; |
92 |
|
flatdir(dn, r1, r2); |
93 |
|
for (j = 0; j < 3; j++) |
94 |
|
dir[j] = -dn[0]*u[j] - dn[1]*v[j] - dn[2]*fa->norm[j]; |
116 |
|
} |
117 |
|
rayflush(rt); |
118 |
|
/* write out the face and its distribution */ |
119 |
< |
average(il, distarr, nalt*nazi); |
120 |
< |
if (il->sampdens > 0) |
121 |
< |
flatout(il, distarr, nalt, nazi, u, v, fa->norm); |
122 |
< |
illumout(il, ob); |
119 |
> |
if (average(il, distarr, nalt*nazi)) { |
120 |
> |
if (il->sampdens > 0) |
121 |
> |
flatout(il, distarr, nalt, nazi, u, v, fa->norm); |
122 |
> |
illumout(il, ob); |
123 |
> |
} else if (!(il->flags & IL_LIGHT)) |
124 |
> |
printobj(il->altmat, ob); |
125 |
|
/* clean up */ |
126 |
|
freeface(ob); |
127 |
|
free((char *)distarr); |
166 |
|
multisamp(sp, 4, urand(ilhash(dim,3)+i)); |
167 |
|
/* random direction */ |
168 |
|
r1 = (dim[1] + sp[0])/nalt; |
169 |
< |
r2 = (dim[2] + sp[1])/nazi; |
169 |
> |
r2 = (dim[2] + sp[1] - .5)/nazi; |
170 |
|
rounddir(dir, r1, r2); |
171 |
|
/* random location */ |
172 |
|
mkaxes(u, v, dir); /* yuck! */ |
185 |
|
} |
186 |
|
rayflush(rt); |
187 |
|
/* write out the sphere and its distribution */ |
188 |
< |
average(il, distarr, nalt*nazi); |
189 |
< |
if (il->sampdens > 0) |
190 |
< |
roundout(il, distarr, nalt, nazi); |
191 |
< |
else |
192 |
< |
objerror(ob, WARNING, "diffuse distribution"); |
193 |
< |
illumout(il, ob); |
188 |
> |
if (average(il, distarr, nalt*nazi)) { |
189 |
> |
if (il->sampdens > 0) |
190 |
> |
roundout(il, distarr, nalt, nazi); |
191 |
> |
else |
192 |
> |
objerror(ob, WARNING, "diffuse distribution"); |
193 |
> |
illumout(il, ob); |
194 |
> |
} else if (!(il->flags & IL_LIGHT)) |
195 |
> |
printobj(il->altmat, ob); |
196 |
|
/* clean up */ |
197 |
|
free((char *)distarr); |
198 |
|
} |
236 |
|
multisamp(sp, 4, urand(ilhash(dim,3)+i)); |
237 |
|
/* random direction */ |
238 |
|
r1 = (dim[1] + sp[0])/nalt; |
239 |
< |
r2 = (dim[2] + sp[1])/nalt; |
239 |
> |
r2 = (dim[2] + sp[1] - .5)/nazi; |
240 |
|
flatdir(dn, r1, r2); |
241 |
|
for (j = 0; j < 3; j++) |
242 |
|
dir[j] = -dn[0]*u[j] - dn[1]*v[j] - dn[2]*co->ad[j]; |
255 |
|
} |
256 |
|
rayflush(rt); |
257 |
|
/* write out the ring and its distribution */ |
258 |
< |
average(il, distarr, nalt*nazi); |
259 |
< |
if (il->sampdens > 0) |
260 |
< |
flatout(il, distarr, nalt, nazi, u, v, co->ad); |
261 |
< |
illumout(il, ob); |
258 |
> |
if (average(il, distarr, nalt*nazi)) { |
259 |
> |
if (il->sampdens > 0) |
260 |
> |
flatout(il, distarr, nalt, nazi, u, v, co->ad); |
261 |
> |
illumout(il, ob); |
262 |
> |
} else if (!(il->flags & IL_LIGHT)) |
263 |
> |
printobj(il->altmat, ob); |
264 |
|
/* clean up */ |
265 |
|
freecone(ob); |
266 |
|
free((char *)distarr); |
291 |
|
if (rt->nrays <= 0) |
292 |
|
return; |
293 |
|
bzero(rt->buf+6*rt->nrays, 6*sizeof(float)); |
294 |
+ |
errno = 0; |
295 |
|
if ( process(rt->pd, (char *)rt->buf, (char *)rt->buf, |
296 |
|
3*sizeof(float)*rt->nrays, |
297 |
|
6*sizeof(float)*(rt->nrays+1)) < |