HDK
|
Structure to hold "deep" data – multiple samples per pixel. More...
#include <deepdata.h>
Public Member Functions | |
DeepData () | |
Construct an empty DeepData. More... | |
DeepData (const ImageSpec &spec) | |
Construct and init from an ImageSpec. More... | |
DeepData (const DeepData &d) | |
Copy constructor. More... | |
~DeepData () | |
const DeepData & | operator= (const DeepData &d) |
Copy assignment. More... | |
void | clear () |
Clear the vectors and reset size to 0. More... | |
void | free () |
Deallocate all space in the vectors. More... | |
void | init (int npix, int nchan, cspan< TypeDesc > channeltypes, cspan< std::string > channelnames) |
Initialize size and allocate nsamples, pointers. More... | |
void | init (const ImageSpec &spec) |
bool | initialized () const |
Is the DeepData initialized? More... | |
bool | allocated () const |
int | pixels () const |
Retrieve the total number of pixels. More... | |
int | channels () const |
Retrieve the number of channels. More... | |
int | Z_channel () const |
int | Zback_channel () const |
int | A_channel () const |
int | AR_channel () const |
int | AG_channel () const |
int | AB_channel () const |
string_view | channelname (int c) const |
The name of channel c. More... | |
TypeDesc | channeltype (int c) const |
Retrieve the channel type of channel c. More... | |
size_t | channelsize (int c) const |
The size for each sample of channel c. More... | |
size_t | samplesize () const |
The size for all channels of one sample. More... | |
int | samples (int pixel) const |
Retrieve the number of samples for the given pixel index. More... | |
void | set_samples (int pixel, int samps) |
void | set_all_samples (cspan< unsigned int > samples) |
void | set_capacity (int pixel, int samps) |
int | capacity (int pixel) const |
void | insert_samples (int pixel, int samplepos, int n=1) |
void | erase_samples (int pixel, int samplepos, int n=1) |
float | deep_value (int pixel, int channel, int sample) const |
Retrieve deep sample value within a pixel, cast to a float. More... | |
uint32_t | deep_value_uint (int pixel, int channel, int sample) const |
Retrieve deep sample value within a pixel, as an untigned int. More... | |
void | set_deep_value (int pixel, int channel, int sample, float value) |
Set deep sample value within a pixel, as a float. More... | |
void | set_deep_value (int pixel, int channel, int sample, uint32_t value) |
Set deep sample value within a pixel, as a uint32. More... | |
void * | data_ptr (int pixel, int channel, int sample) |
const void * | data_ptr (int pixel, int channel, int sample) const |
cspan< TypeDesc > | all_channeltypes () const |
cspan< unsigned int > | all_samples () const |
cspan< char > | all_data () const |
void | get_pointers (std::vector< void * > &pointers) const |
bool | copy_deep_sample (int pixel, int sample, const DeepData &src, int srcpixel, int srcsample) |
bool | copy_deep_pixel (int pixel, const DeepData &src, int srcpixel) |
bool | split (int pixel, float depth) |
void | sort (int pixel) |
Sort the samples of a pixel by Z. More... | |
void | merge_overlaps (int pixel) |
void | merge_deep_pixels (int pixel, const DeepData &src, int srcpixel) |
Merge src's samples into dst's samples. More... | |
float | opaque_z (int pixel) const |
Return the z depth at which the pixel becomes opaque. More... | |
void | occlusion_cull (int pixel) |
Occlusion cull samples hidden behind opaque samples. More... | |
Structure to hold "deep" data – multiple samples per pixel.
Definition at line 47 of file deepdata.h.
DeepData::DeepData | ( | ) |
Construct an empty DeepData.
DeepData::~DeepData | ( | ) |
int DeepData::A_channel | ( | ) | const |
int DeepData::AB_channel | ( | ) | const |
int DeepData::AG_channel | ( | ) | const |
cspan<char> DeepData::all_data | ( | ) | const |
bool DeepData::allocated | ( | ) | const |
Has the DeepData fully allocated? If no, it is still very inexpensive to call set_capacity().
int DeepData::AR_channel | ( | ) | const |
Retrieve the capacity (number of allocated samples) for the given pixel index.
string_view DeepData::channelname | ( | int | c | ) | const |
The name of channel c.
int DeepData::channels | ( | ) | const |
Retrieve the number of channels.
size_t DeepData::channelsize | ( | int | c | ) | const |
The size for each sample of channel c.
void DeepData::clear | ( | ) |
Clear the vectors and reset size to 0.
Retrieve the pointer to a given pixel/channel/sample, or NULL if there are no samples for that pixel. Use with care, and note that calls to insert_samples and erase_samples can invalidate pointers returend by prior calls to data_ptr.
Retrieve deep sample value within a pixel, cast to a float.
Retrieve deep sample value within a pixel, as an untigned int.
Erase n samples at the given pixel, starting at the indexed position.
void DeepData::free | ( | ) |
Deallocate all space in the vectors.
Fill in the vector with pointers to the start of the first channel for each pixel.
void DeepData::init | ( | int | npix, |
int | nchan, | ||
cspan< TypeDesc > | channeltypes, | ||
cspan< std::string > | channelnames | ||
) |
Initialize size and allocate nsamples, pointers.
Initialize size and allocate nsamples based on the number of pixels, channels, and channel types in the ImageSpec.
bool DeepData::initialized | ( | ) | const |
Is the DeepData initialized?
Insert n samples at the given pixel, starting at the indexed position.
Merge src's samples into dst's samples.
Merge any adjacent samples in the pixel that exactly overlap in z range. This is only useful if the pixel has previously been split at all sample starts and ends, and sorted by Z. Note that this may change the number of samples in the pixel.
float DeepData::opaque_z | ( | int | pixel | ) | const |
Return the z depth at which the pixel becomes opaque.
int DeepData::pixels | ( | ) | const |
Retrieve the total number of pixels.
size_t DeepData::samplesize | ( | ) | const |
The size for all channels of one sample.
Set the number of samples for all pixels. The samples.size() is required to match pixels().
Set the capacity of samples for the given pixel. This must be called after init().
Set deep sample value within a pixel, as a float.
Set deep sample value within a pixel, as a uint32.
Set the number of samples for the given pixel. This must be called after init().
bool DeepData::split | ( | int | pixel, |
float | depth | ||
) |
Split all samples of that pixel at the given depth zsplit. Samples that span z (i.e. z < zsplit < zback) will be split into two samples with depth ranges [z,zsplit] and [zsplit,zback] with appropriate changes to their color and alpha values. Samples not spanning zsplit will remain intact. This operation will have no effect if there are not Z and Zback channels present. Return true if any splits occurred, false if the pixel was not modified.
int DeepData::Z_channel | ( | ) | const |
int DeepData::Zback_channel | ( | ) | const |