99 |
|
RadSimulManager::Cleanup(bool everything) |
100 |
|
{ |
101 |
|
if (!ray_pnprocs) |
102 |
– |
ray_pdone(everything); |
103 |
– |
else |
102 |
|
ray_done(everything); |
103 |
+ |
else |
104 |
+ |
ray_pdone(everything); |
105 |
|
return 0; |
106 |
|
} |
107 |
|
|
117 |
|
// Global pointer to simulation manager for trace call-back (only one) |
118 |
|
static const RtraceSimulManager * ourRTsimMan = NULL; |
119 |
|
|
120 |
< |
void // static call-back |
120 |
> |
// Call-back for trace output |
121 |
> |
void |
122 |
|
RtraceSimulManager::RTracer(RAY *r) |
123 |
|
{ |
124 |
|
(*ourRTsimMan->traceCall)(r, ourRTsimMan->tcData); |
217 |
|
return -1; |
218 |
|
|
219 |
|
if (castonly && !cookedCall) |
220 |
< |
error(CONSISTENCY, "EnqueueBundle() called in castonly mode without cookedCall"); |
220 |
> |
error(INTERNAL, "EnqueueBundle() called in castonly mode without cookedCall"); |
221 |
|
|
222 |
|
if (!UpdateMode()) // update rendering mode if requested |
223 |
|
return -1; |
224 |
|
|
225 |
+ |
if (rID0 && curFlags&RTdoFIFO) |
226 |
+ |
error(INTERNAL, "Ray number assignment unsupported with FIFO"); |
227 |
+ |
|
228 |
|
while (n-- > 0) { // queue each ray |
229 |
|
VCOPY(res.rorg, orig_direc[0]); |
230 |
|
VCOPY(res.rdir, orig_direc[1]); |
231 |
|
orig_direc += 2; |
232 |
|
rayorigin(&res, PRIMARY, NULL, NULL); |
233 |
< |
if (rID0) res.rno = rID0++; |
230 |
< |
else res.rno = ++lastRayID; |
233 |
> |
res.rno = rID0 ? (lastRayID = rID0++) : ++lastRayID; |
234 |
|
if (curFlags & RTimmIrrad) |
235 |
|
res.revf = rayirrad; |
236 |
|
else if (castonly) |
237 |
|
res.revf = raycast; |
238 |
|
double d = normalize(res.rdir); |
239 |
|
bool sendRes = (cookedCall != NULL); |
240 |
< |
if (d > 0) { // direction vector is valid? |
240 |
> |
if (d > .0) { // direction vector is valid? |
241 |
|
if (curFlags & RTlimDist) |
242 |
|
res.rmax = d; |
243 |
< |
if (curFlags & RTdoFIFO) { |
244 |
< |
ray_fifo_in(&res); |
243 |
> |
if (((curFlags&RTdoFIFO) != 0) & (ray_pnprocs > 0)) { |
244 |
> |
if (ray_fifo_in(&res) < 0) |
245 |
> |
return -1; |
246 |
|
sendRes = false; |
247 |
|
} else |
248 |
|
sendRes &= ProcessRay(&res); |
261 |
|
int |
262 |
|
RtraceSimulManager::FlushQueue() |
263 |
|
{ |
264 |
< |
if (curFlags & RTdoFIFO) |
265 |
< |
return ray_fifo_flush(); |
266 |
< |
|
264 |
> |
if (curFlags & RTdoFIFO) { |
265 |
> |
if (ray_pnprocs) |
266 |
> |
return ray_fifo_flush(); |
267 |
> |
return 0; |
268 |
> |
} |
269 |
|
int nsent = 0; |
270 |
|
RAY res; |
271 |
|
|