utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
texture.cpp
1/*
2** ETIB PROJECT, 2026
3** utility
4** File description:
5** texture
6*/
7
8#include <utility/graphic/texture.hpp>
9
10namespace utility::graphic
11{
12 Texture::Texture(uint32_t width, uint32_t height, TextureType type)
13 : _type(type)
14 , _width(width)
15 , _height(height)
16 {
18 _pixels.resize(
19 width * height,
20 0); // Initialize pixel data with zeros (grayscale)
21 } else {
22 _pixels.resize(width * height * 4, 0);
23 }
24 }
25} // namespace utility::graphic
TextureType type() const noexcept
Retrieve the type of the texture.
Definition texture.hpp:119
TextureType
Describes the type of texture, such as albedo, normal, roughness, or font atlas.
Definition texture.hpp:32
uint32_t height() const
Retrieves the height of the texture.
Definition texture.hpp:90
Texture(uint32_t width, uint32_t height, TextureType type=TextureType::Albedo)
Constructs a Texture object with the specified width and height.
Definition texture.cpp:12
std::vector< uint8_t > _pixels
The corresponding pixel data for this texture, stored as a vector of bytes (RGBA format).
Definition texture.hpp:129
uint32_t width() const
Retrieves the width of the texture.
Definition texture.hpp:75