t
Loading...
Searching...
No Matches
Texture.hpp
1#include "constants.hpp"
2#include <memory>
3
4#ifndef TEXTURE_HPP
5#define TEXTURE_HPP
6
7namespace t {
8
17template <class BufferType> class Texture {
18public:
19 int width;
20 int height;
22 std::vector<BufferType> image;
27 Texture(int _width, int _height, TextureFormat _format)
28 : image(std::vector<BufferType>(_width * _height *
29 static_cast<int>(_format))),
30 width(_width), height(_height), format(_format) {}
31
40 Texture(std::vector<BufferType> &_image, int _width, int _height,
41 TextureFormat _format)
42 : image(_image), width(_width), height(_height), format(_format) {}
43};
44
45} // namespace t
46
47#endif // TEXTURE_HPP
The 2D texture class.
Definition Texture.hpp:17
Texture(std::vector< BufferType > &_image, int _width, int _height, TextureFormat _format)
Creates a new texture with the given image data, width, height, and format.
Definition Texture.hpp:40
int width
The width of the texture in pixels.
Definition Texture.hpp:19
Texture(int _width, int _height, TextureFormat _format)
Creates a new texture with the given width, height, and format.
Definition Texture.hpp:27
int height
The height of the texture in pixels.
Definition Texture.hpp:20
std::vector< BufferType > image
The image data of the texture.
Definition Texture.hpp:22
TextureFormat format
The format of the texture.
Definition Texture.hpp:21
Contains various constants and enumerations.
The t software 3D graphics library namespace.
Definition algorithms.hpp:12
TextureFormat
The texture format.
Definition constants.hpp:28