Class Texture

Class Documentation

class Texture

This class represents a texture.

Public Functions

Texture()

Constructor.

Texture(int index, unsigned short int width, unsigned short int height, unsigned char numChannels, unsigned char numBytesPerChan, float texelSize, unsigned char *data = nullptr, std::string layer = "default")

Constructor.

Texture(int index, GlTexture *oldTexture)

Constructor.

Texture(Texture &&other)

Constructor.

Texture(const Texture &other)

Constructor.

Texture &operator=(const Texture &other)
Texture &operator=(Texture &&other)
virtual ~Texture()

Destructor.

void save(const std::string &file_name = "")

Writes the texture to an image file.

If no filename is provided, file will be called texture_<INDEX>.ppm

Public Members

int m_index

Texture index.

unsigned short int m_width

The dimensions of the texture.

unsigned short int m_height
unsigned char *m_data

The texture data.

unsigned char m_numChannels

The number of color channels.

unsigned char m_numBytesPerChan

The number of bytes per channel.

float m_texelSize

The size of a texture pixel.

std::string m_layerName

The layer name of this texture.