36 |
|
LoadOctree(octn); |
37 |
|
} |
38 |
|
~RadSimulManager() { |
39 |
< |
Cleanup(); |
39 |
> |
// Cleanup(); |
40 |
|
} |
41 |
|
/// Load octree and prepare renderer |
42 |
|
bool LoadOctree(const char *octn); |
96 |
|
static void RTracer(RAY *r); |
97 |
|
// Call-back for FIFO |
98 |
|
static int Rfifout(RAY *r); |
99 |
+ |
protected: |
100 |
|
// Check for changes to render flags, etc. |
101 |
|
bool UpdateMode(); |
101 |
– |
protected: |
102 |
|
RNUMBER lastRayID; // last ray ID assigned |
103 |
|
public: |
104 |
|
int rtFlags; // operation (RT*) flags |
112 |
|
~RtraceSimulManager() { |
113 |
|
FlushQueue(); |
114 |
|
} |
115 |
+ |
/// Load octree and prepare renderer |
116 |
+ |
bool LoadOctree(const char *octn) { |
117 |
+ |
if ((octn != NULL) & (octname != NULL) && |
118 |
+ |
!strcmp(octn, octname)) |
119 |
+ |
return true; |
120 |
+ |
srcFollowed.NewBitMap(0); |
121 |
+ |
curFlags &= ~RTtraceSources; |
122 |
+ |
return RadSimulManager::LoadOctree(octn); |
123 |
+ |
} |
124 |
|
/// Set number of computation threads (0 => #cores) |
125 |
|
int SetThreadCount(int nt = 0) { |
126 |
|
if (nt <= 0) nt = castonly ? 1 : GetNCores(); |
154 |
|
if (nt > 1) SetThreadCount(1); |
155 |
|
traceCall = cb; |
156 |
|
tcData = cb ? cd : NULL; |
157 |
+ |
UpdateMode(); |
158 |
|
if (nt > 1) SetThreadCount(nt); |
159 |
|
} |
150 |
– |
/// Are we ready? |
151 |
– |
bool Ready() const { |
152 |
– |
return (cookedCall != NULL) | (traceCall != NULL) && |
153 |
– |
RadSimulManager::Ready(); |
154 |
– |
} |
160 |
|
/// Finish pending rays and complete callbacks (return #sent) |
161 |
|
int FlushQueue(); |
162 |
|
/// Close octree, free data, return status |
163 |
|
int Cleanup(bool everything = false) { |
164 |
< |
SetCookedCall(NULL); |
165 |
< |
SetTraceCall(NULL); |
166 |
< |
rtFlags = 0; |
164 |
> |
int st = RadSimulManager::Cleanup(everything); |
165 |
> |
srcFollowed.NewBitMap(0); |
166 |
> |
curFlags &= ~RTtraceSources; |
167 |
> |
if (everything) { |
168 |
> |
SetCookedCall(NULL); |
169 |
> |
SetTraceCall(NULL); |
170 |
> |
rtFlags &= ~RTmask; |
171 |
> |
} |
172 |
|
UpdateMode(); |
173 |
|
lastRayID = 0; |
174 |
< |
return RadSimulManager::Cleanup(everything); |
174 |
> |
return st; |
175 |
|
} |
176 |
|
}; |
177 |
|
|