| 66 |
|
} |
| 67 |
|
/// Update output row count |
| 68 |
|
bool SetRowsDone(int r) { |
| 69 |
< |
if (!rData | (0 >= r) | (r > nRows)) return false; |
| 69 |
> |
if (!rData | (0 > r) | (r > nRows)) return false; |
| 70 |
|
char * rbuf = (char *)rData->GetMemory(rowCountPos, 17, 0); |
| 71 |
|
sprintf(rbuf, "%-16d", r); |
| 72 |
|
rbuf[16] = '\n'; // replaces nul byte |
| 108 |
|
|
| 109 |
|
typedef double DCOLORV; // color accumulator type |
| 110 |
|
|
| 111 |
– |
/// Modifier channel for recording contributions (no constructor/destructor) |
| 112 |
– |
struct RcontribMod; |
| 113 |
– |
|
| 114 |
– |
/// Allocate rcontrib accumulator |
| 115 |
– |
extern RcontribMod * NewRcMod(const char *prms = NULL, const char *binexpr = NULL, int ncbins = 1); |
| 111 |
|
/// Free an RcontribMod |
| 112 |
|
extern lut_free_t FreeRcMod; |
| 113 |
|
|
| 202 |
|
modLUT.freek = efree; |
| 203 |
|
modLUT.freed = FreeRcMod; |
| 204 |
|
kid = NULL; kidRow = NULL; nkids = 0; |
| 210 |
– |
rtFlags = RTtraceSources; |
| 211 |
– |
SetTraceCall(&RctCall, this); |
| 205 |
|
outOp = RCOnew; |
| 206 |
|
cdsF = &defDataShare; |
| 207 |
|
xres = yres = 0; |
| 208 |
|
accum = 1; |
| 209 |
+ |
if (octname) { |
| 210 |
+ |
SetTraceCall(&RctCall, this); |
| 211 |
+ |
rtFlags |= RTtraceSources; |
| 212 |
+ |
UpdateMode(); |
| 213 |
+ |
} |
| 214 |
|
} |
| 215 |
|
~RcontribSimulManager() { |
| 216 |
|
if (nkids >= 0) ClearModifiers(); |
| 228 |
|
} |
| 229 |
|
/// Load octree and prepare renderer |
| 230 |
|
bool LoadOctree(const char *octn) { |
| 231 |
< |
return RtraceSimulManager::LoadOctree(octn); |
| 231 |
> |
if (octname) Cleanup(false); |
| 232 |
> |
if (!RtraceSimulManager::LoadOctree(octn)) |
| 233 |
> |
return false; |
| 234 |
> |
SetTraceCall(&RctCall, this); |
| 235 |
> |
rtFlags |= RTtraceSources; |
| 236 |
> |
return UpdateMode(); |
| 237 |
|
} |
| 238 |
|
/// Prepare header from previous input (or clear) |
| 239 |
|
bool NewHeader(const char *inspec=NULL) { |
| 326 |
|
void ClearModifiers() { |
| 327 |
|
if (rowsDone.Length()) { |
| 328 |
|
SetThreadCount(1); |
| 326 |
– |
cow_doneshare(); |
| 329 |
|
rowsDone.NewBitMap(0); |
| 330 |
+ |
rInPos = 0; |
| 331 |
|
} |
| 332 |
|
lu_done(&modLUT); |
| 333 |
|
delete outList; outList = NULL; |
| 336 |
|
/// Close octree, free data, return status |
| 337 |
|
int Cleanup(bool everything = false) { |
| 338 |
|
ClearModifiers(); |
| 339 |
+ |
cow_doneshare(); |
| 340 |
+ |
if (everything) { |
| 341 |
+ |
dtyp = 'f'; |
| 342 |
+ |
outOp = RCOnew; |
| 343 |
+ |
cdsF = &defDataShare; |
| 344 |
+ |
xres = yres = 0; |
| 345 |
+ |
accum = 1; |
| 346 |
+ |
rtFlags &= ~RCmask; |
| 347 |
+ |
} |
| 348 |
|
return RtraceSimulManager::Cleanup(everything); |
| 349 |
|
} |
| 350 |
|
}; |
| 351 |
+ |
|
| 352 |
+ |
extern const char * formstr(int f); // string from format |
| 353 |
|
|
| 354 |
|
#endif /* RcontribSimulManager_h */ |