25 |
|
|
26 |
|
extern char RCCONTEXT[]; // global rcontrib context |
27 |
|
|
28 |
+ |
extern int contrib; // computing contributions? |
29 |
+ |
|
30 |
|
extern int xres, yres; // global resolution settings |
31 |
|
|
32 |
< |
class RcontribSimulManager; // need forward decl |
32 |
> |
class RcontribSimulManager; // need forward decl |
33 |
|
|
34 |
|
/// Shared data object for record output (includes header; may be write-only) |
35 |
|
class RcontribOutput { |
34 |
– |
protected: |
36 |
|
RcontribOutput * next; // next in sorted list |
37 |
|
char * ofname; // output file name |
38 |
|
uint32 rowCountPos; // row count position in header |
154 |
|
*/ |
155 |
|
|
156 |
|
/// Output channel opening options: new/exclusive, overwrite if exists, or recover data |
157 |
< |
enum RCOutputOp {RCOnew, RCOforce, RCOrecover}; |
157 |
> |
enum RCOutputOp {RCOnew=0, RCOforce, RCOrecover}; |
158 |
|
|
159 |
|
/// Converts above to RdataShare open flags (may be adjusted by calling program) |
160 |
|
extern int RSDOflags[]; |
165 |
|
/// Our default data share function |
166 |
|
extern RcreateDataShareF defDataShare; |
167 |
|
|
168 |
< |
/// Call-back used by GetOutputs() method (cd is client data) |
169 |
< |
typedef int RoutputShareF(const RcontribOutput *op, void *cd); |
168 |
> |
/// Modifiable ray-tracing flags for rcontrib |
169 |
> |
#define RCmask (RTlimDist|RTimmIrrad) |
170 |
|
|
171 |
|
/// rcontrib-like simulation manager (at most one such object) |
172 |
|
class RcontribSimulManager : protected RtraceSimulManager { |
213 |
|
~RcontribSimulManager() { |
214 |
|
Cleanup(); |
215 |
|
} |
216 |
+ |
/// Check modifiable ray-tracing computation flag(s) |
217 |
+ |
bool HasFlag(int fl) const { |
218 |
+ |
return ((rtFlags & RCmask & fl) != 0); |
219 |
+ |
} |
220 |
+ |
/// Set/reset modifiable ray-tracing computation flag(s) |
221 |
+ |
bool SetFlag(int fl, bool val = true) { |
222 |
+ |
if (!(fl &= RCmask)) return false; |
223 |
+ |
if (val) rtFlags |= fl; |
224 |
+ |
else rtFlags &= ~fl; |
225 |
+ |
return true; |
226 |
+ |
} |
227 |
|
/// Load octree and prepare renderer |
228 |
|
bool LoadOctree(const char *octn) { |
229 |
|
return RtraceSimulManager::LoadOctree(octn); |
267 |
|
bool AddModFile(const char *modfn, const char *outspec, |
268 |
|
const char *prms = NULL, |
269 |
|
const char *binval = NULL, int bincnt = 1); |
270 |
< |
/// Run through current list of output struct's |
271 |
< |
int GetOutputs(RoutputShareF *osF, void *cd = NULL) const; |
270 |
> |
/// Get named rcontrib output (or list) |
271 |
> |
const RcontribOutput * GetOutput(const char *nm = NULL) const { |
272 |
> |
if (!nm) return outList; |
273 |
> |
const RcontribOutput * op = outList; |
274 |
> |
while (op && strcmp(op->GetName(), nm)) |
275 |
> |
op = op->next; |
276 |
> |
return op; |
277 |
> |
} |
278 |
|
/// Open output channels and return # completed rows |
279 |
|
int PrepOutput(); |
280 |
|
/// Are we ready to compute some records? |
281 |
|
bool Ready() const { |
282 |
< |
return rowsDone.Length(); |
282 |
> |
return (rowsDone.Length() > 0) & (accum > 0); |
283 |
|
} |
284 |
|
/// Set number of computation threads (0 => #cores) |
285 |
|
int SetThreadCount(int nt = 0); |