CamSim  0.0.0
A rasterization-based simulator for various types of cameras
Public Member Functions | List of all members
CamSim::TexData Class Reference

Provides convenient access to data stored in a texture. More...

Public Member Functions

 TexData ()
 Constructor. More...
 
 TexData (int w, int h, int channels, int type, const QByteArray &packedData, const QList< QString > &names=QList< QString >())
 Constructor for data given in main memory instead of texture memory. More...
 
 TexData (unsigned int tex, int cubeSide, int arrayLayer, int retrievalFormat, const QList< QString > &names=QList< QString >(), unsigned int pbo=0)
 Constructor for texture tex. Its data is retrieved immediately so that the OpenGL texture handle can be reused or deleted. See setTexture() for details. More...
 
void setTexture (unsigned int tex, int cubeSide, int arrayLayer, int retrievalFormat, const QList< QString > &names=QList< QString >(), unsigned int pbo=0)
 Set the texture tex to use. Its data is retrieved immediately so that the OpenGL texture handle can be reused or deleted. More...
 
int width () const
 Returns the texture width. More...
 
int height () const
 Returns the texture height. More...
 
int channels () const
 Returns the number of channels in the texture. More...
 
const QString & channelName (int channel) const
 Returns the name of the given channel (may be empty) More...
 
int type () const
 Returns the data type (depends on the retrieval format with which this object was created). Currently GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, or GL_FLOAT. More...
 
size_t typeSize () const
 Returns the size of the data type. More...
 
size_t packedElementSize () const
 Returns the size of one packed texture element (consisting of one or more components, depending on the channels (see packedData) More...
 
size_t packedLineSize () const
 Returns the size of one line of packed data (see packedData) More...
 
size_t packedDataSize () const
 Returns the size of the packed data (see packedData) More...
 
const void * packedData () const
 Return a pointer to the packed data. More...
 
const void * element (int x, int y, int c=0) const
 Return a pointer to the data element with coordinates x and y and the channel number c. More...
 
size_t planarElementSize () const
 Returns the size of one planar texture element (consisting of only one components). This is the same as typeSize(). See planarData. More...
 
size_t planarLineSize () const
 Returns the size of one line of planar data (see planarData) More...
 
size_t planarColumnSize () const
 Returns the size of one column of planar data (see planarData) More...
 
size_t planarDataSize () const
 Returns the size of the planar data (see planarData) More...
 
QByteArray planarDataArray (int channel) const
 Return the planar data for the given channel as a byte array. More...
 
QByteArray transposedPlanarDataArray (int channel) const
 Return the transposed planar data for the given channel as a byte array. More...
 

Detailed Description

Provides convenient access to data stored in a texture.

Constructor & Destructor Documentation

◆ TexData() [1/3]

CamSim::TexData::TexData ( )

Constructor.

◆ TexData() [2/3]

CamSim::TexData::TexData ( int  w,
int  h,
int  channels,
int  type,
const QByteArray &  packedData,
const QList< QString > &  names = QList< QString >() 
)

Constructor for data given in main memory instead of texture memory.

◆ TexData() [3/3]

CamSim::TexData::TexData ( unsigned int  tex,
int  cubeSide,
int  arrayLayer,
int  retrievalFormat,
const QList< QString > &  names = QList< QString >(),
unsigned int  pbo = 0 
)

Constructor for texture tex. Its data is retrieved immediately so that the OpenGL texture handle can be reused or deleted. See setTexture() for details.

Member Function Documentation

◆ channelName()

const QString& CamSim::TexData::channelName ( int  channel) const
inline

Returns the name of the given channel (may be empty)

◆ channels()

int CamSim::TexData::channels ( ) const
inline

Returns the number of channels in the texture.

◆ element()

const void* CamSim::TexData::element ( int  x,
int  y,
int  c = 0 
) const
inline

Return a pointer to the data element with coordinates x and y and the channel number c.

◆ height()

int CamSim::TexData::height ( ) const
inline

Returns the texture height.

◆ packedData()

const void* CamSim::TexData::packedData ( ) const
inline

Return a pointer to the packed data.

Packed means that for every texture element all channels are stored together (in planar format, they are separated).

◆ packedDataSize()

size_t CamSim::TexData::packedDataSize ( ) const
inline

Returns the size of the packed data (see packedData)

◆ packedElementSize()

size_t CamSim::TexData::packedElementSize ( ) const
inline

Returns the size of one packed texture element (consisting of one or more components, depending on the channels (see packedData)

◆ packedLineSize()

size_t CamSim::TexData::packedLineSize ( ) const
inline

Returns the size of one line of packed data (see packedData)

◆ planarColumnSize()

size_t CamSim::TexData::planarColumnSize ( ) const
inline

Returns the size of one column of planar data (see planarData)

◆ planarDataArray()

QByteArray CamSim::TexData::planarDataArray ( int  channel) const

Return the planar data for the given channel as a byte array.

Planar means that the data contains only the given channel.

◆ planarDataSize()

size_t CamSim::TexData::planarDataSize ( ) const
inline

Returns the size of the planar data (see planarData)

◆ planarElementSize()

size_t CamSim::TexData::planarElementSize ( ) const
inline

Returns the size of one planar texture element (consisting of only one components). This is the same as typeSize(). See planarData.

◆ planarLineSize()

size_t CamSim::TexData::planarLineSize ( ) const
inline

Returns the size of one line of planar data (see planarData)

◆ setTexture()

void CamSim::TexData::setTexture ( unsigned int  tex,
int  cubeSide,
int  arrayLayer,
int  retrievalFormat,
const QList< QString > &  names = QList< QString >(),
unsigned int  pbo = 0 
)

Set the texture tex to use. Its data is retrieved immediately so that the OpenGL texture handle can be reused or deleted.

If cubeSide is greater than or equal to zero, then tex is assumed to be a cube map and the specified cube side is used. Otherwise (cubeSide is less than zero), tex is assumed to be a standard 2D texture.

If arrayLayer is greater than or equal to zero, then tex is assumed to be an array texture and the specified layer is used. Otherwise (arrayLayer is less than zero), tex is assumed to be a standard 2D texture.

Retrieval of data is done in the format suggested by retrievalFormat, which can be one of GL_R8, GL_RG8 GL_RGB8, GL_RGBA8, GL_R32F, GL_RG32F, GL_RGB32F, GL_RGBA32F, GL_R32UI, GL_RG32UI, GL_RGB32UI, GL_RGBA32UI.

Optionally each channel in the texture can be assigned a name. This will be used by the Exporter class, depending on the file format. For example, for Matlab *.mat files, the name will be used as the corresponding variable name.

Optionally a pixel buffer object (pbo) is used to transfer the data, for potentially better performance.

◆ transposedPlanarDataArray()

QByteArray CamSim::TexData::transposedPlanarDataArray ( int  channel) const

Return the transposed planar data for the given channel as a byte array.

Planar means that the data contains only the given channel.

◆ type()

int CamSim::TexData::type ( ) const
inline

Returns the data type (depends on the retrieval format with which this object was created). Currently GL_UNSIGNED_BYTE, GL_UNSIGNED_INT, or GL_FLOAT.

◆ typeSize()

size_t CamSim::TexData::typeSize ( ) const

Returns the size of the data type.

◆ width()

int CamSim::TexData::width ( ) const
inline

Returns the texture width.


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