15 : width(_width), height(_height), texture(_width, _height, _format) {}
17 Color read(
int x,
int y) {
18 switch (this->texture.
format) {
20 return Color(texture.
image[x * 3 + y * width * 3],
21 texture.
image[x * 3 + y * width * 3 + 1],
22 texture.
image[x * 3 + y * width * 3 + 2]);
25 const auto depth = texture.
image[x + y * width];
26 return Color(depth, depth, depth);
29 return Color(0, 0, 0);
32 void write(
int x,
int y,
Color color) {
33 switch (this->texture.
format) {
35 texture.
image[x * 3 + y * width * 3] = color.
x;
36 texture.
image[x * 3 + y * width * 3 + 1] = color.
y;
37 texture.
image[x * 3 + y * width * 3 + 2] = color.
z;
41 texture.
image[x + y * width] = color.
x;
The 2D texture class.
Definition Texture.hpp:17
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