MobileRT  1.0
A multi platform C++ CPU progressive Ray Tracer.
MobileRT::Texture Class Reference

#include <Texture.hpp>

Collaboration diagram for MobileRT::Texture:
Collaboration graph

Public Member Functions

 Texture ()=default
 
 Texture (::std::shared_ptr<::std::uint8_t > pointer, ::std::int32_t width, ::std::int32_t height, ::std::int32_t channels)
 
 Texture (const Texture &texture)=default
 
 Texture (Texture &&texture) noexcept=default
 
 ~Texture ()=default
 
Textureoperator= (const Texture &texture)=default
 
Textureoperator= (Texture &&texture) noexcept=default
 
::glm::vec3 loadColor (const ::glm::vec2 &texCoords) const
 
bool isValid () const
 
bool operator== (const Texture &texture) const
 

Static Public Member Functions

static Texture createTexture (::std::string &&texture, long size)
 
static Texture createTexture (const ::std::string &texturePath)
 

Private Attributes

::std::shared_ptr<::std::uint8_t > pointer_ {}
 
::std::uint8_t * image_ {}
 
::std::int32_t width_ {}
 
::std::int32_t height_ {}
 
::std::int32_t channels_ {}
 

Detailed Description

A texture of a material.
A texture is an image where each cell in the image represents the reflection of light in the object on an intersection point.

Constructor & Destructor Documentation

◆ Texture() [1/4]

MobileRT::Texture::Texture ( )
explicitdefault

◆ Texture() [2/4]

Texture::Texture ( ::std::shared_ptr<::std::uint8_t >  pointer,
::std::int32_t  width,
::std::int32_t  height,
::std::int32_t  channels 
)
explicit

The constructor.

Parameters
pointerA shared_ptr to the texture data.
widthThe width of the texture.
heightThe height of the texture.
channelsThe number of channels in the texture.

◆ Texture() [3/4]

MobileRT::Texture::Texture ( const Texture texture)
default

◆ Texture() [4/4]

MobileRT::Texture::Texture ( Texture &&  texture)
defaultnoexcept

◆ ~Texture()

MobileRT::Texture::~Texture ( )
default

Member Function Documentation

◆ createTexture() [1/2]

static Texture MobileRT::Texture::createTexture ( ::std::string &&  texture,
long  size 
)
static
Here is the caller graph for this function:

◆ createTexture() [2/2]

Texture Texture::createTexture ( const ::std::string &  texturePath)
static

A factory which loads a texture file and creates a new Texture.

Parameters
texturePathThe path to the texture file.
Returns
A new texture.
Here is the call graph for this function:

◆ isValid()

bool Texture::isValid ( ) const

Checks if the texture is valid or not.

Returns
Whether the texture is a valid one or not.

◆ loadColor()

glm::vec3 Texture::loadColor ( const ::glm::vec2 &  texCoords) const

Gets the color of a point in the texture.

Parameters
texCoordsThe texture coordinates.
Returns
The color of the point.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

Texture& MobileRT::Texture::operator= ( const Texture texture)
default

◆ operator=() [2/2]

Texture& MobileRT::Texture::operator= ( Texture &&  texture)
defaultnoexcept

◆ operator==()

bool Texture::operator== ( const Texture texture) const

The operator equals.

Parameters
textureA texture.
Returns
Whether both textures are equal.

Member Data Documentation

◆ channels_

::std::int32_t MobileRT::Texture::channels_ {}
private

◆ height_

::std::int32_t MobileRT::Texture::height_ {}
private

◆ image_

::std::uint8_t* MobileRT::Texture::image_ {}
private

◆ pointer_

::std::shared_ptr<::std::uint8_t> MobileRT::Texture::pointer_ {}
private

◆ width_

::std::int32_t MobileRT::Texture::width_ {}
private

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