Blue Brain BioExplorer
core::Texture2D Class Reference

#include <Texture2D.h>

Public Types

enum class  Type { default_ , cubemap , normal_roughness , aoe }
 

Public Member Functions

PLATFORM_API Texture2D (const Type type, const std::string &filename, const uint8_t channels, const uint8_t depth, const uint32_t width, const uint32_t height)
 
size_t getSizeInBytes () const
 
void setMipLevels (const uint8_t mips)
 
uint8_t getMipLevels () const
 
template<typename T >
const T * getRawData (const uint8_t face=0, const uint8_t mip=0) const
 
void setRawData (unsigned char *data, const size_t size, const uint8_t face=0, const uint8_t mip=0)
 
void setRawData (std::vector< unsigned char > &&rawData, const uint8_t face=0, const uint8_t mip=0)
 
uint8_t getPossibleMipMapsLevels () const
 
bool isCubeMap () const
 
bool isNormalMap () const
 
uint8_t getNumFaces () const
 
void setWrapMode (const TextureWrapMode mode)
 
TextureWrapMode getWrapMode () const
 

Public Attributes

const Type type
 
const std::string filename
 
const uint8_t channels
 
const uint8_t depth
 
const uint32_t width
 
const uint32_t height
 

Detailed Description

Definition at line 37 of file Texture2D.h.

Member Enumeration Documentation

◆ Type

enum core::Texture2D::Type
strong

Enum defining the types of textures.

Enumerator
default_ 
cubemap 
normal_roughness 
aoe 

Definition at line 43 of file Texture2D.h.

Constructor & Destructor Documentation

◆ Texture2D()

core::Texture2D::Texture2D ( const Type  type,
const std::string &  filename,
const uint8_t  channels,
const uint8_t  depth,
const uint32_t  width,
const uint32_t  height 
)

Constructor for Texture2D class.

Parameters
typeType of texture.
filenameFile name of the texture.
channelsNumber of channels in the texture.
depthDepth of the texture.
widthWidth of the texture.
heightHeight of the texture.

Definition at line 25 of file Texture2D.cpp.

Member Function Documentation

◆ getMipLevels()

uint8_t core::Texture2D::getMipLevels ( ) const
inline
Returns
The number of mip levels.

Definition at line 79 of file Texture2D.h.

◆ getNumFaces()

uint8_t core::Texture2D::getNumFaces ( ) const
inline
Returns
The number of faces of the texture.

Definition at line 131 of file Texture2D.h.

◆ getPossibleMipMapsLevels()

uint8_t core::Texture2D::getPossibleMipMapsLevels ( ) const
Returns
The possible number of mip maps levels.

Definition at line 58 of file Texture2D.cpp.

◆ getRawData()

template<typename T >
const T* core::Texture2D::getRawData ( const uint8_t  face = 0,
const uint8_t  mip = 0 
) const
inline

Get the raw data of the texture.

Parameters
faceFace of the texture.
mipMip level of the texture.
Returns
The raw data of the texture.

Definition at line 89 of file Texture2D.h.

◆ getSizeInBytes()

size_t core::Texture2D::getSizeInBytes ( ) const
inline
Returns
The size in bytes of the texture.

Definition at line 67 of file Texture2D.h.

◆ getWrapMode()

TextureWrapMode core::Texture2D::getWrapMode ( ) const
inline
Returns
The wrap mode of the texture.

Definition at line 143 of file Texture2D.h.

◆ isCubeMap()

bool core::Texture2D::isCubeMap ( ) const
inline
Returns
True if the texture is a cubemap.

Definition at line 121 of file Texture2D.h.

◆ isNormalMap()

bool core::Texture2D::isNormalMap ( ) const
inline
Returns
True if the texture is a normal map.

Definition at line 126 of file Texture2D.h.

◆ setMipLevels()

void core::Texture2D::setMipLevels ( const uint8_t  mips)

Set the number of mip levels for the texture.

Parameters
mipsNumber of mip levels to set.

Definition at line 38 of file Texture2D.cpp.

◆ setRawData() [1/2]

void core::Texture2D::setRawData ( std::vector< unsigned char > &&  rawData,
const uint8_t  face = 0,
const uint8_t  mip = 0 
)

Set the raw data of the texture.

Parameters
rawDataRaw data of the texture.
faceFace of the texture.
mipMip level of the texture.

Definition at line 53 of file Texture2D.cpp.

◆ setRawData() [2/2]

void core::Texture2D::setRawData ( unsigned char *  data,
const size_t  size,
const uint8_t  face = 0,
const uint8_t  mip = 0 
)

Set the raw data of the texture.

Parameters
dataRaw data of the texture.
sizeSize of the raw data.
faceFace of the texture.
mipMip level of the texture.

Definition at line 47 of file Texture2D.cpp.

◆ setWrapMode()

void core::Texture2D::setWrapMode ( const TextureWrapMode  mode)
inline

Set the wrap mode of the texture.

Parameters
modeWrap mode to set.

Definition at line 138 of file Texture2D.h.

Member Data Documentation

◆ channels

const uint8_t core::Texture2D::channels

Number of channels in the texture.

Definition at line 152 of file Texture2D.h.

◆ depth

const uint8_t core::Texture2D::depth

Depth of the texture.

Definition at line 155 of file Texture2D.h.

◆ filename

const std::string core::Texture2D::filename

File name of the texture.

Definition at line 149 of file Texture2D.h.

◆ height

const uint32_t core::Texture2D::height

Height of the texture.

Definition at line 161 of file Texture2D.h.

◆ type

const Type core::Texture2D::type

Type of the texture.

Definition at line 146 of file Texture2D.h.

◆ width

const uint32_t core::Texture2D::width

Width of the texture.

Definition at line 158 of file Texture2D.h.


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