|
HDK
|
Thread-safe convenience class to make writing DSM pixels easy. More...
#include <IMG_DeepShadow.h>
Inheritance diagram for IMG_DeepPixelWriter:Public Member Functions | |
| IMG_DeepPixelWriter (const IMG_DeepShadow &dsm) | |
| ~IMG_DeepPixelWriter () | |
| void | writeRawSamples (bool enable) |
| bool | open (int x, int y) |
| Open a pixel for writing. More... | |
| bool | close () |
| bool | write (float z, const float *chdata, int chsize, int flags, int sampleid, float dz=0) |
| bool | writeOrdered (float z, const float *chdata, int chsize, int flags, int sampleid, float dz=0) |
| bool | writePixel (int pixel_x, int pixel_y, const PXL_DeepSampleListPtr &pixel) |
| const PXL_DeepCompressorPtr & | compressor () const |
| Access to the pixel compressor. More... | |
Thread-safe convenience class to make writing DSM pixels easy.
This is a thread-safe convenience class to wrap around writing pixels which ensures that the pixel is closed properly.
The class should be used as follows for sequential samples:
Definition at line 151 of file IMG_DeepShadow.h.
| IMG_DeepPixelWriter::IMG_DeepPixelWriter | ( | const IMG_DeepShadow & | dsm | ) |
| IMG_DeepPixelWriter::~IMG_DeepPixelWriter | ( | ) |
| bool IMG_DeepPixelWriter::close | ( | ) |
Close the pixel. This is called automatically on destruction. However, if an IMG_DeepPixelWriter and IMG_DeepShadow are created in the same scope, the IMG_DeepPixelReader may hold onto references (and cause crashing errors). Calling close() manually is a safe thing to do.
|
inline |
Access to the pixel compressor.
Definition at line 234 of file IMG_DeepShadow.h.
Open a pixel for writing.
| bool IMG_DeepPixelWriter::write | ( | float | z, |
| const float * | chdata, | ||
| int | chsize, | ||
| int | flags, | ||
| int | sampleid, | ||
| float | dz = 0 |
||
| ) |
Write data to the currently open pixel. This method inserts an unordered data record with the given z-value and data into the current pixel. vsize is the number of floats that are contained in the data array.
The first 3 floats of the data array must be the opacity (RGB). Any extra channel data follows this according to the float_offset associated with the channel. This data may be quantized to a single float depending on the options.
If vsize doesn't contain a full record, then this method will fail. vsize must be greater or equal to 3 (depending on extra channels)
Currently, mantra will always interpret the data as a rgb opacity triple.
The flags parameter is used to pass information to the PXL_DeepSampleList interface. Possible values are:
PXL_DeepSampleList::SampleFlag enum.The sampleid parameter specifies which pixel sample is associated with these values (see sxres and syres on the create() method).
The z value represents the "z-front" value for the depth sample. For hard surfaces dz should be 0. For volumes dz should be set to the extent of the volume sample so that the "z-back" data can be set appropriately.
|
inline |
Perform the same operation as write() except assume that data is pre-sorted by increasing z-value. This method will perform slightly better than write() as data does not need to be sorted.
Definition at line 215 of file IMG_DeepShadow.h.
| bool IMG_DeepPixelWriter::writePixel | ( | int | pixel_x, |
| int | pixel_y, | ||
| const PXL_DeepSampleListPtr & | pixel | ||
| ) |
Alternatively, you can do something like:
| void IMG_DeepPixelWriter::writeRawSamples | ( | bool | enable | ) |
Ignore the desired sample compositing state in IMG_DeepShadow. The default is to assume the incoming samples are pre-composited. Writing raw samples will ignore compression levels, since the compressors assume pre-composited samples.