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.hpp
1/*
2** ETIB PROJECT, 2026
3** utility
4** File description:
5** texture
6*/
7
8#pragma once
9
10#include <string>
11#include <vector>
12#include <cstdint>
13
14namespace utility::graphic
15{
25 class Texture
26 {
27 public:
32 enum class TextureType {
33 Albedo,
35 Normal,
37 Roughness,
41 };
42
57 Texture(uint32_t width, uint32_t height,
59
63 ~Texture() = default;
64
75 [[nodiscard]] uint32_t width() const
76 {
77 return _width;
78 }
79
90 [[nodiscard]] uint32_t height() const
91 {
92 return _height;
93 }
94
100 [[nodiscard]] const std::vector<uint8_t> &pixels() const noexcept
101 {
102 return _pixels;
103 }
104
110 [[nodiscard]] std::vector<uint8_t> &pixels() noexcept
111 {
112 return _pixels;
113 }
114
119 [[nodiscard]] TextureType type() const noexcept
120 {
121 return _type;
122 }
123
124 protected:
129 std::vector<uint8_t> _pixels;
130
135
139 uint32_t _width;
140
144 uint32_t _height;
145 };
146} // namespace utility::graphic
The Texture class represents a texture resource that can be used for rendering in a graphics applicat...
Definition texture.hpp:26
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
~Texture()=default
Destructs the Texture object.
uint32_t height() const
Retrieves the height of the texture.
Definition texture.hpp:90
uint32_t _width
The width of the texture in pixels.
Definition texture.hpp:139
std::vector< uint8_t > _pixels
The corresponding pixel data for this texture, stored as a vector of bytes (RGBA format).
Definition texture.hpp:129
const std::vector< uint8_t > & pixels() const noexcept
Retrieve the pixel data.
Definition texture.hpp:100
std::vector< uint8_t > & pixels() noexcept
Retrieve the pixel data for mutation.
Definition texture.hpp:110
uint32_t _height
The height of the texture in pixels.
Definition texture.hpp:144
uint32_t width() const
Retrieves the width of the texture.
Definition texture.hpp:75
TextureType _type
The type of the texture.
Definition texture.hpp:134