| 22 |
|
/// Multi-threaded simulation manager base class |
| 23 |
|
class RadSimulManager { |
| 24 |
|
int nThreads; // number of active threads |
| 25 |
+ |
protected: |
| 26 |
+ |
// Assign ray to subthread (fails if NThreads()<2) |
| 27 |
+ |
bool SplitRay(RAY *r); |
| 28 |
|
public: |
| 29 |
|
RadSimulManager(const char *octn = NULL) { |
| 30 |
|
LoadOctree(octn); |
| 49 |
|
bool Ready() const { |
| 50 |
|
return (octname && nsceneobjs > 0); |
| 51 |
|
} |
| 52 |
+ |
/// Process a ray (in subthread), optional result |
| 53 |
+ |
bool ProcessRay(RAY *r); |
| 54 |
+ |
/// Wait for next result (or fail) |
| 55 |
+ |
bool WaitResult(RAY *r); |
| 56 |
|
/// Close octree, free data, return status |
| 57 |
|
int Cleanup(bool everything = false); |
| 58 |
|
}; |
| 72 |
|
// Check for changes to render flags, etc. |
| 73 |
|
bool UpdateMode(); |
| 74 |
|
protected: |
| 75 |
+ |
// Add a ray result to FIFO, flushing what we can |
| 76 |
+ |
int QueueResult(const RAY &ra); |
| 77 |
|
RNUMBER lastRayID; // last ray ID assigned |
| 78 |
|
public: |
| 79 |
|
int rtFlags; // operation (RT*) flags |
| 123 |
|
return (cookedCall != NULL) | (traceCall != NULL) && |
| 124 |
|
RadSimulManager::Ready(); |
| 125 |
|
} |
| 126 |
< |
/// Finish pending rays and complete callbacks |
| 127 |
< |
bool FlushQueue(); |
| 126 |
> |
/// Finish pending rays and complete callbacks (return #sent) |
| 127 |
> |
int FlushQueue(); |
| 128 |
|
/// Close octree, free data, return status |
| 129 |
|
int Cleanup(bool everything = false) { |
| 130 |
|
SetCookedCall(NULL); |