33 lines
663 B
C++
33 lines
663 B
C++
|
|
#ifndef RENDERTARGET_H
|
|
#define RENDERTARGET_H
|
|
|
|
#include "fastmath.hpp"
|
|
class Rendertarget {
|
|
|
|
public:
|
|
const int width;
|
|
const int height;
|
|
|
|
Rendertarget(int width, int height) : width(width), height(height) {
|
|
pixels = new decimal[width * height * 3];
|
|
}
|
|
|
|
void set(int x, int y, vec3 val) {
|
|
int start = (width * y + x) * 3;
|
|
for (int i = 0; i < 3; i++) {
|
|
pixels[start + i] = val[i];
|
|
}
|
|
}
|
|
void get(int x, int y, vec3 *val) {
|
|
int start = (width * y + x) * 3;
|
|
for (int i = 0; i < 3; i++) {
|
|
(*val)[i] = pixels[start + i];
|
|
}
|
|
}
|
|
|
|
decimal *pixels;
|
|
};
|
|
|
|
#endif
|