HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DeepData Class Reference

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 DeepDataoperator= (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...
 
voiddata_ptr (int pixel, int channel, int sample)
 
const voiddata_ptr (int pixel, int channel, int sample) const
 
cspan< TypeDescall_channeltypes () const
 
cspan< unsigned intall_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...
 

Detailed Description

Structure to hold "deep" data – multiple samples per pixel.

Definition at line 47 of file deepdata.h.

Constructor & Destructor Documentation

DeepData::DeepData ( )

Construct an empty DeepData.

DeepData::DeepData ( const ImageSpec spec)

Construct and init from an ImageSpec.

DeepData::DeepData ( const DeepData d)

Copy constructor.

DeepData::~DeepData ( )

Member Function Documentation

int DeepData::A_channel ( ) const
int DeepData::AB_channel ( ) const
int DeepData::AG_channel ( ) const
cspan<TypeDesc> DeepData::all_channeltypes ( ) const
cspan<char> DeepData::all_data ( ) const
cspan<unsigned int> DeepData::all_samples ( ) 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
int DeepData::capacity ( int  pixel) 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.

TypeDesc DeepData::channeltype ( int  c) const

Retrieve the channel type of channel c.

void DeepData::clear ( )

Clear the vectors and reset size to 0.

bool DeepData::copy_deep_pixel ( int  pixel,
const DeepData src,
int  srcpixel 
)

Copy the designated pixel from a source DeepData into this DeepData. The two DeepData structures need to have the same channel layout.

bool DeepData::copy_deep_sample ( int  pixel,
int  sample,
const DeepData src,
int  srcpixel,
int  srcsample 
)

Copy the designated sample from a source DeepData into this DeepData. The two DeepData structures need to have the same channel layout.

void* DeepData::data_ptr ( int  pixel,
int  channel,
int  sample 
)

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.

const void* DeepData::data_ptr ( int  pixel,
int  channel,
int  sample 
) const
float DeepData::deep_value ( int  pixel,
int  channel,
int  sample 
) const

Retrieve deep sample value within a pixel, cast to a float.

uint32_t DeepData::deep_value_uint ( int  pixel,
int  channel,
int  sample 
) const

Retrieve deep sample value within a pixel, as an untigned int.

void DeepData::erase_samples ( int  pixel,
int  samplepos,
int  n = 1 
)

Erase n samples at the given pixel, starting at the indexed position.

void DeepData::free ( )

Deallocate all space in the vectors.

void DeepData::get_pointers ( std::vector< void * > &  pointers) const

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.

void DeepData::init ( const ImageSpec spec)

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?

void DeepData::insert_samples ( int  pixel,
int  samplepos,
int  n = 1 
)

Insert n samples at the given pixel, starting at the indexed position.

void DeepData::merge_deep_pixels ( int  pixel,
const DeepData src,
int  srcpixel 
)

Merge src's samples into dst's samples.

void DeepData::merge_overlaps ( int  pixel)

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.

void DeepData::occlusion_cull ( int  pixel)

Occlusion cull samples hidden behind opaque samples.

float DeepData::opaque_z ( int  pixel) const

Return the z depth at which the pixel becomes opaque.

const DeepData& DeepData::operator= ( const DeepData d)

Copy assignment.

int DeepData::pixels ( ) const

Retrieve the total number of pixels.

int DeepData::samples ( int  pixel) const

Retrieve the number of samples for the given pixel index.

size_t DeepData::samplesize ( ) const

The size for all channels of one sample.

void DeepData::set_all_samples ( cspan< unsigned int samples)

Set the number of samples for all pixels. The samples.size() is required to match pixels().

void DeepData::set_capacity ( int  pixel,
int  samps 
)

Set the capacity of samples for the given pixel. This must be called after init().

void DeepData::set_deep_value ( int  pixel,
int  channel,
int  sample,
float  value 
)

Set deep sample value within a pixel, as a float.

void DeepData::set_deep_value ( int  pixel,
int  channel,
int  sample,
uint32_t  value 
)

Set deep sample value within a pixel, as a uint32.

void DeepData::set_samples ( int  pixel,
int  samps 
)

Set the number of samples for the given pixel. This must be called after init().

void DeepData::sort ( int  pixel)

Sort the samples of a pixel by Z.

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

The documentation for this class was generated from the following file: