Engine::Graphics::Texture2D

Module: An example game engine / Graphical related classes

#include <Texture2D.hpp>

Inherits from Engine::Graphics::Texture, Engine::Graphics::Handle

Public Functions

Name
Texture2D(int width, int height, uint8_t * data, Texture::Type type =Texture::Type::RGBA8)
virtual ~Texture2D()
virtual int getWidth() const override
Returns the width of the texture in pixels.
virtual int getHeight() const override
Returns the height of the texture in pixels.
virtual int getDepth() const override
Returns the depth of the texture in pixels.

Additional inherited members

Public Types inherited from Engine::Graphics::Texture

Name
enum class Type { UNKNOWN, RGBA_8, RGB_8, RGBA_16, RGB_16, RGBA_32, RGB_32}

Public Functions inherited from Engine::Graphics::Texture

Name
Texture(Type type)
virtual ~Texture() =default
bool isLoaded() const

Protected Attributes inherited from Engine::Graphics::Texture

Name
bool loaded
Type type

Public Functions inherited from Engine::Graphics::Handle

Name
Handle() =default
virtual ~Handle() =default
int getHandle() const

Protected Attributes inherited from Engine::Graphics::Handle

Name
int handle

Public Functions Documentation

function Texture2D

Texture2D(
    int width,
    int height,
    uint8_t * data,
    Texture::Type type =Texture::Type::RGBA8
)

Parameters:

  • data The pointer to the raw pixels data
  • width The width of the image held by the data pointer
  • height The height of the image held by the data pointer
  • type What is the type of this pixels array?

function ~Texture2D

virtual ~Texture2D()

function getWidth

virtual int getWidth() const override

Returns the width of the texture in pixels.

Return: Width in pixels

Reimplements: Engine::Graphics::Texture::getWidth

function getHeight

virtual int getHeight() const override

Returns the height of the texture in pixels.

Return: Height in pixels

Reimplements: Engine::Graphics::Texture::getHeight

function getDepth

virtual int getDepth() const override

Returns the depth of the texture in pixels.

Return: Depth in pixels

Note: If this texture is 2D the depth is always 1 pixels

Reimplements: Engine::Graphics::Texture::getDepth


Updated on 2021-10-12 at 20:06:42 +0000