1
Fork 0
raytracer/include/image.h

22 lines
399 B
C
Raw Normal View History

2020-02-17 10:33:56 -05:00
#pragma once
2020-05-13 17:19:21 -04:00
#include <array>
2022-08-16 07:41:12 -04:00
#include <glm/glm.hpp>
2020-02-17 10:33:56 -05:00
2022-08-16 07:41:12 -04:00
template<class T, int Width, int Height> class Image {
2020-02-17 10:33:56 -05:00
public:
2020-05-13 17:19:21 -04:00
void reset() {
array = {};
}
2022-08-16 07:41:12 -04:00
2020-02-17 10:33:56 -05:00
T& get(const int32_t x, const int32_t y) {
return array[y * Width + x];
}
2022-08-16 07:41:12 -04:00
2020-02-17 10:33:56 -05:00
T get(const int32_t x, const int32_t y) const {
return array[y * Width + x];
}
2022-08-16 07:41:12 -04:00
std::array<T, Width* Height> array = {};
2020-02-17 10:33:56 -05:00
};