85 |
|
refDepth = 1.; |
86 |
|
Init(bp, ystride, dp); |
87 |
|
} |
88 |
+ |
PixelAccess(COLORV *rp, int ystride, short *dp) { |
89 |
+ |
refDepth = 1.; |
90 |
+ |
Init(rp, ystride, dp); |
91 |
+ |
} |
92 |
|
void Init() { |
93 |
|
pbase.f = NULL; dbase.f = NULL; |
94 |
|
rowStride = 0; |
126 |
|
} |
127 |
|
if (dp) dtyp |= RDTdshort; |
128 |
|
} |
129 |
+ |
void Init(COLORV *rp, int ystride, short *dp) { |
130 |
+ |
pbase.f = rp; dbase.s = dp; |
131 |
+ |
rowStride = ystride; |
132 |
+ |
if (NCSAMP > 3) { |
133 |
+ |
dtyp = RDTscolor; primp = NULL; |
134 |
+ |
} else { |
135 |
+ |
dtyp = RDTrgb; primp = stdprims; |
136 |
+ |
} |
137 |
+ |
if (dp) dtyp |= RDTdshort; |
138 |
+ |
} |
139 |
|
/// Set color space after non-empty initialization |
140 |
|
bool SetColorSpace(RenderDataType cs, RGBPRIMP pr=NULL); |
141 |
|
/// Get color space |
251 |
|
COLORV * barPix; // current render bar pixels |
252 |
|
float * barDepth; // current render bar depths |
253 |
|
bool SetTile(const int ti[2]); |
254 |
< |
bool RenderRect(); |
254 |
> |
bool RenderRect(const int x0 = 0, const int y0 = 0); |
255 |
|
bool ComputePixel(int x, int y); |
256 |
< |
bool BelowSampThresh(int x, int y, const int noff[4][2]) const; |
256 |
> |
bool BelowSampThresh(const int x, const int y, |
257 |
> |
const int noff[4][2]) const; |
258 |
|
void FillSquare(const int x, const int y, const int noff[4][2]); |
259 |
|
void NewBar(int ht = 0); |
260 |
|
bool LowerBar(int v, int ytop); |
276 |
|
frameNo = 0; |
277 |
|
} |
278 |
|
~RpictSimulManager() { |
279 |
< |
NewBar(); |
279 |
> |
delete [] barPix; delete [] barDepth; |
280 |
|
} |
281 |
|
/// Load octree and prepare renderer |
282 |
|
bool LoadOctree(const char *octn) { |
295 |
|
return RtraceSimulManager::AddHeader(ac, av); |
296 |
|
} |
297 |
|
/// Get header lines if any |
298 |
< |
const char * GetHeader() const { |
299 |
< |
return RtraceSimulManager::GetHeader(); |
298 |
> |
const char * GetHeadStr() const { |
299 |
> |
return RtraceSimulManager::GetHeadStr(); |
300 |
|
} |
301 |
+ |
/// Look for specific header keyword, return value |
302 |
+ |
const char * GetHeadStr(const char *key, bool inOK = false) const { |
303 |
+ |
return RtraceSimulManager::GetHeadStr(key, inOK); |
304 |
+ |
} |
305 |
|
/// Set number of computation threads (0 => #cores) |
306 |
|
int SetThreadCount(int nt = 0) { |
307 |
|
return RtraceSimulManager::SetThreadCount(nt); |
344 |
|
/// Increments frameNo if >0 |
345 |
|
bool NewFrame(const VIEW &v, int xydim[2], double *ap=NULL, |
346 |
|
const int *tgrid=NULL); |
347 |
+ |
/// Get current view if set |
348 |
+ |
const VIEW * GetView() const { |
349 |
+ |
if (!vw.type) return NULL; |
350 |
+ |
return &vw; |
351 |
+ |
} |
352 |
+ |
/// Writeable previous view (for motion blur) |
353 |
+ |
VIEW & PreView() { |
354 |
+ |
return pvw; |
355 |
+ |
} |
356 |
|
/// Get current picture width |
357 |
|
int GetWidth() const { |
358 |
|
return hvres[0]; |
381 |
|
/// Same but also use 16-bit encoded depth buffer |
382 |
|
bool RenderTile(COLRV *bp, int ystride, short *dp, |
383 |
|
const int *tile=NULL); |
384 |
+ |
/// Back to float color with 16-bit depth |
385 |
+ |
bool RenderTile(COLORV *rp, int ystride, short *dp, |
386 |
+ |
const int *tile=NULL); |
387 |
|
/// Render and write a frame to the named file |
388 |
|
/// Include any header lines set prior to call |
389 |
< |
/// Picture file must not already exist |
389 |
> |
/// Picture file must not exist |
390 |
|
/// Write pixels to stdout if !pfname |
391 |
|
/// Write depth to a command if dfname[0]=='!' |
392 |
|
RenderDataType RenderFrame(const char *pfname, |
395 |
|
/// Resume partially finished rendering |
396 |
|
/// Picture file must exist with valid header |
397 |
|
RenderDataType ResumeFrame(const char *pfname, |
398 |
+ |
const char *dfname=NULL); |
399 |
+ |
/// Prepare new picture (and depth) output |
400 |
+ |
/// Called by RenderFrame() |
401 |
+ |
RenderDataType NewOutput(FILE *pdfp[2], const char *pfname, |
402 |
+ |
RenderDataType dt=RDTrgbe, |
403 |
+ |
const char *dfname=NULL); |
404 |
+ |
/// Reopen existing picture (and depth) file |
405 |
+ |
/// Called by ResumeFrame() |
406 |
+ |
/// File pointers @ end of header (before res.) |
407 |
+ |
RenderDataType ReopenOutput(FILE *pdfp[2], const char *pfname, |
408 |
|
const char *dfname=NULL); |
409 |
|
/// Close octree, free data, return status |
410 |
|
int Cleanup(bool everything = false) { |