cgv
cgv::data::packing_info Class Reference

#include <packing_info.h>

Inheritance diagram for cgv::data::packing_info:
cgv::data::component_format cgv::data::data_format cgv::render::render_buffer cgv::render::texture

Public Member Functions

 packing_info (unsigned int align=1, unsigned int d0=0, unsigned int d1=0, unsigned int d2=0, unsigned int d3=0)
 construct packed format with different bit depths More...
 
void clear ()
 clear packing info information
 
unsigned int get_bit_depth (unsigned int ci) const
 return the bit depth of the ci-th component
 
void set_bit_depth (unsigned int ci, unsigned int depth)
 set the bit depth of the ci-th component
 
bool is_packing () const
 return whether packing is enabled
 
void set_packing (bool enable=true)
 set the packing flag
 
unsigned int get_component_alignment () const
 return the component alignment in bits in the packed case and in bytes in the unpacked case
 
void set_component_alignment (unsigned int a)
 set the component alignment in bits in the packed case and in bytes in the unpacked case
 
int get_signed (unsigned int ci, const void *ptr) const
 return the ci-th component of the data entry pointed to by the given pointer of a signed packed component
 
unsigned int get_unsigned (unsigned int ci, const void *ptr) const
 return the ci-th component of the data entry pointed to by the given pointer of an unsigned packed component
 
bool set_signed (unsigned int ci, void *ptr, int v) const
 set the ci-th component of the data entry pointed to by the given pointer of a signed packed component
 
bool set_unsigned (unsigned int ci, void *ptr, unsigned int v) const
 set the ci-th component of the data entry pointed to by the given pointer of an unsigned packed component
 
bool operator== (const packing_info &pi) const
 equal comparison
 
bool operator!= (const packing_info &pi) const
 unequal comparison
 

Static Public Member Functions

static unsigned int align (unsigned int v, unsigned int a)
 return the next integer larger or equal to v which is dividable by a
 

Detailed Description

the packing_info class stores information about packed integers structures. It is typically used to define packed component formats. The stored information includes, whether packing is used, the alignment of the components and bit depths of up to 4 components. The aligment is an integer defining a multiple to which the components are aligned. If the alignment is 1, the components are packed densely. If it is for example 8, the components are stored at starting at locations that are multiples of 8. For example if the components have bit depth 6 and the alignment is 8, then the first component is stored starting with the first bit, the second component starting with the 8th bit and so on. In case no packing is used the alignment is measured in bytes. The bit depths and alignment are stored as unsigned integers with 6 bits, i.e. the maximum value is 63.

Constructor & Destructor Documentation

◆ packing_info()

cgv::data::packing_info::packing_info ( unsigned int  align = 1,
unsigned int  d0 = 0,
unsigned int  d1 = 0,
unsigned int  d2 = 0,
unsigned int  d3 = 0 
)

construct packed format with different bit depths

construct packing information from alignment and bit depths. If no bit depths are given, the components are not packed and the alignment is in bytes. If one or more depths are specified, the alignment is in bits. If exactly one depth is given, all component bit depths are set to this bit depth


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